XSLTPROC(1)

๐Ÿ“ฆ
version 1.1.45 ยท 5 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

๐Ÿ’– 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 in SGML_CATALOG_FILES to resolve the location of external entities. By default, xsltproc looks for the catalog specified in XML_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 before libxslt(3) concludes it's in an infinite loop. The default is 3000. (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 is 15000.
  • --huge โ€” Relax hardcoded limits of the XML parser by setting the XML_PARSE_HUGE parser 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.
  • -o or --output FILE | 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 directory will 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 of 32. If the value being passed is a string, you can use --stringparam instead, 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.
  • --profile or --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 transformation 20 times. 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.
  • -v or --verbose โ€” Output each step taken by xsltproc in processing the stylesheet and the document.
  • -V or --version โ€” Show the version of libxml(3) and libxslt(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 the SGML_CATALOG_FILES environment variable to a list of catalogs. An empty one should deactivate loading the default /etc/sgml/catalog catalog.
  • 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 the XML_CATALOG_FILES environment variable to a list of catalogs. An empty one should deactivate loading the default /etc/xml/catalog catalog.

(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:

  1. 0 โ€” No error (normal operation)
  2. 1 โ€” No argument
  3. 2 โ€” Too many parameters
  4. 3 โ€” Unknown option
  5. 4 โ€” Failed to parse the stylesheet
  6. 5 โ€” Error in the stylesheet
  7. 6 โ€” Error in one of the documents
  8. 7 โ€” Unsupported xsl:output method
  9. 8 โ€” String parameter contains both quote and double-quotes
  10. 9 โ€” Internal processing error
  11. 10 โ€” Processing was stopped by a terminating message
  12. 11 โ€” Could not write the result to the output file
number 8 is SO specific and honestly? it has trauma. we can tell. ๐Ÿ˜ญ

โญ SEE ALSO โญ

libxml(3), libxslt(3)

More information can be found at


๐ŸŒท AUTHOR ๐ŸŒท

John Fleck <jfleck@inkstain.net>

  • Author.

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 ๐Ÿ’‹โœจ