metatools/sysdeftools/lib/test-model.xsl
changeset 661 199bb033aacf
parent 660 66ff3e731c60
child 663 8e27d440923e
equal deleted inserted replaced
660:66ff3e731c60 661:199bb033aacf
    73 </xsl:template>
    73 </xsl:template>
    74 
    74 
    75 <xsl:template match="/SystemDefinition[starts-with(@schema,'3.0.')] | systemModel">
    75 <xsl:template match="/SystemDefinition[starts-with(@schema,'3.0.')] | systemModel">
    76 	<xsl:param name="filename"  select="$Filename"/>
    76 	<xsl:param name="filename"  select="$Filename"/>
    77 		
    77 		
    78 <xsl:if test="//unit and not(self::systemModel)">
    78 <xsl:if test="descendant::unit and not(self::systemModel)">
    79 <xsl:call-template name="Section">
    79 <xsl:call-template name="Section">
    80 	<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>
    80 	<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>
    81 	<xsl:with-param name="id"><xsl:value-of select="*/@id"/></xsl:with-param>
    81 	<xsl:with-param name="id"><xsl:value-of select="*/@id"/></xsl:with-param>
    82 	<xsl:with-param name="sub"><xsl:value-of select="count(//unit)"/> unit<xsl:if test="count(//unit)!=1">s</xsl:if></xsl:with-param>
    82 	<xsl:with-param name="sub"><xsl:value-of select="count(//unit)"/> unit<xsl:if test="count(//unit)!=1">s</xsl:if></xsl:with-param>
    83 </xsl:call-template>
    83 </xsl:call-template>
   333 </xsl:template>
   333 </xsl:template>
   334 
   334 
   335 <xsl:template match="layer | package | collection | component">
   335 <xsl:template match="layer | package | collection | component">
   336 	<xsl:param name="filename"/>
   336 	<xsl:param name="filename"/>
   337 
   337 
   338 <xsl:if test="self::package and not(parent::SystemDefinition)">
   338 <xsl:if test="self::package[not(@href)] and not(parent::SystemDefinition)">
   339 <xsl:call-template name="Section">
   339 <xsl:call-template name="Section">
   340 	<xsl:with-param name="id"><xsl:value-of select="@id"/></xsl:with-param>
   340 	<xsl:with-param name="id"><xsl:value-of select="@id"/></xsl:with-param>
   341 	<xsl:with-param name="text"><xsl:value-of select="translate(substring(name(),1,1),'clp','CLP')"/><xsl:value-of select="substring(name(),2)"/>: <xsl:value-of select="@name"/></xsl:with-param>
   341 	<xsl:with-param name="text"><xsl:value-of select="translate(substring(name(),1,1),'clp','CLP')"/><xsl:value-of select="substring(name(),2)"/>: <xsl:value-of select="@name"/></xsl:with-param>
   342 	<xsl:with-param name="sub"><xsl:value-of select="count(descendant::unit)"/> unit<xsl:if test="count(descendant::unit)!=1">s</xsl:if></xsl:with-param>
   342 	<xsl:with-param name="sub"><xsl:value-of select="count(descendant::unit)"/> unit<xsl:if test="count(descendant::unit)!=1">s</xsl:if></xsl:with-param>
   343 </xsl:call-template>
   343 </xsl:call-template>
   346 <xsl:apply-templates select="@*" mode="valid"/>
   346 <xsl:apply-templates select="@*" mode="valid"/>
   347 <xsl:apply-templates select="@id"/>
   347 <xsl:apply-templates select="@id"/>
   348 <xsl:if test="self::component">
   348 <xsl:if test="self::component">
   349 	<xsl:choose>
   349 	<xsl:choose>
   350 		<xsl:when test="count(unit[not(@filter | @version)]) = 0 "/>
   350 		<xsl:when test="count(unit[not(@filter | @version)]) = 0 "/>
   351 		<xsl:when test="count(unit[not(@version)]) &gt; 1 and @filter='s60'">
   351 		<xsl:when test="count(unit[not(@version)]) &gt; 1 and descendant-or-self::*[contains(@filter,'s60')]">
   352 			<xsl:call-template name="Warning"><xsl:with-param name="text">S60 Component <id><xsl:value-of select="@id"/></id> has <xsl:value-of select="count(unit)"/> units.</xsl:with-param></xsl:call-template>
   352 			<xsl:call-template name="Warning"><xsl:with-param name="text">S60 Component <id><xsl:value-of select="@id"/></id> has <xsl:value-of select="count(unit)"/> units.</xsl:with-param></xsl:call-template>
   353 		</xsl:when>
   353 		</xsl:when>
   354 		<xsl:when test="count(unit[not(@version)]) &gt; 1">
   354 		<xsl:when test="count(unit[not(@version)]) &gt; 1">
   355 			<xsl:call-template name="Error"><xsl:with-param name="text">Component "<id><xsl:value-of select="@id"/></id>" has <xsl:value-of select="count(unit)"/> units.</xsl:with-param></xsl:call-template>
   355 			<xsl:call-template name="Error"><xsl:with-param name="text">Component "<id><xsl:value-of select="@id"/></id>" has <xsl:value-of select="count(unit)"/> units.</xsl:with-param></xsl:call-template>
   356 		</xsl:when>
   356 		</xsl:when>
   503 
   503 
   504 <xsl:if test="translate(.,'-','')!=.">
   504 <xsl:if test="translate(.,'-','')!=.">
   505 	<xsl:call-template name="Error"><xsl:with-param name="text">ID "<id><xsl:value-of select="."/></id>" contains reserved character "-" </xsl:with-param></xsl:call-template>
   505 	<xsl:call-template name="Error"><xsl:with-param name="text">ID "<id><xsl:value-of select="."/></id>" contains reserved character "-" </xsl:with-param></xsl:call-template>
   506 </xsl:if>
   506 </xsl:if>
   507 
   507 
   508 <xsl:if test="contains(.,'.') and not(parent::package) and not(contains(ancestor::pacakge/@id,'.'))">
   508 <xsl:if test="contains(.,'.') and not(parent::package) and not(contains(ancestor::package/@id,'.'))">
   509 	<xsl:call-template name="Error"><xsl:with-param name="text">ID "<xsl:value-of select="."/>" contains reserved character "<code>.</code>" </xsl:with-param></xsl:call-template>
   509 	<xsl:call-template name="Error"><xsl:with-param name="text">ID "<xsl:value-of select="."/>" contains reserved character "<code>.</code>" </xsl:with-param></xsl:call-template>
   510 </xsl:if>
   510 </xsl:if>
   511 
   511 
   512 <xsl:if test="translate(substring(.,1,1),'0123456789','')=''">
   512 <xsl:if test="translate(substring(.,1,1),'0123456789','')=''">
   513 	<xsl:call-template name="Error"><xsl:with-param name="text">ID "<id><xsl:value-of select="."/></id>" cannot begin with a digit</xsl:with-param></xsl:call-template>
   513 	<xsl:call-template name="Error"><xsl:with-param name="text">ID "<id><xsl:value-of select="."/></id>" cannot begin with a digit</xsl:with-param></xsl:call-template>
   546 <xsl:if test="substring(.,string-length(.))='/'">
   546 <xsl:if test="substring(.,string-length(.))='/'">
   547 		<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>
   547 		<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>
   548 </xsl:if>
   548 </xsl:if>
   549 <xsl:if test="contains(.,'\')">
   549 <xsl:if test="contains(.,'\')">
   550 		<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>
   550 		<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>
       
   551 </xsl:if>
       
   552 
       
   553 <xsl:if test="count(//unit[@bldFile=current()]/..) &gt; 1">
       
   554 		<xsl:call-template name="Error"><xsl:with-param name="text"><code><xsl:value-of select="name()"/></code> path "<xsl:value-of select="."/>" appears in components <xsl:for-each select="//unit[@bldFile=current()]/..">
       
   555 			<id><xsl:value-of select="@id"/></id>
       
   556 			<xsl:choose>
       
   557 			<xsl:when test="position()=last() - 1"> and </xsl:when>
       
   558 			<xsl:when test="position()!=last()">, </xsl:when>
       
   559 			</xsl:choose>
       
   560 			</xsl:for-each>
       
   561 		</xsl:with-param>
       
   562 		<xsl:with-param name="sub">Use filters or config metadata to control what kind of builds a component can appear in</xsl:with-param>
       
   563 		</xsl:call-template>
   551 </xsl:if>
   564 </xsl:if>
   552 
   565 
   553 <!-- this is a realtive path, so just check that it's the expected number of dirs down -->
   566 <!-- this is a realtive path, so just check that it's the expected number of dirs down -->
   554 	<xsl:variable name="fullpath"><xsl:call-template name="normpath">
   567 	<xsl:variable name="fullpath"><xsl:call-template name="normpath">
   555 				<xsl:with-param name="path">
   568 				<xsl:with-param name="path">