D
Dwayne Wilkinson
Hi,
I need to number a set of PARA nodes as outlined below:
<?xml version="1.0" encoding="utf-8"?>
<DESCRIPT>
<PARA0>
<PARA>Paragraph 1</PARA>
</PARA0>
<PARA0>
<PARA>Paragraph 2</PARA>
<SPECPARA>
<CAUTION>
<PARA>Special Caution paragraph 1</PARA>
</CAUTION>
<PARA>Paragraph 3</PARA>
</SPECPARA>
<PARA>Paragraph 4</PARA>
</PARA0>
<DESCRIPT>
<!-- Desired Output:
1. Paragraph 1
2. Paragraph 2
-- CAUTION --
Special Caution paragraph 1
3. Paragraph 3
Paragraph 4
I have created the following XSLT to do this, but it doesn't quite
work the way I'd like:
<!-- SNIP -->
<xsl:template match="PARA">
<xsl:choose>
<xsl:when test="(name(../..) = 'PARA0' and name(..) = 'SPECPARA')
or name(..) = 'PARA0'">
<table style="width:100%;border:0;" class="para0">
<tr style="vertical-align:top;">
<td style="width:12mm;font-weight:bold;">
<xsl:if test="self::node() [generate-id() =
generate-id(parent::node()/child:
ARA [position() = 1])]">
<xsl:number format="1. "
count="PARA0 [PARA != '' or SPECPARA/PARA = '']"
level="single" />
</xsl:if>
</td>
<td class="para">
<a>
<xsl:attribute name="name">
<xsl:value-of select="@ID"/>
</xsl:attribute>
<xsl:apply-templates />
</a>
</td>
</tr>
</table>
</xsl:when>
<!-- SNIP -->
This produces the following results:
1. Paragraph 1
2. Paragraph 2
2. Paragraph 3
Paragraph 4
Any help on how to number Paragraph 3 as 3 instead of 2 would be
greatly appreciated.
Regards
Dwayne
I need to number a set of PARA nodes as outlined below:
<?xml version="1.0" encoding="utf-8"?>
<DESCRIPT>
<PARA0>
<PARA>Paragraph 1</PARA>
</PARA0>
<PARA0>
<PARA>Paragraph 2</PARA>
<SPECPARA>
<CAUTION>
<PARA>Special Caution paragraph 1</PARA>
</CAUTION>
<PARA>Paragraph 3</PARA>
</SPECPARA>
<PARA>Paragraph 4</PARA>
</PARA0>
<DESCRIPT>
<!-- Desired Output:
1. Paragraph 1
2. Paragraph 2
-- CAUTION --
Special Caution paragraph 1
3. Paragraph 3
Paragraph 4
I have created the following XSLT to do this, but it doesn't quite
work the way I'd like:
<!-- SNIP -->
<xsl:template match="PARA">
<xsl:choose>
<xsl:when test="(name(../..) = 'PARA0' and name(..) = 'SPECPARA')
or name(..) = 'PARA0'">
<table style="width:100%;border:0;" class="para0">
<tr style="vertical-align:top;">
<td style="width:12mm;font-weight:bold;">
<xsl:if test="self::node() [generate-id() =
generate-id(parent::node()/child:
<xsl:number format="1. "
count="PARA0 [PARA != '' or SPECPARA/PARA = '']"
level="single" />
</xsl:if>
</td>
<td class="para">
<a>
<xsl:attribute name="name">
<xsl:value-of select="@ID"/>
</xsl:attribute>
<xsl:apply-templates />
</a>
</td>
</tr>
</table>
</xsl:when>
<!-- SNIP -->
This produces the following results:
1. Paragraph 1
2. Paragraph 2
2. Paragraph 3
Paragraph 4
Any help on how to number Paragraph 3 as 3 instead of 2 would be
greatly appreciated.
Regards
Dwayne