This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

XML Varaible scope problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]