sysmodelgen/extra/makeabbrev.xsl
author Bob Rosenberg <bob.rosenberg@nokia.com>
Wed, 30 Jun 2010 15:34:41 +0100
branchHighFidelityModel
changeset 327 70b6ce6b8331
parent 165 ba562c1e2717
permissions -rw-r--r--
Brin app layer pkgdefs up to date with latest code drop
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     1
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     2
	xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="exslt" >
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     3
	<xsl:param name="dict"/> <!--  the dictionary file -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     4
	<xsl:param name="include" select="1"/> <!-- boolean indicates if any linked abbrev files from a model file should be included. Can turn it off to avoid creating a file which linked (recursion bad) -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     5
	<xsl:variable name="d" select="document($dict,/)/dict/word"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     6
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     7
<xsl:variable name="WordCut" select="10"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     8
<xsl:variable name="Cut" select="22"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
     9
<xsl:variable name="Cut2" select="25"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    10
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    11
<xsl:template match="*" priority="-1"><xsl:apply-templates select="*|@href"/></xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    12
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    13
<xsl:template match="@href">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    14
	<xsl:apply-templates select="document(.,.)/SystemDefinition/*"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    15
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    16
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    17
<xsl:template match="meta/@href"/>
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
    18
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    19
<xsl:template match="/*" priority="1">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    20
<display-names><xsl:apply-templates select="*"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    21
</display-names>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    22
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    23
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    24
<xsl:template match="/model/*" priority="5"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    25
<xsl:template match="/model/sysdef" priority="5">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    26
	<xsl:apply-templates select="@href"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    27
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    28
<xsl:template match="/model/layout" priority="5">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    29
	<xsl:if test="$include">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    30
		<xsl:copy-of select="document(info[@type='abbrev']/@href,.)/display-names/*"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    31
	</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    32
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    33
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    34
<xsl:template match="*[@name]">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    35
	<xsl:variable name="list">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    36
		<xsl:call-template name="wordlist"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    37
	</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    38
	<xsl:variable name="w">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    39
		<xsl:apply-templates select="exslt:node-set($list)/w" mode="word"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    40
	</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    41
	<xsl:variable name="v">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    42
		<xsl:call-template name="print">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    43
		<xsl:with-param name="words" select="exslt:node-set($w)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    44
		</xsl:call-template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    45
	</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    46
	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    47
	<xsl:variable name="txt" >
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    48
		<xsl:call-template name="breaks">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    49
			<xsl:with-param name="text">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    50
				<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    51
					<xsl:when test="string-length($v) &gt; $Cut"> <!-- too long total, use abbreviation instead of display form, starting from the end -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    52
						<xsl:variable name="w2">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    53
							<xsl:apply-templates select="exslt:node-set($w)/w[last()]" mode="pass2"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    54
						</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    55
						<xsl:variable name="v2">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    56
							<xsl:call-template name="print">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    57
							<xsl:with-param name="words" select="exslt:node-set($w2)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    58
							</xsl:call-template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    59
						</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    60
						<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    61
							<xsl:when test="string-length($v2) &gt; $Cut2">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    62
								<xsl:variable name="w3">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    63
									<xsl:apply-templates select="exslt:node-set($w2)/w[last()]" mode="pass2">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    64
										<xsl:with-param name="at">s</xsl:with-param>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    65
									</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    66
								</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    67
								<xsl:call-template name="print">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    68
									<xsl:with-param name="words" select="exslt:node-set($w3)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    69
								</xsl:call-template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    70
							</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    71
							<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    72
								<xsl:value-of select="$v2"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    73
							</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    74
						</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    75
					</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    76
					<xsl:when test="$v != '' and $v != @name">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    77
						<xsl:value-of select="$v"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    78
					</xsl:when> 
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    79
				</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    80
			</xsl:with-param>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    81
		</xsl:call-template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    82
	</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    83
	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    84
	<xsl:if test="$txt != '' and $txt != @name">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    85
		<abbrev name="{@name}" abbrev="{$txt}"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    86
	</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    87
	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    88
	<xsl:apply-templates select="@href|*"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    89
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    90
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    91
<xsl:template name="print">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    92
	<xsl:param name="words"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    93
	<xsl:apply-templates select="$words/w" mode="print"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    94
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    95
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    96
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    97
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    98
<xsl:template mode="print" match="w">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
    99
	<xsl:value-of select="@use"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   100
	<xsl:if test="not(@use)">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   101
		<xsl:value-of select="."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   102
	</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   103
	<xsl:if test="following-sibling::w">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   104
		<xsl:text> </xsl:text>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   105
	</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   106
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   107
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   108
165
ba562c1e2717 Using a dictionary no longer looks in meta sections. New argument -ignore-meta to ignore specific meta types. New xslt-param pkgAuxWidth to leave extra space on the right of packages. Fix for spanned layer height bug. Fix for namespace bug when joining. Support for drawing multiple sysdef fragments of the same rank.
Bob Rosenberg <bob.rosenberg@nokia.com>
parents: 152
diff changeset
   109
<xsl:template match="layer[string-length(@id) &lt; 10]" priority="2"><!-- don't abbreviate short layer names -->
152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   110
	<xsl:apply-templates select="*"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   111
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   112
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   113
<xsl:template mode="word" match="w">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   114
	<xsl:variable name="match" select="$d[@term=current()]"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   115
	<xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   116
	<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   117
		<xsl:when test="(string-length(.) &gt; $WordCut) and $match/@abbrev">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   118
			<xsl:attribute name="use">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   119
			<xsl:value-of select="$match/@abbrev"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   120
			</xsl:attribute>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   121
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   122
		<xsl:when test="$match/@d">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   123
		<xsl:attribute name="use">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   124
			<xsl:value-of select="$match/@d"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   125
			</xsl:attribute>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   126
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   127
	</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   128
	<xsl:value-of select="."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   129
	</xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   130
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   131
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   132
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   133
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   134
<xsl:template name="wordlist">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   135
	<xsl:param name="words" select="normalize-space(@name)"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   136
<w>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   137
		<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   138
			<xsl:when test="contains($words,' ')">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   139
				<xsl:value-of select="substring-before($words,' ')"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   140
			</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   141
			<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   142
				<xsl:value-of select="$words"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   143
			</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   144
		</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   145
</w>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   146
	<xsl:if test="contains($words,' ')">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   147
		<xsl:call-template name="wordlist">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   148
			<xsl:with-param name="words" select="substring-after($words,' ')"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   149
		</xsl:call-template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   150
	</xsl:if>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   151
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   152
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   153
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   154
<xsl:template match="w" mode="pass2"> <!-- 2nd pass -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   155
	<xsl:param name="len" select="0"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   156
	<xsl:param name="at">abbrev</xsl:param>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   157
	<xsl:variable name="match" select="$d[@term=current()]"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   158
	<xsl:variable name="cur">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   159
		<xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   160
			<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   161
				<xsl:when test="$match/@*[name()=$at]">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   162
					<xsl:attribute name="use">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   163
						<xsl:value-of select="$match/@*[name()=$at]"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   164
					</xsl:attribute>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   165
				</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   166
				<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   167
					<xsl:copy-of select="@use"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   168
				</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   169
			</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   170
			<xsl:value-of select="."/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   171
		</xsl:copy>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   172
	</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   173
	
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   174
	<xsl:variable name="mytxt">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   175
		<xsl:value-of select="exslt:node-set($cur)/w"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   176
	</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   177
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   178
	<xsl:variable name="prev"> <!--  unprocessed text -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   179
		<xsl:apply-templates select="preceding-sibling::w" mode="print"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   180
	</xsl:variable>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   181
	<xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   182
		<xsl:when test="string-length($prev) + string-length($mytxt) +$len &lt;= $Cut"> <!--  shrunk all that's needed. just output the words -->
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   183
			<xsl:copy-of select="preceding-sibling::w"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   184
		</xsl:when>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   185
		<xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   186
			<xsl:apply-templates select="preceding-sibling::w[1]" mode="pass2">
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   187
				<xsl:with-param name="len" select="string-length($mytxt) +$len"/> 
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   188
				<xsl:with-param name="at" select="$at"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   189
			</xsl:apply-templates>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   190
		</xsl:otherwise>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   191
	</xsl:choose>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   192
	<xsl:copy-of select="$cur"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   193
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   194
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   195
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   196
<xsl:template name="breaks"><xsl:param name="text"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   197
<xsl:value-of select="$text"/>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   198
</xsl:template>
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   199
5acf50bbb618 Preview version of system model generator which supports 3.0 syntax
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff changeset
   200
</xsl:stylesheet>