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 > and <, 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.
You need to change your XSLT code:
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
aspnamespace in XSLT and use actual ASP.NET code, not text that looks like code.