RE: [xsl] variable in xpath?

Subject: RE: [xsl] variable in xpath?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 12 Apr 2002 09:27:02 +0100
> 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@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx



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


Current Thread