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

Re: [xsl] Dynamic numbering of lists in xslt


Subject: Re: [xsl] Dynamic numbering of lists in xslt
From: xslt.new <xslt.new@xxxxxxxxx>
Date: Tue, 9 Jan 2007 08:53:30 -0600

Thank you for all your responses. I should have mentioned that I did
use <xsl:number>, but the problem I am facing is with the filtering.

I have some logic on the style sheet to filter out section 2. What
that does is it filters it out but the input XML remains the same.

So, in my xslt, I use:

<xsl:choose>
<xsl:when test="section='second section'>
  <!-- Do not display thi section -->
</xsl:when>
</xsl:choose>

But overall, the input XML still remains as:
<chapter1>
 <section>first section<section>
</chapter1>
<chapter1>
<section>second section</section>
</chapter1>
<chapter1>
<section>third section</section>
</chapter1>
<chapter1>
<section>fourth section</section>
</chapter1>

So, the <xsl:number> numbers the <chapter1> sequentially, and as a result,

my output has:

1. first section
3. third section
4. fourth section

This is part of a huge issue that I am facing and so pasting the whole
XSLT here might be too cumbersome.

Can you give me any idea on how to number sequentially even if the
preceding or folowing siblings are filtered?

Thank you





On 1/8/07, J.Pietschmann <j3322ptm@xxxxxxxx> wrote:
xslt.new wrote:
> I am a newbie to xslt and XSLFO. I have to do a numbering which offers the
> flexibility to reorder elements if an element in between is being removed.

Look at xsl:number
  http://www.w3.org/TR/xslt#number
There is an example in the spec, and you can probably get lots
of information by typing "xsl:number" in you favorite search
engine.

J.Pietschmann


Current Thread
Keywords