Subject: Re: [xsl] Sorting a variable that contains a nodeset From: "cutlass" <cutlass@xxxxxxxxxxx> Date: Thu, 10 Jan 2002 17:17:45 -0000 |
try this re JT <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:variable name="var" select="//ARTICULO"/> <xsl:apply-templates select="$var"> <xsl:sort select="NOMBRE_FAMILIA"/> </xsl:apply-templates> </xsl:template> <xsl:template match="ARTICULO"> <ARTICULO> <xsl:copy-of select="*"/> </ARTICULO> </xsl:template> </xsl:stylesheet> here is an awkward solution ..... though i think i am more confused re. cheers, jim ----- Original Message ----- From: "rafael vazquez" <rc_vazquez@xxxxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Thursday, January 10, 2002 4:58 PM Subject: Re: [xsl] Sorting a variable that contains a nodeset > > > > >From: "cutlass" <cutlass@xxxxxxxxxxx> > >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > >To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > >Subject: Re: [xsl] 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 > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Sorting a variable that c, rafael vazquez | Thread | Re: [xsl] Sorting a variable that c, Jeni Tennison |
RE: [xsl] making grandparents of gr, Michael Kay | Date | Re: [xsl] Problem in xsl:for-each, jam |
Month |