sysmodellibs/sysmodelgen/src/svg/Model.xsl
author terytkon
Thu, 11 Mar 2010 18:20:56 +0200
changeset 1 b538b70cbe51
permissions -rw-r--r--
Move rest of the swconfigmdw package components to oss repository. -Changed sfl licences to epl.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     1
<?xml version="1.0"?>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     2
 <!DOCTYPE XSLT  [
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     3
      <!ENTITY AZ  "ABCDEFGHIJKLMNOPQRSTUVWXYZ">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     4
      <!ENTITY az  "abcdefghijklmnopqrstuvwxyz">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     5
 ]>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     6
 <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"  xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date exslt"
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     7
		xmlns:exslt="http://exslt.org/common">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     8
	<xsl:param name="xml-stylesheet"/><!-- set to default stylesheet-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     9
	<xsl:param name="Verbose" select="0"/><!-- Verbosity level of messages. Set to 1 (or higher) to get runtime comments-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    10
	<xsl:param name="Origin-attr">old_model</xsl:param>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    11
	<xsl:output method="xml" cdata-section-elements="script s:script" indent="yes"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    12
	  <xsl:key name="named" match="*" use="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    13
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    14
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    15
<!-- ====== Computed values ============= -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    16
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    17
<xsl:variable name="Version">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    18
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    19
		<xsl:when test="/model/@ver"><xsl:value-of select="/model/@ver"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    20
		<xsl:when test="/model/@deps"><xsl:value-of select="document(/model/@deps,.)/SystemModelDeps/@version"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    21
		<xsl:when test="count(/model/sysdef/info[@type='s12'])=1">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    22
			<xsl:value-of select="document(/model/sysdef/info[@type='s12']/@href,.)/Schedule12/@OS_version"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    23
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    24
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    25
</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    26
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    27
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    28
<!-- for merging: -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    29
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    30
<xsl:variable name="filter-nodes" select="//filter[not(@accept or @reject) and @select and @display]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    31
	<!--  @value is optional, but should be set unless select=* -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    32
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    33
<xsl:variable name="filter-in"> <!--comma-separated list of filters to accept -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    34
	<xsl:text>,</xsl:text>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    35
	<xsl:if test="not($filter-nodes) and //filter[@accept|@reject]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    36
		<xsl:value-of  select="concat($Version,',')"/> <!-- the version number -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    37
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    38
	<xsl:for-each select="//filter[@accept]"><xsl:value-of select="@accept"/>,</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    39
	<xsl:for-each select="//filter[@reject]">!<xsl:value-of select="@reject"/>,</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    40
</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    41
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    42
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    43
<xsl:variable name="ignore" select="//ignore"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    44
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    45
<xsl:variable name="abbrevs" select="document(/model/layout/info/@href,/)/display-names//abbrev"/> <!-- the abbreviations list -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    46
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    47
<xsl:variable name="simple-filters" select="not(function-available('exslt:node-set'))"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    48
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    49
<!-- ====== Error checking ============= -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    50
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    51
<!--  start error checking -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    52
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    53
<xsl:template match="SystemDefinition/@schema" mode="check">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    54
	<!-- warning if schema is less than 1.4 -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    55
	<xsl:if test="substring-before(.,'.') &lt; 1 or (substring-before(.,'.')=1 and substring-before(substring-after(.,'.'),'.') &lt; 4)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    56
		<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">using old System Definition schema (<xsl:value-of select="."/>)</xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    57
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    58
<!--	<xsl:if test="starts-with(.,'1.4.')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    59
		<xsl:call-template name="Caller-Note"><xsl:with-param name="text">using backwards compatible System Definition schema (<xsl:value-of select="."/>)</xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    60
	</xsl:if> -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    61
	<xsl:if test="substring-before(.,'.') &gt; 2">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    62
		<xsl:call-template name="Critical-Error"><xsl:with-param name="text">using incompatible System Definition schema (<xsl:value-of select="."/>)</xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    63
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    64
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    65
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    66
<xsl:template match="*" mode="check"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    67
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    68
<xsl:template match="block[ancestor::layer/@levels]|lsubblock[ancestor::layer/@levels] | logicalset[ancestor::layer/@levels]|logicalsubset[ancestor::layer/@levels]" mode="check">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    69
	<xsl:variable name="levels"><xsl:text> </xsl:text><xsl:apply-templates mode="layernames" select="."/><xsl:text> </xsl:text></xsl:variable>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    70
	<xsl:for-each select="module | collection">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    71
	<xsl:if test="not(contains($levels,concat(' ',@level,' ')))">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    72
		<xsl:call-template name="Caller-Error"><xsl:with-param name="text">Invalid level: <xsl:value-of select="@level"/> in <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    73
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    74
	</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    75
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    76
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    77
<xsl:template name="Caller-Debug"><xsl:param name="text"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    78
	<xsl:if test="$Verbose &gt; 5"><xsl:message>&#xa;Note: <xsl:value-of select="$text"/></xsl:message></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    79
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    80
<xsl:template name="Caller-Note"><xsl:param name="text"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    81
	<xsl:message>&#xa;Note: <xsl:value-of select="$text"/></xsl:message>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    82
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    83
<xsl:template name="Caller-Warning"><xsl:param name="text"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    84
	<xsl:message>&#xa;Warning: <xsl:value-of select="$text"/></xsl:message>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    85
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    86
<xsl:template name="Caller-Error"><xsl:param name="text"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    87
	<xsl:message>&#xa;Error: <xsl:value-of select="$text"/></xsl:message>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    88
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    89
<xsl:template name="Critical-Error"><xsl:param name="text"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    90
	<xsl:message terminate="yes">&#xa;Error: <xsl:value-of select="$text"/></xsl:message>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    91
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    92
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    93
<!--- ==================== merge ==================== -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    94
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    95
<!-- merge is used this is called on a model file -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    96
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    97
<xsl:template match="@*" mode="copyroot" priority="-1"><xsl:copy-of select="."/></xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    98
<xsl:template match="@detail" mode="copyroot">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    99
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   100
		<xsl:when test=".='module'"><xsl:attribute name="detail">collection</xsl:attribute></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   101
		<xsl:when test=".='logicalsubset'"><xsl:attribute name="detail">subblock</xsl:attribute></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   102
		<xsl:when test=".='logicalset'"><xsl:attribute name="detail">block</xsl:attribute></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   103
		<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   104
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   105
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   106
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   107
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   108
<xsl:template match="@revision[../@revision-type='date' and contains(.,'%') and function-available('date:month-abbreviation')]" mode="copyroot">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   109
<xsl:attribute name="revision"><xsl:call-template name="format-date"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   110
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   111
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   112
<xsl:template match="/model">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   113
	<xsl:if test="$xml-stylesheet!='' "> <!-- start with an optional style sheet transform -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   114
		<xsl:processing-instruction name="xml-stylesheet">type="text/xsl" href="<xsl:value-of select="$xml-stylesheet"/>"</xsl:processing-instruction>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   115
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   116
	<SystemDefinition>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   117
		<xsl:copy-of select="document(sysdef/@href, .)/SystemDefinition/@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   118
	<xsl:copy-of select="document(layout/info[@type='abbrev']/@href,.)/*/@xml:lang"/> <!-- copy localized language value -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   119
		<xsl:apply-templates select="document(@deps, .)/SystemModelDeps" mode="merge"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   120
		<styling>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   121
			<xsl:apply-templates select="@shapes | layout/info" mode="styling"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   122
		</styling>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   123
		<xsl:apply-templates select="document(sysdef/@href, .)/SystemDefinition/@schema" mode="check"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   124
		  <systemModel>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   125
			<!-- copy all attributes from all the system models and from the model element -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   126
			<xsl:apply-templates select="document(sysdef/@href, .)/SystemDefinition/systemModel/@*|@*|layout/@*" mode="copyroot"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   127
			<xsl:if test="$Version!='' and not(@ver)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   128
				<xsl:attribute name="ver">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   129
					<xsl:value-of select="$Version"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   130
				</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   131
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   132
			<!-- special handing of revision details -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   133
			<xsl:choose><!-- get revision details from deps if not otherwise specified -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   134
				<xsl:when test="@deps and (not(@revision-type) or @revision-type='build') and not(@revision)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   135
					<xsl:variable name="rt" select="@revision-type"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   136
					<xsl:for-each select="document(@deps,.)/SystemModelDeps[@number]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   137
						<xsl:if test="not($rt)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   138
							<xsl:attribute name="revision-type">build</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   139
						</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   140
						<xsl:attribute name="revision"><xsl:value-of select="@number"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   141
					</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   142
				</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   143
				<xsl:when test="@revision-type='date' and not(@revision) and function-available('date:date-time')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   144
					<xsl:attribute name="revision"><xsl:value-of select="substring-before(date:date-time(),'T')"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   145
				</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   146
			</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   147
			<xsl:apply-templates select="layout/legend" mode="merge"/> <!-- add legend as a layer -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   148
			<xsl:apply-templates select="layout/logo" mode="merge"/> <!-- copy logos to use when drawing: put first so it's drawn last-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   149
			<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   150
				<xsl:when test="not(function-available('exslt:node-set'))">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   151
					<!-- can't do much, don't bother filtering -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   152
					<xsl:apply-templates select="sysdef" mode="merge"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   153
				</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   154
				<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   155
					<xsl:for-each select="/model"> <!-- hack for xsltproc which loses the current node -->				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   156
					<xsl:variable name="unfiltered">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   157
							<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   158
								<xsl:when test="count(sysdef) &lt; 2"> <!-- no need to merge multi models -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   159
									<xsl:apply-templates select="sysdef" mode="merge"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   160
								</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   161
								<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   162
									<xsl:variable name="sysdefs">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   163
										<xsl:for-each select="sysdef">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   164
											<sysdef><xsl:apply-templates select="." mode="merge"/></sysdef>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   165
										</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   166
									</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   167
									<xsl:apply-templates select="exslt:node-set($sysdefs)/sysdef[1]" mode="override-merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   168
										<xsl:with-param name="next" select="exslt:node-set($sysdefs)/sysdef[2]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   169
									</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   170
								</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   171
							</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   172
						</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   173
						<xsl:apply-templates select="exslt:node-set($unfiltered)/*" mode="filter-for-presence"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   174
					</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   175
				</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   176
			</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   177
			<xsl:copy-of select="layout/layer-group"/> <!-- copy layer groups to use when drawing: put last so it's drawn first-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   178
		  </systemModel>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   179
	</SystemDefinition>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   180
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   181
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   182
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   183
<!-- merge multiple models together -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   184
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   185
<xsl:template match="sysdef" mode="override-merge"><xsl:param name="next"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   186
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   187
		<xsl:when test="not($next)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   188
			<xsl:copy-of select="*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   189
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   190
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   191
			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Merging with model <xsl:value-of select="1 +  count($next/preceding-sibling::sysdef)"/></xsl:with-param></xsl:call-template>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   192
			<xsl:variable name="cur">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   193
					<sysdef>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   194
						<xsl:apply-templates select="*" mode="override-merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   195
							<xsl:with-param name="other" select="$next"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   196
						</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   197
						<xsl:apply-templates select="$next/*" mode="append">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   198
							<xsl:with-param name="main" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   199
						</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   200
					</sysdef>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   201
			</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   202
			<xsl:apply-templates select="exslt:node-set($cur)/sysdef" mode="override-merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   203
				<xsl:with-param name="next" select="$next/following-sibling::sysdef[1]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   204
			</xsl:apply-templates>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   205
		</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   206
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   207
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   208
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   209
<xsl:template match="component/*" mode="override-merge" priority="7"><xsl:copy-of select="."/></xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   210
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   211
<xsl:template match="*" mode="override-merge"><xsl:param name="other"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   212
	<xsl:variable name="n" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   213
	<xsl:variable name="tag" select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   214
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   215
		<xsl:when test="$other/*[@override=$n and name()=$tag]"> 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   216
			<!--replace this with the other one at the current location-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   217
			<xsl:apply-templates select="$other/*[@override=$n and name()=$tag]" mode="safe-combine">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   218
				<xsl:with-param name="main-root" select="ancestor-or-self::sysdef"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   219
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   220
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   221
		<xsl:when test="$other/ancestor-or-self::sysdef/descendant::*[@override=$n and name()=$tag]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   222
			<!-- it's overridden somewhere else (perhaps deleted)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   223
			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Deleting  <xsl:value-of select="$n"/></xsl:with-param></xsl:call-template>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   224
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   225
		<xsl:when test="$other/*[@rename=$n or @move=$n and name()=$tag]"> <!-- leave as is at the current location-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   226
			<xsl:if test="$other/*[@rename=$n or @move=$n and name()=$tag]/*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   227
			<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">ignoring children</xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   228
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   229
			<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   230
				<xsl:copy-of select="@*"/> <!-- own attributes -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   231
				<xsl:copy-of select="$other/*[@rename=$n or @move=$n and name()=$tag]/@name"/> <!-- overwrite names -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   232
			<!--leave as is at the current location-->					
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   233
				<xsl:apply-templates select="*[not(self::name)]"  mode="override-merge"> <!-- do not copy deprecated localised name form-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   234
					<xsl:with-param name="other" select="$other/ancestor-or-self::sysdef"/> <!-- use root of other, to catch any moved decendants -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   235
				</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   236
			</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   237
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   238
		<xsl:when test="$other/ancestor-or-self::sysdef/descendant::*[@rename=$n or @move=$n and $tag=name()]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   239
			<!--it's moved to elsewhere-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   240
			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Relocating <xsl:value-of select="$n"/></xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   241
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   242
		<xsl:when test="$other/*[@name=$n and self::component]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   243
			<!--use other at the current location-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   244
			<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   245
				<xsl:copy-of select="$other/*[@name=$n and name()=$tag]/@*"/> <!--other's attributes -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   246
				<!-- should put something here to merge filters,classes properly -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   247
				<xsl:copy-of select="*"/> <!--current conent -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   248
					<xsl:variable name="this" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   249
				<xsl:apply-templates mode="copy-merge-content"  select="$other/*[@name=$n and name()=$tag]/*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   250
					<xsl:with-param name="main" select="$this"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   251
				</xsl:apply-templates> <!--other's conent -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   252
			</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   253
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   254
		<xsl:when test="$other/*[@name=$n and name()=$tag]"> <!-- leave as is at the current location, merge children-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   255
			<xsl:for-each select="$other/*[@name=$n and name()=$tag]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   256
				<xsl:if test="(self::module and $tag!='module') or (not(self::module) and $tag='module')   or   (self::collection and $tag!='collection') or (not(self::collection) and $tag='collection')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   257
					<xsl:call-template name="Critical-Error"><xsl:with-param name="text">Cannot merge <xsl:value-of select="name()"/> "<xsl:value-of select="@name"/>" with <xsl:value-of select="$tag"/> "<xsl:value-of select="$n"/>"</xsl:with-param></xsl:call-template>				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   258
				</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   259
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   260
			<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   261
				<xsl:copy-of select="@*"/> <!-- own attributes -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   262
				<xsl:copy-of select="$other/*[@name=$n and name()=$tag]/@*"/> <!-- other's attributes -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   263
				<xsl:apply-templates select="*"  mode="override-merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   264
					<xsl:with-param name="other" select="$other/*[@name=$n and name()=$tag]"/> <!-- use other version of this -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   265
				</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   266
			</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   267
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   268
		<xsl:when test="$other/ancestor-or-self::sysdef/descendant::*[@name=$n and name()=$tag]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   269
			<!-- it's moved to elsewhere -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   270
			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Relocating and merging <xsl:value-of select="$n"/></xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   271
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   272
		<xsl:otherwise> <!--  there is no equivalent in 2nd, just copy this and descend -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   273
			<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   274
				<xsl:copy-of select="@*"/> <!-- own attributes -->	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   275
				<xsl:apply-templates select="*"  mode="override-merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   276
					<xsl:with-param name="other" select="$other/ancestor-or-self::sysdef"/> <!-- use root of other, to catch any moved decendants -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   277
				</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   278
			</xsl:copy>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   279
		</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   280
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   281
	<!-- this won't work if the main model has nothing in the group, but that's invalid, so it's ok. -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   282
	<xsl:if test="position()=last() and name($other)!='sysdef'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   283
		<!--Check if other has stuff to append that's not already been used   -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   284
		<xsl:apply-templates select="$other/*" mode="append">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   285
			<xsl:with-param name="main" select=".."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   286
		</xsl:apply-templates>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   287
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   288
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   289
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   290
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   291
<xsl:template mode="copy-merge-content" match="*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   292
<xsl:copy-of select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   293
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   294
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   295
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   296
<xsl:template mode="copy-merge-content" match="component/*[starts-with(name(),'generator-')]"><xsl:param name="main"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   297
	<xsl:variable name="self" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   298
	<!-- only copy if does not exist in original -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   299
	<xsl:if test="not($main/*[name()=name($self)])">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   300
		<xsl:copy-of select="$self"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   301
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   302
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   303
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   304
<xsl:template mode="copy-merge-content" match="unit"><xsl:param name="main"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   305
	<xsl:variable name="attr"><xsl:for-each select="@*"><xsl:value-of select="concat(name(),'=',.)"></xsl:value-of></xsl:for-each></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   306
	<xsl:variable name="exists">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   307
		<xsl:for-each select="$main/unit">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   308
			<xsl:variable name="attr2"><xsl:for-each select="@*"><xsl:value-of select="concat(name(),'=',.)"></xsl:value-of></xsl:for-each></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   309
			<xsl:if test="$attr2=$attr">*</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   310
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   311
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   312
	<!-- only copy if does not exist in original's units-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   313
	<xsl:if test="$exists=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   314
		<xsl:copy-of select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   315
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   316
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   317
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   318
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   319
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   320
<xsl:template match="*[@override  and *]" mode="append" priority="5"><xsl:param name="main"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   321
	<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">Append (5) <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   322
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   323
	<xsl:variable name="n" select="@override"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   324
		<!-- if override is not in main, use this -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   325
	<xsl:if test="@name and not($main/*[@name=$n])">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   326
		<!--  must have a name for renaming -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   327
		<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   328
			<xsl:copy-of select="@*[not(name()='override' or name()='rename' or name()='move')]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   329
			<xsl:apply-templates select="*" mode="safe-combine">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   330
				<xsl:with-param name="main-root" select="$main/ancestor-or-self::sysdef"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   331
			</xsl:apply-templates>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   332
		</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   333
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   334
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   335
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   336
<xsl:template match="*" mode="safe-combine" priority="-1"><xsl:param name="main-root"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   337
	<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   338
		<xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   339
		<xsl:apply-templates select="*"  mode="safe-combine">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   340
			<xsl:with-param name="main-root" select="$main-root"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   341
		</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   342
	</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   343
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   344
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   345
<xsl:template match="*[@rename or @move]" mode="safe-combine" priority="3"><xsl:param name="main-root"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   346
	<xsl:variable name="n" select="@rename | @move"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   347
	<xsl:variable name="newname" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   348
	<xsl:variable name="atts" select="@*[name()!='name' and name()!='move' and name()!='rename' and name()!='override']"/> <!-- if any non-oragnisational attributes are present on the "move" item, then they should override the values in the thing being moved -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   349
	<xsl:variable name="other" select="ancestor-or-self::sysdef"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   350
	<!-- can't merge a component with a container -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   351
	<xsl:for-each select="$main-root/descendant::*[@name=$n and (self::layer or self::block or self::subblock or self::logicalset or self::logicalsubset)]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   352
		<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   353
			<xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   354
			<xsl:copy-of select="$newname"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   355
			<xsl:copy-of select="$atts"/> <!-- if any of these attributes are present on the moved collection, then use that value rather than the value in the one being moved -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   356
			<xsl:apply-templates select="*"  mode="override-merge"> <!-- do not copy localised name -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   357
				<xsl:with-param name="other" select="$other"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   358
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   359
		</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   360
	</xsl:for-each>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   361
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   362
<!-- can only merge a component or module with component or module -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   363
<xsl:template match="component[@rename or @move] | collection[@rename or @move] | module[@rename or @move]" mode="safe-combine" priority="4"><xsl:param name="main-root"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   364
	<xsl:variable name="n" select="@rename | @move"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   365
	<xsl:variable name="newname" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   366
	<xsl:variable name="atts" select="@*[name()!='name' and name()!='move' and name()!='rename' and name()!='override']"/> <!-- if any non-oragnisational attributes are present on the "move" item, then they should override the values in the thing being moved -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   367
	<xsl:variable name="tag" select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   368
	<xsl:variable name="other" select="ancestor-or-self::sysdef"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   369
	<!-- can't merge a component with a container -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   370
	<xsl:for-each select="$main-root/descendant::*[@name=$n and $tag=name()]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   371
		<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   372
			<xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   373
			<xsl:copy-of select="$newname"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   374
			<xsl:copy-of select="$atts"/> <!-- if any of these attributes are present on the moved collection, then use that value rather than the value in the one being moved -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   375
			<xsl:apply-templates select="*[not(self::name)]"  mode="override-merge"> <!-- do not copy localised name -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   376
				<xsl:with-param name="other" select="$other"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   377
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   378
		</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   379
	</xsl:for-each>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   380
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   381
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   382
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   383
<xsl:template match="*[@name]" mode="safe-combine" priority="2"><xsl:param name="main-root"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   384
	<xsl:if test="@override and (@rename or @move)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   385
		<xsl:call-template name="Critical-Error"><xsl:with-param name="text">Error invalid combinations of attributes in <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   386
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   387
	<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   388
		<xsl:variable name="cur" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   389
		<xsl:copy-of select="@*[not(name()='override' or name()='rename' or name()='move')]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   390
		<!-- copy other's attributes -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   391
		<xsl:copy-of select="$main-root/descendant::*[@name=$cur/@name and name($cur)=name()]/@*[not(name()='override' or name()='rename' or name()='move' or name()='name')]"/>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   392
		<xsl:apply-templates select="*"  mode="safe-combine">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   393
			<xsl:with-param name="main-root" select="$main-root"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   394
		</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   395
		<!-- now copy anything defined here -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   396
		<xsl:variable name="other" select="ancestor-or-self::sysdef"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   397
		<xsl:for-each select="$main-root/descendant::*[@name=$cur/@name and name($cur)=name()]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   398
			<xsl:apply-templates select="*[not(self::name)]"  mode="override-merge"> <!-- do not copy localised name -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   399
				<xsl:with-param name="other" select="$other"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   400
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   401
		</xsl:for-each>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   402
	</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   403
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   404
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   405
<xsl:template match="component | component/*" mode="safe-combine" priority="2">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   406
	<!--a component is atomic: it cannot be merged. So it's always just copied.-->	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   407
	<xsl:copy-of select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   408
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   409
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   410
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   411
<xsl:template match="*[@override and not(@name)]" mode="safe-combine" priority="5"/> <!-- ignore component -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   412
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   413
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   414
<xsl:template match="*" mode="unused-merge"><xsl:param name="other"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   415
	<xsl:variable name="self" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   416
	<xsl:if test="not($other/descendant::*[@name=$self/@name and name()=name($self)  and descendant-or-self::component])">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   417
		<!-- not in other, so include here -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   418
		<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   419
			<xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   420
			<xsl:apply-templates select="*"  mode="unused-merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   421
				<xsl:with-param name="other" select="$other"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   422
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   423
		</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   424
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   425
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   426
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   427
<xsl:template match="*[@name]" mode="append"><xsl:param name="main"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   428
	<!--  this handles all cases where this holds the data -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   429
	<xsl:variable name="self" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   430
		<!-- if $self is not in main, use this -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   431
	<xsl:if test="not($main/*[@name=$self/@name])">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   432
		<xsl:variable name="other" select="ancestor-or-self::sysdef"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   433
		<xsl:for-each select="$main/ancestor-or-self::sysdef/descendant::*[@name=$self/@name and name()=name($self)  and descendant-or-self::component]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   434
			<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">To Merge <xsl:value-of select="$self/@name"/> with these: <xsl:for-each select="*">"<xsl:value-of select="@name"/>", </xsl:for-each></xsl:with-param></xsl:call-template>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   435
			<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   436
				<xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   437
				<xsl:apply-templates select="*"  mode="override-merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   438
					<xsl:with-param name="other" select="$other"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   439
				</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   440
	<xsl:comment>was not here</xsl:comment>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   441
				<xsl:apply-templates select="$other/descendant::*[@name=$self/@name and name()=name($self) and descendant-or-self::component]/*"  mode="unused-merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   442
					<xsl:with-param name="other" select="$main"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   443
				</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   444
	<xsl:comment>end not here</xsl:comment>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   445
			</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   446
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   447
		<!-- if it does not already exist, create it and check all children -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   448
		<xsl:if test="not($main/ancestor-or-self::sysdef/descendant::*[@name=$self/@name and name()=name($self) and descendant-or-self::component])">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   449
			<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">Does not already exist: <xsl:value-of select="$self/@name"/> </xsl:with-param></xsl:call-template>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   450
			<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   451
				<xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   452
				<xsl:apply-templates select="*"  mode="safe-combine">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   453
					<xsl:with-param name="main-root" select="$main/ancestor-or-self::sysdef"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   454
				</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   455
			</xsl:copy>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   456
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   457
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   458
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   459
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   460
<xsl:template match="component[@name]" mode="append" priority="1"><xsl:param name="main"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   461
	<xsl:variable name="n" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   462
		<!-- if $n is not in main, use this -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   463
	<xsl:if test="not($main/*[@name=$n])">	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   464
		<xsl:copy-of select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   465
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   466
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   467
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   468
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   469
<xsl:template match="*[@rename or @move]" mode="append" priority="4"><xsl:param name="main"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   470
	<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">Append (4) <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   471
	<xsl:variable name="n" select="@rename | @move"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   472
		<!-- if $n is not in main, use this -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   473
	<xsl:if test="not($main/*[@name=$n])">	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   474
		<xsl:apply-templates select="." mode="safe-combine">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   475
			<xsl:with-param name="main-root" select="$main/ancestor-or-self::sysdef"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   476
		</xsl:apply-templates>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   477
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   478
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   479
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   480
<!-- merging data sources  -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   481
<xsl:template match="sysdef" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   482
	<xsl:apply-templates select="document(@href)/SystemDefinition/systemModel/*" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   483
		<xsl:with-param name="extra-files" select="info|../@deps|../@ts|../layout/info[@type and document(@href,.)/values]|../layout/display|@root"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   484
	</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   485
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   486
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   487
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   488
<xsl:template match="SystemModelDeps" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   489
	<xsl:if test="@name or @version or @number">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   490
		<release><xsl:copy-of select="@name | @version | @number"/></release>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   491
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   492
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   493
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   494
<!-- merge model with extra -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   495
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   496
<xsl:template match="layer" mode="merge"><xsl:param name="extra-files"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   497
	<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   498
	<xsl:if test="$e!=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   499
		<xsl:copy><xsl:copy-of select="@*"/> 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   500
			<xsl:variable name="name" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   501
			<xsl:copy-of select="$extra-files[self::display and @name=$name]/@*[name()!='name']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   502
			<xsl:if test="$extra-files[@type='levels']"><!-- levels hack for older models -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   503
				<xsl:copy-of select="document($extra-files[@type='levels']/@href,$extra-files)//layer[@name=$name]/@*[name()='levels' or name()='span']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   504
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   505
			<xsl:apply-templates select="$extra-files[@type='extra']" mode="merge-attributes">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   506
				<xsl:with-param name="cmp" select="."/>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   507
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   508
			<xsl:if test="@name='Programming Support' and not(@span)"><xsl:attribute name="span">2</xsl:attribute></xsl:if> <!-- hack!!!!! -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   509
			<xsl:call-template name="abbrev"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   510
		 	<xsl:apply-templates select="*" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   511
				<xsl:with-param name="extra-files" select="$extra-files"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   512
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   513
		</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   514
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   515
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   516
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   517
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   518
<!-- hack for old models -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   519
<xsl:template match="logicalsubset[@name='J2ME']" mode="merge" priority="5"><xsl:param name="extra-files"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   520
	<xsl:apply-templates select="*" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   521
		<xsl:with-param name="extra-files" select="$extra-files"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   522
	</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   523
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   524
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   525
<!-- update old model names, these could be done as a set of templates instead.
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   526
	I've no idea which is more efficient -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   527
<xsl:template match="*" mode="item-tag">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   528
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   529
		<xsl:when test="self::module">collection</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   530
		<xsl:when test="self::logicalset">block</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   531
		<xsl:when test="self::logicalsubset">subblock</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   532
		<xsl:otherwise><xsl:value-of select="name()"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   533
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   534
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   535
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   536
<xsl:template match="*" mode="alt-tag"> <!-- for compatability-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   537
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   538
		<xsl:when test="self::collection">module</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   539
		<xsl:when test="self::block">logicalset</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   540
		<xsl:when test="self::subblock">logicalsubset</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   541
		<xsl:otherwise><xsl:value-of select="name()"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   542
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   543
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   544
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   545
<xsl:template match="collection|block|subblock | module|logicalset|logicalsubset" mode="merge"><xsl:param name="extra-files"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   546
	<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   547
	<xsl:if test="$e!=''">	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   548
		<xsl:variable name="tag"><xsl:apply-templates mode="item-tag" select="."/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   549
		<xsl:variable name="alt-tag"><xsl:apply-templates mode="alt-tag" select="."/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   550
		<xsl:element name="{$tag}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   551
			<xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   552
			<xsl:variable name="name" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   553
			<xsl:copy-of select="$extra-files[self::display and @name=$name]/@*[name()!='name']"/>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   554
			<xsl:if test="not(self::logicalsubset or self::subblock) and $extra-files[@type='levels']">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   555
				<xsl:copy-of select="document($extra-files[@type='levels']/@href,$extra-files)//*[@name=$name and (name()=$tag or name()=$alt-tag)]/@*[starts-with(name(),'level') or name()='span']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   556
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   557
			<xsl:apply-templates select="$extra-files[@type='extra']" mode="merge-attributes">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   558
				<xsl:with-param name="cmp" select="."/>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   559
			</xsl:apply-templates>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   560
			<xsl:call-template name="abbrev"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   561
			<xsl:apply-templates select="*" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   562
				<xsl:with-param name="extra-files" select="$extra-files"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   563
			</xsl:apply-templates>	  
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   564
		</xsl:element>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   565
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   566
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   567
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   568
<!-- sched 12 -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   569
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   570
<xsl:template match="Schedule12/*[@name]" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   571
	<s12>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   572
		<!-- allow multiple s12 in a component so shapes can pick the right one for the supplied version-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   573
		<xsl:attribute name="ver"><xsl:value-of select="/Schedule12/@OS_version"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   574
		<xsl:apply-templates select="." mode="osd"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   575
		<xsl:copy-of select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   576
	</s12>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   577
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   578
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   579
<xsl:template match="*" mode="osd"> <!-- CR, OS, OR, CS or anything new -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   580
	<xsl:attribute name="osd"><xsl:value-of select="name()"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   581
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   582
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   583
<xsl:template match="REF" mode="osd">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   584
	<xsl:attribute name="osd">T-R</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   585
	<xsl:attribute name="ref">true</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   586
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   587
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   588
<xsl:template match="TEST|RT" mode="osd">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   589
	<xsl:attribute name="osd">T-R</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   590
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   591
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   592
<!--/sched 12 -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   593
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   594
<!-- filters -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   595
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   596
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   597
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   598
<xsl:template name="is-present">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   599
	<!-- use this for filtering if we need to use simple filtering
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   600
		only necessary if we can't use node-set filters -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   601
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   602
		<xsl:when test="not($simple-filters)">1</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   603
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   604
			<xsl:variable name="show">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   605
				<xsl:apply-templates select="." mode="filter-value"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   606
			</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   607
			<!-- filter accept="..." takes precedence over "rich" filters, so if the rich filter
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   608
				says the item is present, then we still need to check to see if it should be
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   609
				shown via the mode="present" template	-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   610
			<xsl:if test="$show='' or $show='show'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   611
				<xsl:apply-templates select="." mode="present"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   612
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   613
		</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   614
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   615
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   616
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   617
<xsl:template match="component" mode="present" priority="8">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   618
	<xsl:variable name="e"><xsl:apply-templates select="unit|package|prebuilt" mode="present"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   619
	<xsl:if test="$e!='' or not(unit|package|prebuilt)">1</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   620
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   621
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   622
<xsl:template match="layer|block|subblock|collection | module|logicalset|logicalsubset" mode="present" priority="9">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   623
	<xsl:variable name="t" select="name()"/><xsl:variable name="n" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   624
	<xsl:variable name="alt"><xsl:apply-templates select="." mode="alt-tag"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   625
	<xsl:if test="not($ignore[(@type=$t or @type=$alt) and @name=$n])"> <!-- matches either e.g. module or colelction -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   626
		<xsl:apply-templates select="descendant::component" mode="present"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   627
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   628
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   629
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   630
<xsl:template match="component[@filter]" mode="present" priority="9">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   631
	<!-- if there's a filter then check to see if this is filtered out -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   632
	<xsl:variable name="e0"><xsl:call-template name="present"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   633
	<xsl:if test="$e0!=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   634
		<xsl:variable name="e1"><xsl:apply-templates select="unit|package|prebuilt" mode="present"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   635
		<xsl:if test="$e1!=''  or not(unit|package|prebuilt)">1</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   636
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   637
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   638
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   639
<xsl:template match="*[not(@filter)]" mode="present" priority="5">1</xsl:template> <!-- if no filter, must always be valid -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   640
<xsl:template match="*[@filter]" mode="present"><xsl:call-template name="present"/></xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   641
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   642
<xsl:template match="*[contains(@filter,',')]" mode="present">	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   643
	<!-- if the number of comma-separated items is the same as the number of items present, then this is present (ie we're ANDing the items)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   644
	<xsl:variable name="present"><xsl:call-template name="present-list"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   645
	<xsl:if test="string-length(@filter) - string-length(translate(@filter,',','')) + 1 = string-length($present)">1</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   646
</xsl:template>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   647
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   648
<xsl:template name="present-list"><xsl:param name="filter" select="@filter"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   649
	<xsl:call-template name="present">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   650
		<xsl:with-param name="filter">	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   651
			<xsl:when test="contains($filter,',')"><xsl:value-of select="substring-before($filter,',')"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   652
			<xsl:otherwise><xsl:value-of select="$filter"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   653
		</xsl:choose></xsl:with-param>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   654
	</xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   655
	<xsl:if test="contains($filter,',')"><xsl:call-template name="present-list">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   656
		<xsl:with-param name="filter" select="substring-after($filter,',')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   657
	</xsl:call-template></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   658
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   659
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   660
<xsl:template name="present"><xsl:param name="filter" select="@filter"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   661
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   662
		<xsl:when test="$filter-in=',' and $filter-nodes">1</xsl:when> <!-- accept everything -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   663
		<xsl:when test="contains($filter-in,concat(',',$filter,','))">1</xsl:when> <!-- accept anything explictly on accept list -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   664
		<xsl:when test="starts-with($filter,'!') and contains($filter-in,concat(',',substring($filter,2),','))"/> <!--reject if expliftly to accept a something with a "not" -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   665
		<xsl:when test="starts-with($filter,'!')">1</xsl:when> <!--it's not on the must-have list, so accept it -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   666
		<!-- reject otherwise -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   667
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   668
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   669
<!-- node-set filters -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   670
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   671
<xsl:template mode="filter-for-presence" match="comment() | node()" priority="-1"><xsl:copy-of select="."/></xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   672
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   673
<xsl:template mode="filter-for-presence" match="layer|block|subblock|collection | logicalset|logicalsubset|module">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   674
	<xsl:variable name="t" select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   675
	<xsl:variable name="alt"><xsl:apply-templates select="." mode="alt-tag"/></xsl:variable>	<!-- for bkward compat -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   676
	<xsl:variable name="n" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   677
	<xsl:if test="not($ignore[(@type=$t or @type=$alt) and @name=$n])">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   678
		<xsl:variable name="content">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   679
			<xsl:apply-templates  select="comment() | *" mode="filter-for-presence"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   680
		</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   681
		<xsl:if test="exslt:node-set($content)/*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   682
			<xsl:copy><xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   683
				<xsl:copy-of select="$content"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   684
			</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   685
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   686
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   687
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   688
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   689
<xsl:template match="filter" mode="filter-values"><xsl:param name="c"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   690
	<xsl:variable name="att" select="@select"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   691
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   692
		<xsl:when test="not($c[self::component])"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   693
		<xsl:when test="@select='*'"> <!-- always matches -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   694
				<xsl:value-of select="concat(' ',@display)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   695
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   696
		<xsl:when test="not($c/@*[name()=$att] or $c/*[self::unit or self::package or self::prebuilt]/@*[name()=$att])"/> <!-- this filter does not match this component-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   697
		<xsl:when test="not(@value) or @value='*'">	<!-- true if just checking for the presence of the attribute on the item -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   698
				<xsl:value-of select="concat(' ',@display)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   699
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   700
		<xsl:when test="@select='filter'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   701
			<!--  @value must be in the comma-separated list of filter on this or child-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   702
			<xsl:if test="contains(concat(',',$c/@filter,',',$c/*/@filter,','),concat(',',@value,','))">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   703
				<xsl:value-of select="concat(' ',@display)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   704
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   705
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   706
		<xsl:when test="@select='class'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   707
			<!--  @value must be in the whitespace-separated list -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   708
			<xsl:if test="contains(concat(' ',normalize-space($c/@class),' '),concat(' ',@value,' '))">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   709
				<xsl:value-of select="concat(' ',@display)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   710
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   711
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   712
		<!--  any other attribute must match exactly on the component -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   713
		<xsl:when test="@value= $c/@*[name()=$att]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   714
				<xsl:value-of select="concat(' ',@display)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   715
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   716
		<!--  other attributes on unit children must also match exactly -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   717
		<xsl:when test="@value= $c/*/@*[name()=$att]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   718
				<xsl:value-of select="concat(' ',@display)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   719
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   720
	</xsl:choose>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   721
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   722
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   723
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   724
<xsl:template match="*" mode="filter-value"/> <!-- no filter value unless otherwise specified -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   725
<xsl:template match="component" priority="1"  mode="filter-value"> <!-- only components can have "rich" filters, though some attributes can apply to units-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   726
	<xsl:variable name="this" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   727
	<xsl:call-template name="last-in-list">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   728
		<xsl:with-param name="str">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   729
			<xsl:apply-templates select="$filter-nodes" mode="filter-values">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   730
				<xsl:with-param name="c" select="$this"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   731
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   732
		</xsl:with-param>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   733
	</xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   734
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   735
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   736
<!-- this will add a display="..." attribute to the item for any display value other than
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   737
	'hide' (which does not include the item in the output) and
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   738
	'show' (which includes the item, but the attribtue is not needed, since it should appear like any other item) -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   739
<xsl:template mode="filter-for-presence" match="component|unit|package|prebuilt" priority="1">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   740
	<xsl:variable name="show">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   741
		<xsl:apply-templates select="." mode="filter-value"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   742
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   743
	<xsl:if test="$show='' or $show!='hide'">	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   744
		<xsl:variable name="this" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   745
		<xsl:if test="not($ignore[@type=name($this) and $this/@name=@name])"> 	<!-- hide component if specifically told to ignore -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   746
			<xsl:variable name="e"><xsl:apply-templates select="." mode="present"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   747
			<!-- show component if any CBRs survive the filters or this is a placeholder with no content -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   748
			<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   749
				<xsl:when test="$e='' "/> <!-- filtered out, don't show -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   750
				<xsl:when test="self::component">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   751
					<xsl:variable name="content">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   752
						<xsl:apply-templates  select="comment() | *" mode="filter-for-presence"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   753
					</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   754
					<xsl:if test="exslt:node-set($content)/* or not(*)"> <!-- show all empty components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   755
						<xsl:copy><xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   756
							<xsl:if test="$show!='' and $show!='show'"><xsl:attribute name="display"><xsl:value-of select="$show"/></xsl:attribute></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   757
							<xsl:copy-of select="$content"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   758
						</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   759
					</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   760
				</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   761
				<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   762
			</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   763
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   764
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   765
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   766
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   767
<!-- /filters -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   768
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   769
<!-- ======= rules to merge various aux data ============== -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   770
<xsl:template match="*" mode="merge-attributes"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   771
<xsl:template match="*" mode="merge-content"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   772
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   773
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   774
<xsl:template match="/values" mode="merge-attributes"><xsl:param name="cmp"/><xsl:param name="base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   775
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   776
		<xsl:if test="$base[@type!='style' and @type!='color']"> <!-- style and colour can have any number of values, so it needs to be captured in an element -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   777
			<xsl:variable name="join"><xsl:if test="$base/@type!=''">-</xsl:if></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   778
			<xsl:variable name="value" select="key('named',$cmp/@name)[self::component]/.."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   779
			<xsl:if test="$value/@value">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   780
				<xsl:attribute name="generator{$join}{$base/@type}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   781
					<xsl:apply-templates select="$value" mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   782
						<xsl:with-param select="$base" name="base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   783
					</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   784
				</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   785
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   786
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   787
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   788
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   789
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   790
<xsl:template match="/values" mode="merge-content"><xsl:param name="cmp"/><xsl:param name="base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   791
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   792
		<xsl:if test="$base[@type='style' or @type='color']"> <!-- at this point, only style and color can have multiple values -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   793
			<xsl:variable name="join"><xsl:if test="$base/@type!=''">-</xsl:if></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   794
			<xsl:variable name="value" select="key('named',$cmp/@name)[self::component]/.."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   795
			<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   796
				<xsl:when test="$value">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   797
					<xsl:for-each select="$value">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   798
						<xsl:element name="generator{$join}{$base/@type}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   799
						 	<xsl:attribute name="ref">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   800
								<xsl:apply-templates select="." mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   801
									<xsl:with-param select="$base" name="base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   802
								</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   803
							</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   804
						</xsl:element>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   805
					</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   806
				</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   807
				<xsl:when test="@default">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   808
					<xsl:element name="generator{$join}{$base/@type}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   809
					 	<xsl:attribute name="ref">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   810
							<xsl:apply-templates select="$base" mode="style-id"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   811
						</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   812
					</xsl:element>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   813
				</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   814
			</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   815
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   816
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   817
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   818
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   819
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   820
<!-- unsupported proprietary format -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   821
<xsl:template match="/techstreams" mode="merge-attributes"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   822
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   823
		<xsl:attribute name="ts"><xsl:value-of select="key('named',$cmp/@name)[name()='component' and not(@type)]/../@name"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   824
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   825
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   826
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   827
<xsl:template match="/techstreams" mode="merge-content"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   828
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   829
		<xsl:for-each select="key('named',$cmp/@name)[name()='component']">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   830
			<xsl:for-each select="self::component[not(@type)]/ancestor::group">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   831
				<ts-group><xsl:copy-of select="@*"/></ts-group>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   832
			</xsl:for-each>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   833
			<xsl:for-each select="owners">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   834
				<xsl:copy><xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   835
					<xsl:if test="@type"><xsl:attribute name="ts"><xsl:value-of select="../../@name"/></xsl:attribute></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   836
				<xsl:copy-of select="*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   837
				</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   838
			</xsl:for-each>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   839
		</xsl:for-each>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   840
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   841
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   842
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   843
<!-- unsupported proprietary format -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   844
<xsl:template match="/attributes" mode="merge-attributes"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   845
	<xsl:for-each select="key('named',$cmp/ancestor::layer/@name)[self::layer and @inherit='yes']">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   846
		<xsl:copy-of select="attrs/@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   847
	</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   848
	<xsl:for-each select="key('named',$cmp/ancestor::block/@name)[self::block and @inherit='yes']">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   849
		<xsl:copy-of select="attrs/@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   850
	</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   851
	<xsl:for-each select="key('named',$cmp/ancestor::subblock/@name)[self::subblock and @inherit='yes']">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   852
		<xsl:copy-of select="attrs/@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   853
	</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   854
	<xsl:for-each select="key('named',$cmp/ancestor::collection/@name)[self::coll and @inherit='yes']">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   855
		<xsl:copy-of select="attrs/@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   856
	</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   857
	<xsl:for-each select="key('named',$cmp/@name)[starts-with(local-name($cmp),local-name())]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   858
		<xsl:if test="not(@location) or (@location=$cmp/../@name)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   859
			<xsl:copy-of select="attrs/@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   860
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   861
	</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   862
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   863
<xsl:template match="/attributes" mode="merge-content"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   864
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   865
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   866
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   867
<xsl:template match="/model" mode="merge-attributes"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   868
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   869
		<!-- only use location if there is ambiguity -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   870
		<xsl:variable name="loc">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   871
			<xsl:variable name="name" select="$cmp/@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   872
			<xsl:if test="count($cmp/ancestor::systemModel//component[@name=$name])!=1">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   873
				<xsl:for-each select="$cmp"><xsl:call-template name="location"/></xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   874
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   875
		</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   876
	<!--	<xsl:copy-of select="key('named',$cmp/@name)[name()='c' and ($loc='' or location=$loc)]/@*"/>-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   877
		<xsl:for-each select="key('named',$cmp/@name)[name()='c' and ($loc='' or location=$loc)]/@*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   878
			<xsl:copy-of select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   879
			<xsl:if test="name()='introduced'">   <!-- keep this while still in beta -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   880
				<xsl:attribute name="since"><xsl:value-of select="."/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   881
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   882
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   883
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   884
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   885
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   886
<xsl:template match="/model" mode="merge-content"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   887
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   888
		<xsl:variable name="loc">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   889
			<xsl:variable name="name" select="$cmp/@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   890
			<xsl:if test="count($cmp/ancestor::systemModel//component[@name=$name])!=1">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   891
				<xsl:for-each select="$cmp"><xsl:call-template name="location"/></xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   892
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   893
		</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   894
		<xsl:for-each select="key('named',$cmp/@name)[name()='c' and ($loc='' or location=$loc)]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   895
			<xsl:copy-of select="*[name()!='location' and name()!='bld' and name()!='ts']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   896
			<xsl:apply-templates select="bld" mode="merge"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   897
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   898
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   899
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   900
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   901
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   902
<xsl:template match="/SQL" mode="merge-content"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   903
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   904
		<xsl:variable name="loc"><xsl:for-each select="$cmp"><xsl:call-template name="location"/></xsl:for-each></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   905
		<xsl:for-each select="//ROW[translate(component,'&AZ;','&az;')=translate($cmp/name,'&AZ;','&az;')]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   906
			<xsl:variable name="match">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   907
				<xsl:if test="layer"><xsl:value-of select="layer"/>/</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   908
				<xsl:if test="layer"><xsl:value-of select="block"/>/</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   909
				<xsl:if test="layer"><xsl:value-of select="subblock"/>/</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   910
				<xsl:if test="layer"><xsl:value-of select="collection"/>/</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   911
			</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   912
			<xsl:if test="$match = concat($loc,'/') or 1 "><xsl:apply-templates mode="sql" select="*"/></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   913
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   914
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   915
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   916
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   917
<xsl:template mode="sql" match="*"><xsl:copy-of select="."/></xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   918
<xsl:template mode="sql" match="layer|block|subblock|collection|component"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   919
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   920
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   921
<xsl:template match="/Schedule12" mode="merge-content"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   922
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   923
		<xsl:variable name="match">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   924
			<xsl:call-template name="merge-Schedule12">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   925
				<xsl:with-param name="cmp" select="$cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   926
			</xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   927
		</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   928
		<xsl:if test="$match='' ">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   929
			<xsl:call-template name="Caller-Warning"><xsl:with-param name="text"><xsl:value-of select="$cmp/@name"/> not in Schedule 12</xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   930
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   931
		<xsl:if test="$match!='' ">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   932
			<xsl:apply-templates select="//system_model[$match=@entry]/.." mode="merge"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   933
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   934
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   935
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   936
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   937
<xsl:template name="merge-Schedule12"><xsl:param name="path"/><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   938
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   939
	<!--  match this, then try matching parents -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   940
		<xsl:when test="//system_model[@entry=$cmp/@name]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   941
			<xsl:value-of select="$cmp/@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   942
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   943
		<xsl:when test="$cmp/parent::*[@name]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   944
			<xsl:call-template name="merge-Schedule12">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   945
				<xsl:with-param name="cmp" select="$cmp/parent::*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   946
			</xsl:call-template>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   947
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   948
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   949
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   950
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   951
<xsl:template match="/LicensesFile" mode="merge-content"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   952
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   953
		<xsl:for-each select="//Supplier/Contract">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   954
			<xsl:variable name="n" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   955
			<xsl:variable name="s" select="../@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   956
			<xsl:if test="not(following-sibling::Contract[@name=$n])">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   957
			<xsl:for-each select="$cmp/*[@name]"> <!-- if there is somthing without a contract use Symbian_Default -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   958
				<xsl:if test="(not(@contract) and $n='Symbian_Default') or @contract=$n"><supplier name="{$s}" for="{@name}"/></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   959
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   960
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   961
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   962
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   963
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   964
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   965
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   966
<xsl:template match="/SystemModelDeps" mode="merge-content"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   967
	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   968
		<Build>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   969
			<xsl:variable name="name">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   970
				<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   971
					<xsl:when test="starts-with(@component,'techview_')"><xsl:message/><xsl:value-of select="substring-after(@component,'techview_')"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   972
					<xsl:otherwise><xsl:value-of select="@component"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   973
				</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   974
			</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   975
			<xsl:apply-templates select="//Executable[$cmp/@name=@component or ($cmp/*[contains(@filter,'techview')] and concat('techview_',$cmp/@name)=@component)]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   976
		</Build>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   977
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   978
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   979
<!-- /aux rules -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   980
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   981
<xsl:template match="@root" mode="merge-attributes"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   982
<xsl:template match="@root" mode="merge-content"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   983
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   984
<xsl:template match="@*" mode="merge-attributes"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   985
	<xsl:apply-templates mode="merge-attributes" select="document(.,/)/*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   986
		<xsl:with-param name="cmp" select="$cmp"/>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   987
	</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   988
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   989
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   990
<xsl:template match="info[@type!='symsym']" mode="merge-attributes"><xsl:param name="cmp"/> 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   991
	<!-- not called for symsym snice symsym only adds components -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   992
	<xsl:apply-templates mode="merge-attributes" select="document(@href,/)/*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   993
		<xsl:with-param name="cmp" select="$cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   994
		<xsl:with-param name="base" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   995
	</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   996
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   997
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   998
<xsl:template match="@*" mode="merge-content"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   999
	<xsl:apply-templates mode="merge-content" select="document(.,/)/*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1000
		<xsl:with-param name="cmp" select="$cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1001
	</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1002
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1003
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1004
<xsl:template match="info" mode="merge-content"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1005
	<xsl:apply-templates mode="merge-content" select="document(@href,/)/*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1006
		<xsl:with-param name="cmp" select="$cmp"/>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1007
		<xsl:with-param name="base" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1008
	</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1009
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1010
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1011
<xsl:template match="info[@type='symsym']" mode="merge-content"><xsl:param name="cmp"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1012
	<xsl:variable name="filter" select="@dbfilter"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1013
	<xsl:variable name="use" select="@use"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1014
	<xsl:variable name="include" select="concat(',',@include,',')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1015
	<SQL>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1016
		<xsl:for-each select="document(@href)/SQL/ROW/*[name()=$filter]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1017
			<xsl:variable name="name" select="translate(.,'&AZ;','&az;')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1018
			<xsl:if test="($use='mrp' and $cmp/*[translate(@name,'&AZ;','&az;')=$name]) or ($use='component' and translate($cmp/@name,'&AZ;','&az;')=$name)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1019
			 	<xsl:for-each select="..">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1020
					<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1021
						<xsl:for-each select="*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1022
							<xsl:if test="$include=',,' or contains($include,concat(',',name(),','))"><xsl:copy-of select="."/></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1023
						</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1024
					</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1025
				</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1026
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1027
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1028
	</SQL>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1029
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1030
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1031
<xsl:template match="component" mode="merge"><xsl:param name="extra-files"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1032
	<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1033
	<xsl:if test="$e!=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1034
		<xsl:copy><xsl:copy-of select="@*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1035
			<xsl:if test="$Origin-attr!='' and not(@*[local-name()=$Origin-attr]) and /SystemDefinition/@name!=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1036
				<xsl:attribute name="{$Origin-attr}">	<!-- indicate which model this came from -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1037
					<xsl:value-of select="/SystemDefinition/@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1038
				</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1039
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1040
			<xsl:apply-templates select="$extra-files" mode="merge-attributes">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1041
				<xsl:with-param name="cmp" select="."/>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1042
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1043
			<xsl:call-template name="abbrev"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1044
			<xsl:apply-templates select="$extra-files" mode="merge-content">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1045
				<xsl:with-param name="cmp" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1046
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1047
			<xsl:apply-templates select="*" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1048
				<xsl:with-param name="extra-files" select="$extra-files"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1049
			</xsl:apply-templates>	 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1050
		</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1051
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1052
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1053
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1054
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1055
<xsl:template match="component/*" mode="merge"><xsl:param name="extra-files"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1056
<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1057
<xsl:if test="$e!=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1058
		<xsl:copy><xsl:copy-of select="@*"/> <!-- only put root attribute on units with a path in them - does not make sense otherwise -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1059
		<xsl:if test="not(@root) and (@mrp or @bldFile)"><xsl:copy-of select="$extra-files[name()='root']"/></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1060
		<xsl:copy-of select="node()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1061
	</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1062
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1063
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1064
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1065
<xsl:template name="abbrev">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1066
	<xsl:variable name="n" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1067
	<xsl:variable name="match" select="$abbrevs[@name=$n]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1068
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1069
		<xsl:when test="not($match)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1070
		<xsl:when test="self::techstream">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1071
			<xsl:attribute name="label"><xsl:value-of select="$match/@abbrev"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1072
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1073
	<!-- 	<xsl:when test="self::component">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1074
			<name><xsl:copy-of select="$match/@font|$match/../@font"/><xsl:value-of select="$match/@abbrev"/></name>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1075
		</xsl:when>-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1076
		<xsl:otherwise><xsl:copy-of select="$match/@abbrev|$match/@font|$match/../@font"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1077
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1078
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1079
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1080
<xsl:template name="location">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1081
	<xsl:if test="../../@name"><xsl:for-each select="parent::*[@name]"><xsl:call-template name="location"/>/</xsl:for-each></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1082
	<xsl:if test="../@name"><xsl:value-of select="../@name"/></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1083
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1084
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1085
<xsl:template match="Executable">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1086
	<Bin><xsl:copy-of select="@*[name()!='component']|*"/></Bin>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1087
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1088
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1089
<!-- /merge model with extra -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1090
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1091
<!-- merge logo -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1092
<xsl:template match="layout/logo" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1093
	<xsl:copy><xsl:copy-of select="@width | @height"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1094
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1095
		<xsl:when test="@embed='yes' or @embed='true' ">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1096
			<xsl:for-each select="document(@src,.)/s:svg">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1097
				<xsl:copy-of select="@viewBox"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1098
				<xsl:copy-of select="*"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1099
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1100
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1101
		<xsl:otherwise><xsl:copy-of select="@src"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1102
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1103
	</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1104
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1105
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1106
<!-- merge legend -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1107
<xsl:template match="layout/legend" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1108
	<legend-layer><xsl:copy-of select="@*[name()!='literal']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1109
		<xsl:if test="not(@literal='yes' or @literal='true') and contains(@label,'{')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1110
			<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1111
		</xsl:if>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1112
	<!-- only draw footer items if they are not referenced elsewhere in a label -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1113
		<xsl:variable name="footer">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1114
			<xsl:for-each select="/model/@copyright|/model/@distribution">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1115
				<xsl:variable name="a" select="concat('@',name())"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1116
				<xsl:if test="not(/model/layout//legend[contains(@label,$a)]) and not(/model/layout//legend/note[contains(.,$a)])">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1117
					<xsl:value-of select="concat(name(),' ')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1118
				</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1119
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1120
		</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1121
		<xsl:if test="$footer!=''"><xsl:attribute name="footer"><xsl:value-of select="normalize-space($footer)"/></xsl:attribute></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1122
		<xsl:apply-templates select="*" mode="merge"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1123
	</legend-layer>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1124
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1125
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1126
<xsl:template match="legend" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1127
	<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1128
		<xsl:copy-of select="@*[name()!='literal']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1129
		<xsl:if test="not(@literal='yes' or @literal='true') and contains(@label,'{')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1130
			<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1131
		</xsl:if>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1132
		<xsl:apply-templates select="*" mode="merge"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1133
	</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1134
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1135
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1136
<xsl:template match="legend/note|legend/s:svg" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1137
	<xsl:copy><xsl:copy-of select="@*[name()!='literal']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1138
		<xsl:if test="self::note and not(@literal='yes' or @literal='true') and contains(.,'{')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1139
			<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1140
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1141
		<xsl:copy-of select="node()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1142
	</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1143
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1144
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1145
<xsl:template match="cmp" mode="merge"><xsl:param name="model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1146
	<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1147
		<xsl:apply-templates select="@*" mode="generated-value">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1148
			<xsl:with-param name="model" select="$model"/>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1149
		</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1150
		<xsl:if test="not(@literal='yes' or @literal='true') and contains(.,'{')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1151
			<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1152
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1153
		<xsl:copy-of select="text()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1154
	</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1155
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1156
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1157
<!--not sure if this bit is actually used anywhere -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1158
<xsl:template match="@*" mode="generated-value"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1159
<xsl:template match="@overlay|@border|@style" mode="generated-value">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1160
	<xsl:variable name="n" select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1161
	<xsl:variable name="v" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1162
	<xsl:variable name="m" select="//*[name()=$n and @label=$v]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1163
	<xsl:if test="count($m)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1164
		<xsl:attribute name="generator-{$n}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1165
			<xsl:apply-templates select="$m" mode="style-id"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1166
		</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1167
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1168
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1169
<!--not sure if this bit is actually used anywhere -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1170
<xsl:template match="@color" mode="generated-value"><xsl:param name="model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1171
	<xsl:variable name="v" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1172
	<xsl:variable name="m" select="//color[@label=$v]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1173
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1174
		<xsl:when test="count($m)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1175
			<xsl:attribute name="generator-color"><xsl:apply-templates select="$m" mode="style-id"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1176
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1177
		<xsl:when test="$model//info[@type='color']">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1178
			<xsl:attribute name="generator-color">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1179
				<xsl:variable name="m0" select="$model//info[@type='color']/@href"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1180
				<xsl:apply-templates select="document($m0/@href,$m0)//item[@label=$v]" mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1181
					<xsl:with-param name="base" select="$m0"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1182
				</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1183
			</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1184
		</xsl:when>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1185
		<xsl:when test="//colors[not(*) and @match='@ts']">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1186
			<xsl:variable name="id"><xsl:apply-templates select="//colors[not(*) and @match='@ts']" mode="style-id"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1187
			<xsl:for-each select="document($model/@ts)//techstream[@name=$v]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1188
				<xsl:attribute name="generator-color"><xsl:value-of select="concat($id,'-color',count(preceding::techstream))"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1189
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1190
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1191
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1192
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1193
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1194
<xsl:template match="title" mode="merge"><xsl:copy-of select="."/></xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1195
<xsl:template match="ts" mode="merge"><cbox><xsl:copy-of select="@*|node()"/></cbox></xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1196
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1197
<xsl:template match="legend[s:g]" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1198
<xsl:copy-of select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1199
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1200
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1201
<xsl:template match="legend" mode="copy">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1202
	<xsl:copy-of select="@*[name()!='use' or name()='literal']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1203
	<xsl:if test="not(@literal='yes' or @literal='true') and contains(@label,'{')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1204
		<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1205
	</xsl:if>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1206
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1207
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1208
<xsl:template match="legend[@use]" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1209
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1210
	<!-- 	$tag = bit after the # (can be empty)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1211
		$pre is bit before the # (can be empty)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1212
		$file is file pointed to by pre (can be empty) -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1213
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1214
	<xsl:variable name="tag" select="substring-after(@use,'#')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1215
	<xsl:variable name="pre">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1216
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1217
			<xsl:when test="$tag!=''"><xsl:value-of select="substring-before(@use,'#')"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1218
			<xsl:otherwise><xsl:value-of select="@use"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1219
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1220
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1221
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1222
	<xsl:variable name="file">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1223
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1224
			<xsl:when test="starts-with($pre,'@')"><xsl:value-of select="//model/@*[name()=substring($pre,2)]"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1225
			<xsl:otherwise><xsl:value-of select="$pre"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1226
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1227
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1228
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1229
	<xsl:variable name="model" select="/model"/>  <!--  hack for xsltproc -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1230
	<xsl:variable name="legend" select="."/>  <!--  hack for xsltproc -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1231
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1232
	<xsl:variable name="this" select="."/>  <!--  save node just in case need to use more than once -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1233
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1234
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1235
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1236
		<xsl:when test="$tag!='' and $pre=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1237
			<!-- pre is empty, but tag is not, so this legend is an info in this file -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1238
			<xsl:for-each select="ancestor::layout/info[@type=$tag]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1239
				<legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1240
					<xsl:apply-templates select="$this" mode="copy"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1241
					<xsl:apply-templates select="." mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1242
						<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1243
						<xsl:with-param name="legend" select="$legend"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1244
					</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1245
				</legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1246
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1247
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1248
		<xsl:when test="$tag!=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1249
			<xsl:for-each select="document($file,/)/*/*[name()=$tag]">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1250
				<legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1251
					<xsl:apply-templates select="$this" mode="copy"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1252
					<xsl:apply-templates select="." mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1253
						<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1254
						<xsl:with-param name="legend" select="$legend"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1255
					</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1256
				</legend>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1257
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1258
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1259
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1260
			<xsl:for-each select="document($file,/)/*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1261
				<legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1262
					<xsl:apply-templates select="$this" mode="copy"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1263
					<xsl:apply-templates select="." mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1264
						<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1265
						<xsl:with-param name="legend" select="$legend"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1266
					</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1267
				</legend>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1268
			</xsl:for-each>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1269
			</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1270
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1271
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1272
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1273
<xsl:template match="info[(@type='color'  or @type='overlay' or @type='style' or @type='border') and document(@href,.)/values]" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1274
	<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1275
	<xsl:attribute name="type">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1276
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1277
			<xsl:when test="@type='color'">cbox</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1278
			<xsl:otherwise>cmp</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1279
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1280
	</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1281
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1282
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1283
<xsl:template match="text()" mode="merge"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1284
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1285
<!-- Any ref with a type attribute that starts with a # indicates a literal ref, so just copy it -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1286
<xsl:template match="*[starts-with(@type,'#')]" mode="ref" priority="1"><xsl:value-of select="@type"/></xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1287
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1288
<!-- Borders in legend -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1289
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1290
<xsl:template match="border" mode="ref">#Border<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1291
		<xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1292
		<xsl:otherwise>Shape<xsl:value-of select="count(preceding::border)"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1293
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1294
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1295
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1296
<xsl:template match="color[../@type='highlight' or ../@type='text-highlight']" mode="ref">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1297
	<xsl:value-of select="concat('#',../@type,count(preceding::color[../@type]))"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1298
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1299
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1300
<!-- Colours in legend -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1301
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1302
<xsl:template match="/shapes/colors/color[not(@value|@label)]" mode="merge" priority="3"/> 	<!-- use value if no label, but don't show if neither -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1303
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1304
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1305
<!-- can have any number of these, so put in a sub-legend -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1306
<xsl:template match="/shapes/examples" mode="merge"><xsl:param name="model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1307
	<xsl:param name="legend"/>	<!-- label on legend overrides label in values document -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1308
	<xsl:variable name="tag" select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1309
	<xsl:variable name="content">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1310
		<!-- don't show this label if there is a label defined in the Model XML doc *and* this is the first legend item of this type (e.g colors, styles, etc)	 -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1311
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1312
			<xsl:when test="@sort='yes'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1313
				<xsl:apply-templates mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1314
					<xsl:sort select="@label"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1315
					<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1316
				</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1317
			</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1318
			<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1319
				<xsl:apply-templates mode="merge"><xsl:with-param name="model" select="$model"/></xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1320
			</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1321
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1322
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1323
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1324
		<xsl:when test="count(//*[name()=$tag]) != 1">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1325
			<legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1326
				<xsl:if test="not($legend) or not($legend/@label) or preceding-sibling::*[name()=$tag]"><xsl:apply-templates select="@label"  mode="legend-abbrev"/></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1327
				<xsl:copy-of select="$content"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1328
			</legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1329
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1330
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1331
			<xsl:copy-of select="@sort|@show-unused"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1332
			<xsl:if test="not($legend) or not($legend/@label) or preceding-sibling::*[name()=$tag]"><xsl:apply-templates select="@label"  mode="legend-abbrev"/></xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1333
			<xsl:copy-of select="$content"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1334
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1335
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1336
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1337
<!-- can have any number of these, so put in a sub-legend -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1338
<xsl:template match="/shapes/styles|/shapes/colors|/shapes/patterns|/shapes/borders" mode="merge">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1339
	<xsl:variable name="tag" select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1340
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1341
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1342
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1343
		<xsl:when test="count(//*[name()=$tag]) != 1">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1344
			<legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1345
				<xsl:copy-of select="@sort|@show-unused"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1346
				<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1347
				<xsl:attribute name="type">cmp</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1348
			</legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1349
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1350
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1351
			<xsl:copy-of select="@sort|@show-unused"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1352
			<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1353
			<xsl:attribute name="type">cmp</xsl:attribute>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1354
		</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1355
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1356
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1357
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1358
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1359
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1360
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1361
<xsl:template match="overlay" mode="ref">#Pattern<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1362
		<xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1363
		<xsl:otherwise>Overlay<xsl:value-of select="count(preceding::overlay)"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1364
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1365
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1366
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1367
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1368
<xsl:template match="/shapes/*/*[not(@label)]" mode="merge"/> <!--  don't show legend items with no label -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1369
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1370
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1371
<xsl:template match="/shapes" mode="as-example"><xsl:param name="at"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1372
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1373
		<xsl:when test="name($at)='border' or name($at)='overlay'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1374
			<xsl:attribute name="generator-{name($at)}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1375
				<xsl:apply-templates  select="//*[name()=name($at) and @label=$at]" mode="style-id"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1376
			</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1377
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1378
		<xsl:when test="name($at)='style'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1379
			<xsl:attribute name="generator-{name($at)}"><xsl:apply-templates  select="//style[@label=$at]" mode="style-id"/></xsl:attribute>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1380
		</xsl:when>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1381
		<xsl:when test="name($at)='color-highlight'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1382
			<xsl:attribute name="generator-highlight">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1383
				<xsl:apply-templates select="//colors[@type='highlight']/color[@label=$at]" mode="style-id"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1384
			</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1385
		</xsl:when>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1386
		<xsl:when test="name($at)='color-text-highlight'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1387
			<xsl:attribute name="generator-text-highlight">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1388
				<xsl:apply-templates select="//colors[@type='text-highlight']/color[@label=$at]" mode="style-id"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1389
			</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1390
		</xsl:when>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1391
		<xsl:when test="name($at)='color'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1392
			<xsl:attribute name="generator-color">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1393
				<xsl:apply-templates select="//colors[not(@type) or @type='background']/color[@label=$at]/@color" mode="style-id"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1394
			</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1395
		</xsl:when>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1396
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1397
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1398
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1399
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1400
<xsl:template match="examples/cmp" mode="merge"><xsl:param name="model"/><xsl:param name="shapes" select="/shapes"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1401
	<cmp>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1402
		<xsl:if test="not(@literal='yes' or @literal='true') and contains(.,'{')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1403
			<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1404
		</xsl:if>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1405
		<xsl:for-each select="@*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1406
			<xsl:apply-templates select="$shapes" mode="as-example">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1407
				<xsl:with-param name="at" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1408
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1409
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1410
		<xsl:apply-templates mode="generated-value" select="@color">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1411
			<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1412
		</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1413
		<xsl:copy-of select="text()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1414
	</cmp>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1415
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1416
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1417
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1418
<xsl:template match="/shapes/colors[not(*)]" mode="merge"><xsl:param name="model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1419
<!-- special known type which can be generated -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1420
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1421
		<xsl:when test="count(//colors) != 1 and @match='@ts' and $model">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1422
			<legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1423
				<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1424
				<xsl:attribute name="sort">yes</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1425
				<xsl:attribute name="type">cbox</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1426
			</legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1427
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1428
		<xsl:when test="@match='@ts' and $model">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1429
			<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1430
			<xsl:attribute name="sort">yes</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1431
			<xsl:attribute name="type">cbox</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1432
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1433
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1434
			<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">no colour data</xsl:with-param></xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1435
		</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1436
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1437
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1438
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1439
<!-- /merge legend -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1440
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1441
<!-- new experimetal stuff  -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1442
<xsl:template match="node()" mode="styling"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1443
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1444
<xsl:template match="@shapes" mode="styling">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1445
	<xsl:variable name="model" select=".."/> <!-- hack for xsltproc -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1446
	<xsl:apply-templates select="document(.,.)/shapes/*" mode="styling">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1447
	<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1448
	</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1449
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1450
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1451
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1452
<xsl:template match="info" mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1453
	<xsl:value-of select="concat('i',count(preceding-sibling::info))"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1454
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1455
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1456
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1457
<xsl:template match="/values" mode="style-id"><xsl:param name="base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1458
	<xsl:apply-templates select="$base" mode="style-id"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1459
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1460
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1461
<xsl:template match="/values/item" mode="style-id"><xsl:param name="base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1462
	<xsl:apply-templates select="$base" mode="style-id"/>-<xsl:value-of select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1463
	<xsl:value-of select="count(preceding-sibling::*)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1464
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1465
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1466
<xsl:template match="colors|borders|patterns|styles" mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1467
	<xsl:value-of select="concat('s',count(preceding-sibling::*))"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1468
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1469
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1470
<xsl:template match="examples/cmp" mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1471
	<xsl:value-of select="concat('e',count(preceding::cmp[parent::examples]))"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1472
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1473
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1474
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1475
<xsl:template match="note" mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1476
	<xsl:value-of select="concat('n',count(preceding::note))"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1477
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1478
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1479
<xsl:template match="legend" mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1480
	<xsl:value-of select="concat('L',count(preceding::legend))"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1481
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1482
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1483
<xsl:template match="colors/color|borders/border|patterns/overlay|styles/style" mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1484
	<xsl:apply-templates select=".." mode="style-id"/>-<xsl:value-of select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1485
	<xsl:value-of select="count(preceding-sibling::*)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1486
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1487
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1488
<xsl:template match="layout/info[@type='color' or @type='border' or @type='overlay' or @type='style']" mode="styling">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1489
	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1490
	<xsl:variable name="base" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1491
	<group style-id="{$id}" detail="component">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1492
		<xsl:copy-of select="@type | @show-unused"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1493
		<xsl:for-each select="document(@href,.)/values">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1494
			<xsl:copy-of select="@default"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1495
			<xsl:apply-templates select="@label"  mode="legend-abbrev"/>				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1496
			<xsl:for-each select="item">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1497
				<xsl:variable name="el">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1498
					<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1499
						<xsl:when test="$base/@type='color'">cbox</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1500
						<xsl:otherwise>cmp</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1501
					</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1502
				</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1503
				<xsl:element name="{$el}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1504
					<xsl:attribute name="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1505
						<xsl:apply-templates select="." mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1506
							<xsl:with-param name="base" select="$base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1507
						</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1508
					</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1509
					<xsl:apply-templates select="@label"  mode="legend-abbrev"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1510
					<xsl:attribute name="value">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1511
					<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1512
						<xsl:when test="not(starts-with(@value,'#')) and $base/@type='border' ">#Border<xsl:value-of select="@value"/></xsl:when> 
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1513
						<xsl:when test="not(starts-with(@value,'#')) and $base/@type='overlay' ">#Pattern<xsl:value-of select="@value"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1514
							<!-- highlight not allowed in values files, but put here anyway -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1515
						<xsl:when test="contains($base/@type,'highlight')">#<xsl:value-of select="$base/@type"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1516
							<xsl:apply-templates select="." mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1517
								<xsl:with-param name="base" select="$base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1518
							</xsl:apply-templates></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1519
						<xsl:otherwise><xsl:value-of select="@value"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1520
					</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1521
					</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1522
				</xsl:element>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1523
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1524
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1525
	</group>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1526
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1527
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1528
<xsl:template match="/shapes/colors[not(@type) or @type='background']" mode="styling"><xsl:param name="model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1529
	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1530
	<group type="color" style-id="{$id}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1531
		<xsl:copy-of select="@default"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1532
		<xsl:call-template name="lgd-group-detail"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1533
		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1534
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1535
		<xsl:when test="not(*) and @match='@ts' and $model">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1536
			<xsl:apply-templates select="document($model/@ts,$model)/*" mode="styling">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1537
				<xsl:with-param name="id" select="$id"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1538
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1539
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1540
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1541
			<xsl:apply-templates mode="styling"><xsl:with-param name="id" select="$id"/></xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1542
		</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1543
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1544
	</group>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1545
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1546
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1547
<xsl:template name="lgd-group-detail">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1548
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1549
		<xsl:when test="self::borders or self::patterns or  not(@match)"><xsl:attribute name="detail">component</xsl:attribute></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1550
		<xsl:when test="@match='component' or @match='collection' or @match='block' or @match='subblock' or @match='layer'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1551
			<xsl:attribute name="detail"><xsl:value-of select="@match"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1552
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1553
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1554
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1555
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1556
<xsl:template match="@label" mode="legend-abbrev">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1557
	<xsl:variable name="n" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1558
	<xsl:variable name="match" select="$abbrevs[@name=$n]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1559
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1560
		<xsl:when test="not($match)"><xsl:copy-of select="."/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1561
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1562
			<xsl:attribute name="label"><xsl:value-of select="$match/@abbrev"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1563
			<xsl:copy-of select="$match/@font"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1564
			<xsl:if test="not($match/@font)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1565
				<xsl:copy-of select="$match/ancestor::display-names/@font"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1566
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1567
		</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1568
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1569
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1570
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1571
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1572
<xsl:template match="/shapes/colors[@type='highlight' or @type='text-highlight']" mode="styling"><xsl:param name="model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1573
	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1574
	<group type="{@type}" style-id="{$id}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1575
		<xsl:call-template name="lgd-group-detail"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1576
		<xsl:copy-of select="@default"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1577
		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1578
		<xsl:apply-templates mode="styling"><xsl:with-param name="id" select="$id"/></xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1579
	</group>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1580
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1581
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1582
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1583
<xsl:template match="/shapes/borders|/shapes/patterns|/shapes/styles" mode="styling"><xsl:param name="model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1584
	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1585
	<group type="{name(*)}" style-id="{$id}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1586
		<xsl:call-template name="lgd-group-detail"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1587
		<xsl:copy-of select="@default"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1588
		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1589
		<xsl:apply-templates mode="styling"><xsl:with-param name="id" select="$id"/></xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1590
	</group>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1591
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1592
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1593
<xsl:template match="/shapes/colors/color|/shapes/borders/border|/shapes/patterns/overlay|/shapes/styles/style" mode="styling">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1594
	<xsl:variable name="my-id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1595
	<xsl:variable name="el">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1596
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1597
			<xsl:when test="self::color[../@type='highlight' or ../@type='text-highlight']">cmp</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1598
			<xsl:when test="self::color">cbox</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1599
			<xsl:otherwise>cmp</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1600
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1601
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1602
	<xsl:element name="{$el}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1603
		<xsl:attribute name="style-id"><xsl:value-of select="$my-id"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1604
		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1605
		<xsl:if test="contains(@label,'{')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1606
			<xsl:attribute name="label-ref"><xsl:value-of select="$my-id"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1607
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1608
		<xsl:if test="@value">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1609
			<xsl:attribute name="lookup"><xsl:value-of select="@value"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1610
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1611
		<xsl:attribute name="value">	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1612
			<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1613
				<xsl:when test="self::style"><xsl:value-of select="."/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1614
				<xsl:when test="self::color[not(../@type) or ../@type='background']"><xsl:value-of select="@color"/></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1615
				<xsl:otherwise><xsl:apply-templates select="." mode="ref"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1616
			</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1617
		</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1618
	</xsl:element>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1619
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1620
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1621
<xsl:template match="/techstreams" mode="styling">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1622
	<xsl:param name="id"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1623
	<xsl:for-each select="//techstream">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1624
		<cbox value="{@color}" lookup="{@name}" style-id="{$id}-color{count(preceding::techstream)}" detail="component">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1625
			<xsl:variable name="n" select="@name"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1626
			<xsl:variable name="match" select="$abbrevs[@name=$n]"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1627
			<xsl:if test="$match">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1628
				<xsl:attribute name="label"><xsl:value-of select="$match/@abbrev"/></xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1629
				<xsl:copy-of select="$match/@font"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1630
				<xsl:if test="not($match/@font)">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1631
					<xsl:copy-of select="$match/ancestor::display-names/@font"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1632
				</xsl:if>				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1633
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1634
		</cbox>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1635
	</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1636
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1637
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1638
<!-- for date formatting: only use if the date functions are *fully* supported (ie not by xalan)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1639
Uses unix date %-encoding, but only a few are supported (see comments)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1640
-->  
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1641
<xsl:template name="format-date"><xsl:param name="date" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1642
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1643
		<xsl:when test="contains($date,'%')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1644
			<xsl:value-of select="substring-before($date,'%')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1645
			<xsl:variable name="rest" select="substring-after($date,'%')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1646
			<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1647
				<xsl:when test="starts-with($rest,'%') or $rest=''">%</xsl:when> <!-- %%     a literal % -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1648
				<xsl:when test="starts-with($rest,'a')"><xsl:value-of select="date:day-abbreviation()"/></xsl:when> <!--      %a     locale’s abbreviated weekday name (e.g., Sun) -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1649
				<xsl:when test="starts-with($rest,'A')"><xsl:value-of select="date:day-name()"/></xsl:when> <!--  %A     locale’s full weekday name (e.g., Sunday)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1650
				<xsl:when test="starts-with($rest,'b') or starts-with($rest,'h')"><xsl:value-of select="date:month-abbreviation()"/></xsl:when><!--       %b     locale’s abbreviated month name (e.g., Jan)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1651
				<xsl:when test="starts-with($rest,'B')"><xsl:value-of select="date:month-name()"/></xsl:when><!--       %B     locale’s full month name (e.g., January)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1652
				<xsl:when test="starts-with($rest,'d')"><xsl:number format="01" value="date:day-in-month()"/></xsl:when><!--%d     day of month (e.g, 01)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1653
				<xsl:when test="starts-with($rest,'e')"><xsl:number format=" 1" value="date:day-in-month()"/></xsl:when><!--%d     day of month (e.g, 01)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1654
				<xsl:when test="starts-with($rest,'F')"><xsl:value-of select="date:date()"/></xsl:when><!--%F     full date; same as %Y-%m-%d-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1655
				<xsl:when test="starts-with($rest,'H')"><xsl:number format="01" value="date:hour-in-day()"/></xsl:when><!--%H     hour (00..23)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1656
				<xsl:when test="starts-with($rest,'I')"><xsl:number format="01" value="((24 + date:hour-in-day() - 1) mod 12) + 1"/></xsl:when><!--%I     hour (01..12)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1657
				<xsl:when test="starts-with($rest,'j')"><xsl:number format="001" value="date:day-in-year()"/></xsl:when><!--%j     day of year (001..366)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1658
				<xsl:when test="starts-with($rest,'k')"><xsl:number format=" 1" value="date:hour-in-day()"/></xsl:when><!--%k     hour ( 0..23)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1659
				<xsl:when test="starts-with($rest,'l')"><xsl:number format=" 1" value="((24 + date:hour-in-day() - 1) mod 12) + 1"/></xsl:when><!--%l     hour ( 1..12)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1660
				<xsl:when test="starts-with($rest,'m')"><xsl:number format="01" value="date:month-in-year()"/></xsl:when><!--%m     month (01..12)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1661
				<xsl:when test="starts-with($rest,'M')"><xsl:number format="01" value="date:minute-in-hour()"/></xsl:when><!--%M     minute (00..59)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1662
				<xsl:when test="starts-with($rest,'p') and date:hour-in-day() &lt; 12">AM</xsl:when><!--%p     locale’s equivalent of either AM or PM; blank if not known-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1663
				<xsl:when test="starts-with($rest,'p')">PM</xsl:when><!--%p     locale’s equivalent of either AM or PM; blank if not known-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1664
				<xsl:when test="starts-with($rest,'P') and date:hour-in-day() &lt; 12">am</xsl:when><!--%P     like %p, but lower case-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1665
				<xsl:when test="starts-with($rest,'P')">pm</xsl:when><!--%P     like %p, but lower case-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1666
				<xsl:when test="starts-with($rest,'S')"><xsl:number format="01" value="date:second-in-minute()"/></xsl:when><!--%S     second (00..60)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1667
				<xsl:when test="starts-with($rest,'T')"><xsl:value-of select="date:time()"/></xsl:when><!--%T     time; same as %H:%M:%S-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1668
				<xsl:when test="starts-with($rest,'u')"><xsl:value-of select="((date:day-in-week() +5) mod 7) + 1"/></xsl:when><!--%u     day of week (1..7); 1 is Monday-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1669
				<xsl:when test="starts-with($rest,'V')"><xsl:value-of select="date:week-in-year()"/></xsl:when><!--%V     ISO week number, with Monday as first day of week (01..53)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1670
				<xsl:when test="starts-with($rest,'w')"><xsl:value-of select="date:day-in-week() - 1"/></xsl:when><!--%w     day of week (0..6); 0 is Sunday-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1671
				<xsl:when test="starts-with($rest,'y')"><xsl:value-of select="date:year() mod 100"/></xsl:when><!--%y     last two digits of year (00..99)-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1672
				<xsl:when test="starts-with($rest,'Y')"><xsl:value-of select="date:year()"/></xsl:when><!--%Y     year-->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1673
				<xsl:otherwise><xsl:value-of select="substring($rest,1,1)"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1674
			</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1675
			<xsl:if test="string-length($rest) &gt; 1">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1676
				<xsl:call-template name="format-date">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1677
					<xsl:with-param name="date" select="substring($rest,2)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1678
				</xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1679
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1680
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1681
		<xsl:otherwise><xsl:value-of select="$date"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1682
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1683
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1684
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1685
<xsl:include href="draw.xsl"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
  1686
</xsl:stylesheet>