[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: Joshua.Kuswadi@xxxxxxxxxxxxxxxxxxxx
Date: Fri, 15 Mar 2002 16:57:46 +1100
tunuguntla
Replace:
> <xsl:template match="/">

with
  <xsl:template match="/Company">

so that you are at the correct context node.

Joshua

> -----Original Message-----
> From: tunuguntla srinivas [mailto:tunuguntla@xxxxxxxxxxxxx]
> Sent: Friday,15 March 2002 16:44
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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
> 
> 

------------------------------------------------------------------------------
This message and any attachment is confidential and may be privileged or otherwise protected from disclosure.  If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone.





 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.