|
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
|
2 <!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 All rights reserved. |
|
4 This component and the accompanying materials are made available |
|
5 under the terms of the License "Eclipse Public License v1.0" |
|
6 which accompanies this distribution, and is available |
|
7 at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
|
9 Initial Contributors: |
|
10 Nokia Corporation - initial contribution. |
|
11 Contributors: |
|
12 Description: |
|
13 Module containing the validation logic for system definition 3.0.0 syntax |
|
14 --> |
|
15 <xsl:key name="named" match="*[ancestor::systemModel]" use="@name"/> |
|
16 <xsl:param name="Filename"/> |
|
17 <xsl:variable name="info" select="document(/model//info[@type='extra']/@href,/model)//c"/> |
|
18 |
|
19 <xsl:variable name="all-ids"> |
|
20 <xsl:apply-templates select="document(/model/sysdef/@href)| SystemDefinition" mode="ids"/> |
|
21 </xsl:variable> |
|
22 |
|
23 |
|
24 <xsl:template match="/model" priority="-1"> |
|
25 <xsl:apply-templates select="." mode="check"/> |
|
26 </xsl:template> |
|
27 |
|
28 <xsl:template match="/model" mode="check"> |
|
29 <xsl:for-each select="sysdef"> |
|
30 <xsl:apply-templates select="document (@href,. )/*"> |
|
31 <xsl:with-param name="filename"> |
|
32 <xsl:choose> |
|
33 <xsl:when test="starts-with(current()/@href,current()/@rootpath)"> |
|
34 <xsl:value-of select="substring-after(current()/@href,current()/@rootpath)"/> |
|
35 </xsl:when> |
|
36 <xsl:otherwise> |
|
37 <xsl:value-of select="@href"/> |
|
38 </xsl:otherwise> |
|
39 </xsl:choose> |
|
40 </xsl:with-param> |
|
41 </xsl:apply-templates> |
|
42 </xsl:for-each> |
|
43 |
|
44 |
|
45 |
|
46 <xsl:apply-templates mode="x-check" select="document (//info[@type='vp']/@href)/*"> |
|
47 <xsl:with-param name="sysdef" select="document (sysdef/@href)/*"/> |
|
48 </xsl:apply-templates> |
|
49 |
|
50 <xsl:apply-templates mode="x-check" select="document (//info[@type='build']/@href)/*"> |
|
51 <xsl:with-param name="sysdef" select="document (sysdef/@href)/*"/> |
|
52 </xsl:apply-templates> |
|
53 </xsl:template> |
|
54 |
|
55 <xsl:template match="/SystemDefinition[@schema='3.0.0']" mode="ids"> |
|
56 <xsl:for-each select="//*[@id and not(@href)]"><xsl:value-of select="concat(' ',@id,' ')"/></xsl:for-each> |
|
57 <xsl:apply-templates select="document(//layer/@href | //package/@href | //collection/@href | //component/@href,.)/*" mode="ids"/> |
|
58 </xsl:template> |
|
59 |
|
60 <xsl:template match="/SystemDefinition[@schema='3.0.0' and systemModel]" priority="2"> |
|
61 <xsl:param name="filename" select="$Filename"/> |
|
62 <xsl:call-template name="Section"> |
|
63 <xsl:with-param name="text">System Definition: <xsl:value-of select="*/@name"/></xsl:with-param> |
|
64 <xsl:with-param name="sub"><xsl:value-of select="(string-length($all-ids) - string-length(translate($all-ids,' ',''))) div 2 "/> items</xsl:with-param> |
|
65 </xsl:call-template> |
|
66 <xsl:apply-templates select="*"> |
|
67 <xsl:with-param name="filename" select="$filename"/> |
|
68 </xsl:apply-templates> |
|
69 </xsl:template> |
|
70 |
|
71 <xsl:template match="/SystemDefinition[@schema='3.0.0'] | systemModel"> |
|
72 <xsl:param name="filename" select="$Filename"/> |
|
73 |
|
74 <xsl:if test="//unit"> |
|
75 <xsl:call-template name="Section"> |
|
76 <xsl:with-param name="text"><xsl:value-of select="translate(substring(name(*),1,1),'clp','CLP')"/><xsl:value-of select="substring(name(*),2)"/> Definition: <xsl:value-of select="*/@name"/></xsl:with-param> |
|
77 <xsl:with-param name="sub"><xsl:value-of select="count(//unit)"/> unit<xsl:if test="count(//unit)!=1">s</xsl:if></xsl:with-param> |
|
78 </xsl:call-template> |
|
79 </xsl:if> |
|
80 <xsl:if test="self::systemModel and not(@name)"> |
|
81 <xsl:call-template name="Error"><xsl:with-param name="text">systemModel element should have a name</xsl:with-param></xsl:call-template> |
|
82 </xsl:if> |
|
83 <xsl:apply-templates select="*"> |
|
84 <xsl:with-param name="filename" select="$filename"/> |
|
85 </xsl:apply-templates> |
|
86 </xsl:template> |
|
87 |
|
88 |
|
89 <xsl:template match="@*" mode="valid"> |
|
90 <xsl:call-template name="Error"><xsl:with-param name="text">Attribute <xsl:value-of select="name()"/>="<xsl:value-of select="."/>" is not valid for <xsl:value-of select="name(..)"/></xsl:with-param></xsl:call-template> |
|
91 </xsl:template> |
|
92 |
|
93 <xsl:template match="@before|@id|package/@span|collection/@level|package/@level|package/@levels|layer/@levels" mode="valid"/> <!-- really should check syntax --> |
|
94 |
|
95 <xsl:template match="@name|@href|@filter" mode="valid"/> |
|
96 |
|
97 <xsl:template match="component/@introduced|component/@deprecated" mode="valid"/> |
|
98 |
|
99 |
|
100 <xsl:template name="validate-class"> |
|
101 <ok>plugin</ok> |
|
102 <ok>doc</ok> |
|
103 <ok>tool</ok> |
|
104 <ok>config</ok> |
|
105 <ok>api</ok> |
|
106 <w d="deprecated">test</w> |
|
107 </xsl:template> |
|
108 |
|
109 <xsl:template name="validate-purpose"> |
|
110 <ok>mandatory</ok> |
|
111 <ok>optional</ok> |
|
112 <ok>development</ok> |
|
113 </xsl:template> |
|
114 <xsl:template name="validate-target"> |
|
115 <ok>other</ok> |
|
116 <ok>desktop</ok> |
|
117 <ok>device</ok> |
|
118 </xsl:template> |
|
119 |
|
120 |
|
121 <xsl:template name="validate-tech-domain"> |
|
122 <ok>lo</ok> |
|
123 <ok>hb</ok> |
|
124 <ok>mm</ok> |
|
125 <ok>ma</ok> |
|
126 <ok>pr</ok> |
|
127 <ok>vc</ok> |
|
128 <ok>se</ok> |
|
129 <ok>ui</ok> |
|
130 <ok>dc</ok> |
|
131 <ok>de</ok> |
|
132 <ok>dm</ok> |
|
133 <ok>rt</ok> |
|
134 <ok>to</ok> |
|
135 <w d="Non-standard">ocp</w> |
|
136 </xsl:template> |
|
137 |
|
138 <xsl:template match="component/@class" mode="valid"> |
|
139 <xsl:call-template name="checklist"> |
|
140 <xsl:with-param name="list" select="normalize-space(.)"/> |
|
141 <xsl:with-param name="values" select="document('')/*/xsl:template[@name=concat('validate-',name(current()))]/*"/> |
|
142 </xsl:call-template> |
|
143 </xsl:template> |
|
144 |
|
145 <xsl:template name="checklist"> |
|
146 <xsl:param name="list" select="."/><xsl:param name="values"/><xsl:param name="sep" select="' '"/> |
|
147 <xsl:variable name="item"> |
|
148 <xsl:choose> |
|
149 <xsl:when test="contains($list,$sep)"><xsl:value-of select="substring-before($list,$sep)"/></xsl:when> |
|
150 <xsl:otherwise><xsl:value-of select="$list"/></xsl:otherwise> |
|
151 </xsl:choose> |
|
152 </xsl:variable> |
|
153 <xsl:variable name="v" select="$values[.=$item]"/> |
|
154 <xsl:choose> |
|
155 <xsl:when test="not($v)"> |
|
156 <xsl:call-template name="Error"><xsl:with-param name="text">Illegal <xsl:value-of select="name()"/> value <xsl:value-of select="name()"/>="<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template> |
|
157 </xsl:when> |
|
158 <xsl:when test="name($v)='ok'"/> |
|
159 <xsl:when test="name($v)='w'"> |
|
160 <xsl:call-template name="Warning"><xsl:with-param name="text"><xsl:value-of select="$v/@d"/> value in <xsl:value-of select="name()"/>="<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template> |
|
161 </xsl:when> |
|
162 </xsl:choose> |
|
163 <xsl:if test="contains($list,$sep)"> |
|
164 <xsl:call-template name="checklist"> |
|
165 <xsl:with-param name="list" select="substring-after($list,$sep)"/> |
|
166 <xsl:with-param name="values" select="$values"/> |
|
167 <xsl:with-param name="sep" select="$sep"/> |
|
168 </xsl:call-template> |
|
169 </xsl:if> |
|
170 </xsl:template> |
|
171 |
|
172 |
|
173 <xsl:template match="package/@tech-domain|component/@purpose|component/@target" mode="valid"> |
|
174 <xsl:variable name="v" select="document('')/*/xsl:template[@name=concat('validate-',name(current()))]/*[.=current()]"/> |
|
175 <xsl:choose> |
|
176 <xsl:when test="not($v)"> |
|
177 <xsl:call-template name="Error"><xsl:with-param name="text">Illegal <xsl:value-of select="name()"/> value <xsl:value-of select="name()"/>="<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template> |
|
178 </xsl:when> |
|
179 <xsl:when test="name($v)='ok'"/> |
|
180 <xsl:when test="name($v)='w'"> |
|
181 <xsl:call-template name="Warning"><xsl:with-param name="text"><xsl:value-of select="$v/@d"/> value in <xsl:value-of select="name()"/>="<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template> |
|
182 </xsl:when> |
|
183 </xsl:choose> |
|
184 </xsl:template> |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 <xsl:template match="*" priority="-2"> |
|
191 <xsl:call-template name="Error"><xsl:with-param name="text">Element "<xsl:value-of select="name()"/>" is not valid in the context of "<xsl:value-of select="name(..)"/>"</xsl:with-param></xsl:call-template> |
|
192 </xsl:template> |
|
193 |
|
194 <xsl:template match="component[not(parent::collection)] | collection[not(parent::package)] | package[not(parent::package or parent::layer or (parent::SystemDefinition and count(../*)=1))] | layer[not(parent::systemModel)] " priority="3"> |
|
195 <xsl:call-template name="Error"><xsl:with-param name="text"><xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" has invalid parent <xsl:value-of select="name(..)"/> "<xsl:value-of select="../@id"/>"</xsl:with-param></xsl:call-template> |
|
196 </xsl:template> |
|
197 |
|
198 <xsl:template match="layer | package | collection | component"> |
|
199 <xsl:param name="filename"/> |
|
200 |
|
201 <xsl:apply-templates select="@*" mode="valid"/> |
|
202 <xsl:apply-templates select="@id"/> |
|
203 <xsl:if test="self::component"> |
|
204 <xsl:choose> |
|
205 <xsl:when test="count(*[not(@version)]) > 1 and @filter='s60'"> |
|
206 <xsl:call-template name="Warning"><xsl:with-param name="text">S60 Component "<xsl:value-of select="@id"/>" has <xsl:value-of select="count(*)"/> children.</xsl:with-param></xsl:call-template> |
|
207 </xsl:when> |
|
208 <xsl:when test="count(*[not(@version)]) > 1"> |
|
209 <xsl:call-template name="Error"><xsl:with-param name="text">Component "<xsl:value-of select="@id"/>" has <xsl:value-of select="count(*)"/> children.</xsl:with-param></xsl:call-template> |
|
210 </xsl:when> |
|
211 </xsl:choose> |
|
212 <xsl:choose> |
|
213 <xsl:when test="unit"/> |
|
214 <xsl:when test="contains(comment(),'PLACEHOLDER=')"/> |
|
215 <xsl:when test="comment()"> |
|
216 <xsl:call-template name="Note"><xsl:with-param name="text">Component "<xsl:value-of select="@name"/>" is empty.</xsl:with-param></xsl:call-template> |
|
217 </xsl:when> |
|
218 <xsl:when test="not(comment())"> |
|
219 <xsl:call-template name="Warning"><xsl:with-param name="text">Component "<xsl:value-of select="@name"/>" is empty and has no comment</xsl:with-param></xsl:call-template> |
|
220 </xsl:when> |
|
221 </xsl:choose> |
|
222 </xsl:if> |
|
223 <xsl:if test="@href"> |
|
224 <xsl:variable name="child" select="document(@href,.)/SystemDefinition"/> |
|
225 <xsl:if test="@id!=$child/@id"> |
|
226 <xsl:call-template name="Error"><xsl:with-param name="text"><xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" must match ID in linked file "<xsl:value-of select="@href"/>"</xsl:with-param></xsl:call-template> |
|
227 </xsl:if> |
|
228 <xsl:if test="$child/@href"> |
|
229 <xsl:call-template name="Error"><xsl:with-param name="text">linked <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" cannot be a link</xsl:with-param></xsl:call-template> |
|
230 </xsl:if> |
|
231 <xsl:for-each select="@*[name()!='id']"> |
|
232 <xsl:if test="$child/@*[name()=name(current())]"> |
|
233 <xsl:call-template name="Warning"><xsl:with-param name="text">linked <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" has duplicate attribute to linking document. Duplicate ignored.</xsl:with-param></xsl:call-template> |
|
234 </xsl:if> |
|
235 </xsl:for-each> |
|
236 <xsl:if test="*"> |
|
237 <xsl:call-template name="Error"><xsl:with-param name="text"><xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" cannot have both link and content. Content ignored.</xsl:with-param></xsl:call-template> |
|
238 </xsl:if> |
|
239 </xsl:if> |
|
240 <xsl:if test="@href and name()!=name(document(@href,.)/SystemDefinition/*)"> |
|
241 <xsl:call-template name="Error"><xsl:with-param name="text"><xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" must match item in linked file "<xsl:value-of select="@href"/>"</xsl:with-param></xsl:call-template> |
|
242 </xsl:if> |
|
243 <xsl:if test="not(@href)"> |
|
244 <xsl:apply-templates select="*"> |
|
245 <xsl:with-param name="filename" select="$filename"/> |
|
246 </xsl:apply-templates> |
|
247 </xsl:if> |
|
248 <xsl:if test="@href"> |
|
249 <xsl:apply-templates select="document(@href,.)/*"> |
|
250 <xsl:with-param name="filename"> |
|
251 <xsl:call-template name="normpath"> |
|
252 <xsl:with-param name="path"> |
|
253 <xsl:if test="not(starts-with(current()/@href,'/'))"> |
|
254 <xsl:call-template name="before"> |
|
255 <xsl:with-param name="text" select="$filename"/> |
|
256 </xsl:call-template> |
|
257 </xsl:if> |
|
258 <xsl:value-of select="current()/@href"/> |
|
259 </xsl:with-param> |
|
260 </xsl:call-template> |
|
261 </xsl:with-param> |
|
262 </xsl:apply-templates> |
|
263 </xsl:if> |
|
264 </xsl:template> |
|
265 |
|
266 |
|
267 <xsl:template match="unit"> <xsl:param name="filename"/> |
|
268 <xsl:apply-templates select="@mrp|@bldFile"> |
|
269 <xsl:with-param name="filename" select="$filename"/> |
|
270 </xsl:apply-templates> |
|
271 </xsl:template> |
|
272 |
|
273 |
|
274 <xsl:template match="@id" mode="path"> |
|
275 <xsl:choose> |
|
276 <xsl:when test="contains(.,':')"><xsl:value-of select="substring-after(.,':')"/></xsl:when> |
|
277 <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise> |
|
278 </xsl:choose> |
|
279 </xsl:template> |
|
280 |
|
281 |
|
282 <xsl:template match="@id"> |
|
283 <xsl:if test="contains(concat(' ',substring-after($all-ids,concat(' ',.,' '))),concat(' ',.,' '))"> |
|
284 <xsl:call-template name="Warning"><xsl:with-param name="text">Duplicate ID: <xsl:value-of select="name(..)"/> "<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template> |
|
285 </xsl:if> |
|
286 |
|
287 <xsl:if test="contains(.,':') and not(ancestor::*/namespace::*[name()=substring-before(current(),':')])"> |
|
288 <xsl:call-template name="Error"><xsl:with-param name="text">Undefined namespace for ID "<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template> |
|
289 </xsl:if> |
|
290 |
|
291 </xsl:template> |
|
292 |
|
293 |
|
294 <xsl:template match="@bldFile|@mrp"><xsl:param name="filename"/> |
|
295 |
|
296 <xsl:variable name="fullpath"><xsl:call-template name="normpath"> |
|
297 <xsl:with-param name="path"> |
|
298 <xsl:if test="not(starts-with(.,'/'))"> |
|
299 <xsl:call-template name="before"> |
|
300 <xsl:with-param name="text" select="$filename"/> |
|
301 </xsl:call-template> |
|
302 </xsl:if> |
|
303 <xsl:value-of select="."/> |
|
304 </xsl:with-param> |
|
305 </xsl:call-template> |
|
306 </xsl:variable> |
|
307 <xsl:variable name="path"> |
|
308 <xsl:choose> |
|
309 <xsl:when test="not(contains($filename,':'))">/<xsl:for-each select="ancestor::*/@id"><xsl:apply-templates mode="path" select="."/>/</xsl:for-each></xsl:when> |
|
310 <xsl:otherwise><xsl:for-each select="../../../@id|../../@id"><xsl:apply-templates mode="path" select="."/>/</xsl:for-each></xsl:otherwise> |
|
311 </xsl:choose> |
|
312 </xsl:variable> |
|
313 <xsl:variable name="segment"> |
|
314 <xsl:choose> |
|
315 <xsl:when test="ancestor::layer"> |
|
316 <xsl:value-of select="concat($fullpath,'/')"/> |
|
317 </xsl:when> |
|
318 <xsl:when test="ancestor::package"> |
|
319 <xsl:value-of select="concat('/',substring-after(substring-after($fullpath,'/'),'/'),'/')"/> |
|
320 </xsl:when> |
|
321 <xsl:when test="ancestor::collection"> |
|
322 <xsl:value-of select="concat('/',substring-after(substring-after(substring-after($fullpath,'/'),'/'),'/'),'/')"/> |
|
323 </xsl:when> |
|
324 <xsl:otherwise> |
|
325 <xsl:value-of select="concat('/',substring-after(substring-after(substring-after(substring-after($fullpath,'/'),'/'),'/'),'/'),'/')"/> |
|
326 </xsl:otherwise> |
|
327 </xsl:choose> |
|
328 </xsl:variable> |
|
329 <xsl:choose> |
|
330 <xsl:when test="contains($filename,':')"> |
|
331 <xsl:choose> |
|
332 <xsl:when test="not(starts-with(.,$path) or concat(.,'/')=$path)"> |
|
333 <xsl:call-template name="Note"><xsl:with-param name="text">Unexpected <code><xsl:value-of select="name()"/></code> path for <xsl:apply-templates mode="path" select="../../../@id"/> -> <strong><xsl:apply-templates mode="path" select="../../@id"/></strong> "<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template> |
|
334 </xsl:when> |
|
335 </xsl:choose> |
|
336 </xsl:when> |
|
337 <xsl:otherwise> |
|
338 <xsl:choose> |
|
339 <xsl:when test="substring-before(substring($segment,2),'/') != substring-before(substring($path,2),'/') and (ancestor::SystemDefinition/@id-namespace!='http://www.symbian.org/system-definition' and not(contains(../../@id,':')))"> |
|
340 <xsl:call-template name="Warning"><xsl:with-param name="text">Unexpected <code><xsl:value-of select="name()"/></code> path for <xsl:apply-templates mode="path" select="../../../@id"/> -> <strong><xsl:apply-templates mode="path" select="../../@id"/></strong> "<xsl:value-of select="$fullpath"/>"</xsl:with-param></xsl:call-template> |
|
341 </xsl:when> |
|
342 <xsl:when test="substring-before(substring($segment,2),'/') != substring-before(substring($path,2),'/')"> |
|
343 <xsl:call-template name="Error"><xsl:with-param name="text">Unexpected <code><xsl:value-of select="name()"/></code> path for <xsl:apply-templates mode="path" select="../../../@id"/> -> <strong><xsl:apply-templates mode="path" select="../../@id"/></strong> "<xsl:value-of select="$fullpath"/>"</xsl:with-param></xsl:call-template> |
|
344 </xsl:when> |
|
345 <xsl:when test="not(starts-with($segment,$path))"> |
|
346 <xsl:call-template name="Note"><xsl:with-param name="text">Unexpected <code><xsl:value-of select="name()"/></code> path for <xsl:apply-templates mode="path" select="../../../@id"/> -> <strong><xsl:apply-templates mode="path" select="../../@id"/></strong> "<xsl:value-of select="$fullpath"/>"</xsl:with-param></xsl:call-template> |
|
347 </xsl:when> |
|
348 </xsl:choose> |
|
349 </xsl:otherwise> |
|
350 </xsl:choose> |
|
351 <xsl:if test="substring(.,string-length(.))='/'"> |
|
352 <xsl:call-template name="Warning"><xsl:with-param name="text"><code><xsl:value-of select="name()"/></code> path "<xsl:value-of select="."/>" should not end in /</xsl:with-param></xsl:call-template> |
|
353 </xsl:if> |
|
354 <xsl:if test="contains(.,'\')"> |
|
355 <xsl:call-template name="Error"><xsl:with-param name="text"><code><xsl:value-of select="name()"/></code> path "<xsl:value-of select="."/>" must use only forward slashes</xsl:with-param></xsl:call-template> |
|
356 </xsl:if> |
|
357 </xsl:template> |
|
358 |
|
359 |
|
360 <xsl:template match="SystemDefinition" mode="check-matches"> |
|
361 <xsl:param name="which"/> |
|
362 <xsl:param name="other"/> |
|
363 <xsl:for-each select="//*[@mrp]"> |
|
364 <xsl:variable name="mrp" select="@mrp"/> |
|
365 <xsl:if test="not($other//*[@mrp=$mrp])"> |
|
366 <xsl:call-template name="Error"><xsl:with-param name="text"><xsl:value-of select="$mrp"/> has no match in <xsl:value-of select="$which"/>.</xsl:with-param></xsl:call-template> |
|
367 </xsl:if> |
|
368 </xsl:for-each> |
|
369 </xsl:template> |
|
370 |
|
371 <xsl:template match="*" mode="value"> |
|
372 <xsl:call-template name="Error"><xsl:with-param name="text"> |
|
373 <xsl:value-of select="name()"/>:<xsl:for-each select="@*"><xsl:value-of select="concat(name(),'=',.)"/></xsl:for-each> |
|
374 </xsl:with-param></xsl:call-template> |
|
375 </xsl:template> |
|
376 |
|
377 <xsl:template match="*" mode="compare"><xsl:param name="base"/> |
|
378 <xsl:variable name="n" select="@id"/> |
|
379 <xsl:variable name="tag" select="name()"/> |
|
380 <xsl:variable name="v"><xsl:apply-templates select="." mode="value"/></xsl:variable> |
|
381 <xsl:variable name="v2"><xsl:apply-templates mode="value" select="$base//*[name()=$tag and @id=$n]"/></xsl:variable> |
|
382 <xsl:if test="$v != $v2"> |
|
383 <xsl:call-template name="Error"><xsl:with-param name="text"> |
|
384 <xsl:value-of select="concat(name(),' ',@name)"/> not identical. [<xsl:value-of select="$v"/>|<xsl:value-of select="$v2"/>]</xsl:with-param></xsl:call-template> |
|
385 </xsl:if> |
|
386 </xsl:template> |
|
387 |
|
388 |
|
389 |
|
390 <xsl:template match="unit" mode="compare" priority="1"><xsl:param name="base"/> |
|
391 <xsl:variable name="n" select="concat(@version,':',@mrp,'.',@prebuilt)"/> |
|
392 <xsl:variable name="v"><xsl:apply-templates select="." mode="value"/></xsl:variable> |
|
393 <xsl:variable name="v2"><xsl:apply-templates mode="value" select="$base//unit[concat(@version,':',@mrp,'.',@prebuilt)=$n]"/></xsl:variable> |
|
394 <xsl:if test="$v != $v2"> |
|
395 <xsl:call-template name="Error"><xsl:with-param name="text"> |
|
396 <xsl:value-of select="concat('
',name(),' ',../@name,' v',@version)"/> not identical. [<xsl:value-of select="$v"/>|<xsl:value-of select="$v2"/>]</xsl:with-param></xsl:call-template> |
|
397 </xsl:if> |
|
398 </xsl:template> |
|
399 |
|
400 <xsl:template match="/variations/@module"> (<xsl:value-of select="."/>)</xsl:template> |
|
401 |
|
402 <xsl:template match="/variations" mode="x-check"><xsl:param name="sysdef"/> |
|
403 <xsl:call-template name="Section"><xsl:with-param name="text">vp cross-check <xsl:apply-templates select="@module"/></xsl:with-param></xsl:call-template> |
|
404 <xsl:for-each select="//component"> |
|
405 <xsl:variable name="found"> |
|
406 <xsl:apply-templates select="$sysdef" mode="lookfor"> |
|
407 <xsl:with-param name="id" select="@name"/> |
|
408 <xsl:with-param name="version" select="@version"/> |
|
409 </xsl:apply-templates> |
|
410 </xsl:variable> |
|
411 <xsl:if test="$found=''"> |
|
412 <xsl:call-template name="Error"><xsl:with-param name="text">VP component "<xsl:value-of select="@name"/>"<xsl:if test="@version"> v<xsl:value-of select="@version"/></xsl:if> not in SysDef</xsl:with-param></xsl:call-template> |
|
413 </xsl:if> |
|
414 </xsl:for-each> |
|
415 </xsl:template> |
|
416 |
|
417 <xsl:template match="*" mode="lookfor"><xsl:param name="id"/><xsl:param name="version"/> |
|
418 <xsl:choose> |
|
419 <xsl:when test="string-length($version) and //component[@id=$id and unit[@version=$version]]">Found</xsl:when> |
|
420 <xsl:when test="string-length($version)=0 and //*[@id=$id]">Found</xsl:when> |
|
421 <xsl:otherwise> |
|
422 <xsl:apply-templates select="document(//layer/@href | //package/@href | //collection/@href | //component/@href,.)/*/*" mode="lookfor"> |
|
423 <xsl:with-param name="version" select="$version"/> |
|
424 <xsl:with-param name="id" select="$id"/> |
|
425 </xsl:apply-templates> |
|
426 </xsl:otherwise> |
|
427 </xsl:choose> |
|
428 </xsl:template> |
|
429 |
|
430 |
|
431 |
|
432 <xsl:template match="SystemBuild" mode="x-check"><xsl:param name="sysdef"/> |
|
433 |
|
434 <xsl:call-template name="Section"><xsl:with-param name="text">System Build cross-check</xsl:with-param></xsl:call-template> |
|
435 <xsl:for-each select="//ref"> |
|
436 <xsl:variable name="found"> |
|
437 <xsl:apply-templates select="$sysdef" mode="lookfor"> |
|
438 <xsl:with-param name="id" select="current()/@item"/> |
|
439 </xsl:apply-templates> |
|
440 </xsl:variable> |
|
441 <xsl:if test="$found=''"> |
|
442 <xsl:call-template name="Error"><xsl:with-param name="text">Build item "<xsl:value-of select="@item"/>" not in SysDef</xsl:with-param></xsl:call-template> |
|
443 </xsl:if> |
|
444 </xsl:for-each> |
|
445 |
|
446 <xsl:for-each select="//listRef"> |
|
447 <xsl:if test="not(//list[@name=current()/@list])"> |
|
448 <xsl:call-template name="Error"><xsl:with-param name="text">Build list "<xsl:value-of select="@name"/>" not defined</xsl:with-param></xsl:call-template> |
|
449 </xsl:if> |
|
450 </xsl:for-each> |
|
451 </xsl:template> |
|
452 |
|
453 |
|
454 <xsl:template name="my-release"> |
|
455 <xsl:variable name="n" select="@name"/> |
|
456 <xsl:variable name="new" select="@introduced"/> |
|
457 <xsl:variable name="end" select="@deprecated"/> |
|
458 <xsl:choose> |
|
459 <xsl:when test="$new!='' and $end!=''">(<xsl:value-of select="concat($new,' - ',$end)"/>)</xsl:when> |
|
460 <xsl:when test="$new!='' ">(<xsl:value-of select="$new"/>)</xsl:when> |
|
461 <xsl:when test="$end!=''">(? - <xsl:value-of select="$end"/>)</xsl:when> |
|
462 </xsl:choose> |
|
463 </xsl:template> |
|
464 |
|
465 <xsl:template name="normpath"><xsl:param name="path"/> |
|
466 <!-- normalize out any ".." in the path in $path --> |
|
467 <xsl:choose> |
|
468 <xsl:when test="contains($path,'/../')"> |
|
469 <xsl:call-template name="normpath"> |
|
470 <xsl:with-param name="path"> |
|
471 <xsl:call-template name="before"> |
|
472 <xsl:with-param name="text" select="substring-before($path,'/../')"/> |
|
473 </xsl:call-template> |
|
474 <xsl:value-of select="substring-after($path,'/../')"/> |
|
475 </xsl:with-param> |
|
476 </xsl:call-template> |
|
477 </xsl:when> |
|
478 <xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise> |
|
479 </xsl:choose> |
|
480 </xsl:template> |
|
481 |
|
482 <!-- return all text before the last / --> |
|
483 <xsl:template name="before"><xsl:param name="text"/> |
|
484 <xsl:if test="contains($text,'/')"> |
|
485 <xsl:value-of select="substring-before($text,'/')"/>/<xsl:call-template name="before"><xsl:with-param name="text" select="substring-after($text,'/')"/></xsl:call-template> |
|
486 </xsl:if> |
|
487 </xsl:template> |
|
488 |
|
489 |
|
490 </xsl:stylesheet> |