I am trying to allow a user to click on an item and the item pop up in a dialog box using JavaScript. Here is my xsl code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <HTML> <HEAD> <script LANGUAGE="javascript"> </SCRIPT> </HEAD> <BODY> <TABLE border="0" cellpadding="3" cellspacing="3"> <TR> <TH style="background-color:beige">Name</TH> <TH style="background-color:beige">Salary</TH> <TH style="background-color:beige">Dept.</TH> </TR> <xsl:for-each select="employees/employee" order-by="name"> <xsl:variable name="Dept" select="department" /> <TR VALIGN="top" onmouseover="this.style.backgroundColor='lightcyan'" onmouseout="this.style.backgroundColor='white'" style="background-color:white;cursor:hand" onclick="alert('You are in the '{Dept}' Department!)"> <TD> <xsl:value-of select="name"/> </TD> <TD> <xsl:value-of select="salary"/> </TD> <TD> <xsl:value-of select="department"/> </TD> </TR> </xsl:for-each> </TABLE> </BODY> </HTML> </xsl:template></xsl:stylesheet>
Here is the XML code that is connecting to it:
<?xml version="1.0" ?><?xml-stylesheet type="text/xsl" href="employees18.xsl"?><employees> <employee id="123"> <name>Roberts</name> <salary payperiod="weekly">23500</salary> <department>Development <title>Developer</title> </department> </employee> <employee id="124"> <name>Freestone</name> <salary payperiod="weekly">51000</salary> <department>Human Resources <title>Recruiter</title> </department> </employee></employees>
When I run this file I get the following error, rather I delete the namespace (xmlns:xsl="http://www.w3.org/TR/WD-xsl") or leave it.Keyword xsl:variable may not be used in namespace http://www.w3.org/TR/WD-xsl. Any help would be greatly appreciated.Thanks,Scott