|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Sibling sort 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
|
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








