CSS Counter

Are you missing a feature? Request its implementation here.
patrick
Posts: 96
Joined: Mon May 09, 2011 11:54 am

CSS Counter

Post by patrick »

Hi,

I have an XML which should have auto-numbered sections in the author view. The root element han an Attribut "startnum" which pretend the initial value of the first section.

Code: Select all


<document startnum="5">
<section/> <!-- Should have "5" as number -->
<section/> <!-- 6 -->
<section/> <!-- 7 ... -->
</document>
I've found no way to use the attribute value as a variable in css, e.g.:

Code: Select all


document[startnum] {
counter-reset: sect1 attr(startnum)-1;
}
The only workaround I've found is to define the start value for each possible startnum value:

Code: Select all

document[startnum="2"] {
counter-reset: sect1 1;
}
document[startnum="3"] {
counter-reset: sect1 2;
}
document[startnum="4"] {
counter-reset: sect1 3;
}
document[startnum="5"] {
counter-reset: sect1 4;
}
document[startnum="6"] {
counter-reset: sect1 5;
}
document[startnum="7"] {
counter-reset: sect1 6;
}
document[startnum="8"] {
counter-reset: sect1 7;
}
document[startnum="9"] {
counter-reset: sect1 8;
}
document[startnum="10"] {
counter-reset: sect1 9;
}
Is it possible to support a better solution for this cases?
Radu
Posts: 9473
Joined: Fri Jul 09, 2004 5:18 pm

Re: CSS Counter

Post by Radu »

Hi Patrick,

Unfortunately for now we do not have support for evaluating functions in the "counter-reset" values. I added an improvement request for this.
We also have plans to add functions for simple arithmetic evaluations (like adding that "1" in your case).
I'll update this post when the request gets implemented.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
patrick
Posts: 96
Joined: Mon May 09, 2011 11:54 am

Re: CSS Counter

Post by patrick »

Hi Radu,

Thanks!
Post Reply