You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by xa...@xml.apache.org on 2004/09/06 07:57:37 UTC

[jira] Updated: (XALANJ-1189) Null pointer exception with XPath $foo[position() > 1]

The following issue has been updated:

    Updater: Brian Minchau (mailto:minchau@ca.ibm.com)
       Date: Sun, 5 Sep 2004 10:57 PM
    Changes:
             description changed from 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() &gt; 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> to 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() &gt; 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() &gt; 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>
             environment changed from Operating System: Windows XP
Platform: PC to Operating System: Windows XP
Platform: PC
             priority changed to Blocker
             Component changed to XPath
             Component changed from Xalan-interpretive transformation
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/XALANJ-1189?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XALANJ-1189

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XALANJ-1189
    Summary: Null pointer exception with XPath $foo[position() &gt; 1]
       Type: Bug

     Status: Open
   Priority: Blocker

    Project: XalanJ2
 Components: 
             XPath
   Versions:
             CurrentCVS

   Assignee: Arun Yadav
   Reporter: Curt Arnold

    Created: Thu, 19 Sep 2002 3:01 AM
    Updated: Sun, 5 Sep 2004 10:57 PM
Environment: Operating System: Windows XP
Platform: PC

Description:
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() &gt; 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() &gt; 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>


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org