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

RE: Muenchian method, and keys 'n stuff

Subject: RE: Muenchian method, and keys 'n stuff
From: DPawson@xxxxxxxxxxx
Date: Wed, 23 Jan 2002 10:21:53 -0000
the delta connection innes
Done it. Thanks a million Jeni, I've said it before and I'll
say it again!

solution below:

  <xsl:template match="adventure">

    <xsl:call-template name="alphabetical">
      <xsl:with-param name="section" select="generate-id(.)"/>

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:when test="$auths">
         <xsl:apply-templates select="$auths[1]"/>
  <h2>The letter <xsl:value-of select="translate($letter, $l,$u)"/> </h2>
          There are no authors beginning with
          <xsl:value-of select="$letter" />
    <xsl:call-template name="alphabetical">
      <xsl:with-param name="alphabet"
                      select="substring($alphabet, 2)" />
        <xsl:with-param name="section" select="$section"/>

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 ]" 

<!-- 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 

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


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.
First Name
Last Name
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.