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