1XMLTO(1) Reference XMLTO(1)
2
3
4
6 xmlto - apply an XSL stylesheet to an XML document
7
9 xmlto [-o output_dir] [-x custom_xsl] [-m xsl_fragment] [-v]
10 [-p postprocessor_opts] [--extensions] [--searchpath path]
11 [--skip-validation] [--stringparam paramname=paramvalue]
12 [--noclean] [--noautosize] [--noextensions] [--with-fop]
13 [--with-dblatex] {format} {file}
14
15 xmlto {[--help] | [--version]}
16
18 The purpose of xmlto is to convert an XML file to the desired format
19 using whatever means necessary. This may involve two steps:
20
21 1. The application of an appropriate XSL stylesheet using an XSL-T
22 processor.
23
24 2. Further processing with other tools. This step may not be
25 necessary.
26
27 To decide which stylesheet to use and what, if any, needs to be done to
28 post-process the output, xmlto makes use of format scripts, which are
29 simple shell scripts that xmlto calls during the conversion.
30
31 The appropriate format script is selected based on the type of XML file
32 and the desired output format. xmlto comes with some format scripts
33 for converting DocBook XML files to a variety of formats. You may
34 specify your own format script by using an absolute filename for format
35 on the command line.
36
37 Firstly, if xmlto has not been told explicitly which stylesheet to use
38 (with the -x option), the format script will be called with $1 set to
39 stylesheet. The environment variable XSLT_PROCESSOR contains the base
40 name of the executable that will be used to perform the XSL-T
41 transformation (for example xsltproc). The format script should write
42 the name of the stylesheet to use to standard output and exit
43 successfully, or exit with a non-zero return code if there is no
44 appropriate stylesheet to use (for example, if the only available
45 stylesheet is known not to work with the XSL-T processor that will be
46 used). If nothing is written to standard output but the script exits
47 successfully, no XSL-T transformation will be performed.
48
49 Secondly, after an XSL-T processor has been run using the stylesheet,
50 the format script will be called again, this time with $1 set to
51 post-process. The format script should perform any necessary steps to
52 translate the XSL-T processed output into the desired output format,
53 including copying the output to the desired output directory. For
54 post-processing, the format script is run in a temporary directory
55 containing just the processed output (whose name is stored in
56 XSLT_PROCESSED and whose basename is that of the original XML file with
57 any filename extension replaced with .proc). INPUT_FILE is set to the
58 name of the original XML file, OUTPUT_DIR is set to the name of the
59 directory that the output (and only the output) must end up in, and
60 SEARCHPATH is set to a colon-separate list of fallback directories in
61 which to look for input (for images, for example). If this step is
62 unsuccessful the format script should exit with a non-zero return code.
63
65 -v
66 Be verbose (-vv for very verbose).
67
68 -x stylesheet
69 Use stylesheet instead of asking the format script to choose one.
70
71 -m fragment
72 Use the provided XSL fragment to modify the stylesheet.
73
74 -o directory
75 Put output in the specified directory instead of the current
76 working directory.
77
78 -p postprocessor_opts
79 Pass postprocessor_opts to processing stages after stylesheet
80 application (e.g. lynx or links when going through HTML to text,
81 or xmltex when going from through TeX to DVI). If -p is specified a
82 second time, the options specified will be passed to second-stage
83 postprocessing; presently this is only applicable when going
84 through xmltex and dvips to PostScript.
85
86 --extensions
87 Turn on stylesheet extensions for the tool chain in use
88 (use.extensions is turned on). The variables turned on are the ones
89 used by Norman Walsh's DocBook XSL stylesheets.
90
91 --searchpath path
92 Add the colon-separated list of directories in path as fallback
93 directories for including input.
94
95 --skip-validation
96 Skip the validation step that is normally performed.
97
98 --stringparam paramname=paramvalue
99 Pass a named parameter paramname with value paramvalue to
100 stylesheet from the command line.
101
102 --noclean
103 Temporary files are not deleted(their names are shown and kept in
104 tmp directory). It could help with analyzing problems.
105
106 --noautosize
107 By default, some XSL variables are overriden by autodetection
108 (page.width and page.height for paperconf (libpaper) use,
109 paper.type for locale-based (LC_PAPER) selection). With this
110 option, xmlto doesn’t use this autodetection and user is able to
111 modify defaults himself (either via default param.xsl modification
112 or by user-defined XSL fragment).
113
114 --noextensions
115 By default, xmlto enables XSL params passivetex.extensions for
116 passivetex backend and fop.extensions and fop1.extensions for fop
117 backend. This usually produces better results. If you for some
118 reason don't want to use these parameters, just disable them using
119 this option.
120
121 --with-fop
122 Use fop for formatting. It is an experimental option, expects fop
123 in specific location(detected at configured time), could be changed
124 manually in xmlto script by modification of FOP_PATH
125
126 --with-dblatex
127 Use dblatex for formatting. It is an experimental option, expects
128 dblatex in specific location(detected at configured time), could be
129 changed manually in xmlto script by modification of DBLATEX_PATH
130
131 --help
132 Display a short usage message. It will describe xmlto's options,
133 and the available output formats.
134
135 --version
136 Display the version number of xmlto.
137
139 XSLT_PROCESSOR
140 Base name of the executable that will be used to perform the XSL-T
141 transformation (default: xsltproc(1)).
142
143 TMPDIR
144 Directory, where to create temporary stylesheets (default: /tmp).
145
147 0
148 Everything went fine. This is the expected exit code.
149
150 1
151 xmlto was called with insufficient arguments.
152
153 2
154 mktemp(1) failed to create a file/directory. Make sure /tmp or
155 TMPDIR is writable.
156
157 3
158 xmlto failed to find some binary on configured location. Make sure
159 that all required packages are installed and paths in xmlto script
160 are set properly.
161
162 10+(Validation non-zero error code)
163 xmlto tried to validate a xml document, but validation failed. For
164 better diagnostic, validation output and xmllint exit code is
165 provided. Consider either fixing your document or using
166 --skip-validation.
167
169 To convert a DocBook XML document to PDF, use:
170
171 xmlto pdf mydoc.xml
172
173 To convert a DocBook XML document to HTML and store the resulting HTML
174 files in a separate directory use:
175
176 xmlto -o html-dir html mydoc.xml
177
178 To convert a DocBook XML document to a single HTML file use:
179
180 xmlto html-nochunks mydoc.xml
181
182 To modify the output using an XSL fragment use:
183
184 xmlto -m ulink.xsl pdf mydoc.xml
185
186 To specify which stylesheet to use (overriding the one that the format
187 script would choose) use:
188
189 xmlto -x mystylesheet.xsl pdf mydoc.xml
190
192 Tim Waugh <twaugh@redhat.com>
193 Original author, maintainer until 0.0.18
194
195 Ondřej Vašík <ovasik@redhat.com>
196 Maintainer since 0.0.19
197
199xmlto 0.0.25 November 2011 XMLTO(1)