Subject: Re: [xsl] XSLT/XPath Question (Grouping Authors by First Character of Last Name) From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 04 Mar 2007 16:00:21 -0500 |
Excellent! That's exactly what I was trying to achieve. Thanks.
It also seems that this may have answered my other question: about saving the list of letters so I can iterate over them later (to make links to the TOC entries. It looks like I can just take the main for-each loop and save that code to a variable. I'll play with it.
I guess I need to play with the <xsl:key/>'s some more. The code does not seem obvious to me at all....
On 3/3/07, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote:t:\>type grover.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:key name="alet" match="author" use="substring(name/@file-as,1,1)"/>
<xsl:template match="/">
<xsl:for-each select="*/author[generate-id(.)=
generate-id(key('alet',substring(name/@file-as,1,1))[1])]"> <xsl:text>

</xsl:text> <xsl:value-of select="substring(name/@file-as,1,1)"/> <xsl:text>
</xsl:text>
<xsl:for-each select="key('alet',substring(name/@file-as,1,1))"> <xsl:value-of select="name/@file-as"/> <xsl:text>
</xsl:text> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet>
-- World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT/XPath Question (Grou, Kevin Grover | Thread | RE: [xsl] XSLT/XPath Question (Grou, Michael Kay |
Re: [xsl] not copying duplicate nod, M. David Peterson | Date | [xsl] Saxon error message, donna-b |
Month |