[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

intermingling upper and lower case letters in group/sort

Subject: intermingling upper and lower case letters in group/sort
From: Eric Taylor <Eric.Taylor@xxxxxxxxxxxx>
Date: Thu, 21 Sep 2000 07:15:03 -0500
upper and lower case letters
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.