[xsl] XML Varaible scope problem

Subject: [xsl] XML Varaible scope problem
From: "tunuguntla srinivas" <tunuguntla@xxxxxxxxxxxxx>
Date: Thu, 14 Mar 2002 21:43:33 -0800
Hi,
I am a beginner and i am not getting the clear picture of the scope of a variable. i have a XML file and XSL style sheet like this. I am giving them.Can anybody tell me why the table rows are not coming??
xml file:

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="D:\Catxs.xsl"?>
<Company name="MyCompany">
    <Branches>
         <Branch name="NewYork" NoOfEmployee="300"/>
         <Branch name="London" NoOfEmployee="600"/>
         <Branch name="Tokyo" NoOfEmployee="100"/>
         <Branch name="HongKong" NoOfEmployee="50"/>
    </Branches>
    <Managers>
         <Manager name="wilson" branch="NewYork"/>
         <Manager name="Tony" branch="London"/>
         <Manager name="Adams" branch="Tokyo"/>
         <Manager name="Peter" branch="HongKong"/>
    </Managers>
</Company>



xsl style sheet:


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/">
  <html>
  <body>
    <table border="2" bgcolor="yellow">
            <th>Manager</th>
            <th>NoOfEmployee</th>
            <xsl:for-each select="Manager">
                 <td><xsl:value-of select="@name"/></td>
                 <xsl:variable name="BranchName" select="@branch"/>
                 <xsl:for-each select="/Company/Branches/Branch[@name=$BranchName]">
                     <xsl:variable name="NoOfEmp" select="@NoOfEmployee"/>
                     <td><xsl:value-of select="$NoOfEmp"/></td>
                 </xsl:for-each>
            </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>


Thanks in advance,
tunuguntla.





Is your boss reading your email? ....Probably
Keep your messages private by using Lycos Mail.
Sign up today at http://mail.lycos.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread