This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Sorting a variable that contains a nodeset


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]