RE: [xsl] Get value outside of for-each Statement

Subject: RE: [xsl] Get value outside of for-each Statement
From: "john lee" <excel_man@xxxxxxxxxxx>
Date: Thu, 19 Aug 2004 22:52:48 +0000
Thanks Michael, It works.
Thanks for the help :D



From: "Michael Kay" <mhk@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: [xsl] Get value outside of for-each Statement
Date: Thu, 19 Aug 2004 21:48:39 +0100
MIME-Version: 1.0
Received: from h01.biglist.com ([209.123.46.101]) by mc2-f31.hotmail.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 19 Aug 2004 13:49:19 -0700
Received: (qmail 76802 invoked by uid 2149); 19 Aug 2004 20:49:09 -0000
Received: (qmail 76786 invoked from network); 19 Aug 2004 20:49:08 -0000
X-Message-Info: JGTYoYF78jH2yxNaIZIa1sX+0ln2ZxCc
Mailing-List: contact xsl-list-help@xxxxxxxxxxxxxxxxxxxxxx
Precedence: bulk
X-BL-Legal-Notice: <http://www.BIGLIST.com/legal/>
X-Complaints-To: <mailto:abuse@xxxxxxxxxxx>
List-Post: <mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
List-Help: <mailto:xsl-list-help@xxxxxxxxxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:xsl-list-unsubscribe-excel_man=hotmail.com@xxxxxxxxxxxxxxxxxxxxxx>
List-Subscribe: <mailto:xsl-list-subscribe@xxxxxxxxxxxxxxxxxxxxxx>
Delivered-To: mailing list xsl-list@xxxxxxxxxxxxxxxxxxxxxx
X-Mailer: Microsoft Office Outlook, Build 11.0.5510
Thread-Index: AcSGHw6VJ4Rp50QdS/OdXh1FkFw70AADqUQg
In-Reply-To: <BAY9-F22RluzIDPWEHh000283b9@xxxxxxxxxxx>
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Return-Path: xsl-list-return-4901-excel_man=hotmail.com@xxxxxxxxxxxxxxxxxxxxxx
Message-ID: <MC2-F31RfX3CapGj6fV000245bb@xxxxxxxxxxxxxxxxxxx>
X-OriginalArrivalTime: 19 Aug 2004 20:49:19.0790 (UTC) FILETIME=[FFE27CE0:01C4862D]


>
> 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


_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


Current Thread