[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: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Thu, 19 Aug 2004 15:32:16 -0400
RE:  Get value outside of for-each Statement
> From: Niclas Hedhman [mailto:niclas@xxxxxxxxxxx]
> Sent: Thursday, August 19, 2004 3:17 PM
>
> To start with, I wouldn't write a for-each loop at all. Instead;
>
> <xsl:template match="employees"> <!-- or whatever root you have-->
>   <table>
>     <xsl:apply-template select="employee_name" />
>   </table>
> </xsl:template>
>
> <xsl:template match="employee_name" >
>   <tr>
>     <td><xsl:value-of select="." /></td>
>     <td><xsl:value-of select="following-sibling::employee_number"
/></td>
>   </tr>
> </xsl:template>
>
> But the proper answer to your question is about learning the so called
> 'axis'
> concept and in your particular case the "following-sibling::".

Just for a bit of completeness, following-sibling will find the
employee_number nodes even if you do use xsl:for-each, so it can still
be used if desired.

Cheers,

Tom P

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.