This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: returning single result from apply-templates
- To: xsl-list at mulberrytech dot com
- Subject: RE: returning single result from apply-templates
- From: DPawson at rnib dot org dot uk
- Date: Tue, 10 Oct 2000 09:51:12 +0100
- Reply-To: xsl-list at mulberrytech dot com
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