|
1 <stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" |
|
2 exclude-result-prefixes="set exslt" |
|
3 xmlns:exslt="http://exslt.org/common" |
|
4 xmlns:set="http://exslt.org/sets"> |
|
5 <output method="text"/> |
|
6 <!-- |
|
7 tech_domain,layer,package,collection,component,old_layer,old_package<value-of select="$atts"/> |
|
8 Foundation Tech Domain,Foundation layer,Foundation package,Foundation collection,Component,Layer,Domain,Subsystem<value-of select="$atts"/> |
|
9 --> |
|
10 <variable name="default-atts">layer,package,collection,component</variable> |
|
11 <param name="atts"> |
|
12 <value-of select="$default-atts"/> |
|
13 <call-template name="all-atts"/> |
|
14 </param> |
|
15 <param name="labels"><if test="starts-with($atts,$default-atts)">Module,Layer,Package,Collection,Component</if></param> |
|
16 |
|
17 |
|
18 <key name="tech" match="group[@type='color']/cbox" use="@style-id"/> |
|
19 |
|
20 |
|
21 <template name="all-atts"> |
|
22 <variable name="all"> |
|
23 <apply-templates select="//layer/@* | //package/@*| //collection/@*| //component/@*" mode="atts"> |
|
24 <sort select="name()"/> |
|
25 </apply-templates> |
|
26 </variable> |
|
27 <for-each select="set:distinct(exslt:node-set($all)/*/@v)"> |
|
28 <sort select="."/>,<value-of select="."/> |
|
29 </for-each> |
|
30 </template> |
|
31 |
|
32 <template name="labels"><param name="at" select="$atts"/><param name="label" select="$labels"/> |
|
33 <variable name="At"> |
|
34 <choose> |
|
35 <when test="contains($at,',')"><value-of select="substring-before($at,',')"/></when> |
|
36 <otherwise><value-of select="$at"/></otherwise> |
|
37 </choose> |
|
38 </variable> |
|
39 <variable name="Lab"> |
|
40 <choose> |
|
41 <when test="contains($label,',')"><value-of select="substring-before($label,',')"/></when> |
|
42 <otherwise><value-of select="$label"/></otherwise> |
|
43 </choose> |
|
44 </variable> |
|
45 <choose> |
|
46 <when test="not(contains($at,',')) and $Lab!=''"><value-of select="$Lab"/></when> <!-- at end of list, use label --> |
|
47 <when test="not(contains($at,','))"><value-of select="$At"/></when><!-- at end of list--> |
|
48 <when test="$Lab!=''"> |
|
49 <value-of select="$Lab"/><text>,</text> |
|
50 <call-template name="labels"> |
|
51 <with-param name="at" select="substring-after($at,',')"/> |
|
52 <with-param name="label" select="substring-after($label,',')"/> |
|
53 </call-template> |
|
54 </when> |
|
55 <otherwise> |
|
56 <value-of select="$At"/><text>,</text> |
|
57 <call-template name="labels"> |
|
58 <with-param name="at" select="substring-after($at,',')"/> |
|
59 <with-param name="label" select="substring-after($label,',')"/> |
|
60 </call-template> |
|
61 </otherwise> |
|
62 </choose> |
|
63 </template> |
|
64 |
|
65 <template match="/SystemDefinition"><call-template name="labels"/> |
|
66 <text>
</text> |
|
67 <apply-templates select="systemModel/layer//component"/> |
|
68 </template> |
|
69 |
|
70 <template match="component"> |
|
71 <call-template name="others"/> |
|
72 <text>
</text> |
|
73 </template> |
|
74 |
|
75 <template match="*" mode="name"><apply-templates select="@id" mode="name"/></template> |
|
76 <!-- <template match="@*" mode="name">"<value-of select="."/>"</template> |
|
77 <template match="@*[contains(.,',')]" mode="name" priority="9">"<value-of select="."/>"</template> |
|
78 --> |
|
79 <template match="@*" mode="name" priority="7">"<value-of select="."/>"</template> |
|
80 <template match="@*[not(contains(.,','))]" mode="name" priority="8"><value-of select="."/></template> |
|
81 |
|
82 <template match="@*" mode="atts" priority="-1"> |
|
83 <element name="a"><attribute name="v"><value-of select="name()"/></attribute></element> |
|
84 </template> |
|
85 |
|
86 <!--template match="@name|@old_layer|@old_package|@id|@abbrev|@plugin|@introduced|@span|@levels|@level|@tech_domain|@platform_optional|@reason" mode="atts"/--> |
|
87 <template match="@name|@abbrev/@id" mode="atts"/> |
|
88 |
|
89 <template name="others"><param name="at" select="$atts"/> |
|
90 <variable name="a"> |
|
91 <choose> |
|
92 <when test="contains($at,',')"><value-of select="substring-before($at,',')"/></when> |
|
93 <otherwise><value-of select="$at"/></otherwise> |
|
94 </choose> |
|
95 </variable> |
|
96 <choose> |
|
97 <when test="$a='module' and @module"><apply-templates select="@module" mode="name"/></when> |
|
98 <when test="$a='module'"><apply-templates select="ancestor::package[1]" mode="name"/></when> |
|
99 <when test="$a='layer'"><apply-templates select="ancestor::layer" mode="name"/></when> |
|
100 <when test="$a='package'"><apply-templates select="ancestor::package" mode="name"/></when> |
|
101 <when test="$a='subpackage'"><apply-templates select="ancestor::package/package" mode="name"/></when> |
|
102 <when test="$a='collection'"><apply-templates select="ancestor::collection" mode="name"/></when> |
|
103 <when test="$a='component'"><apply-templates select="." mode="name"/></when> |
|
104 <when test="$a='old_component'"><if test="@old_component!=@name"><apply-templates select="@old_component" mode="name"/></if></when> |
|
105 <when test="$a='tech_domain' or $a='tech-domain'">"<value-of select="ancestor::package/@tech-domain"/>"</when> |
|
106 <when test="$a='level'"><value-of select="ancestor-or-self::collection/@level"/></when> |
|
107 <when test="$a='levels'">"<value-of select="ancestor-or-self::package/@levels"/>"</when> |
|
108 <when test="$a='layer-levels'">"<value-of select="ancestor-or-self::layer/@levels"/>"</when> |
|
109 <when test="$a='package-level'"><value-of select="ancestor-or-self::package/@level"/></when> |
|
110 <when test="contains(concat($a,'
'),'-name
')"><apply-templates mode="name" select="ancestor-or-self::*[name()=substring-before($a,'-')]/@name"/></when> |
|
111 <when test="@*[name()=$a]"><apply-templates select="@*[name()=$a]" mode="name"/></when> |
|
112 <when test="ancestor::collection/@*[name()=$a]"><apply-templates select="ancestor::collection/@*[name()=$a]" mode="name"/></when> |
|
113 <when test="ancestor::package/@*[name()=$a]"><apply-templates select="ancestor::package/@*[name()=$a]" mode="name"/></when> |
|
114 <otherwise><apply-templates select="ancestor::layer/@*[name()=$a]" mode="name"/></otherwise> |
|
115 </choose> |
|
116 <if test="contains($at,',')"> |
|
117 <text>,</text> |
|
118 <call-template name="others"> |
|
119 <with-param name="at" select="substring-after($at,',')"/> |
|
120 </call-template> |
|
121 </if> |
|
122 </template> |
|
123 |
|
124 </stylesheet> |