Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > passing a sorted node set to template

Reply
Thread Tools

passing a sorted node set to template

 
 
drs58@msn.com
Guest
Posts: n/a
 
      03-20-2005
I'm calling a template that I'd like to pass a sort node set to. I'm
creating the node set with <xsl:copy-of>...is there a way to sort the
set prior to passing it? If not, what's a reasonable alternative?

Thanks in advance,
David

 
Reply With Quote
 
 
 
 
David Carlisle
Guest
Posts: n/a
 
      03-21-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:

> I'm calling a template that I'd like to pass a sort node set to. I'm
> creating the node set with <xsl:copy-of>...is there a way to sort the
> set prior to passing it? If not, what's a reasonable alternative?
>
> Thanks in advance,
> David



node sets are (as their name implies) sets, ie unordered data structures:
the set {1,2,3} is the same as the set {2,3,1}.

In XSLT1 you need to sort as the set as it is used (using xsl:sort on an
xsl:for-each or xsl:apply-templates) You can not store an order in the
data structure itself.

XSLT2 of course will abandon the node set data type and instead use
sequences (which are an ordered data structure) XSLT2 is still in draft
but there are implementations eg saxon 8.

David
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting the first node of a Sorted Group IcedDante XML 2 12-11-2006 09:09 AM
removing a node from a node-set jonny@drugphish.ch XML 0 12-02-2006 11:46 AM
xsl variable $node/text() but $node can non-node-set help! Tjerk Wolterink XML 2 08-24-2006 03:28 AM
How to set the node indent property between the parent node and the leaf node viveknatani@gmail.com ASP .Net 0 02-13-2006 07:11 PM
how to create a node set of elements through C++ code while executing a style sheet and process the created node set. pvssvikas@gmail.com XML 0 01-25-2006 12:48 PM



Advertisments