This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: error in javascript, that is generated from xsl


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 (" ...) 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@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Thomas B.
Passin
Subject: Re: [xsl] 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]