works now..
thanks!
Mathieu
From: "Michael Kay" <mhk(_at_)mhk(_dot_)me(_dot_)uk>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: RE: [xsl] How to put sorted nodes into a variable? (to xsl:number
a sorted node-set)
Date: Mon, 5 Jan 2004 14:51:35 -0000
Yes, the approach is correct. You want something like:
<xsl:variable name="temp">
<xsl:apply-templates>
<xsl:sort select="..."/>
</xsl:apply-templates>
</xsl:variable>
<xsl:for-each select="exslt:node-set($temp)/*">
<out>
<xsl:number/>
<xsl:copy-of select="."/>
</out>
</xsl:for-each>
Michael Kay
> -----Original Message-----
> From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
> [mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
> ongeaddresseerd ongeaddresseerd
> Sent: 05 January 2004 11:50
> To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
> Subject: [xsl] How to put sorted nodes into a variable? (to
> xsl:number a sorted node-set)
>
>
> hello all,
>
> I'm trying to 'xsl:number' some sorted multileveled nodes.
>
> According to some messages I found in the archive of this
> mailing list, I
> should
> first put my sorted node-set into a xsl:variable. (Otherwise
> numbering will
> take place according
> to the order of nodes in the xml document!).
>
> To reproduce my struggle:
>
> a) xml input:
>
> <thing sequenceIndex="30" key="hardware">
> <thing sequenceIndex="20" key="computerB">
> </thing>
> <thing sequenceIndex="5" key="computerA">
> <thing sequenceIndex="5" key="diskOne">
> </thing>
> <thing sequenceIndex="10" key="diskTwo">
> </thing>
> </thing>
> <thing
> <thing sequenceIndex="10" key="software">
> </thing>
>
> b) wished output: (sorted on attribute 'sequenceIndex')
>
> 1 software
> 2 hardware
> 2.1 computerA
> 2.1.1 diskOne
> 2.1.2 diskTwo
> 2.2 computerB
>
> c) xsl
>
> <xsl:variable name="sorted-things" select="//Thing">
> <!-- see question 1 below -->
> </xsl:variable>
>
> <xsl:for-each select="$sorted-things">
> <fo:block>
> <xsl:number level="multiple" grouping-size="1"
> grouping-separator="."/>
> <xsl:text> </xsl:text>
> <xsl:value-of select="@key"/>
> </fo:block>
> </xsl:for-each>
>
>
> Question 1: how to put sorted nodes into the variable
> ($sorted-things)?
> Sortation according to <xsl:sort select="@sequenceIndex"
> data-type="number"
> order="ascending"/>.
>
> Question 2: is this "use a variable"-strategy correct to
> xsl:number a set of
> nodes according to their sortation (and not their xml document order)?
>
> any help appreciated,
>
> Mathieu van Echtelt
> Groningen
> the Netherlands
>
> _________________________________________________________________
> MSN Zoeken helpt je om de gekste dingen te vinden!
http://search.msn.nl
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________
MSN Zoeken helpt je om de gekste dingen te vinden! http://search.msn.nl
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list