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

Question about xsl, xml,javascript

Subject: Question about xsl, xml,javascript
From: DADBHAWALA@xxxxxxx
Date: Sun, 28 Nov 1999 16:38:52 EST
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&#13;&#10;" 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&#13;&#10;" type=checkbox> San Jose 
<DT><INPUT align=left name="B&#13;&#10;" type=checkbox> Washington 
<DT><INPUT align=left name="B&#13;&#10;" 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

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.