CSS Counter
Posted: Mon May 09, 2011 12:14 pm
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.
I've found no way to use the attribute value as a variable in css, e.g.:
The only workaround I've found is to define the start value for each possible startnum value:
Is it possible to support a better solution for this cases?
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>
Code: Select all
document[startnum] {
counter-reset: sect1 attr(startnum)-1;
}
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;
}