XSLTPROC(1)
๐ XSLTPROC(1) ๐
okay so this is the xsltproc manual page, bestie โ from the xsltproc Manual, and yes it's giving "very serious tool, very serious docs," but we're gonna make it cute anyway. ๐
โจ NAME โจ
xsltproc โ command line XSLT processor
๐ธ SYNOPSIS ๐ธ
xsltproc [[-V | --version] [-v | --verbose] [{-o | --output} {FILE |
DIRECTORY}] | --timing | --repeat | --debug | --novalid |
--noout | --maxdepth VALUE | --maxvars VALUE | --huge |
--seed-rand VALUE | --html | --encoding ENCODING |
--param PARAMNAME PARAMVALUE |
--stringparam PARAMNAME PARAMVALUE | --nonet |
--path "PATH(S)" | --load-trace | --catalogs | --xinclude |
--xincludestyle | [--profile | --norman] | --dumpextensions |
--nowrite | --nomkdir | --writesubtree PATH | --nodtdattr]
[STYLESHEET] {XML-FILE... | -}
like. look at that. it's a whole vibe. ๐ฆ
๐ DESCRIPTION ๐
xsltproc is a command line tool for applying XSLT stylesheets to XML documents. It's part of libxslt(3), the XSLT C library for GNOME. And listen โ even though it was developed as part of the GNOME project, it can operate independently of the GNOME desktop. main character energy fr fr. โจ
So the way you call it: you invoke xsltproc from the command line with the name of the stylesheet you wanna use, followed by the name of the file (or files) you want that stylesheet applied to. And if a filename you pass is -, it will use the standard input. iconic behavior. ๐ซถ
Also! If a stylesheet is included in an XML document with a Stylesheet Processing Instruction, you don't need to name a stylesheet at the command line at all. xsltproc will automatically detect the included stylesheet and use it. not me being self-sufficient ๐
By default, output goes to stdout. If you want it in a file instead, use the -o or --output option.
๐ OPTIONS ๐
xsltproc accepts the following options (in alphabetical order):
--catalogsโ Use the SGML catalog specified inSGML_CATALOG_FILESto resolve the location of external entities. By default,xsltproclooks for the catalog specified inXML_CATALOG_FILES. If that isn't specified, it uses/etc/xml/catalog. ๐ two whole different catalog systems, pick your fighter.--debugโ Output an XML tree of the transformed document, for debugging purposes.--dumpextensionsโ Dumps the list of all registered extensions on stdout.--htmlโ The input document is an HTML file.--load-traceโ Display all the documents loaded during the processing to stderr.--maxdepth VALUEโ Adjust the maximum depth of the template stack beforelibxslt(3)concludes it's in an infinite loop. The default is3000. (bestie it's not looping, it's just โจthoroughโจ โ no wait, it might be looping. that's the whole point.)--maxvars VALUEโ Maximum number of variables. The default is15000.--hugeโ Relax hardcoded limits of the XML parser by setting theXML_PARSE_HUGEparser option. going huge. no notes. ๐ฅ--seed-rand VALUEโ Initialize pseudo random number generator with specific seed.--nodtdattrโ Do not apply default attributes from the document's DTD.--nomkdirโ Refuses to create directories.--nonetโ Do not use the Internet to fetch DTDs, entities or documents. offline era ๐--nooutโ Do not output the result.--novalidโ Skip loading the document's DTD.--nowriteโ Refuses to write to any file or resource.-oor--outputFILE | DIRECTORY โ Direct output to the given FILE. Using the option with a DIRECTORY directs the output files to the specified directory. This can be useful for multiple outputs (also known as "chunking") or manpage processing.
Important ๐ The given directory must already exist. like it's not gonna make it for you, girl.
Note โ Make sure that FILE and DIRECTORY follow the โURI reference computationโ as described in RFC 2396 and laters. This means, that e.g.-o directorywill maybe not work, but-o directory/will. the slash is doing SO much heavy lifting here ๐
--encoding ENCODINGโ Allow to specify the encoding for the input.--param PARAMNAME PARAMVALUEโ Pass a parameter of name PARAMNAME and value PARAMVALUE to the stylesheet. You may pass multiple name/value pairs up to a maximum of32. If the value being passed is a string, you can use--stringparaminstead, to avoid additional quote characters that appear in string expressions. Note: the XPath expression must be UTF-8 encoded.--path "PATH(S)"โ Use the (space- or colon-separated) list of filesystem paths specified by PATHS to load DTDs, entities or documents. Enclose space-separated lists by quotation marks.--profileor--normanโ Output profiling information detailing the amount of time spent in each part of the stylesheet. This is useful in optimizing stylesheet performance. (yes the second one is literally called--norman. we don't ask questions. we just respect it. ๐)--repeatโ Run the transformation20times. Used for timing tests.--stringparam PARAMNAME PARAMVALUEโ Pass a parameter of name PARAMNAME and value PARAMVALUE where PARAMVALUE is a string rather than a node identifier. Note: The string must be UTF-8 encoded.--timingโ Display the time used for parsing the stylesheet, parsing the document and applying the stylesheet and saving the result. Displayed in milliseconds.-vor--verboseโ Output each step taken byxsltprocin processing the stylesheet and the document.-Vor--versionโ Show the version oflibxml(3)andlibxslt(3)used.--writesubtree PATHโ Allow file write only within the PATH subtree.--xincludeโ Process the input document using the XInclude specification. More details on this can be found in the XInclude specification: http://www.w3.org/TR/xinclude/--xincludestyleโ Process the stylesheet with XInclude.
๐ง ENVIRONMENT ๐ง
SGML_CATALOG_FILESโ SGML catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting theSGML_CATALOG_FILESenvironment variable to a list of catalogs. An empty one should deactivate loading the default/etc/sgml/catalogcatalog.XML_CATALOG_FILESโ XML catalog behavior can be changed by redirecting queries to the user's own set of catalogs. This can be done by setting theXML_CATALOG_FILESenvironment variable to a list of catalogs. An empty one should deactivate loading the default/etc/xml/catalogcatalog.
(an empty one deactivating the default? that's the "leave me alone" setting and honestly, relatable. ๐)
๐ DIAGNOSTICS ๐
xsltproc return codes provide information that can be used when calling it from scripts. so if you're scripting, these are your little status receipts:
0โ No error (normal operation)1โ No argument2โ Too many parameters3โ Unknown option4โ Failed to parse the stylesheet5โ Error in the stylesheet6โ Error in one of the documents7โ Unsupportedxsl:outputmethod8โ String parameter contains both quote and double-quotes9โ Internal processing error10โ Processing was stopped by a terminating message11โ Could not write the result to the output file
number 8 is SO specific and honestly? it has trauma. we can tell. ๐ญ
โญ SEE ALSO โญ
More information can be found at
libxml(3)web page https://gitlab.gnome.org/GNOME/libxslt- W3C XSLT page http://www.w3.org/TR/xslt
๐ท AUTHOR ๐ท
John Fleck <jfleck@inkstain.net>
- Author.
๐ COPYRIGHT ๐
Copyright ยฉ 2001, 2002
okay that's the whole page bestie, you're officially certified ๐ go forth and transform some XML. slay. ๐
libxslt ยท 07/04/2024 ยท XSLTPROC(1) โ mwah, that's a wrap ๐โจ
๐ฆ where this page comes from
- alpine 3.22: libxslt-doc 1.1.43-r3 ยท X11
- alpine 3.23: libxslt-doc 1.1.43-r3 ยท X11
- alpine 3.24: libxslt-doc 1.1.43-r3 ยท X11
- arch rolling: libxslt 1.1.45-2 ยท MIT
- fedora 43: libxslt 1.1.43-5.fc43 ยท MIT
- fedora 43: libxslt 1.1.43-5.fc43 ยท MIT
- fedora 44: libxslt 1.1.43-6.fc44 ยท MIT
- fedora 44: libxslt 1.1.43-6.fc44 ยท MIT
- nixos 26.05: libxslt 1.1.45
- nixpkgs unstable: libxslt 1.1.45
- opensuse-leap 16.0: libxslt-tools 1.1.43-160000.4.1 ยท GPL-2.0-or-later AND MIT
- opensuse-leap 16.0: libxslt-tools 1.1.43-160000.4.1 ยท GPL-2.0-or-later AND MIT
- opensuse-leap 16.0: libxslt-tools 1.1.43-160000.4.1 ยท GPL-2.0-or-later AND MIT
- opensuse-leap 16.0: libxslt-tools 1.1.43-160000.4.1 ยท GPL-2.0-or-later AND MIT
- ubuntu questing: xsltproc 1.1.43-0.1
- ubuntu resolute: xsltproc 1.1.45-0.1
- ubuntu stonking: xsltproc 1.1.45-0.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms