xsl-list
[Top] [All Lists]

RE: Get value outside of for-each Statement

2004-08-19 13:48:39

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


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--