[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Count preceding cousins and siblings


Subject: Re: [xsl] Count preceding cousins and siblings
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Mar 2008 16:43:41 -0400

Jim,

At 04:28 PM 3/12/2008, you wrote:
I need to be able to count the preceding cousins and siblings.

In 2.0, count(../../*/*[. &lt;&lt; current()]) (assuming you want only elements)


or count(../../*/* intersect preceding::*)

Someone more knowledgeable about inner workings will have to suggest which is likely to be more efficient. I suspect the first one.

Thanks to Wendell for a quick correct solution to the adding hierarchy
problem. I spent three days on it without success.

You're welcome. One is always nervous sending untested code out into the ether -- although mind you, the algorithm was tested (I have faced that problem in the past).


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 ======================================================================


Current Thread
Keywords
xml