[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Incremental Numbering

Subject: Re: Incremental Numbering
From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Date: Tue, 9 May 2006 13:40:23 -0500
xsl increment function
I'm not sure I follow the whole thing, but one possibility does come to
mind:

Put the nodes you need to number into a variable.

Since you are numbering the first cells of a two-column table, you can

position() mod 2 = 1

to get the nodes that go into the odd-numbered cells.

Then you can use the position of each node in that variable as the number
you need.

Jay Bryant
Bryant Communication Services

----- Original Message ----- 
From: "Mark Williams" <mark@xxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, May 09, 2006 1:00 PM
Subject:  Incremental Numbering


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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.