Re: [xsl] Counting preceding nodes

Subject: Re: [xsl] Counting preceding nodes
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 24 Jun 2005 13:21:38 -0400
Billie,

At 01:29 PM 6/24/2005, you wrote:
I gave the diagrams the appropriate names so you could see what I was looking for, but basically,
I'm looking for a way to number the diagrams based on the absolute order in which they are placed.

This statement of the problem suggests it might be handled with the xsl:number instruction, which is designed to do this.


You might want <xsl:number level="any"/>. A good XSLT reference will help.

I've tried all sorts of combinations but nothing seemed to work. One logical structure I came up
with, that I couldn't figure out how to translate into XSL, was: "count the number of diagrams that
have an ancestor-or-self which is a preceding-sibling to an ancestor-or-self of the diagram in
question". Is that possible to do?

Yes (sort of), but there are also easier ways, such as using "count(preceding::diagram)". You don't need to worry about counting ancestors unless diagrams are allowed to contain other diagrams.


But xsl:number is the thing to use unless there's some reason not to.

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