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

RE: Get value outside of for-each Statement

Subject: RE: Get value outside of for-each Statement
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 19 Aug 2004 21:48:39 +0100
get value of the tr
> I got a problem with for-each statement. When you are inside 
> a for-each 
> statement, how do you link the value inside the for-each 
> statement with a 
> value that is outside of the element being looped through ?
> 
> This is the xml:
> 
> <employee_name>
> </employee_name>
> <employee_number>
> </employee_number>
> 
> <employee_name>
> </employee_name>
> <employee_number>
> </employee_number>
> 
> This is the output I want to have:
> Employee Name: Test1                  Employee Number: 123
> Employee Name: Test2                  Employee Number: 456

It looks as if the only relationship between an employee name and the
corresponding number is that they are adjacent, so use
following-sibling::employee_number[1].

It would be more usual to have an <employee> wrapper element, in which case
you would do ../employee_number.

Michael Kay

> 
> 
> <xsl:for-each select="employee_name">
>    <tr>
>       <td> Employee Name: <xsl:value-of select="employee_name"></td>
>       <td>Employee Number: ______________________________ </td>
>   </tr>
> </xsl:for-each>
> 
> Any help would be appreciated
> 
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online 
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

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.