我的xml和xsl文件如下:
nu.xml:
1<cd>
2<abc></abc>
3</cd>
nu.xsl:
1<xsl:stylesheet result-ns="" xmlns="http://www.w3.org/TR/REC-html40" xmlns:xsl="http://www.w3.org/TR/WD-xsl">
2<xsl:template>
3<xsl:apply-templates></xsl:apply-templates>
4</xsl:template>
5<xsl:template match="/">
6<html>
7<head>
8<script>
9<![CDATA[
10function getNumber(iNumber)
11{
12if (document.all.text.innerText.length<8)
13{
14document.all.text.innerText+= iNumber;
15}
16else
17{
18document.all.text.innerText+= "";
19}
20}
21]]>
22</script>
23<title></title>
24</head>
25<body>
26<xsl:apply-templates select="CD/abc"></xsl:apply-templates>
27</body>
28</html>
29</xsl:template>
30<xsl:template match="abc">
31<form>
32<body>
33<table border="0" cellpadding="0" cellspacing="0" height="345" width="81%">
34<tr>
35<td height="345" width="54%">
36<table align="center" border="3" cellpadding="0" cellspacing="0" height="56" width="80%">
37<tr>
38<td id="text"></td>
39</tr>
40</table></td>
41<td width="46%"><table border="0" cellpadding="0" cellspacing="0" width="325">
42<tr>
43<td width="116"><img border="0" height="81" onclick="getNumber(1)" src="images/shuru_a_02.jpg" style="cursor: hand;" width="116"/></td>
44<td width="108"><img border="0" height="81" onclick="getNumber(2)" src="images/shuru_a_03.jpg" style="cursor: hand;" width="108"/></td>
45<td width="101"><img border="0" height="81" onclick="getNumber(3)" onmousedown="javascript:src='images/shuru_b_04.jpg'" src="images/shuru_a_04.jpg" style="cursor: hand;" width="101"/></td>
46</tr>
47<tr>
48<td><img border="0" height="91" onclick="getNumber(4)" src="images/shuru_a_06.jpg" style="cursor: hand;" width="116"/></td>
49<td><img border="0" height="91" onclick="getNumber(5)" src="images/shuru_a_07.jpg" style="cursor: hand;" width="108"/></td>
50<td><img border="0" height="91" onclick="getNumber(6)" src="images/shuru_a_08.jpg" style="cursor: hand;" width="101"/></td>
51</tr>
52<tr>
53<td><img border="0" height="89" onclick="getNumber(7)" src="images/shuru_a_09.jpg" style="cursor: hand;" width="116"/></td>
54<td><img border="0" height="89" onclick="getNumber(8)" src="images/shuru_a_10.jpg" style="cursor: hand;" width="108"/></td>
55<td><img border="0" height="89" onclick="getNumber(9)" src="images/shuru_a_11.jpg" style="cursor: hand;" width="101"/></td>
56</tr>
57<tr>
58<td></td>
59<td><img border="0" height="84" onclick="getNumber(0)" src="images/shuru_a_13.jpg" style="cursor: hand;" width="108"/></td>
60<td></td>
61</tr>
62</table></td>
63</tr>
64</table>
65</body>
66</form>
67</xsl:template>
68</xsl:stylesheet>
要实现的是,点击右边的数字图片,在左边的表格框内输入相应的数字,左边的表格框内要输入一个8位数的数字;现在我写的xsl总是出错,说缺少对象,请大侠看看,多谢!
---------------------------------------------------------------
1<script>
2<![CDATA[
3function getNumber(iNumber)
4{
5if (document.all.text.innerText.length<8)
6{
7document.all.text.innerText+= iNumber;
8}
9else
10{
11document.all.text.innerText+= "";
12}
13}
14]]>
15</script>
==〉
1<script language="javascript">
2<xsl:comment>
3<![CDATA[
4function getNumber(iNumber)
5{
6if (document.all.text.innerText.length < 8)
7{
8document.all.text.innerText+= iNumber;
9}
10else
11{
12document.all.text.innerText+= "";
13}
14}
15]]>
16</xsl:comment>
17</script>
:_)