[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Using XSLT to build an index


Subject: Re: [xsl] Using XSLT to build an index
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 31 Oct 2011 12:38:19 +0000

On 31/10/2011 12:05, Mark wrote:
<xsl:for-each-group select="Text" group-by="tokenize(@data,'\s+')">
<xsl:for-each select="current-group()">
<xsl:sort select="current-grouping-key()" lang="cz"/>
<Word title="{@title}" ref="{@ref}">
<xsl:value-of select="."/>
</Word>
</xsl:for-each>
</xsl:for-each-group>

And received the warning:  "Sort key will have no effect because its
value does not depend on the context item"

The xsl:sort is the first child of xsl:for-each as it iterates through the items in one group, so, as the warning says the grouping-key will be the same for each item.


Perhaps you meant to sort the groups, in which case, move the xsl:sort up a line so it is the first child of xsl:for-each-group.


> and the <xsl:value-of> returns nothing.
your for-each-group is selecting Text elements so each group will just consist of Text elements, so the value-of is taking the string value of an empty element, which is always the empty string.



David


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________



Current Thread