[
https://issues.apache.org/jira/browse/XALANJ-2504?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Henry Zongaro resolved XALANJ-2504.
-----------------------------------
Resolution: Duplicate
Duplicate of XALANJ-2308.
> key function not working on trees that have been created by using
> exsl:node-set function on result tree fragment
> ----------------------------------------------------------------------------------------------------------------
>
> Key: XALANJ-2504
> URL: https://issues.apache.org/jira/browse/XALANJ-2504
> Project: XalanJ2
> Issue Type: Bug
> Security Level: No security risk; visible to anyone(Ordinary problems in
> Xalan projects. Anybody can view the issue.)
> Components: XSLTC
> Affects Versions: 2.7.1
> Environment: Windows XP Professional SP 3, Sun Java JRE 6 (1.6)
> Reporter: Martin Honnen
>
> The key function is not working properly on trees that have been created by
> converting a result tree fragment to a node-set with the extension function
> exsl:node-set. Instead of returning the nodes with the passed in key value it
> looks as if an empty node-set is returned.
> Details:
> With the XSLT stylesheet being
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:exsl="http://exslt.org/common"
> exclude-result-prefixes="exsl"
> version="1.0">
>
> <xsl:output indent="yes"/>
>
> <xsl:key name="k1" match="foo" use="bar"/>
>
> <xsl:template match="/">
> <html lang="en">
> <head>
> <title>Test case</title>
> </head>
> <body>
> <h1>Test case</h1>
> <xsl:variable name="rtf1">
> <foo><bar>1</bar></foo>
> <foo><bar>1</bar></foo>
> <foo><bar>2</bar></foo>
> </xsl:variable>
> <p>The count should be 2.
> <xsl:for-each select="exsl:node-set($rtf1)">
> <xsl:variable name="c" select="count(key('k1', '1'))"/>
> Count returned is <xsl:value-of select="$c"/>.
> <xsl:choose>
> <xsl:when test="$c = 2">
> <xsl:text>Test succeeded.</xsl:text>
> </xsl:when>
> <xsl:otherwise><xsl:text>Test failed.</xsl:text></xsl:otherwise>
> </xsl:choose>
> </xsl:for-each>
> </p>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
> the output (when run against any XML input) with Xalan interpreter of Saxon
> is as follows:
> <html lang="en">
> <head>
> <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <title>Test case</title>
> </head>
> <body>
> <h1>Test case</h1>
> <p>The count should be 2.
> Count returned is 2.
> Test succeeded.</p>
> </body>
> </html>
> so the number of nodes returned by the call key('k1', '1') is 2 as it should
> be.
> When I run with Xalan XSLTC then the output is
> <html lang="en">
> <head>
> <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <title>Test case</title>
> </head>
> <body>
> <h1>Test case</h1>
> <p>The count should be 2.
> Count returned is 0.
> Test failed.</p>
> </body>
> </html>
> so the number of nodes returned by the call key('k1', '1') is 0 which is a
> bug.
> This bug is quite a problem any time you want to use keys (e.g. with
> Muenchian grouping) on temporary results created by converting a result tree
> fragment to a node-set with the help of exsl:node-set.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]