Subject: Re: [xsl] variable in xpath? From: "David N Bertoni/Cambridge/IBM" <david_n_bertoni@xxxxxxxxxx> Date: Thu, 11 Apr 2002 16:58:29 -0700 |
Hi Steve, '.' _always_ refers to the context node. You're using the context node implicitly when you call the name() function without an argument. That is: *[name()=$child] is the same as *[name(.)=$child] because of how the name() function is defined: http://www.w3.org/TR/xpath#function-name "...If the argument it omitted, it defaults to a node-set with the context node as its only member." Many functions in XPath have the same default argument. More info on the context node and predicate evaluation can be found in the recommendation: http://www.w3.org/TR/xpath#predicates In particular: "A predicate filters a node-set with respect to an axis to produce a new node-set. For each node in the node-set to be filtered, the PredicateExpr is evaluated with that node as the context node, with the number of nodes in the node-set as the context size, and with the proximity position of the node in the node-set with respect to the axis as the context position; if PredicateExpr evaluates to true for that node, the node is included in the new node-set; otherwise, it is not included." If you're looking for an articulate description of the context node I'd suggest Mike Kay's XSLT book. Hope that helps... Dave |---------+-------------------------------------> | | "Steve Renshaw" | | | <renshaw_steve@xxxxxxxxxxx| | | > | | | Sent by: | | | owner-xsl-list@xxxxxxxxxxx| | | rrytech.com | | | | | | | | | 04/11/2002 04:21 PM | | | Please respond to xsl-list| | | | |---------+-------------------------------------> >---------------------------------------------------------------------------------------------------------------------------| | | | To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx | | cc: (bcc: David N Bertoni/Cambridge/IBM) | | Subject: Re: [xsl] variable in xpath? | >---------------------------------------------------------------------------------------------------------------------------| >select all <element> [which have a child element [whose name() is the same >as stored in $child and whose concatenation of all descendant text nodes is >the same as stored in $value]] 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]]" In what context is a dot used within nested predicates evaluated in? I think I know what the answer is, but I am searching for an articulate wording of it. Thansk agian _________________________________________________________________ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] variable in xpath?, Michael Kay | Thread | [xsl] xsl:sort by a sum()?, Juan Gril |
RE: Business logic (was: Re: [xsl] , jasonp | Date | [xsl] Query regarding XSL variables, Anand Ganapathy |
Month |