Add class attribute to every ul element in XHTML TOC output
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 38
- Joined: Thu Oct 28, 2010 5:10 pm
Add class attribute to every ul element in XHTML TOC output
Hello,
I have a request regarding how to:
1) Add a custom CSS to the XHTML transformation scenario, how to reference my custom CSS in the generated index.html file?
2) I also need to add a custom class to elements inside the output index.html containing the TOC. I would like to be able to add to the <ul> and <li> elements in the TOC custom classes that I can use to style the look/behavior of the links in the TOC.
Hopefully, this makes sense to you.
Thanks
I have a request regarding how to:
1) Add a custom CSS to the XHTML transformation scenario, how to reference my custom CSS in the generated index.html file?
2) I also need to add a custom class to elements inside the output index.html containing the TOC. I would like to be able to add to the <ul> and <li> elements in the TOC custom classes that I can use to style the look/behavior of the links in the TOC.
Hopefully, this makes sense to you.
Thanks
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Add class attribute to every ul element in XHTML TOC out
Post by sorin_ristache »
Hello,
Altrernatively you could also style the ul and li elements in the TOC with your custom CSS that you set above in the transformation. For example in the Oxygen Webhelp transformation you can match in your CSS the ul and li elements that are descendants of div#tree:
In the XHTML transformation you can match the TOC ul and li elements with the following CSS code because other ul elements (that are not in the TOC) are NOT inserted directly as child elements of the body element:
Regards,
Sorin
Set the file path of the custom CSS in the parameter args.css of the XHTML transformation. I suggest setting also the args.copycss parameter to yes (by default it has the no value) for copying your custom CSS to the output directory of the transformation, otherwise you have to make sure that the file path set in the args.css parameter works in the XHTML output pages.eloralon wrote:1) Add a custom CSS to the XHTML transformation scenario, how to reference my custom CSS in the generated index.html file?
Setting a custom class attribute to some DITA elements is usually done with a DITA specialization. If you just want to set a custom class value to the ul and li elements from TOC without creating a DITA specialization you have to add the class attribute to all the ul and li elements that are created in all the XSLT templates with the attribute mode="toc" in the [Oxygen-install-dir]/frameworks/dita/DITA-OT/xsl/map2htmtoc/map2htmlImpl.xsl stylesheet.eloralon wrote:2) I also need to add a custom class to elements inside the output index.html containing the TOC. I would like to be able to add to the <ul> and <li> elements in the TOC custom classes that I can use to style the look/behavior of the links in the TOC.
Altrernatively you could also style the ul and li elements in the TOC with your custom CSS that you set above in the transformation. For example in the Oxygen Webhelp transformation you can match in your CSS the ul and li elements that are descendants of div#tree:
Code: Select all
div#tree ul {
...
}
div#tree li {
...
}
Code: Select all
body > ul {
...
}
body > ul li {
...
}
Regards,
Sorin
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)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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