Re: trying to reproduce fosi counters in xsl-fo

At 13:35 2003 05 09 -0400, Lee Ann Lentz wrote:

>I can not find any information on how to create a counter in xsl-fo.  For example, I want to assign a label to each section in the document with an incremental value (XX 00) using a variable, but if an attribute is set on the section (insertchg), then I only want to increment the "00" portion of "XX 00".  If I use fo:number, I can't maintain the original value when a change occurs (because its counting the sections).  Any help would be appreciated.


This sort of thing is where the FOSI paradigm and the XSL
one differ fairly dramatically, and you need to approach
the problem you are trying to solve with quite a different
mindset.

Because XSL was designed to avoid such "side effects", you
cannot have variables that you increment.  In general, you
have to do all the determination of the number for a given 
element while processing that element itself.

This will probably mean that, in the case of the insertchg
attribute, you will need to have a different computation
for the number than in the absence of this attribute, and
in each case, you will have to write something that only
counts the appropriate sections.  For example, when counting
non-inserted sections, you will probably want to ensure you
don't count sections with insertchg assigned (if I understand
your requirements correctly).

So instead of thinking of incrementing variables, think of how
you would determine the appropriate number if someone picked
a given section out of the document at random and pointed to
it and said "what's it's number?"  That's more how you have to
do it in XSL.

paul

Received on Saturday, 10 May 2003 13:36:55 UTC