[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Sorting a variable that contains a nodeset

Subject: Re: Sorting a variable that contains a nodeset
From: "rafael vazquez" <rc_vazquez@xxxxxxxxxxx>
Date: Thu, 10 Jan 2002 19:17:01 +0100
xsl if node set contains
Hi Jeni!

> My problem is that I have to compare each 'ARTICULO' with the
> following 'ARTICULO', but once they are sorted. For this, I think
> the best solution is to store in a variable all the nodes
> 'ARTICULO', sort them, and compare each of them with the following.

The only way that you can do this in XSLT 1.0 is if you use a
node-set() extension function to create a new document in which the
ARTICULOs are in sorted order. You create the new document within a

  <xsl:variable name="articulos">
    <xsl:for-each select="ARTICULO">
      <xsl:sort select="NOMBRE_FAMILIA"/>
      <xsl:sort select="NOMBRE_SUBFAMILIA"/>
      <xsl:sort select="DESCRIPCION_CORTA"/>
      <xsl:copy-of select="." />

Then convert that to a node set with an extension function that
depends on what processor you're using, and check the following
ARTICULO using the following-sibling:: axis. For example, if you're
using MSXML, you do:

  <xsl:for-each select="msxsl:node-set($articulos)/ARTICULO">
    <xsl:if test="NOMBRE_FAMILIA =

My intuition tells me that you might be wanting to do this because you
want to create groups of ARTICULO elements. If that's the case, then
there are different (and more portable) ways to go about it, so let us
know if that's what you're trying to do.

I have tested this code, and I think it will work, but my browser gives me an error when I use the prefix namespace 'msxsl'. Reference to a non declared namespace prefix: 'msxsl'. I´m using IExplorer 6.02. What can I do?

I´m using in my XSLT the following namespace:


_________________________________________________________________ Hable con sus amigos en línea, pruebe MSN Messenger: http://messenger.msn.es

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.