xml-pyx
Convert XML to Python code
TLDR
Convert an XML document to PYX format
Convert an XML document from stdin to PYX format
Display help
SYNOPSIS
xmlpyx [options] stylesheet.xml [input.xml ...]
PARAMETERS
-h, --help
Show help message and exit
-v, --version
Print version information
-o FILE, --output=FILE
Set output file (default: stylesheet name with .ps extension)
--dump-macros
Dump defined macros for debugging
--traceback
Print full Python traceback on errors
--no-process-includes
Disable processing of XInclude directives
DESCRIPTION
xmlpyx is a command-line tool from the PyX package, a Python library for generating high-quality PostScript, PDF, and SVG graphics. It processes XML input files using stylesheets written in PyX syntax, allowing embedded PyX code to generate vector graphics from structured XML data.
This enables declarative creation of diagrams, plots, and illustrations within XML documents. Stylesheets define PyX macros that transform XML elements into graphical output. Ideal for technical documentation, scientific publications, or automated report generation where XML serves as a data format and PyX handles rendering.
Output defaults to PostScript (.ps), with options for other formats via PyX capabilities. Requires PyX installed (pip install pyx or system package). Processes stdin if no input files specified.
CAVEATS
Requires PyX library; XML must be well-formed. Limited to PyX-supported output formats. No built-in validation; errors in PyX code cause runtime failures.
Deprecated in favor of modern tools like lxml + custom scripts.
EXAMPLES
Basic usage:
xmlpyx style.xml data.xml
Multiple inputs:
xmlpyx style.xml file1.xml file2.xml
INSTALLATION
Install via apt install python3-pyx or pip install pyx. Ensure TeX fonts for best rendering.
HISTORY
Introduced with PyX 0.10 (2004); maintained through PyX 0.15 (2018). Developed by Jörg Lehmann and contributors for integrating PyX with XML workflows in scientific computing.


