[xsl] Incremental Numbering

Subject: [xsl] Incremental Numbering
From: "Mark Williams" <mark@xxxxxxxxxxxxxxxxx>
Date: Tue, 9 May 2006 19:00:29 +0100
I've googled and searched the archives and from what I have understood
(which is little), it seems that what I want to do may not be possible.
Hopefully I have misunderstood and someone is able to help.

We're building an online form constructor. It constructs a web page of
edit controls based on a specification contained in an xml file. Once
the user has completed the required fields and clicked submit, it
constructs an xml file which is then passed for rendering together with
the necessary xsl.

The online form constructor provides a number of checkbox options as to
what the user will require in their finished form. This could be a list
of a number of items.

As an example there could be checkboxes for:

Option1 I require A

Option2 I require B

Option3 I require C

Option4 I require D

The xsl then lays out the chosen options in a table a row at a time, but
only if the particular option has been checked:

eg:

If Option1=1

Add table-row "I require A"

and so on.

The difficulty is that the table is in two columns and I need to number
the first colum for each row sequentially.

Accordingly, if option1 is checked then the first table column will be
numbered 1.

If option3 is checked, but not option 2 then the first table column for
option 3 will be numbered 2 not 3.

In short, what I need to do is:

<xsl:variable name = "counter"><xsl:value-of select=1/></xsl:variable>
........

<if test="option1=1">

<fo:table-row>

<fo:table-cell><fo:block><xsl:value-of
select=$counter/><fo:block><fo:table-cell/>

<fo:table-cell><fo:block><xsl:value-of
select="option1"/><fo:block><fo:table-cell/>

<xsl:increment name="$counter" inc="1"/>

</fo:table-row>

<xsl:if>

<if test="option2=1">

<fo:table-row>

<fo:table-cell><fo:block><xsl:value-of
select=$counter/><fo:block><fo:table-cell/>

<fo:table-cell><fo:block><xsl:value-of
select="option2"/><fo:block><fo:table-cell/>

<xsl:increment name="$counter" inc="1"/>

</fo:table-row>

<xsl:if>

This is obviously very rough and I appreciate there is no xsl:increment
function, but it's something like this that I need. Is there any way I
can store and increment a value in this way?

I hope I've made myself clear. Apologies if not. Any help gratefully
appreciated.

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.

Current Thread