11 Contributors: |
11 Contributors: |
12 Description: |
12 Description: |
13 Module containing the validation logic for system definition 3.0.0 syntax |
13 Module containing the validation logic for system definition 3.0.0 syntax |
14 --> |
14 --> |
15 <xsl:key name="named" match="*[ancestor::systemModel]" use="@name"/> |
15 <xsl:key name="named" match="*[ancestor::systemModel]" use="@name"/> |
16 <xsl:param name="path-errors" select="0"/> |
|
17 <xsl:param name="Filename"/> |
16 <xsl:param name="Filename"/> |
18 <xsl:variable name="info" select="document(/model//info[@type='extra']/@href,/model)//c"/> |
17 <xsl:variable name="info" select="document(/model//info[@type='extra']/@href,/model)//c"/> |
19 |
18 |
20 <xsl:variable name="all-ids"> |
19 <xsl:variable name="all-ids"> |
21 <xsl:apply-templates select="document(/model/sysdef/@href)| SystemDefinition" mode="ids"/> |
20 <xsl:apply-templates select="document(/model/sysdef/@href)| SystemDefinition" mode="ids"/> |
91 <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> |
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> |
92 </xsl:template> |
91 </xsl:template> |
93 |
92 |
94 <xsl:template match="@before|@id|package/@span|layer/@span|collection/@level|package/@level|package/@levels|layer/@levels" mode="valid"/> <!-- really should check syntax --> |
93 <xsl:template match="@before|@id|package/@span|layer/@span|collection/@level|package/@level|package/@levels|layer/@levels" mode="valid"/> <!-- really should check syntax --> |
95 |
94 |
96 <xsl:template match="@name|@href|@filter" mode="valid"/> |
95 <xsl:template match="@name|@href|@filter|unit/@version|unit/@prebuilt" mode="valid"/> |
97 |
96 |
98 <xsl:template match="component/@introduced|component/@deprecated" mode="valid"/> |
97 <xsl:template match="component/@introduced|component/@deprecated" mode="valid"/> |
99 |
98 |
|
99 <xsl:template match="component/@origin-model" mode="valid"/> |
|
100 |
|
101 <xsl:template match="unit/@priority" mode="valid"> |
|
102 <xsl:call-template name="Note"><xsl:with-param name="text">Attribute <xsl:value-of select="name()"/> is deprecated</xsl:with-param></xsl:call-template> |
|
103 </xsl:template> |
|
104 |
|
105 |
|
106 <xsl:template match="@*[namespace-uri()!='']" mode="valid"> |
|
107 <xsl:call-template name="Note"><xsl:with-param name="text">Extension attribute <xsl:value-of select="local-name()"/>="<xsl:value-of select="."/>" in namespace <xsl:value-of select="namespace-uri()"/></xsl:with-param></xsl:call-template> |
|
108 </xsl:template> |
|
109 |
|
110 <xsl:template match="@*[namespace-uri()='http://www.nokia.com/qt' and local-name()='proFile']" mode="valid"/> |
|
111 |
|
112 |
|
113 <xsl:template match="@*[namespace-uri()='http://www.nokia.com/qt' and local-name()='qmakeArgs']" mode="valid"> |
|
114 <xsl:call-template name="Note"><xsl:with-param name="text">Should avoid using extension attribute <xsl:value-of select="local-name()"/>="<xsl:value-of select="."/>" in namespace <xsl:value-of select="namespace-uri()"/></xsl:with-param></xsl:call-template> |
|
115 </xsl:template> |
100 |
116 |
101 |
117 |
102 <xsl:template match="@replace" mode="valid"> |
118 <xsl:template match="@replace" mode="valid"> |
103 <xsl:if test="/SystemDefinition[@schema='3.0.0']"> |
119 <xsl:if test="/SystemDefinition[@schema='3.0.0']"> |
104 <xsl:call-template name="Error"><xsl:with-param name="text">Attribute <b><xsl:value-of select="name()"/></b>="<xsl:value-of select="."/>" not valid in schema <xsl:value-of select="/SystemDefinition/@schema"/>. Must use schema 3.0.1 or higher</xsl:with-param></xsl:call-template> |
120 <xsl:call-template name="Error"><xsl:with-param name="text">Attribute <b><xsl:value-of select="name()"/></b>="<xsl:value-of select="."/>" not valid in schema <xsl:value-of select="/SystemDefinition/@schema"/>. Must use schema 3.0.1 or higher</xsl:with-param></xsl:call-template> |
281 </xsl:template> |
297 </xsl:template> |
282 |
298 |
283 <xsl:template match="meta/@rel | meta/@type | meta/@href"/> <!-- anything is valid --> |
299 <xsl:template match="meta/@rel | meta/@type | meta/@href"/> <!-- anything is valid --> |
284 |
300 |
285 <xsl:template match="unit"> <xsl:param name="filename"/> |
301 <xsl:template match="unit"> <xsl:param name="filename"/> |
286 <xsl:apply-templates select="@mrp|@bldFile"> |
302 <xsl:apply-templates select="@*"> |
287 <xsl:with-param name="filename" select="$filename"/> |
303 <xsl:with-param name="filename" select="$filename"/> |
288 </xsl:apply-templates> |
304 </xsl:apply-templates> |
|
305 </xsl:template> |
|
306 |
|
307 |
|
308 <xsl:template match="unit/@*" priority="-1"> |
|
309 <xsl:apply-templates select="." mode="valid"/> |
289 </xsl:template> |
310 </xsl:template> |
290 |
311 |
291 |
312 |
292 <xsl:template match="@id" mode="path"> |
313 <xsl:template match="@id" mode="path"> |
293 <xsl:choose> |
314 <xsl:choose> |
313 <xsl:choose> |
334 <xsl:choose> |
314 <xsl:when test="contains(@id,':')">/<xsl:value-of select="substring-after(@id,':')"/></xsl:when> |
335 <xsl:when test="contains(@id,':')">/<xsl:value-of select="substring-after(@id,':')"/></xsl:when> |
315 <xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise> |
336 <xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise> |
316 </xsl:choose> |
337 </xsl:choose> |
317 </xsl:template> |
338 </xsl:template> |
318 <xsl:template match="@bldFile|@mrp"><xsl:param name="filename"/> |
339 <xsl:template match="@bldFile|@mrp|@base"><xsl:param name="filename"/> |
319 <xsl:if test="substring(.,string-length(.))='/'"> |
340 <xsl:if test="substring(.,string-length(.))='/'"> |
320 <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> |
341 <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> |
321 </xsl:if> |
342 </xsl:if> |
322 <xsl:if test="contains(.,'\')"> |
343 <xsl:if test="contains(.,'\')"> |
323 <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> |
344 <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> |