M
Mark Constant
I have a drop-down list now and I got it so when something is selected
from the drop down list it calls a JavaScript function. I want it so
the value selected from the drop-down list is sent as a parameter to
the xslt file. When I select a value from the drop-down list nothing
appears. I want just a basic listing of Title, Image, and Description
outputed. I have done a basic JavaScript that uses the .write()
function and that worked so the value is getting sent to the
JavaScript function from the drop-down list. So the problem has to be
with the .addParameter function. What could I be missing?
Here is my javascript and drop-down menu.
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<SELECT name="select1" onchange='CallXML(this.form.select1);'>
<OPTION value="Ratchet and Clank">Ratchet and Clank</OPTION>
<OPTION value="Sly Cooper">Sly Cooper</OPTION>
</SELECT>
</form>
</body>
<script language="javascript">
function CallXML(dropdown)
{
var myindex = dropdown.selectedIndex;
var SelValue = dropdown.options[myindex].value;
xml = new ActiveXObject("Msxml2.DOMDocument.4.0");
xml.async = false;
xml.load("Games.xml");
xslt = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
xslt.async = false;
xslt.load("Games.xslt");
xslTemp = new ActiveXObject("Msxml2.XSLTemplate.4.0");
xslTemp.stylesheet = xslt;
var xslProc = xslTemp.createProcessor();
xslProc.input = xml;
xslProc.addParameter(Title, SelValue);
xslProc.transform;
xslProc.output;
}
</script>
Here is my xslt file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lc="http://mark/DevelopmentWebsite">
<xsl
utput method="html"/>
<xsl
aram name="Title"/>
<xsl:template match="/">
<h2>My Game Collection</h2>
<table border="1">
<xsl:for-each select="lc:Entertainment/lc:GameList[lc:Title =
$Title]">
<tr>
<th colspan="2"><xsl:value-of select="lc:Title"/></th>
</tr>
<tr>
<td>
<xsl:element name="IMG">
<xsl:attribute name="SRC">
<xsl:value-of select="lc:Image"/>
</xsl:attribute>
</xsl:element>
</td>
<td><xsl:value-of select="lc
escription"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
from the drop down list it calls a JavaScript function. I want it so
the value selected from the drop-down list is sent as a parameter to
the xslt file. When I select a value from the drop-down list nothing
appears. I want just a basic listing of Title, Image, and Description
outputed. I have done a basic JavaScript that uses the .write()
function and that worked so the value is getting sent to the
JavaScript function from the drop-down list. So the problem has to be
with the .addParameter function. What could I be missing?
Here is my javascript and drop-down menu.
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<SELECT name="select1" onchange='CallXML(this.form.select1);'>
<OPTION value="Ratchet and Clank">Ratchet and Clank</OPTION>
<OPTION value="Sly Cooper">Sly Cooper</OPTION>
</SELECT>
</form>
</body>
<script language="javascript">
function CallXML(dropdown)
{
var myindex = dropdown.selectedIndex;
var SelValue = dropdown.options[myindex].value;
xml = new ActiveXObject("Msxml2.DOMDocument.4.0");
xml.async = false;
xml.load("Games.xml");
xslt = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
xslt.async = false;
xslt.load("Games.xslt");
xslTemp = new ActiveXObject("Msxml2.XSLTemplate.4.0");
xslTemp.stylesheet = xslt;
var xslProc = xslTemp.createProcessor();
xslProc.input = xml;
xslProc.addParameter(Title, SelValue);
xslProc.transform;
xslProc.output;
}
</script>
Here is my xslt file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:lc="http://mark/DevelopmentWebsite">
<xsl
<xsl
<xsl:template match="/">
<h2>My Game Collection</h2>
<table border="1">
<xsl:for-each select="lc:Entertainment/lc:GameList[lc:Title =
$Title]">
<tr>
<th colspan="2"><xsl:value-of select="lc:Title"/></th>
</tr>
<tr>
<td>
<xsl:element name="IMG">
<xsl:attribute name="SRC">
<xsl:value-of select="lc:Image"/>
</xsl:attribute>
</xsl:element>
</td>
<td><xsl:value-of select="lc
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>