W3C home > Mailing lists > Public > www-xsl-fo@w3.org > October 2004

Re: node after current node in xsl:for-each with xsl:sort (was: conditional page-break table based on row number?)

From: David Carlisle <davidc@nag.co.uk>
Date: Mon, 11 Oct 2004 22:23:40 +0100
Message-Id: <200410112123.WAA32609@penguin.nag.co.uk>
To: mooney@dogbert.cc.ndsu.NoDak.edu
CC: www-xsl-fo@w3.org

this list is more for FO issues than XSLT programming (I think) but

                             select="self::*[position() + 1]"
self::* selects at most 1 node, which will always have position()=1
but in any case, if you use [] with a numeric value rather than a
predicate it is short for
so *[1] means *[position()=1]
and selects the first thing and
[position() + 1] is short for [position()=(position() + 1)] and selects
all those elements for which 0=1 ie, it selects the empty set.

Actually it's a bit tricky in pure xslt 1 to sort and then access the
sorted list at the same time, as the sorted list information goes to the
result tree where by design you can't really get it back.

If you can use your processor's node-set extension (if it has one) first
sort the input into a temporary variable then process every other item
in this sorted list, and access the next item by
if xx:node-set() isn't available, ask again:-)


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
Received on Monday, 11 October 2004 21:24:03 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:29 UTC