|
[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








