xml.xml
1<viewentries toplevelentries="5">
2<viewentry children="5" descendants="5" position="1" siblings="5">
3<entrydata category="true" columnnumber="0" name="AppCategory">
4<text>个人事务</text>
5</entrydata>
6</viewentry>
7<viewentry noteid="9A6" position="1.1" siblings="5">
8<entrydata columnnumber="1" name="AppName">
9<text>电子公告</text>
10</entrydata>
11</viewentry>
12<viewentry noteid="9BA" position="1.2" siblings="5">
13<entrydata columnnumber="1" name="AppName">
14<text>电子公告</text>
15</entrydata>
16</viewentry>
17<viewentry children="4" descendants="4" position="2" siblings="5">
18<entrydata category="true" columnnumber="0" name="AppCategory">
19<text>个性设置</text>
20</entrydata>
21</viewentry>
22<viewentry noteid="9B2" position="2.1" siblings="4">
23<entrydata columnnumber="1" name="AppName">
24<text>个性界面</text>
25</entrydata>
26</viewentry>
27<viewentry noteid="9D2" position="2.2" siblings="4">
28<entrydata columnnumber="1" name="AppName">
29<text>个性界面</text>
30</entrydata>
31</viewentry>
32</viewentries>
xsl.xsl
1<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2<xsl:template match="/">
3<style type="text/css">
4<xsl:comment>
5<![CDATA[
6.on {DISPLAY: inline}
7.off {DISPLAY: none}
8.menu{cursor:hand;font-size:13px;text-decoration:none;color:#0000ff;}
9.cur_pos {cursor:hand;font-size:13px; color: #000000; text-decoration:none;}
10]]>
11</xsl:comment>
12</style>
13<script language="javascript">
14<xsl:comment>
15<![CDATA[
16function ugiAction(id)
17{
18alert(document.all.item(id))
19if(document.all.item(name)!=null)
20with(document.all.item(id))
21{
22if(className!="off")
23className="off"
24else
25className="on";
26}
27alert(document.all.item(id).className)
28}
29]]>
30</xsl:comment>
31</script>
32<xsl:apply-templates></xsl:apply-templates>
33</xsl:template>
34<xsl:template match="data" mode="default">
35<xsl:apply-templates></xsl:apply-templates>
36</xsl:template>
37<xsl:template match="viewentry">
38<div>
39<xsl:attribute name="id">aa_<xsl:value-of select="@name"></xsl:value-of></xsl:attribute>
40<xsl:if test="@id!='AppCategory'"><xsl:attribute name="class">on</xsl:attribute></xsl:if>
41<xsl:apply-templates></xsl:apply-templates>
42</div>
43</xsl:template>
44<xsl:template match="entrydata">
45<xsl:if test="@name='AppCategory'">
46<table height="10" width="127"><tr><td></td></tr></table>
47<div style="text-align:center;width:127;height:24;background-image:url(image/menu_bg.gif);">
48<xsl:attribute name="class">on</xsl:attribute>
49<xsl:attribute name="onclick">ugiAction('aa_<xsl:value-of select="@id"></xsl:value-of>')
50</xsl:attribute>
51<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
52<tr>
53<td align="center" class="menu" valign="middle">
54<xsl:value-of select="text"></xsl:value-of>
55</td>
56</tr>
57</table>
58</div>
59</xsl:if>
60<xsl:if test="@name='AppName'">
61<div style="text-align:center;width:127;height:24;background-image:url(image/item_bg.gif);">
62<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
63<tr>
64<td align="center" class="cur_pos" valign="middle">
65<xsl:value-of select="text"></xsl:value-of>
66</td>
67</tr>
68</table>
69</div>
70</xsl:if>
71</xsl:template>
72</xsl:stylesheet>
为什么我得不到真确得id,我这样做是不是思路有问题,由于初学,我在这上面花了好久的时间,还是不的要领,请各位高手指点!小弟拜谢!!
---------------------------------------------------------------
tell us what display you want, and we will show you a working example