xsl:if test for null string giving TransformerException

Discussion in 'XML' started by Robert Kattke, Apr 8, 2004.

  1. I'm getting a TransformerException when running Tomcat and calling a
    Servlet that use XML to create DOM and XSL to create webpage.

    I'm posting just the snippet of XSL code and the Error here. Full
    listing should be in my next thread. Funny thing is from a command
    line I can run Process without an error. Why would Tomcat hiccup and
    belch ?
    Maybe I should be investigating my JARs in the classpath ?
    *** note error occurring in ln 65 ***

    <xsl:choose>
    65 <xsl:when test="site = ''">
    <xsl:text>N/A</xsl:text>
    </xsl:when>
    <xsl:eek:therwise>
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="site"/>
    </xsl:attribute>Website
    </a>
    </xsl:eek:therwise>

    </xsl:choose>

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ; SystemID: ; Line#: 65; Column#: 34
    javax.xml.transform.TransformerException: Unknown error in XPath
    at org.apache.xpath.XPath.bool(XPath.java:411)
    at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:162)
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2182)at
    .... xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:678)
    ...

    ....
    ....
    ....

    at org.apache.xpath.objects.XNodeSet.compare(XNodeSet.java:619)
    at org.apache.xpath.objects.XNodeSet.equals(XNodeSet.java:706)
    at org.apache.xpath.operations.Equals.operate(Equals.java:82)
    at org.apache.xpath.operations.Operation.execute(Operation.java:146)
    at org.apache.xpath.Expression.bool(Expression.java:208)
    at org.apache.xpath.XPath.bool(XPath.java:388)
    ... 66 more
    ---------
    java.lang.NullPointerException

    Maybe there is a better way to check for blank or null string.
    TIA for you suggestions and references.
    Robert Kattke, Apr 8, 2004
    #1
    1. Advertising

  2. > I'm getting a TransformerException when running Tomcat and calling a
    > Servlet that use XML to create DOM and XSL to create webpage.
    > 65 <xsl:when test="site = ''"> Error on this line


    Also tried this variation
    <xsl:when test="string-length(site) > 0">

    still getting:
    ; SystemID: ; Line#: 65; Column#: 48
    javax.xml.transform.TransformerException: Unknown error in XPath

    Help - something must not be configured right on my system.
    Robert Kattke, Apr 9, 2004
    #2
    1. Advertising

  3. <xsl:when test="string-length(site) > 0"> Error here

    > Help - something must not be configured right on my system.

    How would I check what actual jar's are being used by Tomcat 4.0.4 on
    WXP ?
    I'm assumming check my master environment variables and then analyze
    the batch files ( possibly using echo to see the classpath ).
    Robert Kattke, Apr 21, 2004
    #3
    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. veny
    Replies:
    0
    Views:
    527
  2. Replies:
    0
    Views:
    387
  3. Replies:
    1
    Views:
    3,589
    A. Bolmarcich
    May 27, 2005
  4. Abdelhalim
    Replies:
    2
    Views:
    1,033
    Tom Hawtin
    Jul 6, 2007
  5. sixteenmillion

    The giving that keeps on giving

    sixteenmillion, Nov 19, 2007, in forum: C Programming
    Replies:
    0
    Views:
    417
    sixteenmillion
    Nov 19, 2007
Loading...

Share This Page