|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Question about xsl, xml,javascript
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






