This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: variable in xpath?


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]