xslt.xslt
2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="GBK"/>
<xsl:param name="currpath">/portal/plugin/homepage/web1/left</xsl:param>
<xsl:template match="/">
<div id="divJingjiang">
<ul id="ulMenu">
<xsl:call-template name="TreeNode">
<xsl:with-param name="Nodes" select="tree/*" />
</xsl:call-template>
</ul>
</div>
</xsl:template>
<xsl:template name="TreeNode">
<!--将树集合的节点通过param传过来-->
<xsl:param name="Nodes" />
<!--循环所有子节点,即Item-->
<xsl:for-each select="$Nodes">
<!--计算子节点的数量-->
<xsl:variable name="Count" select="count(tree)" />
<xsl:variable name="linkAddress" select="@linkAddress" />
<xsl:variable name="icon" select="@icon" />
<xsl:variable name="openmode" select="@baseTarget" />
<xsl:variable name="id" select="@id" />
<xsl:variable name="display" select="@display" />
<xsl:variable name="mainMenuId" select="@mainMenuId" />
<li>
<div>
<span class="spanLeft">
<a style="cursor:hand" onclick="javascript:onLeftMenuClick(this,'{$id}','{$linkAddress}','{$openmode}','{$mainMenuId}')">
<!--<img src="{@icon}" border="0"/>-->
<xsl:choose>
<xsl:when test="../@id='0'">
<img src="images/entity.jpg" border="0"/>
</xsl:when>
<xsl:otherwise>
<img src="images/entitysub.jpg" border="0"/>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="@text"/>
</a>
</span>
<xsl:choose>
<xsl:when test="$Count>0 or $mainMenuId!=''">
<xsl:choose>
<xsl:when test="$display=1">
<span class="spanRight" style="font-family:webdings!important" onclick="showorhidden(this,'{$mainMenuId}')">5</span>
</xsl:when>
<xsl:otherwise>
<span class="spanRight" style="font-family:webdings!important" onclick="showorhidden(this,'{$mainMenuId}')">6</span>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<span class="spanRightNone" style="font-family:webdings!important">6</span>
</xsl:otherwise>
</xsl:choose>
</div>
</li>
<!--如果有下级级点,则递归获取节点-->
<xsl:if test="$Count>0">
<xsl:choose>
<xsl:when test="$display=1">
<ul id="ul_leftMenu_{$id}" style="display:block">
<xsl:call-template name="TreeNode">
<xsl:with-param name="Nodes" select="*" />
</xsl:call-template>
</ul>
</xsl:when>
<xsl:otherwise>
<ul id="ul_leftMenu_{$id}" style="display:none">
<xsl:call-template name="TreeNode">
<xsl:with-param name="Nodes" select="*" />
</xsl:call-template>
</ul>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>