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

Re: Looping in XSLT(old question, but maybe new proble

Subject: Re: Looping in XSLT(old question, but maybe new problem)
From: Mike Brown <mike@xxxxxxxx>
Date: Mon, 23 Jun 2003 22:53:42 -0600 (MDT)
exsl bound.
Liu Shuai wrote:
> As you see, I sort bar based on some rule, but when I get the next two
> element, how can I keep
> the order? Looks to me following-sibling fetch element based on the orginal
> order in the source
> file.

Yes, that's correct. The relationship between nodes has nothing to do with the
order in which they are processed. 

For this situation you are best off copying the nodes you need into a result
tree fragment, and converting it to a node-set with an extension function. If
your processor supports EXSLT (many do), then the exsl:node-set() function
(exsl prefix bound to "http://exslt.org/common") will do the conversion. Other
and older processors support the same functionality with a vendor-specific
namespace and function name.

<xsl:variable name="bars-rtf">
  <xsl:for-each select="bar">
    <xsl:sort .../>
    <xsl:copy-of select="."/>
  </xsl:for-each>
</xsl:variable>
<xsl:variable name="bars" select="exsl:node-set($bars-rtf)"/>

<xsl:for-each select="$bars/bar">
  ...


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


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.