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

RE: returning single result from apply-templates

Subject: RE: returning single result from apply-templates
From: DPawson@xxxxxxxxxxx
Date: Tue, 10 Oct 2000 09:51:12 +0100
RE: returning single result from apply-templates
David Carlisle

> foo//bar[1]
>   All the bar which are the first child of any descendent of any foo
>   child of the current node. 
> 
> foo/descendant::bar[1]
>   All the bar which are the first descendant of any foo child of the
>   current node.
> 
> foo//bar
>   All the bar which are descendants of any foo child of the current
>   node.
> 
> (foo//bar)[1]
>   The first node in document order in the node set constructed above.
>   Note if there is more than one foo child this is the only one
>   guaranteed to select at most one node


Picks out a nodeset matching foo//bar, picks out the first of this nodeset?
So the ()[integer] construct guarantees a single node? 

Whereas foo//bar[1], given a number of matches, will return n nodes.



>    Just what do the () do here?
> 
> Make the [] apply to the whole node set constructed by foo//bar rather
> than just the last step in //bar[1].


Reasonable (if not DC accurate) view then would be

(1)   foo//bar[1] applies the whole path as many times as are found in the
src document

whereas

(2)	(foo//bar)[1] creates the nodeset in () first, then applies the
predicate?



Thanks David. Very clear.

Regards DaveP


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.