This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: variable in xpath?
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 12 Apr 2002 09:27:02 +0100
- Subject: RE: [xsl] variable in xpath?
- Reply-to: xsl-list at lists dot mulberrytech dot com
> Thanks. But for the second construct (I haven't tested it) it
> isn't 100%
> clear what the context of "." is:
>
> select="*[*[name()=$child and . = $value]]"
>
A "." used within a predicate always refers to the node for which the
(immediately containing) predicate is being evaluated.
You can expand this into an XQuery-like construct if it helps your
understanding:
select="for $x in child::*
where exists(for $y in $x/child::*
where name($y)=$child and $y=$value
return $y)
return $x"
$y here plays the role of "." in the inner predicate, while $x represents
the value of "." in the outer predicate.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list