Subject: RE: [xsl] Muenchian method, and keys 'n stuff From: DPawson@xxxxxxxxxxx Date: Wed, 23 Jan 2002 10:21:53 -0000 |
Done it. Thanks a million Jeni, I've said it before and I'll say it again! solution below: <xsl:template match="adventure"> <h1>Adventure</h1> <xsl:call-template name="alphabetical"> <xsl:with-param name="section" select="generate-id(.)"/> </xsl:call-template> </xsl:template> Calls your alphabetical, with id. key as you described: Why the space I wonder. <xsl:key name="auth" match="adventure/r" use="concat(generate-id(..), ' ', Ra/lett)" /> The bit of Jeni genius, <!-- context is adventure (or other category). --> <xsl:template name="alphabetical"> <xsl:param name="section" select="'none'"/> <xsl:param name="alphabet" select="'abcdefghijklmnopqrstuvwxyz'" /> <xsl:if test="$alphabet != ''"> <xsl:variable name="letter" select="substring($alphabet, 1, 1)" /> <xsl:variable name="auths" select="key('auth', concat($section, ' ', $letter))" /> <xsl:choose> <xsl:when test="$auths"> <xsl:apply-templates select="$auths[1]"/> </xsl:when> <xsl:otherwise> <h2>The letter <xsl:value-of select="translate($letter, $l,$u)"/> </h2> <p> There are no authors beginning with <xsl:value-of select="$letter" /> </p> </xsl:otherwise> </xsl:choose> <xsl:call-template name="alphabetical"> <xsl:with-param name="alphabet" select="substring($alphabet, 2)" /> <xsl:with-param name="section" select="$section"/> </xsl:call-template> </xsl:if> </xsl:template> Processing for first r record. <xsl:variable name="u" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> <xsl:variable name="l" select="'abcdefghijklmnopqrstuvwxyz'"/> <!-- Template for the first record in a letter --> <xsl:template match="r"> .... <xsl:apply-templates select="following-sibling::r[Ra/au = $thisAu ]" mode="others"/> </xsl:template/> <!-- Template for those other than first. --> <xsl:template match="r" mode="others"> Produces required output: The letter I Innes, Hammond. Delta Connection. Read by Michael Tudor Barnes, 12hrs 36mins. TB 11148 A desperate escape from Romania after the fall of the Ceausescus...a violent introduction to the new rules of warfare on the borders of Afghanistan...then an icy struggle for survival amongst the world's highest mountains. Death follows those who seek beyond the 'Delta Connection' - searching for something closely guarded in the most dangerous region on earth. TB 11148 The letter J There are no authors beginning with j The letter K with all books by same author under single author title! I'm happy. Regards DaveP. - NOTICE: The information contained in this email and any attachments is confidential and may be legally privileged. If you are not the intended recipient you are hereby notified that you must not use, disclose, distribute, copy, print or rely on this email's content. If you are not the intended recipient, please notify the sender immediately and then delete the email and any attachments from your system. RNIB has made strenuous efforts to ensure that emails and any attachments generated by its staff are free from viruses. However, it cannot accept any responsibility for any viruses which are transmitted. We therefore recommend you scan all attachments. Please note that the statements and views expressed in this email and any attachments are those of the author and do not necessarily represent those of RNIB. RNIB Registered Charity Number: 226227 Website: http://www.rnib.org.uk XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Muenchian method, and key, Jeni Tennison | Thread | Re: [xsl] Muenchian method, and key, Jeni Tennison |
Re: [xsl] Muenchian method, and key, Jeni Tennison | Date | Re: [xsl] Muenchian method, and key, Jeni Tennison |
Month |