passing a sorted node set to template

Discussion in 'XML' started by drs58@msn.com, Mar 20, 2005.

  1. Guest

    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
     
    , Mar 20, 2005
    #1
    1. Advertising

  2. 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
     
    David Carlisle, Mar 21, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,668
  2. Alan Silver
    Replies:
    0
    Views:
    553
    Alan Silver
    Dec 21, 2005
  3. Tjerk Wolterink
    Replies:
    2
    Views:
    1,520
    Dimitre Novatchev
    Aug 24, 2006
  4. Replies:
    0
    Views:
    535
  5. IcedDante
    Replies:
    2
    Views:
    507
Loading...

Share This Page