Resolved.
Sorry, I don't expect logic errors from Mike Kay :-)
comparison was A lt A and G gt A which returned false.
Changed to le A
Example may help others. Thanks Mike,
<categories>
<item>
<artist>About the Moon</artist>
<title>Carved in Stigmata Wounds</title>
</item>
<item>
<artist>Satyricon</artist>
<title>Rebel Extravaganza</title>
</item>
<item>
<artist>Secrets of the Moon</artist>
<title>Carved in Stigmata Wounds</title>
</item>
</categories>
<xsl:template match="categories">
<xsl:for-each-group select="item" group-by="f:grouping-key(.)">
Group starts with <xsl:value-of select="substring(artist,1,1)"/>.
<xsl:for-each select="current-group()">
<xsl:copy>
<xsl:copy-of select="*"/>
</xsl:copy>
</xsl:for-each>
</xsl:for-each-group>
<xsl:apply-templates select="item"/>
</xsl:template>
<xsl:function name="f:grouping-key" >
<xsl:param name="item" as="element(item)"/>
<xsl:variable name="ranges">
<range from="A" to= "G"/>
<range from="H" to= "L"/>
<range from="M" to= "P"/>
<range from="Q" to= "Z"/>
<range from="0" to= "9"/>
</xsl:variable>
<xsl:sequence select="$ranges/range
[string(@from) le substring($item/artist,1,1) and
string(@to) ge substring($item/artist,1,1)]/@from"/>
</xsl:function>
regards DaveP
--
DISCLAIMER:
NOTICE: The information contained in this email and any attachments is
confidential and may be privileged. If you are not the intended
recipient you should not use, disclose, distribute or copy any of the
content of it or of any attachment; you are requested to notify the
sender immediately of your receipt of the email and then to delete it
and any attachments from your system.
RNIB endeavours to ensure that emails and any attachments generated by
its staff are free from viruses or other contaminants. However, it
cannot accept any responsibility for any such which are transmitted.
We therefore recommend you scan all attachments.
Please note that the statements and views expressed in this email and
any attachments are those of the author and do not necessarily represent
those of RNIB.
RNIB Registered Charity Number: 226227
Website: http://www.rnib.org.uk
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--