I am transforming xml to html using xslt in .Net 1.1. One part contains a javascript section where 2 vars are ANDed (&&). The transform throws an unknown entity error. What can I do? I have tried 'CDATA' and 'disable-output-escaping' but without success. If I write && then the output is also '&&'.
Here is my code. (trimmed for clarity)
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" standalone="yes" indent="yes" cdata-section-elements="script style"/>
<xsl:template match="/menus">
<html>
<xsl:text disable-output-escaping="yes">
<head>
<title>Portal</title>
<script type="text/javascript">
//
// Show hide language block
//
function lang(s) {
var elD = document.getElementById('german');
var elE = document.getElementById('english');
if(elD && elE) { /// <<---- error occurs here
elD.style.display = s == 'german' ? 'block': 'none';
elE.style.display = s == 'german' ? 'none': 'block';
}
}
</script>
</head>
</xsl:text>
<body>
<h2>Das Portal ist vorübergehend unerreichbar / The Portal is temporarily unavailable</h2>
<div><a href="#" onclick="lang('german')">deutsch</a> | <a href="#" onclick="lang('english')">English</a>
</div>
<div id="german">
<xsl:apply-templates select="//menu[@lang='de']"/>
</div>
<div id="english">
<xsl:apply-templates select="//menu[@lang='en']"/>
</div>
</body>
</html>
</xsl:template>