[xsl] Extract footnotes

Subject: [xsl] Extract footnotes
From: "J. S. Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Sat, 03 Nov 2007 12:24:37 +0530
Hi all
Can anybody let me know how to extract "footnote" from paragraph and write it to end of the section. Below is what I am trying to do


Input
<section>
<para>111...<footnote label="1" id="f1"><para>First fnt</para></footnote> 222... <footnote label="2" id="f2"><para>second fnt</para></footnote> </para>
<para>333...<footnote label="3" id="f3"><para>Third fnt</para></footnote> ...</para>
</section>


Required Output
<level>
<para>111....222 ....  </para>
<para>333... ...</para>
<footnote label="1" id="f1"><para>First fnt</para></footnote>
<footnote label="2" id="f2"><para>second fnt</para></footnote>
<footnote label="3" id="f3"><para>Third fnt</para></footnote>
</level>

<xsl:template match="section">
<level>
<xsl:apply-templates/>
<xsl:if test="descendant::*[self::footnote]">
<xsl:apply-templates select="descendant::*[self::section//footnote]"/>
</xsl:if>
</level>
</xsl:template>

<xsl:template match="para">
<xsl:copy>
<xsl:apply-templates select="descendant::*[not(self::footnote)]"/>
</xsl:copy>
</xsl:template>

thanks
...JSR

Current Thread