sysmodelgen/core/mergesysdef-module.xsl
author Bob Rosenberg <bob.rosenberg@nokia.com>
Tue, 28 Sep 2010 17:48:51 +0100
branchHighFidelityModel
changeset 432 0f44a943faf9
parent 165 ba562c1e2717
permissions -rw-r--r--
System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     1
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common"  exclude-result-prefixes="exslt">
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
     2
<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
     3
	All rights reserved.
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
     4
	This component and the accompanying materials are made available
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
     5
	under the terms of the License "Eclipse Public License v1.0"
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
     6
	which accompanies this distribution, and is available
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
     7
	at the URL "http://www.eclipse.org/legal/epl-v10.html".
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
     8
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
     9
	Initial Contributors:
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    10
	Nokia Corporation - initial contribution.
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    11
	Contributors:
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    12
	Description:
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
    13
	XSLT module for merging only two sysdef files according to the 3.0.1 rules. 
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
    14
		2.x and older syntax not supported and must be converted before calling.
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
    15
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
    16
		Requires the including XSLT to also include path-module.xsl
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    17
-->
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    18
	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    19
<xsl:variable name="defaultnamespace">http://www.symbian.org/system-definition</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    20
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    21
<xsl:template match="/SystemDefinition[starts-with(@schema,'2.') or starts-with(@schema,'1.')]" priority="2" mode="merge-models">
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    22
	<xsl:message terminate="yes">ERROR: Syntax <xsl:value-of select="@schema"/> not supported</xsl:message>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    23
</xsl:template>
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    24
<!--<xsl:template match="/SystemDefinition[not(systemModel)]" priority="2" mode="merge-models">
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    25
	<xsl:message terminate="yes">ERROR: Can only merge stand-alone system models</xsl:message>
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    26
</xsl:template>-->
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    27
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    28
<!-- stuff for dealing with namespaces -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    29
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    30
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    31
<xsl:template match="node()|@*" mode="translate-namespaces"><xsl:copy-of select="."/></xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    32
<!-- don't translate meta or unit tags, just copy verbatim -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    33
<xsl:template match="meta|unit" mode="translate-namespaces" priority="2">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    34
<xsl:element name="{name()}">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    35
<xsl:copy-of select="@*|*|comment()"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    36
</xsl:element>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    37
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    38
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    39
<xsl:template match="*" mode="translate-namespaces"><xsl:param name="nsdoc"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    40
<xsl:element name="{name()}">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    41
<xsl:apply-templates select="@*|node()" mode="translate-namespaces">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    42
	<xsl:with-param name="nsdoc" select="$nsdoc"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    43
</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    44
</xsl:element>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    45
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    46
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    47
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
    48
<xsl:template match="@id|@before|@replace" mode="translate-namespaces"><xsl:param name="nsdoc"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    49
	<xsl:attribute name="{name()}">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    50
		<xsl:variable name="id">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    51
			<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    52
				<xsl:when test="contains(.,':')">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    53
					<xsl:value-of select="substring-after(.,':')"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    54
				</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    55
				<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    56
					<xsl:value-of select="."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    57
				</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    58
			</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    59
		</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    60
		<xsl:variable name="ns">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    61
			<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    62
				<xsl:when test="contains(.,':')">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    63
					<xsl:value-of select="ancestor-or-self::*/namespace::*[name()=substring-before(current()/.,':')]"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    64
				</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    65
				<xsl:when test="ancestor::SystemDefinition/@id-namespace">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    66
					<xsl:value-of select="ancestor::SystemDefinition/@id-namespace"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    67
				</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    68
				<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    69
					<xsl:value-of select="$defaultnamespace"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    70
				</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    71
			</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    72
		</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    73
		<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    74
			<xsl:when test="not($nsdoc/@id-namespace) and $defaultnamespace=$ns">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    75
				<xsl:value-of select="$id"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    76
			</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    77
			<xsl:when test="$nsdoc/@id-namespace=$ns">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    78
				<xsl:value-of select="$id"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    79
			</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    80
			<xsl:when test="$nsdoc/namespace::*[.=$ns]">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    81
				<xsl:value-of select="concat(name($nsdoc/namespace::*[.=$ns]),':',$id)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    82
			</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    83
			<xsl:when test="ancestor::SystemDefinition/@id-namespace=$ns">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    84
				<xsl:variable name="myns">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    85
					<xsl:apply-templates mode="ns-prefix" select="$nsdoc">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    86
						<xsl:with-param name="ns" select="$ns"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    87
					</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    88
				</xsl:variable>			
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    89
				<xsl:value-of select="concat($myns,':',$id)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    90
			</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    91
			<xsl:otherwise> <!-- some namespace that needed to be defined --> 
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    92
			<xsl:message>Warning: need definition for namespace "<xsl:value-of select="$ns"/>" for <xsl:value-of select="$id"/></xsl:message>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    93
				<xsl:value-of select="."/>					
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    94
			</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    95
		</xsl:choose>		
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    96
	</xsl:attribute>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    97
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    98
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    99
<xsl:template match="SystemDefinition" mode="ns-prefix">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   100
	<xsl:param name="ns"/> <!-- the namespace URI -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   101
	<xsl:param name="pre"/> <!-- the preferred prefix to use if possbile -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   102
	<xsl:param name="dontuse"/> <!-- space prefixed, separated and terminated list of namespace prefixes to not use -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   103
	<xsl:param name="chars">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</xsl:param> <!-- single letter namespace prefixes to try -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   104
	<xsl:variable name="name" select="substring(substring-after($ns,'http://www.'),1,1)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   105
	<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   106
		<xsl:when test="$pre!='' and $pre!='id-namespace' and not(//namespace::*[name()=$pre]) and not(contains($dontuse,concat(' ',$pre,' ')))">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   107
			<xsl:value-of select="$pre"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   108
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   109
		<xsl:when test="$ns='' and $chars=''">
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
   110
			<xsl:message terminate="yes">ERROR: Cannot create namespace prefix for downstream default namespace in <xsl:value-of select="*/@id"/></xsl:message>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   111
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   112
		<xsl:when test="$name!='' and not(contains($dontuse,concat(' ',$name,' ')))"><xsl:value-of select="$name"/></xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   113
		<xsl:when test="namespace::*[name()=substring($chars,1,1)] or contains($dontuse,concat(' ',substring($chars,1,1),' '))">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   114
			<xsl:apply-templates mode="ns-prefix">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   115
				<xsl:with-param name="chars" select="substring($chars,2)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   116
			</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   117
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   118
		<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   119
			<xsl:value-of select="substring($chars,1,1)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   120
		</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   121
	</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   122
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   123
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   124
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   125
<!--  need to make sure this handles <meta> correctly -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   126
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   127
<xsl:template match="SystemDefinition" mode="merge-models">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   128
	<xsl:param name="other"/>	<!-- the downstream SystemDefinition this is merged with -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   129
	<xsl:param name="up" select="systemModel"/>	<!-- the element containing the origin @name used for any component from "this" model. -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   130
	<xsl:param name="down" select="$other/systemModel"/> <!-- the element containing origin @name used for any component from $other model. -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   131
	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   132
	<!-- do some testing -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   133
 	<xsl:if test="$other[starts-with(@schema,'2.') or starts-with(@schema,'1.')]">
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
   134
		<xsl:message terminate="yes">ERROR: Syntax <xsl:value-of select="$other/@schema"/> not supported</xsl:message>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   135
	</xsl:if>
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
   136
	<xsl:if test="name(*) != name($other/*)">
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
   137
		<xsl:message terminate="yes">ERROR: Can only merge system models of the same rank</xsl:message>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   138
	</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   139
	 
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   140
	<xsl:copy>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   141
		<xsl:attribute name="schema">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   142
			<xsl:call-template name="compare-versions">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   143
				<xsl:with-param name="v1" select="@schema"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   144
				<xsl:with-param name="v2" select="$other/@schema"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   145
			</xsl:call-template>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   146
		</xsl:attribute>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   147
		<xsl:copy-of  select="@*[name()!='schema']"/> <!--  use attributes from origin model -->
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   148
		<xsl:variable name="namespaces">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   149
			<xsl:copy> <!-- needs <copy> so the processor doesn't lose the namespaces -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   150
				<!--copy namespaces as needed -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   151
				
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   152
				<xsl:copy-of select="namespace::*[name()!='xml']"/> <!-- all upstream namespaces -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   153
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   154
				<xsl:variable name="cur" select="."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   155
				<xsl:for-each select="$other/namespace::*"> <!-- all namespaces in downstream not already in upstream -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   156
					<xsl:if test="not((. = $cur/@id-namespace) or (not($cur/@id-namespace) and .= $defaultnamespace) or  $cur/namespace::*[.=current()])">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   157
							<!-- namespace in downstream not in upstream doc -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   158
							<xsl:variable name="newprefix">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   159
								 <!-- test to see if the ns prefix already exists -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   160
								<xsl:apply-templates select="$cur" mode="ns-prefix">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   161
									<xsl:with-param name="ns" select="."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   162
									<xsl:with-param name="pre" select="name()"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   163
								</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   164
							</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   165
							<xsl:copy/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   166
					</xsl:if>   
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   167
				</xsl:for-each>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   168
				
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   169
					<xsl:if test="not(($other/@id-namespace = @id-namespace) or (not($other/@id-namespace) and not(@id-namespace)) or (not(@id-namespace) and $other/@id-namespace = $defaultnamespace) or namespace::*[.=$other/@id-namespace])">  
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   170
						<!-- default namespace in downstream not in upstream doc -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   171
						<!-- need to make created ns a bit more intelligent -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   172
						<xsl:attribute name="bar" namespace="{$other/@id-namespace}">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   173
							<xsl:value-of select="$other/@id-namespace"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   174
						</xsl:attribute>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   175
				</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   176
			</xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   177
		</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   178
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   179
		
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   180
		<!-- copy the namespaces to currently open element (the root one) -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   181
		<xsl:copy-of select="namespace::*"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   182
		<xsl:for-each select="$other/namespace::*[.!=current()/namespace::*]"><xsl:copy/></xsl:for-each>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   183
		<xsl:for-each select="exslt:node-set($namespaces)/*/namespace::*"><xsl:copy/></xsl:for-each>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   184
	<!-- translate all IDs in downstream doc to use namespaces from upstream doc  
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   185
		This is so much easier than having to propigate this info around while creating the doc-->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   186
	<xsl:variable name="otherdoc">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   187
		<xsl:apply-templates mode="translate-namespaces" select="$other">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   188
			<xsl:with-param name="nsdoc" select="exslt:node-set($namespaces)/* | ."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   189
		</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   190
	</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   191
		<xsl:apply-templates mode="merge-models">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   192
			<xsl:with-param name="other" select="exslt:node-set($otherdoc)/*"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   193
			<xsl:with-param name="up" select="$up"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   194
			<xsl:with-param name="down" select="$down"/>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   195
			<xsl:with-param name="replaces" select="exslt:node-set($otherdoc)//*[self::component or self::collection or self::package or self::layer]/@replace"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   196
		</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   197
	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   198
	</xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   199
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   200
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   201
<xsl:template match="systemModel" mode="merge-models">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   202
	<xsl:param name="other"/>	<!-- the parent of the downstream systemModel this is merged with -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   203
	<xsl:param name="up"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   204
	<xsl:param name="down"/>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   205
	<xsl:param name="replaces"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   206
	<xsl:copy><xsl:copy-of  select="@*"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   207
		<!--  copy metas and comments in between meta. Do not try to merge metadata between models -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   208
			<xsl:copy-of select="meta | $other/systemModel/meta | comment()[following-sibling::meta]"/>	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   209
		<xsl:apply-templates mode="merge-models">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   210
			<xsl:with-param name="other" select="$other/systemModel"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   211
			<xsl:with-param name="up" select="$up"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   212
			<xsl:with-param name="down" select="$down"/>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   213
			<xsl:with-param name="replaces" select="$replaces"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   214
		</xsl:apply-templates>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   215
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   216
		<!-- tack on any remaining layers -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   217
		<xsl:apply-templates mode="merge-copy-of" select="$other/systemModel/layer[not(@before) and not(following-sibling::*[@id=current()/layer/@id]) and not(@id=current()/layer/@id)]">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   218
			<xsl:with-param name="origin" select="$down"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   219
			<xsl:with-param name="root" select="current()/.."/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   220
			<xsl:with-param name="replaces" select="$replaces"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   221
		</xsl:apply-templates>		
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   222
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   223
	</xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   224
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   225
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   226
<xsl:template match="@*|*|comment()" mode="merge-models"><xsl:copy-of select="."/></xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   227
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   228
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   229
<xsl:template match="meta|comment()[following-sibling::meta]" mode="merge-models"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   230
	<!-- copy elesewhere, not here so that metas always appear first-->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   231
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   232
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   233
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   234
<!-- merge levels attribute via std rules -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   235
<xsl:template match="layer/@levels|package/@levels" mode="merge-models">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   236
	<xsl:param name="other"/><!-- the element contains the other @levels -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   237
	<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   238
		<!--  if they are the same, or not specified in the other,  just copy -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   239
		<xsl:when test=".=$other/@levels or not($other/@levels)"><xsl:copy-of select="."/></xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   240
		<xsl:when test="contains(concat(' ',normalize-space(.),' '),concat(' ',normalize-space($other/@levels),' '))">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   241
			<!--upstream completely contains downstream, just copy --> 
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   242
			<xsl:copy-of select="."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   243
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   244
		<xsl:when test="contains(concat(' ',normalize-space($other/@levels),' '),concat(' ',normalize-space(.),' '))">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   245
			<!--  If this is contained is other, then use other-->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   246
			<xsl:copy-of select="$other/@levels"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   247
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   248
		<xsl:when test="contains(concat(' ',normalize-space($other/@levels),' '),' - ')">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   249
			<!-- if other uses - syntax, then pre/append -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   250
			<xsl:variable name="lev">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   251
				<xsl:value-of select="substring-before(concat(' ',normalize-space($other/@levels),' '),' - ')"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   252
				<xsl:value-of select="concat(' ',.,' ')"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   253
				<xsl:value-of select="substring-after(concat(' ',normalize-space($other/@levels),' '),' - ')"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   254
			</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   255
			<xsl:attribute name="levels"><xsl:value-of select="normalize-space($lev)"/></xsl:attribute>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   256
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   257
		<xsl:otherwise> <!--  if they differ, use the origin's levels -->
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   258
			<xsl:message>Note: levels differ "<xsl:value-of select="."/>" vs "<xsl:value-of select="$other/@levels"/>" on <xsl:value-of select="../@id"/></xsl:message>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   259
			<xsl:copy-of select="."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   260
		</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   261
	</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   262
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   263
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   264
<xsl:template name="copy-sorted-content">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   265
	<xsl:param name="base"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   266
	<xsl:param name="to-sort"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   267
	<xsl:param name="start"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   268
	<xsl:param name="end"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   269
	<xsl:param name="down"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   270
	<xsl:param name="remainder" select="/.."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   271
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   272
	<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   273
		<xsl:when test="not($to-sort)"/>  <!-- nothing left to copy. stop -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   274
		<xsl:when test="not($base)"/>  <!-- reached end. stop -->
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   275
		<xsl:otherwise>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   276
			<xsl:for-each select="$to-sort">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   277
				<xsl:if test="((@before=$end/@id) or not(@before) or not($base/ancestor::SystemDefinition//*[@id=current()/@before])) and not($base[@id=current()/@id])">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   278
					<xsl:apply-templates mode="merge-copy-of" select=".">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   279
						<xsl:with-param name="origin" select="$down"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   280
						<xsl:with-param name="root" select="$end/ancestor::SystemDefinition"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   281
					</xsl:apply-templates>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   282
				</xsl:if>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   283
			</xsl:for-each>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   284
		</xsl:otherwise>	
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   285
	</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   286
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   287
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   288
<xsl:template match="node()" mode="merge-data">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   289
	<xsl:copy-of select="." />
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   290
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   291
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   292
<xsl:template match="meta" mode="merge-data">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   293
	<xsl:param name="metas" />
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   294
	<!-- compare this meta against all metas in the  merged doc
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   295
		if they are identical, then ignore this one.
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   296
		identical is computed by translating to a string, normalising some known parts. This might be slow in some cases-->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   297
	<xsl:variable name="val"><xsl:apply-templates select="." mode="as-xml-text" /></xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   298
	<xsl:variable name="match">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   299
		<xsl:for-each select="$metas">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   300
			<xsl:variable name="cur"><xsl:apply-templates select="." mode="as-xml-text" /></xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   301
			<xsl:if test="$cur=$val">*</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   302
		</xsl:for-each>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   303
	</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   304
	<xsl:if test="$match='' ">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   305
		<xsl:copy-of select="." />
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   306
	</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   307
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   308
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   309
<xsl:template match="text()[normalize-space(.)='']" mode="as-xml-text"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   310
<xsl:template match="node()" mode="as-xml-text"><xsl:value-of select="."/></xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   311
<xsl:template match="comment()" mode="as-xml-text">&lt;--<xsl:value-of select="."/>--&gt;</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   312
<xsl:template match="@*" mode="as-xml-text">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   313
	<xsl:value-of select="concat(' ',name())"/>="<xsl:value-of select="."/>"</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   314
<xsl:template match="*" mode="as-xml-text">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   315
	<xsl:value-of select="concat('&lt;',name())"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   316
	<xsl:apply-templates select="@*" mode="as-xml-text"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   317
	<xsl:if test="self::meta and not(@rel)"> rel="Generic"</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   318
	<xsl:if test="self::meta and not(@type)"> type="auto"</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   319
	<xsl:text>&gt;</xsl:text>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   320
	<xsl:apply-templates select="node()" mode="as-xml-text"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   321
	<xsl:value-of select="concat('&lt;/',name(),'&gt;')"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   322
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   323
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   324
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   325
<xsl:template name="best-prev"><xsl:param name="cur" select="."/><xsl:param name="alt"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   326
<xsl:if test="$alt">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   327
<xsl:variable name="prev" select="$cur/preceding-sibling::*[@id][1]"/> 
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   328
<xsl:choose>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   329
	<xsl:when test="not($prev)"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   330
	<xsl:when test="$alt/preceding-sibling::*[@id=$prev/@id]"><xsl:value-of select="$prev/@id"/></xsl:when>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   331
	<xsl:otherwise>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   332
		<xsl:call-template name="best-prev">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   333
			<xsl:with-param name="cur" select="$prev"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   334
			<xsl:with-param name="alt" select="$alt"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   335
		</xsl:call-template>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   336
	</xsl:otherwise>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   337
</xsl:choose>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   338
</xsl:if>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   339
</xsl:template>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   340
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   341
<xsl:template match="layer | package | collection | component" mode="merge-models">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   342
	<xsl:param name="other"/>	<!-- the downstream item of the parent's rank that contains a potential items this is merged with -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   343
	<xsl:param name="up"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   344
	<xsl:param name="down"/>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   345
	<xsl:param name="replaces"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   346
	<xsl:variable name="this" select="."/>	<!-- current item -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   347
	<!-- match = this item in the downstream model -->	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   348
	<xsl:variable name="match" select="$other/*[@id=current()/@id]"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   349
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   350
	<xsl:choose>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   351
		<xsl:when test="$replaces[.=$this/@id] or (self::component and $match)">  <!-- replace the item instead of merge -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   352
			<xsl:message>Note: <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" in "<xsl:value-of select="../@id"/>" <xsl:choose>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   353
					<xsl:when test="self::component and $match">overridden in downstream sysdef</xsl:when>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   354
					<xsl:otherwise><xsl:for-each select="$replaces[.=$this/@id]/..">replaced by <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" in "<xsl:value-of select="../@id"/>"</xsl:for-each></xsl:otherwise>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   355
				</xsl:choose>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   356
			</xsl:message>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   357
			<!-- if the removed item is in the downstream doc, just copy that and ignore the upstream contents -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   358
			<xsl:apply-templates mode="merge-copy-of" select="$match">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   359
				<xsl:with-param name="origin" select="$down"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   360
				<xsl:with-param name="root" select="$this/ancestor::SystemDefinition"/>			
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   361
				<xsl:with-param name="replaces" select="$replaces"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   362
			</xsl:apply-templates>		
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   363
		</xsl:when>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   364
		<xsl:otherwise>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   365
			<!-- remove this if it's in the list of stuff to be replaced-->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   366
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   367
<xsl:variable name="prev-id">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   368
	<xsl:call-template name="best-prev">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   369
		<xsl:with-param name="alt" select="$match"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   370
	</xsl:call-template>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   371
</xsl:variable>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   372
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   373
	<!-- prev = the previous item before the current one (no metas, only named items)-->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   374
	<xsl:variable name="prev" select="preceding-sibling::*[@id=$prev-id]"/> 
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   375
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   376
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   377
	<!-- copy all items between this and prev that are solely in the downstream model -->	 		
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   378
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   379
	<!-- <xsl:variable name="upstream-ids" select="ancestor::SystemDefinition//@id[parent::component or parent::collection or parent::package or parent::layer]"/> -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   380
	<xsl:variable name="upstream-ids" select="../*/@id"/> <!-- this is much faster than using all IDs. before only currently works in the same parent anyway -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   381
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   382
	<!-- $upstream-ids is used to avoid inserting an item that's being moved -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   383
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   384
	<xsl:choose>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   385
		<xsl:when test="$match and $prev">
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   386
			<xsl:call-template name="copy-sorted-content">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   387
				<xsl:with-param name="base" select="../*[@id]"/>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   388
				<xsl:with-param name="to-sort" select="$other/*[@id and not(@before=$upstream-ids)][following-sibling::*[@id=$match/@id]][preceding-sibling::*[@id=$prev/@id]]"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   389
				<xsl:with-param name="start" select="$prev"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   390
				<xsl:with-param name="end" select="."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   391
				<xsl:with-param name="down" select="$down"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   392
			</xsl:call-template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   393
		</xsl:when>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   394
		<xsl:when test="$match and not($prev)">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   395
			<xsl:call-template name="copy-sorted-content">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   396
				<xsl:with-param name="base" select="../*[@id]"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   397
				<xsl:with-param name="to-sort" select="$other/*[@id and not(@before=$upstream-ids)][following-sibling::*[@id=$match/@id]]"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   398
				<xsl:with-param name="start" select="$prev"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   399
				<xsl:with-param name="end" select="."/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   400
				<xsl:with-param name="down" select="$down"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   401
			</xsl:call-template>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   402
		</xsl:when>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   403
	</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   404
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   405
 	<!-- just copy anything identified as being before this, assume they're all ok -->
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   406
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   407
	<xsl:apply-templates mode="merge-copy-of" select="$other/*[@before=current()/@id]">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   408
		<xsl:with-param name="remove-before" select="1"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   409
		<xsl:with-param name="origin" select="$down"/>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   410
		<xsl:with-param name="root" select="$this/ancestor::SystemDefinition"/>	
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   411
		<xsl:with-param name="replaces" select="$replaces"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   412
	</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   413
	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   414
	<xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   415
		<xsl:apply-templates select="@*" mode="merge-models"> <!-- copy upstream attributes -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   416
			<xsl:with-param name="other" select="$match"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   417
		</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   418
		
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   419
		<xsl:if test="self::component and not(@origin-model) and $up/@name">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   420
			<!-- insert origin-model and optional root for components only -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   421
			<xsl:attribute name="origin-model">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   422
				<xsl:value-of select="$up/@name"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   423
			</xsl:attribute>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   424
			<xsl:if test="not(@root)">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   425
				<xsl:copy-of select="$up/@root"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   426
			</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   427
		</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   428
		
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   429
		<xsl:for-each select="$match/@*[name()!='replace']">  <!-- copy downstream attributes, only if not set on upstream -->
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   430
			<xsl:if test="not($this/@*[name()=name(current())])"><xsl:copy-of select="."/></xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   431
		</xsl:for-each>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   433
		<xsl:if test="$match/@replace"> <!-- check replace separately -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   434
			<xsl:if test="not($this/ancestor::SystemDefinition//*[(self::component or self::collection or self::package or self::layer) and $match/@replace=@id])">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   435
				<!-- only remove replace if it's been used -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   436
				<xsl:copy-of select="$match/@replace"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   437
			</xsl:if>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   438
		</xsl:if>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   439
		
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   440
		<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   441
			<xsl:when test="self::component">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   442
				<!-- copy all units, metas and comments from this
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   443
					copy all metas in the merged component
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   444
					copy any new comments in the merged component (not duplicates)
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   445
					if there are no units in the this, copy all units in the merged component
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   446
					if there are units in this, copy only the versioned units in the merged component (only those versions not already specified) -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   447
				<xsl:copy-of select="*|comment() | $match/meta |$match/unit[not($this/unit)] | $match/unit[$this/unit and @version[.!=$this/unit/@version]] | $match/comment()[.!=$this/comment()]"/>				
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   448
			</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   449
			<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   450
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   451
				<!--  copy metas and comments in between meta. Do not try to merge metadata between models -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   452
				<xsl:apply-templates select="meta | $match/meta | comment()[following-sibling::meta]" mode="merge-data">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   453
					<xsl:with-param name="metas" select="$match/meta"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   454
				</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   455
				<xsl:copy-of select=" $match/meta | $match/comment()[following-sibling::meta]"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   456
				
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   457
				<xsl:apply-templates mode="merge-models">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   458
					<xsl:with-param name="other" select="$match"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   459
					<xsl:with-param name="up" select="$up"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   460
					<xsl:with-param name="down" select="$down"/>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   461
					<xsl:with-param name="replaces" select="$replaces"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   462
				</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   463
				<!--  don't copy if explicitly or implicitly placed already-->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   464
				<xsl:for-each select="$match/*[not(@before) and not(following-sibling::*[@id=$this/*/@id])]">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   465
					<xsl:if test="not($this/*[@id=current()/@id])">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   466
						<xsl:apply-templates mode="merge-copy-of" select=".">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   467
							<xsl:with-param name="origin" select="$down"/>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   468
							<xsl:with-param name="root" select="$this/ancestor::SystemDefinition"/>			
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   469
							<xsl:with-param name="replaces" select="$replaces"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   470
						</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   471
					</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   472
				</xsl:for-each>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   473
			</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   474
		</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   475
	</xsl:copy>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   476
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   477
		</xsl:otherwise>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   478
	</xsl:choose>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   479
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   480
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   481
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   482
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   483
<xsl:template match="*" mode="merge-copy-of">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   484
	<xsl:param name="remove-before" select="0"/> <!-- set to true if any before attribute is to be removed -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   485
	<xsl:param name="origin"/>	<!--the element containing the @name to use the origin-model attribute  -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   486
	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   487
	<xsl:param name="replaces" select="ancestor::SystemDefinition/descendant::*[(self::component or self::collection or self::package or self::layer) and not(ancestor::meta)]/@replace"/> <!-- recalculate this is necessarfy, but should just pass down as a param -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   488
	<xsl:variable name="moved" select="$root/descendant::*[name()=name(current()/..) and @id!=current()/../@id]/*[@id=current()/@id]"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   489
	<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   490
		<!-- this might slow things down, consider making optional -->
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   491
		<xsl:when test="not(self::layer) and (count($moved) and not($moved[ancestor-or-self::*/@id=$replaces]) )">
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   492
			<xsl:message>Warning: <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" moved in downstream model. Ignoring moved <xsl:value-of select="name()"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   493
				<xsl:text>&#xa;</xsl:text>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   494
			</xsl:message>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   495
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   496
		<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   497
			<!-- save all content in a variable to test to see if it's got any problems (ie been removed due to errors)-->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   498
			<xsl:variable name="content">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   499
				<xsl:apply-templates select="*|comment()" mode="merge-copy-of">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   500
					<xsl:with-param name="origin" select="$origin"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   501
					<xsl:with-param name="root" select="$root"/>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   502
					<xsl:with-param name="replaces" select="$replaces"/>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   503
				</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   504
			</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   505
			<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   506
				<!-- if all elements in this have been deleted, throw out this element -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   507
				<xsl:when test="not(exslt:node-set($content)/*) and *">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   508
					<xsl:message>Warning: All content in downstream <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" is invalid. Ignoring <xsl:value-of select="name()"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   509
						<xsl:text>&#xa;</xsl:text>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   510
					</xsl:message>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   511
				</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   512
				<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   513
					<xsl:copy>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   514
						<xsl:call-template name="merge-copy-of-atts">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   515
							<xsl:with-param name="remove-before" select="$remove-before"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   516
							<xsl:with-param name="root" select="$root"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   517
						</xsl:call-template>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   518
						<xsl:copy-of select="exslt:node-set($content)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   519
					</xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   520
				</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   521
			</xsl:choose>					
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   522
		</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   523
	</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   524
</xsl:template>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   525
<xsl:template match="comment()|@*" mode="merge-copy-of">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   526
	<xsl:copy-of select="."/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   527
</xsl:template>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   528
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   529
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   530
<xsl:template name="merge-copy-of-atts">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   531
	<xsl:param name="remove-before" select="0"/> <!-- set to true if any before attribute is to be removed -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   532
	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   533
	
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   534
	<xsl:choose>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   535
		<xsl:when test="$remove-before">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   536
			<xsl:copy-of select="@*[name()!='before' and name()!='replace']"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   537
		</xsl:when>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   538
		<xsl:otherwise><xsl:copy-of select="@*[name()!='replace']"/></xsl:otherwise>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   539
	</xsl:choose>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   540
	<xsl:if test="@replace and not($root/descendant::*[(self::component or self::collection or self::package or self::layer) and @id=current()/@replace])">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   541
		<!-- only include replace if it's not been used -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   542
		<xsl:copy-of select="@replace"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   543
	</xsl:if>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   544
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   545
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   546
<xsl:template match="component" mode="merge-copy-of">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   547
	<xsl:param name="remove-before" select="0"/> <!-- set to true if any before attribute is to be removed -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   548
	<xsl:param name="origin"/>	<!--the element containing the @name to use the origin-model attribute  -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   549
	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   550
	<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   551
		<!-- this might slow things down, consider making optional -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   552
		<xsl:when test="$root/descendant::collection[@id!=current()/../@id]/component[@id=current()/@id]">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   553
			<xsl:message>Warning: <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" moved in downstream model. Ignoring moved <xsl:value-of select="name()"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   554
				<xsl:text>&#xa;</xsl:text>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   555
			</xsl:message>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   556
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   557
		<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   558
			<xsl:copy>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   559
				<xsl:call-template name="merge-copy-of-atts">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   560
					<xsl:with-param name="remove-before" select="$remove-before"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   561
					<xsl:with-param name="root" select="$root"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   562
				</xsl:call-template>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   563
				<xsl:if test="not(@origin-model) and $origin/@name">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   564
					<xsl:attribute name="origin-model">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   565
						<xsl:value-of select="$origin/@name"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   566
					</xsl:attribute>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   567
					<xsl:if test="not(@root)">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   568
						<xsl:copy-of select="$origin/@root"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   569
					</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   570
				</xsl:if>
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   571
				<xsl:apply-templates select="*|comment()" mode="merge-copy-of">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   572
					<xsl:with-param name="origin" select="$origin"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   573
					<xsl:with-param name="root" select="$root"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   574
				</xsl:apply-templates>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   575
			</xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   576
		</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   577
	</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   578
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   579
432
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   580
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   581
<xsl:template match="unit" mode="merge-copy-of">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   582
	<xsl:param name="origin"/>	<!--the element containing the @name to use the origin-model attribute  -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   583
	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   584
	<xsl:copy>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   585
				<xsl:apply-templates select="@*" mode="merge-copy-of">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   586
					<xsl:with-param name="origin" select="$origin"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   587
					<xsl:with-param name="root" select="$root"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   588
				</xsl:apply-templates>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   589
	</xsl:copy>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   590
</xsl:template>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   591
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   592
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   593
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   594
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   595
<xsl:template match="meta" mode="merge-copy-of">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   596
	<xsl:param name="origin"/>	<!--the element containing the @name to use the origin-model attribute  -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   597
	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   598
	<xsl:copy>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   599
		<xsl:apply-templates select="@*" mode="merge-copy-of">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   600
			<xsl:with-param name="origin" select="$origin"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   601
			<xsl:with-param name="root" select="$root"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   602
		</xsl:apply-templates>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   603
		<xsl:copy-of select="node()"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   604
	</xsl:copy>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   605
</xsl:template>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   606
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   607
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   608
<xsl:template match="unit/@bldFile | unit/@mrp | unit/@base | meta/@href" mode="merge-copy-of">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   609
	<xsl:param name="origin" select="/.."/>	<!--the element containing the @name to use the origin-model attribute  -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   610
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   611
	<xsl:attribute name="{name()}">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   612
		<xsl:choose>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   613
			<xsl:when test="not($origin/@pathto)"><xsl:value-of select="."/></xsl:when>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   614
			<xsl:when test="(contains(.,'://') and not(contains(substring-before(.,'://'),'/'))) or starts-with(.,'/')"> <!-- absolute URI or absolute path-->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   615
				<xsl:value-of select="."/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   616
			</xsl:when>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   617
			<xsl:when test="contains($origin/@pathto,'://') and not(contains(substring-before($origin/@pathto,'://'),'/'))"> <!-- absolute URI for downstream sysdef not valif for unit paths, just copy and raise warning-->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   618
				<xsl:message>ERROR: Could not resolve relative path in downstream file: <xsl:value-of select="."/> relative to absolute URI <xsl:value-of select="$origin/@pathto"/></xsl:message>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   619
				<xsl:value-of select="."/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   620
			</xsl:when>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   621
		<xsl:otherwise> <!-- relative link -->
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   622
			<xsl:call-template name="joinpath">
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   623
				<xsl:with-param name="file" select="$origin/@pathto"/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   624
				<xsl:with-param name="rel" select="."/>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   625
			</xsl:call-template>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   626
		</xsl:otherwise>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   627
		</xsl:choose>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   628
	</xsl:attribute>
0f44a943faf9 System model generator bug fixes for merging and dependencies. Support for 3.0.1 syntax. Catch up with sysdeftools.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 165
diff changeset
   629
</xsl:template>
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   630
</xsl:stylesheet>