This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
intermingling upper and lower case letters in group/sort
- To: "'XSL-List at mulberrytech dot com'" <XSL-List at mulberrytech dot com>
- Subject: intermingling upper and lower case letters in group/sort
- From: Eric Taylor <Eric dot Taylor at RealPage dot com>
- Date: Thu, 21 Sep 2000 07:15:03 -0500
- Reply-To: xsl-list at mulberrytech dot com
Currently (thanks to considerable help from Don and Oliver!), I have some
XSL that sorts my index entries, adding headings for each new letter.
However, I've discovered that I'm going to have some entries beginning with
upper case, and others with lower. This, I've discovered, yeilds results
like:
<H2>a</H2>
aa
ad
az
<H2>A</H2>
Aaa
Ae
When what I want is:
<H2>A</H2>
aa
Aaa
ad
Ae
az
I tried adding things like translate ($initial, 'abcde...','ABCDE...') at
various points, and got various results: all lower case entries just
disappearing altogether, upper case entries being duplicated, etc. Not
exactly what I'd hoped for. Can someone (in novice terms, please) clarify
for me.
<xsl:for-each select="//index[count(. | key('letters',
substring(@entry,1,1))[1]) = 1]">
<xsl:sort select="@entry" />
<xsl:variable name="initial" select="substring(@entry,1,1)" />
<xsl:choose>
<xsl:when test="translate($initial,'1234567890@#','')=''">
<<!-- piece here not relevant to current issue -->
</xsl:when>
<xsl:otherwise>
<h2><xsl:value-of select="$initial" /></h2>
<xsl:for-each select="key('letters', $initial)">
<xsl:sort select="@entry" />
<p><a><xsl:attribute name="href"
saxon:disable-output-escaping="yes"><xsl:value-of
select="../@location"/></xsl:attribute><xsl:value-of
select="@entry"/></a></p>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
Thanks again. Eric
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list