|
Subject: Question about xsl, xml,javascript From: DADBHAWALA@xxxxxxx Date: Sun, 28 Nov 1999 16:38:52 EST |
Hi,
I have been trying to use the following xml and xsl files in ie5
and have not succeded in doing so. The xsl generates the html with the
names of the checkboxes with a "A " and thus the javascript code
does
not recognize the name of the checkbox
For example --> <INPUT align=left name="A " type=checkbox>
I would appreciate if some one could tell what is wrong with the code.
Thanks
Dharmesh
// File:;test.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="test.xsl" ?>
<CITIES>
<RULE>
<![CDATA[
function checkRules()
{
var A = document.question.A.checked;
var B = document.question.B.checked;
var C = document.question.C.checked;
if ( B ) return true;
alert("Sorry wrond answer");
return false;
}
]]>
</RULE>
<CITY ID="A" >
<NAME> San Jose </NAME>
</CITY>
<CITY ID="B">
<NAME> Washington </NAME>
</CITY>
<CITY ID="B">
<NAME> New York </NAME>
</CITY>
</CITIES>
File::test.xsl
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<head>
<script langauge="javascript">
<xsl:value-of select="CITIES/RULE"/>
</script>
</head>
<form method="post" name="question" onSubmit="return checkRules()">
Which of the following cities is the capital of USA
<xsl:for-each select="CITIES/CITY" >
<dt>
<input type="checkbox" align="left" >
<xsl:attribute name="name">
<xsl:value-of select="@ID"/>
</xsl:attribute>
</input>
</dt>
<xsl:value-of select="."/>
</xsl:for-each>
<a href="javascript:checkRules()">Check Criteria</a>
</form>
</xsl:template>
</xsl:stylesheet>
// html output
<HEAD>
<SCRIPT langauge="javascript">
function checkRules()
{
var A = document.question.A.checked;
var B = document.question.B.checked;
var C = document.question.C.checked;
if ( B ) return true;
alert("Sorry wrond answer");
return false;
}
</SCRIPT>
</HEAD>
<FORM method=post name=question onsubmit="return checkRules()">Which of the
following cities is the capital of USA
<DT><INPUT align=left name="A " type=checkbox> San Jose
<DT><INPUT align=left name="B " type=checkbox> Washington
<DT><INPUT align=left name="B " type=checkbox> New York
<A href="javascript:checkRules()">Check Criteria</A>
</FORM>
</DT>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: Extended file extentions (XfeX), Liam R. E. Quin | Thread | Re: Question about xsl, xml,javascr, Phil Lanch |
| RE: Extended file extentions (XfeX), Liam R. E. Quin | Date | RE: modifiable variables, Nicolas DELAHAYE |
| Month |