JAXP / Xalan / data-types problem

Discussion in 'Java' started by Felix Engelhardt, Apr 17, 2006.

  1. 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
     
    Felix Engelhardt, Apr 17, 2006
    #1
    1. Advertising

  2. 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
     
    Felix Engelhardt, Apr 18, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tobi Krausl
    Replies:
    0
    Views:
    675
    Tobi Krausl
    Nov 20, 2003
  2. cvissy
    Replies:
    0
    Views:
    637
    cvissy
    Nov 16, 2004
  3. ramu
    Replies:
    2
    Views:
    345
    rlblaster
    Feb 20, 2006
  4. Gary Roach
    Replies:
    0
    Views:
    124
    Gary Roach
    Sep 1, 2013
  5. Fábio Santos
    Replies:
    0
    Views:
    138
    Fábio Santos
    Sep 4, 2013
Loading...

Share This Page