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

xsl:sort

Subject: xsl:sort
From: Dave Pawson <daveP@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 06 Aug 2000 11:34:36 +0100
xsl sort function
I thought I understood sorting :-|

With the following xml
<?xml version="1.0" encoding="utf-8"?>
<faqindex>
<functions/>
<functions>
<pair>
<word>document()</word>
<file>N169.html</file>
</pair>
</functions>

<functions>
<pair>
<word>order</word>
<file>N795.html</file>
</pair>
</functions>
<functions>
<pair>
<word>position()</word>
<file>N961.html</file>
</pair>
</functions>


I want to sort on select = pair/word.

Does a sort use the key *only* for sorting,
i.e. can I keep the function and its children together
durin the sort?

  <xsl:template match="faqindex">
     <H2>Index for XSLT FAQ Website</H2>
     <!-- Sort the functions -->
       <xsl:variable name="fns">
	<xsl:for-each select="functions[.!='']">
	  <xsl:sort data-type="text" select="pair/word"/>
	</xsl:for-each>
       </xsl:variable>

<!-- now convert that to a node-set and step through it -->

     <xsl:for-each select="xt:node-set($fns)">*
       <xsl:value-of select="child::*/text()"/> <br />
     </xsl:for-each>
   </xsl:template>

this is giving me zilch output, and I can't see the logic.
I'm hoping that the fns variable will hold the node-list 
of all function elements, sorted by 'word' child, and 
include the file child... or at least thats the way I thought
it worked.

any help appreciated.
TIA DaveP



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


Current Thread
  • xsl:sort
    • Dave Pawson - Sun, 06 Aug 2000 11:34:36 +0100 <=

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.