[xsl] XML + Javascript

Subject: [xsl] XML + Javascript
From: ケンジイ ムヤモト <kenjii.muyamoto@xxxxxxxxx>
Date: Tue, 30 Nov 2004 15:41:17 -0800
I'm having trouble with Javascript in XML.  For one, the alert box
won't come up:
XML
====================================================================
<?xml version="1.0" encoding="UTF-16" ?>
<?xml-stylesheet type="text/xsl" href="homework-style.xsl" ?>
<xml>
<head>
	<title>Homework Pages</title>
	<link rel="stylesheet" type="text/css" href="homework-style.css" />
</head>
<body>
	<day date="2004-11-29">
		<homework period="1">Read pages 1-10.</homework>
		<homework period="2">None</homework>
	</day>
	<day date="2004-12-16">
		<homework period="4">Big vriting project</homework>
	</day>
</body>
</xml>


XSLT:
====================================================================
<?xml version="1.0" encoding="UTF-16" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:variable name="choice">
	<script type="text/javascript">
		var choice = prompt("Date? (YYYY-MM-DD)");
		document.write(choice);
	</script>
</xsl:variable>
<xsl:template match="xml">
	<html>
		<xsl:apply-templates />
	</html>
</xsl:template>
<xsl:template match="head">
	<head>
		<title><xsl:value-of select="title" /></title>
		<xsl:for-each select="link">
			<link>
				<xsl:attribute name="rel"><xsl:value-of select="@rel" /></xsl:attribute>
				<xsl:attribute name="type"><xsl:value-of select="@type" /></xsl:attribute>
				<xsl:attribute name="href"><xsl:value-of select="@href" /></xsl:attribute>
			</link>
		</xsl:for-each>
	</head>
</xsl:template>
<xsl:template match="body">
	<body>
		<table>
			<xsl:apply-templates />
		</table>
	</body>
</xsl:template>
<xsl:template match="day">
	<xsl:if test="($choice) = @date">
		<xsl:apply-templates>
			<xsl:sort select="homework/@period" order="ascending" />
		</xsl:apply-templates>
	</xsl:if>
</xsl:template>
<xsl:template match="homework">
	<tr>
		<th><xsl:value-of select="@period" /></th>
		<td><xsl:value-of select="." /></td>
	</tr>
</xsl:template>
</xsl:stylesheet>

Current Thread