RE: xslt 1.1

> There is needed, ...
> the ability for position() to take a node as an argument, and
> return the -relative- position.
> For example:
> <xsl:value-of select="position(following-sibling::truck[1])" />
>
> would return: "3"

The result, of course, is a function not only of the target node, but of the
axis by which it was reached; and presumably it would count all nodes along
that axis (including comments), rather than merely counting elements?
Defining such a function would get very complex and might well give answers
that were intuitively wrong in many cases.

I think a much more general capability is the idea of a "truncated axis", so
you could select the node-set

leading(following-sibling::*, [not(self::truck)])

which selects all following sibling elements up to the first one that is a
<truck>, and then you can do count() on this to get your position()
function.

If you want to play with this, there's an extension function saxon:leading()
that works like this in Saxon.

Mike Kay

Received on Wednesday, 31 January 2001 13:12:06 UTC