forked from roboticslibrary/rl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rlmdl2dot.xsl
54 lines (54 loc) · 2.33 KB
/
rlmdl2dot.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/rl/mdl/model|/rlmdl/model">
<xsl:text>digraph G {</xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>	</xsl:text>
<xsl:text>edge [ color = red, fontcolor = red ];</xsl:text>
<xsl:text>
</xsl:text>
<xsl:text>	</xsl:text>
<xsl:text>node [ color = red, fontcolor = red ];</xsl:text>
<xsl:text>
</xsl:text>
<xsl:for-each select="world">
<xsl:text>	</xsl:text>
<xsl:value-of select="concat('"', @id, '"')"/>
<xsl:text> [ color = darkviolet, fontcolor = darkviolet, shape = doubleoctagon ];</xsl:text>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:for-each select="frame">
<xsl:text>	</xsl:text>
<xsl:value-of select="concat('"', @id, '"')"/>
<xsl:text> [ color = black, fontcolor = black, shape = box ];</xsl:text>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:for-each select="body">
<xsl:text>	</xsl:text>
<xsl:value-of select="concat('"', @id, '"')"/>
<xsl:text> [ color = blue, fillcolor = red, fontcolor = blue, shape = octagon ];</xsl:text>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:for-each select="fixed">
<xsl:text>	</xsl:text>
<xsl:value-of select="concat('"', frame/a/@idref, '"')"/>
<xsl:text disable-output-escaping="yes"> -> </xsl:text>
<xsl:value-of select="concat('"', frame/b/@idref, '"')"/>
<xsl:text> [ </xsl:text>
<xsl:value-of select="concat('label = "', @id, '"')"/>
<xsl:text>, color = black, fontcolor = black ];</xsl:text>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:for-each select="cylindrical|helical|prismatic|revolute|spherical">
<xsl:text>	</xsl:text>
<xsl:value-of select="concat('"', frame/a/@idref, '"')"/>
<xsl:text disable-output-escaping="yes"> -> </xsl:text>
<xsl:value-of select="concat('"', frame/b/@idref, '"')"/>
<xsl:text> [ </xsl:text>
<xsl:value-of select="concat('label = "', @id, '"')"/>
<xsl:text>, color = forestgreen, fontcolor = forestgreen ];</xsl:text>
<xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:text>}</xsl:text>
</xsl:template>
</xsl:stylesheet>