passing a sorted node set to template

D

drs58

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
 
D

David Carlisle

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,839
Latest member
MartinaBur

Latest Threads

Top