I have the following code: (i use jquery)
<a href="javascript:"
onclick="document.getElementById('TEST').style.display = ( (document.getElementById('TEST').style.display == 'block') ? 'none' : 'block' );">
<xsl:value-of select="$DisplayTitle"/>
</a>
<div id="TEST" style="display:none">
<xsl:value-of select="@Announcement" />
</div>
This works fine. But I’m pulling multiple elements so the only shows of hide’s the first announcement with is logical because that’s the first element with the ID:TEST
Now I would like you use <xsl:value-of select="@ID" /> for the elementbyid
but I can’t just put that between the quotes. The following is not well formatted
<a href="javascript:"
onclick="document.getElementById('<xsl:value-of select="@ID" />').style.display = ( (document.getElementById('TEST').style.display == 'block') ? 'none' : 'block' );">
<xsl:value-of select="$DisplayTitle"/>
</a>
any tips on how to format this correct?
You need to use the
<xsl:attribute>command within the element you wish the attribute to be placed…UPDATE based on comments by OP…
As I said above,
<xsl:attributemust be WITHIN the element you wish the attribute to be used… in fact it must be the FIRST command afterwards.Instead of…
You should have (formatted with newlines for viewing here)…