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] {format} {file}
12
13 xmlto {[--help] [--version]}
14
16 The purpose of xmlto is to convert an XML file to the desired format
17 using whatever means necessary. This may involve two steps:
18
19 1. The application of an appropriate XSL stylesheet using an XSL-T
20 processor.
21
22 2. Further processing with other tools. This step may not be necessary.
23
24 To decide which stylesheet to use and what, if any, needs to be done to
25 post-process the output, xmlto makes use of format scripts, which are
26 simple shell scripts that xmlto calls during the conversion.
27
28 The appropriate format script is selected based on the type of XML file
29 and the desired output format. xmlto comes with some format scripts
30 for converting DocBook XML files to a variety of formats. You may
31 specify your own format script by using an absolute filename for format
32 on the command line.
33
34 Firstly, if xmlto has not been told explicitly which stylesheet to use
35 (with the -x option), the format script will be called with $1 set to
36 stylesheet. The environment variable XSLT_PROCESSOR contains the base
37 name of the executable that will be used to perform the XSL-T
38 transformation (for example xsltproc), and the environment variable
39 XSL_DIR contains the path to the directory containing some useful
40 stylesheets that come with xmlto. The format script should write the
41 name of the stylesheet to use to standard output and exit successfully,
42 or exit with a non-zero return code if there is no appropriate
43 stylesheet to use (for example, if the only available stylesheet is
44 known not to work with the XSL-T processor that will be used). If
45 nothing is written to standard output but the script exits
46 successfully, no XSL-T transformation will be performed.
47
48 Secondly, after an XSL-T processor has been run using the stylesheet,
49 the format script will be called again, this time with $1 set to
50 post-process. The format script should perform any necessary steps to
51 translate the XSL-T processed output into the desired output format,
52 including copying the output to the desired output directory. For
53 post-processing, the format script is run in a temporary directory
54 containing just the processed output (whose name is stored in
55 XSLT_PROCESSED and whose basename is that of the original XML file with
56 any filename extension replaced with INPUT_FILE is set to the name of
57 the original XML file, OUTPUT_DIR is set to the name of the directory
58 that the output (and only the output) must end up in, and SEARCHPATH is
59 set to a colon-separate list of fallback directories in which to look
60 for input (for images, for example). If this step is unsuccessful the
61 format script should exit with a non-zero return code.
62
63 -v Be verbose (-vv for very verbose).
64
65 -x stylesheet
66 Use stylesheet instead of asking the format script to choose
67 one.
68
69 -m fragment
70 Use the provided XSL fragment to modify the stylesheet.
71
72 -o directory
73 Put output in the specified directory instead of the current
74 working directory.
75
76 -p postprocessor_opts
77 Pass postprocessor_opts to processing stages after stylesheet
78 application (e.g. lynx or links when going through HTML to
79 text, or xmltex when going from through TeX to DVI). If -p is
80 specified a second time, the options specified will be passed to
81 second-stage postprocessing; presently this is only applicable
82 when going through xmltex and dvips to PostScript.
83
84 --extensions
85 Turn on stylesheet extensions for the tool chain in use (for
86 example, this might turn on passivetex.extensions and
87 use.extensions if PassiveTeX is being used). The variables
88 turned on are the ones used by Norman Walsh's DocBook XSL
89 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 --help Display a short usage message. It will describe xmlto's options,
99 and the available output formats.
100
101 --version
102 Display the version number of xmlto.
103
105 To convert a DocBook XML document to PDF, use:
106
107 xmlto pdf mydoc.xml
108
109 To convert a DocBook XML document to HTML and store the resulting HTML
110 files in a separate directory use:
111
112 xmlto -o html-dir html mydoc.xml
113
114 To convert a DocBook XML document to a single HTML file use:
115
116 xmlto html-nochunks mydoc.xml
117
118 To modify the output using an XSL fragment use:
119
120 xmlto -m ulink.xsl pdf mydoc.xml
121
122 To specify which stylesheet to use (overriding the one that the format
123 script would choose) use:
124
125 xmlto -x mystylesheet.xsl pdf mydoc.xml
126
127
128
129
130Linux October 2002 XMLTO(1)