You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2006/10/11 00:51:23 UTC
[jira] Commented: (XALANJ-2324) XPath function last() gives wrong
result when select has a predicate
[ http://issues.apache.org/jira/browse/XALANJ-2324?page=comments#action_12441303 ]
Brian Minchau commented on XALANJ-2324:
---------------------------------------
A fix for this bug is needed because of a regression caused by the fix in xalanj-2204
We could just pull that fix out and we wouldn't need to do anything. But xalanj-2204 is needed to fix a regression caused by the fix in xalanj-1810.
So we could just pull that fix out and .... but wait, xalanj-1810 must have fixed something ....
> XPath function last() gives wrong result when select has a predicate
> --------------------------------------------------------------------
>
> Key: XALANJ-2324
> URL: http://issues.apache.org/jira/browse/XALANJ-2324
> Project: XalanJ2
> Issue Type: Bug
> Components: Xalan-interpretive, XPath-function
> Affects Versions: Latest Development Code
> Reporter: Brian Minchau
>
> Here is the testcase, the input XML is this:
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
> <author>
> <firstname>Bugs</firstname>
> <initial>B</initial>
> <lastname>Gone</lastname>
> </author>
> </project>
> The stylesheet is this:
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="text" encoding="UTF-8"/>
>
> <xsl:template match="author">
> <xsl:for-each select='(child::*)[not(self::initial)]'>
> Child element <xsl:value-of select="position()"/>
> of <xsl:value-of select="last()"/>
> Element name: <xsl:value-of select="name()"/>
> </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
> The current, and incorrect output is this:
> Child element 1
> of 3
> Element name: firstname
> Child element 2
> of 3
> Element name: lastname
> The selected elements are correct, but the last() function is returning 3 rather than 2.
> If the for-each is changed to this:
> <xsl:for-each select='(child::*)[not(self::junk)]'>
> it iterates over the 3 children correctly (there is no child named 'junk' so the predicate does not reduce the sequence selected by (child::*), but in this case last() returns 4. In both cases one greater than it should.
> With no predicate things work fine.
--
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
-
For more information on JIRA, 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