This xslt will convert dia shapes to svg editable by inkscape.

xsltproc shape2svg.xslt firewall.shape > firewall.svg

(A lot of the .shape files are BAD svg subset, with the semi-colon
seperator missing in the style attributes sometimes).

The connection points are preserved in a "connections" layer, and the
textbox position is also preserved.
The width and height (which dia ingores) ARE used to set the document size.

The plan is to be able to convert inkscape back to shape files,
regenerating the connections etc (doing what we can about transforms
etc) so that I can use inkscape to create shapes.

The general problem is matching dia style assumptions to svg style
assumptions (i.e. whether or not a closed shape defaults to fill, or
not), but I've got that down to:


fill:default = fill:#ffffff
fill:foreground = fill:#000000
fill:background = fill:ffffff

A larger problem is to do with line-width and coordinate handling; it
seems like I need to divide the stroke-width by 10 when converting to
inkscape. An example is the Network/firewall.shape which has lines with
length 0.4 and stroke-width 1. dia renders that specific line with the
stroke-width 1/4 of the line length.

(from the shape file:
    <svg:line style="stroke:#FFFFFF; stroke-width:1" x1=".7" y1="1"
x2=".7" y2="1.4"/>)

Any comments?


Attachment: shape2svg.xslt
Description: application/xml

Dia-list mailing list
FAQ at
Main page at

Reply via email to