[xsl] Muenchian technique, a problem.

Subject: [xsl] Muenchian technique, a problem.
From: DPawson@xxxxxxxxxxx
Date: Fri, 1 Feb 2002 12:58:53 -0000
I've been two full days tracking this down,
and I don't feel any closer to a solution.

Essential elements are, in the stylesheet

<xsl:key name="books-in-section-by-letter"
         match="r"
         use="concat(name(..), ' ', Ra/lett)" />

<xsl:key name="books-in-section-by-author"
         match="r"
         use="concat(name(..), ' ', Ra/au)" />


in the called template for 'section' element I have some debug code.
$catn is set to the name() of the 'section' element name, as a string.
$letter (case in point) is set to z.

  <xsl:variable name="books"
                select="key('books-in-section-by-letter',
                            concat($catn, ' ', $letter))" />   

   <xsl:if test="$letter='z'">
          <xsl:message>Alpha: 
          <xsl:for-each select="$books[generate-id() =
                   generate-id(key('books-in-section-by-author',
                                   concat($catn, ' ', Ra/au)))]">

ctx:<xsl:value-of select="name()"/> nds=<xsl:value-of
select="count($books[generate-id() =
                   generate-id(key('books-in-section-by-author',
                                   concat($catn, ' ', Ra/au)))])"/>
        </xsl:for-each>
        </xsl:message>
      </xsl:if>


the output from this informs me:
         ctx:r nds=2
I.e. the context is r, and this Muenchian method of getting the 'first'
node (as modified by MK, p626) is returning a count of 2.

Which is proving 'correct' in that it generates the 'z' letters twice.
Dearly love some help please.

Regards DaveP


Input document format is

<doc>
<section>
     <r>
       <Ra>
         <lett>a</lett>
         <au>Ant</au>
       </Ra>
  <cat-num>A1</cat-num>
     </r>
    <r>
       <Ra>
         <lett>a</lett>
         <au>Arthur</au>
       </Ra>
  <cat-num>A2</cat-num>
     </r>
    <r>
       <Ra>
         <lett>z</lett>
         <au>ZZZ. </au>
       </Ra>
         <cat-num>Z1</cat-num>
     </r>
   <r>
       <Ra>
         <lett>z</lett>
         <au>ZZZ. </au>
       </Ra>
         <cat-num>Z2</cat-num>
     </r>
     </section>
   </doc>

************snip here************** 

- 

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 

14th June 2002 is RNIB Look Loud Day - visit http://www.lookloud.org.uk to
find out all about it.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread