I would like to create a template in xslt with a condition on the parameter of the tag I am matching.
for exemple:
If I have the tags <par class="class1"> and <par class="class2">
I would like to create a template like this :
<xsl:template match="par">
<xsl:if test="class=class1">
<fo:block
space-before="3pt"
space-after="3pt">
<xsl:apply-templates />
</fo:block>
</xsl:if>
<xsl:otherwise>
<fo:block
space-before="10pt"
space-after="10pt">
<xsl:apply-templates />
</fo:block>
</xsl:otherwise>
</xsl:template>
But it doesn’t work. How can I test on the parameter of the tag ?
thanks in advance.
The technical term for these “parameters” is “attributes” (just in case that helps for future searches) and you refer to them with
@classetc.Also note that
<xsl:otherwise>is not for<xsl:if>, but for<xsl:choose>:Or, to better show the actual differences,