workaround to CSS @counter-style

Post here questions and problems related to editing and publishing DITA content.
Bruno.Ballarin
Posts: 25
Joined: Thu Aug 07, 2014 3:40 pm

workaround to CSS @counter-style

Post by Bruno.Ballarin »

I am under the impression that the rule @counter-style is not supported (yet?) in dita framework CSSs.

I understand this rule would allow (when supported) to modify the rendering of a counter from the default numeric suite 0 1 2 ... to (for instance) a literal suite A B C.

Would there be a workaround to this feature like for instance being able to test the value of a counter and use the result of the test to render one or another hard coded character. For prefixing appendix titles for instance I would only need A B and C since we likely not have more than 3 appendix main sections.

Cheers,

Bruno
Radu
Posts: 9041
Joined: Fri Jul 09, 2004 5:18 pm

Re: workaround to CSS @counter-style

Post by Radu »

Hi Bruno,

I'm not sure exactly what your CSS looks like.
A possible solution is something like:

Code: Select all

:root{
counter-reset:appendixCounter;
}

appendix {
counter-increment:appendixCounter;
}

appendix title:before {
content:"Appendix " counter(appendixCounter, upper-alpha) ": ";
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Bruno.Ballarin
Posts: 25
Joined: Thu Aug 07, 2014 3:40 pm

Re: workaround to CSS @counter-style

Post by Bruno.Ballarin »

Thank you very much Radu.

It does precisely what I was looking for :-).

Cheers,

Bruno
Radu
Posts: 9041
Joined: Fri Jul 09, 2004 5:18 pm

Re: workaround to CSS @counter-style

Post by Radu »

Hi Bruno,

Thanks for the confirmation. We'll probably add a similar improvement to the CSSs bundled by default in Oxygen for DocBook editing support.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply