Jirka Kosek wrote:
> I'm configuring XXE for custom DTD subsetted from DocBook. I need to 
> remove texts like "Chapter " occuring in front of each chapter title. 
> Thus I created new CSS file which imports default DocBook formatting and 
> overrides :before selector:
> 
> @import "xxe-config:docbook/css/docbook.css";
> 
> chapter > title:before {
>     content: counter(n-, decimal) ": ";
> }
> 
> However text "Chapter " is still appearing. If I try to override other 
> templates, like chapter > title or chapter > title:after I can see 
> changes in displaying.
> 
> Is this is a bug in CSS implementation in XXE or am I missing something?

* docbook.css contains:
---
@import "docbook1.imp";
@import "refentry.imp";
@import "ebnf.imp";
@import "forms.imp";
@import "mathml.imp";
@import "docbook2.imp";
@import "image.imp";
@import "collapsible.imp";
@import "print.imp";

/* DocBook 4.3 supports HTML tables as well as CALS tables. */
@import "xhtml_table.imp";
---

* docbook1.imp contains:
---
chapter > title:before {
     content: "Chapter " counter(n-, decimal) ": ";
}
---

* But collapsible.imp contains:
---
chapter > title:first-child:before {
     content: collapser() " Chapter " counter(n-, decimal) ": ";
}
---

The specifity of selector "chapter > title:first-child" is greater than 
the specifity of selector "chapter > title". Therefore, you cannot 
override a "chapter > title:first-child" by redefining a "chapter > title".

==> Clean approach: do not @import "xxe-config:docbook/css/docbook.css", 
@import just the components you need. In such case, you would not import 
collapsible.imp and your CSS rule would work fine.

==> Quick and dirty approach: boost the specifity of your selector by 
adding ":first-child".


Reply via email to