Re: sequentially counting in XSL

Subject: Re: sequentially counting in XSL
From: David_Marston@xxxxxxxxx
Date: Thu, 20 Jul 2000 14:15:42 -0400
Hugo de Groot asks:
>When I want to generate numbered testcases for the methods and
>use <xsl:number value="position()"/>, the testcases are not
>sequentially numbered. I've tried several other possibilities
>like <xsl:number count="MethodDeclaration"/> etc, but I can't
>get it work right.
>Does anyone know the solution?

I think your description was a little too sketchy to permit one
of the readers to provide a full solution. The idea of using
count rather than position is a good one, and I'd encourage you
to try harder in that direction. As an aid, here is a set of
principles I'm refining:

1. Use xsl:number to generate numbering for output, not for
   general counting. (Mnemonic: that's why it's in chapter 7
   of the XSLT spec.)

2. There are well-targeted counting options in xsl:number,
   so try to let it do the work for you. In other words, avoid
   value="position()" and its variants.

2A. Start with just plain <xsl:number>, then tinker with
    count, level, from, value, and format, IN THAT
    ORDER, to get what you need. (All other attributes
    come later, to tweak the appearance.)

3. Ultimately, xsl:number is creating strings.
   (Mnemonic: it can generate "numbers" with more than
   one decimal point, or with other separators.)

(Suggestions for refining these principles are welcome.)
.................David Marston


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


Current Thread