RE: [xsl] Incremental Numbering

Subject: RE: [xsl] Incremental Numbering
From: "Mark Williams" <mark@xxxxxxxxxxxxxxxxx>
Date: Fri, 12 May 2006 10:18:40 +0100
Hi Ken,

Thanks for the response. I tried to implement this in the way previously
mentioned. For various reasons that I won't bore you with, this is
proving impractical.

However, each item that I need to number is contained in a fo:table-row.
Is there any way of outputting the current number of a fo:table-row
within the table. Sort of an auto-row numbering function? Eg

<xsl:if test="option1=1">
   <fo:table-row>
     <fo:table-cell>
       <fo:block>1</fo:block>
     </fo:table-cell>
     <fo:table-cell>
       <fo:block>1</fo:block>
     </fo:table-cell
   </fo:table-row>
</xsl:if>
<xsl:if test="option2=1">
   <fo:table-row>
     <fo:table-cell>
       <fo:block>
         <xsl:value-of select=row-number/>
       </fo:block>
     </fo:table-cell>
     <fo:table-cell>
       <fo:block>1</fo:block>
     </fo:table-cell
   </fo:table-row>
</xsl:if>
<xsl:if test="option3=1">
   <fo:table-row>
     <fo:table-cell>
       <fo:block>
         <xsl:value-of select=<xsl:value-of select=row-number/>
       </fo:block>
     </fo:table-cell>
     <fo:table-cell>
       <fo:block>1</fo:block>
     </fo:table-cell
   </fo:table-row>

I suspect this is wishful thinking on my part and that there is no
choice here, but some pretty hard graft!

Thanks


Mark Williams

________________________________

GWSmartmove

24 St Andrews Crescent, Cardiff, CF10 3DD

E: enquiries@xxxxxxxxxxxxxxxxx
T: 02920375901
F: 02920375909

www.gwsmartmove.co.uk

The contents of this email and any attachments are the property of
Gimblett Williams Solicitors Limited and are intended for the
confidential use of the named recipient(s) only. If they have been
received by you in error please maintain confidentiality, notify us,
destroy copies and delete them from your computer. It is the
responsibility of the recipient to scan this email for viruses.


-----Original Message-----
From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx]
Sent: 10 May 2006 09:22
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Incremental Numbering

At 2006-05-10 09:12 +0100, Mark Williams wrote:
>There could be a large number of options potentially so I'm keen to
>avoid a solution that has to input every possible option.

Absolutely ... that was why I asked for clarification and stated my
assumptions for your data.  You happened to enumerate each element name
in your example.

>I think what I need to do is structure the XML returned from html page
>so that it groups all options with a value of 1 together.

    <options>
      <option>1</option>
      <option>0</option>
      <option>1</option>
      <option>0</option>
    </options>

>I can then just use count and position.

Indeed ... and you can change your focus to each option and build your
table rows quite easily:

<xsl:for-each test="option[.=1]">
    <fo:table-row>
      <fo:table-cell>
        <fo:block>
          <xsl:value-of
select="count(preceding-sibling::option[.=1])+1"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>1</fo:block>
      </fo:table-cell
    </fo:table-row>
</xsl:for-each>

>Sorry to all if I didn't make what I was trying to do clear.

No apology necessary ... we can only help based on the information we
are given.

. . . . . . . . . Ken

--
Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16
Also for XSLT/XSL-FO training:    Minneapolis, MN 2006-07-31/08-04
Also for XML/XSLT/XSL-FO training:Birmingham,England 2006-05-22/25
Also for XSLT/XSL-FO training:    Copenhagen,Denmark 2006-05-08/11
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread