|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: breaking sorted material into subsections
Thanks Oliver. Using translate as you suggested to determine if the initial
character was one of a set worked well. However, I'm running into one more
minor problem. None of my attempts to add a section heading for this
Numbers & Symbols work right (either the heading is repeated multiple times
(once for the 1's, again for the 2's, etc.), or it appear even when there is
nothing in the section, or it don't appear at all). Here's the current
code:
<xsl:template match="pages">
<!-- problem with following if -->
<!-- I'm aware that I'm only checking the first
@entry -->
<!-- in the data, resulting in the heading
generally -->
<!-- not appearing when it should, but I can't
figure -->
<!-- out how to check them all in this context
-->
<xsl:if
test="translate((substring(//index/@entry,1,1)),'1234567890@#','')=''">
<h2>Numbers & symbols</h2>
</xsl:if>
<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@#','')=''">
<!-- Tried adding something here before, but could
-->
<!-- never get something here to not repeat for
-->
<!-- each group
-->
<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: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>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








