人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統下載站 > 技術開發教程 > 詳細頁面

用XSLT簡單完成樹形折疊導航欄(2)

用XSLT簡單完成樹形折疊導航欄(2)

更新時間:2022-08-23 文章作者:未知 信息來源:網絡 閱讀次數:

我引用花園的TOC,一是讓大家能有個初步印象,等文章完成后, 把幾個文件C&P加上幾個圖片, 在IE5以上的機器上象打開一個html文件一樣打開navi.xml后,就會出現跟花園很類似的TOC了;二是希望大家根據它的層次結構來分析我的xml文件, 因為除頂層外, 我的層次安排和花園是一樣的。 我來解釋一下:Layer相同表示元素處在同一層次即兄弟關系, Childs的值表示該元素是否有子結點, 父子之間用AncestorID和ID聯系, 依次類推可以擴充至無限次深。 在xsl文件中根據Layer的值用padding-left屬性來實現樹形,根據Layer的值用display:none或block來實現折疊。 原理即此, 好,來看看這個關鍵的Navigator.xsl: <?xml version="1.0" encoding="gb2312" ?>
<HTML>
<HEAD>
<TITLE>XSLT樹形導航欄</TITLE>
<LINK rel="stylesheet" type="text/css" href="navigator.css"/>
<SCRIPT src="toggle.js"></SCRIPT>
</HEAD>
<BODY>

<DIV xmlns:xsl="http://www.w3.org/TR/WD-xsl" >
<TABLE>
<TR>
<TD><DIV noWrap="true" STYLE="padding-left:0em;">有座花園分類目錄</DIV></TD>
</TR>
<xsl:for-each select="Navigation/Navigator">
<TR>
<xsl:attribute name="TITLE"><xsl:value-of select="@Title" /></xsl:attribute>
<xsl:attribute name="Class">Navigator<xsl:if test="@Layer[.>0]">-Hidden</xsl:if></xsl:attribute>
<xsl:attribute name="ID"><xsl:value-of select="@ID"/></xsl:attribute>
<xsl:attribute name="AncestorID"><xsl:value-of select="@AncestorID"/></xsl:attribute>
<xsl:attribute name="Depth"><xsl:value-of select="@Layer"/></xsl:attribute>
<xsl:if test="@Childs[.>0]">
<xsl:attribute name="Expanded">no</xsl:attribute>
</xsl:if>
<TD STYLE="cursor:hand">
<DIV noWrap="true"><xsl:attribute name="STYLE">padding-left:<xsl:value-of select="@Layer"/>em;</xsl:attribute>
<xsl:choose>
<xsl:when test="@Childs[.>0]"><IMG src="http://edu.chinaz.com/Get/Program/Xml/images/bs.gif"></IMG></xsl:when>
<xsl:otherwise><IMG><xsl:attribute name="src"><xsl:value-of select="@Image" /></xsl:attribute></IMG></xsl:otherwise>
</xsl:choose>
<A><xsl:if test="@Childs[.>0]"><xsl:attribute name="onclick">toggle('<xsl:value-of select="@ID" />')</xsl:attribute></xsl:if><xsl:attribute name="href"><xsl:value-of select="@Url" /></xsl:attribute><xsl:value-of select="@Title" /></A></DIV></TD>
</TR>
</xsl:for-each>
</TABLE>
</DIV>
</BODY>
</HTML>


溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

網站地圖xml | 網站地圖html
主站蜘蛛池模板: 从化市| 台江县| 新疆| 勃利县| 石阡县| 安福县| 北川| 舟曲县| 平武县| 阜康市| 诏安县| 丰都县| 楚雄市| 新绛县| 海城市| 夏津县| 繁昌县| 平定县| 崇文区| 平武县| 崇阳县| 当涂县| 蓝田县| 镇赉县| 宜丰县| 泗水县| 延吉市| 东港市| 甘德县| 秦安县| 洛扎县| 甘孜县| 雷波县| 昌邑市| 通许县| 沙洋县| 潞西市| 莫力| 朔州市| 海兴县| 卢龙县|