>The XML element has an attribute "type" and I would like to apply a
>template in different mode depending on the value of "type".
>If I first get the value of the attribute, I can apply the template
>in a specific mode:
>  <xsl:choose>
>    <xsl:when test="@type = 'vdtPTD'">
>      <xsl:apply-templates select="." mode="vdtPTD" />
>    </xsl:when>
>    ...
>  </xsl:choose>
>but it requires number of <xsl:when> calls.

The mode attribute of xsl:apply-templates is not an attribute value
template (AVT), so the above is the best way to do it. You might want
to compare the above to a predicate-based system:
<xsl:template match="[EMAIL PROTECTED] = 'vdtPTD']">
There may be better optimizations on predicates than on modes.

XSLT 2.0 will allow one template to be in effect for several modes, FWIW.
.................David Marston

Reply via email to