[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML Varaible scope problem

Subject: Re: XML Varaible scope problem
From: Peter Davis <pdavis152@xxxxxxxxx>
Date: Thu, 14 Mar 2002 22:15:31 -0800
xml select scope
> 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.