[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML + Javascript

Subject: [xsl] XML + Javascript
From: ケンジイ ムヤモト <kenjii.muyamoto@xxxxxxxxx>
Date: Tue, 30 Nov 2004 15:41:17 -0800
xml javascript
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.