Docbook PDF output Table customization
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 3
- Joined: Fri Jan 18, 2013 11:05 am
- Location: Germany, Stuttgart
Docbook PDF output Table customization
Good morning!
I created a DocBook5 file with Oxygen XML Editor 14.1.
Now I need some customized tables for the PDF output.
I want to customize the backgroundcolor, font-size and font-color.
I don't want to customize all tables.
I tried to figure out how to do that.
I created a customization layer. My Idea was to write a template with the table customizations and add it to the customization layer. But that's my problem because I'm not very familiar with xslt and xsl-fo coding.
Can I use the "role"-attribute to customize a table e.g.?
And what is the code for customizing the backgroundcolor, font-size and font-color?
I use the informaltables because I don't want to have table headlines.
Best regards from Germany
I created a DocBook5 file with Oxygen XML Editor 14.1.
Now I need some customized tables for the PDF output.
I want to customize the backgroundcolor, font-size and font-color.
I don't want to customize all tables.
I tried to figure out how to do that.
I created a customization layer. My Idea was to write a template with the table customizations and add it to the customization layer. But that's my problem because I'm not very familiar with xslt and xsl-fo coding.
Can I use the "role"-attribute to customize a table e.g.
Code: Select all
<xsl:template match="para"[@role='customtable']">
And what is the code for customizing the backgroundcolor, font-size and font-color?
I use the informaltables because I don't want to have table headlines.
Best regards from Germany
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Docbook PDF output Table customization
Post by sorin_ristache »
Hello,
In your Docbook customization layer you should add a template based on your table marker, which is @role='customtable', similar with the following template from the file [Oxygen-install-dir]/frameworks/docbook/xsl/fo/htmltbl.xsl:
For example if you want to set the color and font size for all the table cells you can set them on the fo:table element:
This example is for the HTML table model in the Docbook XML documents. If you are not familiar with XSLT and XSL-FO I recommend avoiding the CALS table model because it seems harder to customize. The customization process is similar but more complicated in the XSLT stylesheet.
Regards,
Sorin
In your Docbook customization layer you should add a template based on your table marker, which is @role='customtable', similar with the following template from the file [Oxygen-install-dir]/frameworks/docbook/xsl/fo/htmltbl.xsl:
Code: Select all
<xsl:template match="d:table|d:informaltable" mode="htmlTable">
Code: Select all
<xsl:template match="d:table[@role='customtable']|d:informaltable[@role='customtable']" mode="htmlTable">
...
<fo:table background-color="yellow" font-size="24" color="blue">
Regards,
Sorin
-
- Posts: 3
- Joined: Fri Jan 18, 2013 11:05 am
- Location: Germany, Stuttgart
Re: Docbook PDF output Table customization
Hello sorin,
thank you for your quick respond.
I think that's what I need.
I tried to implement it but I get errors using the HTML table model.
My table inside my docbook-file looks like this:
The table is ok until I add the "role"-attribute. If I add the "role"-attribute to the "informaltable"-element I get the following error-message from the validator: "E [Jing] element 'tbody' not allowed here; expected element 'alt', 'indexterm', 'info', mediaobject','textobject' or 'tgroup'".
If I add for example the "alt"-element the message still appears.
Any ideas what's the problem with the "role"-attribute?
Regards
Felix
thank you for your quick respond.
I think that's what I need.
I tried to implement it but I get errors using the HTML table model.
My table inside my docbook-file looks like this:
Code: Select all
<informaltable role="customtable">
<tbody>
<tr>
<td>Text</td>
<td>Text</td>
<td><mediaobject><imageobject><imagedata fileref="images/test.png"></imagedata><imageobject></mediaobject></td>
</tr>
</tbody>
</informaltable>
If I add for example the "alt"-element the message still appears.
Any ideas what's the problem with the "role"-attribute?
Regards
Felix
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Docbook PDF output Table customization
Post by sorin_ristache »
Hi Felix,
Regards,
Sorin
In fact informaltable is a CALS table and if you add the role attribute the content model of the informaltable element required by the Docbook schema is changed. I suggest using a table instead of an informaltable, that is the HTML table model instead of the CALS model:Felix wrote:The table is ok until I add the "role"-attribute. If I add the "role"-attribute to the "informaltable"-element I get the following error-message from the validator: "E [Jing] element 'tbody' not allowed here; expected element 'alt', 'indexterm', 'info', mediaobject','textobject' or 'tgroup'".
Code: Select all
<table role="customtable">
<caption/>
<tbody>
<tr>
<td>Text</td>
<td>Text</td>
<td>
<mediaobject>
<imageobject>
<imagedata fileref="images/test.png"/>
</imageobject>
</mediaobject>
</td>
</tr>
</tbody>
</table>
Regards,
Sorin
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