Subject: Re: [xsl] alt. to for-each when there's only one From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx> Date: Tue, 12 Feb 2002 10:04:39 -0500 |
[alex] > I've bee using <xsl:for-each select="Orders/RowId"> > to process all the RowId children of my one Orders > node. > > But I've got a case where I know the xml returned > to me will only contain one RowId child. Is using > a for-each still the way to go in this case? Or is > there something more direct and efficient? > You usually have a choice between xsl:for-each and xsl:apply-templates for processing a series of elements. They aren't fully interchangeable, but often you can arrange to use one or the other. There is no harm in using xsl:for-each when there is only one element to loop over, but more than likely, xsl:apply-templates will be able to do the job for you. The prime situation where you want to use xsl:for-each instead of xsl:apply-templates when there is only one element is when you need to change the context, as for instance when you want a key to apply to xml brought in from another source by means of document(). Cheers, Tom P XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] alt. to for-each when there's, alex | Thread | [xsl] RE: xsl mathematical calculat, Andrew Welch |
Re: [xsl] the difference between xs, Corey_Haines | Date | [xsl] RE: xsl mathematical calculat, Andrew Welch |
Month |