You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/02/26 22:28:47 UTC
DO NOT REPLY [Bug 6693] New: -
XSLTC xsl:sort does not work with nodeset variables
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=6693>.
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=6693
XSLTC xsl:sort does not work with nodeset variables
Summary: XSLTC xsl:sort does not work with nodeset variables
Product: XalanJ2
Version: 2.3Dx
Platform: Other
OS/Version: Other
Status: NEW
Severity: Minor
Priority: Other
Component: org.apache.xalan.xsltc
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: tim_elcott@bigfoot.com
When saving a nodeset in a variable to reuse throughout a stylesheet any use of
an xsl:sort within a xsl:for-each block results in zero nodes. This xsl:for-
each block works fine without the xsl:sort statement. This works fine with
Saxon 6.5. The example below shows the problem. Only <Name2> elements are
produced in the output.
There is a workaround - If you replace the nodeset variable with its actual
select statement it works fine. Would using the same select statement multiple
time cause a performance problem when using complex XPath expressions?
-- Simple Test Stylesheet -----------------------------------------------
-------------------------------------------------------------------------
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
>
<xsl:variable name='nodes' select="/MyNodes/Node[ID='1']"/>
<xsl:template match="/">
<!-- This does not produce any output -->
<xsl:for-each select="$nodes">
<xsl:sort select="Name"/>
<Name1><xsl:value-of select="Name"/></Name1>
</xsl:for-each>
<!-- This works -->
<xsl:for-each select="$nodes">
<Name2><xsl:value-of select="Name"/></Name2>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
-- Simple Test XML File-- -----------------------------------------------
-------------------------------------------------------------------------
<MyNodes>
<Node>
<ID>1</ID>
<Name>Tim</Name>
</Node>
<Node>
<ID>1</ID>
<Name>Leanne</Name>
</Node>
<Node>
<ID>2</ID>
<Name>John</Name>
</Node>
</MyNodes>