-
Notifications
You must be signed in to change notification settings - Fork 0
/
xml2dot.xsl
49 lines (42 loc) · 1.12 KB
/
xml2dot.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
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="Something">
<Root-Element>
digraph g {
graph [
rankdir = "LR"
];
node [
fontsize = "12"
fontname = "Courier"
shape = "ellipse"
];
edge[];
<xsl:apply-templates select="Classes"/>
}
</Root-Element>
</xsl:template>
<xsl:template match="Classes">
<xsl:apply-templates select="Class" mode="node"/>
</xsl:template>
<xsl:template match="Class" mode="node">
<xsl:text>"</xsl:text><xsl:value-of select="@name"/> <xsl:text>" [
label="</xsl:text><xsl:value-of
select="@name"/>
<xsl:text>"
shape="record"
color=".99 0.0 .9"
style=filled
];
</xsl:text>
<xsl:apply-templates select="DependsUpon"/>
</xsl:template>
<xsl:template match="Class" mode="edge">
<xsl:text>"</xsl:text><xsl:value-of select="../../@name"/> <xsl:text>" -> "</xsl:text><xsl:value-of select="."/><xsl:text>"
</xsl:text>
</xsl:template>
<xsl:template match="DependsUpon">
<xsl:apply-templates select="Class" mode="edge"/>
</xsl:template>
</xsl:stylesheet>