Re: [xsl] NullPointerException?

Subject: Re: [xsl] NullPointerException?
From: Peter Davis <pdavis152@xxxxxxxxx>
Date: Thu, 31 Jan 2002 18:43:03 -0800
I don't see any obvious errors in there, but you might try the changes I gave 
in a response to one of your other emails.  Since you are using Xalan, you 
might try running your stylesheet with org.apache.xalan.xslt.Process (if you 
aren't already) and give it the -TT, -TTC, -TG, and/or -TS command line 
options.  These will spit out trace information (-TT and -TTC are probably 
the most useful) that will let you figure out where in your stylesheet the 
problem occurs.  Could you post the results here?

On Tuesday 29 January 2002 12:33, Jay Burgess wrote:
> After upgrading my version of Xalan yesterday, I've started having null
> pointer exceptions in a Java app doing XSL transformation.  Since I'm still
> somewhat new to XSL, I assume the problem is in my XSL, not with
> Xalan.  First, here's the stack trace:
>
>       [java] javax.xml.transform.TransformerException:
> java.lang.NullPointerException
>       [java]     at
> org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.
>java:1230) [java]     at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java
>:642) [java]     at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java
>:1092) [java]     at
> org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java
>:1070) [java]     at XMLConfig.traverse(XMLConfig.java:172)
>       [java]     at XMLConfig.traverse(XMLConfig.java:177)
>       [java]     at XMLConfig.traverse(XMLConfig.java:177)
>       [java]     at XMLConfig.main(XMLConfig.java:46)
>
> The template is below (it's a simple escape/encode routine for name/value
> pairs in the query string of a URL). From my preliminary debugging, it
> appears that the line "<xsl:with-param name="inString"
> select="string($value1)"/>" is the culprit. It's almost as though value2 is
> trying to set itself before value1 has been fully defined.  Is this
> possible?  If so, do you see any obvious errors in or workarounds for my
> code?
>
> <xsl:template name="param">
>      <xsl:variable name="value1">
>          <xsl:call-template name="encode">
>              <xsl:with-param name="inString" select="string(.)"/>
>              <xsl:with-param name="oldChars" select="'%'"/>
>              <xsl:with-param name="newChars" select="'%25'"/>
>          </xsl:call-template>
>      </xsl:variable>
>      <xsl:variable name="value2">
>          <xsl:call-template name="encode">
>              <xsl:with-param name="inString" select="string($value1)"/>
>              <xsl:with-param name="oldChars" select="' '"/>
>              <xsl:with-param name="newChars" select="'%20'"/>
>          </xsl:call-template>
>      </xsl:variable>
>      <xsl:text>"&#38;</xsl:text><xsl:value-of
> select="@name"/><xsl:text>="</xsl:text><xsl:value-of select="$value2"/>
> </xsl:template>
>
> Thanks in advance.
>
> Jay
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

-- 
Peter Davis
If only one could get that wonderful feeling of accomplishment without
having to accomplish anything.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread