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

Re: How to sort a $variable and store that into anothe

Subject: Re: How to sort a $variable and store that into another $variable ?
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 11 Dec 2008 17:16:37 +0100
Re:  How to sort a $variable and store that into anothe
Jean-Philippe Martin wrote:

My need is :
- extract a list of values
- make it unique
- make it sorted
- put it on many columns in a html table

My XML document is big. I create an unordered list of unique values
with this call  (the first // is important since the info can be
anywhere in the xml tree) :

<xsl:variable name="unsortedList"
select="//category[@defid=3183315]//*[@attid=49]/node()[not(.=following::*)]"
/>

Your first post said you had troubles to sort nodes into a variable, the problem being "I get is a single node containing all the values sorted
concatenated in a single string". Can you show us the code that causes that problem?
What you did show in your second post did not even attempt to sort into a variable and output that sorted variable.


The only problem I see above is that the variable unsortedList could contain all kind of nodes (e.g. element nodes, text nodes, comment nodes) and I am not sure sorting such an incoherent node-set makes much sense.

And as I pointed out in my initial post, if you sort a node-set into a variable in XSLT 1.0 then you have a result tree fragment. If you want to apply XPath on a result tree fragment then you first need to apply an extension function like exsl:node-set to convert the result tree fragment into a node-set. So that could also be a problem, but you have not shown us your attempt to sort into a variable and to use that variable later so I am just guessing.

--

	Martin Honnen
	http://JavaScript.FAQTs.com/

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.