VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/doc/readme/dita2pdf-customization.html@ 99507

最後變更 在這個檔案從99507是 98584,由 vboxsync 提交於 2 年 前

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

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 7.4 KB
 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE html
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4<html xml:lang="en" lang="en">
5<head>
6<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7<meta name="copyright" content="(C) Copyright 2005"/>
8<meta name="DC.rights.owner" content="(C) Copyright 2005"/>
9<meta name="DC.Type" content="task"/>
10<meta name="DC.Title" content="Customizing PDF output"/>
11<meta name="abstract" content="Example of PDF output customization with a custom transformation type."/>
12<meta name="description" content="Example of PDF output customization with a custom transformation type."/>
13<meta name="DC.Relation" scheme="URI" content="../dev_ref/developer-reference.html"/>
14<meta name="DC.Format" content="XHTML"/>
15<meta name="DC.Identifier" content="dita2pdf-customization"/>
16<meta name="DC.Language" content="en"/>
17<link rel="stylesheet" type="text/css" href="../commonltr.css"/>
18<link rel="stylesheet" type="text/css" href="../dita-ot-doc.css"/>
19<title>Customizing PDF output</title>
20</head>
21<body id="dita2pdf-customization">
22
23
24 <h1 class="title topictitle1">Customizing PDF output</h1>
25
26
27 <div class="body taskbody"><p class="shortdesc">Example of PDF output customization with a custom transformation type.</p>
28
29 <div class="tasklabel"><h2 class="sectiontitle tasklabel">Procedure</h2></div><ol class="ol steps"><li class="li step stepexpand">
30 <span class="ph cmd">Create a new plug-in directory <span class="ph filepath">com.example.print-pdf</span> into DITA-OT
31 <span class="ph filepath">plugins</span> directory.</span>
32 </li>
33<li class="li step stepexpand">
34 <span class="ph cmd">Create a plug-in configuration file <span class="ph filepath">plugin.xml</span>, declare the new
35 transformation type <span class="keyword">print-pdf</span> and dependencies.</span>
36 <div class="itemgroup info"><div class="fig fignone"><pre class="pre codeblock">&lt;?xml version='1.0' encoding='UTF-8'?&gt;
37&lt;plugin id="com.example.print-pdf"&gt;
38 &lt;require plugin="org.dita.pdf2"/&gt;
39 &lt;feature extension="dita.conductor.transtype.check" value="print-pdf"/&gt;
40 &lt;feature extension="dita.transtype.print" value="print-pdf"/&gt;
41 &lt;feature extension="dita.conductor.target.relative" file="integrator.xml"/&gt;
42&lt;/plugin&gt;</pre>
43</div>
44</div>
45 </li>
46<li class="li step stepexpand">
47 <span class="ph cmd">Add an Ant script <span class="ph filepath">integrator.xml</span> to define the transformation
48 type.</span>
49 <div class="itemgroup info"><pre class="pre codeblock">&lt;?xml version='1.0' encoding='UTF-8'?&gt;
50&lt;project name="com.example.print-pdf"&gt;
51 &lt;target name="dita2print-pdf.init"&gt;
52 &lt;property name="customization.dir" location="${dita.plugin.com.example.print-pdf.dir}/cfg"/&gt;
53 &lt;/target&gt;
54 &lt;target name="dita2print-pdf" depends="dita2print-pdf.init, dita2pdf2"/&gt;
55&lt;/project&gt;</pre>
56</div>
57 </li>
58<li class="li step stepexpand">
59 <span class="ph cmd">Add a <span class="ph filepath">cfg/catalog.xml</span> file to take custom XSLT stylesheets into
60 use.</span>
61 <div class="itemgroup info"><pre class="pre codeblock">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
62&lt;catalog prefer="system" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"&gt;
63 &lt;uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/&gt;
64 &lt;uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/&gt;
65&lt;/catalog&gt;</pre>
66</div>
67 </li>
68<li class="li step stepexpand">
69 <span class="ph cmd">Add attribute and variable overrides to
70 <span class="ph filepath">cfg/fo/attrs/custom.xsl</span></span>
71 <div class="itemgroup info"> <pre class="pre codeblock">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
72&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
73 version="2.0"&gt;
74 &lt;!-- Change page size to A4 --&gt;
75 &lt;xsl:variable name="page-width"&gt;210mm&lt;/xsl:variable&gt;
76 &lt;xsl:variable name="page-height"&gt;297mm&lt;/xsl:variable&gt;
77&lt;/xsl:stylesheet&gt;</pre>
78</div>
79 </li>
80<li class="li step stepexpand">
81 <span class="ph cmd">Add XSLT overrides to <span class="ph filepath">cfg/fo/xsl/custom.xsl</span></span>
82 <div class="itemgroup info">
83 <pre class="pre codeblock">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
84&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
85 xmlns:xs="http://www.w3.org/2001/XMLSchema"
86 xmlns:fo="http://www.w3.org/1999/XSL/Format"
87 version="2.0"&gt;
88 &lt;!-- Move figure title to top and description to bottom --&gt;
89 &lt;xsl:template match="*[contains(@class,' topic/fig ')]"&gt;
90 &lt;fo:block xsl:use-attribute-sets="fig"&gt;
91 &lt;xsl:call-template name="commonattributes"/&gt;
92 &lt;xsl:if test="not(@id)"&gt;
93 &lt;xsl:attribute name="id"&gt;
94 &lt;xsl:call-template name="get-id"/&gt;
95 &lt;/xsl:attribute&gt;
96 &lt;/xsl:if&gt;
97 &lt;xsl:apply-templates select="*[contains(@class,' topic/title ')]"/&gt;
98 &lt;xsl:apply-templates select="*[not(contains(@class,' topic/title ') or contains(@class,' topic/desc '))]"/&gt;
99 &lt;xsl:apply-templates select="*[contains(@class,' topic/desc ')]"/&gt;
100 &lt;/fo:block&gt;
101 &lt;/xsl:template&gt;
102&lt;/xsl:stylesheet&gt;</pre>
103
104 </div>
105 </li>
106<li class="li step stepexpand">
107 <span class="ph cmd">Add variable definition file <span class="ph filepath">cfg/common/vars/en.xml</span> for English to
108 override generated text.</span>
109 <div class="itemgroup info">
110 <pre class="pre codeblock">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
111&lt;vars xmlns="http://www.idiominc.com/opentopic/vars"&gt;
112 &lt;!-- Remove dot from list number --&gt;
113 &lt;variable id="Ordered List Number"&gt;&lt;param ref-name="number"/&gt;&lt;/variable&gt;
114 &lt;!-- Change unordered list bullet to an em dash --&gt;
115 &lt;variable id="Unordered List bullet"&gt;&amp;#x2014;&lt;/variable&gt;
116&lt;/vars&gt;</pre>
117
118 </div>
119 </li>
120</ol>
121
122 <div class="section result" id="dita2pdf-customization__result_23y_yv3_tf"><div class="tasklabel"><h2 class="sectiontitle tasklabel">Results</h2></div>
123 <p class="p">The plug-in directory should have the layout and files:</p>
124
125 <pre class="pre codeblock">com.example.print-pdf/
126 cfg/
127 common/
128 vars/
129 en.xml
130 fo/
131 attrs/
132 custom.xsl
133 xsl/
134 custom.xsl
135 catalog.xml
136 integrator.xml
137 plugin.xml</pre>
138
139 </div>
140
141 <div class="section postreq" id="dita2pdf-customization__postreq_mqj_zz3_tf"><div class="tasklabel"><h2 class="sectiontitle tasklabel">What to do next</h2></div>
142 <p class="p">Run integration process to install the plug-in and take the <span class="keyword">print-pdf</span>
143 transformation type into use.</p>
144
145 </div>
146
147 </div>
148
149<div class="related-links">
150<div class="familylinks">
151<div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../dev_ref/developer-reference.html" title="The DITA Open Toolkit Developer Reference is designed to provide more advanced information about the DITA OT. It is geared to an audience that needs information about the DITA-OT architecture, configuring and extending the DITA-OT, and creating DITA-OT plug-ins.">DITA Open Toolkit Developer Reference</a></div>
152</div>
153</div>
154
155</body>
156</html>
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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