Page 1 of 1

CSS-Based PDF: Uppercase/lowercase CAUTION vs Warning

Posted: Thu Aug 16, 2018 2:35 am
by mdslup
Using the new HTML5 CSS-based PDF.

I notice that note type="caution" produces a "CAUTION", while note type="warning" produces a "Warning". I can't figure out why this is.

I found the file com.oxygenxml.pdf.css\css\core\-i18n-en.css which says:

*[class ~= "topic/note"][type = "caution"]:before {
content: url('../../img/caution.png') " Caution: ";

So this should NOT be coming out in all uppercase.

That file has a similar declaration:

*[class ~= "hazard-d/hazardstatement"][type = "caution"]:before {
content: url("../img/warning-black30.png") " " "CAUTION";

which is all uppercase, but I'm definitely not using that element type. Is it possible some processor is mixing these up?


Re: CSS-Based PDF: Uppercase/lowercase CAUTION vs Warning

Posted: Thu Aug 16, 2018 3:46 pm
by Dan
The selectors you pointed to apply to the WYSYWIG PDF transformation only.

In the HTML based transformation, the intermediate merged DITA map is transformed to HTML5 using the DITA-OT built-in support, so the generation of the static strings (the labels for chapters, parts, figures, tables, notes, etc..) is done by the DITA-OT. To change thse strings there are two methods:
1. The DITA-OT classic way, see : ... dtext.html.
2. Style from CSS: you will have to hide first the structure generated by the XSL HTML5 transformation (like the caption elements for tables, or span elements for notes) then replace the labels with your own, defined in CSS:

For example, to change the label and numbering for notes:

Code: Select all

/*Hide the HTML generated label*/
*[class ~= "topic/note"] > span.note__title {

/*Impose your own*/
*[class ~= "topic/note"]:before {
content:" Note: ";
*[class ~= "topic/note"][type="caution"]:before {
content: "Caution: ";
*[class ~= "topic/note"][type="important"]:before {
content: "Important: ";
To identify the selectors for the elements you need to hide, open the merged HTML file in an Internet Browser and inspect the styles of the elements/labels that need to be changed.

In case you need to place an icon before the text, copy the artwork files from [oXgen installation dir]/frameworks/dita/img to your CSS directory, then use the url function:

Code: Select all

*[class ~= "topic/note"][type="caution"]:before {
content: url('caution.png') "Caution: ";
Let me know if this worked for you.
Many regards,

Re: CSS-Based PDF: Uppercase/lowercase CAUTION vs Warning

Posted: Thu Aug 16, 2018 9:43 pm
by mdslup
Great, thanks. I was able to get it to work using the 2nd way.

I'd like to try using the first way and create a new plug-in. I have 2 questions about this:

* What plug-in should I copy to get started? I thought that it was "com.oxygenxml.pdf.css", but you've indicated that is the WYSIWYG scenario. Which plugin in the HTML5 based scenario?

* How do I associate my transformation scenario with my new plug-in?

Thanks again,


Re: CSS-Based PDF: Uppercase/lowercase CAUTION vs Warning

Posted: Fri Aug 17, 2018 12:38 pm
by Costin

There is no predefined plugin - you should create a custom DITA-OT plugin from scratch.
More details on creating custom plugins available on the DITA-OT website: ... rview.html
and also in the oXygen User-Guide (where you can find details on creating and installing a DITA-OT plugin): ... lugin.html

However, as creating a DITA-OT plugin to add your own XSLT extension implies XSLT knowledge and is not a simple operation you could perform in no time, if that works for you, I recommend you should use the 2nd method Dan suggested (styling through CSS, by hiding the captions and creating your own labels).

Best Regards,