Re: [xsl] sequence numbering.

Your problem comes from calling the key from within the node processing
on the sorted node-set.

(Apparently the key is not available from within that node-set? Anyone?
I read once something about it being a different document space)

You create a sorted node-set, $sorted-color, and then try to access the
key from within the processing for that node-set
<xsl:for-each select="xalan:nodeset($sorted-color)/product">
<xsl:value-of select="key('color',this_color)"/>
</xsl:for-each>

I was expecting a result that would look like
1 blue
2 blue
1 red
2 red
3 red
but the key function is not returning any text..
and the result is
1
2
1
2
3
Am i wrong in my XSL or is there any thing i am missing out and which
i am unaware of??
thanks
william

Hi William,

> about the name space,
> The Declartion i am using is
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xalan="http://xml.apache.org/xslt"
> xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
> extension-element-prefixes="redirect"
> version="1.0">
>
> and i am using XALAN processor

OK, then you should be able to use xalan:nodeset() extension function
(see http://xml.apache.org/xalan-j/extensionslib.html#nodeset).

[It seems likely that the next version of Xalan will support EXSLT
functions. See the recent mail from Don Leslie
(http://aspn.activestate.com/ASPN/Mail/Message/exslt/1083089). With
that version, you'll be able to use the namespace
http://exslt.org/common, and the function exsl:node-set(), which would
make your stylesheet portable across a range of processors, including
Saxon, libxslt, 4XSLT and jd.xslt.]

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

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

On Wed, 27 Mar 2002 william locksman wrote :

Hi the solution Michael Suggested seems to fit my purpose, But Since
i am a newbie to XSL , I do not know how to form a temporary tree
that contains sorted sequence.
Michael's explaination made me pretty much clear of what has to be
done. But i do not know how it has to be done.
If any one can please suggest me how to go about doing it or give me
a link to any reference document, It should be of much help to me
Thanks
William

On Tue, 26 Mar 2002 Michael Kay wrote :

<xsl:number> gives you the position of the element in the source
tree, not
in the sorted sequence. To get the number in the sorted sequence, do a
two-phase transformation: create a temporary tree that contains the
sorted
products, then process this (using xx:node-set()) to add the
numbers. To get
the number for a product among all the products of the same colour, use
<xsl:number count="product[color=$this_color]"/>