Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have XSL file that applies stylin

Status
Not open for further replies.

Draug

Programmer
Apr 18, 2001
77
0
0
CA
I have XSL file that applies styling to my XML data. Inside the XSL, there are variables. There are also some Javascript scripts inside the XSL file.

How do I access the XSL variables inside the JS scripts?


Thanks,
Draug
 
If I understand your question correctly, you want to add XSL variables in your JavaScript at the time the document loads. You would do that by inserting the variable directly into the JavaScript as it is being generated by the XSL. Say you are wanting to populate a choice box with the results of an XSL:for-each statement, you would insert the statment directly into the script and the browser, IE5+, or processor would evaluate those statements when the document loads. You do have to be careful trying to use XSL in your scripts where you try to assign values to objects that would require a "" around the value. You may have to use escape characters to get the referrence correct.
Hope this helps.
 
Hi, I have a question that follows on from this thread. Above GiffordS wrote....
You do have to be careful trying to use XSL in your scripts where you try to assign values to objects that would require a "" around the value. You may have to use escape characters to get the referrence correct.

If I want to place the CheckName variable into the name and the CheckValue into the value field of my checkbox, how do I use escape characters in this instance???

<xsl:for-each select=&quot;//Holding&quot;>
<xsl:variable name=&quot;CheckName&quot; select=&quot;Policy/PlanName&quot;/>
<xsl:variable name=&quot;CheckValue&quot; select=&quot;Policy/PolNumber&quot;/>

<tr valign = &quot;top&quot; align=&quot;center&quot;>
<td width=&quot;10%&quot;>
<input type=&quot;checkbox&quot; name=&quot;&quot; value&quot;&quot;/>
</td>
</tr>
</xsl:for-each>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top