sysdeftools/joinsysdef-module.xsl
author Bob Rosenberg <bob.rosenberg@nokia.com>
Thu, 06 May 2010 16:31:38 +0100
branchHighFidelityModel
changeset 201 280dc2a9385b
parent 164 8309dda95234
child 259 fbf606da2044
permissions -rw-r--r--
Extra warnings, help and bug fixes in sysdeftools perl scripts. Support for 3.0.1 sysdef syntax (replacing when merging)
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
<?xml version="1.0"?>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     2
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     3
 	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
     4
<!--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
     5
	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
     6
	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
     7
	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
     8
	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
     9
	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
    10
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    11
	Initial Contributors:
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    12
	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
    13
	Contributors:
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    14
	Description:
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    15
	XSLT module which contains the logic to join a system definition file
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    16
-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    17
	<!-- save SF namespace as a constant to avoid the risk of typos-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    18
 <xsl:variable name="defaultns">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
    19
 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    20
<!-- create a stand-alone sysdef from a linked set of fragments -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    21
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    22
<xsl:template match="/*" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    23
	<xsl:message terminate="yes">ERROR: Cannot process this document</xsl:message>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    24
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    25
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
    26
<!-- anything in schemas 3.0.x won't add new functional attributes that need processing here, just blindly copy them-->
151
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    27
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
    28
<xsl:template match="/SystemDefinition[starts-with(@schema,'3.0.') and count(*)=1]" mode="join">
151
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    29
	<xsl:param name="origin" select="/.."/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    30
	<xsl:param name="root"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    31
	<xsl:param name="filename"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    32
	<xsl:param name="namespaces"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    33
	<xsl:param name="data" select="/.."/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    34
	<xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    35
		<xsl:when test="$origin">	<!-- this sysdef fragment was linked from a parent sysdef -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    36
			<xsl:for-each select="*"> <!-- can be only one -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    37
				<xsl:variable name="upid"><xsl:apply-templates select="$origin/@id" mode="my-id"/></xsl:variable>		<!-- namespaceless ID of this in parent doc -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    38
				<xsl:variable name="id"><xsl:apply-templates select="@id" mode="my-id"/></xsl:variable>						<!-- namespaceless ID of this here -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    39
				<xsl:variable name="upns"><xsl:apply-templates select="$origin/@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace in parent doc -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    40
				<xsl:variable name="ns"><xsl:apply-templates select="@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    41
				<xsl:if test="$id!=$upid or $ns!=$upns">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    42
					<xsl:message terminate="yes">ERROR: Linked ID "<xsl:value-of select="$id"/>" (<xsl:value-of select="$ns"/>) must match linking document "<xsl:value-of select="$upid"/>" (<xsl:value-of select="$upns"/>)</xsl:message>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    43
				</xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    44
				<!-- copy any attributes not already defined (parent doc overrides child doc)-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    45
				<xsl:for-each select="@*">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    46
					<xsl:variable name="n" select="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:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    48
						<xsl:when test="$n='id'"/> <!-- never copy this, always set -->
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="$origin/@*[name()=$n]"> <!-- don't copy if already set -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    50
							<xsl:message>Cannot set "<xsl:value-of select="$n"/>", already set</xsl:message>
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>
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
    52
						<xsl:when test="$n='before' or $n='replace'">
151
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    53
							<!-- ensure ns is correct (if any future attribtues will ever use an ID, process it here too)-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    54
							<xsl:apply-templates select="." mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    55
								<xsl:with-param name="namespaces" select="$namespaces"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    56
							</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
    57
						</xsl:when> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    58
						<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- just copy anything else -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    59
					</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    60
				</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
    61
				<xsl:copy-of select="../namespace::*[not(.=$namespaces)]"/> <!-- set any namespaces not already set (they should all alreayd be, but some XSLT processors are quirky) -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    62
			 	<xsl:apply-templates select="$data" mode="overlay-attributes">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    63
					<xsl:with-param name="item" select="current()"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    64
				</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
    65
				<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
    66
					<xsl:apply-templates select="*|comment()" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    67
						<xsl:with-param name="root" select="$root"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    68
						<xsl:with-param name="filename" select="$filename"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    69
						<xsl:with-param name="data" select="$data"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    70
						<xsl:with-param name="namespaces" select="$namespaces | ../namespace::*[not(.=$namespaces)]"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    71
					</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
    72
				</xsl:variable>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    73
				<xsl:apply-templates select="." mode="is-content-filtered"> <!-- optionally add filtered="yes" if some content has been removed -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    74
					<xsl:with-param name="content" select="$content"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    75
				</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
    76
			 	<xsl:apply-templates select="$data" mode="overlay-meta">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    77
					<xsl:with-param name="item" select="current()"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    78
				</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
    79
				<xsl:copy-of select="$content"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    80
			</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
    81
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    82
		<xsl:when test="function-available('exslt:node-set')"> <!-- this is the root element of a root sysdef -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    83
			<!--try to put all namespaces in root element -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    84
			<xsl:variable name="nss">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    85
				<!-- contains node set of namespaces to add to root element.
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    86
					May panic if there are too many single-letter namespaces and this can't create a new one -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    87
				<xsl:call-template name="needed-namespaces">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    88
					<xsl:with-param name="foundns">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    89
						<xsl:apply-templates select="//*[(self::component or self::collection or self::package or self::layer) and @href]" mode="scan-for-namespaces"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    90
					</xsl:with-param>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    91
				</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
    92
			</xsl:variable>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    93
			<xsl:variable name="ns" select="@id-namespace | namespace::* | exslt:node-set($nss)/*"/>
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
    94
			<xsl:copy><xsl:copy-of select="@*[name()!='schema']"/><xsl:call-template name="set-schema"/>
151
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    95
				<xsl:apply-templates select="self::*[not(@id-namespace)]" mode="add-id-ns"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    96
				<xsl:for-each select="exslt:node-set($nss)/*"> <!-- add namespace definitions -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    97
					<xsl:attribute name="xmlns:{name()}">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    98
						<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
    99
					</xsl:attribute>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   100
				</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
   101
				<!-- no need to call is-content-filtered, it never will be from this element --> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   102
				<xsl:apply-templates select="*|comment()" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   103
					<xsl:with-param name="namespaces" select="$ns"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   104
					<xsl:with-param name="root" select="$root"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   105
					<xsl:with-param name="data" select="$data"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   106
					<xsl:with-param name="filename" select="$filename"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   107
				</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
   108
			</xsl:copy>
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>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   110
		<xsl:otherwise> <!-- can't handle node-set() so put the namespaces in the document instead of the root element-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   111
			<xsl:variable name="ns" select="@id-namespace | namespace::*"/>
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
   112
			<xsl:copy><xsl:copy-of select="@*[name()!='schema']"/><xsl:call-template name="set-schema"/>
151
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   113
				<!-- no need to call is-content-filtered, it never will be from this element -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   114
				<xsl:apply-templates select="*|comment()" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   115
					<xsl:with-param name="namespaces" select="$ns"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   116
					<xsl:with-param name="root" select="$root"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   117
					<xsl:with-param name="data" select="$data"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   118
					<xsl:with-param name="filename" select="$filename"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   119
				</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
   120
			</xsl:copy>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   121
		</xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   122
	</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   123
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   124
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   125
<xsl:template match="*" mode="scan-for-namespaces"/> <!-- just in case of errors, consider replacing by terminate -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   126
<xsl:template match="*[@href and not(self::meta)]" mode="scan-for-namespaces">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   127
	<!-- produce a list of namespace-prefix namespace pairs separated by newlines, in reverse order found in documents 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   128
		reverse order so we can try to use the first namespace prefix defined if it's available-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   129
	<xsl:for-each select="document(@href,.)/*">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   130
		<xsl:apply-templates select="//*[(self::component or self::collection or self::package or self::layer) and @href]" mode="scan-for-namespaces"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   131
		<xsl:for-each select="//namespace::* | @id-namespace">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   132
			<xsl:value-of select="concat(name(),' ',.,'&#xa;')"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   133
		</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
   134
	</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
   135
</xsl:template>
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:template name="needed-namespaces">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   138
	<xsl:param name="foundns"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   139
	<xsl:param name="usedpre"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   140
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   141
	<xsl:if test="$foundns!=''">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   142
		<xsl:variable name="line" select="substring-before($foundns,'&#xa;')"/> <!-- always has trailing newline -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   143
		<xsl:variable name="name" select="substring-after($line,' ')"/> <!-- namespace prefix -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   144
		<xsl:variable name="remainder" select="substring-after($foundns,'&#xa;')"/>
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="newprefix">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   146
			<xsl:if test="not(contains(concat('&#xa;',$remainder),concat('&#xa;',$line,'&#xa;'))) and
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   147
				not(//namespace::*[.=$name] or @id-namespace[.=$name] or (not(@id-namespace) and $defaultns=$name))">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   148
						<xsl:apply-templates select="." 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
   149
							<xsl:with-param name="ns" select="$name"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   150
							<xsl:with-param name="pre" select="substring-before($line,' ')"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   151
							<xsl:with-param name="dontuse" select="$usedpre"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   152
						</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
   153
			</xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   154
		</xsl:variable>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   155
		<xsl:if test="$newprefix!=''">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   156
			<!-- can treat this as if it were a namespace node -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   157
			<xsl:element name="{$newprefix}">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   158
				<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
   159
			</xsl:element>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   160
		</xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   161
		<xsl:if test="$remainder!=''">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   162
			<xsl:call-template name="needed-namespaces">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   163
				<xsl:with-param name="foundns" select="$remainder"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   164
				<xsl:with-param name="usedpre" select="concat($usedpre,' ',$newprefix,' ')"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   165
			</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
   166
		</xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   167
	</xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   168
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   169
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   170
<xsl:template match="/SystemDefinition" 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
   171
	<!-- should be able to replace this with mechanism that uses the XSLT processor's own ability to generate namespaces -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   172
	<xsl:param name="ns"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   173
	<xsl:param name="pre"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   174
	<xsl:param name="dontuse"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   175
	<xsl:param name="chars">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</xsl:param>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   176
	<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
   177
	<xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   178
		<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
   179
			<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
   180
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   181
		<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
   182
			<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
   183
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   184
		<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
   185
		<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
   186
			<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
   187
				<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
   188
			</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
   189
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   190
		<xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   191
			<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
   192
		</xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   193
	</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   194
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   195
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   196
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
   197
<!-- schema handling -->
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
   198
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
   199
<xsl:template name="set-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
   200
<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
   201
	<xsl:apply-templates mode="my-schema" select="/SystemDefinition"/>
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: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
   203
</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
   204
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
   205
<xsl:template name="compare-versions"><xsl:param name="v1"/><xsl:param name="v2"/>
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
   206
			<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
   207
				<xsl:when test="$v1=$v2"><xsl:value-of select="$v1"/></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
   208
				<xsl:when test="substring-before($v1,'.') &gt; substring-before($v2,'.')"><xsl:value-of select="$v1"/></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
   209
				<xsl:when test="substring-before($v1,'.') &lt; substring-before($v2,'.')"><xsl:value-of select="$v2"/></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
   210
				<xsl:when test="substring-before(substring-after($v1,'.'),'.') &gt; substring-before(substring-after($v2,'.'),'.')"><xsl:value-of select="$v1"/></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
   211
				<xsl:when test="substring-before(substring-after($v1,'.'),'.') &lt; substring-before(substring-after($v2,'.'),'.')"><xsl:value-of select="$v2"/></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
   212
				<xsl:when test="substring-after(substring-after($v1,'.'),'.') &gt; substring-after(substring-after($v2,'.'),'.')"><xsl:value-of select="$v1"/></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
   213
				<xsl:when test="substring-after(substring-after($v1,'.'),'.') &lt; substring-after(substring-after($v2,'.'),'.')"><xsl:value-of select="$v2"/></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
   214
				<xsl:otherwise><xsl:value-of select="$v1"/></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
   215
			</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
   216
</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
   217
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
   218
<xsl:template name="compare-version-list"><xsl:param name="list"/>
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
   219
	<xsl:variable name="cur" select="substring-before($list,' ')"/>
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
   220
	<xsl:variable name="remaining" select="substring-after($list,' ')"/>
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
   221
	<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
   222
		<xsl:when test="$remaining=''"><xsl:value-of select="$cur"/></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
   223
		<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
   224
			<xsl:variable name="nextbig">
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
   225
				<xsl:call-template name="compare-version-list">
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
   226
					<xsl:with-param name="list" select="$remaining"/>
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
   227
				</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
   228
			</xsl:variable>
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
   229
			<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
   230
				<xsl:with-param name="v1" select="$cur"/>
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
   231
				<xsl:with-param name="v2" select="$nextbig"/>
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
   232
			</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
   233
		</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
   234
	</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
   235
</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
   236
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
   237
<xsl:template match="/SystemDefinition" mode="my-schema"><xsl:param name="biggest" 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
   238
	<xsl:variable name="linked" select="//*[(self::component or self::collection or self::package or self::layer) and @href]"/>
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
   239
	<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
   240
		<xsl:when test="not($linked)"> <!-- no need to go further -->
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
   241
			<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
   242
				<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
   243
				<xsl:with-param name="v2" select="$biggest"/>
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
   244
			</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
   245
		</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
   246
		<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
   247
				<xsl:call-template name="compare-version-list">
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
   248
					<xsl:with-param name="list">
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
   249
						<xsl:for-each select="$linked">
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
   250
						<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
   251
							<xsl:with-param name="v1">
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
   252
								<xsl:apply-templates mode="my-schema" select="document(@href,.)/*"/>
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
   253
							</xsl:with-param>
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
   254
							<xsl:with-param name="v2" select="$biggest"/>
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
   255
						</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
   256
						<xsl:text> </xsl:text>
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
   257
					</xsl:for-each>
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
   258
				</xsl:with-param>
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
   259
				</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
   260
		</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
   261
	</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
   262
</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
   263
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
   264
151
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   265
<xsl:template match="unit" mode="join">	<xsl:param name="root"/><xsl:param name="filename"/><xsl:param name="data"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   266
	 <xsl:variable name="display">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   267
	 	<xsl:apply-templates select="$data" mode="filter">
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="item" select="current()"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   269
		</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
   270
	 </xsl:variable>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   271
	 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   272
	 <xsl:if test="$display != 'hide' "> <!-- if hide, remove completely from the output-->	 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   273
		<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
   274
			<xsl:apply-templates select="@*" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   275
				<xsl:with-param name="root" select="$root"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   276
				<xsl:with-param name="filename" select="$filename"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   277
			</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
   278
		</xsl:element>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   279
	</xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   280
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   281
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   282
<!-- override mode="meta" to translate metadata sections. By default, include -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   283
<xsl:template match="meta" priority="2" mode="join"><xsl:param name="data"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   284
	 <xsl:variable name="display">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   285
	 	<xsl:apply-templates select="$data" mode="filter">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   286
			<xsl:with-param name="item" select="current()"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   287
		</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
   288
	 </xsl:variable>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   289
	 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   290
	<xsl:if test="$display != 'hide' "> <!-- if hide, remove completely from the output-->	
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 select="." mode="meta"> 
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="display" select="$display"/>
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="data" select="$data"/>
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:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   297
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   298
<xsl:template match="meta[@rel='link-mapping']" priority="3" mode="join"/> <!--these are only used in the joining process, so remove from output -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   299
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   300
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   301
<xsl:template match="*" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   302
	<xsl:param name="root"/><xsl:param name="filename"/><xsl:param name="namespaces"/><xsl:param name="data"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   303
	<!-- get attribtues from overlay -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   304
	<!-- test for presence, if filtered out, just return -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   305
	<!-- test for children, if it has some, but they're filtered out, either return or leave as empty, dependening on filter rule
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   306
		if had items and now has none, options:
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   307
			still has meta: keep / delete
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   308
			still has comments: keep / delete 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   309
	 -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   310
	 <xsl:variable name="display">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   311
	 	<xsl:apply-templates select="$data" mode="filter">
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="item" select="current()"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   313
		</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
   314
	 </xsl:variable>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   315
	 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   316
	 <xsl:if test="$display != 'hide' "> <!-- if hide, remove completely from the output-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   317
		 <xsl:variable name="href">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   318
		 	<xsl:apply-templates select="." mode="link">
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="data" select="$data"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   320
			</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
   321
		 </xsl:variable>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   322
	 		 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   323
		<xsl:element name="{name()}"> <!-- use this instead of <copy> so xalan doesn't add extra wrong namespaces -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   324
			<xsl:apply-templates select="@*" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   325
				<xsl:with-param name="namespaces" select="$namespaces"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   326
			</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
   327
			<xsl:if test="$display != '' ">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   328
				<!-- custom attribute to indicate how this is to be represented. Blank indicates normal, hide removes from the output (see above), anything else is put in the attribute --> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   329
				<xsl:attribute name="display"><xsl:value-of select="$display"/></xsl:attribute>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   330
			</xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   331
		 	<xsl:apply-templates select="$data" mode="overlay-attributes">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   332
				<xsl:with-param name="item" select="current()"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   333
			</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
   334
			<xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   335
				<xsl:when test="$href !='' ">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   336
					<xsl:variable name="prefixmap" select="ancestor::SystemDefinition/*/meta[@rel='link-mapping']/map-prefix[starts-with($href,@link)]"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   337
					<xsl:variable name="origin" select="."/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   338
					<xsl:apply-templates select="document($href,.)/*" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   339
						<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
   340
						<xsl:with-param name="data" select="$data"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   341
						<xsl:with-param name="namespaces" select="$namespaces"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   342
						<xsl:with-param name="filename">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   343
							<xsl:call-template name="joinpath">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   344
								<xsl:with-param name="file" select="$filename"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   345
								<xsl:with-param name="rel">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   346
									<xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   347
										<xsl:when test="$prefixmap">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   348
											<xsl:value-of select="$prefixmap/@to"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   349
											<xsl:value-of select="substring-after($href,$prefixmap/@link)"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   350
										</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   351
										<xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   352
											<xsl:value-of select="$href"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   353
										</xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   354
									</xsl:choose>								
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   355
								 </xsl:with-param>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   356
							</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
   357
						</xsl:with-param>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   358
						<xsl:with-param name="root">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   359
							<xsl:value-of select="$root"/>/<xsl:call-template name="lastbefore">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   360
								<xsl:with-param name="string" select="$href"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   361
							</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
   362
						</xsl:with-param>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   363
					</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
   364
				</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   365
				<xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   366
					<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
   367
						<xsl:apply-templates select="*|comment()" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   368
							<xsl:with-param name="root" select="$root"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   369
							<xsl:with-param name="filename" select="$filename"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   370
							<xsl:with-param name="namespaces" select="$namespaces"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   371
							<xsl:with-param name="data" select="$data"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   372
						</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
   373
					</xsl:variable>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   374
					<xsl:apply-templates select="." mode="is-content-filtered"> <!-- add filtered="yes" if some content has been removed -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   375
						<xsl:with-param name="content" select="$content"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   376
					</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
   377
				 	<xsl:apply-templates select="$data" mode="overlay-meta">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   378
						<xsl:with-param name="item" select="current()"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   379
					</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
   380
					<xsl:copy-of select="$content"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   381
				</xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   382
			</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   383
		</xsl:element>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   384
	</xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   385
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   386
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   387
<!-- By default, do nothing. Can override template to add filtered="yes" if need to track what's a placeholder and what's been filtered 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   388
	implement with param name="content"
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   389
-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   390
<xsl:template mode="is-content-filtered" match="*" priority="-2"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   391
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   392
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   393
<xsl:template match="@mrp[starts-with(.,'/')] | @bldFile[starts-with(.,'/')] | @base[starts-with(.,'/')]" mode="join">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   394
	<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
   395
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   396
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   397
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   398
<xsl:template match="@mrp|@bldFile|@base" mode="join">	<xsl:param name="root"/><xsl:param name="filename"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   399
	<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
   400
		<xsl:call-template name="joinpath">
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="file" select="$filename"/>
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="rel" 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:call-template>	
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   404
	</xsl:attribute>	
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   405
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   406
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   407
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   408
<xsl:template match="@href" mode="join"/> <!--never copy this into the generated doc, that's the whole point of this module -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   409
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   410
<xsl:template match="@*" mode="my-namespace"> <!-- the namespace of an ID -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   411
	<xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   412
		<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
   413
			<xsl:value-of select="ancestor::*/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
   414
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   415
		<xsl:when test="/SystemDefinition/@id-namespace">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   416
			<xsl:value-of select="/SystemDefinition/@id-namespace"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   417
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   418
		<xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   419
			<xsl:value-of select="$defaultns"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   420
		</xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   421
	</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   422
</xsl:template>
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:template match="@*" mode="my-id"> <!-- the ID with namespace prefix removed -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   426
	<xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   427
		<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
   428
			<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
   429
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   430
		<xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   431
			<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
   432
		</xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   433
	</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   434
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   435
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   436
<xsl:template match="*" mode="err-path">
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 test="../@id">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   438
	<xsl:apply-templates select=".." mode="err-path"/>/</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
<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
   440
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   441
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   442
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
<xsl:template match="@id|@before|@replace" mode="join">
151
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   444
	<xsl:param name="namespaces"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   445
	<!-- this will change the namespace prefixes for all IDs to match the root document -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   446
	<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
   447
		<xsl:apply-templates select="." mode="my-namespace"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   448
	</xsl:variable>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   449
	<xsl:if test="$ns=''">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   450
		<xsl:message terminate="yes">ERROR: Could not find namespace for <xsl:value-of select="name()"/> "<xsl:value-of select="."/>" in <xsl:apply-templates select="../.." mode="err-path"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   451
		<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
   452
		</xsl:message>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   453
	</xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   454
	<xsl:variable name="prefix" select="name($namespaces[.=$ns])"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   455
	<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
   456
	<xsl:choose>
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
   457
		<xsl:when test="$prefix = 'id-namespace' or  (not($namespaces[name()='id-namespace']) and $ns=$defaultns)"/> <!-- it's the default namespace, no prefix -->
151
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   458
		<xsl:when test="$prefix='' and contains(.,':')">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   459
			<!-- complex: copy id and copy namespace (namespace should be copied already)-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   460
			<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
   461
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   462
		<xsl:when test="$prefix='' and $ns=$defaultns"/> <!-- no prefix and it's the default --> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   463
		<xsl:when test="$prefix!=''">			<!-- just change the prefix -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   464
			<xsl:value-of select="concat($prefix,':')"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   465
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   466
		<xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   467
		<xsl:message terminate="yes">ERROR: Joining error in resolving namespace for <xsl:value-of select="name()"/> "<xsl:value-of select="."/>" in <xsl:apply-templates select="../.." mode="err-path"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   468
		<xsl:text>&#xa;</xsl:text></xsl:message>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   469
		</xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   470
	</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   471
		<xsl:apply-templates select="." mode="my-id"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   472
	</xsl:attribute>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   473
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   474
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   475
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   476
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   477
<xsl:template match="@*|comment()" mode="join"><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
   478
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   479
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   480
<!-- path handling follows -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   481
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   482
 <xsl:template name="lastbefore"><xsl:param name="string"/><xsl:param name="substr" select="'/'"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   483
        <xsl:if test="contains($string,$substr)">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   484
                <xsl:value-of select="substring-before($string,$substr)"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   485
                <xsl:if test="contains(substring-after($string,$substr),$substr)">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   486
	                <xsl:value-of select="$substr"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   487
	              </xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   488
        <xsl:call-template name="lastbefore">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   489
                <xsl:with-param name="string" select="substring-after($string,$substr)"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   490
                <xsl:with-param name="substr" select="$substr"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   491
        </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
   492
        </xsl:if>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   493
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   494
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   495
 <xsl:template name="joinpath"><xsl:param name="file"/><xsl:param name="rel"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   496
	<xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   497
		<xsl:when test="(contains($rel,'://') and not(contains(substring-before($rel,'://'),'/'))) or starts-with($rel,'/')"> <!-- absolute URI or absolute path-->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   498
			<xsl:value-of select="$rel"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   499
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   500
		<xsl:otherwise> <!-- relative link -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   501
			<xsl:call-template name="reducepath">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   502
				<xsl:with-param name="file">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   503
					<xsl:call-template name="lastbefore">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   504
						<xsl:with-param name="string" select="$file"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   505
					</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
   506
					<xsl:text>/</xsl:text>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   507
					<xsl:value-of select="$rel"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   508
				</xsl:with-param>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   509
			</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
   510
		</xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   511
	</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   512
 </xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   513
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   514
<xsl:template name="reducepath"><xsl:param name="file"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   515
	<xsl:call-template name="reducedotdotpath">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   516
    	<xsl:with-param name="file">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   517
			<xsl:call-template name="reducedotpath">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   518
		    	<xsl:with-param name="file" select="$file"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   519
		    </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
   520
		</xsl:with-param>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   521
	</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
   522
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   523
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   524
<xsl:template name="reducedotdotpath"><xsl:param name="file"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   525
	<xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   526
		<xsl:when test="starts-with($file,'../')">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   527
			<xsl:text>../</xsl:text>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   528
			<xsl:call-template name="reducedotdotpath">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   529
        		<xsl:with-param name="file" select="substring($file,4)"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   530
			</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
   531
		</xsl:when>
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 test="contains($file,'/../')">							
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   533
			<xsl:call-template name="reducepath">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   534
        		<xsl:with-param name="file">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   535
			        <xsl:call-template name="lastbefore">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   536
			                <xsl:with-param name="string" select="substring-before($file,'/../')"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   537
			        </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
   538
			        <xsl:text>/</xsl:text>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   539
					<xsl:value-of select="substring-after($file,'/../')"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   540
				</xsl:with-param>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   541
			</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
   542
		</xsl:when>
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><xsl:value-of select="$file"/></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
<xsl:template name="reducedotpath"><xsl:param name="file"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   548
	<xsl:choose>	
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   549
		<xsl:when test="starts-with($file,'./')">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   550
			<xsl:call-template name="reducedotpath">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   551
        		<xsl:with-param name="file" select="substring($file,3)"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   552
			</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
   553
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   554
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   555
		<xsl:when test="contains($file,'/./')">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   556
			<xsl:call-template name="reducepath">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   557
        		<xsl:with-param name="file">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   558
	                <xsl:value-of select="substring-before($file,'/./')"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   559
			        <xsl:text>/</xsl:text>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   560
					<xsl:value-of select="substring-after($file,'/./')"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   561
				</xsl:with-param>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   562
			</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
   563
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   564
		<xsl:when test="substring($file,string-length($file) - 1) = '/.'">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   565
           <xsl:value-of select="substring($file,1,string-length($file) - 2)"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   566
		</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   567
		<xsl:otherwise><xsl:value-of select="$file"/></xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   568
	</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   569
 </xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   570
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   571
<!-- overridable templates follow -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   572
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   573
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   574
<xsl:template match="*" mode="filter" priority="-9"/> <!-- by default show --> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   575
<xsl:template match="*" mode="overlay-attributes" priority="-9"/> <!-- by default do nothing --> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   576
<xsl:template match="*" mode="overlay-meta" priority="-9"/> <!-- by default do nothing --> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   577
<xsl:template match="/SystemDefinition" mode="add-id-ns" priority="-9"/> <!-- some tools may have an easier job if this were always present, but, by default, assume it can just stay implied -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   578
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   579
<xsl:template match="*" mode="link" priority="-1"> <!-- can be overriden to allow custom changes to href values --> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   580
<xsl:value-of select="@href"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   581
</xsl:template>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   582
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   583
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   584
<xsl:template match="*" mode="meta" priority="-9"><xsl:param name="data"/><xsl:param name="display"/>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   585
	<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
   586
		<xsl:copy-of select="@*[name()!='href']"/> <!-- copy all attributes as is, always drop href -->
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   587
		<xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   588
			<xsl:when test="$display='local' and @href and contains(@href,':') and not(starts-with(@href,'file:'))">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   589
				<!-- non-local URL: only want local URLs, so keep href as is-->
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="@href"/> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   591
			</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   592
			<xsl:when test="@href">
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   593
				<xsl:copy-of select="document(@href,.)/*"/> 
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   594
			</xsl:when>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   595
			<xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   596
				<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
   597
			</xsl:otherwise>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   598
		</xsl:choose>
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   599
	</xsl:element>
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
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   602
84b123918d3f Added latest version of sysdeftools. See readme.txt for details on content.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   603
</xsl:stylesheet>