|
1 <stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:set="http://exslt.org/sets"> |
|
2 <output method="text"/> |
|
3 <key name="name" match="component|collection|block|subblock|layer" use="@name"/> |
|
4 |
|
5 <template match="/*" priority="-1"> |
|
6 ERROR: Invalid root element: <value-of select="name()"/> |
|
7 </template> |
|
8 |
|
9 <template match="*" priority="-5"> |
|
10 ERROR: Invalid element: <value-of select="name()"/> |
|
11 </template> |
|
12 |
|
13 |
|
14 <template match="component/Build"/> <!-- for depmodel --> |
|
15 |
|
16 <template match="@*" priority="-5"> |
|
17 NOTE: unexpected attribute "<value-of select="name()"/>" on <<value-of select="name(..)"/>></template> |
|
18 |
|
19 |
|
20 <template match="text()"> |
|
21 <if test="normalize-space(.)!=''"> |
|
22 ERROR: unexepected text: <value-of select="."/></if> |
|
23 </template> |
|
24 |
|
25 |
|
26 <template match="/SystemDefinition"> |
|
27 <if test="not(@name)"> |
|
28 Note: missing System Definition name</if> |
|
29 <for-each select="systemModel//*[@name]"> |
|
30 <if test="count(key('name',@name)) > 1"> |
|
31 ERROR: duplicate name for <value-of select="name()"/> "<value-of select="@name"/>" (<value-of select="count(key('name',@name))"/>) <apply-templates mode="location" select=".."/></if> |
|
32 </for-each> |
|
33 <apply-templates select="@schema | node()"/> |
|
34 <call-template name="extra-atts"/> |
|
35 <call-template name="extra-atts"><with-param name="item">collection</with-param></call-template> |
|
36 <call-template name="extra-atts"><with-param name="item">subblock</with-param></call-template> |
|
37 <call-template name="extra-atts"><with-param name="item">block</with-param></call-template> |
|
38 <call-template name="extra-atts"><with-param name="item">layer</with-param></call-template> |
|
39 <variable name="levels"> |
|
40 <for-each select="set:distinct(//@level)"> |
|
41 <value-of select="concat(.,' ')"/> |
|
42 </for-each> |
|
43 </variable> |
|
44 <if test="$levels!=''"> |
|
45 Note: Level names used: <value-of select="normalize-space($levels)"/></if> |
|
46 </template> |
|
47 |
|
48 <template name="extra-atts"><param name="item">component</param> |
|
49 <variable name="atts"> |
|
50 <for-each select="//*[name()=$item]/@*"><variable name="n" select="name()"/> |
|
51 <if test="not(following::*[name()=$item]/@*[name()=$n])"> |
|
52 <apply-templates mode="extra" select="."/></if> |
|
53 </for-each> |
|
54 </variable> |
|
55 <if test="$atts!=''"> |
|
56 Note: Extra <value-of select="$item"/> attributes: <value-of select="normalize-space($atts)"/></if> |
|
57 </template> |
|
58 |
|
59 <template match="@*" mode="extra"> |
|
60 <value-of select="concat(name(), ' ')"/> |
|
61 </template> |
|
62 |
|
63 |
|
64 <template match="collection/@level | block/@level | block/@span | layer/@span| layer/@levels | block/@levels | @name |component/@filter |component/@contract |component/@deprecated |component/@class |component/@introduced |component/@plugin" mode="extra"/> |
|
65 |
|
66 |
|
67 <template match="/SystemDefinition/@schema"> |
|
68 <choose> |
|
69 <when test="starts-with(.,'2.')"/> |
|
70 <when test="starts-with(.,'1.')"> |
|
71 WARNING: 1.x syntax checking not fully supported</when> |
|
72 <otherwise> |
|
73 ERROR: unsupported syntax: <value-of select="."/></otherwise> |
|
74 </choose> |
|
75 </template> |
|
76 |
|
77 |
|
78 |
|
79 <template match="@level"> |
|
80 WARNING: invalid attribute "<value-of select="name()"/>" on <<value-of select="name(..)"/>></template> |
|
81 |
|
82 <template match="systemModel/layer|layer/block|block/subblock|layer/collection| block/collection| subblock/collection|collection/component"> |
|
83 <apply-templates select="@*|node()"/> |
|
84 </template> |
|
85 |
|
86 |
|
87 <template match="layer|block|subblock|collection|component" priority="-3"> |
|
88 ERROR: <<value-of select="name()"/> name="<value-of select="@name"/>"> cannot be a child of <<value-of select="name(..)"/>></template> |
|
89 |
|
90 |
|
91 |
|
92 <template match="block/@level"> |
|
93 <if test="not(contains(concat(' ',normalize-space(../../@levels), ' '),concat(' ',normalize-space(.), ' ')))"> |
|
94 ERROR: Invalid level name "<value-of select="."/>" on <value-of select="name(..)"/> "<value-of select="../@name"/>" (<value-of select="../../@levels"/>)</if> |
|
95 </template> |
|
96 |
|
97 <template match="collection/@level"> |
|
98 <choose> |
|
99 <when test="ancestor::block/@levels"> |
|
100 <if test="not(contains(concat(' ',normalize-space(ancestor::block/@levels), ' '),concat(' ',normalize-space(.), ' ')))"> |
|
101 ERROR: Invalid level name "<value-of select="."/>" on <value-of select="name(..)"/> "<value-of select="../@name"/>" (<value-of select="../../@levels"/>)</if> |
|
102 </when> |
|
103 <otherwise> |
|
104 <if test="not(contains(concat(' ',normalize-space(ancestor::layer/@levels), ' '),concat(' ',normalize-space(.), ' ')))"> |
|
105 ERROR: Invalid level name "<value-of select="."/>" on <value-of select="name(..)"/> "<value-of select="../@name"/>" (<value-of select="../../@levels"/>)</if> |
|
106 </otherwise> |
|
107 </choose> |
|
108 </template> |
|
109 |
|
110 |
|
111 |
|
112 <template match="component/@plugin"> |
|
113 <if test=".!='Y' and .!='N'"> |
|
114 WARNING: invalid <value-of select="name()"/> value "<value-of select="."/>" on <<value-of select="name(..)"/> name="<value-of select="../@name"/>"></if> |
|
115 </template> |
|
116 |
|
117 |
|
118 <template match="logicalset|logicalsubset|module|SystemBuild"> |
|
119 ERROR: using 1.x syntax element: <<value-of select="name()"/>></template> |
|
120 |
|
121 <template match="unit/@name | unit/@unitID"> |
|
122 <if test="not(starts-with(/SystemDefinition/@schema,'1.'))"> |
|
123 WARNING: using 1.x syntax attribute: <<value-of select="concat(name(..),' ',name())"/>="<value-of select="."/>"></if> |
|
124 </template> |
|
125 |
|
126 <template match="@name | layer/@levels |block/@levels | component/@class | component/@filter | component/@introduced | component/@deprecated | component/@contract"> <!-- validate elsewhere --> |
|
127 <if test=".=''"> |
|
128 ERROR: attribute "<value-of select="name()"/>" on <<value-of select="name(..)"/>> must not be empty</if> |
|
129 </template> |
|
130 |
|
131 <template match="systemModel"> |
|
132 <apply-templates select="@*|node()"/> |
|
133 </template> |
|
134 |
|
135 <template match="unit[starts-with(/SystemDefinition/@schema,'1.')]/@contract"/> |
|
136 |
|
137 |
|
138 <template match="unit/@mrp | unit/@bldFile"> |
|
139 <choose> |
|
140 <when test="starts-with(/SystemDefinition/@schema,'1.')"> |
|
141 <if test="contains(.,'/')"> |
|
142 WARINING: path separator must be "\" for <value-of select="name()"/>="<value-of select="."/>"</if> |
|
143 </when> |
|
144 <otherwise> |
|
145 <if test="contains(.,'\')"> |
|
146 WARINING: path separator must be "/" for <value-of select="name()"/>="<value-of select="."/>"</if> |
|
147 </otherwise> |
|
148 </choose> |
|
149 </template> |
|
150 |
|
151 |
|
152 <template match="unit/@version | unit/@priority | unit/@filter | unit/@root"/> <!-- handle later--> |
|
153 <template match="package/@* | prebuilt/@*"/> <!-- handle later--> |
|
154 |
|
155 <template match="unit|component/package|prebuilt"> |
|
156 <if test="*"> |
|
157 WARNING: <<value-of select="name()"/>> must be empty.</if> |
|
158 |
|
159 <if test="not(starts-with(/SystemDefinition/@schema,'1.'))"> |
|
160 <if test="count(../unit | ../package | ../prebuilt) != 1 and count(../*[@filter or @version]) != count(../*)"> |
|
161 ERROR: multiple units must have "version" or "filter" attributes (<value-of select="../@name"/>)</if> |
|
162 <if test="self::prebuilt or self::package"> |
|
163 ERROR: using 1.x syntax element: <<value-of select="name()"/>></if> |
|
164 </if> |
|
165 <apply-templates select="@*"/> |
|
166 </template> |
|
167 |
|
168 <template mode="location" match="*"> |
|
169 <for-each select="ancestor::*[(self::layer or self::block or self::subblock or self::collection) and @name]">[<value-of select="substring(name(),1,1)"/>] <value-of select="@name"/> |
|
170 <if test="position()=1"> / </if> |
|
171 </for-each> |
|
172 </template> |
|
173 </stylesheet> |