<xsl:choose> and <xsl:otherwise> problem
Hello,
I am creating a simple XSLT using the <xsl:choose> instruction to conditionally handle varying attributes for a <Para> tag in my file.
The test branching seems to work just fine, the problem is that the <xsl:otherwise> alwise fires, even when one of the other branches has already executed.
Here is the code snippet:
<xsl:template match="Para">
<p>
<xsl:choose>
<xsl:when test="@Justify='Center'">
<center>
<xsl:value-of select="." />
</center>
</xsl:when>
<xsl:when test="@FirstLineIndent='7'">
<xsl:text> </xsl:text>
<xsl:value-of select="." />
</xsl:when>
<xsl:when test="@FirstLineIndent='13'">
<xsl:text> &nbs p;
</xsl:text>
<xsl:value-of select="." />
</xsl:when>
<xsl:when test="@FirstLineIndent='19'">
<xsl:text> &nbs p;
&n bsp;
</xsl:text>
<xsl:value-of select="." />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
</p>
</xsl:template>
So in the example, after a <center> 'd paragraphs text is displayed correctly, the <xsl:otherwise> displays the text again, resulting in double output.
Thanks for any help with this.
Dan
|