Subject: Re: Abbreviated Location Paths... From: James Clark <jjc@xxxxxxxxxx> Date: Thu, 22 Apr 1999 17:36:51 +0700 |
Kay Michael wrote: > I don't think it's just an implementation issue, I've been trying to figure > it out myself. As far as I can see (see last few paras before section 6.1): > > - every pattern is an expression and its result type is always "node-set" Right. > - Not every expression of type "node-set" is a pattern. But the only example > I have found that isn't is a docref(). There are many others. Here are some more examples: from-ancestors(foo) $x/foo idref(@ref) foo:bar("baz")/x > - every location path is an expression Right. > - every location path "that meets certain restrictions" is a pattern: I > haven't discovered what the restrictions are, It is a location path none of whose steps use either AxisIdentifiers or "." or ".." (see the paragraph before production 48). > nor have I discovered a use > for location paths that are not patterns Any use of an axis that doesn't select exclusively from the attributes and descendants of the context node (and their attributes) is not allowed in a pattern. So for example: . .. from-ancestors(foo) from-preceding-siblings(fop) are not allowed in patterns. > - every pattern (syntax rule 48) is either a location path or a union of > location paths Not quite. You can also start one of the alternatives in a pattern with an expression like id('foo') or key('foo','bar'). See production 49. > Answering your question, a pattern is one kind of expression. There are > syntactic contexts where the only kind of expression you can use is a > pattern, e.g. in the match attribute of <xsl:template>. Right. Expressions that are not patterns support one operation, which is evaluation. Expressions that *are* patterns support two different operations, which are evaluation and matching; when such an expression is used in a context that requires a pattern, then the matching operation is the only operation that will be used; when it is used in another context, then the evaluation operation is the only operation that will be used. The matching operation is defined in terms of the evaluation operation (see the paragraph after production 52). For example, "foo" is an expression that is also pattern. The evaluation operation on "foo" returns a node-set containing the foo child elements of the current node. The match operation on "foo" returns true if the current node is a "foo" element. James XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Abbreviated Location Paths..., Kay Michael | Thread | Mistake...., Guy_Murphy |
FO: absolutely positioning, Bovone Stefano | Date | Not grokking keys..., Guy_Murphy |
Month |