DITA->PDF transform; how to remove title page and TOC
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 4
- Joined: Sat Feb 20, 2016 12:55 am
DITA->PDF transform; how to remove title page and TOC
Post by GreatBigBore »
Sorry to ask such dumb questions here, but I promise I've been all over the place trying to figure this out. I tried reading the xsl files, but some of the syntax is totally baffling to me, so I'm not making much progress. If anyone out there is feeling indulgent, I am trying to answer three questions:
- How to omit the title page from the PDF
- How to omit the TOC from the PDF
- What in the world does this syntax mean in the XSL: contains(@class, ' topic/title ') -- I understand the contains function, and I understand @class. But I don't understand ' topic/title '. What's with the spaces? Why do templates with this function run, when there is nothing in my project that has a class attribute with such a weird value. And I can't find ' topic/title ' being assigned to any class attribute in any of the xsl.
-
- Posts: 404
- Joined: Thu Aug 21, 2003 11:36 am
- Location: Craiova
- Contact:
Re: DITA->PDF transform; how to remove title page and TOC
Post by radu_pisoi »
Hi,
A solution to avoid their generation is to comment the invocation of the above templates from the rootTemplate template defined in the file DITA-OT/plugins/org.dita.pdf2/xsl/fo/root-processing_fop.xsl. After you have commented the code, it should look something like:
To apply these modifications, it is recommended to write a PDF customization plugin that will override the above XSLT template. The procedure for creating a such plugin can be found in our user manual at http://oxygenxml.com/doc/versions/17.1/ ... ation.html
http://docs.oasis-open.org/dita/v1.2/os ... l#classatt
I assumed you are using the Apache FOP processor for generating the PDF file. In order to do that you have to override some XSLT templates that are responsible for generating TOC and the title page. The title page is generated by the template createFrontMatter (DITA-OT/plugins/org.dita.pdf2/xsl/fo/front-matter.xsl) and TOC is generated by the createToc template (DITA-OT/plugins/org.dita.pdf2/xsl/fo/toc.xsl).GreatBigBore wrote: * How to omit the title page from the PDF
* How to omit the TOC from the PDF
A solution to avoid their generation is to comment the invocation of the above templates from the rootTemplate template defined in the file DITA-OT/plugins/org.dita.pdf2/xsl/fo/root-processing_fop.xsl. After you have commented the code, it should look something like:
Code: Select all
<xsl:template match="/" name="rootTemplate">
<xsl:call-template name="validateTopicRefs"/>
<fo:root xsl:use-attribute-sets="__fo__root">
<xsl:call-template name="createLayoutMasters"/>
<xsl:call-template name="createMetadata"/>
<xsl:call-template name="createBookmarks"/>
<!--<xsl:call-template name="createFrontMatter"/>
<xsl:if test="not($retain-bookmap-order)">
<xsl:call-template name="createToc"/>
</xsl:if>-->
<xsl:apply-templates/>
<xsl:if test="not($retain-bookmap-order)">
<xsl:call-template name="createIndex"/>
</xsl:if>
</fo:root>
</xsl:template>
Class attributes are usually necessary only when using a DITA customization. You don't have to explicitly specify the class attributes for the default DITA implementation. The class attributes are already specified as default value attributes in the DITA DTDs and are taken into consideration by the transformation. You can read more about the DITA specialization here:GreatBigBore wrote:What in the world does this syntax mean in the XSL: contains(@class, ' topic/title ') -- I understand the contains function, and I understand @class. But I don't understand ' topic/title '. What's with the spaces? Why do templates with this function run, when there is nothing in my project that has a class attribute with such a weird value. And I can't find ' topic/title ' being assigned to any class attribute in any of the xsl.
http://docs.oasis-open.org/dita/v1.2/os ... l#classatt
Radu Pisoi
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 6
- Joined: Mon Mar 06, 2017 5:20 pm
Re: DITA->PDF transform; how to remove title page and TOC
If your PDF plugin is based on DITA OT 2.x, it is quite easy to remove either the title page or the TOC.
Add the following variables to basic-settings.xsl and set to true or false, as required:
Hope this helps!
Add the following variables to basic-settings.xsl and set to true or false, as required:
Code: Select all
<xsl:variable name="generate-front-cover" select="false()"/>
<xsl:variable name="generate-toc" select="false()"/>
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