RE: Xpath and copy-of

Subject: RE: Xpath and copy-of
From: John Robert Gardner <jrgardn@xxxxxxxxx>
Date: Fri, 9 Jun 2000 15:04:05 -0400 (EDT)
On Fri, 9 Jun 2000, Matt Sergeant wrote:

> On Fri, 9 Jun 2000, Liu, Ying wrote:
> 
> > But as I read the XPath recommendation, child is an expression and so is
> > parent.
> > Did I have some misunderstanding?
> 
> Yes, child and parent are axes.

It's possible that too many cooks answering this can spoil the respective
vichy soisse, but I'm going to hazard a reply along the lines that made
sense to me.  child:: is the default axis . . . for that reason it does
not have to be explicitly declared.  Every node of your instance is a
child node except the root ( "/" ), which has no parent.  PI's, document
type declarations and namespace declarations, as well as the root element,
are all children of the root.  Any other node is a descendant of the root
and a child of the context node in which it is found-- the context node
for an attribute is the element in which it is found, the context node for
an element is the element which is its ".." or parent.

Quoting the spec, 2.5, that finally sorted out this ubiquitous yet
esoteric child:: for me, is the following:

<snip>
The most important abbreviation is that child:: can be omitted from a
location step. In effect, child is the default axis. For example, a
location path div/para is short for child::div/child::para.
</snip>

Declaring child:: gets you into trouble, so to speak, because it is always
already implicitly declared.

jr

=-=-=-=-=-=-=-=-=-==-=-=-=
John Robert Gardner, Ph.D.
XML Engineer
Emory University
------------------------------------------------------------
http://vedavid.org/diss/
"There is a difference between knowing The Path, and walking the Path."
					-Lawrence Fishburn/Morpheus

> 
> -- 
> <Matt/>
> 
> Fastnet Software Ltd. High Performance Web Specialists
> Providing mod_perl, XML, Sybase and Oracle solutions
> Email for training and consultancy availability.
> http://sergeant.org http://xml.sergeant.org
> 
> 
>  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