sysmodelgen/core/mergesysdef.xsl
branchHighFidelityModel
changeset 165 ba562c1e2717
parent 152 5acf50bbb618
child 432 0f44a943faf9
equal deleted inserted replaced
164:8309dda95234 165:ba562c1e2717
    20 <!-- only supports 3.x syntax and only operates on stand-alone models -->
    20 <!-- only supports 3.x syntax and only operates on stand-alone models -->
    21 
    21 
    22 <xsl:variable name="downstream" select="document($Downstream,.)/SystemDefinition"/>
    22 <xsl:variable name="downstream" select="document($Downstream,.)/SystemDefinition"/>
    23 <xsl:param name="upname">
    23 <xsl:param name="upname">
    24 	<xsl:choose>
    24 	<xsl:choose>
    25 		<xsl:when test="$downstream[starts-with(@schema,'2.') or starts-with(@schema,'1.')  or not(systemModel)]">
    25 		<xsl:when test="$downstream[starts-with(@schema,'2.') or starts-with(@schema,'1.')]">
    26 			<xsl:message terminate="yes">Syntax <xsl:value-of select="@schema"/> not supported</xsl:message>
    26 			<xsl:message terminate="yes">Syntax <xsl:value-of select="@schema"/> not supported</xsl:message>
    27 		</xsl:when>
    27 		</xsl:when>
    28 		<xsl:when test="/SystemDefinition/systemModel/@name=$downstream/systemModel/@name">
    28 		<xsl:when test="name($downstream/*)!=name(/SystemDefinition/*)">
       
    29 			<xsl:message terminate="yes">Can only merge fragments of the same rank</xsl:message>
       
    30 		</xsl:when>
       
    31 <!--		<xsl:when test="$downstream[not(systemModel)]">
       
    32 			<xsl:message terminate="yes">Needs to be a standalone system definition</xsl:message>
       
    33 		</xsl:when>-->
       
    34 		<xsl:when test="/SystemDefinition/systemModel/@name=$downstream/systemModel/@name or not(/SystemDefinition/systemModel/@name)">
    29 			<xsl:apply-templates mode="origin-term" select="/*">
    35 			<xsl:apply-templates mode="origin-term" select="/*">
    30 				<xsl:with-param name="root">Upstream</xsl:with-param>
    36 				<xsl:with-param name="root">Upstream</xsl:with-param>
    31 			</xsl:apply-templates>
    37 			</xsl:apply-templates>
    32 			</xsl:when>
    38 			</xsl:when>
    33 		<xsl:otherwise><xsl:value-of select="/SystemDefinition/systemModel/@name"/></xsl:otherwise>
    39 		<xsl:otherwise><xsl:value-of select="/SystemDefinition/systemModel/@name"/></xsl:otherwise>
    34 	</xsl:choose>
    40 	</xsl:choose>
    35 </xsl:param>
    41 </xsl:param>
    36 
    42 
    37 <xsl:param name="downname">
    43 <xsl:param name="downname">
    38 	<xsl:choose>
    44 	<xsl:choose>
    39 		<xsl:when test="/SystemDefinition/systemModel/@name=$downstream/systemModel/@name">
    45 		<xsl:when test="/SystemDefinition/systemModel/@name=$downstream/systemModel/@name or not($downstream/systemModel/@name)">
    40 			<xsl:apply-templates mode="origin-term" select="$downstream">	
    46 			<xsl:apply-templates mode="origin-term" select="$downstream">	
    41 				<xsl:with-param name="root">Downstream</xsl:with-param>
    47 				<xsl:with-param name="root">Downstream</xsl:with-param>
    42 			</xsl:apply-templates>
    48 			</xsl:apply-templates>
    43 			</xsl:when>
    49 			</xsl:when>
       
    50 		<xsl:when test="name($downstream/*)!=name(/SystemDefinition/*)">
       
    51 			<xsl:message terminate="yes">Can only merge fragments of the same rank</xsl:message>
       
    52 		</xsl:when>
    44 		<xsl:otherwise><xsl:value-of select="$downstream/systemModel/@name"/></xsl:otherwise>
    53 		<xsl:otherwise><xsl:value-of select="$downstream/systemModel/@name"/></xsl:otherwise>
    45 	</xsl:choose>
    54 	</xsl:choose>
    46 </xsl:param>
    55 </xsl:param>
    47 
    56 
    48 <xsl:template mode="origin-term" match="*">
    57 <xsl:template mode="origin-term" match="*">