[jcifs] XSLT

eglass1 at comcast.net eglass1 at comcast.net
Thu May 27 10:32:53 GMT 2004





> 
> I'm not sure. I'm using the builtin 'style' task of Ant 4 with the
> optional jar. From reading the docs which processor you use is highly
> dependant on what is in the CLASSPATH and what loads. So I'm not sure how
> to decipher what's going on.
> 

If you're using JDK 1.4, it is likely using Xalan.  You can confirm this by typing:

java org.apache.xalan.xslt.Process

and seeing if anything happens (this should invoke the command line XSLT
processor).

I can confirm that Xalan will do this with output method html, but only to
attributes it recognizes as URLs; i.e., if you pass in a document:

<html>
    <a href="http://foo/stuff&amp;more">test</a>
    <foo href="http://foo/stuff&amp;more">test</foo>
</html>

you get:

<html>
    <a href="http://foo/stuff&more">test</a>
    <foo href="http://foo/stuff&amp;more">test</foo>
</html>

I don't know if this is conformant to the XSLT spec or not; I suspect this is
done to accommodate browsers that don't convert &amp; --> & when
parsing the URL maybe?

In any case, you could force output method xml with:

<xsl:output method="xml"/>

which will cause it to output as &amp;.  Of course, it will also output
well-formed XML rather than HTML, which may cause a bunch of other issues.

> Another problem I have is that passing params into the transform does not
> appear to work. I know I'm doing it right as the same technique is used by
> XT which I've used stand-alone for some time. The processor must not
> support them. That's going to need to work in the near future.
> 

I know Xalan does, and it appears to work properly with the Ant style
task (using Ant 1.6.1, results may vary for older versions):

<style style="test.xsl" in="test.xml" out="testout.xml">
    <param name="myparam" expression="myvalue"/>
</style>

Then just declare "myparam" in the stylesheet:

<xsl:param name="myparam" select="''"/>

and use it later:

<xsl:value-of select="$myparam"/>

What behavior are you seeing?  Do you get an error, or just no value output?


Eric


More information about the jcifs mailing list