[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to use xslt variable in javascript embedded in
At 10:34 AM 5/10/2002, you wrote:
I'm trying to use a variable in my javascript which is embedded in my stylesheet. Can you give me some suggestions on how to use it? This question keeps coming up in this group so I feel that the following needs to be reiterated. Aside from MSXSL extension functions that use JavaScript directly DURING the transformation process, JavaScript never knows that XSLT exists. When you want to create JavaScript code using XSLT, it is exactly the same procedure as creating any textual content -- you simply write it out. The only "special" qualities about JavaScript code -- as far as XSLT should be concerned -- is that it tends to use special characters that need to be ignored by the XSLT processor. Such strings are often "<", ">", "&", and "--". These can be outputted using d-o-e on some processors, and CDATA sections in others (or both). Here is part of my stylesheet and the javascript embedded. I would like to define a variable "path" using <xsl:variable name="path">/development/jsp/markRecords.jsp</xsl:variable> and use this variable in my javascript below. So, break out of the current CDATA section, output the textual value of the XSL variable, and enter another CDATA section. <![CDATA[ // Previous JavaScript code var path = "]]><xsl:value-of select="$path" /><![CDATA["; // Rest of JavaScript code ]]>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|