wiki:schematic

Schematic (originally known as process_includes) can be found at tools/schematic/.

Features

This python-based tool uses the lxml module, which conveniently wraps libxml2 and libxslt2 functions and provides good general XML and XSLT processing abilities.

The script provides a number of functions:

  • Include / Import processing: include statements, referencing local or remote files, are dereferenced and included verbatim. duplicate imports can optionally be ignored (as is desirable in Theon schema terms)
  • XSLT Transformation: Specified XSL transform be applied to the included file
  • XSLT Augmentation: using an function namespace, custom python functions can be called from within the XSLT.

The tool has its own manual page which can be found on any machine on which schematic is installed.

Usage

In its current revision the tool can be used in the following manner:

$ schematic.py --help

schematic.py -- (Theon) Schema Includer -- Revision: 4444 
===============================================================================
Synopsis:
    Recusively process the include elements in an XML Schema Document.
    Produce a single file that contains all included content.
    Writes to specified input / output files, or stdin / stdout.
Usage:
    python schematic.py [options] [ infile [ outfile ] ]
Options:
    -h, --help              Display this help message.
    -q, --quiet             Do not announce each new included / ignored file.
    -f, --force             Force: if outfile exists, overwrite without asking.
    -s, --search <path[:p]> Search path for schemas as colon separated list.
    -u, --unique            Ensure includes are only processed once (DEFAULT)
    -U, --duplicates        Allow includes to be processed more than once 
    -t, --transform <xslt>  Apply an XSLT transform to the retrieved output
    -e, --extend <ns:path>  Extend transform [-t] using given namespace prefix
                            (ns) and python source.  One file per flag.
        --validate          Require schema to be validated before processing.
    -T, --tree              Don't output XML; display a tree.
    -X, --XPath "<expr>"    resolve an XPath expression.
  • TODO: potentially implement change-tracking functionality here..?
Last modified 10 years ago Last modified on Apr 2, 2010, 5:51:25 PM