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

Re: Node set

Subject: Re: Node set
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Mon, 5 Feb 2001 18:47:29 +0000
Re:  Node set
Hi YueMa,

> How can I create a node set with specific order other than document
> order?

As David "pure mathematician" Carlisle says, node sets aren't ordered,
so you can't create one with an order, but you can choose what order
to process them in.

> How about if I want to  display like:
> title2
> title4
> title1
> title3

Then apply templates (or use xsl:for-each) in that order:

  <xsl:apply-templates select="title2" />
  <xsl:apply-templates select="title4" />
  <xsl:apply-templates select="title1" />
  <xsl:apply-templates select="title3" />

This hardcodes into the stylesheet the order in which they're
processed in a certain context.  You could select the order in any
number of ways.
  
> the order is not fixed and may changd everytime, and even the number
> of titles are not guaranteed, maybe 4, maybe 3, etc.

There must be some underlying way of choosing which order you want
them in?  What is it?

> What I wanted to do is to create a node set with the particular
> order and then I can process elements just by using <xsl:for-each>,
> is that possible in XSL?

Not really (although you could feasibly create a result tree fragment
variable and then iterate over that with xsl:for-each having turned it
into a node set with an extension function).

If you apply templates to the nodes you want in order, as outlined
above, then you can have a template that matches any of them and that
contains whatever you want to put in the body of the xsl:for-each:

<xsl:template match="title1 | title2 | title3 | title4">
   ... body of the xsl:for-each ...
</xsl:template>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread
  • Node set
    • YueMa - Mon, 5 Feb 2001 11:45:24 -0500 (EST)
      • David Carlisle - Mon, 5 Feb 2001 12:05:10 -0500 (EST)
      • Jeni Tennison - Mon, 5 Feb 2001 13:50:45 -0500 (EST) <=
        • YueMa - Mon, 5 Feb 2001 15:57:30 -0500 (EST)

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.