[xslt] Using xpath expressions for mode attribute



Hi all,

Could the mode of <apply-templates> be an xpath expression?

Essentially, I have a stylesheet that looks like:

<xsl:sylesheet>
<xsl:param name="mode" select="'normal'"/>
<xsl:template match="/">
<xsl:choose>
<xsl:when select="$mode = 'normal'"><xsl:apply-templates select="."
mode="normal"/></xsl:when>
<xsl:when select="$mode = 'simple'"><xsl:apply-templates select="."
mode="simple"/></xsl:when>
</xsl:choose>
</xsl:template>

<xsl:template match="/" mode="normal">normal</xsl:template>
<xsl:template match="/" mode="simple">simple</xsl:template>

</xsl:stylesheet>

----  I would like to do 

<xsl:template match="/"><xsl:apply-templates  select="."
mode="{$mode}"/></xsl:template>

To do this xsltApplyTemplatesComp would have to evaluate the expression, but
I fairly sure this would violate spec.  Can anyone confirm/deny if this
violates the spec?

Thanks




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]