Re: [xsl] Iterating over all the Ancestors

Subject: Re: [xsl] Iterating over all the Ancestors
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 26 Nov 2002 18:20:31 -0500
Bix,

At 05:36 PM 11/26/2002, you wrote:
Suppose I wanted to stop at a given node or after a certain number of ancestors. What would I do to tweak your original solution?

It depends on your criteria. It can get a bit tricky since this is a reverse axis, so e.g. select="ancestor-or-self::*[position &lt; last()] gets all but the document element (the last of the ancestor elements going up).


select="ancestor::*[position &lt;= 3] gets your first three ancestors (but not your context node).

Cheers,
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