I need to adapt an old XSLT file that transforms an XML file into HTML/JS. It doesn’t work anymore.
Here is the original JS code generated in XSLT file :
function processVisibility(item, visible) {
var childs = item.childNodes;
for (var i = 0; i < childs.length; i++) {
if ( (childs.item(i).className == "ArchiveObject")
|| (childs.item(i).className == "Document")
|| (childs.item(i).className == "Attachment") ) {
if (visible) {
childs.item(i).style.display = "block";
} else {
childs.item(i).style.display = "none";
}
}
}
}
The string “< ;” is not transformed into < in the output HTML. As a result, JS code doesn’t work in modern browsers.
If I replace “< ;” with < in the XSLT file, I get an error and that’s normal. So I tried creating a variable:
<xsl:variable name="chevron"><</xsl:variable>
et
function processVisibility(item, visible) {
var childs = item.childNodes;
for (var i = 0; i <xsl:value-of select="$chevron" disable-output-escaping="yes"/> childs.length; i++) {
if ( (childs.item(i).className == "ArchiveObject")
|| (childs.item(i).className == "Document")
|| (childs.item(i).className == "Attachment") ) {
if (visible) {
childs.item(i).style.display = "block";
} else {
childs.item(i).style.display = "none";
}
}
}
}
But the HTML output does not contain < but “< ;”
How can I get < to be generated in HTML using XSLT?
Thank you in advance