[Home] [By Thread] [By Date] [Recent Entries]
Hi Byomkesh, When this source XML: <?xml version="1.0" encoding="UTF-8"?> <document> <Text>This zine is about Egyptology<Intref Refid="Pref02fn1"><Sup>1</Sup></Intref> <Intref Refid="Page_50">50</Intref></Text> <Text>States Accepting the<Intref Refid="Pref02fn2"><Sup>2</Sup></Intref> <Intref Refid="Page_127">127</Intref></Text> <!-- Preface Footnote --> <Fnote Id="Pref02fn1" Label="1" Type="Footnote"><Smalltext>1. Source: United Nations.</Smalltext></Fnote> <Fnote Id="Pref02fn2" Label="2" Type="Footnote"><Smalltext>2. Source: International.</Smalltext></Fnote> <!-- Chapter Footnote --> <Text>Structure that consists of 191 nation states.<Intref Refid="Ch01Fn01"><Sup>1</Sup></Intref>.</Text> <Fnote Id="Ch01Fn01" Label="1." Type="ChFootnote"><Smalltext><Emphasis Type="Bold">1.</Emphasis> As of 2005, “state,” see <Intref Refid="Ch02Lev1001">Chapter 2(A)</Intref>.</Smalltext></Fnote> </document> is transformed with this stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/>
<xsl:template match="/document">
<document>
<xsl:apply-templates select="Text" />
</document>
</xsl:template><xsl:template match="Text">
<para>
<xsl:apply-templates />
</para>
</xsl:template>
<xsl:template match="Intref">
<xsl:choose>
<xsl:when test="ancestor::Fnote">
<link id="{@Refid}">
<xsl:apply-templates />
</link>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="starts-with(@Refid, 'Pref')">
<footnote id="{@Refid}"
label="{../following-sibling::Fnote[@Id = current()/@Refid]/@Label}">
<xsl:copy-of select="../following-sibling::Fnote[@Id =
current()/@Refid]//text()" />
</footnote>
</xsl:when>
<xsl:when test="starts-with(@Refid, 'Page')">
<xsl:apply-templates />
</xsl:when>
<xsl:when test="starts-with(@Refid, 'Ch')">
<footnote id="{@Refid}"
label="{../following-sibling::Fnote[@Id = current()/@Refid]/@Label}">
<xsl:apply-templates
select="../following-sibling::Fnote[@Id = current()/@Refid]" />
</footnote>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template><xsl:template match="Fnote"> <xsl:apply-templates/> </xsl:template> <xsl:template match="Smalltext"> <xsl:apply-templates/> </xsl:template> <xsl:template match="Emphasis"> <xsl:copy-of select="." /> </xsl:template> </xsl:stylesheet> the desired output is produced: <?xml version="1.0" encoding="UTF-8"?>
<document>
<para>This zine is about Egyptology<footnote id="Pref02fn1" label="1">1. Sour
ce: United
Nations.</footnote> 50</para>
<para>States Accepting the<footnote id="Pref02fn2" label="2">2. Source:
International.</footnote>
127</para>
<para>Structure that consists of 191 nation states.<footnote id="Ch01Fn01" la
bel="1.">
<Emphasis Type="Bold">1.</Emphasis> As of 2005, NCB#state,NCB% see <link
id="Ch02Lev1001">Chapter 2(A)</link>.</footnote>.</para>
</document>Regards, Mukul On 7/3/06, Byomkesh <bkesh@xxxxxxxxxxxxxxx> wrote: Hi,
|

Cart



