XSLT character-escaping query

xslt

Lets say I have the following code snippet below, how do I also apply the disable-output-escaping to the {name} in the title attribute?

<a title="{name}"><xsl:value-of select="name" disable-output-escaping="yes" /></a>

This has really got me stumped.

Thanks guys.

Best Answer

This cannot be done with XSLT. The spec says:

It is an error for output escaping to be disabled for a text node that is used for something other than a text node in the result tree.

Thus it makes no difference if you use Attribute Value Templates or xsl:attribute with xsl:value-of, because you're generating an attribute node, not a text node. It's a limitation in the language.

Related Topic