Re: Re-ordering elements

Subject: Re: Re-ordering elements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 20 Jan 2000 21:18:46 GMT
me> NO!

despite the capitalisation my description of your propsed code was
largely inaccurate I was thrown by the use of the attribute name `id'
thinking that you were selecting on id (eg with the id() function)
that would have the effect that I described. But your `id' is just an
attribute that happens to be called id, and you are accessing it with @
not with id() so the sort keys do vary depending on the node they are
evelauated on, but in a strange way.

    <xsl:for-each select="mantra" >
                <xsl:sort select="[@id='rv1.84.10a']" />
                <xsl:sort select="[@id='rv3.62.10c']" />
                <xsl:sort select="[@id='rv1.164.1a']" />
                <xsl:sort select="[@id='rv1.164.1e']" />
                <xsl:sort select="[@id='rv1.14.1a']" />

on a node which has an id='rv1.84.10a' the value of
select="[@id='rv1.84.10a']" is the charactar data of the content of that

On every other node the value of select="[@id='rv1.84.10a']" is empty.

so this will compare the text of the mantra with the empty string.

If both nodes don't have that id you will compare two empty strings
and so proceed to the next sort.

But this is just such a strange way to proceed, you are making the
machine go through hoops, and effectively just writing out the
full order that you want, eg no for-each and change that  xsl:sort to


 XSL-List info and archive:

Current Thread