[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi Jeni!
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?
Thanks!
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Re: [xsl] Sorting a variable that contains a nodeset
Subject: Re: [xsl] Sorting a variable that contains a nodeset From: "rafael vazquez" <rc_vazquez@xxxxxxxxxxx> Date: Thu, 10 Jan 2002 19:17:01 +0100 |
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 variable:
<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="." /> </xsl:for-each> </xsl:variable>
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 = following-sibling::NOMBRE_FAMILIA[1]"> ... </xsl:if> ... </xsl:for-each>
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: xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
Thanks!
_________________________________________________________________ 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Sorting a variable that c, Jeni Tennison | Thread | Re: [xsl] Sorting a variable that c, Jeni Tennison |
[xsl] apply template within call te, Maneshi Tuli | Date | Re: [xsl] use cases for d-o-e, Wendell Piez |
Month |
Keywords