|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








