This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Sorting a variable that contains a nodeset
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "rafael vazquez" <rc_vazquez at hotmail dot com>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Thu, 10 Jan 2002 16:23:03 +0000
- Subject: Re: [xsl] Sorting a variable that contains a nodeset
- Organization: Jeni Tennison Consulting Ltd
- References: <F197BIggMN42HzoKwNG0001243a@hotmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Rafael,
> I have a variable containing a nodeset as <xsl:variable name="var"
> select="//ARTICULO"/> and I want to order this nodeset by the node
> 'NOMBRE_FAMILIA'. How can I perform it? Exists any function that
> sorts the variable?
Because collections of nodes are *sets* in XSLT 1.0, they are
unordered by definition. But you can process the nodes in the set in a
particular order using xsl:sort when you use xsl:for-each:
<xsl:for-each select="$var">
<xsl:sort select="NOMBRE_FAMILIA" data-type="number" />
...
</xsl:for-each>
Or when you apply templates:
<xsl:apply-templates select="$var">
<xsl:sort select="NOMBRE_FAMILIA" data-type="number" />
</xsl:apply-templates>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list