This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: xsl:sort -- XSLT version 1.1/2.0: document order and request for reverse doc. order
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] xsl:sort -- XSLT version 1.1/2.0: document order and request for reverse doc. order
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Fri, 4 May 2001 09:11:37 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> XML elements that are already in some kind of order
> in the source document are processed in order they are written in,
> this order is refferred to as document order. Since WD XSLT
> v1.1 it is
> stated explicitly that when such elements/nodes are used in the
> select att of an apply-templates/xsl:for-each --without an
> xsl:sort as their child--
> they are processed in document order (XSLTv1.1 ch. 10).
> Sometimes, however, I want to process these nodes in
> *reverse* order.
>
> Q: Is there some deaper reasoning why such a possibility
> isn't offered?
>
The rules for position() in the xsl:sort select expression are expressly
designed so that
<xsl:sort select="position()" data-type="number" order="descending"/>
gives you reverse document order.
(I know, because the rules were put there at my request...)
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list