XMLTO(1)
πΈ NAME πΈ
xmlto β apply an XSL stylesheet to an XML document β¨
okay so welcome to XMLTO(1), bestie π this is the reference page for xmlto, and honestly? she's a little powerhouse. she takes your XML file and makes it become whatever format you asked for, using literally whatever means necessary. no cap. π«Ά
π SYNOPSIS π
xmlto [-o output_dir] [-x custom_xsl] [-m xsl_fragment] [-v]
[-p postprocessor_opts] [--extensions] [--searchpath path]
[--skip-validation] [--stringparam paramname=paramvalue]
[--noclean] [--noautosize] [--noextensions] [--profile]
[--with-fop] [--with-dblatex] {format} {file}
xmlto {[--help] | [--version]}
π¦ DESCRIPTION π¦
So the whole purpose of xmlto is to convert an XML file to the format you want, using whatever means necessary. π
And sometimes that's a two-step kind of situation:
- Applying an appropriate XSL stylesheet using an XSL-T processor. π§
- Further processing with other tools. (this step might not even be necessary, she's flexible like that)
To figure out which stylesheet to use and what (if anything) needs to happen to post-process the output, xmlto uses format scripts β they're just simple shell scripts that xmlto calls during the conversion. π
The right format script gets picked based on the type of XML file and the output format you want. xmlto ships with some format scripts for converting DocBook XML files into a whole variety of formats. And yes bestie, you can bring your own format script β just use an absolute filename for format on the command line. π
β¨ The first call: choosing a stylesheet β¨
Firstly, if xmlto hasn't been told explicitly which stylesheet to use (that's the -x option), the format script gets called with $1 set to stylesheet. The environment variable XSLT_PROCESSOR holds the base name of the executable that'll do the XSL-T transformation (like, for example, xsltproc). The format script should write the name of the stylesheet to use to standard output and exit successfully β or exit with a non-zero return code if there's no appropriate stylesheet to use (for example, if the only stylesheet available is known not to work with the XSL-T processor that's gonna be used π).
And here's a lil plot twist: if nothing gets written to standard output but the script still exits successfully, then no XSL-T transformation will be performed. Periodt.
π The second call: post-processing π
Secondly, after an XSL-T processor has been run using the stylesheet, the format script gets called again, this time with $1 set to post-process. The format script should do whatever necessary steps translate the XSL-T processed output into the desired output format β including copying the output to the desired output directory. π
For post-processing, the format script runs in a temporary directory containing just the processed output (its name is stored in XSLT_PROCESSED, and its basename is that of the original XML file with any filename extension replaced with .proc). Also:
INPUT_FILEis set to the name of the original XML fileOUTPUT_DIRis set to the name of the directory that the output (and only the output) must end up inSEARCHPATHis set to a colon-separate list of fallback directories in which to look for input (for images, for example) πΌοΈ
If this step is unsuccessful, the format script should exit with a non-zero return code. π
π OPTIONS π
-vβ be verbose (-vvfor very verbose). she's chatty, we love that π¬-xstylesheet β usestylesheetinstead of asking the format script to choose one.-mfragment β use the provided XSL fragment to modify the stylesheet.-odirectory β put output in the specified directory instead of the current working directory.-ppostprocessor_opts β passpostprocessor_optsto processing stages after stylesheet application (e.g.lynxorlinkswhen going through HTML to text, orxmltexwhen going from through TeX to DVI). If-pis specified a second time, the options specified will be passed to second-stage postprocessing; presently this is only applicable when going throughxmltexanddvipsto PostScript.--extensionsβ turn on stylesheet extensions for the tool chain in use (use.extensionsis turned on). The variables turned on are the ones used by Norman Walsh's DocBook XSL stylesheets. π₯--searchpathpath β add the colon-separated list of directories inpathas fallback directories for including input.--skip-validationβ skip the validation step that is normally performed. living dangerously, love that for you π--stringparamparamname=paramvalue β pass a named parameterparamnamewith valueparamvaluetostylesheetfrom the command line.--nocleanβ temporary files are not deleted (their names are shown and kept in tmp directory). It could help with analyzing problems. π--noautosizeβ by default, some XSL variables are overridden by autodetection (page.widthandpage.heightforpaperconf(libpaper) use,paper.typefor locale-based (LC_PAPER) selection). With this option,xmltodoesn't use this autodetection and user is able to modify defaults himself (either via defaultparam.xslmodification or by user-defined XSL fragment).--noextensionsβ by default,xmltoenables XSL paramspassivetex.extensionsfor passivetex backend andfop.extensionsandfop1.extensionsfor fop backend. This usually produces better results. If you for some reason don't want to use these parameters, just disable them using this option.--profileβ pre-process the XML document with the profiling stylesheet.--with-fopβ usefopfor formatting. It is an experimental option, expectsfopin specific location (detected at configured time), could be changed manually inxmltoscript by modification ofFOP_PATH.
β οΈ bestie, --with-fop is experimental, ok? don't come for me.
--with-dblatexβ usedblatexfor formatting. It is an experimental option, expectsdblatexin specific location (detected at configured time), could be changed manually inxmltoscript by modification ofDBLATEX_PATH.
β οΈ same energy: --with-dblatex is experimental too π
--helpβ display a short usage message. It will describexmlto's options, and the available output formats. π«Ά--versionβ display the version number ofxmlto.
π ENVIRONMENT π
XSLT_PROCESSORβ base name of the executable that will be used to perform the XSL-T transformation (default:xsltproc(1)).TMPDIRβ directory, where to create temporary stylesheets (default:/tmp).
β DIAGNOSTICS β
0β everything went fine. This is the expected exit code. π1βxmltowas called with insufficient arguments. π2βmktemp(1)failed to create a file/directory. Make sure/tmporTMPDIRis writable.3βxmltofailed to find some binary on configured location. Make sure that all required packages are installed and paths inxmltoscript are set properly.10+(Validation non-zero error code)βxmltotried to validate a xml document, but validation failed. For better diagnostic, validation output andxmllintexit code is provided. Consider either fixing your document or using--skip-validation.
π EXAMPLES π
To convert a DocBook XML document to PDF, use:
xmlto pdf mydoc.xml
To convert a DocBook XML document to HTML and store the resulting HTML files in a separate directory use:
xmlto -o html-dir html mydoc.xml
To convert a DocBook XML document to a single HTML file use:
xmlto html-nochunks mydoc.xml
To modify the output using an XSL fragment use:
xmlto -m ulink.xsl pdf mydoc.xml
To specify which stylesheet to use (overriding the one that the format script would choose) use:
xmlto -x mystylesheet.xsl pdf mydoc.xml
π AUTHORS π
- Tim Waugh
<twaugh@redhat.com>β original author, maintainer until0.0.18π«‘ - OndΕej VaΕ‘Γk
<ovasik@redhat.com>β maintainer since0.0.19π
π§ COPYRIGHT π§
(it's giving very "official business", so here's the receipts, bestie π)
and that's the whole page, bestie!! this manual is for xmlto 0.0.25, dated November 2011 β iconic behavior from 2011 that's still serving today. mwah π
β¨
π¦ where this page comes from
- arch rolling: xmlto 0.0.29-1 Β· GPL
- fedora 43: xmlto 0.0.29-3.fc43 Β· GPL-2.0-or-later
- fedora 44: xmlto 0.0.29-5.fc44 Β· GPL-2.0-or-later
- nixos 26.05: xmlto 0.0.29
- nixpkgs unstable: xmlto 0.0.29
- ubuntu questing: xmlto 0.0.29-2
- ubuntu resolute: xmlto 0.0.29-3 Β· GPL-2.0-or-later
- ubuntu stonking: xmlto 0.0.29-3 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms