Re: XML Varaible scope problem
> Can anybody tell me why the table rows are not coming?? First of all, you dont't have a <tr> tag :) But more importantly, when it gets to the first for-each, the context node is still "/". So it is looking for "/Manager", which doesn't exist. You should change this to "/Company/Managers/Manager". As someone else suggested, you can also change the template to match "/Company", which will put you one step closer. But you still need to include the "Managers" tag before you can get any single Manager, so if you go this route you either can have the template match "/Company/Managers" and leave the for-each unchanged or match "/Company" and have the for-each select "Managers/Manager". You get the idea. On Thursday 14 March 2002 21:43, tunuguntla srinivas wrote: > <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> -- Peter Davis Your mind understands what you have been taught; your heart, what is true. 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