Render reltable content as a table
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 679
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Render reltable content as a table
Post by julien_lacour »
Hi Matt,
From DITA specs: https://docs.oasis-open.org/dita/dita/v ... table.html
PS: If you want to use the DITA Map PDF - based on XSL-FO transformation instead, the process will be harder has you will need to generate the table by using XSLT templates only.
Regards,
Julien
From DITA specs: https://docs.oasis-open.org/dita/dita/v ... table.html
But it is possible to force the reltable rendering when using DITA Map PDF - based on HTML5 & CSS transformation, follow these instructions:By default, the contents of a <reltable> element are not output for navigation or TOC purposes; they are used only to define relationships that can be expressed as topic-to-topic links. The <relcell> elements can contain <topicref> elements, which are then related to other <topicref> elements in the same row (although not necessarily in the same cell).
- First, create a Publishing Template Descriptor file with the following content:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?> <publishing-template> <name>Custom</name> <pdf> <resources> <css file="custom.css"/> </resources> <xslt> <extension file="m2m-display-reltable.xsl" id="com.oxygenxml.pdf.css.xsl.merged2merged"/> </xslt> </pdf> </publishing-template>
- Then, create the m2m-display-reltable.xsl (New > XSLT Stylesheet) with the following content:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:opentopic="http://www.idiominc.com/opentopic" exclude-result-prefixes="#all" version="2.0"> <xsl:template match="opentopic:map//*[contains(@class, ' map/reltable ')]"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet>
- After that, create the custom.css (New > CSS) stylesheet with the following content:
Code: Select all
*[class ~= "map/reltable"] { display: table; border: 1px solid black; border-collapse: collapse; } *[class ~= "map/relheader"] { display: table-row; } *[class ~= "map/relcolspec"] { display: table-cell; border: 1px solid black; content: attr(type); text-align: center; font-weight: bold; padding: 0.3em; } *[class ~= "map/relrow"] { display: table-row; } *[class ~= "map/relcell"] { display: table-cell; border: 1px solid black; padding: 0.3em; }
- Once you've done that, duplicate the DITA Map PDF - based on HTML5 & CSS scenario and refer the opt file in the Templates tab
- Finally, run the transformation.
PS: If you want to use the DITA Map PDF - based on XSL-FO transformation instead, the process will be harder has you will need to generate the table by using XSLT templates only.
Regards,
Julien
-
- Posts: 47
- Joined: Mon Aug 17, 2020 7:16 pm
Re: Render reltable content as a table
Hi Julien
Thank you, I have managed to get that working using the DITA map HTML CSS transform.
I will now experiment with applying some formatting to the tables.
Is there a way to specify coloumn widths to reltables and to make each reltable appear as a separate table?
Regards
Matt
Thank you, I have managed to get that working using the DITA map HTML CSS transform.
I will now experiment with applying some formatting to the tables.
Is there a way to specify coloumn widths to reltables and to make each reltable appear as a separate table?
Regards
Matt
-
- Posts: 679
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Render reltable content as a table
Post by julien_lacour »
Hi Matt,
You can update the map/reltable rules in the CSS stylesheet to make the reltables bigger and add space between each others, like in this example:
By default the table cells will have equals sizes, is it what you wanted?
Regards,
Julien
You can update the map/reltable rules in the CSS stylesheet to make the reltables bigger and add space between each others, like in this example:
Code: Select all
*[class ~= "map/reltable"] {
display: table;
border: 1px solid black;
border-collapse: collapse;
margin: 0.2in 0.5in;
width: 80%;
}
Regards,
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)
- ↳ 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