
April 8th, 2008, 10:27 AM
|
|
|
|
Setting HTML attributes with XSL
Hi all
I have a value that is made up of a number of different XML attributes for an individual item. I want to use that to dynamically (on XSLT procesing) generate the name of DIVs and be passed to JavaScript functions as the parameters.
XML
Code:
<row valx='1' valy='2' />
Current XSL -- edited to show you the relevant area
Code:
<tr><td colspan='3'><div id='div<xsl:value-of select="@VALX"/><xsl:value-of select="@VALY"/>' style='display:none'></div></td></tr>
Intended HTML
Code:
<tr><td colspan='3'><div id='div12' style='display:none'></div></td></tr>
The idea is to create the div which will be filled with data once the row above is clicked by a user (via AJAX).
I presume this CAN be done via XSL. I have already tried setting an XSL variable but it is not recognised by my code highlighter (vim) or xsltproc so I presume I can't use that instead.
The variable code looked:
Code:
<xsl:variable name=variable><xsl:value-of select="@VALX"/><xsl:value-of select="@VALY"/></xsl:variable>
<tr><td colspan='3'><div id='div{$variable}' style='display:none'></div></td></tr>
Thanks in advance for any help!
|