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>