RE: [xsl] XPath - excluding specified childNodes from result nodeList

Subject: RE: [xsl] XPath - excluding specified childNodes from result nodeList
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 15 Dec 2007 09:11:43 -0000
> I'm simply trying to exclude a specified child node from 
> being within the nodeList created by my expression e.g.
> 
> 
> 
> <document>
> <a>
>      <b>
>      </b>
>      <c>
>      </c>
> </a>
> </document>
> 
> Select node 'a' but remove child 'c' from the result set.

XPath expressions return a set of nodes from the original tree. They can't
modify the tree in any way. The <a> node in your document has a <c> child,
and there is nothing any XPath expression can do to change that. The
expression /document/a doesn't actually include either the b or c elements
in its result set, but the a that it returns is the original a, with its
children intact.

Michael Kay
http://www.saxonica.com/

Current Thread