Re: [xsl] Restarting the numbering sequence of a fo:list-block

Subject: Re: [xsl] Restarting the numbering sequence of a fo:list-block
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 20 Feb 2002 10:16:03 +0000
Hi Gary,

> For the life of me I cannot figure out how to restart the numbering
> sequence of a fo:list-block without using the "from" attribute of
> xsl:number element. I don't want to use the "from" attribute because
> it seems to be selection criteria oriented which for me doesn't
> really pertain. I've searched the FAQs, 3 different books,
> tutorials, through the W3C specs, all to no avail.

By default, xsl:number should give you the number of the current
element within the list of its siblings that have the same type and
name. So if your source is:

  <list>
    <item>entry 1</item>
    <item>entry 2</item>
  </list>
  <list>
    <item>entry 1</item>
    <item>entry 2</item>
  </list>

Then you should be able to do:

  <xsl:for-each select="list">
    <fo:list-block>
      <xsl:for-each select="item">
        <fo:list-item>
          <fo:list-item-label>
            <xsl:number format="1." />
          </fo:list-item-label>
          <fo:list-item-body>
            <xsl:value-of select="." />
          </fo:list-item-body>
        </fo:list-item>
      </xsl:for-each>
    </fo:list-block>
  </xsl:for-each>

If that's approximately what you're doing and it isn't working, then
please post again, this time with the source XML for the lists and the
XSLT code that you're using, and we should be able to help.

[BTW, since the numbers are being supplied by XSLT, it shouldn't make
any difference what XSL-FO processor you're using (though it might
make a difference what XSLT processor you're using).]

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread