[
Lists Home |
Date Index |
Thread Index
]
Hi,
I am facing problem in passing parameter to XSL
thru javascript.. Please have a look at the following
code and let me know if there is anything wrong in
it...
XSL code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="art" select="Bonnie"></xsl:param>
<xsl:template name="testp" match="/">
<html>
<body>
<table border="2" bgcolor="yellow">
<tr>
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each
select="CATALOG/CD[ARTIST=$art]">
<tr>
<td><xsl:value-of select="TITLE"/></td>
<td><xsl:value-of select="ARTIST"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
*******************************************************
javascript code:
<html>
<body>
<script language=javascript>
// Load XML
var xml = new
ActiveXObject("MSXML2.FreeThreadedDOMDocument")
xml.async = false
xml.load("cd_catalog.xml")
// Load the XSL
var xsl = new
ActiveXObject("MSXML2.FreeThreadedDOMDocument")
xsl.async = false
xsl.load("cd_catalog_filter.xsl")
var xout = new
ActiveXObject("MSXML2.FreeThreadedDOMDocument")
var myTemplate = new
ActiveXObject("MSXML2.XSLTemplate")
myTemplate.stylesheet = xsl
var art="bonnie";
var myProc = myTemplate.createProcessor();
myProc.input = xml
myProc.output = xout
myProc.setParameter ("art","Bonnie");
myProc.transform()
// Transform
document.write(xml.transformNode(xsl))
</script>
</body>
</html>
*******************************************************
Please let me know if there is any other way of doing
it..
THanks
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
|