Hi I am new for xslt and I have trouble make dropdown menu navigation , please any can help me I create a static drop down in xslt but I want make drop down as per my XML , In XML there have MenuItem/Menu/Link which I want to make drop down .
Following is my XML code :
"<?xml version='1.0' encoding='ISO-8859-1'?>\r\n \
<?xml-stylesheet type='text/xsl' href='menu.xsl'?>\r\n \
<MenuData>\r\n \
<MenuTab>\r\n \
<Tab URL='?do=userMgmt&Page=userMgmt&action=list' Rel='1' TabName='User Management'/>\r\n \
<Tab URL='?do=clientMgmt&Page=clientMgmt&action=list' Rel='2' TabName='Client Management'/>\r\n \
<Tab URL='?do=clientserverMgmt&Page=clientserverMgmt&action=list' Rel='3' TabName='Client ServerManagement'/>\r\n \
<Tab URL='?do=licMgmt&Page=licMgmt&action=list' Rel='4' TabName='License Management'/>\r\n \
<Tab URL='?do=serviceMgmt&Page=serviceMgmt&action=list' Rel='5' TabName='Service Management'/>\r\n \
<Tab URL='?do=reports&Page=Reports&action=list' Rel='6' TabName='Report'/>\r\n \
</MenuTab>\r\n \
<MenuItem>\r\n \
<Menu Rel='1'>\r\n \
<Link URL='?do=userMgmt&Page=users&action=list' LinkName='Users' Permission='VW,AD,ED,DL'/>\r\n \
<SubLink URL='?do=userMgmt&Page=users&action=add' />\r\n \
<SubLink URL='?do=userMgmt&Page=users&action=edit' />\r\n \
<SubLink URL='?do=userMgmt&Page=users&action=delete' />\r\n \
<Link URL='?do=userMgmt&Page=roles&action=list' LinkName='Roles' Permission='VW,AD,ED,DL'/>\r\n \
<SubLink URL='?do=userMgmt&Page=roles&action=add' />\r\n \
<SubLink URL='?do=userMgmt&Page=roles&action=edit' />\r\n \
<SubLink URL='?do=userMgmt&Page=roles&action=delete' />\r\n \
</Menu>\r\n \
<Menu Rel='2'>\r\n \
<Link URL='?do=clientMgmt&Page=clients&action=list' LinkName='Clients' Permission='VW,AD,ED,DL'/>\r\n \
<SubLink URL='?do=clientMgmt&Page=clients&action=add' />\r\n \
<SubLink URL='?do=clientMgmt&Page=clients&action=edit' />\r\n \
<SubLink URL='?do=clientMgmt&Page=clients&action=delete' />\r\n \
</Menu>\r\n \
<Menu Rel='3'>\r\n \
<Link URL='?do=clientserverMgmt&Page=clientServer&action=list' LinkName='Servers' Permission='VW,AD,ED,DL'/>\r\n \
<SubLink URL='?do=clientserverMgmt&Page=clientServer&action=add' />\r\n \
<SubLink URL='?do=clientserverMgmt&Page=clientServer&action=edit' />\r\n \
<SubLink URL='?do=clientserverMgmt&Page=clientServer&action=delete' /> \r\n \
</Menu>\r\n \
<Menu Rel='4'>\r\n \
<Link URL='?do=licMgmt&Page=licDetail&action=list' LinkName='License Details' Permission='VW,AD,ED,DL'/>\r\n \
<SubLink URL='?do=licMgmt&Page=licDetail&action=add' />\r\n \
<SubLink URL='?do=licMgmt&Page=licDetail&action=edit' />\r\n \
<SubLink URL='?do=licMgmt&Page=licDetail&action=delete' />\r\n \
<Link URL='?do=licMgmt&Page=licReq&action=list' LinkName='License Request' Permission='VW,AD,ED,DL'/>\r\n \
<SubLink URL='?do=licMgmt&Page=licReq&action=add' />\r\n \
<SubLink URL='?do=licMgmt&Page=licReq&action=edit' />\r\n \
<SubLink URL='?do=licMgmt&Page=licReq&action=delete' />\r\n \
</Menu>\r\n \
<Menu Rel='5'>\r\n \
<Link URL='?do=serviceMgmt&Page=service&action=list' LinkName='Services' Permission='VW,AD,DL'/>\r\n \
<SubLink URL='?do=serviceMgmt&Page=service&action=add' />\r\n \
<SubLink URL='?do=serviceMgmt&Page=service&action=delete' />\r\n \
</Menu>\r\n \
<Menu Rel='6'>\r\n \
<Link URL='?do=reports&Page=Reports&action=list' LinkName='Reports' Permission='VW'/>\r\n \
<SubLink URL='?do=reports&Page=Reports&action=add' />\r\n \
<SubLink URL='?do=reports&Page=Reports&action=edit' />\r\n \
<SubLink URL='?do=reports&Page=Reports&action=delete' />\r\n \
</Menu>\r\n \
</MenuItem>\r\n \
</MenuData>\r\n "
Following is my xslt with static drop down but I want dynamic as per as XML :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:output method="html" />
<xsl:template match="MenuData">
<ul>
<xsl:for-each select="MenuTab/Tab">
<li onclick='toggleNavSelected(this);'><a href="{@URL}" rel="{@Rel}"><span><xsl:value-of select="@TabName"/></span></a>
<div class="dropdown-content">
<a href="#123">Tab1</a>
</div>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Aucun commentaire:
Enregistrer un commentaire