xslt-dependency-graph

Overview

xslt-dependency-graph calculates the dependencies of a set of XSLT 2.0 stylesheets. (A stylesheet depends on another when it imports or includes that other stylesheet.)

A DOT-language graph is produced, representing the stylesheets and their dependencies. This graph can be given to one of the graph layout programs of the Graphviz suite to visualize the dependency structure of a project with multiple XSLT stylesheets.

Example output, formatted with "dot"

Requirements

An XSLT 2.0 processor.

This tool was designed with XSLT 2.0 stylesheets in mind. It might not work on stylesheets written in earlier versions of XSLT. It's a hack, so it probably misses some corner cases.

An accompanying shell script is included to drive an XSLT 2.0 processor, providing a somewhat reasonable command-line interface. The Saxon-B processor is assumed to be installed, available with the command-line tool saxonb-xslt (as it is under Debian). The script could be easily adapted to other scripting languages—for non-Unix platforms—or to use another XSLT 2.0 processor.

Usage

./depgraph STYLESHEET [STYLESHEET ...]

Each named stylesheet will be loaded and its dependencies traversed. The resulting DOT graph, which is printed on standard output, will include each named stylesheet, as well as any stylesheets that they ultimately depend on.

Pipe the output to dot or one of the other Graphviz programs to generate an image representing the graph:

./depgraph STYLESHEET [STYLESHEET ...] | dot -Tpng > dep-graph.png

For best visual results, it helps if all the stylesheets are in the same directory, or closely spaced together under different subdirectories of the same directory. If this doesn't fit your project, you can customize how nodes are labelled within depgraph.xsl.

Download

The most recent release is 0.1, released 2009-09-11. It has no external dependencies.

I sign all my software with OpenPGP, key ID 0xE979FFBEA002D20F, fingerprint A87B 1C5A 28C4 03BD 54BA CE8E E979 FFBE A002 D20F. (Releases were previously signed with 0x80555CED7394F948, which has been revoked, but not compromised. See my OpenPGP transition statement.)

Copying

This software is licensed under permissive, BSD-like terms, copied from the ISC license:

Copyright (c) 2009, Jean-Paul Guy Larocque

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Contact

I'm reachable via e-mail for feedback, questions, help requests, and bug reports: jpl-software at thoughtcrime.us

— J.P. Larocque