Thursday, 8 January 2009

Output literal text from XSLT

A colleague (Neil Pullinger) and my self have both come across the same problem. Getting the PICS tag to show correctly whilst using Sitecore.

The example below is wrong, as the quotes have been escaped.
<meta http-equiv="PICS-Label" content="(pics-1.1 &quot;http://www.icra.org/pics/vocabularyv03/&quot; I gen true for &quot;http://www.xxxxxx.com&quot; r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 0))" />

The required output is:
<meta http-equiv="PICS-Label" content='(pics-1.1 "http://www.icra.org/pics/vocabularyv03/" I gen true for "http://www.xxxxxx.com" r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 0))' />

To achive the second option, we had to use

<xsl:text disable-output-escaping="yes">
<![CDATA[<meta http-equiv="PICS-Label" content=']]>
</xsl:text>
<xsl:value-of select="$picsrating" />
<xsl:text disable-output-escaping="yes">
<![CDATA[' />]]>
</xsl:text>

No comments: