JAXP / Xalan / data-types problem

F

Felix Engelhardt

Hi there,

I'm having a problem compiling an XSL-stylesheet using JAXP/Xalan which is
really driving me nuts...

When I try to compile a stylesheet that contains something like:

<xsl:value-of select="encode-for-uri(/bla)"/>

then I get a TransformerConfigurationException saying that there was an
error while checking the type of the expression "funcall(encode-for-uri
....)". I don't know the exact error message, as the message I get is in
German for some reason (literally it says "Fehler beim Überprüfen des Typs
des Ausdrucks").

I suppose that the reason for this is that encode-for-uri returns an
xs:string and @select expects a node-set, and it cannot convert between the
two.

If anybody knows how to solve this problem, please let me know, as I've
already spent a few hours on this and I'm really frustrated ;-).

Regards,

Felix
 
F

Felix Engelhardt

Found a solution:
The problem was that Xalan does not support XSLT 2.0 nor XPath 2.0 (though
it seems to support some of the 2.0 features and does not complain about the
stylesheet being declared as 2.0). So I just switched to Saxon. In order to
tell JAXP to use Saxon instead of Xalan for transformation, I just had to
insert the following line into my initialization code (and include the Saxon
libraries in my classpath, of course):

System.setProperty("javax.xml.transform.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl");

Surprisingly, it was pretty hard to find this information on the web... The
Saxon documentation states that normally this shouldn't be necessary, but
obviously it was for my web app on Tomcat.

Best regards,

Felix
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,227
Latest member
Daniella65

Latest Threads

Top