How can I pass the value of a xsl:variable into the id of a checkbox?
My code looks like this:
<xsl:variable name="CB_ID">
<xsl:value-of select = "ID"/>
</xsl:variable>
....
<input type="checkbox" id="?????" onclick=""/>
???? What do I need to fill in here to get the value of the
variable CB_ID?
Write input type="checkbox" id="{$CB_ID}" onclick=""/>
It's called an "attribute value template" which should help you to look
it up in your favourite XSLT book.
By the way, try to get out of the habit of writing
<xsl:variable name="CB_ID">
<xsl:value-of select = "ID"/>
</xsl:variable>
when you could write
<xsl:variable name="CB_ID" select="ID"/>
This might seem a cosmetic difference, but you're putting the XSLT
processor to a lot of trouble to construct a tree, or to work out that
you don't actually need one, when all that you need is a string.
Michael Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list