This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Back to Basics: XPath and Context Node
- To: xsl-list at mulberrytech dot com
- Subject: Back to Basics: XPath and Context Node
- From: John Robert Gardner <jrgardn at emory dot edu>
- Date: Mon, 8 May 2000 21:32:19 -0400 (EDT)
- cc: John Robert Gardner <jrgardner at atla-certr dot org>
- Reply-To: xsl-list at mulberrytech dot com
Greetings:
Watching my recent exchange--and many others--it seems XPath remains a
constant nuance that causes many a good script to stumble--at least
certainly my own. IN order to have mercy on the list, and David, Michael,
and Mike, and Steve who are infintiely patient with some of my thrashings,
I'm trying to parse the short but dense spec in detail.
This is unbearably basic, but I'm in the midst of a self-imposed RTFM, and
want to be sure-- from the W3C spec at www.w3c.org/TR/xpath.html, sections
1ff, re. "context node." It seems the point of departure, semantically
and conceptually, for describing any expression (and location path is a
subset of expression, per the spec: "One important kinds of expression is
a location path"), so I have several questions, based on spec quotes
(please understand i'm reading this from a rhetorical sciences, not
technical sciences background, so some of the "obvious" may be lost on
me):
sect 1: . . . "Several kinds of expressions change the context node; only
predicates change the context position and context size."
Q: by implication, then, predicates do not change the context
node?
Sect. 2: "child::para selects the para element children of the context
node."
Q: so, if I have this xsl
< . . . .std. header stuff and PI . . .>
<xsl:template match="/">
<xsl:apply-templates />
<xsl:template>
<xsl:template match="child::para or child::*">
---some stuff ---
</xsl:template>
The context node for my child:: matches is the root "/", yes? and
my location path is essentially redundant b/c child::* includes
all para's anyway, obviating the "or," right?
Sect 2: A relative location path consists of a sequence . . . separated by
/. . . . An absolute location path consists of / optionally
followed by . . ."
Q: anything beginning with / is an absolute path, and nothing that
doesn't begin with / can be an absolute path, therefore it is relative
(wish I'd remembered my BNF foray in my one AI class . . .)?
Sect 2.1: Location steps: . . ."The final node set is the node-set
selected by the location step"
Q: reading the BNF preceding this question, am I right that
location steps only occur in RelativeLocationPaths (cf. [3]
immediately before 2.1)? And, then, is the location step in this
case <=> with the "location path" -- same thing as?
Sect 3.2 Function calls: . . . "A FunctionCall expression is evaluated by
using the FunctionName to identify a function in the expression evaluation
context function libarary, evaluating each of the arguments, converting
each argument to the type required by the function, and finally calling
the funtion, passing it the converted arguments."
Q: Anyone courageous to unpack this-- particularly the astounding
concatenation: "the expression evaluation context function
libarary"? In the absence of an example here, it's not clear to
me what exactly the "function call" is, unless --and I am
certainly wrong here but it's all I can think of in my
non-programmer's mindset-- "xsl:call-template"?
And finally, in due deference to nomenclature issues, "xsl:call-template"
or "xsl:variable" or xsl:choose -- these are properly called XSL elements,
xslt elements, xslt functions, xslt operators, xslt commands, xslt
template types, xslt transformers ("more than meets the eye") -- what's
the accepted word for that xsl-namespaced-thing?
I've also tried various FAQ's on these points, but what I'm really trying
to get at is a good oldfashioned commonfolks' definition type explanation
and example (and, not wanting to curry disfavor, but the shipping time on
my efforts to procure a certain book are not adding up to the par set by
my colleagues herein, save, heaven-forbid, Australia ;-)).
=-=-=-=-=-=-=-=-=-==-=-=-=
John Robert Gardner, Ph.D.
XML Engineer
Emory University
------------------------------------------------------------
http://vedavid.org/diss/
"If there is something you're thinking of doing, or wish you could do,
begin it. In boldness there is mystery and power . . . . " -Goethe
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list