metatools/sysdeftools/lib/test-model.xsl
changeset 656 88e01c8f013e
parent 624 f70b728ea30c
child 660 66ff3e731c60
equal deleted inserted replaced
640:ac0bbc1e5d79 656:88e01c8f013e
    18 
    18 
    19 	<xsl:variable name="all-ids">
    19 	<xsl:variable name="all-ids">
    20 		<xsl:apply-templates select="document(/model/sysdef/@href)| SystemDefinition" mode="ids"/>
    20 		<xsl:apply-templates select="document(/model/sysdef/@href)| SystemDefinition" mode="ids"/>
    21 	</xsl:variable>
    21 	</xsl:variable>
    22 
    22 
       
    23 	<xsl:variable name="sf-ns">http://www.symbian.org/system-definition</xsl:variable>
    23  
    24  
    24 <xsl:template match="/model" priority="-1">
    25 <xsl:template match="/model" priority="-1">
    25 	<xsl:apply-templates select="." mode="check"/>
    26 	<xsl:apply-templates select="." mode="check"/>
    26 </xsl:template>
    27 </xsl:template>
    27 
    28 
   196 </xsl:template> 
   197 </xsl:template> 
   197 
   198 
   198 
   199 
   199 <xsl:template match="package/@tech-domain|component/@purpose|component/@target" mode="valid">
   200 <xsl:template match="package/@tech-domain|component/@purpose|component/@target" mode="valid">
   200 	<xsl:variable name="v" select="document('')/*/xsl:template[@name=concat('validate-',name(current()))]/*[.=current()]"/>
   201 	<xsl:variable name="v" select="document('')/*/xsl:template[@name=concat('validate-',name(current()))]/*[.=current()]"/>
   201 	<xsl:choose>
   202 	<xsl:variable name="ns"><xsl:apply-templates select="../@id" mode="namespace-for-id"/></xsl:variable>
       
   203 	<xsl:choose>
       
   204 		<xsl:when test="not($v) and $ns=$sf-ns">
       
   205 			<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>
       
   206 		</xsl:when> 
   202 		<xsl:when test="not($v)">
   207 		<xsl:when test="not($v)">
   203 			<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>
   208 			<xsl:call-template name="Note"><xsl:with-param name="text">Non-standard <xsl:value-of select="name()"/> value <xsl:value-of select="name()"/>="<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template>
   204 		</xsl:when> 
   209 		</xsl:when> 
   205 		<xsl:when test="name($v)='ok'"/> 
   210 		<xsl:when test="name($v)='ok'"/> 
   206 		<xsl:when test="name($v)='w'">
   211 		<xsl:when test="name($v)='w'">
   207 			<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>
   212 			<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>
   208 		</xsl:when> 
   213 		</xsl:when> 
   325 
   330 
   326 <xsl:if test="contains(.,':') and not(ancestor::*/namespace::*[name()=substring-before(current(),':')])">
   331 <xsl:if test="contains(.,':') and not(ancestor::*/namespace::*[name()=substring-before(current(),':')])">
   327 	<xsl:call-template name="Error"><xsl:with-param name="text">Undefined namespace for ID "<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template>
   332 	<xsl:call-template name="Error"><xsl:with-param name="text">Undefined namespace for ID "<xsl:value-of select="."/>"</xsl:with-param></xsl:call-template>
   328 </xsl:if>
   333 </xsl:if>
   329 
   334 
       
   335 </xsl:template>
       
   336 
       
   337 
       
   338 <xsl:template match="@*" mode="namespace-for-id">
       
   339 <xsl:choose>
       
   340 	<xsl:when test="contains(.,':') and ancestor::*/namespace::*[name()=substring-before(current(),':')]">
       
   341 		<xsl:value-of select="ancestor::*/namespace::*[name()=substring-before(current(),':')]"/>
       
   342 	</xsl:when>
       
   343 	<xsl:when test="ancestor::SystemDefinition/@id-namespace"><xsl:value-of select="ancestor::SystemDefinition/@id-namespace"/></xsl:when>
       
   344 	<xsl:otherwise><xsl:value-of select="$sf-ns"/></xsl:otherwise>
       
   345 </xsl:choose>
   330 </xsl:template>
   346 </xsl:template>
   331 
   347 
   332 
   348 
   333 <xsl:template mode="localid" match="*">
   349 <xsl:template mode="localid" match="*">
   334 	<xsl:choose>
   350 	<xsl:choose>