This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Baffled by xsl:sort - want to process nodes in reverse document order.


Hi. I am trying to process a set of elements, starting with the last, and
working towards the first. I have tried the following:

           <xsl:apply-templates select="someElementType">
              <xsl:sort select="position()" data-type="number"
order="descending"/>
            </xsl:apply-templates>

The xsl:sort is taken straight out of Michael Kays book. However when I run
it, the elements are processed in document order. If I change "descending"
to "ascending", the output is exactly the same.

If, on the other hand, I change the select to say, the value of an
attribute, instead of position(), it sorts them in reverse alphabetical
order according to the text in that attribute. If I change "descending" to
"ascending", the output is reversed. In other words, it works for strings
but not for position().

Can anyone explain to me what is going on? 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]