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']" />
                </xsl:for-each>
                


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
node.

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:copy-of 

David


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


Current Thread