With XSLT, how do I output the following
<div onclick="var e = document.getElementById('<xsl:value-of select="div_id"/>');
if(e.style.display == 'block')
e.style.display = 'none';
else
{
e.style.display = 'block';
e.scrollIntoView();
}"
style="text-decoration: underline; color: blue;"
>Toggle</div>
Note: The code should reside in onclick attribute, I have access only to the body of the document.
One way to do this is by using AVT (Attribute Value Templates):
When this transformation is applied on the following XML document:
the wanted result is produced:
Do note: When specifying such AVT (attribute-value-template) one must double any
{or}characters that must be generated.Another way is to use
xsl:attribute: