xml文件折叠展开

xml.xml  
  <?xml   version='1.0'   encoding='gb2312'   ?>  
  <?xml-stylesheet   type="text/xsl"   href="xsl.xsl"?>  
  <viewentries   toplevelentries="5">  
  <viewentry   position="1"     children="5"   descendants="5"   siblings="5">  
  <entrydata   columnnumber="0"   name="AppCategory"   category="true">  
  <text>个人事务</text>  
  </entrydata>  
  </viewentry>  
  <viewentry   position="1.1"     noteid="9A6"   siblings="5">  
  <entrydata   columnnumber="1"   name="AppName">  
  <text>电子公告</text>  
  </entrydata>  
  </viewentry>  
  <viewentry   position="1.2"   noteid="9BA"   siblings="5">  
  <entrydata   columnnumber="1"   name="AppName">  
  <text>电子公告</text>  
  </entrydata>  
  </viewentry>  
  <viewentry   position="2"   children="4"   descendants="4"   siblings="5">  
  <entrydata   columnnumber="0"   name="AppCategory"   category="true">  
  <text>个性设置</text>  
  </entrydata>  
  </viewentry>  
  <viewentry   position="2.1"     noteid="9B2"   siblings="4">  
  <entrydata   columnnumber="1"   name="AppName">  
  <text>个性界面</text>  
  </entrydata>  
  </viewentry>  
  <viewentry   position="2.2"   noteid="9D2"   siblings="4">  
  <entrydata   columnnumber="1"   name="AppName">  
  <text>个性界面</text>  
  </entrydata>  
  </viewentry>  
  </viewentries>  

 

<xsl:stylesheet  
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
  version="1.0">  
  <xsl:template   match="/">  
  <style   type="text/css">  
  <xsl:comment>  
  <![CDATA[  
  .on   {DISPLAY:   inline}  
  .off   {DISPLAY:   none}  
  .menu{cursor:hand;font-size:13px;text-decoration:none;color:#0000ff;}  
  .cur_pos   {cursor:hand;font-size:13px;   color:   #000000;   text-decoration:none;}  
  ]]>  
  </xsl:comment>  
  </style>  
  <SCRIPT   language="javascript">  
  <xsl:comment>  
  <![CDATA[  
  function   ugiAction(id)  
  {  
  //alert(document.all.item(id))  
  if(document.all.item(id)!=null)  
  with(document.all.item(id))  
  {  
  if(className!="off")  
  className="off"  
  else  
  className="on";  
  }  
  //alert(document.all.item(id).className)  
  }  
  ]]>  
  </xsl:comment>  
  </SCRIPT>  
  <xsl:apply-templates   />  
  </xsl:template>  
   
  <xsl:template   match="viewentries">  
  <xsl:apply-templates   select="viewentry[not(contains(@position,'.'))]"/>  
  </xsl:template>  
   
  <xsl:template   match="viewentry">  
  <DIV>  
  <xsl:attribute   name="id">aa_<xsl:value-of   select="@name"   /></xsl:attribute>  
  <xsl:if   test="@id!='AppCategory'"><xsl:attribute   name="class">on</xsl:attribute></xsl:if>  
  <xsl:apply-templates/>  
  </DIV>  
  </xsl:template>  
   
  <xsl:template   match="entrydata[@name='AppCategory']"   >  
  <table   width="127"   height="10"><tr><td></td></tr></table>  
  <DIV   STYLE="text-align:center;width:127;height:24;background-image:url(image/menu_bg.gif);">  
  <xsl:attribute   name="onclick">ugiAction('aa_<xsl:value-of   select="generate-id()"   />')  
  </xsl:attribute>  
  <TABLE   width="100%"   height="100%"   BORDER="0"   CELLSPACING="0"   CELLPADDING="0"   >  
  <TR>  
  <TD   align="center"   valign="middle"   class="menu"><xsl:value-of   select="text"   /></TD>  
  </TR>  
  <TR>  
  <TD>  
  <DIV   id="aa_{generate-id()}"   class="off">  
  <xsl:apply-templates   select="following::entrydata[@name='AppName'   and   starts-with(../@position,   concat(current()/../@position,'.'))]"   />  
  </DIV>  
  </TD>  
  </TR>  
  </TABLE>  
  </DIV>  
  </xsl:template>  
   
  <xsl:template   match="entrydata[@name='AppName']"   >  
  <DIV   STYLE="text-align:center;width:127;height:24;background-image:url(image/item_bg.gif);">  
  <TABLE   width="100%"   height="100%"   BORDER="0"   CELLSPACING="0"   CELLPADDING="0">  
  <TR>  
  <TD   align="center"   valign="middle"   class="cur_pos"><xsl:value-of   select="text"   /></TD>  
  </TR>  
  </TABLE>  
  </DIV>  
  </xsl:template>  
  </xsl:stylesheet>  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值