RE: level, from, and count in xsl:number

Subject: RE: level, from, and count in xsl:number
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 21 May 1999 10:56:51 +0100
You catch me with a sore head from implementing these features for SAXON
over the last 24 hours! I agree, they're pretty messy, but there are plenty
of things you can do with xsl:number that you can't do easily with
position(). The problem with position() is that it's the position of the
current node in the current node list; what you really want is a function
that returns the position of the current node (or possibly some other node)
in an arbitrary node list. If you had that, then I agree there would be
little case for level, from, and count. For example, one might write


to achieve the effect of level=ANY count=ITEM from=BOOKLIST

level=MULTI is a bit trickier but I'm sure it could be achieved as well.

The other messiness in xsl:number is that XSLT now has two completely
separate schemes, both elaborate yet incomplete, for converting numbers to
strings. There must be scope to rationalise this.

I also question why xsl:number is an XSL element rather than a function: if
it were a function it would be possible to post-process the result. (Of
course you can assign it to a variable, but that still has limitations, e.g.
you can't sort on the result).

Mike Kay

Puzzle corner: one thing the SAXON XSL compiler does is to process nodes in
reverse document order. (It actually does this for the xsl:sort nodes, if
you're interested). I'm trying to find a way to do this using standard XSL.
Any suggestions? 

> -----Original Message-----
> From: Elliotte Rusty Harold [mailto:elharo@xxxxxxxxxxxxxxx]
> Is there anything the level, from, and count attributes of 
> xsl:number do
> that can't be done more easily with the expr attribute and 
> position()? 

 XSL-List info and archive:

Current Thread