Subject: [xsl] Question 2: consolidating footnotes/numbering with same idref From: "Whitney, Dan (CanWest Interactive)" <DWhitney@xxxxxxxxxxx> Date: Thu, 16 Oct 2003 16:01:45 -0400 |
Thanks to Mukul and David for the responses to the last question. I ended up going with Mukul's method because I got his to work first and it was an easier concept for me to grasp. So here's question 2 (got this far but cannot find any other info to help me). Here's the xml <RS> <RI col="1">Row 1 - Column 1<RIREF refid="142">Footnote 1</RIREF></RI> <RI col="2">Row 1 - Column 2</RI> <RI col="3">Row 1 - Column 3<RIREF refid="140">Footnote 2</RIREF></RI> <RI col="4">Row 1 - Column 4</RI> <RI col="1">Row 2 - Column 1</RI> <RI col="2">Row 2 - Column 2<RIREF refid="150">Footnote 3</RIREF></RI> <RI col="3">Row 2 - Column 3</RI> <RI col="4">Row 2 - Column 4<RIREF refid="142">Footnote 1</RIREF></RI> </RS> Here's the xsl: <?xml version="1.0" encoding="iso8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="4.0" indent="yes"/> <xsl:template match="/RS"> <table> <tr> <xsl:for-each select="RI"> <td> <xsl:copy-of select="text()"/> <xsl:for-each select="RIREF"> <sup><xsl:number count="RIREF" level="any" from="RS" format="1"/></sup> </xsl:for-each> </td> </xsl:for-each> </tr> </table> <table> <tr> <td> <xsl:apply-templates select="RI/RIREF"/> </td> </tr> </table> </xsl:template> <xsl:template match="RIREF"> <tr> <td> <b><xsl:number count="RIREF" level="any" from="RS" format="1. "/> </b> <xsl:value-of select="."/> </td> </tr> </xsl:template> </xsl:stylesheet> Here's the output: <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>4</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> <tr> <td><b>4. </b>Footnote 1 </td> </tr> </td> </tr> </table> 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> That's it for now thanks for all the help Dan XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Interesting discussion on typ, Dimitre Novatchev | Thread | RE: [xsl] Question 2: consolidating, Americo Albuquerque |
Re: [xsl] Ignoring specific charact, Wendell Piez | Date | Re: [xsl] Sorting Problem(solved), Wendell Piez |
Month |