Jump to content

Make <![cdata[&]]> Equal To Just "&" Not "&"


kvnmck18

Recommended Posts

I am building some canonical elements in an XSLT page.

<link rel="canonical" href="{$CanonicalURL}"/>

But in the source code my "&" is always "&" -- which is usually a good case but not when using a canonical.I have this code in my XSLT:

<xsl:text>http://www.kvnmck18.com/?id=</xsl:text>				  <xsl:value-of select="Page[@ID=$CononicalID]/@ID"/>				  <xsl:text disable-output-escaping="no"><![CDATA[&]]>title=</xsl:text>				  <xsl:value-of select="Page[@ID=$CononicalID]/title"/>

This will display as:

<link rel="canonical" href="http://www.kvnmck18.com/?id=1&title=Title" />
but needs to be like:
<link rel="canonical" href="http://www.kvnmck18.com/?id=1&title=Title" />
How can I do this without throwing errors in the XSLT?
Link to comment
Share on other sites

Why on earth would you want to disable this even for cannonical URLs? The browser (or search engine...) will automatically convert the & to & at parsing time. If you think that the URL your users/crawlers would reach is with "&" instead of "&", you're wrong.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...