DITA-OT PDF output - table column 1 color
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 11
- Joined: Mon Mar 03, 2014 5:11 pm
- Location: Shawnee, KS
DITA-OT PDF output - table column 1 color
We have had a request to change the color of the first table column to something other than the default color. Is there a specific way to do that? I looked through the table-attr.xsl file (under org.dita.pdf2\cfg\fo\attrs) and did not see anything that could be updated/changed. Am I looking in the wrong area or is it even possible?
Thanks!
Thanks!
Bryan
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DITA-OT PDF output - table column 1 color
Hi Bryan,
This is possible but there is no easy configuration value you can change in the XSLT stylesheets in order to make it work.
Probably first of all you should somehow mark the DITA tables on which you want this special coloring to appear with a distinct outputclass value like:
This is useful in order not to have the same special column color on all DITA tables. If you want it on all DITA tables, then this step is not necessary.
Then you should find the XSLT stylesheet which handles outputting tables to XSL-FO:
OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/xsl/fo/tables.xsl
In that XSLT there are two templates which match cells in the table (one template matches cells in the header and another in the body):
The proper way to make PDF XSLT customizations is by avoiding to modify directly the XSLT templates in the DITA OT installation:
http://www.oxygenxml.com/doc/ug-oxygen/ ... ation.html
Regards,
Radu
This is possible but there is no easy configuration value you can change in the XSLT stylesheets in order to make it work.
Probably first of all you should somehow mark the DITA tables on which you want this special coloring to appear with a distinct outputclass value like:
Code: Select all
<tgroup cols="2" outputclass="firstColSpecialColor">
................
Then you should find the XSLT stylesheet which handles outputting tables to XSL-FO:
OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/xsl/fo/tables.xsl
In that XSLT there are two templates which match cells in the table (one template matches cells in the header and another in the body):
Code: Select all
<xsl:template match="*[contains(@class, ' topic/thead ')]/*[contains(@class, ' topic/row ')]/*[contains(@class, ' topic/entry ')]">
.........
<xsl:template match="*[contains(@class, ' topic/tbody ')]/*[contains(@class, ' topic/row ')]/*[contains(@class, ' topic/entry ')]">
.................
[code]
In those templates on the output "<fo:table-cell" you can add an extra attribute controlling the background color if the matched cell is the first one in the row and if the cell belongs to a table which has been marked with that special outputclass attribute.
Something like:
[code] <xsl:template match="*[contains(@class, ' topic/tbody ')]/*[contains(@class, ' topic/row ')]/*[contains(@class, ' topic/entry ')]">
<fo:table-cell xsl:use-attribute-sets="tbody.row.entry">
<xsl:call-template name="commonattributes"/>
<xsl:call-template name="applySpansAttrs"/>
<xsl:call-template name="applyAlignAttrs"/>
<xsl:call-template name="generateTableEntryBorder"/>
<!-- MAKE FIRST COLUMN PINK -->
<xsl:if test="ancestor::*[@outputclass='firstColSpecialColor'] and not(preceding-sibling::*)">
<xsl:attribute name="background-color">pink</xsl:attribute>
</xsl:if>
<!-- ADDED XSLT ENDS -->
<fo:block xsl:use-attribute-sets="tbody.row.entry__content">
<xsl:call-template name="processEntryContent"/>
</fo:block>
</fo:table-cell>
</xsl:template>
http://www.oxygenxml.com/doc/ug-oxygen/ ... ation.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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