XSLT renders &gt; and &lt; for >< how to do I get around this?

asp.net, xslt

Solution

You need to change your XSLT code:

<span>
  <asp:LinkButton ID="{ID}" onclick="LinkClicked">
    <xsl:value-of select="."/>
  </asp:LinkButton>
</span> 

All this CDATA juggling is not only bad for everybody's eyes, but also the wrong approach no matter how you look at it.

Declare the `asp` namespace in XSLT and use actual ASP.NET code, not text that looks like code.

Problem

I have some code wrapped in a CDATA tag in an xslt file: ``` <span> <xsl:text><![CDATA[<asp:LinkButton ID ="]]></xsl:text><xsl:value-of select="ID"/> <xsl:text><![CDATA[" onclick="LinkClicked">]]></xsl:text > <xsl:value-of select="."/> <xsl:text><![CDATA[</asp:LinkButton>]]></xsl:text> </span> ``` When it renders in the page it is `&gt;` and `&lt;`, how do I get around this? Now I know a work around as I can do a replace within the string after this is rendered, but this doesn't seem like the best approach.

Original source