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] [--with-fop] [--with-dblatex] {format}
13 {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 (for
88 example, this might turn on passivetex.extensions and
89 use.extensions if PassiveTeX is being used). The variables turned
90 on are the ones used by Norman Walsh´s DocBook XSL stylesheets.
91
92 --searchpath path
93 Add the colon-separated list of directories in path as fallback
94 directories for including input.
95
96 --skip-validation
97 Skip the validation step that is normally performed.
98
99 --stringparam paramname=paramvalue
100 Pass a named parameter paramname with value paramvalue to
101 stylesheet from the command line.
102
103 --noclean
104 Temporary files are not deleted(their names are shown and kept in
105 tmp directory). It could help with analyzing problems.
106
107 --noautosize
108 By default, some XSL variables are overriden by autodetection
109 (page.width and page.height for paperconf (libpaper) use,
110 paper.type for locale-based (LC_PAPER) selection). With this
111 option, xmlto doesn’t use this autodetection and user is able to
112 modify defaults himself (either via default param.xsl modification
113 or by user-defined XSL fragment).
114
115 --with-fop
116 Use fop for formatting. It is an experimental option, expects fop
117 in specific location(detected at configured time), could be changed
118 manually in xmlto script by modification of FOP_PATH
119
120 --with-dblatex
121 Use dblatex for formatting. It is an experimental option, expects
122 dblatex in specific location(detected at configured time), could be
123 changed manually in xmlto script by modification of DBLATEX_PATH
124
125 --help
126 Display a short usage message. It will describe xmlto´s options,
127 and the available output formats.
128
129 --version
130 Display the version number of xmlto.
131
133 XSLT_PROCESSOR
134 Base name of the executable that will be used to perform the XSL-T
135 transformation (default: xsltproc(1)).
136
137 TMPDIR
138 Directory, where to create temporary stylesheets (default: /tmp).
139
141 0
142 Everything went fine. This is the expected exit code.
143
144 1
145 xmlto was called with insufficient arguments.
146
147 2
148 mktemp(1) failed to create a file/directory. Make sure /tmp or
149 TMPDIR is writable.
150
151 3
152 xmlto failed to find some binary on configured location. Make sure
153 that all required packages are installed and paths in xmlto script
154 are set properly.
155
156 10+(Validation non-zero error code)
157 xmlto tried to validate a xml document, but validation failed. For
158 better diagnostic, validation output and xmllint exit code is
159 provided. Consider either fixing your document or using
160 --skip-validation.
161
163 To convert a DocBook XML document to PDF, use:
164
165 xmlto pdf mydoc.xml
166
167 To convert a DocBook XML document to HTML and store the resulting HTML
168 files in a separate directory use:
169
170 xmlto -o html-dir html mydoc.xml
171
172 To convert a DocBook XML document to a single HTML file use:
173
174 xmlto html-nochunks mydoc.xml
175
176 To modify the output using an XSL fragment use:
177
178 xmlto -m ulink.xsl pdf mydoc.xml
179
180 To specify which stylesheet to use (overriding the one that the format
181 script would choose) use:
182
183 xmlto -x mystylesheet.xsl pdf mydoc.xml
184
186 Tim Waugh <twaugh@redhat.com>
187 Original author, maintainer until 0.0.18
188
189 Ondřej Vašík <ovasik@redhat.com>
190 Maintainer since 0.0.19
191
193xmlto 0.0.23 September 2009 XMLTO(1)