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

Sibling sort order

Subject: Sibling sort order
From: Richard Bell <RichardBell@xxxxxxxxxxx>
Date: Fri, 31 Mar 2000 14:17:05 +0100
sibling order
Does anyone know how to select the previous/next sibling while maintaining
the sort order of the current context using Microsoft's XSLT March preview?
The only mechanism I can find to refer to the siblings of the context node
is to use the parent axis (parent::) but any sort order which is being
applied in the context of the current node is lost and the node order
reverts to the order in the original document. Example below. Tks.

<root>
 <row f1="f" f2="1"/>
 <row f1="e" f2="2"/>
 <row f1="d" f2="3"/>
 <row f1="c" f2="4"/>
 <row f1="b" f2="5"/>
 <row f1="a" f2="6"/> 
</root>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
 <xsl:template match="/">
  <xsl:apply-templates select="*">
  </xsl:apply-templates>
 </xsl:template>
 <xsl:template match="root">
  <xsl:apply-templates select="*">
   <xsl:sort select="@f1"/>
  </xsl:apply-templates>
 </xsl:template>
 <xsl:template match="row">
  <div>
   <xsl:value-of select="@f1"/>
   <xsl:variable name="pos" select="position()-1"/>
   <xsl:value-of select="parent::*/*[position()=$pos]/attribute::f1"/>   
  </div>
 </xsl:template>
</xsl:stylesheet>


 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.