xsl-list
[Top] [All Lists]

RE: Question 2: consolidating footnotes/numbering with same idref

2003-10-16 16:43:11
Hi

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Whitney, Dan (CanWest Interactive)
Sent: Thursday, October 16, 2003 9:02 PM
To: 'mulberry - xsl'
Subject: [xsl] Question 2: consolidating footnotes/numbering 
with same idref

(...) 
Works great but want to consolidate the numbering for the 
riref elements like so:

<table>
   <tr>
      <td>Row 1 - Column 1<sup>1</sup></td>
      <td>Row 1 - Column 2</td>
      <td>Row 1 - Column 3<sup>2</sup></td>
      <td>Row 1 - Column 4</td>
      <td>Row 2 - Column 1</td>
      <td>Row 2 - Column 2<sup>3</sup></td>
      <td>Row 2 - Column 3</td>
      <td>Row 2 - Column 4<sup>1</sup></td>
   </tr>
</table>
<table>
   <tr>
      <td>
         <tr>
            <td><b>1. </b>Footnote 1
            </td>
         </tr>
         <tr>
            <td><b>2. </b>Footnote 2
            </td>
         </tr>
         <tr>
            <td><b>3. </b>Footnote 3
            </td>
         </tr>
<!-- don't want this output  
        <tr>
            <td><b>4. </b>Footnote 1
            </td>
         </tr>
      </td>
   </tr>
-->
</table>

Try this stylesheet:

  <xsl:key match="RIREF" name="RIREF" use="@refid"/>

  <xsl:template match="RS">
    <table>
      <tr>
        <xsl:apply-templates select="RI"/>
      </tr>
    </table>
    <table>
      <xsl:apply-templates mode="footnote"
select="RI/RIREF[generate-id()=generate-id(key('RIREF',@refid)[1])]"/>
    </table>
  </xsl:template>

  <xsl:template match="RI">
    <td>
      <xsl:apply-templates select="text()"/>
      <xsl:apply-templates
select="../RI/RIREF[(_at_)refid=current()/RIREF/@refid][generate-id()=generat
e-id(key('RIREF',@refid)[1])]"/>
    </td>
  </xsl:template>

  <xsl:template match="RIREF">
    <sup>
      <xsl:number count="RIREF" format="1" from="RS" level="any"/>
    </sup>
  </xsl:template>

  <xsl:template match="RIREF" mode="footnote">
    <tr>
      <td>
        <b>
          <xsl:number count="RIREF" format="1. " from="RS" level="any"/>
        </b>
        <xsl:value-of select="."/>
      </td>
    </tr>
  </xsl:template>

Regards,
Americo Albuquerque


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



<Prev in Thread] Current Thread [Next in Thread>