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

RE: How to put sorted nodes into a variable? (to xsl:n

Subject: RE: How to put sorted nodes into a variable? (to xsl:number a sortednode-set)
From: "ongeaddresseerd ongeaddresseerd" <ongeadresseerd@xxxxxxxxxxx>
Date: Mon, 05 Jan 2004 15:27:34 +0000
xsl select node into variable
works now..
thanks!

Mathieu


From: "Michael Kay" <mhk@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: 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@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> ongeaddresseerd ongeaddresseerd
> Sent: 05 January 2004 11:50
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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



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.