[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 17:58:08 +0100
rafael vazquez



From: "cutlass" <cutlass@xxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  Sorting a variable that contains a nodeset
Date: Thu, 10 Jan 2002 16:11:35 -0000

Hello Rafeal,

----- Original Message -----
From: "rafael vazquez" <rc_vazquez@xxxxxxxxxxx>
> Hi All!
> 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?

depends on how you generate the variable, and if u want to use an extension
function to continue manipulating it ( node-set() function that is).

but since u didnt give me a snippet of xml that is representative, i cant
really give u an explicit example...

we would like to help,

cheers, jim fuller

My XML file is:
<ALMACEN>
<ARTICULO>
 <DESCRIPCION_CORTA>chuletas cerdo</DESCRIPCION_CORTA>
 <DESCRIPCION_LARGA>chuletas cerdo extra</DESCRIPCION_LARGA>
 <NOMBRE_FAMILIA>alimentacion</NOMBRE_FAMILIA>
 <NOMBRE_SUBFAMILIA>carnes</NOMBRE_SUBFAMILIA>
</ARTICULO>
<ARTICULO>
 <DESCRIPCION_CORTA>chuletas marrano</DESCRIPCION_CORTA>
 <DESCRIPCION_LARGA>chuletas marrano extra</DESCRIPCION_LARGA>
 <NOMBRE_FAMILIA>alimentacion</NOMBRE_FAMILIA>
 <NOMBRE_SUBFAMILIA>verduras</NOMBRE_SUBFAMILIA>
</ARTICULO>
<ALMACEN>

And I want to show this information sorted in a HTML table. I perform this with the code:
<xsl:template match="/ALMACEN">
<xsl:for-each select="ARTICULO">
<xsl:sort select="NOMBRE_FAMILIA"/>
<xsl:sort select="NOMBRE_SUBFAMILIA"/>
<xsl:sort select="DESCRIPCION_CORTA"/>
...
</xsl:for-each>
</xsl:template>


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 variable is formed as:
<xsl:variable name="nodos" select="//ARTICULO"/>

I hope you have enought information with it, otherwise I´ll be pleased to give it to you.

Thanks friend!






_________________________________________________________________
MSN Photos es la manera más sencilla de compartir e imprimir sus fotos: http://photos.latam.msn.com/Support/WorldWide.aspx



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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.