annotate gnv-artifacts/contrib/visualize-transitions.xsl @ 867:35c3e82f7eaa

Changed the default directory of the artifact database. gnv-artifacts/trunk@1006 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 27 Apr 2010 15:11:16 +0000
parents ad06ad5f99ea
children f953c9a559d8
rev   line source
866
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 <?xml version="1.0" encoding="UTF-8"?>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 <xsl:stylesheet
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 xmlns:xlink="http://www.w3.org/1999/xlink"
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5 version="1.0">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 <xsl:output method="text" encoding="UTF-8"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 <xsl:param name="base-dir">.</xsl:param>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 <xsl:template match="/">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 <xsl:text>digraph transition_model {&#xa;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 <xsl:apply-templates />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 <xsl:text>}&#xa;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 </xsl:template>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 <xsl:template match="artifact">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 <xsl:choose>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 <xsl:when test="@xlink:href != ''">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 <!-- handle external artifacts -->
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 <xsl:variable name="path">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 <xsl:call-template name="string-replace-all">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 <xsl:with-param name="text" select="@xlink:href" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 <xsl:with-param name="replace">${artifacts.config.dir}</xsl:with-param>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 <xsl:with-param name="by" select="$base-dir" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 </xsl:call-template>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 </xsl:variable>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 <xsl:for-each select="document($path)">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 <xsl:apply-templates select="/artifact"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 </xsl:for-each>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 </xsl:when>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 <xsl:otherwise>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 <!-- handle internal artifacts -->
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 <xsl:text>subgraph </xsl:text><xsl:value-of select="@name"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 <xsl:text> {&#xa;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 <xsl:text> label = "Artefakt: </xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 <xsl:value-of select="@name"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 <xsl:text>";&#xa;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39 <xsl:apply-templates mode="inside-artifact" select="./states/state"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 <xsl:apply-templates mode="inside-artifact" select="./states/transition"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 <xsl:text>}&#xa;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 </xsl:otherwise>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 </xsl:choose>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 </xsl:template>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 <xsl:template match="state" mode="inside-artifact">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 <xsl:text> </xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 <xsl:value-of select="@id"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 <xsl:text disable-output-escaping="yes"
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 > [ shape = "record" label=&lt;&lt;table border="0" cellborder="0" cellpadding="3"&gt;
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51 &lt;tr&gt;&lt;td align="center" colspan="2" bgcolor="black"&gt;&lt;font color="white"&gt;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 <xsl:value-of select="@id"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 <xsl:text disable-output-escaping="yes"
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 >&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 <xsl:apply-templates mode="inside-artifact" select="./inputvalues"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 <xsl:text disable-output-escaping="yes"
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 >&lt;/table&gt;&gt;]</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 <xsl:text>;&#xa;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 </xsl:template>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 <xsl:template match="inputvalue" mode="inside-artifact">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 <xsl:text disable-output-escaping="yes"
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 >&lt;tr&gt;&lt;td align="right"&gt;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 <xsl:value-of select="@name"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 <xsl:text disable-output-escaping="yes"
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 >&lt;/td&gt;&lt;td align="left"&gt;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 <xsl:value-of select="@type"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 <xsl:text disable-output-escaping="yes"
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 >&lt;/td&gt;&lt;/tr&gt;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 </xsl:template>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 <xsl:template match="transition" mode="inside-artifact">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 <xsl:text> </xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 <xsl:value-of select="from/@state"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 <xsl:text disable-output-escaping="yes"> -&gt; </xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 <xsl:value-of select="to/@state"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 <xsl:apply-templates mode="inside-artifact"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 <xsl:text>;&#xa;</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 </xsl:template>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 <xsl:template match="condition" mode="inside-artifact">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 <xsl:text> [ label="</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 <xsl:value-of select="@inputvalue"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 <xsl:text> </xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 <xsl:value-of select="@operator"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 <xsl:text> </xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 <xsl:value-of select="@value"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88 <xsl:text>" ]</xsl:text>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 </xsl:template>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 <xsl:template match="text()" mode="inside-artifact"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 <xsl:template match="text()"/>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 <xsl:template name="string-replace-all">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 <xsl:param name="text" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
96 <xsl:param name="replace" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 <xsl:param name="by" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 <xsl:choose>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 <xsl:when test="contains($text, $replace)">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100 <xsl:value-of select="substring-before($text,$replace)" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 <xsl:value-of select="$by" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 <xsl:call-template name="string-replace-all">
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 <xsl:with-param name="text"
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 select="substring-after($text,$replace)" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 <xsl:with-param name="replace" select="$replace" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 <xsl:with-param name="by" select="$by" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 </xsl:call-template>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 </xsl:when>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 <xsl:otherwise>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 <xsl:value-of select="$text" />
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111 </xsl:otherwise>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 </xsl:choose>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 </xsl:template>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 </xsl:stylesheet>
ad06ad5f99ea ISSUE262: Added XSL-Transformation for the Transitionsmodel
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116

http://dive4elements.wald.intevation.org