BDG Scenario 3

Menu.xsl

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0" />
<META HTTP-EQUIV="content-type">
<xsl:attribute name="CONTENT">text/html ; charset=<xsl:value-of select="//uielement/@charset" /></xsl:attribute>
</META>
<LINK href="../forms.css" rel="stylesheet" type="text/css"/>
</HEAD>

 <!-- BUILD MENUBAR -->
 <DIV ID="divMenuBar">
 <TABLE ID="tblMenuBar" BORDER="0">
 <TR>
 <xsl:for-each select="//menu[menuitem]">
  <xsl:if test="context()[not(end())]"> 
     <TD CLASS="clsMenuBarItem">
         <xsl:attribute name="ID">tdMenu<xsl:value-of select="@name" /></xsl:attribute>
         <A TARGET="_new">
            <xsl:attribute name="ONCLICK">topNavigator<xsl:eval>childNumber(this)-1</xsl:eval>.PopUp()</xsl:attribute>
         <xsl:eval>decode(this,'l_name')</xsl:eval>
             <!--<xsl:value-of select="@l_name" />-->
         </A>
     </TD>

     <TD>|</TD>
  </xsl:if>
     
  <xsl:if test="context()[end()]"> 
   <TD CLASS="clsMenuBarItem">
         <xsl:attribute name="ID">tdMenu<xsl:value-of select="@name" /></xsl:attribute>
         <A TARGET="_top">
             <xsl:attribute name="HREF"><xsl:value-of select="//topmenu/@rooturl" /><xsl:value-of select="@url" /></xsl:attribute>
             <xsl:eval>decode(this,'l_name')</xsl:eval>
         </A>
   </TD> 
  </xsl:if>
 </xsl:for-each>
 </TR>
 </TABLE>
 </DIV>
     
 <!-- Apply template to get the value select(//topmenu/@rooturl) through function -->
 <xsl:apply-templates select='//topmenu' />    
     
 <!-- BUILD INDIVIDUAL MENUS -->
 <xsl:for-each select="//menu[menuitem]">
        <OBJECT CLASSID="clsid:7823A620-9DD9-11CF-A662-00AA00C066D2" CODEBASE="http://activex.microsoft.com/controls/iexplorer/iemenu.ocx#Version=4,70,0,1161" WIDTH = "1" HEIGHT= "1" ALIGN = "baseline" BORDER = "0" TYPE = "application/x-oleobject">
            <xsl:attribute name="ID">topNavigator<xsl:eval>childNumber(this)-1</xsl:eval></xsl:attribute>
     
            <xsl:for-each select="menuitem">
                <xsl:element name="param">
                  <xsl:attribute name="name">menuitem[<xsl:eval>childNumber(this)-1</xsl:eval>]</xsl:attribute>
                  <xsl:attribute name="value"><xsl:eval>decode(this,'itemname')</xsl:eval></xsl:attribute>
                </xsl:element>
             </xsl:for-each>   
         </OBJECT>

       <xsl:element name="SCRIPT">
          <xsl:attribute name="LANGUAGE">VBScript</xsl:attribute>
          
           function topNavigator<xsl:eval>childNumber(this)-1</xsl:eval>_click(ByVal x)
           select case x
             <xsl:choose>           
              <xsl:when test="@name[.='Build']">
                 <xsl:for-each select="menuitem"> 
                     case <xsl:eval>childNumber(this)</xsl:eval>:
                       window.open "<xsl:eval>getrootNode</xsl:eval><xsl:value-of select='@url' />?langFolder=<xsl:value-of select='@itemname' />","Building","status=yes,resizable=yes,top=200,width=400,height=200"
                 </xsl:for-each>  
              </xsl:when>
              <xsl:otherwise>
                 <xsl:for-each select="menuitem"> 
                     case <xsl:eval>childNumber(this)</xsl:eval>:
                        top.location.href = "<xsl:eval>getrootNode</xsl:eval><xsl:value-of select='@url' />"
                 </xsl:for-each>                 
              </xsl:otherwise>
             </xsl:choose>
            end select
           end function
       </xsl:element>
       
 </xsl:for-each> 
 
 <!--GLOBAL SCRIPT FUNCTION USED WHILE TRANSFORMING DATA-->
 
 <xsl:script language="javascript"><![CDATA[
 var getrootNode;
 function decode(me,attrib){
 return unescape(me.getAttribute(attrib));
 }
 
 function getNode(me,str){
  getrootNode = me.getAttribute(str);
 }
 ]]></xsl:script>

</xsl:template>

<xsl:template match="*//topmenu">
<xsl:eval>getNode(this,'rooturl')</xsl:eval>
<xsl:apply-templates />
</xsl:template>

</xsl:stylesheet>