sysmodellibs/sysmodelgen/core/layout-module.xsl
author Bob Rosenberg <bob.rosenberg@nokia.com>
Wed, 13 Oct 2010 16:21:25 +0100
changeset 7 3c36c452f013
parent 6 sysmodellibs/sysmodelgen/src/old/svg/Model.xsl@5b32dc297d05
permissions -rw-r--r--
Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
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"?>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
     2
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
     3
 	xmlns:s="http://www.w3.org/2000/svg" xmlns:exslt="http://exslt.org/common"
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
     4
 	xmlns:date="http://exslt.org/dates-and-times"
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
     5
 	exclude-result-prefixes="s exslt date">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
     6
 	<xsl:output method="xml" indent="yes"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     7
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     8
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
     9
<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
    10
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    11
<xsl:template match="/SystemDefinition" mode="add-id-ns">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    12
<xsl:attribute name="id-namespace"><xsl:value-of select="$defaultns"/></xsl:attribute>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    13
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    14
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    15
<!-- merging -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    16
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    17
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    18
<xsl:include href="mergesysdef-module.xsl"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    19
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    20
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    21
<xsl:template match="/model">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    22
	<xsl:variable name="model" select="."/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    23
	
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    24
	<xsl:variable name="sysdef"> <!-- all the merged sysdefs -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    25
		<xsl:apply-templates select="." mode="first-merge"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    26
	</xsl:variable>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    27
	
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    28
	<!-- now create the output by putting all global attributes into <SystemDefinition>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    29
		 and any global meta sections into the systemModel or other root model item 
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    30
		this contains all the layout data needed to build the model -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    31
	<xsl:for-each select="exslt:node-set($sysdef)/*">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    32
		<xsl:copy><xsl:copy-of select="@*"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    33
			<xsl:apply-templates select="$model" mode="layout-attributes"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    34
			<xsl:for-each select="*">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    35
				<xsl:copy><xsl:copy-of select="@*"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    36
					<xsl:apply-templates select="$model/*[not(self::sysdef)]" mode="layout-meta"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    37
					<xsl:copy-of select="*"/>			
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    38
				</xsl:copy>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    39
			</xsl:for-each>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    40
		</xsl:copy>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    41
	</xsl:for-each>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    42
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    43
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    44
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    45
<xsl:template match="/model" mode="first-merge">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    46
	<xsl:apply-templates select="sysdef[1]" mode="join-sysdef-from-model"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    47
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    48
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    49
<xsl:template match="/model[count(sysdef) &gt; 1]" mode="first-merge">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    50
	<xsl:variable name="prev">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    51
		<xsl:apply-templates select="sysdef[1]" mode="join-sysdef-from-model"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    52
	</xsl:variable>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    53
	
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    54
	<xsl:apply-templates select="sysdef[2]" mode="mergewith">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    55
		<xsl:with-param name="upstream" select="exslt:node-set($prev)/*"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    56
		<xsl:with-param name="up" select="current()/sysdef[1]"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    57
	</xsl:apply-templates>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    58
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    59
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    60
<xsl:template match="sysdef" mode="mergewith">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    61
	<xsl:param name="upstream"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    62
	<xsl:param name="up"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    63
	<xsl:variable name="downstream">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    64
		<xsl:apply-templates select="." mode="join-sysdef-from-model"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    65
	</xsl:variable>	
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    66
	
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    67
	<xsl:variable name="merged">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    68
		<xsl:apply-templates mode="merge-models" select="$upstream">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    69
			<xsl:with-param name="other" select="exslt:node-set($downstream)/*"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    70
			<xsl:with-param name="up" select="$up"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    71
			<xsl:with-param name="down" select="current()"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    72
		</xsl:apply-templates>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    73
	</xsl:variable>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    74
	<xsl:choose>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    75
		<xsl:when test="following-sibling::sysdef">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    76
			<!-- more to come -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    77
			<xsl:apply-templates select="following-sibling::sysdef[1]" mode="mergewith">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    78
				<xsl:with-param name="upstream" select="exslt:node-set($merged)/*"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    79
				<xsl:with-param name="up" select="$up"/> <!-- technically not needed since everything in upstram model is allready populated with root and name data, but needed for completeness -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    80
			</xsl:apply-templates>			
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    81
		</xsl:when>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    82
		<xsl:otherwise><xsl:copy-of select="$merged"/></xsl:otherwise> <!-- we're done, just print-->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    83
	</xsl:choose>	
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    84
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    85
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    86
<!-- /merging -->
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    87
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    88
<xsl:template match="*" mode="layout-meta">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    89
	<xsl:apply-templates select="*[not(self::sysdef)]" mode="global-meta"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    90
</xsl:template>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    91
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    92
<xsl:template match="* | @*" mode="layout-attributes">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    93
	<xsl:apply-templates select="." mode="global-attributes"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    94
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
    95
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    96
<xsl:template match="/model" mode="layout-attributes">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    97
	<xsl:apply-templates select="*[not(self::sysdef)] | @*" mode="layout-attributes"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    98
	<xsl:if test="not(layout/@detail or @detail)">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
    99
		<xsl:attribute name="detail">component</xsl:attribute>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   100
	</xsl:if>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   101
	<!--<xsl:if test="not(layout/@placeholder-detail or @placeholder-detail )">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   102
		<xsl:attribute name="placeholder-detail">component</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   103
	</xsl:if>-->
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   104
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   105
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   106
<xsl:template match="layout" mode="layout-meta"> <!-- ensure it's grouped properly -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   107
	<xsl:if test="info or ../@shapes">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   108
		<xsl:element name="meta"><xsl:attribute name="rel">styling</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   109
			<xsl:apply-templates select="../@shapes | info" mode="styling"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   110
		</xsl:element>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   111
	</xsl:if>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   112
	<xsl:apply-templates select="*[not(self::sysdef)]" mode="layout-meta"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   113
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   114
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   115
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   116
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   117
<xsl:template match="/model[@revision-type='date']/@revision[contains(.,'%') and function-available('date:month-abbreviation')]" mode="layout-attributes">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   118
<xsl:attribute name="revision"><xsl:call-template name="format-date"/></xsl:attribute>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   119
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   120
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   121
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   122
<xsl:template match="/model[@revision-type='date' and not(@revision) or @revision='%Y-%m-%d']/@revision-type" mode="layout-attributes" priority="4">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   123
	<xsl:copy-of select="."/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   124
	<xsl:if test="function-available('date:date-time')">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   125
		<xsl:attribute name="revision"><xsl:value-of select="substring-before(date:date-time(),'T')"/></xsl:attribute>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   126
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   127
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   128
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   129
<xsl:template mode="layout-attributes" match="layout">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   130
	<xsl:copy-of select="@*"/> 
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   131
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   132
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   133
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   134
<!-- new attribute: <values rank="list" default="..."> where list is a space-spearated list of system model item names. 
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   135
	If not present default applies to all items not referenced by an entry. If present, default only applies to unreferenced items of the specified type --> 
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   136
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   137
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   138
<xsl:template match="/values" mode="overlay-meta">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   139
	<xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/><xsl:param name="from"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   140
	<xsl:if test="$from[@type='style' or @type='color' or @type='overlay'] "> <!-- at this point, only pattern, style and color can have multiple values -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   141
		<xsl:variable name="join"><xsl:if test="$from/@type!=''">-</xsl:if></xsl:variable>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   142
		<xsl:variable name="value">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   143
			<xsl:for-each select="/values/item/*[@ref=$id or substring-after(@ref,':')=$id]">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   144
				<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   145
				<xsl:if test="$myns = $ns"> <!-- actual match -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   146
					<xsl:element name="generator{$join}{$from/@type}">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   147
						 <xsl:attribute name="ref">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   148
							<xsl:apply-templates select=".." mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   149
								<xsl:with-param select="$from" name="base"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   150
							</xsl:apply-templates>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   151
						</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   152
					</xsl:element>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   153
				</xsl:if>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   154
			</xsl:for-each>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   155
		</xsl:variable>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   156
		<xsl:if test="exslt:node-set($value)/* or (@default and (not(@rank) or contains(concat(' ',normalize-space(@rank),' '), concat(' ',local-name($item),' ')) ))"> 
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   157
			<xsl:element name="meta"><xsl:attribute name="rel">styling</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   158
				<xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   159
					<xsl:when test="exslt:node-set($value)/*"><xsl:copy-of select="$value"/></xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   160
					<xsl:when test="@default">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   161
						<xsl:element name="generator{$join}{$from/@type}">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   162
						 	<xsl:attribute name="ref">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   163
								<xsl:apply-templates select="$from" mode="style-id"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   164
							</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   165
						</xsl:element>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   166
					</xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   167
				</xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   168
			</xsl:element>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   169
		</xsl:if>		
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   170
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   171
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   172
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   173
<xsl:template match="/model/layout/display" mode="overlay-attributes">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   174
	<xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   175
		<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   176
		<xsl:if test="@ref=$id or substring-after(@ref,':')=$id and $myns=$ns">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   177
			<xsl:copy-of select="@*[name()!='ref']"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   178
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   179
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   180
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   181
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   182
<xsl:template match="/values" mode="overlay-attributes">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   183
	<xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/><xsl:param name="from"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   184
	<xsl:if test="$from[@type!='style' and @type!='color' and @type!='overlay']"> <!-- style, pattern and colour can have any number of values, so it needs to be captured in an element -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   185
		<xsl:variable name="join"><xsl:if test="$from/@type!=''">-</xsl:if></xsl:variable>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   186
		<xsl:for-each select="/values/item/*[@ref=$id or substring-after(@ref,':')=$id]">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   187
			<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   188
			<xsl:if test="$myns = $ns"> <!-- actual match -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   189
				<xsl:attribute name="generator{$join}{$from/@type}">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   190
					<xsl:apply-templates select=".." mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   191
						<xsl:with-param select="$from" name="base"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   192
					</xsl:apply-templates>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   193
				</xsl:attribute>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   194
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   195
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   196
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   197
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   198
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   199
<xsl:template match="info" mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   200
	<xsl:value-of select="concat('i',count(preceding-sibling::info))"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   201
</xsl:template>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   202
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   203
<xsl:template match="/values" mode="style-id"><xsl:param name="base"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   204
	<xsl:apply-templates select="$base" mode="style-id"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   205
</xsl:template>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   206
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   207
<xsl:template match="/values/item" mode="style-id"><xsl:param name="base"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   208
	<xsl:apply-templates select="$base" mode="style-id"/>-<xsl:value-of select="name()"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   209
	<xsl:value-of select="count(preceding-sibling::*)"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   210
</xsl:template>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   211
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   212
<xsl:template match="info" mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   213
	<xsl:value-of select="concat('i',count(preceding-sibling::info))"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   214
</xsl:template>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   215
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   216
<xsl:template match="colors|borders|patterns|styles" mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   217
	<xsl:value-of select="concat('s',count(preceding-sibling::*))"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   218
</xsl:template>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   219
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   220
<xsl:template match="examples/cmp" mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   221
	<xsl:value-of select="concat('e',count(preceding::cmp[parent::examples]))"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   222
</xsl:template>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   223
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   224
<xsl:template match="note" mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   225
	<xsl:value-of select="concat('n',count(preceding::note))"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   226
</xsl:template>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   227
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   228
<xsl:template match="legend" mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   229
	<xsl:value-of select="concat('L',count(preceding::legend))"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   230
</xsl:template>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   231
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   232
<xsl:template match="colors/color|borders/border|patterns/overlay|styles/style" mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   233
	<xsl:apply-templates select=".." mode="style-id"/>-<xsl:value-of select="name()"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   234
	<xsl:value-of select="count(preceding-sibling::*)"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   235
</xsl:template>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   236
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   237
<xsl:template match="layout/layer-group" mode="layout-meta">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   238
	<xsl:element name="meta"><xsl:attribute name="rel">layer-group</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   239
	<xsl:copy-of select="."/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   240
	</xsl:element>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   241
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   242
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   243
<xsl:template match="layout/logo" mode="layout-meta">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   244
	<xsl:element name="meta"><xsl:attribute name="rel">model-logo</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   245
		<xsl:copy><xsl:copy-of select="@width | @height"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   246
			<xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   247
				<xsl:when test="@embed='yes' or @embed='true' ">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   248
					<xsl:for-each select="document(@src,.)/s:svg">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   249
						<xsl:copy-of select="@viewBox"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   250
						<xsl:copy-of select="*"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   251
					</xsl:for-each>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   252
				</xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   253
				<xsl:otherwise><xsl:copy-of select="@src"/></xsl:otherwise>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   254
			</xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   255
		</xsl:copy>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   256
	</xsl:element>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   257
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   258
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   259
<!-- legend follows -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   260
<xsl:template match="layout/legend" mode="layout-meta">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   261
	<xsl:element name="meta"><xsl:attribute name="rel">model-legend</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   262
		<xsl:copy><xsl:copy-of select="@*[name()!='literal']"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   263
			<xsl:if test="not(@literal='yes' or @literal='true') and contains(@label,'{')">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   264
				<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   265
			</xsl:if>	
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   266
			<xsl:apply-templates select="*" mode="layout-meta"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   267
		</xsl:copy>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   268
	</xsl:element>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   269
	
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   270
	<!-- put footer outside of the legend since technically it should be on the bottom of the diagram -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   271
	<xsl:variable name="footer">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   272
		<xsl:for-each select="/model/@copyright|/model/@distribution">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   273
			<xsl:variable name="a" select="concat('@',name())"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   274
			<!-- only use footer items if they are not referenced elsewhere in a label -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   275
			<xsl:if test="not(/model/layout//legend[contains(@label,$a)]) and not(/model/layout//legend/note[contains(.,$a)])">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   276
				<xsl:value-of select="concat(' ',name(),' ')"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   277
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   278
		</xsl:for-each>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   279
	</xsl:variable>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   280
	<xsl:if test="$footer!=''">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   281
		<xsl:element name="meta"><xsl:attribute name="rel">model-footer</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   282
			<xsl:for-each select="/model/@*[contains($footer,concat(' ',name(),' '))]">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   283
				<xsl:element name="{name()}"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   284
			</xsl:for-each>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   285
		</xsl:element>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   286
	</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   287
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   288
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   289
<xsl:template match="legend" mode="layout-meta">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   290
	<xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   291
		<xsl:copy-of select="@*[name()!='literal']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   292
		<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
   293
			<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
   294
		</xsl:if>	
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   295
		<xsl:apply-templates select="*" mode="layout-meta"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   296
	</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   297
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   298
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   299
<xsl:template match="legend/note|legend/s:svg" mode="layout-meta">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   300
	<xsl:copy><xsl:copy-of select="@*[name()!='literal']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   301
		<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
   302
			<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
   303
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   304
		<xsl:copy-of select="node()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   305
	</xsl:copy>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   306
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   307
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   308
<xsl:template match="legend[s:g]" mode="layout-meta">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   309
<xsl:copy-of select="."/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   310
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   311
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   312
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   313
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   314
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   315
<xsl:template match="@label" mode="legend-abbrev">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   316
	<xsl:variable name="n" select="."/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   317
	<xsl:variable name="match" select="$abbrevs[@name=$n]"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   318
	<xsl:choose>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   319
		<xsl:when test="not($match)"><xsl:copy-of select="."/></xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   320
		<xsl:otherwise>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   321
			<xsl:attribute name="label"><xsl:value-of select="$match/@abbrev"/></xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   322
			<xsl:copy-of select="$match/@font"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   323
			<xsl:if test="not($match/@font)">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   324
				<xsl:copy-of select="$match/ancestor::display-names/@font"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   325
			</xsl:if>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   326
		</xsl:otherwise>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   327
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   328
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   329
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   330
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   331
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   332
<xsl:template match="legend" mode="legend-copy">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   333
	<xsl:copy-of select="@*[name()!='use' or name()='literal']"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   334
	<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
   335
		<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
   336
	</xsl:if>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   337
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   338
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   339
<xsl:template match="legend[@use]" mode="layout-meta">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   340
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   341
	<!-- 	$tag = bit after the # (can be empty)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   342
		$pre is bit before the # (can be empty)
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   343
		$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
   344
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   345
	<xsl:variable name="tag" select="substring-after(@use,'#')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   346
	<xsl:variable name="pre">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   347
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   348
			<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
   349
			<xsl:otherwise><xsl:value-of select="@use"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   350
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   351
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   352
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   353
	<xsl:variable name="file">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   354
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   355
			<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
   356
			<xsl:otherwise><xsl:value-of select="$pre"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   357
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   358
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   359
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   360
	<xsl:variable name="model" select="/model"/>  <!--  hack for xsltproc -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   361
	<xsl:variable name="legend" select="."/>  <!--  hack for xsltproc -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   362
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   363
	<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
   364
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   365
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   366
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   367
		<xsl:when test="$tag!='' and $pre=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   368
			<!-- 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
   369
			<xsl:for-each select="ancestor::layout/info[@type=$tag]">
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   370
				<xsl:element name="legend">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   371
					<xsl:apply-templates select="$this" mode="legend-copy"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   372
					<xsl:apply-templates select="." mode="legend-layout">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   373
						<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   374
						<xsl:with-param name="legend" select="$legend"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   375
					</xsl:apply-templates>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   376
				</xsl:element>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   377
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   378
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   379
		<xsl:when test="$tag!=''">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   380
			<xsl:for-each select="document($file,/)/*/*[name()=$tag]">
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   381
				<xsl:element name="legend">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   382
					<xsl:apply-templates select="$this" mode="legend-copy"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   383
					<xsl:apply-templates select="." mode="legend-layout">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   384
						<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   385
						<xsl:with-param name="legend" select="$legend"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   386
					</xsl:apply-templates>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   387
				</xsl:element>			
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   388
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   389
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   390
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   391
			<xsl:for-each select="document($file,/)/*">
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   392
				<xsl:element name="legend">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   393
					<xsl:apply-templates select="$this" mode="legend-copy"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   394
					<xsl:apply-templates select="." mode="legend-layout">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   395
						<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   396
						<xsl:with-param name="legend" select="$legend"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   397
					</xsl:apply-templates>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   398
				</xsl:element>			
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   399
			</xsl:for-each>			
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   400
			</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   401
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   402
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   403
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   404
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   405
<xsl:template match="info[(@type='color'  or @type='overlay' or @type='style' or @type='border') and document(@href,.)/values]" mode="legend-layout">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   406
	<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
   407
	<xsl:attribute name="type">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   408
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   409
			<xsl:when test="@type='color'">cbox</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   410
			<xsl:otherwise>cmp</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   411
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   412
	</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   413
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   414
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   415
<xsl:template match="text()" mode="legend-layout"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   416
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   417
<!-- Any ref with a type attribute that starts with a # indicates a literal ref, so just copy it -->
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   418
<xsl:template match="*[starts-with(@type,'#')]" mode="layout-ref" priority="1"><xsl:value-of select="@type"/></xsl:template>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   419
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   420
<!-- Borders in legend -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   421
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   422
<xsl:template match="border" mode="layout-ref">#Border<xsl:choose>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   423
		<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
   424
		<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
   425
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   426
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   427
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   428
<!-- Colours in legend -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   429
<xsl:template match="color[../@type='highlight' or ../@type='text-highlight']" mode="layout-ref">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   430
	<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
   431
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   432
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   433
<xsl:template match="/shapes/colors/color[not(@value|@label)]" mode="legend-layout" priority="3"/> 	<!-- use value if no label, but don't show if neither -->
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   434
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   435
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   436
<!-- can have any number of these, so put in a sub-legend -->
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   437
<xsl:template match="/shapes/examples" mode="legend-layout"><xsl:param name="model"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   438
	<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
   439
	<xsl:variable name="tag" select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   440
	<xsl:variable name="content">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   441
		<!-- 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
   442
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   443
			<xsl:when test="@sort='yes'">
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   444
				<xsl:apply-templates mode="legend-layout">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   445
					<xsl:sort select="@label"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   446
					<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   447
				</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   448
			</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   449
			<xsl:otherwise>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   450
				<xsl:apply-templates mode="legend-layout"><xsl:with-param name="model" select="$model"/></xsl:apply-templates>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   451
			</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   452
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   453
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   454
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   455
		<xsl:when test="count(//*[name()=$tag]) != 1">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   456
			<legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   457
				<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
   458
				<xsl:copy-of select="$content"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   459
			</legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   460
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   461
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   462
			<xsl:copy-of select="@sort|@show-unused"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   463
			<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
   464
			<xsl:copy-of select="$content"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   465
	</xsl:choose>
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
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   468
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   469
<!-- can have any number of these, so put in a sub-legend -->
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   470
<xsl:template match="/shapes/styles|/shapes/colors|/shapes/patterns|/shapes/borders" mode="legend-layout">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   471
	<xsl:variable name="tag" select="name()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   472
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   473
		<xsl:when test="count(//*[name()=$tag]) != 1">
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   474
			<xsl:element name="legend">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   475
				<xsl:copy-of select="@sort|@show-unused"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   476
				<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
   477
				<xsl:attribute name="type">cmp</xsl:attribute>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   478
			</xsl:element>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   479
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   480
		<xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   481
			<xsl:copy-of select="@sort|@show-unused"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   482
			<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
   483
			<xsl:attribute name="type">cmp</xsl:attribute>		
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   484
		</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   485
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   486
</xsl:template>
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
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   489
<xsl:template match="overlay" mode="layout-ref">#Pattern<xsl:choose>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   490
		<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
   491
		<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
   492
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   493
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   494
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   495
	
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   496
<xsl:template match="/shapes/*/*[not(@label)]" mode="legend-layout"/> <!--  don't show legend items with no label -->
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   497
	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   498
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   499
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   500
<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
   501
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   502
		<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
   503
			<xsl:attribute name="generator-{name($at)}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   504
				<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
   505
			</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   506
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   507
		<xsl:when test="name($at)='style'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   508
			<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
   509
		</xsl:when>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   510
		<xsl:when test="name($at)='color-highlight'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   511
			<xsl:attribute name="generator-highlight">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   512
				<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
   513
			</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   514
		</xsl:when>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   515
		<xsl:when test="name($at)='color-text-highlight'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   516
			<xsl:attribute name="generator-text-highlight">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   517
				<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
   518
			</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   519
		</xsl:when>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   520
		<xsl:when test="name($at)='color'">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   521
			<xsl:attribute name="generator-color">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   522
				<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
   523
			</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   524
		</xsl:when>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   525
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   526
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   527
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   528
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   529
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   530
<xsl:template match="@color" mode="generated-value"><xsl:param name="model"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   531
	<xsl:variable name="v" select="."/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   532
	<xsl:variable name="m" select="//color[@label=$v]"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   533
	<xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   534
		<xsl:when test="count($m)">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   535
			<xsl:attribute name="generator-color"><xsl:apply-templates select="$m" mode="style-id"/></xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   536
		</xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   537
		<xsl:when test="$model//info[@type='color']">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   538
			<xsl:attribute name="generator-color">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   539
				<xsl:variable name="m0" select="$model//info[@type='color']/@href"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   540
				<xsl:apply-templates select="document($m0/@href,$m0)//item[@label=$v]" mode="style-id">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   541
					<xsl:with-param name="base" select="$m0"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   542
				</xsl:apply-templates>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   543
			</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   544
		</xsl:when>		
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   545
	</xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   546
</xsl:template>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   547
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   548
<xsl:template match="examples/cmp" mode="legend-layout"><xsl:param name="model"/><xsl:param name="shapes" select="/shapes"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   549
	<cmp>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   550
		<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
   551
			<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
   552
		</xsl:if>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   553
		<xsl:for-each select="@*">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   554
			<xsl:apply-templates select="$shapes" mode="as-example">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   555
				<xsl:with-param name="at" select="."/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   556
			</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   557
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   558
		<xsl:apply-templates mode="generated-value" select="@color">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   559
			<xsl:with-param name="model" select="$model"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   560
		</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   561
		<xsl:copy-of select="text()"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   562
	</cmp>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   563
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   564
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   565
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   566
<xsl:template match="/shapes/colors[not(*)]" mode="legend-layout"><xsl:param name="model"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   567
<!-- special known type which can be generated -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   568
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   569
		<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
   570
			<legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   571
				<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
   572
				<xsl:attribute name="sort">yes</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   573
				<xsl:attribute name="type">cbox</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   574
			</legend>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   575
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   576
		<xsl:when test="@match='@ts' and $model">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   577
			<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
   578
			<xsl:attribute name="sort">yes</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   579
			<xsl:attribute name="type">cbox</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   580
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   581
		<xsl:otherwise>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   582
		<!--	<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">no colour data</xsl:with-param></xsl:call-template> -->
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   583
		</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   584
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   585
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   586
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   587
<!-- styling stuff  -->
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   588
<xsl:template match="node()" mode="styling"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   589
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   590
<xsl:template match="@shapes" mode="styling">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   591
	<xsl:variable name="model" select=".."/> <!-- hack for xsltproc -->
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   592
	<xsl:apply-templates select="document(.,.)/shapes/*" mode="styling">
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   593
		<xsl:with-param name="model" select="$model"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   594
	</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   595
</xsl:template>
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 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
   599
	<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
   600
	<xsl:variable name="base" select="."/>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   601
	<group style-id="{$id}">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   602
		<xsl:copy-of select="@type | @show-unused"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   603
		<xsl:for-each select="document(@href,.)/values">
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   604
		<xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   605
			<xsl:when test="contains(normalize-space(@rank),' ')"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   606
			<xsl:when test="@rank"><xsl:attribute name="detail"><xsl:value-of select="@rank"/></xsl:attribute></xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   607
			<xsl:otherwise><xsl:attribute name="detail">component</xsl:attribute></xsl:otherwise>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   608
		</xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   609
		</xsl:for-each>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   610
		<xsl:for-each select="document(@href,.)/values">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   611
			<xsl:copy-of select="@default"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   612
			<xsl:apply-templates select="@label"  mode="legend-abbrev"/>				
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   613
			<xsl:for-each select="item">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   614
				<xsl:variable name="el">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   615
					<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   616
						<xsl:when test="$base/@type='color'">cbox</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   617
						<xsl:otherwise>cmp</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   618
					</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   619
				</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   620
				<xsl:element name="{$el}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   621
					<xsl:attribute name="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   622
						<xsl:apply-templates select="." mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   623
							<xsl:with-param name="base" select="$base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   624
						</xsl:apply-templates>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   625
					</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   626
					<xsl:apply-templates select="@label"  mode="legend-abbrev"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   627
					<xsl:attribute name="value">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   628
					<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   629
						<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
   630
						<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
   631
							<!-- 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
   632
						<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
   633
							<xsl:apply-templates select="." mode="style-id">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   634
								<xsl:with-param name="base" select="$base"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   635
							</xsl:apply-templates></xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   636
						<xsl:otherwise><xsl:value-of select="@value"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   637
					</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   638
					</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   639
				</xsl:element>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   640
			</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   641
		</xsl:for-each>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   642
	</group>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   643
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   644
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   645
<xsl:template name="lgd-group-detail">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   646
	<xsl:choose>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   647
		<xsl:when test="@detail"><xsl:copy-of select="@detail"/></xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   648
		<xsl:when test="self::borders or  not(@match)"><xsl:attribute name="detail">component</xsl:attribute></xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   649
		<xsl:when test="@match='component' or @match='collection' or @match='package' or @match='layer'">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   650
			<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
   651
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   652
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   653
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   654
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   655
<xsl:template match="/shapes/colors[@match='@ts' and not(*)]" mode="styling" priority="4"/> <!-- no longer supported -->
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   656
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   657
<xsl:template match="/shapes/borders|/shapes/patterns|/shapes/styles|/shapes/colors" mode="styling"><xsl:param name="model"/>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   658
	<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
   659
	<group type="{name(*)}" style-id="{$id}">
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   660
		<xsl:attribute name="type">
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   661
			<xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   662
				<xsl:when test="self::colors and @type='background' ">color</xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   663
				<xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   664
				<xsl:otherwise><xsl:value-of select="name(*)"/></xsl:otherwise>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   665
			</xsl:choose>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   666
		</xsl:attribute>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   667
		<xsl:call-template name="lgd-group-detail"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   668
		<xsl:copy-of select="@default"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   669
		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   670
		<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
   671
	</group>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   672
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   673
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   674
<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
   675
	<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
   676
	<xsl:variable name="el">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   677
		<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   678
			<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
   679
			<xsl:when test="self::color">cbox</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   680
			<xsl:otherwise>cmp</xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   681
		</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   682
	</xsl:variable>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   683
	<xsl:element name="{$el}">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   684
		<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
   685
		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   686
		<xsl:if test="contains(@label,'{') or @count">
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   687
			<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
   688
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   689
		<xsl:if test="@value">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   690
			<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
   691
		</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   692
		<xsl:attribute name="value">	
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   693
			<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   694
				<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
   695
				<xsl:when test="self::color[not(../@type) or ../@type='background']"><xsl:value-of select="@color"/></xsl:when>
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   696
				<xsl:otherwise><xsl:apply-templates select="." mode="layout-ref"/></xsl:otherwise>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   697
			</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   698
		</xsl:attribute>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   699
	</xsl:element>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   700
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   701
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   702
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   703
<!-- consider making this just an optional call to template so it does nothing if it's not needed -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   704
<xsl:template mode="is-content-filtered" match="*" priority="5"><xsl:param name="content"/>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   705
	<xsl:if test="function-available('exslt:node-set') and count(exslt:node-set($content)/*[not(self::meta)])!=count(*[not(self::meta)])"> 
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   706
		<xsl:attribute name="filtered">yes</xsl:attribute>
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   707
	</xsl:if>
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   708
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   709
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   710
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   711
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   712
<!-- internal routines follows -->
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   713
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   714
<!-- 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
   715
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
   716
-->  
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   717
<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
   718
	<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   719
		<xsl:when test="contains($date,'%')">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   720
			<xsl:value-of select="substring-before($date,'%')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   721
			<xsl:variable name="rest" select="substring-after($date,'%')"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   722
			<xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   723
				<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
   724
				<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
   725
				<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
   726
				<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
   727
				<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
   728
				<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
   729
				<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
   730
				<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
   731
				<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
   732
				<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
   733
				<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
   734
				<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
   735
				<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
   736
				<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
   737
				<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
   738
				<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-->
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   739
				<xsl:when test="starts-with($rest,'p')">PM</xsl:when><!--%p     locale's equivalent of either AM or PM; blank if not known-->
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   740
				<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
   741
				<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
   742
				<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
   743
				<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
   744
				<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
   745
				<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
   746
				<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
   747
				<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
   748
				<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
   749
				<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
   750
			</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   751
			<xsl:if test="string-length($rest) &gt; 1">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   752
				<xsl:call-template name="format-date">
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   753
					<xsl:with-param name="date" select="substring($rest,2)"/>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   754
				</xsl:call-template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   755
			</xsl:if>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   756
		</xsl:when>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   757
		<xsl:otherwise><xsl:value-of select="$date"/></xsl:otherwise>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   758
	</xsl:choose>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   759
</xsl:template>
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   760
7
3c36c452f013 Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 6
diff changeset
   761
1
b538b70cbe51 Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff changeset
   762
</xsl:stylesheet>