DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12797>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12797 Null pointer exception with XPath $foo[position() > 1] Summary: Null pointer exception with XPath $foo[position() > 1] Product: XalanJ2 Version: CurrentCVS Platform: PC OS/Version: Windows XP Status: NEW Severity: Normal Priority: Other Component: org.apache.xalan.transformer AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The attached file will cause a null pointer exception in the current Xalan CVS and many previous releases. It can be eliminated by rewriting the XPath to avoid the [position() > 1] clause if I remember correctly. Transform <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- match document root --> <xsl:template match="/"> <xsl:variable name="exceptions" select="//exception[@id]"/> <xsl:if test="$exceptions"> <xsl:text>| assert</xsl:text> <xsl:value-of select="$exceptions[1]/@name"/> <xsl:for-each select="$exceptions[position() > 1]"> <xsl:text>| assert</xsl:text> <xsl:value-of select="@name"/> </xsl:for-each> </xsl:if> </xsl:template> </xsl:stylesheet> Test document <spec> <exception id="foo" name="foo"/> <exception id="bar" name="bar"/> </spec>
