[ 
http://issues.apache.org/jira/browse/XALANJ-2180?page=comments#action_12317558 
] 

David Bertoni commented on XALANJ-2180:
---------------------------------------

This has nothing to do with xsl:sort, which you can see if you remove the 
xsl:sort child from the xsl:for-each.  That also produces no output.

The bug is in your stylesheet, in the XPath expression in the xsl:for-each 
select attribute.  You are selecting elements with the local name "bar" and the 
namespace URI "http://www.w3.org/1999/XSL/Transform";, but the elements you 
create in the variable have a local name of "bar" and an empty namespace URI.

You can either change the selection expression:

<xsl:for-each select="xalan:nodeset($foo)/bar"> 

or create the elements in XSL namespace, if that's what you really want:

<xsl:element name="bar" namespace="http://www.w3.org/1999/XSL/Transform";> 


> xsl:sort does not work with nodeset variables
> ---------------------------------------------
>
>          Key: XALANJ-2180
>          URL: http://issues.apache.org/jira/browse/XALANJ-2180
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan
>     Versions: CurrentCVS
>  Environment: Java Plug-in 1.5.0_04 creates DocumentBuilderFactory, 
> TransformerFactory, Transformer objects etc. using newInstance() methods.
>     Reporter: dcaveney
>  Attachments: sortbug.xsl
>
> The symptoms I'm seeing are the same as in issue #Xalanj-860 but I can't use 
> the same workaround. A template creates some elements within a variable, and 
> then tries to sort the resulting nodeset. The following example produces no 
> output:
> <?xml version="1.0" encoding="UTF-8"?>
> <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform"; 
> xmlns:xalan="http://xml.apache.org/xalan"; 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
>   <output method="text"/>
>   <template match="/">
>     <variable name="foo">
>       <xsl:element name="bar">
>          <xsl:attribute name="priority">1</xsl:attribute>
>         <text>Priority = 1</text>
>       </xsl:element>
>       <xsl:element name="bar">
>         <xsl:attribute name="priority">2</xsl:attribute>
>         <text>Priority = 2</text>
>       </xsl:element>
>     </variable>
>     <for-each select="xalan:nodeset($foo)/xsl:bar">
>       <xsl:sort data-type="number" order="descending" select="@priority"/>
>       <value-of select="text()"/>
>     </for-each>
>   </template>
> </stylesheet>

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to