VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/docsrc/readme/dita2pdf-customization.dita@ 99012

Last change on this file since 99012 was 98584, checked in by vboxsync, 2 years ago

Docs: bugref:10302. Setting svn properties of DITA-OT library.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
3<task id="dita2pdf-customization" xml:lang="en">
4 <title>Customizing PDF output</title>
5 <shortdesc>Example of PDF output customization with a custom transformation type.</shortdesc>
6 <taskbody>
7 <steps>
8 <step>
9 <cmd>Create a new plug-in directory <filepath>com.example.print-pdf</filepath> into DITA-OT
10 <filepath>plugins</filepath> directory.</cmd>
11 </step>
12 <step>
13 <cmd>Create a plug-in configuration file <filepath>plugin.xml</filepath>, declare the new
14 transformation type <keyword>print-pdf</keyword> and dependencies.</cmd>
15 <info><fig><codeblock>&lt;?xml version='1.0' encoding='UTF-8'?>
16&lt;plugin id="com.example.print-pdf">
17 &lt;require plugin="org.dita.pdf2"/>
18 &lt;feature extension="dita.conductor.transtype.check" value="print-pdf"/>
19 &lt;feature extension="dita.transtype.print" value="print-pdf"/>
20 &lt;feature extension="dita.conductor.target.relative" file="integrator.xml"/>
21&lt;/plugin></codeblock></fig></info>
22 </step>
23 <step>
24 <cmd>Add an Ant script <filepath>integrator.xml</filepath> to define the transformation
25 type.</cmd>
26 <info><codeblock>&lt;?xml version='1.0' encoding='UTF-8'?>
27&lt;project name="com.example.print-pdf">
28 &lt;target name="dita2print-pdf.init">
29 &lt;property name="customization.dir" location="${dita.plugin.com.example.print-pdf.dir}/cfg"/>
30 &lt;/target>
31 &lt;target name="dita2print-pdf" depends="dita2print-pdf.init, dita2pdf2"/>
32&lt;/project></codeblock></info>
33 </step>
34 <step>
35 <cmd>Add a <filepath>cfg/catalog.xml</filepath> file to take custom XSLT stylesheets into
36 use.</cmd>
37 <info><codeblock>&lt;?xml version="1.0" encoding="UTF-8"?>
38&lt;catalog prefer="system" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
39 &lt;uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/>
40 &lt;uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/>
41&lt;/catalog></codeblock></info>
42 </step>
43 <step>
44 <cmd>Add attribute and variable overrides to
45 <filepath>cfg/fo/attrs/custom.xsl</filepath></cmd>
46 <info> <codeblock>&lt;?xml version="1.0" encoding="UTF-8"?>
47&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
48 version="2.0">
49 &lt;!-- Change page size to A4 -->
50 &lt;xsl:variable name="page-width">210mm&lt;/xsl:variable>
51 &lt;xsl:variable name="page-height">297mm&lt;/xsl:variable>
52&lt;/xsl:stylesheet></codeblock></info>
53 </step>
54 <step>
55 <cmd>Add XSLT overrides to <filepath>cfg/fo/xsl/custom.xsl</filepath></cmd>
56 <info>
57 <codeblock>&lt;?xml version="1.0" encoding="UTF-8"?>
58&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
59 xmlns:xs="http://www.w3.org/2001/XMLSchema"
60 xmlns:fo="http://www.w3.org/1999/XSL/Format"
61 version="2.0">
62 &lt;!-- Move figure title to top and description to bottom -->
63 &lt;xsl:template match="*[contains(@class,' topic/fig ')]">
64 &lt;fo:block xsl:use-attribute-sets="fig">
65 &lt;xsl:call-template name="commonattributes"/>
66 &lt;xsl:if test="not(@id)">
67 &lt;xsl:attribute name="id">
68 &lt;xsl:call-template name="get-id"/>
69 &lt;/xsl:attribute>
70 &lt;/xsl:if>
71 &lt;xsl:apply-templates select="*[contains(@class,' topic/title ')]"/>
72 &lt;xsl:apply-templates select="*[not(contains(@class,' topic/title ') or contains(@class,' topic/desc '))]"/>
73 &lt;xsl:apply-templates select="*[contains(@class,' topic/desc ')]"/>
74 &lt;/fo:block>
75 &lt;/xsl:template>
76&lt;/xsl:stylesheet></codeblock>
77 </info>
78 </step>
79 <step>
80 <cmd>Add variable definition file <filepath>cfg/common/vars/en.xml</filepath> for English to
81 override generated text.</cmd>
82 <info>
83 <codeblock>&lt;?xml version="1.0" encoding="UTF-8"?>
84&lt;vars xmlns="http://www.idiominc.com/opentopic/vars">
85 &lt;!-- Remove dot from list number -->
86 &lt;variable id="Ordered List Number">&lt;param ref-name="number"/>&lt;/variable>
87 &lt;!-- Change unordered list bullet to an em dash -->
88 &lt;variable id="Unordered List bullet">&amp;#x2014;&lt;/variable>
89&lt;/vars></codeblock>
90 </info>
91 </step>
92 </steps>
93 <result id="result_23y_yv3_tf">
94 <p>The plug-in directory should have the layout and files:</p>
95 <codeblock>com.example.print-pdf/
96 cfg/
97 common/
98 vars/
99 en.xml
100 fo/
101 attrs/
102 custom.xsl
103 xsl/
104 custom.xsl
105 catalog.xml
106 integrator.xml
107 plugin.xml</codeblock>
108 </result>
109 <postreq id="postreq_mqj_zz3_tf">
110 <p>Run integration process to install the plug-in and take the <keyword>print-pdf</keyword>
111 transformation type into use.</p>
112 </postreq>
113 </taskbody>
114</task>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette