Customizing the note element
Post here questions and problems related to editing and publishing DITA content.
Customizing the note element
Hi
I want to customize the output of notes in the PDF transformation with css. There should be no image and no linebreak after the bold "Note: "
Sounds like a simple task fulfilled by:
and then likewise for the different subtypes of notes.
But this little code sniplet in my customized css breaks up the whole transformation. It stopps with an error
In the fo output this not even refers to a note but a hazardstatement.
Any idea whats wrong there?
I'm using Oxygen 25.0 and DITA-OT version 3.7.3
Regards
Jörn
I want to customize the output of notes in the PDF transformation with css. There should be no image and no linebreak after the bold "Note: "
Sounds like a simple task fulfilled by:
Code: Select all
*[class ~= "topic/note"]:lang(en):before{
font-weight: bold;
content: "Note: ";
}
But this little code sniplet in my customized css breaks up the whole transformation. It stopps with an error
Code: Select all
Error on line 183 column 73 of stage1.xml.pp:
[java] SXCH0003 org.apache.fop.fo.ValidationException: "fo:table-row" is not a valid child of
[java] "fo:table"! (Siehe Position 183:73). Caused by org.apache.fop.fo.ValidationException:
[java] file:.../temp/pdf-css-html5/oxygen_dita_temp/stage1.xml.pp:183:73: "fo:table-row" is not a valid child of "fo:table"! (See position 183:73)
Any idea whats wrong there?
I'm using Oxygen 25.0 and DITA-OT version 3.7.3
Regards
Jörn
-
- Posts: 581
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Customizing the note element
Post by julien_lacour »
Hi Jörn,
The error message is quite "normal": hazardstatement actually inherits from note (so matching topic/note will match both elements, see DITA Specs) and is displayed as a table, your :before selector tries to add content in this table but doesn't respect the table display.
For what you're trying to achieve, the following rules should be enough:
Regards,
Julien
The error message is quite "normal": hazardstatement actually inherits from note (so matching topic/note will match both elements, see DITA Specs) and is displayed as a table, your :before selector tries to add content in this table but doesn't respect the table display.
For what you're trying to achieve, the following rules should be enough:
Code: Select all
*[class ~= "topic/note"] {
background-image: none !important;
padding: .75em .5em .75em 0.5em !important;
}
span.note__title {
display: inline;
}
Julien
Re: Customizing the note element
Thanks Julien,
yes this works much better.
Although I still have the line break after the note, even when adding !important to the span.note__title rule:
Here's the rendered HTML
I think the problem is that the note element demands a <p> around the text so this will always be a new line.
Regards
Jörn
yes this works much better.
Although I still have the line break after the note, even when adding !important to the span.note__title rule:
- image.png (7.94 KiB) Viewed 896 times
Code: Select all
<span class="note__title">Note:</span>
<p class="- topic/p p">The supply voltage is connected to the device casing through protective elements
exclusively.</p>
Regards
Jörn
-
- Posts: 581
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Customizing the note element
Post by julien_lacour »
Hi Jörn,
By default you can write inside a note without adding a paragraph inside it.
From the DITA Specs:
Which means your note look like:
A solution is to unwrap the paragraphs from within the note using Oxygen > Tools > XML Refactoring...
The operation is called "Unwrap element", the XPath will be //note//p and the scope will be Current DITA map hierarchy.
Another solution is to add the following rules to the previous CSS:
Regards,
Julien
By default you can write inside a note without adding a paragraph inside it.
From the DITA Specs:
Code: Select all
<note type="tip">Thinking of a seashore, green meadow, or cool
mountain overlook can help you to relax and be more
patient.</note>
Code: Select all
<note>
<p>The supply voltage is connected to the device casing through protective elements
exclusively.</p>
</note>
The operation is called "Unwrap element", the XPath will be //note//p and the scope will be Current DITA map hierarchy.
Another solution is to add the following rules to the previous CSS:
Code: Select all
*[class ~= "topic/note"] [class ~= "topic/p"] {
display: inline;
}
Julien
Re: Customizing the note element
Hi Julien,
we have customized DITA and removing the <p> within the note leads to "unexpected character data" error.
However your second solution does what I wanted. Thanks again!
Regards
Jörn
we have customized DITA and removing the <p> within the note leads to "unexpected character data" error.
However your second solution does what I wanted. Thanks again!
Regards
Jörn
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