Subject: Re: Sorting revisited (<xsl:sort>)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 30 Nov 1999 18:57:45 GMT
|
I'll try again:-)
You haven't said what your input document looks like, but I'd guess
that it doesn't match the paths in your select expression.
<xsl:template match="/">
<!-- snip -->
<xsl:apply-templates>
so this apply templates applies to children of the root node.
There must be exactly one such child, and so xsl:sort has only got
a list of length one to sort.
You probably want to use
<xsl:template match="xxx">
where xxx is your document element.
If you do that then
the apply templates applies to all the children of the document node.
<xsl:sort select="*[local-name()=string($sortby)]"
is executed with those children being the current node, this the top
level sortby parameter should name a grandchild of the root, otherwise
the sort key will be null all the time.
If you want to use a sort key that returns a non null value for
the elements named by $sortby you might want ti use
<xsl:sort select="self::*[local-name()=string($sortby)]"
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|