Friday, May 6, 2011

XSLT character-escaping query

Hello guys,

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.

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

  • 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.

    0xA3 : You are right, I deleted my incorrect answer, +1
    Chad Scira : you learn something every day :) +1

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.