This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

FW: intermingling upper and lower case letters in group/sort


Ooops... figured out the answer to my own question:  I was forgetting to add
the translate piece to the line where the key was declared at the top of the
file.  Adding it there did the trick.  Eric  : )

-----Original Message-----
From:	Eric Taylor 
Sent:	Thursday, September 21, 2000 8:15 AM
To:	'XSL-List@mulberrytech.com'
Subject:	intermingling upper and lower case letters in group/sort

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]