Re: [xsl] applying templates to ancestor nodes without reprocessing context node

Subject: Re: [xsl] applying templates to ancestor nodes without reprocessing context node
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 10 Apr 2002 14:03:17 -0400
Jarom,

If I understand you correctly, the error is in your XPath:

At 01:13 PM 4/10/2002, you wrote:
<xsl:apply-templates select="node()[ancestor::l]" mode="noApps"/>

This doesn't select ancestors. Fully expanded, it is equivalent to


child::node()[ancestor::l]

or "all child nodes that have an ancestor l". (Absent an axis specifier, XPath assumes the child axis. The predicate acts to filter the node set: so your XPath does not read "nodes that are ancestor l" but rather "[child] nodes that *have* ancestor l" (or to be really persnickety, "[child] nodes for whom the expression 'ancestor::l' is true, i.e. for whom, acting as the context node, the set of nodes ancestor::l is not empty").

I think what you want is merely select="ancestor::l", which selects all l ancestors (each app should have only one).

Good luck--
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread