Hazard Statement Styling
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 66
- Joined: Thu Feb 08, 2018 2:44 pm
Hazard Statement Styling
Post by dpksaini89 »
Hi, The preset Hazard statement styling layout is not very good, it does not differentiate between a warning and a caution, A lot of space is left blank after the hazard statement, If howtoavoid field has multiple statements it doesnot allow to insert ordered or un-ordered list.


Kindly help us in getting a proper hazard statement: Something like shown below



Kindly help us in getting a proper hazard statement: Something like shown below

-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Hazard Statement Styling
Hi,
I will add an issue on our side to try and better style the hazard notes in a future version.
In the meantime the CSS rules for hazardstatement can be found here:
OXYGEN_INSTALL_DIR\frameworks\dita\css\core\-domain-hazard-d.css
and you can try to override them in your own custom CSS to provide your own styling for it.
About this remark:
https://www.oxygenxml.com/dita/1.3/spec ... howtoavoid
you can probably use a DITA <sl> (simple list) inside it.
Regards,
Radu
I will add an issue on our side to try and better style the hazard notes in a future version.
In the meantime the CSS rules for hazardstatement can be found here:
OXYGEN_INSTALL_DIR\frameworks\dita\css\core\-domain-hazard-d.css
and you can try to override them in your own custom CSS to provide your own styling for it.
About this remark:
The list of allowed child elements for the howtoavoid according to the DITA 1.3 specification is this one:If howtoavoid field has multiple statements it doesnot allow to insert ordered or un-ordered list.
https://www.oxygenxml.com/dita/1.3/spec ... howtoavoid
you can probably use a DITA <sl> (simple list) inside it.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 4
- Joined: Fri Aug 10, 2018 3:21 pm
Re: Hazard Statement Styling
Hi
I would like to know how to change the background color of each specific hazardstatement type .
The current
OXYGEN_INSTALL_DIR\frameworks\dita\css\core\-domain-hazard-d.css as of line 55 is written:
}
In DITA-Framework, I would to have the background color for a
- <hazardstatement type="danger"> with background-color in red;
- <hazardstatement type="warning"> with background-color in orange;
- <hazardstatement type="caution"> with background-color in yellow;
- <hazardstatement type="notice"> with background-color in blue without the icon;
So my question: How do I write/modify the css, so that each hazardstatement type changes color? Could you present me the code?
Thanks in advance.. best regards
Mr. Kim
I would like to know how to change the background color of each specific hazardstatement type .
The current
OXYGEN_INSTALL_DIR\frameworks\dita\css\core\-domain-hazard-d.css as of line 55 is written:
Code: Select all
*[class~"hazard-d/statement"] {
display:block;
background-color:#f57222
border-bottom: 2pt solid;
padding:0.2em;
font-weight:bold
font-size:1.8em
In DITA-Framework, I would to have the background color for a
- <hazardstatement type="danger"> with background-color in red;
- <hazardstatement type="warning"> with background-color in orange;
- <hazardstatement type="caution"> with background-color in yellow;
- <hazardstatement type="notice"> with background-color in blue without the icon;
So my question: How do I write/modify the css, so that each hazardstatement type changes color? Could you present me the code?
Thanks in advance.. best regards
Mr. Kim
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Hazard Statement Styling
Hi,
Maybe you could add in your custom CSS extra selectors looking like this one:
This topic describes how you can debug your CSS selectors to see that you match the proper constructs:
https://www.oxygenxml.com/doc/versions/ ... e_css.html
Regards,
Radu
Maybe you could add in your custom CSS extra selectors looking like this one:
Code: Select all
*[class~="hazard-d/hazardstatement"][type='danger'] {
background-color:red;
}
https://www.oxygenxml.com/doc/versions/ ... e_css.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 4
- Joined: Fri Aug 10, 2018 3:21 pm
Re: Hazard Statement Styling
Hello,
first, I would like to thank you for your previous assistance. I have experimented the "-domain-hazard-d.css"-file and changed it so that much of it now complies with DIN EN82079 and ISO7010 Standards.
But currently, the hazard symbol appears in every type of <hazardstatement>-Element (danger, warning, caution, notice/note) which is not tolerable.
So my question: how do I prevent thte hazard symbol from appearing in a <hazardstatement type="notice">-Element, while the other <hazardstatement type="notice">-Elements must have the hazard symbol? What method must I apply?
In line 55 - line 90, the css-coding currently looks like this:
Best regards,
Mr. Kim
first, I would like to thank you for your previous assistance. I have experimented the "-domain-hazard-d.css"-file and changed it so that much of it now complies with DIN EN82079 and ISO7010 Standards.
But currently, the hazard symbol appears in every type of <hazardstatement>-Element (danger, warning, caution, notice/note) which is not tolerable.
So my question: how do I prevent thte hazard symbol from appearing in a <hazardstatement type="notice">-Element, while the other <hazardstatement type="notice">-Elements must have the hazard symbol? What method must I apply?
In line 55 - line 90, the css-coding currently looks like this:
Code: Select all
*[class~="[color=#0040FF]hazard-d/statement"/hazardstatement[/color]"][type:"[color=#0040FF]notice[/color]"] {
display:block;
background-color:blue;
border-bottom: 2pt solid;
padding:0.4em 0.2em 0.2em 0.8em;
font-weight:bold;
font-size:1.2em
}
/*
* Try to put all caps on the known types.
*/
*[class~="hazard-d/statement"/hazardstatement][type]:before {
content: url("../img/warning-black30.png") " " attr(type);
}
Best regards,
Mr. Kim
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Hazard Statement Styling
Hi,
I'm sorry but I do not understand what you mean. Could you also post some small DITA XML code snippets showing those two situations?
Regards,
Radu
I'm sorry but I do not understand what you mean. Could you also post some small DITA XML code snippets showing those two situations?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 4
- Joined: Fri Aug 10, 2018 3:21 pm
Re: Hazard Statement Styling
How do i prevent the yellow triangle with the expression mark from appearing in the top left corner, when I want to create a NOTICE-hazardstatement??

This is the code written in the oxygen xml css file for DITA-topic hazard statement:
*[class~="hazard-d/statement"/hazardstatement"][type:"notice"] {
display:block;
background-color:blue;
border-bottom: 2pt solid;
padding:0.4em 0.2em 0.2em 0.8em;
font-weight:bold;
font-size:1.2em
}
/*
* Try to put all caps on the known types.
*/
*[class~="hazard-d/statement"/hazardstatement][type]:before {
content: url("../img/warning-black30.png") " " attr(type);

This is the code written in the oxygen xml css file for DITA-topic hazard statement:
*[class~="hazard-d/statement"/hazardstatement"][type:"notice"] {
display:block;
background-color:blue;
border-bottom: 2pt solid;
padding:0.4em 0.2em 0.2em 0.8em;
font-weight:bold;
font-size:1.2em
}
/*
* Try to put all caps on the known types.
*/
*[class~="hazard-d/statement"/hazardstatement][type]:before {
content: url("../img/warning-black30.png") " " attr(type);
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: Hazard Statement Styling
Hello Mr. Kim,
I think you should write your CSS customization rules as:
1. I have corrected the class expressions.
2. I have removed the icon from the "content" expression leaving just an uppercase value extracted from the type attribute. You can use instead the string "NOTICE", since we matched the notice type.
Let us know if you have more questions.
Many regards,
Dan
I think you should write your CSS customization rules as:
Code: Select all
*[class~="hazard-d/hazardstatement"][type="notice"]:before {
content: oxy_uppercase(attr(type));
}
*[class~="hazard-d/hazardstatement"][type="notice"] {
display:block;
background-color:blue;
border-bottom: 2pt solid;
padding:0.4em 0.2em 0.2em 0.8em;
font-weight:bold;
font-size:1.2em
}
2. I have removed the icon from the "content" expression leaving just an uppercase value extracted from the type attribute. You can use instead the string "NOTICE", since we matched the notice type.
Let us know if you have more questions.
Many regards,
Dan
-
- Posts: 4
- Joined: Fri Aug 10, 2018 3:21 pm
Re: Hazard Statement Styling
Currently, the "NOTICE"-hazardstatement also produces the General Hazard Symbol.
How do I remove the image and replace it with different image? Note that the other hazard-statement-types DANGER, WARNING and CAUTION must remain how they are and inclede the General Hazard Symbol ISO-W001.
In the -topic-body.css:262, I found the following css-code:
The css-file @domain-hazard-d.css looks like this:
So what is the next step??
How do I remove the image and replace it with different image? Note that the other hazard-statement-types DANGER, WARNING and CAUTION must remain how they are and inclede the General Hazard Symbol ISO-W001.
In the -topic-body.css:262, I found the following css-code:
Code: Select all
*[class~='topic/image' ]{
content:attr(href , url);
}
Code: Select all
+[class~="hazard-d/hazardstatement"][type="notice"] {
display:block;
color:rgb (255,255,255);
background-color: rgb(21, 72, 137);
padding:0.4em;
padding:0.1em;
padding:0.1em;
padding:0.1em;
}
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: Hazard Statement Styling
You should save the image for notice next to the customization CSS file.
After this, add in you CSS:
In this way you are changing the icon and label of the notice hazardstatements with the ones of your choice. Or you can simply remove the url() expression to remove the icon from the notices.
Many regards,
Dan
After this, add in you CSS:
Code: Select all
*[class ~= "hazard-d/hazardstatement"][type = "notice"]:before {
content: url("other_notice_icon.png") " NOTICE";
}
Many regards,
Dan
-
- Posts: 66
- Joined: Thu Feb 08, 2018 2:44 pm
Re: Hazard Statement Styling
Post by dpksaini89 »
Hi i was able to customize the hazard statement based on the above information, but I am facing one issue:
The hazard statement image is not properly aligned to the WARNING.
Also please suggest how to set parameters for image to get a similar output as shown below:
Current:

Expected:

The hazard statement image is not properly aligned to the WARNING.
Also please suggest how to set parameters for image to get a similar output as shown below:
Current:

Expected:

-
- Posts: 66
- Joined: Thu Feb 08, 2018 2:44 pm
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: Hazard Statement Styling
There is no simple way to achieve this by CSS layout, but is an workaround.
You should create a series of simple background images for the hazard statement headers. These background images should replace the normal header coloring, and have the left part empty - on this part the danger symbol is placed by the layout engine.
For example:
Many regards,
Dan
You should create a series of simple background images for the hazard statement headers. These background images should replace the normal header coloring, and have the left part empty - on this part the danger symbol is placed by the layout engine.
For example:
Code: Select all
*[class~="hazard-d/hazardstatement"]:before{
background-color:inherit;
background-position:0 0;
/* This should be an image with a white left part the same size with the danger symbol and the rest filled with the needed color. It can be a svg.*/
background-image: url("bg-image.png"); /* SIGNAL ORANGE, RAL 2010, No ISO, but appears in the american guidelines */
}
*[class~="hazard-d/hazardstatement"][type="danger"]:before{
background-image: url("bg-image-danger.png"); /* SIGNAL RED RAL 3001, https://en.wikipedia.org/wiki/ISO_3864 */
}
*[class~="hazard-d/hazardstatement"][type="caution"]:before{
background-image: url("bg-image-caution.png"); /* SIGNAL YELLOW RAL 1003, https://en.wikipedia.org/wiki/ISO_3864 */
}
*[class~="hazard-d/hazardstatement"][type="note"]:before{
background-image: url("bg-image-note.png"); /* SIGNAL BLUE RAL 5005, https://en.wikipedia.org/wiki/ISO_3864 */
}
Dan
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Hazard Statement Styling
Post by julien_lacour »
Hello,
The new Oxygen version 23.0 is now available on our website. It includes some improvements on hazard statements rendering.
Regards,
Julien
The new Oxygen version 23.0 is now available on our website. It includes some improvements on hazard statements rendering.
Regards,
Julien
-
- Posts: 24
- Joined: Fri Nov 27, 2020 12:08 pm
Re: Hazard Statement Styling
Hi,
I'm not sure if it's connected with 23.0 update, but I'm unable to clear the image in the header of the hazardstatement table by using tips presented above.
I'm able to clear the text in the header, using the following code in customization CSS:
And that's it. The image is still visible.
I'd like to clear the whole header, or at least convert it to an empty row in the table.
Any idea?
I'm not sure if it's connected with 23.0 update, but I'm unable to clear the image in the header of the hazardstatement table by using tips presented above.
I'm able to clear the text in the header, using the following code in customization CSS:
Code: Select all
*[class~="hazardstatement--danger"] {
content: " " !important;
}

I'd like to clear the whole header, or at least convert it to an empty row in the table.
Any idea?
-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Hazard Statement Styling
Post by julien_lacour »
Hello Piotr,
If you want to remove the whole row from the hazardstatement, I suggest the following CSS:
Regards,
Julien
If you want to remove the whole row from the hazardstatement, I suggest the following CSS:
Code: Select all
*[class~="hazardstatement--danger"] {
display: none;
}
Julien
-
- Posts: 24
- Joined: Fri Nov 27, 2020 12:08 pm
Re: Hazard Statement Styling
Hi Julien,
I've tried this before, but it resulted in a Transformation fail!
The above may be connected with the following:
That is why I have doubt about the update and changes it may impose. 
I've tried this before, but it resulted in a Transformation fail!
Code: Select all
BUILD FAILED
C:\Program Files\Oxygen XML Editor\frameworks\dita\DITA-OT3.x\plugins\org.dita.base\build.xml:29: The following error occurred while executing this line:
C:\Program Files\Oxygen XML Editor\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.pdf.css\build.xml:524: The following error occurred while executing this line:
C:\Program Files\Oxygen XML Editor\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.pdf.css\build.xml:614: Java returned: 1
Code: Select all
[java] Caused by: org.apache.fop.fo.ValidationException: file:/C:/Users/PC/OneDrive/DOX/LEARN/vb/temp/pdf-css-html5/oxygen_dita_temp/stage1.xml.pp:700:86: "fo:table-row" is missing child elements. Required content model: (table-cell+) (See position 700:86)

-
- Posts: 665
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Hazard Statement Styling
Post by julien_lacour »
Hello Piotr,
I'm sorry, I totally forgot the table checker, you may use the following CSS instead:
Regards,
Julien
I'm sorry, I totally forgot the table checker, you may use the following CSS instead:
Code: Select all
*[class ~= "hazard-d/hazardstatement"][type = "danger"] tr:first-of-type {
display: none;
}
*[class ~= "hazard-d/hazardstatement"][type = "danger"] {
border: unset;
}
Julien
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service