buildframework/helium/sf/java/sysdef/demo/data/sf/os/buildtools/bldsystemtools/sysdeftools/sysdefdowngrade.xsl
author wbernard
Fri, 13 Aug 2010 14:59:05 +0300
changeset 628 7c4a911dc066
parent 587 85df38eb4012
permissions -rw-r--r--
helium_11.0.0-e00f171ca185
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     1
<?xml version="1.0"?>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
	All rights reserved.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
	This component and the accompanying materials are made available
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
     6
	under the terms of the License "Eclipse Public License v1.0"
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
	which accompanies this distribution, and is available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
	at the URL "http://www.eclipse.org/legal/epl-v10.html".
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
	Initial Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
	Nokia Corporation - initial contribution.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
	Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
	Description:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
	Downgrade a 3.x system definition into the 2.0.1 syntax
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
-->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
	<xsl:output method="xml" indent="yes"/>
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    17
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    18
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    19
<!--Description:Downgrades a 3.x system definition into the 2.0.1 syntax
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    20
 -->
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    21
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    22
<!--Input:<sysdef> - (required) The system definition XML file to process, in the 3.0 format, and can be a pkgdef or stand-alone sysdef.-->
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    23
<!--Output:<sysdef> - (optional) The system definition XML file to save the output as. If not present it will write to stdout.-->
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    24
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
	<xsl:param name="Path">os/deviceplatformrelease/foundation_system/system_model</xsl:param>
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    26
	<!-- <oldpath> - The directory containing the root system definition XML file in the 2.0 sysdef style. This must not end in /
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    27
		This is used to compute the absolute paths the 2.0 syntax needs. -->
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    28
	<xsl:param name="Root"/> <!--<list> - (optional) A space separated list of root variables in the form "VAR1=value1 VAR=value2" --> 
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    29
	<xsl:param name="Strict" select="0"/> <!--1 - (optional) If present, namespaced extensions are stripped out --> 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    30
	<xsl:variable name="root" select="concat(' ',$Root,' ')"/> <!-- sort of hack to allow absolute paths in downgraded output -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
	<xsl:variable name="srcroot" select="substring-before(substring-after($root,' SRCROOT='),' ')"/> <!-- the default path prefix -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
<xsl:template match="/*">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
	<xsl:message terminate="yes">ERROR: Cannot process this document</xsl:message>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    37
<!-- can only handle 3.0.x to 2.0.1 transforms
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
	Assumes only packages are using href
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
 -->
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    40
<xsl:template match="/SystemDefinition[starts-with(@schema,'3.0.')]"> 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
	<!-- process root system definition or package definition-->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
	<xsl:call-template name="DTD"/> <!-- insert 2.0.01 DTD -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
  <SystemDefinition name="{*/@name}" schema="2.0.1">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
  	<xsl:apply-templates select="*|comment()"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
  </SystemDefinition>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
    48
<xsl:template match="/SystemDefinition[starts-with(@schema,'3.0.') and systemModel]"> 
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
	<xsl:call-template name="DTD"/> <!-- insert 2.0.01 DTD -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
  <SystemDefinition name="{systemModel/@name}" schema="2.0.1">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
  	<xsl:apply-templates select="*|comment()"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    52
  </SystemDefinition>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    54
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    55
<xsl:template match="/SystemDefinition/package[@href]" priority="2">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
	<xsl:message terminate="yes">ERROR: Package definition (<xsl:value-of select="@id"/>) cannot link another package</xsl:message>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
<xsl:template match="/SystemDefinition/package" priority="1">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    60
	<!-- process package definition file--> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
  <systemModel>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
  	<layer name="anonymous"> <!-- fake layer -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
		<block>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    64
			<xsl:apply-templates mode="copy" select="@id|@name|@span|@level|@levels"/><!--  valid attribuites for 2.0 -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
		  	<xsl:apply-templates select="*|comment()">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    66
		  		<xsl:with-param name="path" select="concat($Path,'/')"/> <!-- need to keep tack of where the current document is -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
		  	</xsl:apply-templates>			
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
		</block>  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
   	</layer>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
  </systemModel>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
<xsl:template match="/"><xsl:apply-templates select="*"/></xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
<xsl:template match="@*|comment()"><xsl:copy-of select="."/></xsl:template> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
	<!-- comments are copied verbatim. Attribtues are copied by default -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    78
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
<xsl:template match="systemModel">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
	<systemModel>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
  	<xsl:apply-templates select="*|comment()"> <!-- no attributes -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    82
  		<xsl:with-param name="path" select="$Path"/> <!-- need to keep tack of where the current document is -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    83
  	</xsl:apply-templates>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    84
	</systemModel>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    86
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    87
<xsl:template mode="copy" match="@*">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    88
	<xsl:copy-of select="."/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    89
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    90
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    91
<xsl:template mode="copy" match="@id"> <!-- id in 3.0 is name in 2.0 -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    92
	<xsl:attribute name="name"><xsl:value-of select="."/></xsl:attribute>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    93
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    94
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    95
<xsl:template mode="copy" match="@name">  <!-- name in 3.0 is long-name in 2.0.1 -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    96
	<xsl:if test=".!=../@id"> <!-- don't bother if it will be the same as name -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    97
		<xsl:attribute name="long-name"><xsl:value-of select="."/></xsl:attribute>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    98
	</xsl:if>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    99
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   100
	
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   101
<xsl:template match="layer"><xsl:param name="path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   102
	<layer>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   103
		<xsl:apply-templates mode="copy" select="@id|@name|@span|@levels"/> <!--  valid attribuites for 2.0 -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   104
		<xsl:apply-templates select="*|comment()"> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   105
			<xsl:with-param name="path" select="$path"/> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   106
		</xsl:apply-templates>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   107
	</layer>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   108
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   109
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   110
<xsl:template match="layer/package"><!-- translates to block -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   111
	<xsl:param name="path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   112
	<block>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   113
		<xsl:apply-templates mode="copy" select="@id|@name|@span|@level|@levels"/><!--  valid attribuites for 2.0 -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   114
		<xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   115
			<xsl:when test="@href">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   116
				<xsl:variable name="this" select="."/>
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   117
				<xsl:variable name="prefixmap" select="ancestor::SystemDefinition/*/meta[@rel='link-mapping']/map-prefix[starts-with(current()/@href,@link)]"/>
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   118
				<xsl:for-each select="document(@href,.)/SystemDefinition/*">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   119
					<xsl:variable name="my-id"><xsl:apply-templates mode="normalize-id" select="@id"/></xsl:variable>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   120
					<xsl:variable name="other-id"><xsl:apply-templates mode="normalize-id" select="$this/@id"/></xsl:variable>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   121
					<xsl:if test="$my-id != $other-id">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   122
						<xsl:message terminate="yes">ERROR: Package IDs do not match: <xsl:value-of select="$my-id"/> vs <xsl:value-of select="$other-id"/></xsl:message>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   123
					</xsl:if>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   124
					<xsl:if test="@name and @name!=@id and not($this/@name and $this/@name=$this/@id)">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   125
						<!-- set long-name only if name is different from the id and not set in child doc -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   126
						<xsl:attribute name="long-name"><xsl:value-of select="@name"/></xsl:attribute>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   127
					</xsl:if>						
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   128
					<xsl:for-each select="@span|@levels|@level">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   129
						<!-- copy only if not set in child doc -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   130
						<xsl:if test="not(this/@*[name()=name(current())])">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   131
							<xsl:copy-of select="."/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   132
						</xsl:if>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   133
					</xsl:for-each>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   134
					<xsl:apply-templates select="*|comment()">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   135
	  					<xsl:with-param name="path">
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   136
							<xsl:choose>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   137
								<xsl:when test="$prefixmap">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   138
	  								<xsl:call-template name="normpath">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   139
	  									<xsl:with-param name="path">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   140
										<xsl:apply-templates select="$prefixmap/@to"/>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   141
										<xsl:value-of select="substring-after($this/@href,$prefixmap/@link)"/>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   142
									 </xsl:with-param>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   143
	  								</xsl:call-template>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   144
								</xsl:when>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   145
								<xsl:when test="starts-with($this/@href,'/')">  <!-- absolute path -->
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   146
	  								<xsl:call-template name="normpath">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   147
	  									<xsl:with-param name="path" select="$this/@href"/>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   148
	  								</xsl:call-template>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   149
								</xsl:when>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   150
								<xsl:when test="contains($this/@href,'://')">  <!-- generic URI -->
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   151
	  								<xsl:call-template name="normpath">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   152
	  									<xsl:with-param name="path" select="substring-after($this/@href,'://')"/>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   153
	  								</xsl:call-template>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   154
								</xsl:when>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   155
								<xsl:otherwise>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   156
	  								<xsl:call-template name="normpath">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   157
	  									<xsl:with-param name="path" select="concat($path,'/',$this/@href)"/>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   158
	  								</xsl:call-template>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   159
								</xsl:otherwise>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   160
							</xsl:choose>
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   161
	  					</xsl:with-param> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   162
	  				</xsl:apply-templates>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   163
				</xsl:for-each>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   164
			</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   165
			<xsl:otherwise>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   166
				<xsl:apply-templates select="*|comment()">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   167
  					<xsl:with-param name="path" select="$path"/> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   168
  				</xsl:apply-templates>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   169
			</xsl:otherwise>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   170
		</xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   171
	</block>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   172
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   173
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   174
<xsl:template match="package/package">	<!-- translates to subblock --><xsl:param name="path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   175
	<subblock>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   176
		<xsl:apply-templates mode="copy" select="@id|@name"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   177
		<xsl:apply-templates select="*|comment()">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   178
			<xsl:with-param name="path" select="$path"/> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   179
		</xsl:apply-templates>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   180
	</subblock>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   181
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   182
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   183
<xsl:template match="package/package/pacakge"> <!-- cannot nest this deep --><xsl:param name="path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   184
	<xsl:message>WARNING: Excessive nesting of packages: Ignoring <xsl:value-of select="@id"/></xsl:message>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   185
	<xsl:apply-templates select="*|comment()">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   186
		<xsl:with-param name="path" select="$path"/> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   187
	</xsl:apply-templates>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   188
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   189
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   190
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   191
<xsl:template match="collection"><xsl:param name="path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   192
	<collection>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   193
		<xsl:apply-templates mode="copy" select="@id|@name|@level"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   194
		<xsl:apply-templates select="*|comment()">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   195
			<xsl:with-param name="path" select="$path"/> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   196
		</xsl:apply-templates>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   197
	</collection>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   198
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   199
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   200
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   201
<xsl:template match="component"><xsl:param name="path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   202
	<component>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   203
		<xsl:apply-templates mode="copy" select="@id|@name|@deprecated|@introduced|@filter|@purpose"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   204
		<xsl:if test="contains(concat(' ',@class,' '),' plugin ')">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   205
			<xsl:attribute name="plugin">Y</xsl:attribute>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   206
		</xsl:if>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   207
		<xsl:call-template name="class">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   208
			<xsl:with-param name="remove">plugin</xsl:with-param>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   209
			<xsl:with-param name="add">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   210
				<xsl:if test="not(*) and comment()">placeholder</xsl:if>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   211
				<xsl:if test="@target='desktop'"> PC</xsl:if>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   212
			</xsl:with-param>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   213
		</xsl:call-template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   214
	  	<xsl:apply-templates select="*|comment()">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   215
			<xsl:with-param name="path" select="$path"/> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   216
		</xsl:apply-templates>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   217
	</component>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   218
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   219
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   220
<xsl:template match="unit[@base and not(@mrp or @bldFile)]"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   221
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   222
<xsl:template match="unit"><xsl:param name="path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   223
	<unit>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   224
		<xsl:apply-templates select="@mrp|@bldFile|@late">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   225
			<xsl:with-param name="path" select="$path"/> 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   226
		</xsl:apply-templates>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   227
		<xsl:copy-of select="@filter|@root[not(contains($root,concat(' ',.,'=')))]|@version|@prebuilt|@priority"/>
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   228
		<xsl:for-each select="@*[contains(name(),':') and not($Strict)]">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   229
			<xsl:attribute name="{local-name()}">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   230
				<xsl:value-of select="."/>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   231
			</xsl:attribute>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   232
		</xsl:for-each>
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   233
	</unit>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   234
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   235
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   236
<xsl:template match="unit/@late"> <!-- 2.0 uses Y/N, 3.0 uses yes/no -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   237
	<xsl:attribute name="{name()}">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   238
		<xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   239
			<xsl:when test=".='yes'">Y</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   240
			<xsl:when test=".='no'">N</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   241
		</xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   242
	</xsl:attribute>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   243
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   244
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   245
<xsl:template match="@mrp|@bldFile"><xsl:param name="path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   246
	<xsl:attribute name="{name()}">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   247
		<xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   248
			<xsl:when test="../@root">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   249
				<xsl:variable name="pre" select="substring-before(substring-after($root,concat(' ',../@root,'=')),' ')"/>
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   250
				<xsl:value-of select="$pre"/>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   251
				<xsl:if test="$pre!='' and $pre!='/'">/</xsl:if>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   252
			</xsl:when>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   253
			<xsl:when test="$srcroot='/'"> <!-- treat all paths as absolute -->
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   254
				<xsl:value-of select="$srcroot"/>
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   255
			</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   256
			<xsl:when test="$srcroot!=''">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   257
				<xsl:value-of select="concat($srcroot,'/')"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   258
			</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   259
		</xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   260
		<xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   261
		<xsl:when test="starts-with(.,'/')"> <!-- keep absolute paths verbatim (barring the leading / ) -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   262
			<xsl:value-of select="substring-after(.,'/')"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   263
		</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   264
		<xsl:otherwise>	
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   265
			<xsl:call-template name="normpath">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   266
  				<xsl:with-param name="path">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   267
  					<xsl:call-template name="before">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   268
						<xsl:with-param name="text" select="$path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   269
					</xsl:call-template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   270
					<xsl:value-of select="."/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   271
  				</xsl:with-param>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   272
  			</xsl:call-template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   273
		</xsl:otherwise>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   274
	</xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   275
	</xsl:attribute>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   276
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   277
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   278
<xsl:template match="meta"/> <!-- strip all meta tags -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   279
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   280
<xsl:template match="meta[info/@contract]"> <!-- except contract -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   281
	<xsl:copy-of select="info/@contract"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   282
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   283
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   284
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   285
<xsl:template match="meta[@rel='link-mapping']/map-prefix/@to">
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   286
	<xsl:choose>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   287
		<xsl:when test="starts-with(.,'/')"><xsl:value-of select="substring(.,2)"/></xsl:when> <!-- absolute paths in 3.0 are relative in 2.0 -->
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   288
		<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   289
	</xsl:choose>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   290
</xsl:template>
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   291
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 587
diff changeset
   292
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   293
<xsl:template match="@id" mode="normalize-id">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   294
	<xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   295
		<xsl:when test="contains(@id,':')"><xsl:value-of select="substring-after(@id,':')"/></xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   296
		<xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   297
	</xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   298
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   299
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   300
<xsl:template name="class"><xsl:param name="remove"/><xsl:param name="add"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   301
<!--  returns the value of the class attribute with the space-separated list of names in $remove taken out and those in $add added on (does not check for duplicates) -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   302
	<xsl:param name="class" select="normalize-space(@class)"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   303
	<xsl:variable name="r">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   304
		<xsl:text> </xsl:text>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   305
		<xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   306
			<xsl:when test="contains($remove,' ')"><xsl:value-of select="substring-before($remove,' ')"/></xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   307
			<xsl:otherwise><xsl:value-of select="$remove"/></xsl:otherwise>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   308
		</xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   309
		<xsl:text> </xsl:text>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   310
	</xsl:variable>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   311
	<xsl:variable name="c">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   312
		<xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   313
			<xsl:when test="contains(concat(' ',$class,' '),$r)">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   314
				<xsl:value-of select="substring-before(concat(' ',$class,' '),$r)"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   315
				<xsl:text> </xsl:text>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   316
				<xsl:value-of select="substring-after(concat(' ',$class,' '),$r)"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   317
			</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   318
			<xsl:otherwise><xsl:value-of select="$class"/></xsl:otherwise>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   319
		</xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   320
		<xsl:if test="normalize-space($add)!=''"><xsl:value-of select="concat(' ',normalize-space($add))"/></xsl:if>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   321
	</xsl:variable>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   322
	<xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   323
		<xsl:when test="contains($remove,' ')">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   324
			<xsl:call-template name="class">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   325
				<xsl:with-param name="remove" select="substring-after($remove,' ')"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   326
				<xsl:with-param name="class" select="$c"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   327
			</xsl:call-template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   328
		</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   329
		<xsl:when test="normalize-space($c)!=''">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   330
			<xsl:attribute name="class">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   331
				<xsl:value-of select="normalize-space($c)"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   332
			</xsl:attribute>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   333
		</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   334
	</xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   335
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   336
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   337
<xsl:template name="normpath"><xsl:param name="path"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   338
<!-- normalize out any ".." in the path in $path  -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   339
<xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   340
	<xsl:when test="contains($path,'/../')">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   341
	<xsl:call-template name="normpath">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   342
		<xsl:with-param name="path">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   343
		<xsl:call-template name="before">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   344
			<xsl:with-param name="text" select="substring-before($path,'/../')"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   345
		</xsl:call-template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   346
		<xsl:value-of select="substring-after($path,'/../')"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   347
		</xsl:with-param>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   348
		</xsl:call-template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   349
	</xsl:when>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   350
	<xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   351
</xsl:choose>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   352
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   353
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   354
<!-- return all text before the last / -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   355
<xsl:template name="before"><xsl:param name="text"/>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   356
<xsl:if test="contains($text,'/')">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   357
	<xsl:value-of select="substring-before($text,'/')"/>/<xsl:call-template name="before"><xsl:with-param name="text" select="substring-after($text,'/')"/></xsl:call-template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   358
	</xsl:if>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   359
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   360
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   361
<xsl:template name="DTD">
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   362
<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE SystemDefinition [
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   363
<!ELEMENT SystemDefinition ( systemModel )>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   364
<!ATTLIST SystemDefinition
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   365
  name CDATA #REQUIRED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   366
  schema CDATA #REQUIRED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   367
>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   368
<!-- all paths are relative to the environment variable specified by the root attribute, or SOURCEROOT if not.  -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   369
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   370
<!-- System Model Section of DTD -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   371
<!ELEMENT systemModel (layer+)>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   372
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   373
<!ELEMENT layer (block* | collection*)*>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   374
<!-- Kernel Services, Base Services, OS Services, Etc -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   375
<!ATTLIST layer
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   376
  name CDATA #REQUIRED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   377
  long-name CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   378
  levels NMTOKENS #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   379
  span CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   380
>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   381
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   382
<!ELEMENT block (subblock* | collection*)*>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   383
 <!-- Generic OS services, Comms Services, etc -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   384
<!ATTLIST block
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   385
  levels NMTOKENS #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   386
  span CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   387
  level NMTOKEN #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   388
  name CDATA #REQUIRED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   389
  long-name CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   390
>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   391
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   392
<!ELEMENT subblock (collection)*>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   393
<!-- Cellular Baseband Services, Networking Services, etc -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   394
<!ATTLIST subblock
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   395
  name CDATA #REQUIRED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   396
  long-name CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   397
>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   398
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   399
<!ELEMENT collection (component)*>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   400
<!-- Screen Driver, Content Handling, etc -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   401
<!ATTLIST collection
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   402
  name CDATA #REQUIRED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   403
  long-name CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   404
  level NMTOKEN #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   405
>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   406
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   407
<!ELEMENT component (unit)*>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   408
<!-- contains units or is a  package or prebuilt -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   409
<!ATTLIST component
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   410
  name CDATA #REQUIRED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   411
  long-name CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   412
  deprecated CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   413
  introduced CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   414
  contract CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   415
  plugin (Y|N) "N"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   416
  filter CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   417
  class NMTOKENS #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   418
  supports CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   419
  purpose ( optional | mandatory | development ) "optional"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   420
>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   421
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   422
<!ELEMENT unit EMPTY >
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   423
<!-- must be buildable (bld.inf) -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   424
<!-- bldFile  may someday be removed in favour of mrp -->
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   425
<!ATTLIST unit
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   426
  mrp CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   427
  filter CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   428
  bldFile CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   429
  root CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   430
  version NMTOKEN #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   431
  prebuilt NMTOKEN #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   432
  late (Y|N) #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   433
  priority CDATA #IMPLIED
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   434
>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   435
]>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   436
]]></xsl:text>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   437
</xsl:template>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   438
</xsl:stylesheet>