James
James

Reputation: 6008

XSLT character-escaping query

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.

Upvotes: 1

Views: 335

Answers (2)

jelovirt
jelovirt

Reputation: 5892

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.

Upvotes: 3

gizmo
gizmo

Reputation: 11909

You can't as is. The {name} shortcut doesn't allow additional parameters. Use the <xsl:attribute> tag instead.

Upvotes: 0

Related Questions