This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Sibling sort order
> Does anyone know how to select the previous/next sibling while maintaining
> the sort order
the faq for this list has lots of examples of this.
It is hard to do in xsl without using extensions, but not so easy
and its harder in msxsl which hasnt implemented the sibling axes yet.
Easiest is first just sort the original and save the srted list in a
variable (which is a result tree fragment)
then you can select the nodes in that variable and they are in sorted
order. According to te spec you should have to use an extension function
(xt and saxon at least, provide one called node-set) but in msxsl
you can directly treat the result tree fragment as a node set.
so in other words you can go (but once msxsl becomes conformant you will
have to modify slightly)
<xsl:variable name="x">
<xsl:apply-templates select="*">
<xsl:sort select="@f1"/>
</xsl:apply-templates>
</xsl:variable>
then use
<xsl:apply-templates select="$x/*"/>
rather than <xsl:apply-templates select="*">
David
David
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list