I'm trying to use Javascript in my XSLT sheet to hide and reveal XML elements.
I would like there to be links at the top of the page that makes text elsewhere in the page appear or dissapear.
So far I can just show/hide the content of an element where that element is being processed.
Im using my XSLT style sheet to place this in the head section of the HTML document that gets generated
and this in the XSLT style sheet to get the link to show, and to make the contents of the element show/hide
I would like there to be links at the top of the page that makes text elsewhere in the page appear or dissapear.
So far I can just show/hide the content of an element where that element is being processed.
Im using my XSLT style sheet to place this in the head section of the HTML document that gets generated
Code:
<script type="text/javascript">
function toggle(element) {
if (element.style.display == 'none') {
element.style.display = 'block';
} else {
element.style.display = 'none';
}
}
</script>
and this in the XSLT style sheet to get the link to show, and to make the contents of the element show/hide
Code:
<xsl:template match="instruction">
<span onclick="toggle(lstyle);">[Instruction]</span>
<div id="lstyle" style="display: none;">
<ul ><li>
<xsl:apply-templates select="step"/>
</li></ul>
</div>
</xsl:template>