Re: XPath REC questions: comments and PIs

Subject: Re: XPath REC questions: comments and PIs
From: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Tue, 25 Jan 2000 09:37:38 -0500
At 05:11 PM 01/24/2000 +0000, David Carlisle wrote:

> (An odd omission, since it's very careful to make
> the distinction in the case of attributes and elements.)

The distinction in this case is that attributes are not in the child
axis from the element, but the element is in the parent axis from the

Yes, I understood that distinction in the case of elements and attributes (and elements and namespaces, for that matter), and even the reason for it. My question was this: If the context node is a comment or PI, and you set the axis to parent::, do you get the containing element? or do you get the root node?

(The question assumes that the comment/PI is within the root *element*; if in the prolog or after the close of the root element, the parent is the root node.)

The spec says (in [5.2]) that PI and comment nodes are children of their containing elements but it does not say anything at all about whether those elements are considered parents of the PIs and/or comments that they contain. Common sense says that the relationship between parent and child(ren) "goes both ways" for comments/PIs, just as it does for *elements* which are children of other elements; however, the *spec* does not say that.

Thanks for the reply, David.
John E. Simpson            |  I spilled spot remover on my dog.
simpson@xxxxxxxxxxx        |  He's gone now.      |  (Stephen Wright)

XSL-List info and archive:

Current Thread