Conversion of UML diagrams to SVG
In the course of one of our projects, we had to convert UML
digrams to SVG.
The XSLT stylesheet we created for this purpose is available
under the terms of the MIT license
and can be used free of charge.
As its input, the stylesheet takes XMI documents containing
diagram information (conforming to the UML 2.0 Diagram Interchange
Standard). These documents can, for example, be produced with
Poseidon -
the default file format of Poseidon is a ZIP archive which
includes an XMI file.
To use the stylesheet, you need an XSLT processor (for example
Xalan-J).
If you use Xalan, you can perform the conversion with the
following command line:
java org.apache.xalan.xslt.Process -in document.xmi -xsl xmi2svg.xsl -out diagram.svg -param diagramName Classes
This converts the diagram named "Classes" contained in the file "document.xmi"
to the SVG graphic "diagram.svg".
At the moment, class, use case, activity and state diagrams are supported.
Other diagram types may be added in future versions. As an alternative, you
can take a look at the uml2svg project.
At the time of writing, it still has some conversion bugs, but it already
works with all diagram types.
Patches and feedback are welcome -
please send all enquiries to
Andreas Junghans.
Download
|