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

RE: error in javascript, that is generated from xsl

Subject: RE: error in javascript, that is generated from xsl
From: "Shailesh Valvaikar" <shailesh_valvaikar@xxxxxxxxx>
Date: Wed, 6 Mar 2002 23:10:16 +0530
error document.getelementsbytagname
Thanks Tom, for pointing the errors.
All these showed up due to lot of "trial and test" over the xsl.
I had tried including the entities (&quot; ...) without the CDATA section.

I should have been more careful before posting.

But the .xsl with hardcoded values also gives a problem.
Here is the .xsl.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

		<xsl:template match="/">
		<HTML>
		<HEAD><TITLE>Sample code - Traversing an HTML Table with Javascript and
DOM Interfaces</TITLE>
		<SCRIPT language="Javascript">
					<![CDATA[
					    var current;
					    function displayTable(incr)
					    {
					        current = current + incr;
					        if(current > 4)
					            current = 4; // reset the current if it exceeds the min-max
values
					        if(current < 0)
					            current = 0;
					        var tableData=new Array("A","B","C,"D");
					        var mybody=document.getElementsByTagName("body").item(0);
					        var table = document.getElementsByTagName("TABLE").item(0);
					        mytable = document.createElement("TABLE");
					        mytablebody = document.createElement("TBODY");
					        for(j=current ;  j < 2+current; j++)
					        {
							mycurrent_row=document.createElement("TR");
					          for(i=0; i < 2; i++)
					          {
					                mycurrent_cell=document.createElement("TD");
					                currenttext=document.createTextNode(tableData[j*2 +
i]);
					                mycurrent_cell.appendChild(currenttext);
					                mycurrent_row.appendChild(mycurrent_cell);
					           }
					           mytablebody.appendChild(mycurrent_row);
					        }

					        mytable.appendChild(mytablebody);
					        mybody.appendChild(mytable);
					        mytable.setAttribute("border","2");
					    }

					    function start()
					    {
					        current = 0;
					        displayTable(0);
					    }
					 ]]>
		</SCRIPT>
		</HEAD>
		<BODY onload="start()">
		<form>
		<button name="prev" onclick="displayTable(-2)">Prev</button>
		<button name="next" onclick="displayTable(+2)">Next</button>
		</form>
		</BODY>
		</HTML>
		</xsl:template>

</xsl:stylesheet>


Thanks,
Shailesh
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Thomas B.
Passin
Subject: Re:  error in javascript, that is generated from xsl

You have several error that prevent you from getting correct output.  Here
are the ones I found right away:

1) You use the wrong path to the columns, so your xsl:for-each instruction
returns nothing.  It should read:
...


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


 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.