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:none
stroke:#000000
stroke-width:0.1

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?


Sam

Attachment: shape2svg.xslt
Description: application/xml

_______________________________________________
Dia-list mailing list
Dia-list@gnome.org
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://live.gnome.org/Dia/Faq
Main page at http://live.gnome.org/Dia

Reply via email to