This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
including xsl variables inside of a javascript function
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: including xsl variables inside of a javascript function
- From: Heather Lindsay <heather dot lindsay at Trifolium dot com>
- Date: Fri, 21 Jul 2000 14:17:06 -0400
- Reply-To: xsl-list at mulberrytech dot com
hi all,
I have a javascript table imbedded inside of "<![CDATA[" "]]>".
Right now the table includes static data. I want the table data to be from
an xml file. Since the javascript must be inside of the CDATA tags, I can't
just put "<xsl:value-of select="whatever"/>" as the value of a javascript
variable. Please tell me there is some way to do what I need to do. Thanks
for any suggestions you can offer. Let me know if this is not enough
information.
Desperate for help,
Heather
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Dynamic Table</title>
<link rel="stylesheet" type="text/css"/>
<SCRIPT language="javascript"
src="../../../TDF/dev/js/browsercheck.js"></SCRIPT>
<SCRIPT language="javascript" src="../../../TDF/dev/js/TDFPane.js"></SCRIPT>
<SCRIPT language="javascript" src="../js/DTable.js"></SCRIPT>
<xsl:variable name="user" select="Login/UserInfo/UserName"/>
<!-- I would like to use this variable inside the javascript -->
<SCRIPT language="JavaScript">
<![CDATA[
function init() {
var html = '<nobr>Trying another table file</nobr>'
var myTable = new_DTable('Table1', null, 100, 100, 350, 350)
myTable.add_column('firstColumn', 'data1')
myTable.add_column('secondColumn', 'data2')
myTable.add_column('thirdColumn', 'data3')
rowA = new Object()
rowA.data1 = 'Heather' <!-- I would like to say "rowA.data1 =
$user" here but of course can't-->
rowA.data2 = 'needs'
rowA.data3 = 'help'
myTable.append_row(rowA)
rowB = new Object()
rowB.data1 = 'Mickey'
rowB.data2 = 'Disney Land'
rowB.data3 = 'California'
myTable.append_row(rowB)
rowC = new Object()
rowC.data1 = 'Minnie'
rowC.data2 = 'Disney World is the place to be'
rowC.data3 = 'Florida'
myTable.append_row(rowC)
rowD = new Object()
rowD.data1 = 'Alphabet Soup'
rowD.data2 = 'Burger Stew'
rowD.data3 = 'Camel flavored milk'
rowD.data4 = 'just a try'
myTable.append_row(rowD)
var myHeader = myTable.get_header()
myHeader.name= 'The Table that must be!'
myTable.show_header(myHeader,true)
myTable.show_table()
]]>
}
</SCRIPT>
</head>
<BODY onLoad="init()" BGCOLOR="#FFFFFF">
</BODY>
</html>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list