Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
authorBob Rosenberg <bob.rosenberg@nokia.com>
Wed, 13 Oct 2010 16:21:25 +0100
changeset 7 3c36c452f013
parent 6 5b32dc297d05
child 8 a2e65c705db8
Version 2.0 release of System Model Generator, which draws 3.x syntax system definition files
sysmodellibs/sysmodelgen/SysModGen.pl
sysmodellibs/sysmodelgen/core/draw-model.xsl
sysmodellibs/sysmodelgen/core/draw.xsl
sysmodellibs/sysmodelgen/core/filtersysdef-module.xsl
sysmodellibs/sysmodelgen/core/joinmodel.xsl
sysmodellibs/sysmodelgen/core/joinsysdef-module.xsl
sysmodellibs/sysmodelgen/core/joinsysdef.xsl
sysmodellibs/sysmodelgen/core/layout-module.xsl
sysmodellibs/sysmodelgen/core/layoutsysdef.xsl
sysmodellibs/sysmodelgen/core/legend-module.xsl
sysmodellibs/sysmodelgen/core/legend.xsl
sysmodellibs/sysmodelgen/core/mergesysdef-module.xsl
sysmodellibs/sysmodelgen/core/mergesysdef.xsl
sysmodellibs/sysmodelgen/core/overlay-module.xsl
sysmodellibs/sysmodelgen/core/path-module.xsl
sysmodellibs/sysmodelgen/core/shapes.xsl
sysmodellibs/sysmodelgen/doc/_stock/css/developer.css
sysmodellibs/sysmodelgen/doc/_stock/css/iefix.css
sysmodellibs/sysmodelgen/doc/_stock/css/portal.css
sysmodellibs/sysmodelgen/doc/_stock/css/reset.css
sysmodellibs/sysmodelgen/doc/_stock/css/sdlplugin.css
sysmodellibs/sysmodelgen/doc/_stock/css/sysdoc.css
sysmodellibs/sysmodelgen/doc/_stock/css/ui.css
sysmodellibs/sysmodelgen/doc/_stock/css/ui.tabs.css
sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Basic-Options.html
sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Build-Control-options.html
sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Files-or-uri-options.html
sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Labels-options.html
sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Model-Control-options-ref.html
sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/index.html
sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/troubleshooting.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Border-Shapes-XMLFile.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Border-Style-XMLFile.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Colorxmloutput.gif
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Colours-XMLFile.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Dependencies-XMLFile.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Dependencies-sysinfo.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Dictionary-XMLFile.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Localisation-XMLFile.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Patterns-XMLFile.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/System-Info-XMLFile.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Values-XML-index.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/arrows.png
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/bordershapes.gif
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/bordershapesoutput.gif
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/borderstyleoutput.gif
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/index.html
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/patterns.gif
sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/patternsxmloutput.gif
sysmodellibs/sysmodelgen/extra/css-module.xsl
sysmodellibs/sysmodelgen/extra/css2xml.xsl
sysmodellibs/sysmodelgen/extra/dependencies.xsl
sysmodellibs/sysmodelgen/extra/makeabbrev.xsl
sysmodellibs/sysmodelgen/extra/output-csv.xsl
sysmodellibs/sysmodelgen/extra/output-sysdef.xsl
sysmodellibs/sysmodelgen/extra/postprocess.xsl
sysmodellibs/sysmodelgen/extra/sample_config.ini
sysmodellibs/sysmodelgen/extra/showdeps.xsl
sysmodellibs/sysmodelgen/extra/tovisio.xsl
sysmodellibs/sysmodelgen/extra/validate-raw.xsl
sysmodellibs/sysmodelgen/extra/validate.xsl
sysmodellibs/sysmodelgen/group/build.xml
sysmodellibs/sysmodelgen/installer/SystemModelToolkit.nsi
sysmodellibs/sysmodelgen/rsc/ModelTemplate.94.xml
sysmodellibs/sysmodelgen/rsc/ModelTemplate.95.xml
sysmodellibs/sysmodelgen/rsc/ModelTemplate.older.xml
sysmodellibs/sysmodelgen/rsc/ModelTemplate.xml
sysmodellibs/sysmodelgen/rsc/dictionary.xml
sysmodellibs/sysmodelgen/rsc/fshapes.xml
sysmodellibs/sysmodelgen/rsc/shapes.xml
sysmodellibs/sysmodelgen/src/SysModelGen.pm
sysmodellibs/sysmodelgen/src/common/DepConstants.pm
sysmodellibs/sysmodelgen/src/old/resources/xsd/sysinfo.xsd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/SysModGen.pl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,51 @@
+#!perl
+# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+use strict;
+use warnings;
+use FindBin;
+use lib $FindBin::Bin;
+use lib $FindBin::Bin."/old";
+use lib $FindBin::Bin."/src";
+use SysModelGen;
+
+#legacy stuff
+use lib $FindBin::Bin."/src/old/svg";
+use DrawSvg;
+
+
+my %versions = &DrawSvg::SchemaVersionsFromArgs(@ARGV);
+#my $drawer = new DrawSvg();
+
+my $nOld = 0; 
+my $nCurrent = 0;
+
+# test versions here. If any are less than 3.0.0, build using old model code
+foreach my $v (keys(%versions))
+	{ # need to downgrade anything in 3.x syntax
+	if($v=~/^[12]\./) {$nOld++} else {$nCurrent++}
+	}
+
+if($nOld && $nCurrent)
+	{
+	die "Cannot mix pre-3.0 syntax system definitions with 3.0 and later syntaxes";
+	}
+
+my $drawer = ($nOld)  ? new DrawSvg() :  new SysModelGen();
+
+$drawer->Draw();
+
+exit;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/draw-model.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,1403 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"   xmlns:s="http://www.w3.org/2000/svg" xmlns:exslt="http://exslt.org/common" xmlns:m="http://exslt.org/math" exclude-result-prefixes="s m exslt" >
+<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+	All rights reserved.
+	This component and the accompanying materials are made available
+	under the terms of the License "Eclipse Public License v1.0"
+	which accompanies this distribution, and is available
+	at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+	Initial Contributors:
+	Nokia Corporation - initial contribution.
+	Contributors:
+	Description:
+	Create a stand-alone sysdef from a linked set of fragments
+-->
+	  <xsl:key name="color" match="legend/cbox" use="@value"/>
+
+	<xsl:output method="xml" cdata-section-elements="script s:script" indent="yes"/>
+
+<xsl:param name="pkgLabelSize" select="4.23"/> <!-- the height needed at the bottom of a package for the label (mm) -->
+
+<!-- /SystemDefinition/@detail  = The level of detail to show in the diagram. 
+	The value is the name of the lowest element to show. If @static  is set to false, mousing-over an item will show its detailed content. 
+	By default this is equivalent to 'component' -->
+
+<!-- ====== Constants ============= -->
+<xsl:param name="groupDx" select="2.1"/> <!-- the horizontal distance between groups (mm) -->
+<xsl:param name="groupDy" select="3.2"/> <!-- the vertical distance between groups (mm) -->
+<xsl:param name="cSize" select="9.3"/> <!-- the width and height of a component (mm) -->
+<xsl:param name="mHeight" select="15.6"/> <!-- the height of a collection (mm) -->
+<xsl:param name="mMinWidth" select="15.6"/> <!-- the minimum width of a collection (mm) -->
+<xsl:param name="lyrFixedWidth" select="$mMinWidth * 6"/><!-- fixed width of a layer (mm)-->
+<xsl:param name="pkgMinWidth" select="$cSize * 3"/><!-- small pkg, use min width of 2 * smallest possible collection -->
+<xsl:param name="subpkgMinWidth" select="$cSize * 3"/> <!-- small nested pkg, use min width of  3 components -->
+<xsl:param name="pkgFixedWidth" select="$mMinWidth * 5"/><!-- fixed width of a  pacakge (mm) -->
+<xsl:param name="pkgAuxWidth" select="0"/><!-- Additional width on the right side of each package (mm) -->
+<xsl:param name="subpkgFixedWidth" select="$mMinWidth * 3"/> <!-- fixed width nested pkg (mm) -->
+<xsl:variable name="inlineLabel" select="3 * $cSize"/> <!-- the max width of an inline label. 3 times the width of a collection by default 
+	I don't like this. Should compute somehow and make local variable. -->
+<xsl:variable name="detail-block-space" select="6"/>
+<xsl:param name="lyrTitleBox" select="9.3"/> <!-- the width of the layer's title box (mm) -->
+<xsl:variable name="lgrpDx" select="5"/> <!-- the width of a layer group border (mm)-->
+<xsl:variable name="lgrpLabelDx" select="$lyrTitleBox + 5.7"/> <!-- the width of a layer group title (mm) -->
+<xsl:variable name="levelExpandName" select="$cSize"/> <!-- the height of the name when levels are being shown inline (mm) -->
+
+<xsl:param name="Verbose" select="0"/> <!-- Verbosity level of messages. Set to 1 (or higher) to get runtime comments  -->
+
+<!-- ====== Computed values ============= -->
+
+
+<xsl:template name="Caller-Debug"><xsl:param name="text"/>
+	<xsl:if test="$Verbose &gt; 4"><xsl:message>&#xa;Note: <xsl:value-of select="$text"/></xsl:message></xsl:if>
+</xsl:template>
+<xsl:template name="Caller-Note"><xsl:param name="text"/>
+	<xsl:message>&#xa;Note: <xsl:value-of select="$text"/></xsl:message>
+</xsl:template>
+<xsl:template name="Caller-Warning"><xsl:param name="text"/>
+	<xsl:message>&#xa;Warning: <xsl:value-of select="$text"/></xsl:message>
+</xsl:template>
+<xsl:template name="Caller-Error"><xsl:param name="text"/>
+	<xsl:message>&#xa;Error: <xsl:value-of select="$text"/></xsl:message>
+</xsl:template>
+<xsl:template name="Critical-Error"><xsl:param name="text"/>
+	<xsl:message terminate="yes">&#xa;Error: <xsl:value-of select="$text"/></xsl:message>
+</xsl:template>
+
+
+<xsl:template match="/SystemDefinition">
+		<xsl:apply-templates select="." mode="sizing"/>
+</xsl:template>
+
+
+<xsl:template match="node()" mode="sizing"><xsl:copy-of select="."/></xsl:template>
+
+<xsl:template match="systemModel" mode="sizing">
+	<!-- 1st pass to compute the sizes of everything -->
+	<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+		<xsl:apply-templates select="*" mode="sizing"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="meta" mode="sizing">
+	<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+		<xsl:attribute name="width">0</xsl:attribute>
+		<xsl:attribute name="height">0</xsl:attribute>
+		<xsl:copy-of select="node()"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template name="full-width">
+	<xsl:param name="w0" select="@width"/>
+	<xsl:param name="lscale"/>
+	<!-- call from item which contains the global metas -->
+	<xsl:variable name="logo-w" select="sum(meta[@rel='model-logo']/@width) + $groupDx * count(meta[@rel='model-logo'])"/>
+	<xsl:choose>
+		<xsl:when test="not(meta[@rel='model-legend']) and meta[@rel='model-logo'] and meta[@rel='model-logo']/@width &gt; $w0 ">
+			<!-- no legend, but a logo that's wider than the model, use logo width -->
+			<xsl:value-of select="meta[@rel='model-logo']/@width"/>
+		</xsl:when>
+		<xsl:when test="not(meta[@rel='model-legend']/legend)">
+			<!-- no legend, and if there is a logo it's narrower than the model, use model width -->
+			<xsl:value-of select="$w0"/>
+		</xsl:when>
+		<xsl:when test="meta[@rel='model-legend']/legend/@percent-width and meta[@rel='model-legend']/legend/@percent-width &lt;= 100">
+			<!-- legend takes up less than the full width of the model, so it can be ignored -->
+			<xsl:value-of select="$w0"/>
+		</xsl:when>
+		<xsl:when test="meta[@rel='model-legend']/@width * $lscale + $logo-w &gt; $w0">
+			<!-- if the legend is scaled so that it's wider than the model, then use that width -->
+			<xsl:value-of select="meta[@rel='model-legend']/@width * $lscale + $logo-w"/>
+		</xsl:when>
+		<xsl:otherwise> <!-- legend scaling is smaller than the width, so use model width-->
+			<xsl:value-of select="$w0"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="full-height"><xsl:param name="lscale"/>
+<!--
+ HEIGHT:
+ if there is no scaling, add max(legend height , logo height) to the page height
+ if there is scaling use max(legend height * scale , logo height) 
+-->
+	<xsl:call-template name="sum-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="concat($groupDy,' ')"/>
+			<xsl:choose>
+			
+				<xsl:when test="not(meta[@rel='model-legend']/legend) and meta[@rel='model-logo'] ">
+					<!-- no legend, but there's a logo, so add that height -->
+					<xsl:value-of select="meta[@rel='model-logo']/@height"/>
+				</xsl:when>
+				<xsl:when test="not(meta[@rel='model-legend']/legend)">0</xsl:when>			<!-- no legend and no logo -->
+				<xsl:when test="meta[@rel='model-legend']/@height * $lscale &gt; sum(meta[@rel='model-logo']/@height)">
+					<!-- legend is taller than the logo, use legend -->
+					<xsl:value-of select="meta[@rel='model-legend']/@height * $lscale"/>
+				</xsl:when>
+				<xsl:otherwise> <!-- legend is not at tall as the logo, use logo -->
+					<xsl:value-of select="meta[@rel='model-logo']/@height"/>
+				</xsl:otherwise>
+			</xsl:choose><xsl:text> </xsl:text>
+			<xsl:if test="meta[@rel='model-footer']">
+				<xsl:value-of select="concat(meta[@rel='model-footer']/@height,' ')"/>
+			</xsl:if>
+	
+			<xsl:if test="not(layer)">  <!-- not a full model, just use this one item -->
+				<xsl:value-of select="@height"/> 
+			</xsl:if>
+			<!-- padding + extra padding from layer groups for full model-->
+			<xsl:if test="layer"> 
+				<xsl:value-of select="concat(sum(layer[not(@span) or @span=0]/@height), ' ')"/>
+				<xsl:value-of select="count(layer[not(@span) or @span=0]) * $groupDy + sum(layer[not(@span) or @span=0]/@*[name()='padding-bottom' or name()='padding-top'])"/>
+			</xsl:if>
+			<xsl:text> </xsl:text>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>			
+
+<xsl:template match="/SystemDefinition" mode="sizing">
+	<!-- not full model, just one item  -->
+	<!-- 1st pass to compute the sizes of everything -->
+
+	<xsl:variable name="content">
+		<xsl:apply-templates mode="sizing"/>
+	</xsl:variable>
+
+	<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+		<xsl:attribute name="padding-left">0</xsl:attribute>
+		<xsl:attribute name="padding-right">0</xsl:attribute>
+
+		<xsl:for-each select="exslt:node-set($content)/*">
+			<xsl:attribute name="model-width"><xsl:value-of select="@width"/></xsl:attribute>
+			<xsl:attribute name="model-height"><xsl:value-of select="@height"/></xsl:attribute>
+			<!-- the width without taking the legend into account -->
+			<xsl:variable name="lscale"> <!-- legend scaling --> 
+				<xsl:apply-templates select="meta[@rel='model-legend']/legend" mode="scale-factor">
+					<xsl:with-param name="full-width" select="current()/@width + $groupDy"/>
+				</xsl:apply-templates>
+			</xsl:variable>
+
+			<xsl:attribute name="width">
+				<xsl:call-template name="full-width">
+					<xsl:with-param name="w0" select="current()/@width + $groupDy"/>
+					<xsl:with-param name="lscale" select="$lscale"/>
+				</xsl:call-template>
+			</xsl:attribute>
+			<xsl:attribute name="height">
+				<xsl:call-template name="full-height">
+					<xsl:with-param name="lscale" select="$lscale"/>
+				</xsl:call-template>
+			</xsl:attribute>
+			<xsl:copy><xsl:copy-of select="@*"/> 	<!--  the root item  -->
+				<xsl:for-each select="meta[@rel='model-legend']">
+					<!-- copy legend 1st and add scaling -->
+					<xsl:copy>
+						<xsl:copy-of select="@*[name()!='width' and name()!='height']"/>
+						<xsl:attribute name="width"><xsl:value-of select="@width * $lscale"/></xsl:attribute>
+						<xsl:attribute name="height"><xsl:value-of select="@height * $lscale"/></xsl:attribute>
+						<xsl:attribute name="scaled"><xsl:value-of select="$lscale"/></xsl:attribute>
+						<xsl:copy-of select="node()"/>
+					</xsl:copy>
+				</xsl:for-each>
+				<!-- copy everything else -->
+				<xsl:copy-of select="*[not(self::meta and @rel='model-legend')]"/>
+			</xsl:copy>
+		</xsl:for-each>
+	</xsl:copy>
+</xsl:template>
+
+
+<xsl:template match="/SystemDefinition[systemModel]" mode="sizing">
+	<!-- 1st pass to compute the sizes of everything -->
+
+	<xsl:variable name="content0">
+		<xsl:apply-templates mode="sizing"/>
+	</xsl:variable>
+
+	<xsl:variable name="heights">
+		<xsl:call-template name="layer-height">
+			<xsl:with-param name="layers">
+				<xsl:for-each select="exslt:node-set($content0)/systemModel/layer">
+					<xsl:copy><xsl:copy-of select="@id|@height|@span"/></xsl:copy>
+				</xsl:for-each>
+			</xsl:with-param>
+			<xsl:with-param name="spans" select="exslt:node-set($content0)/systemModel/layer[@span and @span!=0]"/>
+		</xsl:call-template>
+	</xsl:variable>
+
+	<xsl:variable name="content">
+		<xsl:apply-templates select="exslt:node-set($content0)/*" mode="adjust-layer-height">
+			<xsl:with-param name="new-layers" select="exslt:node-set($heights)/layer"/>
+		</xsl:apply-templates>
+	</xsl:variable>	 
+
+
+	<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+		<xsl:for-each select="exslt:node-set($content)/systemModel">
+			<xsl:variable name="m-width">
+				<xsl:call-template name="max-from-list">
+					<xsl:with-param name="list">		
+						<xsl:for-each select="layer[not(@span) or @span=0]">
+							<xsl:value-of select="concat(sum(@width | following-sibling::layer[@span and position() - @span &lt;= 0]/@width) + $groupDx * (count(@width | following-sibling::layer[@span and position() - @span &lt;= 0]/@width)  - 1), ' ')"/>					
+						</xsl:for-each>
+					</xsl:with-param> 
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:attribute name="model-width"><xsl:value-of select="$m-width"/></xsl:attribute>
+
+			<xsl:variable name="right-borders">
+				<xsl:call-template name="max-from-list">
+					<xsl:with-param name="list">
+						<xsl:text>0 </xsl:text>
+						<xsl:for-each select="meta[@rel='layer-group']/layer-group">
+							<xsl:apply-templates select="." mode="right-border"/><xsl:text> </xsl:text>
+						</xsl:for-each>
+					</xsl:with-param>
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:variable name="left-borders">
+				<xsl:call-template name="max-from-list">
+					<xsl:with-param name="list">
+						<xsl:text>0 </xsl:text>
+						<xsl:for-each select="meta[@rel='layer-group']/layer-group">
+							<xsl:apply-templates select="." mode="left-border"/><xsl:text> </xsl:text>
+						</xsl:for-each>
+					</xsl:with-param>
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:attribute name="padding-left"><xsl:value-of select="$left-borders + $lyrTitleBox + 3.5 + $groupDy"/></xsl:attribute>
+			<xsl:attribute name="padding-right"><xsl:value-of select="$right-borders + $groupDy"/></xsl:attribute>
+
+			<!-- the width without taking the legend into account -->
+			<xsl:variable name="w0"  select="$m-width+ $lyrTitleBox + 3.5 +  2 * $groupDy + $left-borders + $right-borders"/>
+
+			<!--
+			Options for scaling the legend:
+			WIDTH: 
+			if the legend has @percent-width, then don't count the legend width in the list
+			if @percent-width < 100 ignore entirely
+			if @percent-width > 100 then width = (full width - logo width) * @percent-width % + logo width 
+			@maxscale is set, then clamp scale to that and recalc width if scale > 1
+			
+			if there is no legend scaling
+			take into account legend width + logo width +padding
+			-->
+			
+			<xsl:variable name="lscale"> <!-- legend scaling --> 
+				<xsl:apply-templates select="meta[@rel='model-legend']/legend" mode="scale-factor">
+					<xsl:with-param name="full-width" select="$w0"/>
+				</xsl:apply-templates>
+			</xsl:variable>
+			
+<!--
+ HEIGHT:
+ if there is no scaling, add max(legend height , logo height) to the page height
+ if there is scaling use max(legend height * scale , logo height) 
+
+-->
+
+		<xsl:attribute name="model-height">
+			<xsl:value-of select="count(layer[not(@span) or @span=0]) * $groupDy + sum(layer[not(@span) or @span=0]/@*[name()='height'  or name()='padding-bottom' or name()='padding-top'])"/>
+		</xsl:attribute>
+		
+		<xsl:attribute name="width">
+				<xsl:call-template name="full-width">
+					<xsl:with-param name="w0" select="$w0"/>
+					<xsl:with-param name="lscale" select="$lscale"/>
+				</xsl:call-template>
+
+		</xsl:attribute>
+		<xsl:attribute name="height">
+			<xsl:call-template name="full-height">
+				<xsl:with-param name="lscale" select="$lscale"/>
+			</xsl:call-template>
+		</xsl:attribute>
+		<xsl:copy><xsl:copy-of select="@*"/>
+			<xsl:for-each select="meta[@rel='model-legend']">
+				<!-- copy legend 1st and add scaling -->
+				<xsl:copy>
+					<xsl:copy-of select="@*[name()!='width' and name()!='height']"/>
+					<xsl:attribute name="width"><xsl:value-of select="@width * $lscale"/></xsl:attribute>
+					<xsl:attribute name="height"><xsl:value-of select="@height * $lscale"/></xsl:attribute>
+					<xsl:attribute name="scaled"><xsl:value-of select="$lscale"/></xsl:attribute>
+					<xsl:copy-of select="node()"/>
+				</xsl:copy>
+			</xsl:for-each>
+			<!-- copy everything else -->
+			<xsl:copy-of select="*[not(self::meta and @rel='model-legend')]"/>
+		</xsl:copy>
+	</xsl:for-each>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template name="layer-height-step">
+	<xsl:param name="layers"/>
+	<xsl:param name="span"/>
+
+	<xsl:variable name="spanning" select="$span/preceding-sibling::layer[not(@span) and position() &lt;= $span/@span]"/>
+	
+	<xsl:variable name="h" select="sum($spanning/@height) + (count($spanning) - 1) * $groupDy"/>
+	<xsl:variable name="even" select="($span/@height - $h) div count($spanning)"/>
+	
+	<xsl:for-each select="exslt:node-set($layers)/layer">
+		<xsl:copy><xsl:copy-of select="@id|@span"/>
+			<xsl:choose>
+				<xsl:when test="0"/> <!-- why? was something removed or should something be here?-->
+				<xsl:otherwise> <!-- layers smaller than spanned -->
+					<xsl:choose>
+						<xsl:when test="$spanning[@id=current()/@id] and $span/@height &gt; $h">
+							<!-- layers are smaller than spanned layer -->
+							<xsl:attribute name="height"><xsl:value-of select="@height + $even"/></xsl:attribute>
+						</xsl:when>
+						<xsl:when test="@id=$span/@id and $span/@height &lt; $h">
+							<!-- layers are bigger than spanned layer -->
+							<xsl:attribute name="height"><xsl:value-of select="$h"/></xsl:attribute>
+						</xsl:when>
+						<xsl:otherwise><xsl:copy-of select="@height"/></xsl:otherwise>
+					</xsl:choose>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:copy>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template name="layer-height">
+	<xsl:param name="layers"/>
+	<xsl:param name="spans"/>
+	<xsl:choose>
+		<xsl:when test="not($spans)">
+			<!-- layers are bigger than spanned layer -->
+			<xsl:copy-of select="$layers"/>
+		</xsl:when>
+		<xsl:when test="count($spans)=1">
+			<xsl:call-template name="layer-height-step">
+				<xsl:with-param name="layers" select="$layers"/>
+				<xsl:with-param name="span" select="$spans[1]"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:call-template name="layer-height">
+				<xsl:with-param name="layers">
+					<xsl:call-template name="layer-height-step">
+						<xsl:with-param name="layers" select="$layers"/>
+						<xsl:with-param name="span" select="$spans[1]"/>
+					</xsl:call-template>
+				</xsl:with-param>
+				<xsl:with-param name="spans" select="$spans[position() &gt; 1]"/>
+			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="legend" mode="scale-factor">
+	<!--
+	Options for scaling the legend:
+	WIDTH: 
+	if the legend has @percent-width, then don't count the legend width in the list
+	if @percent-width < 100 ignore entirely
+	if @percent-width > 100 then width = (full width - logo width) * @percent-width % + logo width 
+	@maxscale is set, then clamp scale to that and recalc width if scale > 1
+	
+	if there is no legend scaling
+	take into account legend width + logo width +padding
+	-->
+	
+	<xsl:param name="full-width"/>
+	<!-- the space avialble for the legend -->
+	<xsl:variable name="available-width" select="$full-width - sum(../../meta[@rel='model-logo']/@width) - $groupDx * count(../../meta[@rel='model-logo'])"/>
+
+
+	<!-- the space the legend wants to take up -->
+	<xsl:variable name="want-width">
+		<xsl:choose>
+			<xsl:when test="@percent-width"><xsl:value-of select="0.01* @percent-width * $available-width"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$available-width"/></xsl:otherwise> <!-- assume 100% in relevent cases where % not set -->
+		</xsl:choose>
+	</xsl:variable>	
+	<xsl:choose>
+		<xsl:when test="@maxscale and ($want-width &gt; ../@width * @maxscale)"><xsl:value-of select="@maxscale"/></xsl:when> <!-- desired space requires too much scaling, so limit the scale to maxscale -->
+		<xsl:when test="@maxscale or @percent-width"><xsl:value-of select="$want-width div ../@width"/></xsl:when> <!-- scaling = desired size / available size -->
+		<xsl:otherwise>1</xsl:otherwise> <!-- don't scale unless asked to -->
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="node()" mode="adjust-layer-height">
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template match="systemModel" mode="adjust-layer-height">	<xsl:param name="new-layers"/>
+	<xsl:copy><xsl:copy-of select="@*"/>
+		<xsl:apply-templates select="*" mode="adjust-layer-height">
+			<xsl:with-param name="new-layers" select="$new-layers"/>
+		</xsl:apply-templates>		
+	</xsl:copy>
+</xsl:template>
+
+
+<xsl:template match="layer" mode="adjust-layer-height">	<xsl:param name="new-layers"/>
+	<xsl:copy><xsl:copy-of select="@*[name()!='height']"/>
+		<xsl:choose>
+			<xsl:when test="$new-layers[@id=current()/@id]/@height">
+				<xsl:copy-of select="$new-layers[@id=current()/@id]/@height"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:copy-of select="@height"/>
+			</xsl:otherwise>
+		</xsl:choose>
+		<xsl:copy-of select="node()"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="layer" mode="sizing">
+	<!-- 1st pass to compute the sizes of everything -->
+	<xsl:variable name="content">
+		<xsl:apply-templates mode="sizing"/>
+	</xsl:variable>	 
+
+	<!-- if there's no content, only show if forced to by placeholder-detail -->
+	<xsl:if test="/SystemDefinition[@placeholder-detail]	or exslt:node-set($content)/*[self::package]">  	
+		<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+			<xsl:if test="not(@span) or @span=0  or count(exslt:node-set($content)/package)!=1">
+				<xsl:attribute name="ipad"><xsl:value-of select="2* $groupDy"/></xsl:attribute>
+			</xsl:if>		
+			<xsl:attribute name="width">
+						<xsl:value-of select="sum(exslt:node-set($content)/*/@width) + $groupDx * ( count(exslt:node-set($content)/*/@width)  - 1 )"/>
+			</xsl:attribute>
+			<xsl:attribute name="height">
+				<xsl:for-each select="exslt:node-set($content)/*">
+					<xsl:sort select="@height" order="descending" data-type="number"/>
+					<xsl:if test="position()=1"><xsl:value-of select="@height"/></xsl:if>
+				</xsl:for-each>
+			</xsl:attribute>
+			<xsl:call-template name="layer-padding"/>
+			<xsl:copy-of select="$content"/>
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template name="layer-padding">
+	<xsl:variable name="top" select="count(../meta[@rel='layer-group']/descendant::layer-group[@to=current()/@id])"/>
+	<xsl:variable name="bottom" select="count(../meta[@rel='layer-group']/descendant::layer-group[@from=current()/@id])"/>
+	<xsl:if test="$top!=0">
+		<xsl:attribute name="padding-top">
+			<xsl:value-of select="$top * $lgrpDx"/>
+		</xsl:attribute>
+	</xsl:if>
+	<xsl:if test="$bottom!=0">
+		<xsl:attribute name="padding-bottom">
+			<xsl:value-of select="$bottom * $lgrpDx"/>
+		</xsl:attribute>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template name="spanned-levels-step">
+	<xsl:param name="pkg"/>
+	<xsl:param name="levels"/>
+	<xsl:variable name="named" select="exslt:node-set($levels)/level[@name=$pkg/@level] or not($pkg/@level)"/>
+	<!-- it's this level, or it spans all by not having any level defined, or by being in the span range for level  or it's the unnamed error level-->
+	<xsl:variable name="match" select="exslt:node-set($levels)/level[
+		@name=$pkg/@level  or 
+		not($pkg/@level)  or 
+		($pkg/@span and following-sibling::level[position() &lt; $pkg/@span][@name=$pkg/@level or (not(@name) and not($named))]) or 
+		(not($named) and not(@name))
+		]"/>
+	
+	<xsl:variable name="h" select="(sum($match/@height) + $groupDy * (count($match) - 1))"/> <!--height of all levels spanned by this -->
+	<xsl:variable name="even" select="($pkg/@height - $groupDy * (count($match) - 1) - sum($match/@min-height)) div count($match)"/>
+	
+	
+	<xsl:for-each select="exslt:node-set($levels)/level">
+		<xsl:choose>
+			<xsl:when test="$even &lt;= 0">
+				<!-- this is too small to have an impact, ignore this -->
+				<xsl:copy-of select="."/>
+			</xsl:when>
+			<xsl:when test="$match[@name=current()/@name or (not(@name) and not(current()/@name))]">
+				<xsl:choose>
+					<xsl:when test="$h &gt;= $pkg/@height">
+							<xsl:copy-of select="."/> <!-- no change -->
+					</xsl:when>
+						<xsl:otherwise>
+							<xsl:copy><xsl:copy-of select="@*[name()!='height']"/>
+								<xsl:attribute name="height">
+									<xsl:value-of select="sum(@min-height) + $even"/>
+								</xsl:attribute>
+								<xsl:copy-of select="*"/>
+							</xsl:copy>
+						</xsl:otherwise>
+				</xsl:choose>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:copy-of select="."/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template name="spanned-levels">
+	<xsl:param name="pkgs"/>
+	<xsl:param name="levels"/>
+	<xsl:choose>
+		<xsl:when test="not($pkgs)">
+			<xsl:copy-of select="$levels"/>
+		</xsl:when>
+		<xsl:when test="count($pkgs) =1">
+			<xsl:call-template name="spanned-levels-step">
+				<xsl:with-param name="pkg" select="$pkgs[1]"/>
+				<xsl:with-param name="levels" select="$levels"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:call-template name="spanned-levels">
+				<xsl:with-param name="pkgs" select="$pkgs[position() &gt; 1]"/>
+				<xsl:with-param name="levels">
+					<xsl:call-template name="spanned-levels-step">
+						<xsl:with-param name="pkg" select="$pkgs[1]"/>
+						<xsl:with-param name="levels" select="$levels"/>
+					</xsl:call-template>
+				</xsl:with-param>
+			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="layer[@levels]" mode="sizing">
+	<!-- layer has levels and packages, at least some with a level set, so determine height and width of each level -->
+
+	<xsl:variable name="content">
+		<xsl:apply-templates mode="sizing"/>
+	</xsl:variable>	 
+	 
+	<!-- if there's no content, only show if forced to by placeholder-detail -->
+	<xsl:if test="/SystemDefinition[@placeholder-detail]	or exslt:node-set($content)/*[self::package]">  	
+
+		<!-- the levels without taking into account spanned pkgs -->
+		<xsl:variable name="levels0">
+			<xsl:call-template name="levels-size">
+				<xsl:with-param name="levels">
+					<xsl:apply-templates select="." mode="levels"/>
+				</xsl:with-param>		
+				<xsl:with-param name="items" select="exslt:node-set($content)/package"/>
+			</xsl:call-template>
+		</xsl:variable>
+	<!-- figure out which spanned pkgs actually have an impact. This excludes:
+		* pkgs which span the same levels, but are smaller than another pkg
+		* pkgs which have collections that use the layer's levels (already taken into account)
+	-->
+		
+
+	<xsl:variable name="b"> <!--all spanning pkgs with set of levels they cover -->
+		<xsl:for-each select="exslt:node-set($content)/package[((@span and @span!=1) or not(@level)) and not(not(@levels) and meta[@rel='model-levels']/level[@name])]">
+			<!-- all pkgs which span and have levels -->
+			<xsl:variable name="named" select="exslt:node-set($levels0)/level[@name=current()/@level] or not(@level)"/>
+			<xsl:variable name="pkg" select="."/>
+			<!-- it's this level, or it spans all by not having any level defined, or by being in the span range for level  or it's the unnamed error level-->
+			<xsl:variable name="match" select="exslt:node-set($levels0)/level[@name=$pkg/@level  or not($pkg/@level)  or ($pkg/@span and following-sibling::level[position() &lt; $pkg/@span][@name=$pkg/@level or (not(@name) and not($named))]) or (not($named) and not(@name))]"/>
+			<b id="{@id}">
+				<xsl:attribute name="levs"> 
+					<!-- just a space separated list of level indexs : don't use names, since one name can be blank -->
+					<xsl:for-each select="$match">
+						<xsl:value-of select="count(preceding-sibling::level)+1"/>
+						<xsl:if test="position()!=last()"><xsl:text> </xsl:text></xsl:if>
+					</xsl:for-each>
+				</xsl:attribute>
+			</b>
+		</xsl:for-each>
+	</xsl:variable>
+	<xsl:variable name="impacting"> <!-- just the list of remaining pkgs which have an impact on the levels -->
+		<xsl:for-each select="exslt:node-set($b)/b">
+			<xsl:variable name="pkg" select="exslt:node-set($content)/package[@id=current()/@id]"/> <!-- the actual pkg -->
+			<xsl:variable name="ignore"> <!-- non-empty if this should be ingnored -->
+				<xsl:for-each select="following-sibling::b[@levs=current()/@levs]"> <!-- compare against pkgs with same set of levels-->
+					<!-- ignore if a later pkg is taller or the same size-->
+					<xsl:if test="exslt:node-set($content)/package[@id=current()/@id]/@height &gt;= $pkg/@height">*</xsl:if>
+				</xsl:for-each>
+			</xsl:variable>
+			<xsl:if test="$ignore=''"><xsl:copy-of select="."/></xsl:if> <!--only keep the un-ignored -->
+		</xsl:for-each>
+	</xsl:variable>
+	
+	<!-- adjust the list of levels to take into account the impacting packages which span levels -->
+	<xsl:variable name="levels">
+		<xsl:call-template name="spanned-levels">
+			<xsl:with-param name="pkgs" select="exslt:node-set($content)/package[@id=exslt:node-set($impacting)/b/@id]"/>
+			<xsl:with-param name="levels" select="$levels0"/>
+		</xsl:call-template>
+	</xsl:variable>
+
+		 <xsl:variable name="ext-w"  select="count(ancestor::SystemDefinition[@levels='expand'])*$levelExpandName"/>
+	 
+		<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+			<xsl:if test="not(@span) or @span=0  or count(exslt:node-set($content)/package)!=1">
+				<xsl:attribute name="ipad"><xsl:value-of select="2 *$groupDy"/></xsl:attribute>
+			</xsl:if>
+			<xsl:attribute name="width">
+				<xsl:for-each select="exslt:node-set($levels)/level">
+					<xsl:sort select="@width" order="descending" data-type="number"/>
+					<xsl:if test="position()=1"><xsl:value-of select="@width + $ext-w"/></xsl:if>
+				</xsl:for-each>
+			</xsl:attribute>
+
+			<xsl:attribute name="height">
+					<!-- +1 for padding on top and bottom  -->
+				<xsl:value-of select="sum(exslt:node-set($levels)/level/@height) + $groupDy * (count(exslt:node-set($levels)/level/@height) + 1)"/>
+			</xsl:attribute>
+			<xsl:call-template name="layer-padding"/>
+			<meta rel="model-levels">
+				<xsl:copy-of select="$levels"/>
+			</meta>
+			<xsl:copy-of select="$content"/>
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="layer[ancestor::SystemDefinition[@detail-type='fixed' and @detail='layer']]" mode="sizing" priority="2">
+	<!-- no displayed content and fixed with, so don't even look at the pkgs -->
+	<xsl:variable name="content">
+		<xsl:apply-templates mode="sizing"/>
+	</xsl:variable>
+	<xsl:variable name="levels">
+		<xsl:apply-templates select="." mode="levels"/>
+	</xsl:variable>
+	<xsl:if test="/SystemDefinition[@placeholder-detail]	or exslt:node-set($content)/*[self::package]">  	
+		<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+			<xsl:attribute name="width">
+				<xsl:value-of select="$lyrFixedWidth + count(ancestor::SystemDefinition[@levels='expand'])*$levelExpandName"/>
+			</xsl:attribute>
+			<xsl:attribute name="height">
+				<xsl:value-of select="count(exslt:node-set($levels)/level) * $mHeight * 1.5 "/>
+			</xsl:attribute>
+			<xsl:call-template name="layer-padding"/>		
+			<meta rel="model-levels">
+				<xsl:copy-of select="$levels"/>
+			</meta>	
+			<xsl:copy-of select="$content"/>
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="layer[not(package/@level)]" mode="sizing" priority="1">
+	<!-- any levels apply to the collections, the pkgs all span full height of the layer => in a row on the same line
+		height = max height of all pkgs + padding
+		width = sum of all pkg widths, plus any internal padding -->
+	<xsl:variable name="content">
+		<xsl:apply-templates mode="sizing"/>
+	</xsl:variable>
+	
+	<!-- if there's no content, only show if forced to by placeholder-detail -->
+	<xsl:if test="/SystemDefinition[@placeholder-detail]	or exslt:node-set($content)/*[self::package]">  	
+		<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+		<xsl:if test="not(@span) or @span=0  or count(exslt:node-set($content)/package)!=1">
+			<xsl:attribute name="ipad"><xsl:value-of select="2 * $groupDy"/></xsl:attribute>
+		</xsl:if>
+			<xsl:variable name="h">
+				<xsl:for-each select="exslt:node-set($content)/*">
+					<xsl:sort select="@height" order="descending" data-type="number"/>
+					<xsl:if test="position()=1"><xsl:value-of select="@height"/></xsl:if>
+				</xsl:for-each>			
+			</xsl:variable>
+			<xsl:attribute name="width">
+				<!-- sum of all widths + padding -->
+				<xsl:value-of select="sum(exslt:node-set($content)/*/@width) +  $groupDx * (count(exslt:node-set($content)/*) - 1) + count(ancestor::SystemDefinition[@levels='expand'])*$levelExpandName"/>
+			</xsl:attribute>
+			<xsl:attribute name="height">
+				<xsl:choose>
+					<xsl:when test="count(package)=1 and @span and @span!=0">
+						<!-- same height as contents, no room for layer name -->
+						<xsl:value-of select="$h"/>
+					</xsl:when>
+					<xsl:when test="@span and @span!=0">
+						<!-- padding on top, room for name on bottom -->
+						<xsl:value-of select="$h  +  $groupDy + $pkgLabelSize"/>
+					</xsl:when>
+					<xsl:otherwise> <!-- padding on top and bottom, name outside -->
+						<xsl:value-of select="$h + 2 * $groupDy"/>
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:attribute>
+			<xsl:call-template name="layer-padding"/>
+			<xsl:copy-of select="$content"/>
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="collection" mode="effective-width"><xsl:param name="levels"/>  
+	<!-- called on the last in a set of collections -->
+	<xsl:variable name="id" select="preceding-sibling::package[1]/@id"/>
+	<xsl:variable name="lev">
+		<xsl:call-template name="levels-widths">
+			<xsl:with-param name="levels" select="$levels"/>
+			<xsl:with-param name="items" select=". | preceding-sibling::collection[preceding-sibling::package/@id=$id]"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:for-each select="exslt:node-set($lev)/level">
+		<xsl:sort select="@width" order="descending" data-type="number"/>
+		<xsl:if test="position()=1"><xsl:value-of select="concat(@width + $groupDx,' ')"/></xsl:if>
+	</xsl:for-each>
+</xsl:template>
+
+
+<xsl:template match="collection[not(preceding-sibling::package)]" mode="effective-width">
+	<xsl:param name="levels"/>  <!-- there is nothing but collections before this -->
+	<xsl:variable name="lev">
+		<xsl:call-template name="levels-widths">
+			<xsl:with-param name="levels" select="$levels"/>
+			<xsl:with-param name="items" select="preceding-sibling::collection | ."/>
+		</xsl:call-template>
+	</xsl:variable>	
+	<xsl:for-each select="exslt:node-set($lev)/level">
+		<xsl:sort select="@width" order="descending" data-type="number"/>
+		<xsl:if test="position()=1"><xsl:value-of select="concat(@width + $groupDx, ' ')"/></xsl:if>
+	</xsl:for-each>
+</xsl:template>
+
+
+<xsl:template match="package" mode="sizing">
+	<!-- height is explicitly set by levels -->
+
+	<xsl:variable name="content">
+		<xsl:apply-templates mode="sizing"/>
+	</xsl:variable>
+	<!-- if there's no content, only show if forced to by placeholder-detail -->
+	<xsl:if test="/SystemDefinition[@placeholder-detail='package' or @placeholder-detail='component' or @placeholder-detail='collection'] 
+		or exslt:node-set($content)/*[self::package or self::collection]">  	
+		<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+			<xsl:variable name="levels0">
+				<xsl:apply-templates select="." mode="levels"/>
+			</xsl:variable>
+			<xsl:variable name="levels">
+				<xsl:call-template name="levels-widths">
+					<xsl:with-param name="levels" select="$levels0"/>
+					<xsl:with-param name="items" select="exslt:node-set($content)/collection"/>
+				</xsl:call-template>
+			</xsl:variable>
+
+			<xsl:variable name="max-width">
+				<xsl:for-each select="exslt:node-set($levels)/level">
+					<xsl:sort select="@width" order="descending" data-type="number"/>
+					<xsl:if test="position()=1"><xsl:value-of select="@width"/></xsl:if>
+				</xsl:for-each>
+			</xsl:variable>					
+			<xsl:variable name="min-width">
+				<xsl:for-each select="exslt:node-set($levels)/level">
+					<xsl:sort select="@width" order="ascending" data-type="number"/>
+					<xsl:if test="position()=1"><xsl:value-of select="@width"/></xsl:if>
+				</xsl:for-each>
+			</xsl:variable>
+			<xsl:variable name="h0" select="count(exslt:node-set($levels)/level) * ($mHeight +  $groupDy) - $groupDy"/> <!-- height of just levels, no padding -->
+			
+			<xsl:variable name="padding" select="number(
+					not(parent::package or  
+							count(exslt:node-set($levels)/level) &lt; 2 or
+								(not(@level) and descendant::collection/@level and ../package/@level) )
+					) * 2 * $groupDy
+				"/>
+
+			<xsl:if test="$padding != 0 ">
+				<xsl:attribute name="ipad"><xsl:value-of select="$padding"/></xsl:attribute>
+			</xsl:if> <!--
+				Perhaps needs this rule for padding too:
+					this has no level, but children have levels and siblings have levels, ie
+					not(@level) and descendant::collection/@level and ../package/@levels				
+				-->
+			
+			<xsl:variable name="h">
+				<xsl:choose>
+					<xsl:when test="exslt:node-set($content)/package and /SystemDefinition/@detail='package'">
+						<xsl:value-of select="$h0 + $pkgLabelSize + $padding + $detail-block-space"/>  <!-- padding plus extra room for larger itle  -->
+					</xsl:when>
+					<xsl:when test="exslt:node-set($content)/package">
+						<xsl:value-of select="$h0 + $pkgLabelSize + $padding"/>  <!-- padding plus room for title  -->
+					</xsl:when>
+					<xsl:when test="/SystemDefinition/@detail='package' and parent::layer">
+						<xsl:value-of select="$h0 + $padding"/>  <!-- needs padding   -->
+					</xsl:when>
+					<xsl:when test="/SystemDefinition/@detail='package'">
+						<xsl:value-of select="$h0"/>  <!-- plenty of room for title  (nested pkg) -->
+					</xsl:when>
+					<xsl:when test="parent::SystemDefinition and not( exslt:node-set($levels)/level[1]/@width=0)">
+						<xsl:value-of select="$h0 + $padding  + $pkgLabelSize "/>  <!-- padding plus room for title -->
+					</xsl:when>
+					<xsl:when test="parent::layer and ($max-width - $min-width &gt; $inlineLabel)">
+						<xsl:value-of select="$h0 + $padding"/>  <!-- padding plus room for title -->
+					</xsl:when>
+					<!-- non-nested pkgs here on out don't have room for inline label-->
+					<xsl:when test="parent::layer and count(exslt:node-set($levels)/level) &gt; 1">
+						<xsl:value-of select="$h0 + $padding + $pkgLabelSize"/>  <!-- padding plus room for title -->
+								<!--xsl:value-of select="$h0 + 2 * $groupDy"/>  <!-  title should go inline -->
+					</xsl:when>
+					<xsl:when test="$max-width - $min-width &lt; $inlineLabel">
+						<xsl:value-of select="$h0 + $padding"/> <!-- nested pkg too small to fit label: use normal height, but make wider (below) -->
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:value-of select="$h0 + $padding"/>  <!--  title should go inline (nested pkg) -->
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:variable>		
+		<xsl:variable name="expand-width">
+			<!-- Set expand-width to indicate when the pkg should be expanded to add room for a title iff it's stays at the native height --> 
+			<xsl:choose>
+				<xsl:when test="not(exslt:node-set($content)/package or exslt:node-set($content)/collection)">0</xsl:when> <!-- no content, don't expand -->
+				<xsl:when test="exslt:node-set($content)/package">0</xsl:when> <!--  never expand with nested pkgs  -->
+				<xsl:when test="/SystemDefinition[@detail-type='fixed' and @detail='package']">0</xsl:when>				<!-- fixed detail.  -->
+				<xsl:when test="parent::package and ($min-width + $inlineLabel  &lt; $subpkgMinWidth)">
+						<xsl:value-of select="$subpkgMinWidth - $max-width"/> <!-- small nested pkg -->
+				</xsl:when> 
+				<xsl:when test="parent::package and ($max-width - $min-width &lt; $inlineLabel)"> 
+					<!-- nested pkg  w/o room for label. Expand to fit label -->
+						<xsl:value-of select="$min-width + $inlineLabel - $max-width"/>
+				</xsl:when>
+				<xsl:when test="parent::package and ($max-width  &lt; $subpkgMinWidth)">
+						<xsl:value-of select="$subpkgMinWidth - $max-width"/>
+				</xsl:when> 	<!-- small nested pkg,  -->
+				<xsl:when test="not(parent::package) and count(exslt:node-set($levels)/level) = 1 and ../package[@level=current()/@level and not(@span) and contains(normalize-space(@levels),' ')]">
+					<!-- this has one level, but at least one sibling at the same level has more than one, so the height will be expanded. No need to add space for title -->
+					<xsl:choose>
+						<xsl:when test="$max-width  &lt; $pkgMinWidth"> 	 <!-- small package -->
+							<xsl:value-of select="$pkgMinWidth - $max-width"/>
+						</xsl:when>
+						<xsl:otherwise><xsl:value-of select="0"/></xsl:otherwise>	
+					</xsl:choose>
+				</xsl:when>				
+				<xsl:when test="$max-width  &lt; $pkgMinWidth and  $inlineLabel + $min-width &gt; $pkgMinWidth and $h &lt; $mHeight*1.5"> 
+				<!-- small pkg, without enough room for a title. Make wide enough to fit the title -->
+						<xsl:value-of select="$min-width + $inlineLabel - $max-width"/>
+				</xsl:when>
+				<xsl:when test="$max-width  &lt; $pkgMinWidth">0</xsl:when>
+				<xsl:when test="parent::package and  ($max-width - $min-width &lt; $inlineLabel)"> 
+					<!-- need to make wider to have room for a title -->
+						<xsl:value-of select="$min-width + $inlineLabel - $max-width"/>
+				</xsl:when>
+				<xsl:when test="$h &lt; $mHeight + $pkgLabelSize">
+					<!-- if not nested and only 1 level tall,  make wider instead of taller-->
+					<!-- need to make wider to have room for a title -->
+						<xsl:value-of select="$inlineLabel"/>
+				</xsl:when>
+				<xsl:when test="parent::layer and not(@level) and ../@levels and ($max-width - $min-width &lt; $inlineLabel)"> 
+					<!-- need to make wider to have room for a title -->
+						<xsl:value-of select="$min-width + $inlineLabel - $max-width"/>
+				</xsl:when>
+				<xsl:otherwise>0</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		
+		
+		
+			<xsl:variable name="w">
+				<xsl:choose>
+					<xsl:when test="not(exslt:node-set($content)/package or exslt:node-set($content)/collection) and parent::package">
+						<!-- no content, shown as placeholder. Use nested package-detail width --> 
+						<xsl:value-of select="$subpkgFixedWidth"/>
+					</xsl:when>
+					<xsl:when test="not(exslt:node-set($content)/package or exslt:node-set($content)/collection)">
+						<!-- no content, shown as placeholder. Use package-detail width --> 
+						<xsl:value-of select="$pkgFixedWidth"/>
+					</xsl:when>
+					<xsl:when test="exslt:node-set($content)/package and exslt:node-set($content)/collection">
+						<!-- sum of all packages, plus space between them + sum of each set of collections in a row w/padding around those-->
+						<xsl:call-template name="sum-list">
+							<xsl:with-param name="list">
+								<xsl:value-of select="concat(sum(exslt:node-set($content)/package/@width) + $groupDx * (count(exslt:node-set($content)/package) - 1),' ')"/>
+								<xsl:apply-templates mode="effective-width" select="exslt:node-set($content)/collection[not(following-sibling::*[self::collection or self::package]) or name(following-sibling::*[self::collection or self::package])='package']">
+									<xsl:with-param name="levels" select="$levels0"/>
+								</xsl:apply-templates>
+							</xsl:with-param>
+						</xsl:call-template>
+					</xsl:when>
+					<xsl:when test="/SystemDefinition[@detail-type='fixed' and @detail='package'] and exslt:node-set($content)/package">
+						<!-- pkg detail, so don't take collections into account. Just show at width of nested pkgs + padding -->
+						<xsl:value-of select="sum(exslt:node-set($content)/package/@width) + $groupDx * (count(exslt:node-set($content)/package) - 1)"/>
+					</xsl:when>
+					<xsl:when test="/SystemDefinition[@detail-type='fixed' and @detail='package'] and (parent::layer or parent::systemModel)">
+						<!-- fixed detail. Use package-detail width --> 
+						<xsl:value-of select="$pkgFixedWidth"/>
+					</xsl:when>
+					<xsl:when test="/SystemDefinition[@detail-type='fixed' and @detail='package']">
+						<!-- fixed detail. Use nested package-detail width --> 
+						<xsl:value-of select="$subpkgFixedWidth"/>
+					</xsl:when>
+					<xsl:when test="parent::package">
+						<!-- small nested pkg, use min width of twice smallest possible collection -->
+						<xsl:value-of select="$max-width"/>
+					</xsl:when>
+					<xsl:when test="exslt:node-set($content)/package and exslt:node-set($content)/collection and not(exslt:node-set($content)/collection[name(following-sibling::*[1])='collection'])">
+						<!-- easy case, all in a line, no two collections next to each other -->
+							<xsl:value-of select="sum(exslt:node-set($content)/*[self::package or self::collection]/@width) + $groupDx * (count(exslt:node-set($content)/*[self::package or self::collection]) - 1)"/>
+					</xsl:when>
+					<xsl:when test="exslt:node-set($content)/package">
+						<!-- sum of all contained packages only-->
+							<xsl:value-of select="sum(exslt:node-set($content)/package/@width) + $groupDx * (count(exslt:node-set($content)/package) - 1)"/>
+					</xsl:when>
+					<xsl:otherwise>
+						<!-- use width of widest level -->
+						<xsl:value-of select="$max-width"/>
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:variable>
+				<!-- this has to be done in a variable since xalan won't let the node-sets be generated inside an attribute -->
+				
+		<xsl:variable name="ext-w" select="count(ancestor::SystemDefinition[@levels='expand'])*$levelExpandName"/>
+			<xsl:attribute name="width">
+				<xsl:choose>
+					<xsl:when test="parent::package and $w + $expand-width &lt; $subpkgMinWidth">	<!-- small nested pkg, use width of  3 components -->
+						<xsl:value-of select="$subpkgMinWidth + $ext-w + pkgAuxWidth"/>
+					</xsl:when>
+					<xsl:when test="$w + $expand-width  &lt; $pkgMinWidth">	<!-- small pkg, use width of twice smallest possible collection -->
+						<xsl:value-of select="$pkgMinWidth + $ext-w + $pkgAuxWidth "/>
+					</xsl:when>
+					<xsl:otherwise><xsl:value-of select="$w + $expand-width + $ext-w + $pkgAuxWidth"/></xsl:otherwise>
+				</xsl:choose>
+			</xsl:attribute>
+			<xsl:attribute name="height"><xsl:value-of select="$h"/></xsl:attribute>
+			
+	
+			<meta rel="model-levels"><xsl:copy-of select="$levels"/></meta>
+		
+			<xsl:copy-of select="$content"/>
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="collection" mode="sizing">
+	<xsl:variable name="content">
+		<xsl:apply-templates select="node()" mode="sizing"/>
+	</xsl:variable>
+	<!-- if there's no content, only show if forced to by placeholder-detail -->
+	<xsl:if test="/SystemDefinition[@placeholder-detail='component' or @placeholder-detail='collection'] 
+		or exslt:node-set($content)/component">  
+		<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+			<xsl:variable name="w" select="sum(exslt:node-set($content)/component/@width)"/>
+			<xsl:attribute name="width">	
+				<xsl:choose>
+					<!-- a collection might be a sibling to a pkg, so it will take up some space at pkag level of detail -->
+					<xsl:when test="$w &lt; $mMinWidth or /SystemDefinition[(@detail='collection' or @detail='package') and @detail-type='fixed']">
+						<xsl:value-of select="$mMinWidth"/>
+					</xsl:when>	
+					<xsl:otherwise><xsl:value-of select="$w"/></xsl:otherwise>
+				</xsl:choose>
+			</xsl:attribute>		
+			<xsl:attribute name="height"><xsl:value-of select="$mHeight"/></xsl:attribute>		
+			<xsl:copy-of select="$content"/>
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="component" mode="sizing">
+	<xsl:copy><xsl:apply-templates mode="copy-attr" select="@*"/>
+		<xsl:attribute name="width"><xsl:value-of select="$cSize"/></xsl:attribute>
+		<xsl:attribute name="height"><xsl:value-of select="$cSize"/></xsl:attribute>
+		<xsl:apply-templates select="node()" mode="sizing"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="package/package/package" priority="9" mode="sizing"> <!-- ignore 3+ level depth packages -->
+	<xsl:apply-templates mode="sizing"/>
+</xsl:template>
+
+<!-- stuff for dealing with levels -->
+
+<xsl:template match="*" mode="levels" priority="-8"><level/>
+	<!-- Should not be able to get here. Panic -->
+<xsl:message terminate="yes">
+<xsl:value-of select="concat(name(), ' ',@id,': ',@levels)"/> (<xsl:value-of select="*/@level | */*/@level"/>)
+</xsl:message>
+</xsl:template>
+
+
+<xsl:template match="package[not(@levels)] |layer[not(@levels)]" mode="levels" priority="-1">
+	<!-- no levels, so everything must be on same nameless level (barring exceptions below) -->
+	<level/>
+</xsl:template>
+
+
+<xsl:template match="layer[@levels]/package/package" mode="levels" priority="1">
+<!-- a nested package with levels defined in the layer  -->
+	<xsl:call-template name="levels-list">
+		<xsl:with-param name="levels" select="normalize-space(../../@levels)"/>
+	</xsl:call-template>
+	<xsl:if test="descendant::collection[not(contains(concat(' ',normalize-space(current()/../../@levels),' '),@level)) or not(@level)]">
+		<!--<xsl:call-template name="Caller-Warning">
+			<xsl:with-param name="text">collection without valid level in package <xsl:value-of select="@id"/></xsl:with-param>
+		</xsl:call-template>-->	
+		<level/>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="layer/package/package[@levels]" mode="levels" priority="1">
+<!-- a nested package with levels defined in the layer  -->
+	<xsl:call-template name="levels-list">
+		<xsl:with-param name="levels" select="normalize-space(@levels)"/>
+	</xsl:call-template>
+	<xsl:if test="descendant::collection[not(contains(concat(' ',normalize-space(current()/@levels),' '),@level)) or not(@level)]">
+		<!--<xsl:call-template name="Caller-Warning">
+			<xsl:with-param name="text">collection without valid level in package <xsl:value-of select="@id"/></xsl:with-param>
+		</xsl:call-template>-->	
+		<level/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="layer/package[@levels]/package" mode="levels" priority="1">
+	<!-- a package with levels and a nested pkg  -->
+	<xsl:call-template name="levels-list">
+		<xsl:with-param name="levels" select="normalize-space(../@levels)"/>
+	</xsl:call-template>
+	<xsl:if test="descendant::collection[not(contains(concat(' ',normalize-space(current()/../@levels),' '),@level)) or not(@level)]">
+		<!--<xsl:call-template name="Caller-Warning">
+			<xsl:with-param name="text">collection without valid level in package <xsl:value-of select="@id"/></xsl:with-param>
+		</xsl:call-template>-->	
+		<level/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="layer[@levels]/package[not(@levels|@level)]" mode="levels">
+	<!-- pkg with levels defined in the layer, and spans whole set of layer levels-->
+	<xsl:call-template name="levels-list">
+		<xsl:with-param name="levels" select="normalize-space(../@levels)"/>
+	</xsl:call-template>
+	<xsl:if test="descendant::collection[not(contains(concat(' ',normalize-space(current()/../@levels),' '),@level)) or not(@level)]">
+		<!--<xsl:call-template name="Caller-Warning">
+			<xsl:with-param name="text">collection without valid level in package <xsl:value-of select="@id"/></xsl:with-param>
+		</xsl:call-template>-->	
+		<level/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="layer[@levels]/package[not(@levels) and @level]" mode="levels">
+	<!-- pkg with levels defined in the layer, but at a range of levels -->
+	<xsl:variable name="span" select="sum(@span) + 1 - count(@span)"/> <!-- easier than having a <choose> -->
+	<xsl:variable name="list">
+		<xsl:call-template name="levels-list">
+			<xsl:with-param name="levels" select="normalize-space(../@levels)"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="match" select="exslt:node-set($list)/level[@name=current()/@level]"/> <!-- the ending level of the span -->
+	
+	<xsl:choose>
+		<xsl:when test="not($match)">
+			<!--<xsl:call-template name="Caller-Warning">
+				<xsl:with-param name="text">collection without valid level in package <xsl:value-of select="@id"/></xsl:with-param>
+			</xsl:call-template>-->	
+			<xsl:copy-of select="exslt:node-set($list)/level[position() &gt; last() - $span + 1]"/> <!-- want last $span-1 levels from this list -->
+			<level/> <!-- extra unnamed level -->
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:copy-of select="$match | $match/preceding-sibling::level[position() &lt; $span]"/> <!-- previous $span - 1 siblings -->
+		</xsl:otherwise>	
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="package[not(@levels) and not(descendant::collection/@level)]" mode="levels" priority="1">
+	<!-- no levels on the package, and none used by any collections => just one level in pkg -->
+	<level/>
+</xsl:template>
+
+<xsl:template match="layer/package[@levels]|SystemDefinition/package[@levels]" mode="levels">
+	<!-- a package with levels  -->
+	<xsl:call-template name="levels-list"/>
+	<xsl:if test="descendant::collection[not(contains(concat(' ',normalize-space(current()/@levels),' '),@level)) or not(@level)]">
+		<!--<xsl:call-template name="Caller-Warning">
+			<xsl:with-param name="text">collection without valid level in package <xsl:value-of select="@id"/></xsl:with-param>
+		</xsl:call-template>-->	
+		<level/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="layer[@levels]" mode="levels">
+	<xsl:call-template name="levels-list"/>
+	<xsl:if test="package[not(contains(concat(' ',normalize-space(current()/@levels),' '),@level)) and @level]">
+		<!--<xsl:call-template name="Caller-Warning">
+			<xsl:with-param name="text">package without valid level in layer <xsl:value-of select="@id"/></xsl:with-param>
+		</xsl:call-template>-->	
+		<level/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="layer[not(@levels) and package/@level]" mode="levels">
+	<xsl:call-template name="Caller-Warning">
+		<xsl:with-param name="text">layer <xsl:value-of select="@id"/> has no levels, but contains package <xsl:value-of select="package[@level]/@id"/> with defined level</xsl:with-param>
+	</xsl:call-template>
+	<!-- this is an error case, well... more of a warning case. Easy to handle with one fake level -->
+	<level/>
+</xsl:template>
+
+<xsl:template name="levels-list"><xsl:param name="levels" select="normalize-space(@levels)"/>
+	<xsl:choose>
+		<xsl:when test="contains($levels,' ')">
+			<level name="{substring-before($levels,' ')}"/>
+			<xsl:call-template name="levels-list">
+				<xsl:with-param name="levels" select="substring-after($levels,' ')"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise><level name="{$levels}"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- widths of the collections in the levels that are in $item -->  
+<xsl:template name="levels-widths"><xsl:param name="levels"/><xsl:param name="items" select="collection"/>
+	<xsl:for-each select="exslt:node-set($levels)/*">
+		<xsl:copy><xsl:copy-of select="@*"/>
+			<xsl:attribute name="width">
+				<xsl:variable name="match" select="$items[@level=current()/@name or (not(@level)  and not(current()/@name)) ]"/>
+				<xsl:choose>
+					<xsl:when test="$match">
+						<xsl:variable name="w"  select="sum($match/@width)"/>
+						<xsl:value-of select="$w +  (count($match) - 1) * $groupDx"/>
+					</xsl:when>
+					<xsl:otherwise>0</xsl:otherwise>
+				</xsl:choose>
+			</xsl:attribute>
+		</xsl:copy>
+	</xsl:for-each>
+</xsl:template>
+
+<!-- add 2d sizes for each level contained in $item -->  
+<xsl:template name="levels-size"><xsl:param name="levels"/><xsl:param name="items" select="package"/>
+	<xsl:apply-templates select="$items[1]" mode="levels-size">
+		<xsl:with-param name="levels" select="$levels"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template mode="levels-size-step" match="package">
+	<xsl:param name="levels"/> <!-- the set of levels -->
+	<xsl:variable name="pkg" select="."/>
+	<xsl:variable name="named" select="$levels[@name=current()/@level] or not(@level)"/>
+	<!-- it's this level, or it spans all by not having any level defined, or by being in the span range for level  or it's the unnamed error level-->
+	<xsl:variable name="match" select="$levels[@name=$pkg/@level  or not($pkg/@level)  or ($pkg/@span and following-sibling::level[position() &lt; $pkg/@span][@name=$pkg/@level or (not(@name) and not($named))]) or (not($named) and not(@name))]"/>
+
+
+	<xsl:variable name="max-width"> <!-- the width of the widest level this spans (ie the x-pos of this pkg) -->
+		<xsl:for-each select="$match[@width]">
+			<xsl:sort select="@width" order="descending" data-type="number"/>
+			<xsl:if test="position()=1"><xsl:value-of select="@width"/></xsl:if>
+		</xsl:for-each>
+	</xsl:variable>
+
+
+	
+	<xsl:variable name="h" select="(sum($match/@height) + $groupDy * (count($match/@height) - 1))"/> <!--height of all levels spanned by this, may be negative if no match -->
+
+	<xsl:for-each select="$levels">
+		<xsl:copy><xsl:copy-of select="@*[name()!='width' and name()!='height'  and name()!='min-height']"/>
+			<xsl:choose>
+				<xsl:when test="not($match[@name=current()/@name or (not(@name) and not(current()/@name))])">
+					<!--  the package does not impact this level, just copy existing attributes -->
+					<xsl:copy-of select="@width|@height|@min-height"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:attribute name="width">
+						<!-- current level is added to by this pkg -->
+						<xsl:choose>
+							<xsl:when test="$max-width='' or $max-width=0">
+								<!-- at the current level, but not adding to anything-->
+								<xsl:value-of select="$pkg/@width"/>
+							</xsl:when>
+							<xsl:otherwise>
+								<!--  at the current level, but adding after something -->
+								<xsl:value-of select="$pkg/@width + $groupDx + $max-width"/>		
+							</xsl:otherwise>
+						</xsl:choose>
+					</xsl:attribute>					
+					<xsl:choose>
+						<xsl:when test="count($match)=1 and (not(@height) or (@height &lt; $pkg/@height))">
+							<!-- pkg too tall, make just this single level bigger -->
+							<xsl:copy-of select="$pkg/@height"/>
+							<xsl:attribute name="min-height"><xsl:value-of select="$pkg/@height"/></xsl:attribute> <!-- level cannot be smaller than this -->
+						</xsl:when>
+						<xsl:when test="count($match)=1">
+							<!-- level is bigger then the pkg, so keep height as is -->
+							<xsl:copy-of select="@height|@min-height"/>
+						</xsl:when>
+						<xsl:when test="not($pkg/@levels) and $pkg/meta[@rel='model-levels']/level[@name=current()/@name or (not(@name) and not(current()/@name))]">
+							<!-- there is a collection at this level, so note that height -->
+							<xsl:choose>
+								<xsl:when test="not(@height) or @height &lt; $mHeight">
+									<xsl:attribute name="height"><xsl:value-of select="$mHeight"/></xsl:attribute>
+									<xsl:attribute name="min-height"><xsl:value-of select="$mHeight"/></xsl:attribute>
+								</xsl:when>							
+								<xsl:otherwise>
+									<xsl:copy-of select="@height|@min-height"/>
+								</xsl:otherwise>
+							</xsl:choose>
+						</xsl:when>		
+						<xsl:otherwise><xsl:copy-of select="@height|@min-height"/></xsl:otherwise>			
+					</xsl:choose>
+				</xsl:otherwise>
+			</xsl:choose>
+			<xsl:copy-of select="*"/>
+			<xsl:if test="@name=$pkg/@level or (not($named) and not(@name)) or not($pkg/@level) and not(following-sibling::level)">
+				<xsl:variable name="base">
+					<xsl:for-each select="$match[@width]">
+						<xsl:sort select="@width" order="descending" data-type="number"/>
+						<xsl:if test="position()=1"><xsl:value-of select="@width"/></xsl:if>
+					</xsl:for-each>
+				</xsl:variable>
+				<xsl:variable name="x">
+					<xsl:choose>
+						<xsl:when test="$base=''">
+							<xsl:value-of select="$groupDx *count(@width)"/>
+						</xsl:when>
+						<xsl:otherwise>
+							<xsl:value-of select="$base +  $groupDx *count(@width)"/>		
+						</xsl:otherwise>
+					</xsl:choose>
+				</xsl:variable>
+				<step ref="{$pkg/@id}" x="{$x}"/>
+			</xsl:if>
+		</xsl:copy>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template mode="levels-size" match="package"><xsl:param name="levels"/>
+	<xsl:apply-templates select="following-sibling::package[1]" mode="levels-size">
+		<xsl:with-param name="levels">
+			<xsl:apply-templates mode="levels-size-step" select="current()">
+				<xsl:with-param name="levels" select="exslt:node-set($levels)/*"/>
+			</xsl:apply-templates>
+		</xsl:with-param>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template mode="levels-size" match="package[not(following-sibling::package)]"><xsl:param name="levels"/>
+	<xsl:apply-templates mode="levels-size-step" select=".">
+		<xsl:with-param name="levels" select="exslt:node-set($levels)/*"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+
+<!-- /levels -->
+
+<!-- fix attributes -->
+<xsl:template mode="copy-attr" match="@*"><xsl:copy-of select="."/></xsl:template>
+
+<xsl:template mode="copy-attr" match="collection/@level" priority="2">
+		<xsl:choose><!-- remove invalid level attribute -->
+			<!-- easier to read and write as two entries rather than one long one -->
+			<xsl:when test="ancestor::package[@levels] and contains(concat(' ',normalize-space(ancestor::package/@levels),' '),concat(' ',.,' '))">
+				<xsl:copy-of select="."/>
+			</xsl:when>
+			<xsl:when test="not(ancestor::package[@levels]) and ancestor::layer[@levels] and contains(concat(' ',normalize-space(ancestor::layer/@levels),' '),concat(' ',.,' '))">
+				<xsl:copy-of select="."/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">collection <xsl:value-of select="../@id"/> with invalid level "<xsl:value-of select="."/>"</xsl:with-param>
+				</xsl:call-template>				
+			</xsl:otherwise>
+		</xsl:choose>
+</xsl:template>
+
+<xsl:template mode="copy-attr" match="layer/package/@level" priority="2">
+		<xsl:choose><!--set to empty invalid level attribute -->
+			<!-- easier to read and write as two entries rather than one long one -->
+			<xsl:when test="not(../../@levels)">
+				<xsl:call-template name="Caller-Warning">
+					<xsl:with-param name="text">package <xsl:value-of select="../@id"/> cannot have level "<xsl:value-of select="."/>" if none defined in layer <xsl:value-of select="../@id"/></xsl:with-param>
+				</xsl:call-template>				
+			</xsl:when>
+			<xsl:when test="contains(concat(' ',normalize-space(../../@levels),' '),concat(' ',.,' '))">
+				<xsl:copy-of select="."/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:call-template name="Caller-Warning">
+					<xsl:with-param name="text">package <xsl:value-of select="../@id"/> with invalid level "<xsl:value-of select="."/>"</xsl:with-param>
+				</xsl:call-template>
+				<xsl:attribute name="level">*</xsl:attribute>				
+			</xsl:otherwise>
+		</xsl:choose>
+</xsl:template>
+
+<xsl:template mode="copy-attr" match="layer/@span[.=0]" priority="2"/> <!-- default value, easier to remove -->
+
+<xsl:template mode="copy-attr" match="package/@span[.=1]" priority="2"/> <!-- default value, easier to remove -->
+
+
+<!-- remove empty items, unless specifically told to include -->
+
+<xsl:template match="component[not(unit) and @filtered and not(/SystemDefinition/@placeholder-detail='component')]" mode="sizing" priority="3"/>
+<xsl:template match="collection[not(component) and @filtered and not(/SystemDefinition[@placeholder-detail='component' or @placeholder-detail='collection'])]" mode="sizing"/>
+<xsl:template match="package[not(collection or package) and @filtered and not(/SystemDefinition[@placeholder-detail!='layer'])]" mode="sizing"/>
+<xsl:template match="layer[not(package) and @filtered and not(/SystemDefinition[@placeholder-detail='layer'])]" mode="sizing"/>
+
+
+
+
+<xsl:template match="layer-group" mode="right-border">
+	<xsl:variable name="d"><xsl:apply-templates select="." mode="depth"/></xsl:variable>
+	<xsl:value-of select="$d * $lgrpDx"/>
+</xsl:template>
+
+<xsl:template match="layer-group" mode="depth">
+	<xsl:variable name="d">
+		<xsl:call-template name="max-from-list">
+			<xsl:with-param name="list">
+				<xsl:text>0 </xsl:text>
+				<xsl:for-each select="layer-group">
+					<xsl:apply-templates select="." mode="depth"/><xsl:text> </xsl:text>
+				</xsl:for-each>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:value-of select="$d + 1"/>
+</xsl:template>
+
+
+<xsl:template match="layer-group" mode="left-border">
+	<xsl:variable name="child-border">
+		<xsl:call-template name="max-from-list">
+			<xsl:with-param name="list">
+				<xsl:text>0 </xsl:text>
+				<xsl:for-each select="layer-group">
+					<xsl:apply-templates select="." mode="left-border"/><xsl:text> </xsl:text>
+				</xsl:for-each>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="@label"><xsl:value-of select="$child-border + $lgrpLabelDx"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$child-border + 0.75 * $lgrpDx"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!-- ====== legend ============= -->
+
+<xsl:include href="legend-module.xsl"/>
+<!-- end legend -->
+
+
+<!-- ============ utilities ============ -->
+
+<xsl:template name="sum-list"><xsl:param name="list"/> <!--  space-separated and terminated -->
+	<xsl:variable name="cur" select="substring-before($list,' ')"/>
+	<xsl:variable name="next" select="substring-after($list,' ')"/>
+	<xsl:variable name="add"><xsl:choose>
+		<xsl:when test="$next=''">0</xsl:when>
+		<xsl:otherwise><xsl:call-template name="sum-list">
+			<xsl:with-param name="list" select="$next"/>
+		</xsl:call-template></xsl:otherwise>
+	</xsl:choose></xsl:variable>
+	<xsl:value-of select="$cur + $add"/>
+</xsl:template>
+
+
+<xsl:template name="max-from-list"><xsl:param name="list"/>
+	<xsl:variable name="cur" select="substring-before($list,' ')"/>
+	<xsl:variable name="next" select="substring-after($list,' ')"/>
+	<xsl:variable name="max"><xsl:choose>
+		<xsl:when test="$next=''">0</xsl:when>
+		<xsl:otherwise><xsl:call-template name="max-from-list">
+			<xsl:with-param name="list" select="$next"/>
+		</xsl:call-template></xsl:otherwise>
+	</xsl:choose></xsl:variable>
+	<xsl:choose>
+		<xsl:when test="$cur &gt; $max"><xsl:value-of select="$cur"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$max"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/draw.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,1722 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/2000/svg"  xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:exslt="http://exslt.org/common" xmlns:m="http://exslt.org/math" exclude-result-prefixes="s m exslt" >
+	<xsl:output method="xml" cdata-section-elements="script s:script" indent="yes"/>
+	<xsl:param name="Run"/> 
+		<!-- Selects the run mode, by default it will draw the model from the given layout data. The output is an SVG diagram. 
+		There are two other options:
+				"calc" - Indicates that it should just do all 1st-pass calculations and generate a model with those embedded. The generated XML output is non-standard and has a fragile syntax that cannot be relied upon.
+				"draw" - Draw the model from a pre-caculated result. The output is an SVG diagram. This will fail if run on raw layout data.  
+			The run mode options are mostly useful for debugging, though they can also be used for drawing a model
+			in low-memory or very large model situations. In the normal mode, the 1st pass is saved in memory before drawing. 
+			Saving to disk instead could greatly reduce the run-time memory usage.	-->
+		
+	<xsl:param name="Use-as-name" select="'name'"/> <!-- The attribute to use as the item name. Falls back to 'name' -->
+	  <xsl:key name="lgrp-bottom" match="layer-group" use="@from"/>
+	  <xsl:key name="lgrp-top" match="layer-group" use="@to"/>
+
+
+	<xsl:variable name="large-width" select="500"/> <!-- cutoff width to be considered a wide model and thus need larger title size -->
+
+<xsl:variable name="Versions">
+	<xsl:choose>
+		<xsl:when test="/SystemDefinition/*/meta[@rel='version-list']">
+			<xsl:copy-of select="/SystemDefinition/*/meta[@rel='version-list']"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<v>ER5</v><v>ER5U</v>
+			<v>6.0</v> <v>6.1</v> <v>6.2</v>
+			 <v>7.0</v> <v>7.0s</v>
+			 <v>8.0</v> <v>8.0a 8.0b</v><v>8.1 8.1a 8.1b</v>
+			 <v>9.0</v> <v>9.1</v> <v>9.2</v> <v>9.3</v> 
+			 <v>9.4 ^1</v><v>tb91 ^2</v> <v>tb92 9.5 ^3</v> <v>tb101 9.6 ^4</v> 
+			 <v>^5</v> <v>^6</v> <v>^7</v> <v>^8</v> <v>^9</v> <v>^10</v>
+			 <v>Future</v>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:variable>
+
+<xsl:template match="/SystemDefinition" priority="2">
+	<!-- see above for Run usage -->
+	<xsl:choose>
+		<xsl:when test="$Run = 'calc' ">
+			<!-- just do 1st pass calculations like sizing and legend generation -->
+			<xsl:apply-templates select="." mode="sizing"/>
+		</xsl:when>
+		<xsl:when test="$Run = 'draw' ">
+			<!-- draw from pre-calculated data -->
+			<xsl:apply-templates select="." mode="draw"/>
+		</xsl:when>
+		<xsl:otherwise> <!-- the normal case, run w/1st pass for sizing, then draw --> 
+			<xsl:variable name="sysdef">
+				<xsl:apply-templates select="." mode="sizing"/>
+			</xsl:variable>
+			<xsl:apply-templates select="exslt:node-set($sysdef)/SystemDefinition" mode="draw"/>
+		</xsl:otherwise>		
+	</xsl:choose>
+</xsl:template>
+
+
+
+<xsl:template match="SystemDefinition" mode="draw">
+	<xsl:if test="@resolution"><xsl:processing-instruction name="AdobeSVGViewer">resolution="<xsl:value-of select="@resolution"/>"</xsl:processing-instruction></xsl:if>
+	<!-- groupDy padding around whole thing -->
+	<svg version="1.1" onload="wrapalltext()" viewBox="{-$groupDy} {-$groupDy} {@width + $groupDy} {@height  + 2* $groupDy}">
+		<xsl:attribute name="class">
+			<xsl:if test="not(@detail)">component</xsl:if>
+			<xsl:value-of select="@detail"/>
+			<xsl:if test="@detail-type">-<xsl:value-of select="@detail-type"/></xsl:if>
+		</xsl:attribute>
+		<xsl:copy-of select="@xml:lang"/> <!-- localized language -->
+		<xsl:if test="not(@static='true') and (@navctrl or */meta/legend/@float)">
+			<xsl:attribute name="onscroll">resized()</xsl:attribute>
+			<xsl:attribute name="onzoom">resized()</xsl:attribute>
+			<xsl:attribute name="onresize">resized()</xsl:attribute>
+		</xsl:if>		
+		<xsl:apply-templates select="." mode="title"/>
+
+	<defs>
+
+    <style type="text/css">
+    text.layer, text.package, text.collection, text.component,
+    text.cbox, text.lgrp, text.label, text.lgd {
+		fill:black;
+		font-family: <xsl:call-template name="default-font"/>;
+    }
+    text.title {
+		fill:red;
+		font-weight: bold;
+		font-size: <xsl:call-template name="title-line-height"/>px;	
+		font-family: <xsl:call-template name="default-font"/>;
+    }    
+    text.component {		
+		font-size: 1.940px;  /*  5.5pt  */
+		font-weight: bold;
+	}
+ 	text.lgd, 
+	text.layer, text.package {
+		font-size: 4.233px;  /*  12pt  */
+		font-weight: bold;
+	}
+	text.label {		
+		font-size: 1.940px;  /*  5.5pt  */
+		font-weight: bold
+	}
+	 text.level {
+		font-style: italic;
+		fill: blue;
+	}
+	g.layer text.level {		
+		font-size: 7.055px;  /*  20pt  */
+		font-style: italic;
+		fill: red;
+	}
+	g.package text.level {		
+		font-size: 4.233px;  /*  12pt  */
+	}
+	g.nested text.level {		
+		font-size: 3.175px;  /*  8pt  */
+	}
+	
+	text.cbox {		
+		font-size: 1.411px;  /*  4pt  */
+		font-weight: bold
+	}
+	text.lgrp {
+		font-size: 12.699px;  /*  36pt  */
+		font-weight: normal;
+	}
+<!-- package font sizes: larger if there is no displayed children -->
+g.placeholder text.package,
+svg.package text.package,
+svg.package-fixed text.package {
+		font-size: 11.288px;  /*  32pt  */
+		font-weight: normal;
+	}
+
+
+<!-- subpackage font sizes -->
+	g.nested text.package {
+		font-size: 2.822px;  /*  8pt  */
+	}
+	
+	svg.collection g.nested text.package,
+	svg.collection-fixed g.nested text.package  {
+		font-size: 4.233px;  /*  12pt  */
+	}
+	
+	svg.package g.nested text.package,
+	svg.package-fixed g.nested text.package  {
+		font-size: 7.055px;  /*  20pt  */
+	}
+<!-- collection font sizes -->
+	text.collection {
+		font-size: 2.469px;  /*  7pt  */
+	}
+	
+	g.placeholder text.collection,
+	svg.collection text.collection,
+	svg.collection-fixed text.collection  {
+		font-size: 3.7035px;  /*  10.5pt  */
+	} 
+<!-- borders -->
+	/* thin border */
+	rect.legend, rect.collection, rect.cbox {
+		stroke-width: 0.0882px;  /*  0.25pt  */
+		stroke: black
+	}
+	/* thick border */
+	rect.layer, rect.package  {
+		stroke-width: 0.2469px;  /*  0.7pt  */
+		stroke: black
+	}
+	rect.layer {
+		fill: #e6e6e6
+	}
+	rect.package {
+		fill: #b3b3b3
+	}
+	g.nested rect.package {
+		fill: #e6e6e6
+	}
+	rect.collection {
+		fill: white
+	}
+	rect.legend {
+		fill: white
+	}
+	<!-- opera does not support <style media="print">, so must use @media instead -->
+	 @media print {
+		#Zoom {visibility: hidden}
+	  }
+ </style>	
+ 		<xsl:apply-templates select="." mode="shapes"/>
+ 
+	</defs>
+
+<script type="text/ecmascript"> 
+<!-- for creating / finding elements by namespace -->
+var svgns="http://www.w3.org/2000/svg";
+
+<xsl:call-template name="script-wrapping"/>
+<xsl:call-template name="script-popups"/> <!-- dependencies use this and they override @static -->
+<xsl:if test="not(@static='true')">
+	<xsl:if test="@navctrl">
+		<xsl:call-template name="script-navcontrol"/>
+	</xsl:if>
+function resized()
+		{
+		var viewbox = document.documentElement.getAttribute("viewBox").split(' ');
+ 		var x = Number(viewbox[0]);
+ 		var y = Number(viewbox[1]);
+ 		var width = Number(viewbox[2]);
+ 		var height = Number(viewbox[3]);
+ 		if( window.innerWidth==0 || window.innerHeight ==0 || height ==0) {return}
+ 		var s = width  / window.innerWidth;
+ 		if ( width / height &lt; window.innerWidth / window.innerHeight)
+ 			{
+			s = height  / window.innerHeight;
+			width = window.innerWidth * s;
+			}
+		else	
+			{
+ 			height = window.innerHeight * s;
+ 			}
+<xsl:if test="@navctrl">
+		var e = document.getElementById('Zoom');
+		var trans = 'translate(';
+		trans+= x - 0.5* (width - viewbox[2]) + ( -document.rootElement.currentTranslate.x ) * s  / document.rootElement.currentScale ;
+		trans+=' ';
+		trans+= y - 0.5* (height - viewbox[3]) + ( -document.rootElement.currentTranslate.y ) * s  / document.rootElement.currentScale ;
+		trans+=') scale(';
+		trans+=  (height / window.innerHeight) *3.2 / document.rootElement.currentScale;
+		trans+=')';
+		e.setAttribute('transform',trans);
+</xsl:if>
+<xsl:if test="*/meta/legend/@float">
+		e = document.getElementById('legend-display');
+		var ctrl = document.getElementById('legend-ctrl');
+		var wBox = Number(ctrl.getAttribute('width'));
+		scale = (width / window.innerWidth)  * (window.innerWidth / ( wBox+3)) / document.rootElement.currentScale;
+		trans = 'translate(';
+		trans+= x + (1.5 *scale )  -0.5* (width - viewbox[2]) + ( -document.rootElement.currentTranslate.x ) * s  / document.rootElement.currentScale ;
+		trans+=' ';
+		trans+= y -(14.3 +0.3)* scale - 0.5* (height - viewbox[3] ) + ( -document.rootElement.currentTranslate.y ) * s  / document.rootElement.currentScale 
+		+ height   / document.rootElement.currentScale
+		trans+=') scale(';
+		trans+=  scale;
+		trans+=')';
+		e.setAttribute('transform',trans);</xsl:if>		
+ 		}
+	<xsl:if test="*/meta/legend/@float">
+		<xsl:call-template name="script-float-legend"/>
+	</xsl:if>
+</xsl:if>
+</script>
+	<xsl:variable name="model-bottom">
+		<!-- The y-location of the bottom of the model itself -->
+		<xsl:for-each select="*[1]"> <!-- should only be one child -->
+			<xsl:choose>
+				<xsl:when test="meta[@rel='model-logo']/@height and (meta[@rel='model-logo']/@height &gt;meta[@rel='model-legend']/@height or not(meta[@rel='model-legend']))">
+					<xsl:value-of select="../@height - sum (meta[@rel='model-footer' or @rel='model-logo']/@height) "/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:value-of select="../@height - sum (meta[@rel='model-footer' or @rel='model-legend']/@height) "/>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:for-each>
+	</xsl:variable>
+	
+	<!-- these meta go under the model -->
+	<xsl:apply-templates select="*/meta[not(starts-with(@rel,'model-'))]" mode="global"/>
+	  
+	<xsl:apply-templates select="*"/>
+	
+	<!-- do these meta last so that it could obscure the model if it needs to -->
+		
+	<xsl:apply-templates select="*/meta[starts-with(@rel,'model-')]" mode="global">
+		<xsl:sort select="@rel"/>
+		<xsl:with-param name="bottom" select="$model-bottom"/> 
+	</xsl:apply-templates>
+	<xsl:if test="not(@static='true') and @navctrl">
+		<xsl:call-template name="navctrl"/>
+	</xsl:if>
+<!--
+<rect x="0" y="0" width="{@width}" height="{@height}" fill="none" stroke="black" stroke-width="1"/>
+<rect x="{@padding-left}" y="0" width="{@model-width}" height="{@model-height}" fill="none" stroke="black" stroke-width="1"/>
+<xsl:for-each select="meta[@rel='model-footer']">
+	<rect x="0" y="{../@height - @height}" width="{../@width}" height="{@height}" fill="none" stroke="green" stroke-width="1"/>
+</xsl:for-each>
+<xsl:for-each select="meta[@rel='model-logo']">
+	<rect x="0" y="{$model-bottom}" width="{@width}" height="{@height}" fill="none" stroke="green" stroke-width="1"/>
+</xsl:for-each>
+<xsl:for-each select="meta[@rel='model-legend']">
+	<rect x="{../@width - legend/@title-width * @scaled}" y="{$model-bottom}" width="{legend/@title-width * @scaled }" height="{legend/@title-height * @scaled}" fill="none" stroke="green" stroke-width="1"/>
+</xsl:for-each>
+-->
+	<xsl:apply-templates mode="validate"/>
+</svg>
+</xsl:template>
+
+<xsl:template match="systemModel">
+	<xsl:apply-templates select="*"/>
+</xsl:template>
+
+
+<xsl:template match="*" mode="filter"/> <!-- filters for all items -->
+<xsl:template match="*" mode="text-filter"/> <!-- fitler for just text -->
+
+
+<!-- scripts -->
+<xsl:template name="script-popups">
+<!-- for pop-ups which can only appear one at a time. 
+In general, one would want to use 
+	onmouseover="on('blah') onmouseout="off('blah')"
+for stuff which appears and disappears based on the position of the mouse (like dependency arrows)
+
+for stuff which appears based on a mouseover or button press, but does not 
+disappear until some other trigger (and only one can appear at a time), use one of:
+	onmouseover="on(clear('blah'))"
+	onclick="on(clear('blah'))"
+-->
+var curId = '';
+function clear(id) {
+	if(curId != '') off(curId);
+	return curId=id;
+}
+
+<!--  for showing and hiding : 
+	not used by default, but used by higher-detailed versions when Static is not set
+	also used by post-processed versions for showing pop-up data.-->
+function on(id) {
+	var cur =document.getElementById(id)
+	cur.setAttribute('visibility','visible');
+	<xsl:if test="not(@detail='component')"><!-- this is needed to wrap text which is initially hidden -->
+	if(!cur.hasAttribute('wrapenated')) {
+		cur.setAttribute('wrapenated','true');
+		wrapalltext(cur)
+	}
+	</xsl:if>
+	return cur;
+}
+
+function off(id) {
+	document.getElementById(id).setAttribute('visibility','hidden');
+}
+</xsl:template>
+
+
+<xsl:template name="script-wrapping">
+<!--  for wrapping: breaks text up into an array of words -->
+function splitup(txt) {
+	var a = new Array;
+	var t = txt;
+	var found		<!-- \u4e00-\ufa2 is the unicode range for kanjii, \u3041-\u309 is katakana and e\u30a1-\u30fe is hiragana-->
+	while((found = t.match(/(^[\u3041-\u309e\u30a1-\u30fe\u4e00-\ufa2d])([\u3041-\u309e\u30a1-\u30fe\u4e00-\ufa2d].*)$/))|| ( found = t.match(/^([^ \u200b\xad-]+[ \u200b\xad-]+)(.*)$/))) {
+			a.push(found[1]);
+			t=found[2];
+	}
+	a.push(t);
+	return a;
+}
+<!--  the remainder of the scripts also are for wrapping 
+
+Note that comments are kept to an absolute minimum inline since it's a waste of 
+	space in the generated file to duplicate the unused text 
+-->
+<![CDATA[
+function splitable(node) {
+ 	return node.firstChild.nodeType == 3 && node.firstChild.data.match(/[\t\n\r \u200b\xad-]/);
+}
+
+function crush(node, len) {
+	node.setAttribute('letter-spacing','-0.075em');
+	if( node.getComputedTextLength() > len) 
+		node.setAttribute('letter-spacing','-0.15em');
+}
+
+function whatSize(txt) { // convert a length into pixels
+	if(txt.match(/^[0-9.-]+$/)) return txt;
+	return;
+}
+
+
+function wrapalltext(node) {
+    if(!node) node= document;
+    var all = node.getElementsByTagNameNS(svgns,'text');
+    var i=0;
+    for (i=0; i<all.length; i++) {
+		var cur = all.item(i);
+		var w=0;
+		if (cur.hasAttribute('width')) {
+			w = whatSize(cur.getAttribute('width'));
+		}
+	if (w)	wraptext(cur,w)
+	}
+}
+
+
+function wraptext(cur,l) {
+	if(cur.firstChild.nodeType != 3)  return; // must be just a text node
+	if(cur.getBBox().width < l )  {
+		cur.firstChild.data = cur.firstChild.data.replace(/[\xad\u200b]/g,"");
+		return; // no need -- won't wrap
+	}
+	var t = cur.firstChild.data.replace(/\s+/," ");  // normalize all spaces
+	t = t.replace(/^ +/,"").replace(/ +$/,"");  // trim spaces
+	var words =splitup(t); 	// each word ends with the split character (if any)
+	if (words.length<2)  {
+		crush(cur, l);
+		return;
+	}
+	cur.removeChild(cur.firstChild)
+	var tspan = document.createElementNS(svgns,'tspan');
+	var first = tspan;	
+	cur.appendChild(tspan);
+	var txt = document.createTextNode(words[0]);
+	tspan.appendChild(txt);
+	tspan.setAttribute('x',cur.getAttribute('x'));	// Opera needs this
+	var nlines=1;
+	var zero =0;
+	for (i =1;i< words.length;i++) {
+		var was = txt.data;
+		txt.data+=words[i];
+		if (tspan.getComputedTextLength() -zero > l) { // if the line with this word at the end is bigger than the available space...
+			txt.data=was.replace(/ +$/,"").replace(/\xad(.)/,"$1").replace(/\u200b/g,""); // remove zero-width spaces and trailing spaces and soft hyphens
+			// if it's still too big then decrease the letter spacing
+			if( tspan.getComputedTextLength() > l ) crush(tspan,l);
+			tspan = document.createElementNS(svgns,'tspan');
+			tspan.setAttribute('dy',"1em");
+			nlines++;
+			tspan.setAttribute('x',cur.getAttribute('x'));
+			cur.appendChild(tspan);
+			txt = document.createTextNode('');
+			tspan.appendChild(txt);
+			zero = tspan.getComputedTextLength();
+			txt.data+=words[i];
+		}
+	}
+	txt.data=txt.data.replace(/ +$/,"").replace(/\xad(.)/,"$1").replace(/\u200b/g,""); // remove zero-width spaces and trailing spaces and soft hyphens
+	if( tspan.getComputedTextLength() > l ) 	crush(tspan,l);
+	var align =cur.getAttribute('dy');
+	if(align=='0.375em') {	// middle aligned
+		first.setAttribute('dy',((1-nlines ) / 2 + 0.375 )+"em");
+	}  else if(align=='0.75em' || align=='1em')  {  // top (or above) aligned
+		first.setAttribute('dy',align)	
+	}  else  { // bottom aligned (default)
+		first.setAttribute('dy',(1-nlines)+"em");
+	}
+}
+]]>
+  <!-- 
+  dominant-baseline is not widely supported, but should indicate the vertical alignment of the text
+  	mathematical = middle-aligned
+  	hanging = top-aligned
+  	ideographic = bottom aligned
+  Since they're not widely supported, using dy is used instead. 
+  Ideally we'd have
+	  top aligned: dy="1.5ex"
+	  middle aligned: dy="0.75ex"
+	  bottom aligned: dy="0ex"
+	  since in most fonts the top of the captial letters is about 0.5ex higher than the 
+	  	top of the lower case letters (1ex), hence 1.5ex for top-algined and half that for middle
+  However, you can't add the em-based offset of multiple lines to the ex-based alignment, 
+  	so we have to make the reasonably valid assumption that 1em = 2ex
+  Which gives us: 
+	  top aligned: dy="0.75em"
+	  middle aligned: dy="0.375em"
+	  bottom aligned: dy="0em"
+	Since this is supported is Firefox 3.5, ASV and Opera 9, it's a much better way to handle 
+		he alighment than using the dominant-baseline approach
+   -->
+</xsl:template>
+
+<xsl:template name="script-navcontrol">
+<!-- this should only be called on the SystemDefinition element -->
+var pandandzoom=null;
+function endpanning()
+        {
+        if(pandandzoom)
+	        {
+    	    window.clearInterval(pandandzoom)
+        	pandandzoom=null
+        	}
+        }
+
+function repeatpan(x,y)
+        {
+        endpanning()
+        panning(x,y)
+        pandandzoom = window.setInterval('panning('+x+','+y+')', 100);
+        }
+
+function panning(x,y)
+        {
+        document.rootElement.currentTranslate.x += x
+        document.rootElement.currentTranslate.y += y
+        }
+
+function repeatzoom(z)
+        {
+        endpanning()
+        zoom(z)
+        pandandzoom = window.setInterval('zoom('+z+')', 100);
+        }
+<![CDATA[
+function zoom(z)
+		{
+		var viewbox = document.documentElement.getAttribute("viewBox").split(' ');
+ 		var x = Number(viewbox[0]);
+ 		var y = Number(viewbox[1]);
+ 		var width = Number(viewbox[2]);
+ 		var height = Number(viewbox[3]);
+ 		if( window.innerWidth==0 || window.innerHeight ==0 || height ==0) {return}
+ 		var s = width  / window.innerWidth;
+ 		if ( width / height < window.innerWidth / window.innerHeight)
+ 			{
+			s = height  / window.innerHeight;
+			width = window.innerWidth * s;
+			}
+		else	
+			{
+ 			height = window.innerHeight * s;
+ 			}
+ 			
+ 		x = x - 0.5* (width - viewbox[2]) + ( -document.rootElement.currentTranslate.x ) * s  / document.rootElement.currentScale ;
+		y = y - 0.5* (height - viewbox[3]) + ( -document.rootElement.currentTranslate.y ) * s  / document.rootElement.currentScale ;
+		width = width / document.rootElement.currentScale;
+		height = height / document.rootElement.currentScale;
+        document.rootElement.currentTranslate.x=
+        	document.rootElement.currentTranslate.x *z - 0.5*window.innerWidth* (z -1 )
+        document.rootElement.currentTranslate.y=
+        	document.rootElement.currentTranslate.y *z - 0.5*window.innerHeight* (z -1 )
+        document.rootElement.currentScale*=z
+		}
+]]>
+</xsl:template>
+
+<xsl:template name="script-float-legend">
+function movelegend(id)
+	{
+	var parent = document.getElementById(id);
+	var legend = document.getElementById('legend-box');
+	parent.appendChild(legend);
+	}
+</xsl:template>
+
+<!-- well known patterns -->
+
+<xsl:template name="default-new-pattern">
+	<radialGradient id="Patternradial-grad"  gradientUnits="objectBoundingBox" cx="50%" cy="50%" r="70%">
+		<stop offset="0%" stop-color="white" stop-opacity="1"/>
+		<stop offset="100%" stop-opacity="0" stop-color="white" />
+	</radialGradient>
+</xsl:template>
+
+<xsl:template name="default-ref-pattern"> 	<!-- diagonal line pattern -->
+	<linearGradient id="Patternstriped-diag-up" spreadMethod="repeat" gradientUnits="userSpaceOnUse" x1="0" x2="3" y1="0" y2="3">
+		<stop offset="0%" stop-opacity="0" stop-color="white" />
+		<stop offset="20%" stop-color="#ccc" stop-opacity="1" />
+		<stop offset="40%" stop-opacity="0" stop-color="white" />
+		<stop offset="100%" stop-opacity="0" stop-color="white" />
+	</linearGradient>
+</xsl:template>
+
+<xsl:template name="default-X-pattern"> 	<!-- big dark X -->
+	<pattern id="Patternbig-X" patternUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%" viewBox="0 0 10 10">
+		<path d="M 1 1 L 9 9 M 1 9  L 9 1" stroke="#555" stroke-width="1.15" stroke-linecap="round"/>
+	</pattern> 
+</xsl:template>
+
+
+
+<xsl:template name="nav-control-patterns"> 	<!-- patterns needed for the naviagiton control -->
+    <radialGradient id="Patternoutgrad"  cx="50%" cy="50%" r="100%" fx="50%" fy="50%">
+       <stop offset="36%" stop-color="white" stop-opacity="0"/>
+       <stop offset="43%" stop-color="white" stop-opacity="0.6" />
+       <stop offset="50%" stop-color="white"  stop-opacity="0"/>
+       <stop offset="100%" stop-color="black"  stop-opacity="0"/>
+     </radialGradient>
+     <radialGradient id="Patterningrad"  cx="50%" cy="50%" r="100%" fx="50%" fy="50%">
+       <stop offset="0%" stop-color="white" stop-opacity="0.45"/>
+       <stop offset="36%" stop-color="yellow" stop-opacity="0"/>
+       <stop offset="43%" stop-color="yellow" stop-opacity="0.6" />
+       <stop offset="50%" stop-color="yellow"  stop-opacity="0"/>
+       <stop offset="100%" stop-color="black"  stop-opacity="0"/>
+     </radialGradient>
+</xsl:template>
+
+
+<!-- well-known border shapes -->
+
+
+<xsl:template name="default-box-border">
+    <symbol id="Borderbox" viewBox="0 0 20 20">
+      <path d="M 0 0 L 0 20 L 20 20 L 20 0 z" stroke="black"/>
+    </symbol>
+</xsl:template>
+<xsl:template name="default-clipLB-border">
+    <symbol id="Borderbox-clipLB" viewBox="0 0 20 20">
+      <path d="M 0 0 L 0 15 L 5 20 L 20 20 L 20 0 z" stroke="black"/>
+    </symbol>
+</xsl:template>
+<xsl:template name="default-clipLT-border">
+    <symbol id="Borderbox-clipLT" viewBox="0 0 20 20">
+      <path d="M 5 0 L 0 5 L 0 20 L 20 20 L 20 0 z" stroke="black"/>
+    </symbol>
+</xsl:template>
+<xsl:template name="default-clipRB-border">
+    <symbol id="Borderbox-clipRB" viewBox="0 0 20 20">
+      <path d="M 0 0 L 0 20 L 15 20 L 20 15 L 20 0 z" stroke="black"/>
+    </symbol>
+</xsl:template>
+<xsl:template name="default-clipRT-border">
+    <symbol id="Borderbox-clipRT" viewBox="0 0 20 20">
+      <path d="M 0 0 L 0 20 L 20 20 L 20 5 L 15 0 z" stroke="black"/>
+    </symbol>
+</xsl:template>
+<xsl:template name="default-clipAll-border">
+    <symbol id="Borderbox-clipAll" viewBox="0 0 20 20">
+      <path d="M 5 0 L 0 5 L 0 15 L 5 20 L 15 20 L 20 15 L 20 5 L 15 0 z" stroke="black"/>
+    </symbol>
+</xsl:template>
+<xsl:template name="default-round-border">
+	<symbol id="Borderround" viewBox="0 0 20 20">
+		<circle cx="10" cy="10" r="10" stroke="black" />
+	</symbol>
+</xsl:template>
+<xsl:template name="default-hexagon-border">
+	<symbol id="Borderhexagon" viewBox="0 0 20 20">
+		<path d="M 0 10 L 5.8 0 L 14.2 0 L 20 10 L 14.2 20 L 5.8 20 z" stroke="black" />
+	</symbol>
+</xsl:template>
+
+<!-- end borders -->
+
+		<!-- overridden by output of shapes.xsl -->
+<xsl:template match="SystemDefinition" mode="shapes">
+	<xsl:call-template name="default-new-pattern"/>
+	<xsl:call-template name="default-ref-pattern"/>
+	<xsl:call-template name="default-X-pattern"/> 
+	<xsl:if test="not(@static='true') and (@navctrl)">
+		<xsl:call-template name="nav-control-patterns"/> 
+	</xsl:if>
+		<!-- borders to use for OSD components -->
+
+	<xsl:call-template name="default-box-border"/>
+	<xsl:call-template name="default-clipLB-border"/>
+	<xsl:call-template name="default-clipLT-border"/>
+	<xsl:call-template name="default-clipRB-border"/>
+	<xsl:call-template name="default-clipRT-border"/>
+	<xsl:call-template name="default-clipAll-border"/>
+</xsl:template>
+
+
+<xsl:template match="component|collection|package|layer" mode="id"><xsl:value-of select="@id"/></xsl:template>
+
+<xsl:template name="linkable-content"><xsl:param name="show"/>
+	<xsl:variable name="found">
+		<xsl:apply-templates select="." mode="has-link"/>
+	</xsl:variable>
+	<xsl:choose> <!-- don't use <a> unless there is a valid link -->
+		<xsl:when test="$found='' or parent::legend">
+			<xsl:copy-of select="$show"/>				
+		</xsl:when>
+		<xsl:otherwise>
+			<a>
+				<xsl:apply-templates select="." mode="link-label"/>
+				<xsl:copy-of select="$show"/>
+			</a>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template mode="validate" match="node()" priority="-4"/>
+<xsl:template mode="validate" match="*" priority="-2"><xsl:apply-templates mode="validate" select="*"/></xsl:template>
+
+
+<xsl:template name="display-name">
+	<xsl:apply-templates select="." mode="text-filter"/>
+	<xsl:if test="@font">
+		<xsl:attribute name="style">font-family: '<xsl:value-of select="@font"/>'</xsl:attribute>
+	</xsl:if>
+	<xsl:call-template name="name-value"/>
+</xsl:template>
+
+<xsl:template name="name-value">
+	<xsl:choose>
+		<xsl:when test="self::cmp or self::cbox  or self::legend or self::note or self::layer[legend|note]">
+			<xsl:apply-templates select="." mode="name"/>
+		</xsl:when>
+		<xsl:when test="@abbrev"><xsl:value-of select="@abbrev"/></xsl:when>
+		<xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when> <!-- for legends -->
+		<xsl:when test="@lookup"><xsl:value-of select="@lookup"/></xsl:when> <!-- for legends -->
+		<xsl:when test="$Use-as-name!='name' and @*[name()=$Use-as-name]"><xsl:value-of select="@*[name()=$Use-as-name]"/></xsl:when>
+		<xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!-- ============ hyperlinks ============ -->
+
+<xsl:template match="*" mode="has-link"/>
+<xsl:template match="*[@id and ancestor::SystemDefinition/@base]" mode="has-link">1</xsl:template>
+
+<xsl:template match="*" mode="link-label"/>
+<xsl:template match="*[@id]" mode="link-label">
+	<xsl:attribute name="target">details</xsl:attribute>
+	<xsl:attribute name="xlink:href"><xsl:value-of select="ancestor::SystemDefinition/@base"/>/<xsl:choose>
+		<xsl:when test="self::package[parent::package]">SubBlocks</xsl:when>
+		<xsl:when test="self::package">Blocks</xsl:when>
+		<xsl:when test="self::layer">Layers</xsl:when>
+		<xsl:when test="self::component">Components</xsl:when>
+		<xsl:when test="self::collection">Collections</xsl:when>
+		<xsl:otherwise>
+			<xsl:call-template name="Caller-Error">
+				<xsl:with-param name="text">Invalid element <xsl:value-of select="name()"/> id="<xsl:value-of select="@id"/>". Cannot generate link.</xsl:with-param>
+			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>/<xsl:value-of select="@name"/>.html</xsl:attribute>
+</xsl:template>
+
+<!-- ============ styles ============ -->
+
+
+<xsl:template name="default-font">
+	<xsl:choose>
+		<xsl:when test="ancestor-or-self::SystemDefinition[@font]">'<xsl:value-of select="ancestor-or-self::SystemDefinition/@font"/>'</xsl:when>
+		<xsl:otherwise>Arial</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="title-line-height">
+	<xsl:choose>
+		<xsl:when test="number(ancestor-or-self::SystemDefinition/systemModel/meta/legend/@title-scale)">
+			<xsl:value-of select="4.3 * ancestor-or-self::SystemDefinition/systemModel/meta/legend/@title-scale"/> <!-- scale 12pt by specified factor-->
+		</xsl:when>
+		<xsl:when test="ancestor-or-self::SystemDefinition/systemModel/meta/legend[@percent-width or @maxscale]">4.233</xsl:when> <!-- 12pt -->
+		<xsl:when test="ancestor-or-self::SystemDefinition/@width &gt; $large-width">6.3495</xsl:when> <!-- 18 pt -->
+		<xsl:otherwise>4.3</xsl:otherwise> <!-- 12pt -->
+	</xsl:choose>		
+</xsl:template>
+
+
+<!-- ============ display styles ============ -->
+
+<xsl:template name="styles"><xsl:param name="for" select="'bg'"/>
+	<xsl:variable name="st0">
+		<xsl:apply-templates select="." mode="display-style"/></xsl:variable>
+	<xsl:variable name="st1">
+		<xsl:choose>
+			<xsl:when test="$for='label' and @label-bg">fill:<xsl:value-of select="@label-bg"/>!important;</xsl:when>
+			<xsl:when test="@bg">fill:<xsl:value-of select="@bg"/>!important;</xsl:when>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:if test="$st0!='' or $st1!=''">
+	<xsl:attribute name="style">
+		<xsl:value-of select="$st0"/>
+		<xsl:if test="$st0!='' and $st1!='' and substring($st0,string-length($st0))!=';'">;</xsl:if>
+		<xsl:value-of select="$st1"/>
+	</xsl:attribute>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template name="gradient-direction"> <!-- calaulate the x1, etc attrbiutes from the dir ratio string. clip each to the range -1..1 -->
+  <xsl:param name="dx" select="1"/>
+  <xsl:param name="dy" select="0"/>
+      <xsl:if test="$dx!='' and $dy!=''">
+        <xsl:attribute  name="x1">
+          <xsl:choose>
+            <xsl:when test="$dx &lt; -1">100%</xsl:when>
+            <xsl:when test="$dx &gt;= 0">0%</xsl:when>
+            <xsl:otherwise><xsl:value-of select="-$dx * 100"/>%</xsl:otherwise>          
+          </xsl:choose>
+       </xsl:attribute>
+        <xsl:attribute  name="x2">
+          <xsl:choose>
+            <xsl:when test="$dx &gt; 1">100%</xsl:when>
+            <xsl:when test="$dx &lt;= 0">0%</xsl:when>
+            <xsl:otherwise><xsl:value-of select="$dx * 100"/>%</xsl:otherwise>          
+          </xsl:choose>
+       </xsl:attribute>
+        <xsl:attribute  name="y1">
+          <xsl:choose>
+            <xsl:when test="$dy &lt; -1">100%</xsl:when>
+            <xsl:when test="$dy &gt;= 0">0%</xsl:when>
+            <xsl:otherwise><xsl:value-of select="-$dy * 100"/>%</xsl:otherwise>          
+          </xsl:choose>
+       </xsl:attribute>
+        <xsl:attribute  name="y2">
+          <xsl:choose>
+            <xsl:when test="$dy &gt;1">100%</xsl:when>
+            <xsl:when test="$dy &lt;= 0">0%</xsl:when>
+            <xsl:otherwise><xsl:value-of select="$dy * 100"/>%</xsl:otherwise>          
+          </xsl:choose>
+       </xsl:attribute>  
+      </xsl:if>
+</xsl:template>
+
+<xsl:template name="gradient-angle"> <!-- calaulate the x1, etc attrbiutes from the dir ratio string. clip each to the range -1..1 -->
+  <xsl:param name="theta" select="0"/>
+	<xsl:call-template name="gradient-direction">
+	  <xsl:with-param name="dx" select="m:cos($theta * m:constant('PI',6) div 180)"/>
+	  <xsl:with-param name="dy" select="-m:sin($theta * m:constant('PI',6) div 180)"/>
+	</xsl:call-template>
+</xsl:template>
+
+
+<!-- provide a gradient of multiple colours for the fill of an item -->
+<xsl:template name="multi-color-grad">
+	<xsl:param name="c" /> <!--  nodeset of either values or values to look up in $key -->
+	<xsl:param name="key" /> <!-- the style ID to lookup the value. Optional. If not set, the value of $c is the value -->
+	<xsl:param name="blur" /> <!-- % to blur 100% mean to blur to the full size of each gradient section -->
+	<xsl:param name="dir" /> <!-- direction ratio in the form dx:dy, where each has a range from -1..1 -->
+	<xsl:param name="angle" /> <!-- angle : use this instead of dir when possible -->
+	<xsl:if test="($key!='' and count(key($key,$c)/@value) &gt; 1) or ($key='' and count($c) &gt; 1)  "><!-- only define if there's more than one match -->
+		<linearGradient>
+	        <xsl:attribute  name="id">bg<xsl:apply-templates select="." mode="id"/></xsl:attribute>
+			<xsl:choose>
+				<xsl:when test="function-available('m:sin') and function-available('m:cos') and function-available('m:constant') and $angle!=''">
+					<xsl:call-template name="gradient-angle">
+						<xsl:with-param name="theta" select="$angle" />
+					</xsl:call-template>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:call-template name="gradient-direction">
+					  <xsl:with-param name="dx" select="substring-before($dir,':')"/>
+					  <xsl:with-param name="dy" select="substring-after($dir,':')"/>
+					</xsl:call-template>
+				</xsl:otherwise>
+			</xsl:choose>
+			<xsl:variable name="blur0" select="$blur div count($c)" />
+			<xsl:for-each select="$c">
+				<xsl:sort />
+				<xsl:variable name="value">
+					<xsl:choose>
+						<xsl:when test="$key=''"><xsl:value-of select="."/></xsl:when>
+						<xsl:otherwise><xsl:value-of select="key($key,.)/@value"/></xsl:otherwise>
+					</xsl:choose>
+				 </xsl:variable>
+				<stop offset="{100* (position()-1) div  last() + $blur0}%" stop-color="{$value}" />
+				<xsl:if test="position()!=last()">
+					<stop offset="{100* position() div  last() - $blur0}%" stop-color="{$value}" />
+				</xsl:if>
+			</xsl:for-each>
+		</linearGradient>
+	</xsl:if>
+</xsl:template>
+<xsl:template mode="multi-color" match="*" priority="-1"/> <!-- this is handled in the generated XSLT, so do nothing by default -->
+
+<xsl:template mode="multi-color" match="*[meta/generator-color]">
+  <xsl:call-template name="multi-color-grad">
+   <xsl:with-param name="key" select="'styled'"/>
+   <xsl:with-param name="c" select="meta/generator-color/@ref"/>
+   <xsl:with-param name="blur" select="0"/>
+  </xsl:call-template>
+</xsl:template>
+
+
+<xsl:template match="*" mode="display-style-color" priority="-2"/>
+<xsl:template match="*" mode="animate-color" priority="-2"/><!-- change from -2 to disable -->
+
+
+<xsl:template match="*[@generator-color]" mode="animate-color" priority="4">
+	<xsl:if test="not(ancestor::SystemDefinition/@static='true')">
+		<set attributeName="opacity" attributeType="XML" to="0.5" fill="remove" begin="{@generator-color}.mouseover" end="{@generator-color}.mouseout"/>		
+	</xsl:if>
+</xsl:template>
+<xsl:template match="*[meta/generator-color]" mode="animate-color" priority="4">
+	<xsl:if test="not(ancestor::SystemDefinition/@static='true')">
+		<xsl:for-each select="meta/generator-color">
+			<set attributeName="opacity" attributeType="XML" to="0.5" fill="remove" begin="{@ref}.mouseover" end="{@ref}.mouseout"/>		
+		</xsl:for-each>
+	</xsl:if>
+</xsl:template>
+
+
+<!--  generated overrides -->
+  
+
+<xsl:template match="*[@generator-color]" mode="display-style-color" priority="8">
+	<xsl:for-each select="key('styled',@generator-color)">
+		<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
+	</xsl:for-each>
+</xsl:template>
+
+
+<xsl:template match="*[count(meta/generator-color)=1]" mode="display-style-color" priority="8">
+	<xsl:for-each select="key('styled',meta/generator-color/@ref)">
+		<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="*[count(meta/generator-color) &gt; 1]" mode="display-style-color" priority="8">
+	<xsl:variable name="ref" select="key('styled',meta/generator-color/@ref)"/>
+	<xsl:choose>
+		<xsl:when test="count($ref/@value)=1">
+			<xsl:value-of select="$ref/@value"/>
+		</xsl:when>
+		<xsl:when test="count($ref/@value)=0">
+			<xsl:value-of select="$ref/@default[last()]"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:text>url(#bg</xsl:text><xsl:apply-templates select="." mode="id"/><xsl:text>)</xsl:text>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="*[@generator-text-highlight]" mode="text-filter"  priority="8">
+		<xsl:attribute name="filter">url(<xsl:for-each select="key('styled',@generator-text-highlight)">
+		<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
+	</xsl:for-each>)</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="*[@generator-highlight]" mode="filter" priority="8">
+	<xsl:attribute name="filter">url(<xsl:for-each select="key('styled',@generator-highlight)">
+		<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
+	</xsl:for-each>)</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="*[@generator-overlay|meta/generator-overlay]" mode="overlays" priority="8">
+	<xsl:for-each select="key('styled',@generator-overlay|meta/generator-overlay/@ref)">
+		<o>
+			<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
+		</o>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="*[@generator-border]" mode="shape" priority="8">
+	<xsl:for-each select="key('styled',@generator-border)">
+		<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="*" mode="display-style">
+	<xsl:variable name="color"><xsl:apply-templates select="." mode="display-style-color"/></xsl:variable>
+	<xsl:if test="$color!=''">fill:<xsl:value-of select="$color"/>;</xsl:if>
+	<xsl:for-each select="@generator-style | meta/generator-style/@ref">
+		<xsl:for-each select="key('styled',.)">
+			<xsl:value-of select="concat(@value | @default,';')"/><!-- can't have both -->
+		</xsl:for-each>
+	</xsl:for-each>
+	<xsl:apply-templates select="." mode="display-style-aux"/>
+</xsl:template>
+  
+<!--  defaults -->
+  
+<xsl:template match="*" mode="display-style-aux" priority="-2"/>
+<xsl:template match="component" mode="display-style-aux" priority="-1">stroke-width:<xsl:choose>
+	<xsl:when test="@plugin">2</xsl:when>
+	<xsl:otherwise>0.4</xsl:otherwise>
+</xsl:choose>;</xsl:template>
+
+<xsl:template match="component|cmp" mode="display-style-color" priority="-1">grey</xsl:template>
+
+<xsl:template match="*" mode="overlay-styles">
+	<!-- overlays just retruns each overlay pattern, this turns them into actual styles -->
+	<xsl:variable name="o">
+		<xsl:apply-templates select="." mode="overlays"/>
+	</xsl:variable>
+	<xsl:for-each select="exslt:node-set($o)/*">
+		<xsl:copy>fill:<xsl:if test=".=''">none</xsl:if>
+		<xsl:if test=".!=''">url(<xsl:value-of select="."/>)</xsl:if>
+		<xsl:text>; stroke: none; stroke-width: 0;</xsl:text>
+		</xsl:copy>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="*" mode="overlays" priority="-3"/>
+
+<xsl:template match="component" mode="overlays" priority="-2">
+	<xsl:if test="@introduced = ancestor::SystemDefinition/@ver"><o>#Patternradial-grad</o></xsl:if>
+	<xsl:if test="@purpose='development' "><o>#Patternstriped-diag-up</o></xsl:if>
+</xsl:template>
+
+<xsl:template match="component|cmp" mode="overlays" priority="-3"/>
+
+<xsl:template match="component|cmp" mode="shape" priority="-1">#Borderbox</xsl:template>
+
+<!-- ====== legend ============= -->
+
+<xsl:include href="legend.xsl"/>
+<!-- end legend -->
+
+
+<!-- ====== drawing ============= -->
+
+<xsl:template match="*"  priority="-1">
+		<xsl:call-template name="Caller-Error">
+			<xsl:with-param name="text">Unrecognised elementn <xsl:value-of select="name()"/> not supported</xsl:with-param>
+		</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="meta" priority="-1">
+	<xsl:if test="not(following::meta[@rel=current()/@rel])">
+		<xsl:call-template name="Caller-Note">
+			<xsl:with-param name="text">meta rel="<xsl:value-of select="@rel"/>" not supported</xsl:with-param>
+		</xsl:call-template>
+	</xsl:if>
+	<xsl:call-template name="Caller-Debug">
+		<xsl:with-param name="text">meta rel="<xsl:value-of select="@rel"/>" in <xsl:value-of select="../@id"/> not supported</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="meta[@rel='styling' or @rel='Generic' or not(@rel) or @rel='Dependencies' or starts-with(@rel,'model-') or @rel='layer-group' or @rel='config'  or @rel='testbuild']"/>
+	<!-- no diagram data in these-->
+
+<xsl:template match="meta[@rel='model-levels']"/> <!--  by default, show no level titles -->
+
+<!-- global stuff is stuff which is drawn outside of any system model item -->
+<xsl:template match="*" mode="global" priority="-1"/>
+
+<!-- ====== layer groups  ============= -->
+
+<xsl:template match="meta[@rel='layer-group']" mode="global">
+	<xsl:apply-templates select="layer-group" mode="lgrp">
+		<!-- start as wide as possible and go inward -->
+		<xsl:with-param name="left" select="0"/>
+		<xsl:with-param name="right" select="ancestor::SystemDefinition/@width"/> 
+	</xsl:apply-templates>
+</xsl:template>
+
+
+<xsl:template match="layer-group" mode="lgrp">
+	<xsl:param name="left"/><xsl:param name="right"/>
+	<xsl:variable name="From" select="ancestor::systemModel/layer[@id=current()/@from]"/>
+	<xsl:variable name="To" select="ancestor::systemModel/layer[@id=current()/@to]"/>
+	<xsl:choose>
+		<xsl:when test="not($From)">
+			<xsl:call-template name="Caller-Error">
+				<xsl:with-param name="text">layer "<xsl:value-of select="@from"/>" does not exist</xsl:with-param>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="not($To)">
+			<xsl:call-template name="Caller-Error">
+				<xsl:with-param name="text">layer "<xsl:value-of select="@to"/>" does not exist</xsl:with-param>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="not($From/following-sibling::layer[@id=current()/@to])">
+			<xsl:call-template name="Caller-Error">
+				<xsl:with-param name="text">"<xsl:value-of select="@from"/>" is after "<xsl:value-of select="@to"/>"</xsl:with-param>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="$To[@span]">
+			<xsl:call-template name="Caller-Error">
+				<xsl:with-param name="text">Layer group cannot be bounded by spanned layer "<xsl:value-of select="@to"/>"</xsl:with-param>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="$From[@span]">
+			<xsl:call-template name="Caller-Error">
+				<xsl:with-param name="text">Layer group cannot be bounded by spanned layer "<xsl:value-of select="@from"/>"</xsl:with-param>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:variable name="parent-to" select="count(ancestor::layer-group[@to=current()/@to])"/>
+			<xsl:variable name="child-to" select="1+ count(descendant::layer-group[@to=current()/@to])"/>
+			<xsl:variable name="child-from" select="1+ count(descendant::layer-group[@from=current()/@from])"/>
+			<xsl:variable name="between" select="$From/following-sibling::layer[following-sibling::layer[@id=current()/@to]]"/>
+			<xsl:variable name="height" select="sum($From/@height | $From/@padding-top | $To/@height | $To/@padding-bottom |$between/@height | $between/@padding-top | $between/@padding-bottom) +
+	 			$lgrpDx *  ($child-to+ $child-from) + $groupDy * (1 + count($between))"/>
+			<xsl:variable name="start">
+				<xsl:choose>
+					<xsl:when test="$To/following-sibling::layer[not(@span)]">
+					<xsl:value-of select="sum($To/following-sibling::layer[not(@span)]/@*[name()='height' or name()='padding-bottom' or name()='padding-top'])  
+						+ $groupDy * count($To/following-sibling::layer[not(@span)])  + $lgrpDx *  $parent-to "/>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:value-of select="$lgrpDx *  $parent-to"/>
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:variable>
+			<xsl:variable name="to-name" select="@to"/>
+			<xsl:variable name="from-name" select="@from"/>
+			<g class="{name()}">
+				<rect width="{$right - $left}" height="{$height}" x="{$left}" y="{$start}" rx="{$lyrTitleBox*0.5}"  fill="{@color}"/>
+				<xsl:if test="@label">
+					<text text-anchor="middle" dy="0.375em" class="lgrp" transform="rotate(-90)" y="{$left + 0.5 * $lgrpLabelDx}" width="{$height}" x="{- ($start + 0.5 * $height)}">
+						<xsl:value-of select="@label"/>
+					</text>
+				</xsl:if>
+			</g>
+			<xsl:variable name="dx">
+				<xsl:choose>
+					<xsl:when test="@label"><xsl:value-of select="$lgrpLabelDx"/></xsl:when>
+					<xsl:otherwise><xsl:value-of select="$lgrpDx * 0.75"/></xsl:otherwise>
+				</xsl:choose>
+			</xsl:variable>		
+			<xsl:apply-templates select="layer-group" mode="lgrp">
+				<xsl:with-param name="left" select="$left + $dx"/>
+				<xsl:with-param name="right" select="$right - $lgrpDx"/>
+			</xsl:apply-templates>
+		</xsl:otherwise>
+	</xsl:choose>
+
+</xsl:template>
+
+<!-- ====== layers  ============= -->
+
+<xsl:template match="layer">
+	<xsl:variable name="y" select="sum(@padding-top|following-sibling::layer[not(@span)]/@*[name()='height'  or name()='padding-bottom' or name()='padding-top']) + count(following::layer[not(@span)]) * $groupDy"/>
+		
+	<g id="{@id}" transform="translate({ancestor::SystemDefinition/@padding-left - 3.5 - $lyrTitleBox } {$y})">
+		<xsl:call-template name="my-class"/>
+		<xsl:apply-templates select="." mode="filter"/>
+		<xsl:apply-templates select="." mode="animate-color"/>	
+        <xsl:apply-templates select="." mode="multi-color"/>	
+        <xsl:variable name="show-content" select="not(ancestor::SystemDefinition[@detail='layer' and not(@levels='show')])"/> <!-- only show if showing content -->
+        <xsl:if test="$show-content"> <!-- only show if showing content -->
+			<xsl:call-template name="linkable-content">
+				<xsl:with-param name="show">
+					<rect x="0.3" y="0.3" width="{$lyrTitleBox}" rx="{$lyrTitleBox * 0.5}" ry="{$lyrTitleBox * 0.5}" class="{name()}" height="{@height}">
+						<xsl:call-template name="styles"><xsl:with-param name="for" select="'label'"/></xsl:call-template>
+					</rect>
+					<text  text-anchor="middle" dy="0.375em" class="layer" transform="rotate(-90)" 
+						 y="{$lyrTitleBox * 0.5 + 0.3}" width="{@height}" height="{$lyrTitleBox}" x="{ -(@height div 2 ) -  0.3}">
+						<xsl:call-template name="display-name"/>
+					</text>
+				</xsl:with-param>
+			</xsl:call-template>
+		</xsl:if>
+		<xsl:variable name="spans" select="following-sibling::layer[@span and position() - @span &lt;= 0]"/>
+		<xsl:variable name="w" select="ancestor::SystemDefinition/@model-width -  sum($spans/@width) - $groupDx * count($spans)"/>
+
+		<xsl:variable name="x-off">
+			<xsl:choose>
+				<xsl:when test="$w &lt;= @width">0</xsl:when> <!-- should never be less than 0 -->
+				<xsl:when test="@align='left'">0</xsl:when>
+				<xsl:when test="@align='right'"><xsl:value-of select="$w - @width"/></xsl:when>
+				<xsl:otherwise><xsl:value-of select="0.5 * ($w - @width)"/></xsl:otherwise> <!-- align='center' -->
+			</xsl:choose>
+		</xsl:variable>
+		<g class="layer-detail" transform="translate({3.5 + $lyrTitleBox + $x-off} {sum(@ipad) *0.5})">
+			<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>
+			<rect x="{-$x-off}" class="{name()}" y="{-0.5 * sum(@ipad)}" width="{$w}" height="{@height}">
+				<xsl:call-template name="styles"/>
+				<xsl:if test="not($show-content)">
+				 <xsl:attribute name="rx"><xsl:value-of select="$lyrTitleBox*0.5"/></xsl:attribute>
+				 <xsl:attribute name="ry"><xsl:value-of select="$lyrTitleBox*0.5"/></xsl:attribute>
+				 </xsl:if>
+			</rect>
+
+			<xsl:variable name="overlay"><xsl:apply-templates select="." mode="overlay-styles"/></xsl:variable>
+			<xsl:variable name="cur" select="."/>
+			
+			
+			<xsl:for-each select="exslt:node-set($overlay)/*">
+				<rect x="{-$x-off}" y="{-0.5 * sum($cur/@ipad)}" width="{$w}" height="{$cur/@height}"  style="{.}"/>
+			</xsl:for-each>
+
+			<xsl:if test="not($show-content)">
+				<xsl:call-template name="linkable-content">
+					<xsl:with-param name="show">
+						<text  text-anchor="middle" dy="0.375em" class="layer" 
+							 y="{0.5 * @height}" width="{@width}" height="{@height}" x="{ 0.5 * @width}">
+							<xsl:call-template name="display-name"/>
+						</text>
+					</xsl:with-param>
+				</xsl:call-template>
+			</xsl:if>
+			<g><xsl:apply-templates select="." mode="detail-stuff"/>
+				<xsl:apply-templates select="*"/>
+			</g>		
+		</g>
+	</g>
+</xsl:template>
+
+<!-- print levels for fixed or non-fixed width -->
+<xsl:template match="layer/meta[@rel='model-levels' and ancestor::SystemDefinition[@levels='show' and @detail='layer']]">
+	<xsl:for-each select="level[@name]">
+		<text text-anchor="middle" class="level" x="{../../@width * 0.5}" width="{../../@width}" dy="0.375em">
+			<xsl:attribute name="y">
+				<xsl:choose>
+					<xsl:when test="ancestor::SystemDefinition/@detail-type='fixed'">
+						<xsl:value-of select="(count(following-sibling::level) + 0.5)* $mHeight * 1.5"/>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:value-of select="sum(following-sibling::level/@height) +count(following-sibling::level/@height) + 0.5* @height "/>
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:attribute>
+			<xsl:call-template name="display-name"/>
+		</text>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="layer/meta[@rel='model-levels' and ancestor::SystemDefinition[@levels='expand']]">
+	<xsl:variable name="spans" select="../following-sibling::layer[@span and position() - @span &lt;= 0]"/>
+	<xsl:variable name="w" select="ancestor::SystemDefinition/@model-width -  sum($spans/@width) - $groupDx * count($spans)"/>
+
+	<xsl:for-each select="level[@name]">
+		<xsl:variable name="y" select="sum(following-sibling::level/@height) + $groupDy * count(following-sibling::level) + 0.5 * @height"/>
+		<text text-anchor="middle" class="level" x="{$w - $levelExpandName * 0.2 - ($w - ../../@width) * 0.5}" width="{@height}" y="{$y}" height="{$levelExpandName}" dy="0em" transform="rotate(-90 {$w - $levelExpandName * 0.2 - ($w - ../../@width) * 0.5} {$y})">
+			<xsl:call-template name="display-name"/>
+		</text>
+	</xsl:for-each>
+</xsl:template>
+
+
+<xsl:template match="layer[@span &gt; 0]">
+	<xsl:variable name="y" select="sum(@padding-top|following-sibling::layer[not(@span)]/@*[name()='height'  or name()='padding-bottom' or name()='padding-top']) + count(following::layer[not(@span)]) * $groupDy"/>
+	
+	<xsl:variable name="spans" select="following-sibling::layer[@span and position() - @span &lt;= 0]"/>
+	<xsl:variable name="w" select="ancestor::SystemDefinition/@model-width -  sum($spans/@width) - $groupDx * count($spans)"/>
+    <xsl:variable name="show-content" select="not(ancestor::SystemDefinition[@detail='layer' and not(@levels='show')])"/> <!-- only show if showing content -->
+	
+	<xsl:variable name="x-off" select="$w - @width"/>
+	<g class="{name()}" id="{@id}" transform="translate({$x-off + $groupDx} {$y})">
+		<xsl:apply-templates select="." mode="filter"/>
+		<g class="layer-detail" transform ="translate({$lyrTitleBox + 3.5} {sum(@ipad) *0.5})">
+			<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>
+			<rect x="0" class="{name()}" y="{-0.5 * sum(@ipad)}" width="{@width}" height="{@height}">
+				<xsl:call-template name="styles"/>
+				<xsl:if test="not($show-content)">
+					 <xsl:attribute name="rx"><xsl:value-of select="$lyrTitleBox*0.5"/></xsl:attribute>
+					 <xsl:attribute name="ry"><xsl:value-of select="$lyrTitleBox*0.5"/></xsl:attribute>
+				 </xsl:if>				
+			</rect>
+
+			<xsl:variable name="overlay"><xsl:apply-templates select="." mode="overlay-styles"/></xsl:variable>
+			<xsl:variable name="cur" select="."/>
+			<xsl:for-each select="exslt:node-set($overlay)/*">
+				<rect x="0" width="{$cur/@width}" height="{$cur/@height}" y="{-0.5 * sum($cur/@ipad)}" style="{.}"/>
+			</xsl:for-each>
+
+			<xsl:call-template name="linkable-content">
+				<xsl:with-param name="show">
+					<text text-anchor="middle" class="layer" width="{@width}" x="{@width div 2}">
+						<xsl:attribute name="y">
+							<xsl:choose>
+								<xsl:when test="ancestor::SystemDefinition[@detail='layer']">
+									<xsl:value-of select="@height * 0.5"/>
+								</xsl:when>
+								<xsl:otherwise>
+									<xsl:value-of select="@height - $groupDy - 2.3"/>								
+								</xsl:otherwise>
+							</xsl:choose>
+						</xsl:attribute>
+						<xsl:if test="ancestor::SystemDefinition[@detail='layer']"> <!--  middle align if no content, otherwise text goes at bottom -->
+							<xsl:attribute name="dy">0.375em</xsl:attribute>
+							<xsl:copy-of select="@height"/>
+						</xsl:if>
+						<xsl:call-template name="display-name"/>
+					</text>
+				</xsl:with-param>
+			</xsl:call-template>
+			<g><xsl:apply-templates select="." mode="detail-stuff"/>					
+				<xsl:apply-templates select="*"/>
+			</g>
+		</g>
+	</g>
+
+</xsl:template>
+
+<xsl:template name="my-class">
+	<xsl:attribute name="class">
+		<xsl:value-of select="name()"/>
+		<xsl:if test="not(*[not(self::meta)])"> placeholder</xsl:if>
+		<xsl:if test="name()=name(..)"> nested</xsl:if>
+	</xsl:attribute>	
+</xsl:template>
+
+<!-- ====== packages  ============= -->
+<xsl:template match="package">
+
+	<xsl:variable name="match" select="../meta[@rel='model-levels']/level[@name=current()/@level  or not(current()/@level)  or (current()/@span and following-sibling::level[position() &lt; current()/@span][@name=current()/@level or (not(@name) and current()/@level='*')]) or (current()/@level='*' and not(@name))]"/>
+
+	<xsl:variable name="h">
+			<xsl:choose>
+				<xsl:when test="$match"> <!-- get height from height of (spanned) levels -->
+						<xsl:value-of select="sum($match/@height) + $groupDy * (count($match) - 1)"/>
+				</xsl:when>
+				<xsl:when test="parent::layer/@span or count(../package)!=1"> <!-- has siblings, so height of layer will do (- padding) -->
+						<xsl:value-of select="../@height - sum(../@ipad)"/>
+				</xsl:when>
+				<xsl:otherwise><xsl:value-of select="@height"/></xsl:otherwise>
+			</xsl:choose>
+	</xsl:variable>  
+
+	<xsl:variable name="x">
+		<xsl:choose>
+			<xsl:when test="../meta[@rel='model-levels']/level/step[@ref=current()/@id]">
+				<xsl:value-of select="../meta[@rel='model-levels']/level/step[@ref=current()/@id]/@x"/>
+			</xsl:when>
+			<xsl:otherwise><xsl:value-of select="sum(preceding-sibling::package/@width) + count(preceding-sibling::package) * $groupDx"/></xsl:otherwise>	
+		</xsl:choose>
+	</xsl:variable>
+
+		<xsl:variable name="lev" select="../meta[@rel='model-levels']/level[@name=current()/@level  or (current()/@level='*' and not(@name))]"/>
+		<xsl:variable name="y" select="sum($lev/following-sibling::level/@height) + $groupDy * count($lev/following-sibling::level)"/>
+		
+	<xsl:variable name="translate-y">
+		<xsl:choose>
+			<xsl:when test="@levels or not(collection/@level)"><xsl:value-of select="$y"/></xsl:when>
+			<xsl:otherwise>0</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+
+	<g id="{@id}">
+		<xsl:call-template name="my-class"/>
+		<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>
+		<xsl:apply-templates select="." mode="filter"/>	
+		<xsl:attribute name="transform">translate( <xsl:value-of select="concat($x,' ',$translate-y)"/>)</xsl:attribute>
+		<xsl:apply-templates select="." mode="animate-color"/>
+        <xsl:apply-templates select="." mode="multi-color"/>		
+		<rect class="{name()}" x="0" width="{@width}" height="{$h}" y="{$y - $translate-y }">
+			<xsl:call-template name="styles"/>
+		</rect>		
+		
+		<xsl:variable name="overlay"><xsl:apply-templates select="." mode="overlay-styles"/></xsl:variable>
+		<xsl:variable name="cur" select="."/>
+		<xsl:for-each select="exslt:node-set($overlay)/*">
+			<rect x="0" width="{$cur/@width}" height="{$h}" y="{$y - $translate-y }" style="{.}"/>
+		</xsl:for-each>
+		<xsl:variable name="middle" select="not(collection|package) or (ancestor::SystemDefinition[@detail='package' and not(@levels='show')] and not(package))"/>
+		
+		<xsl:variable name="text-off"> <!--  middle-align if not showing children -->
+			<xsl:choose>
+				<xsl:when test="$middle"><xsl:value-of select="$h *0.5"/></xsl:when>
+				<xsl:otherwise>0</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="padding" select="sum(@ipad) + number($h - @height &gt; 2 * $groupDy)  * 2 * $groupDy * (1 - count(@ipad))"/>
+			<!-- use @ipad or 2groupdy if h is significantly bigger then @height  -->
+		<!-- label goes here -->
+		<xsl:call-template name="linkable-content">
+			<xsl:with-param name="show">
+				<text text-anchor="middle" class="package" width="{@width}" x="{@width div 2}" y="{ $y + $h - $text-off   - $translate-y - 1 }">
+					<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'text'"/></xsl:apply-templates>
+						<!--  centre-align if not showing children -->				
+					<xsl:if test="$middle">
+							<xsl:attribute name="dy">0.375em</xsl:attribute>
+							<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
+					</xsl:if>
+					<xsl:variable name="txt"><xsl:call-template name="name-value"/></xsl:variable>
+					<xsl:variable name="level-h" select="count(meta[@rel='model-levels']/level) *  ($mHeight + $groupDy) - $groupDy + $padding"/>  
+					<xsl:choose>
+						<!-- the $cSize * string-length($txt) * 0.25 assumes 4 chars per component-width is a good
+							determinant of the amount of pkg text that can fit in a given width. This fails, of course, when
+							the font or font size changes via CSS, something that can't be resolved here at all, however
+							it's not a bad failsafe condition, since it just puts text where there is the most room for it
+							It just might look funny if the font is smaller than expected and there'd be plenty of room for
+							it at the bottom.
+							The ".../level[1]/@width != 0 and count(...) &gt; 1" means that if the first level has nothing in it,
+							then there's plenty of room and no need for an inline label  
+							The ($h - $level-h &lt; $mHeight)" bit means the same thing, except it takes into account that the 
+							levels might not go all the way to the bottom of the pkg							 
+						-->
+						<xsl:when test="package"/> <!-- can't be inline -->
+						<xsl:when test="@width &lt; $cSize * string-length($txt) * 0.25 and meta[@rel='model-levels']/level[1]/@width != 0 and count(meta[@rel='model-levels']/level) &gt; 1 and ($h - $level-h &lt; $mHeight)">
+							<xsl:variable name="min-width">
+								<xsl:for-each select="meta[@rel='model-levels']/level">
+									<xsl:sort select="@width" order="ascending" data-type="number"/>
+									<xsl:if test="position()=1"><xsl:value-of select="@width"/></xsl:if>
+								</xsl:for-each>
+							</xsl:variable>
+							<xsl:if test="$min-width  = @width or @width - $min-width &gt; $inlineLabel and string-length($txt) &gt; 12">
+								<xsl:call-template name="inline-label">
+									<xsl:with-param name="y0" select="$y  - $translate-y "/>
+								</xsl:call-template>
+							</xsl:if>
+						</xsl:when>
+						<xsl:when test="$pkgLabelSize  &lt;= $h - $level-h "/>  <!--  plenty of room on bottom, no need for inline label -->
+						<xsl:when test="ancestor::SystemDefinition[@detail='collection' or @detail='component' or @detail='layer']">
+							<xsl:call-template name="inline-label">
+								<xsl:with-param name="y0" select="$y  - $translate-y "/>
+							</xsl:call-template>
+						</xsl:when>
+					</xsl:choose>
+					<xsl:call-template name="display-name"/>
+				</text>
+			</xsl:with-param>
+		</xsl:call-template>
+		
+
+
+		<g>
+			<xsl:if test="$padding !=0"><xsl:attribute name="transform">translate(0 <xsl:value-of select="0.5* $padding"/>)</xsl:attribute></xsl:if>
+			<xsl:apply-templates select="." mode="detail-stuff"/>		
+			<xsl:apply-templates select="*"/>	
+		</g>
+
+	</g>
+</xsl:template>
+
+<!-- print pkg levels if desired -->
+<xsl:template match="package/meta[@rel='model-levels' and ancestor::SystemDefinition[@levels='show' and @detail='package']]" >
+	<xsl:for-each select="level">
+		<xsl:if test="@name">
+			<text text-anchor="start" class="level" x="{$groupDx}" width="{../../@width - 2 * $groupDx}" y="{count(../../parent::package) *$groupDy + (last() - position()) * ($mHeight + $groupDy) }" dy="0.75em">
+				<xsl:call-template name="display-name"/>
+			</text>
+		</xsl:if>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="package/meta[@rel='model-levels' and ancestor::SystemDefinition[@levels='expand']]">
+	<xsl:for-each select="level">
+		<xsl:if test="@name">
+			<xsl:variable name="y" select="count(../../parent::package) * $groupDy + (last() - position()) * ($mHeight + $groupDy) + 0.5 * $mHeight"/>
+			<text text-anchor="middle" class="level" x="{../../@width - $levelExpandName * 0.2 }" width="{$mMinWidth}" height="{$levelExpandName}" y="{$y}" transform="rotate(-90 {../../@width - $levelExpandName * 0.2 } {$y})" dy="0em">
+				<xsl:call-template name="display-name"/>
+			</text>
+		</xsl:if>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template name="inline-label"><xsl:param name="y0"/>
+	<xsl:variable name="thin-level">
+		<xsl:for-each select="meta[@rel='model-levels']/level">
+			<xsl:sort select="@width" order="ascending" data-type="number"/>
+			<xsl:sort select="count(preceding-sibling::level)" order="ascending" data-type="number"/> <!-- to make sure it's at the lowest level if there is a choice -->
+			<xsl:if test="position()=1"><xsl:value-of select="@name"/></xsl:if>
+		</xsl:for-each>
+	</xsl:variable>
+	<xsl:variable name="lev" select="meta[@rel='model-levels']/level[@name=$thin-level or $thin-level='' and not(@name)]"/>
+	<xsl:variable name="y" select="$y0 + count($lev/following-sibling::level) * ($mHeight +  $groupDy) + sum(@ipad) *0.5 "/>
+	<xsl:attribute name="dy">0.375em</xsl:attribute>
+	<xsl:attribute name="width"><xsl:value-of select="@width - $lev/@width"/></xsl:attribute>
+	<xsl:attribute name="x"><xsl:value-of select="0.5 * (@width +  $lev/@width)"/></xsl:attribute> <!-- centre-aligned -->
+	<xsl:attribute name="y"><xsl:value-of select="$y +  0.5 * $mHeight"/></xsl:attribute> <!-- middle-algined -->
+</xsl:template>
+
+
+
+<!--- sub-packages -->
+
+<xsl:template match="package/package"  priority="2">
+	<xsl:variable name="x">
+		<xsl:call-template name="sum-list">
+			<xsl:with-param name="list">
+				<xsl:value-of select="sum(preceding-sibling::package/@width) + $groupDx * count(preceding-sibling::package)"/>
+		<xsl:text> </xsl:text>
+		<xsl:apply-templates mode="effective-width" select="preceding-sibling::collection[following-sibling::*[1][self::package]]">
+			<xsl:with-param name="levels"><xsl:copy-of select="../meta[@rel='model-levels']/level"/></xsl:with-param>
+		</xsl:apply-templates>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+
+	<g id="{@id}" transform="translate({$x})">
+		<xsl:call-template name="my-class"/>
+		<xsl:apply-templates select="." mode="filter"/>
+		<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>		
+		<xsl:apply-templates select="." mode="animate-color"/>
+        <xsl:apply-templates select="." mode="multi-color"/>		
+		<rect class="{name()}" x="0" height="{@height}" width="{@width}" y ="0">
+			<xsl:if test="not(collection) or ancestor::SystemDefinition/@detail=name()">
+				<!-- to make room for the block label -->
+				<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
+			</xsl:if>
+			<xsl:call-template name="styles"/>
+		</rect>
+
+
+		<xsl:variable name="overlay"><xsl:apply-templates select="." mode="overlay-styles"/></xsl:variable>
+		<xsl:variable name="cur" select="."/>
+		<xsl:for-each select="exslt:node-set($overlay)/*">
+			<rect x="0" height="{$cur/@height}" width="{$cur/@width}" y ="0" style="{.}">
+				<xsl:if test="not($cur/collection) or $cur/ancestor::SystemDefinition/@detail=name($cur)">
+					<!-- to make room for the block label -->
+					<xsl:attribute name="height"><xsl:value-of select="$cur/@height"/></xsl:attribute>
+				</xsl:if>
+			</rect>
+		</xsl:for-each>
+		<xsl:call-template name="linkable-content">
+			<xsl:with-param name="show">		
+				<!-- default is for not showing detail, since it's easy to calculate -->
+				<text text-anchor="middle" class="{name()}" dy="0.375em" x="{@width * 0.5}" width="{@width}" y="{0.5 * @height}">
+					<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'text'"/></xsl:apply-templates>
+						<xsl:if test="not(ancestor::SystemDefinition/@detail='package')">
+							<xsl:call-template name="inline-label">
+								<xsl:with-param name="y0" select="0"/>
+							</xsl:call-template>
+						</xsl:if>
+					<xsl:call-template name="display-name"/>
+				</text>
+			</xsl:with-param>
+		</xsl:call-template>
+		<g><xsl:apply-templates select="." mode="detail-stuff"/>
+			<xsl:apply-templates select="*"/>
+		</g>	
+	</g>
+</xsl:template>
+
+
+<!-- ====== collections  ============= -->
+
+<xsl:template match="collection">
+<xsl:variable name="y" >
+	<xsl:choose>
+		<xsl:when test="ancestor::package/@levels or not(ancestor::layer/meta[@rel='model-levels'])">
+			<!-- the positions come from the pkg only -->
+			<xsl:value-of select="count(../meta[@rel='model-levels']/level[(current()[not(@level)] and not(@name)) or @name=current()/@level]/following-sibling::level) * ($mHeight +  $groupDy)"/> 
+		</xsl:when>
+		<xsl:otherwise>
+			<!-- the positions come from the levels from the layer -->
+			<xsl:variable name="lev" select="ancestor::layer/meta[@rel='model-levels']/level[(current()[not(@level)] and not(@name)) or @name=current()/@level]/following-sibling::level"/>
+			<xsl:value-of select="sum($lev/@height) + $groupDy * count($lev)"/> 
+		</xsl:otherwise>	
+	</xsl:choose>
+</xsl:variable>
+
+	<xsl:variable name="on-level" select="preceding-sibling::collection[(current()[not(@level)] and not(@level)) or @level=current()/@level]"/>
+	
+
+<xsl:variable name="x">
+	<xsl:choose>
+		<xsl:when test="../package and not(preceding-sibling::package)">
+			<!-- treat as if it's a normal collection-->
+			<xsl:value-of  select="sum($on-level/@width) + $groupDx * count($on-level) "/>
+		</xsl:when>
+		<xsl:when test="../package">
+			<xsl:call-template name="sum-list">
+				<xsl:with-param name="list">	
+					<xsl:value-of select="sum(preceding-sibling::package/@width) + $groupDx * count(preceding-sibling::package)"/>
+					<xsl:text> </xsl:text>
+					<xsl:apply-templates mode="effective-width" select="preceding-sibling::collection[following-sibling::*[1][self::package]]">
+						<xsl:with-param name="levels"><xsl:apply-templates select=".." mode="levels"/></xsl:with-param>
+					</xsl:apply-templates>
+					<xsl:variable name="prev" select="preceding-sibling::collection[preceding-sibling::package[@id=current()/preceding-sibling::package[1]/@id]][@level = current()/@level or (not(@level) and not(current()/@level))]"/>
+					<xsl:if test="$prev">
+						<xsl:value-of select="concat(sum($prev/@width) + $groupDx * count($prev), ' ')"/>
+					</xsl:if>
+				</xsl:with-param>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+		<xsl:value-of  select="sum($on-level/@width) + $groupDx * count($on-level) "/>
+		</xsl:otherwise>
+	</xsl:choose>
+	</xsl:variable>
+	
+	
+	<g id="{@id}" transform="translate({$x} {$y})"><xsl:apply-templates select="." mode="filter"/>
+		<xsl:call-template name="my-class"/>
+		<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>
+		<xsl:apply-templates select="." mode="animate-color"/>
+        <xsl:apply-templates select="." mode="multi-color"/>
+		<rect class="{name()}" x="0" y="0" height="{@height}" width="{@width}">
+			<xsl:call-template name="styles"/>
+		</rect>
+		<xsl:variable name="overlay"><xsl:apply-templates select="." mode="overlay-styles"/></xsl:variable>
+		<xsl:variable name="cur" select="."/>
+		<xsl:for-each select="exslt:node-set($overlay)/*">
+			<rect width="{$cur/@width}" height="{$cur/@height}" x="0" y="0" style="{.}"/>
+		</xsl:for-each>
+		
+		
+		
+		<xsl:call-template name="linkable-content">
+			<xsl:with-param name="show">
+			<!-- dy=1em means top align, but leave a bit of space up there so the top of the text is not flush against the border
+				The alternative would be set y to a fixed offset (like the 1.4 x-offset) and use dy="0.75em" to make the text be
+				flush against this offset, but I suspect the 1em method will look better in a wider variety of fonts--> 
+				<text  text-anchor="start" dy="1em" class="collection" y="0" x="1.4" width="{@width - 1.4}">
+					<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'text'"/></xsl:apply-templates>
+					<xsl:choose>
+						<xsl:when test="not(component) or ancestor::SystemDefinition/@detail='collection' ">
+							<xsl:attribute name='text-anchor'>middle</xsl:attribute>
+							<xsl:attribute name='x'><xsl:value-of select="@width * 0.5"/></xsl:attribute>
+							<xsl:attribute name='dy'>0.375em</xsl:attribute> <!-- middle align if no content -->
+							<xsl:attribute name="y"><xsl:value-of select="@height * 0.5"/></xsl:attribute>
+							<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
+						</xsl:when>
+						<xsl:otherwise>
+							<xsl:attribute name="height"><xsl:value-of select="@height - component/@height"/></xsl:attribute> <!--all children are the same size -->
+						</xsl:otherwise>
+					</xsl:choose>
+					<xsl:call-template name="display-name"/>
+				</text>
+			</xsl:with-param>
+		</xsl:call-template>
+		<g transform="translate(0 {@height - $cSize})">
+			<xsl:apply-templates select="." mode="detail-stuff"/>
+			<xsl:apply-templates select="*"/>
+		</g>		
+	</g>
+</xsl:template>
+
+
+<!-- ====== components  ============= -->
+
+<xsl:template match="component|cmp">
+	<xsl:param name="spacing" select="0"/>
+	<!-- the bulk of the following is for cmp, not component -->
+	<xsl:variable name="x-pos">
+		<xsl:choose>
+			<xsl:when test="self::cmp">
+				<xsl:value-of select="sum(preceding-sibling::*/@width | preceding-sibling::*/@rpad | ../@label-width) "/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="sum(preceding-sibling::component/@width) "/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<g id="{@id}">
+		<xsl:call-template name="my-class"/>
+		<xsl:apply-templates select="." mode="filter"/>
+		<xsl:if test="parent::collection">
+			<xsl:apply-templates select="." mode="animate-color"/>
+	        <xsl:apply-templates select="." mode="multi-color"/>			
+		</xsl:if>
+		<xsl:variable name="ref"><xsl:apply-templates select="." mode="shape"/></xsl:variable>
+		<use width="{@width}" height="{@height}" x="{$x-pos}" y="0" xlink:href="{$ref}">
+			<xsl:variable name="style"><xsl:apply-templates select="." mode="display-style"/></xsl:variable>
+			<xsl:if test="string-length($style) &gt; 1">
+				<xsl:attribute name="style"><xsl:value-of select="$style"/></xsl:attribute>
+			</xsl:if>
+		</use>
+		<xsl:variable name="overlay"><xsl:apply-templates select="." mode="overlay-styles"/></xsl:variable>
+		<xsl:variable name="cur" select="."/>
+		<xsl:for-each select="exslt:node-set($overlay)/*">
+			<use width="{$cur/@width}" height="{$cur/@height}" x="{$x-pos}" y="0" style="{.}" xlink:href="{$ref}"/>
+		</xsl:for-each>
+		<xsl:call-template name="linkable-content">
+			<xsl:with-param name="show">
+				<text text-anchor="middle" dy="0.375em"  class="component" y="{@height * 0.5 + 0.15}" width="{@width}" height="{@height}" x="{$x-pos + 0.5 * @width}">
+					<xsl:call-template name="display-name"/>
+				</text>
+			</xsl:with-param>
+		</xsl:call-template>
+	</g>
+</xsl:template>
+
+
+<!-- ============ Detail options============ -->
+
+<!-- don't show when not enough detail -->
+<xsl:template match="component[not(ancestor::SystemDefinition[@detail='component' or not(@static='true' or @detail-type='fixed')]) ]" priority="9"/>
+<xsl:template match="collection[  ancestor::SystemDefinition[(@detail='layer' or @detail='package') and (@static='true'  or @detail-type='fixed')] 	]" priority="9"/>
+<xsl:template match="package[ancestor::SystemDefinition[@detail='layer'  and (@static='true'  or @detail-type='fixed')] ]" priority="9"/>
+
+<xsl:template match="*[ancestor::SystemDefinition/@detail='component']" mode="detail-stuff" priority="9"/>
+<xsl:template match="*" mode="detail-stuff" priority="-5"/>
+
+<xsl:template match="*[ancestor::SystemDefinition/@static='true']" mode="detail-stuff" priority="7"/>
+<xsl:template match="*[ancestor::SystemDefinition/@detail-type='fixed']" mode="detail-stuff" priority="8"/>
+
+<xsl:template match="collection[ancestor::SystemDefinition/@detail!='collection'] | *[(ancestor::SystemDefinition/@detail='collection') and not(self::collection)]" mode="detail-stuff" priority="5"/>
+
+<xsl:template match="collection|package[ancestor::SystemDefinition/@detail='package' and not(package)] | layer[ancestor::SystemDefinition/@detail=name()]" mode="detail-stuff">
+	<xsl:param name="s" select="'content'"/>
+	<xsl:choose>
+		<xsl:when test="$s='mouseover'">
+			<xsl:attribute name="onmouseover">on('<xsl:value-of select="name()"/>-content-<xsl:value-of select="@id"/>');off('<xsl:value-of select="name()"/>-label-<xsl:value-of select="@id"/>');</xsl:attribute>
+			<xsl:attribute name="onmouseout">off('<xsl:value-of select="name()"/>-content-<xsl:value-of select="@id"/>');on('<xsl:value-of select="name()"/>-label-<xsl:value-of select="@id"/>');</xsl:attribute>
+		</xsl:when>
+		<xsl:when test="$s='text'">
+			<xsl:attribute name="id"><xsl:value-of select="name()"/>-label-<xsl:value-of select="@id"/></xsl:attribute>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:attribute name="id"><xsl:value-of select="name()"/>-content-<xsl:value-of select="@id"/></xsl:attribute>
+			<xsl:attribute name="visibility">hidden</xsl:attribute>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template priority="8" match="package[package and ancestor::SystemDefinition/@detail='package']/collection" mode="detail-stuff"><xsl:param name="s" select="'content'"/>
+	<xsl:if test="$s='mouseover'">
+		<xsl:attribute name="id"><xsl:value-of select="name()"/>-content-<xsl:value-of select="@id"/></xsl:attribute>
+		<xsl:attribute name="visibility">hidden</xsl:attribute>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="layer[ancestor::SystemDefinition/@detail=name() or not(package)]" mode="detail-stuff"><xsl:param name="s" select="'content'"/>
+	<xsl:choose>
+		<xsl:when test="$s='mouseover'">
+			<xsl:attribute name="onmouseover">on('<xsl:value-of select="name()"/>-content-<xsl:value-of select="@id"/>')</xsl:attribute>
+			<xsl:attribute name="onmouseout">off('<xsl:value-of select="name()"/>-content-<xsl:value-of select="@id"/>')</xsl:attribute>
+		</xsl:when>
+		<xsl:when test="$s!='text'">
+			<xsl:attribute name="id"><xsl:value-of select="name()"/>-content-<xsl:value-of select="@id"/></xsl:attribute>
+			<xsl:attribute name="visibility">hidden</xsl:attribute>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+<xsl:template match="*[ancestor::systemModel/@detail='layer' and not(self::layer)]" mode="detail-stuff"/>
+
+
+<xsl:template name="navctrl">	
+ <g id="Zoom" onload="resized()">
+ <set attributeType="CSS" attributeName="opacity"  to="0.8"  fill="freeze" begin="Zoom.mouseover"/>
+ <set attributeType="CSS" attributeName="opacity"  to="0.8"  fill="freeze" begin="Zoomin.mouseover"/>
+ <set attributeType="CSS" attributeName="opacity"  to="0.8"  fill="freeze" begin="Zoomout.mouseover"/>
+  <animate attributeType="CSS" attributeName="opacity" from="0.8" to="0" fill="freeze" dur="0.5s" begin="10s"/>
+  <animate attributeType="CSS" attributeName="opacity"  from="0.8" to="0"  fill="freeze" dur="0.2s" begin="Zoom.mouseout" />
+  <animate attributeType="CSS" attributeName="opacity"  from="0.8" to="1"  fill="freeze" dur="0.5s" begin="0.3s" />
+
+ <path d="M0,0 l15,0 l0,30 a 7.5,7.5 18 0,1 -15, 0Z" fill="rgb(0,102,153)" opacity="0.8"/>
+ <g onclick="zoom(1.25)">
+ 	<path d="M7.5,4.5 l0,3 m1.5,-1.5 l-3,0" stroke="yellow" stroke-width="1" pointer-events="none" />
+ 	<circle id="Zoomin" r="4.5" cx="7.5" cy="6" fill="url(#Patternoutgrad)">
+ 		<set attributeType="XML" attributeName="fill" to="url(#Patterningrad)" fill="freeze" begin="Zoomin.mouseover" />
+ 		<set attributeType="XML" attributeName="fill" to="url(#Patternoutgrad)" fill="freeze" begin="Zoomin.mouseout" />
+ 	</circle>
+ </g>
+ <g onclick="zoom(0.8)">
+ 	<path d="M5.5,18 l4,0" stroke="yellow" stroke-width="1" pointer-events="none" />
+ 	<circle r="4.5" cx="7.5" cy="18" fill="url(#Patternoutgrad)" id="Zoomout">
+ 		<set attributeType="XML" attributeName="fill" to="url(#Patterningrad)" fill="freeze" begin="Zoomout.mouseover" />
+ 		<set attributeType="XML" attributeName="fill" to="url(#Patternoutgrad)" fill="freeze" begin="Zoomout.mouseout" />
+ 	</circle>
+ </g>
+ <path id="MoveUp" d="M7.5,25  l1.5,3 l-3,0 Z" fill-opacity="0.2" stroke-opacity="0.7" stroke-linejoin="round" fill="white" stroke="white" stroke-width="0.4" onmousedown="repeatpan(0,20)" onmouseup="endpanning()">
+ 		<set attributeType="XML" attributeName="stroke" to="yellow" end="MoveUp.mouseout" begin="MoveUp.mouseover" />
+ 	</path>
+ 	<path id="MoveDown" d="M6,33  l3,0 l-1.5,3 Z" fill-opacity="0.2" stroke-linejoin="round" stroke-opacity="0.7" fill="white" stroke="white" stroke-width="0.4" onmousedown="repeatpan(0,-20)" onmouseup="endpanning()">
+ 		<set attributeType="XML" attributeName="stroke" to="yellow" end="MoveDown.mouseout" begin="MoveDown.mouseover" />
+ 	</path>
+ 	<path id="MoveRight" d="M10,29  l3,1.5 l-3,1.5 Z" fill-opacity="0.2" stroke-linejoin="round" stroke-opacity="0.7" fill="white" stroke="white" stroke-width="0.4" onmousedown="repeatpan(-20,0)" onmouseup="endpanning()">
+ 		<set attributeType="XML" attributeName="stroke" to="yellow" end="MoveRight.mouseout" begin="MoveRight.mouseover" />
+ 	</path>
+ 	<path id="MoveLeft" d="M5,29  l0,3 l-3,-1.5 Z" fill-opacity="0.2" stroke-linejoin="round" stroke-opacity="0.7" fill="white" stroke="white" stroke-width="0.4" onmousedown="repeatpan(20,0)" onmouseup="endpanning()">
+ 		<set attributeType="XML" attributeName="stroke" to="yellow" end="MoveLeft.mouseout" begin="MoveLeft.mouseover" />
+ 	</path>
+ 	</g>
+</xsl:template>
+
+
+<xsl:include href="draw-model.xsl"/>
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/filtersysdef-module.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ 	<xsl:output method="xml" indent="yes"/>
+<!-- rules for filtering out system model items -->
+
+<!-- sysdef is the "data" element from the Model XML that filters are called on -->  
+<xsl:template match="sysdef" mode="filter" priority="1"><xsl:param name="item"/>
+	<xsl:variable name="result">		<!-- the ordered list of all ignores and filters, the last value is the one to note --> 
+		<xsl:choose>
+			<xsl:when test="$item[self::meta]">
+				<xsl:apply-templates select="ignore|../ignore" mode="filter">
+					<xsl:with-param name="item" select="$item"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:when test="$item[self::unit]">	
+				<!-- only filter to determine if it's shown -->
+				<xsl:apply-templates select="filter|../filter" mode="filter">
+					<xsl:with-param name="item" select="$item"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:when test="$item/@id">	
+				<!-- has an ID, so, use vars to save trouble of recalulating each time -->
+				<xsl:variable name="id"><xsl:apply-templates select="$item/@id" mode="my-id"/></xsl:variable>			<!-- namespaceless ID of this here -->
+				<xsl:variable name="ns"><xsl:apply-templates select="$item/@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace -->
+				<!-- use ignore and filter to determine if it's shown-->
+				<xsl:apply-templates select="ignore[not(@meta or @meta-type)]|filter|../ignore[not(@meta or @meta-type)]|../filter" mode="filter">
+					<xsl:with-param name="id" select="$id"/>
+					<xsl:with-param name="ns" select="$ns"/>
+					<xsl:with-param name="item" select="$item"/>
+				</xsl:apply-templates>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="contains(concat(' ',normalize-space($result),' '),' ignore ')">hide</xsl:when>
+		<xsl:otherwise>
+			<xsl:variable name="display"> <!-- the last value in result -->
+				<xsl:call-template name="notbefore">
+						<xsl:with-param name="string" select="normalize-space($result)"/>
+						<xsl:with-param name="substr" select="' '"/>
+				</xsl:call-template>
+			</xsl:variable>
+
+					
+			<!-- if $display is empty or 'show' then return nothing (ie show), any other value return that -->
+			<xsl:if test="$display!='show'">
+				<xsl:value-of select="$display"/>
+			</xsl:if>	
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- ignore a specific referenced ID -->
+<xsl:template match="ignore[@ref]" mode="filter" priority="2"><xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/>
+	<xsl:variable name="this-id"><xsl:apply-templates select="@ref" mode="my-id"/></xsl:variable>						<!-- namespaceless ID of this here -->
+	<xsl:variable name="this-ns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace -->
+	<xsl:if test="$id = $this-id and $ns = $this-ns"> ignore </xsl:if>
+</xsl:template>
+
+<!-- ignore an entire namespace -->
+<xsl:template match="ignore[@namespace]" mode="filter" priority="2"><xsl:param name="ns"/>
+	<xsl:if test="@namespace = $ns"> ignore </xsl:if>
+</xsl:template>
+
+<!-- ignore by human-readable name and item type (deprecated) -->
+<xsl:template match="ignore[not(@ref) and @name and @type]" mode="filter" priority="1"><xsl:param name="item"/>
+	<!-- old way of doing this -->
+	<xsl:if test="$item/@name=@name and name($item)= @type"> ignore </xsl:if>
+</xsl:template>
+
+
+<xsl:template match="ignore[@meta]" mode="filter" priority="2"><xsl:param name="item"/>
+	<!-- ignore certain metadata rel values -->
+	<xsl:if test="$item[self::meta] and (@meta='*' or $item/@rel=@meta  or (not($item/@rel) and @meta='Generic'))
+		and
+		(not(@meta-type) or  $item/@type=@meta-type or  (@meta-type='auto' and not($item/@type)))"> ignore </xsl:if>
+</xsl:template>
+
+<xsl:template match="ignore[@meta-type]" mode="filter" priority="1"><xsl:param name="item"/>
+	<!-- ignore certain metadata types, no rel values specified -->
+	<xsl:if test="$item[self::meta] and $item/@type=@meta-type or (not($item/@type) and @meta-type='Generic')"> ignore </xsl:if>
+</xsl:template>
+ 
+<xsl:template match="filter" mode="filter"  priority="1"><xsl:param name="item"/>
+	<xsl:variable name="att" select="@select"/>
+	<xsl:choose>
+		<xsl:when test="not($item[self::component or self::unit or self::collection or self::package or self::layer])"/>
+		<xsl:when test="@select='*'"> <!-- always matches -->
+			<xsl:value-of select="concat(' ',@display,' ')"/>
+		</xsl:when>
+		<xsl:when test="not($item/@*[name()=$att])"/> <!-- this filter does not match this item-->
+		<xsl:when test="not(@value) or @value='*'">	<!-- true if just checking for the presence of the attribute on the item -->
+				<xsl:value-of select="concat(' ',@display,' ')"/>
+		</xsl:when>
+		<xsl:when test="@select='filter' and contains(@value,',')">
+			<!--  all items in @value must be in the comma-separated list of filter on this or child-->
+			<xsl:variable name="ok">
+				<xsl:call-template name="all-in-list">
+					<xsl:with-param name="list" select="$item/@filter"/>
+					<xsl:with-param name="items" select="@value"/>
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:if test="$ok=1">
+				<xsl:value-of select="concat(' ',@display,' ')"/>
+			</xsl:if>
+		</xsl:when>
+		<xsl:when test="@select='filter'">
+			<!--  @value must be in the comma-separated list of filter -->
+			<xsl:if test="contains(concat(',',$item/@filter,','),concat(',',@value,','))">
+				<xsl:value-of select="concat(' ',@display,' ')"/>
+			</xsl:if>
+		</xsl:when>
+		<xsl:when test="@select='class' and contains(@value,' ')">
+			<!--  all items in @value must be in the whitespace-separated list -->
+			<xsl:variable name="ok">
+				<xsl:call-template name="all-in-list">
+					<xsl:with-param name="list" select="normalize-space($item/@class)"/>
+					<xsl:with-param name="items" select="@value"/>
+					<xsl:with-param name="separator" select="' '"/>
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:if test="$ok=1">
+				<xsl:value-of select="concat(' ',@display,' ')"/>
+			</xsl:if>
+		</xsl:when>
+		<xsl:when test="@select='class'">
+			<!--  @value must be in the whitespace-separated list -->
+			<xsl:if test="contains(concat(' ',normalize-space($item/@class),' '),concat(' ',@value,' '))">
+				<xsl:value-of select="concat(' ',@display,' ')"/>
+			</xsl:if>
+		</xsl:when>
+		<!--  any other attribute must match exactly on the component -->
+		<xsl:when test="@value= $item/@*[name()=$att]">
+				<xsl:value-of select="concat(' ',@display,' ')"/>
+		</xsl:when>
+	</xsl:choose>	
+</xsl:template>
+
+
+<!-- utility functions follow -->
+
+<!-- return 1 if all items in $items are in the list $list -->
+<xsl:template name="all-in-list"><xsl:param name="list"/><xsl:param name="items"/><xsl:param name="separator" select="','"/>
+	<xsl:variable name="elist" select="concat($separator,$list,$separator)"/>
+	<xsl:choose>
+		<xsl:when test="contains($items,$separator)">
+			<xsl:variable name="item" select="concat($separator,substring-before($items,$separator),$separator)"/>
+			<xsl:if test="contains($elist,$item) or (starts-with($item,'!') and not(contains($elist,substring($item,2))))">
+				<xsl:call-template name="all-in-list">
+					<xsl:with-param name="list" select="$list"/>
+					<xsl:with-param name="separator" select="$separator"/>
+					<xsl:with-param name="items" select="substring-after($items,$separator)"/>
+				</xsl:call-template>
+			</xsl:if>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:variable name="item" select="concat($separator,$items,$separator)"/>
+			<xsl:if test="contains($elist,$item) or (starts-with($item,'!') and not(contains($elist,substring($item,2))))">1</xsl:if>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- return the filename in a path -->
+ <xsl:template name="notbefore"><xsl:param name="string"/><xsl:param name="substr" select="'/'"/>
+ 	<xsl:choose>
+        <xsl:when test="not(contains($string,$substr))">
+	        <xsl:value-of select="$string"/>
+	      </xsl:when>
+	      <xsl:otherwise>
+        <xsl:call-template name="notbefore">
+                <xsl:with-param name="string" select="substring-after($string,$substr)"/>
+                <xsl:with-param name="substr" select="$substr"/>
+        </xsl:call-template>
+        </xsl:otherwise>
+       </xsl:choose>
+</xsl:template>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/joinmodel.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+	All rights reserved.
+	This component and the accompanying materials are made available
+	under the terms of the License "Eclipse Public License v1.0"
+	which accompanies this distribution, and is available
+	at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+	Initial Contributors:
+	Nokia Corporation - initial contribution.
+	Contributors:
+	Description:
+	Create a stand-alone sysdef from a linked set of fragments
+-->
+ 	<xsl:output method="xml" indent="yes"/>
+<!-- create a stand-alone sysdef from a linked set of fragments -->
+
+<xsl:template match="/model">
+	<xsl:apply-templates select="sysdef[1]" mode="join-sysdef-from-model"/>
+</xsl:template>
+
+<xsl:template mode="join-sysdef-from-model" match="/model/sysdef">
+	<xsl:apply-templates select="document(@href,.)/*" mode="join">
+		<xsl:with-param name="filename">
+			<xsl:call-template name="lastbefore">
+				<xsl:with-param name="string">
+					<xsl:choose>
+						<xsl:when test="@path"><xsl:value-of select="@path"/></xsl:when>
+						<xsl:when test="@path-prefix and starts-with(@href,@path-prefix)"><xsl:value-of select="substring(@href,string-length(@path-prefix) + 1)"/></xsl:when>
+						<xsl:otherwise><xsl:value-of select="@href"/></xsl:otherwise>
+					</xsl:choose>								
+				</xsl:with-param>
+			</xsl:call-template>
+		</xsl:with-param>
+		<xsl:with-param name="data" select="current()"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+
+<xsl:include href="joinsysdef-module.xsl"/>
+<xsl:include href="filtersysdef-module.xsl"/>
+<xsl:include href="overlay-module.xsl"/>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/joinsysdef-module.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,527 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+ 	xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="exslt">
+<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+	All rights reserved.
+	This component and the accompanying materials are made available
+	under the terms of the License "Eclipse Public License v1.0"
+	which accompanies this distribution, and is available
+	at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+	Initial Contributors:
+	Nokia Corporation - initial contribution.
+	Contributors:
+	Description:
+	XSLT module which contains the logic to join a system definition file
+-->
+	<!-- save SF namespace as a constant to avoid the risk of typos-->
+ <xsl:variable name="defaultns">http://www.symbian.org/system-definition</xsl:variable>
+ 
+<!-- create a stand-alone sysdef from a linked set of fragments -->
+
+<xsl:template match="/*" mode="join">
+	<xsl:param name="filename"/>
+	<xsl:message terminate="yes">ERROR: Cannot process this document<xsl:if test="$filename !=''"> (<xsl:value-of select="$filename"/>)</xsl:if>
+		<xsl:choose>
+			<xsl:when test="self::SystemDefinition/@schema">. Unrecognised syntax schema="<xsl:value-of select="@schema"/>"</xsl:when>
+			<xsl:when test="self::SystemDefinition">. Missing schema</xsl:when>
+			<xsl:otherwise>. Invalid file type: <xsl:value-of select="name()"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:message>
+</xsl:template>
+
+<!-- anything in schemas 3.0.x won't add new functional attributes that need processing here, just blindly copy them-->
+
+<xsl:template match="/SystemDefinition[starts-with(@schema,'3.0.') and count(*)=1]" mode="join">
+	<xsl:param name="origin" select="/.."/>
+	<xsl:param name="root"/>
+	<xsl:param name="filename"/>
+	<xsl:param name="namespaces"/>
+	<xsl:param name="data" select="/.."/>
+	<xsl:choose>
+		<xsl:when test="$origin">	<!-- this sysdef fragment was linked from a parent sysdef -->
+			<xsl:for-each select="*"> <!-- can be only one -->
+				<xsl:variable name="upid"><xsl:apply-templates select="$origin/@id" mode="my-id"/></xsl:variable>		<!-- namespaceless ID of this in parent doc -->
+				<xsl:variable name="id"><xsl:apply-templates select="@id" mode="my-id"/></xsl:variable>						<!-- namespaceless ID of this here -->
+				<xsl:variable name="upns"><xsl:apply-templates select="$origin/@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace in parent doc -->
+				<xsl:variable name="ns"><xsl:apply-templates select="@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace -->
+				<xsl:if test="$id!=$upid or $ns!=$upns">
+					<xsl:message terminate="yes">ERROR: Linked ID "<xsl:value-of select="$id"/>" (<xsl:value-of select="$ns"/>) must match linking document "<xsl:value-of select="$upid"/>" (<xsl:value-of select="$upns"/>)</xsl:message>
+				</xsl:if>
+				<!-- copy any attributes not already defined (parent doc overrides child doc)-->
+				<xsl:for-each select="@*">
+					<xsl:variable name="n" select="name()"/>
+					<xsl:choose>
+						<xsl:when test="$n='id'"/> <!-- never copy this, always set -->
+						<xsl:when test="$origin/@*[name()=$n]"> <!-- don't copy if already set -->
+							<xsl:message>Note: Cannot set "<xsl:value-of select="$n"/>", already set on <xsl:value-of select="$origin/@id"/>. Ignoring linked value</xsl:message>
+						</xsl:when>
+						<xsl:when test="$n='before' or $n='replace'">
+							<!-- ensure ns is correct (if any future attribtues will ever use an ID, process it here too)-->
+							<xsl:apply-templates select="." mode="join">
+								<xsl:with-param name="namespaces" select="$namespaces"/>
+							</xsl:apply-templates>
+						</xsl:when> 
+						<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- just copy anything else -->
+					</xsl:choose>
+				</xsl:for-each>
+				<xsl:copy-of select="../namespace::*[not(.=$namespaces)]"/> <!-- set any namespaces not already set (they should all alreayd be, but some XSLT processors are quirky) -->
+			 	<xsl:apply-templates select="$data" mode="overlay-attributes">
+					<xsl:with-param name="item" select="current()"/>
+				</xsl:apply-templates>
+				<xsl:variable name="content">									
+					<xsl:apply-templates select="*|comment()" mode="join">
+						<xsl:with-param name="root" select="$root"/>
+						<xsl:with-param name="filename" select="$filename"/>
+						<xsl:with-param name="data" select="$data"/>
+						<xsl:with-param name="namespaces" select="$namespaces | ../namespace::*[not(.=$namespaces)]"/>
+					</xsl:apply-templates>
+				</xsl:variable>
+				<xsl:apply-templates select="." mode="is-content-filtered"> <!-- optionally add filtered="yes" if some content has been removed -->
+					<xsl:with-param name="content" select="$content"/>
+				</xsl:apply-templates>
+			 	<xsl:apply-templates select="$data" mode="overlay-meta">
+					<xsl:with-param name="item" select="current()"/>
+				</xsl:apply-templates>
+				<xsl:copy-of select="$content"/>
+			</xsl:for-each>
+		</xsl:when>
+		<xsl:when test="function-available('exslt:node-set')"> <!-- this is the root element of a root sysdef -->
+			<!--try to put all namespaces in root element -->
+			<xsl:variable name="nss">
+				<!-- contains node set of namespaces to add to root element.
+					May panic if there are too many single-letter namespaces and this can't create a new one -->
+				<xsl:call-template name="needed-namespaces">
+					<xsl:with-param name="foundns">
+						<xsl:apply-templates select="//*[(self::component or self::collection or self::package or self::layer) and @href]" mode="scan-for-namespaces"/>
+					</xsl:with-param>
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:variable name="ns" select="@id-namespace | namespace::* | exslt:node-set($nss)/*"/>
+			<xsl:copy><xsl:copy-of select="@*[name()!='schema']"/><xsl:call-template name="set-schema"/>
+				<xsl:apply-templates select="self::*[not(@id-namespace)]" mode="add-id-ns"/>
+				<xsl:for-each select="exslt:node-set($nss)/*"> <!-- add namespace definitions -->
+					<xsl:attribute name="xmlns:{name()}">
+						<xsl:value-of select="."/>
+					</xsl:attribute>
+				</xsl:for-each>
+				<!-- no need to call is-content-filtered, it never will be from this element --> 
+				<xsl:apply-templates select="*|comment()" mode="join">
+					<xsl:with-param name="namespaces" select="$ns"/>
+					<xsl:with-param name="root" select="$root"/>
+					<xsl:with-param name="data" select="$data"/>
+					<xsl:with-param name="filename" select="$filename"/>
+				</xsl:apply-templates>
+			</xsl:copy>
+		</xsl:when>
+		<xsl:otherwise> <!-- can't handle node-set() so put the namespaces in the document instead of the root element-->
+			<xsl:variable name="ns" select="@id-namespace | namespace::*"/>
+			<xsl:copy><xsl:copy-of select="@*[name()!='schema']"/><xsl:call-template name="set-schema"/>
+				<!-- no need to call is-content-filtered, it never will be from this element -->
+				<xsl:apply-templates select="*|comment()" mode="join">
+					<xsl:with-param name="namespaces" select="$ns"/>
+					<xsl:with-param name="root" select="$root"/>
+					<xsl:with-param name="data" select="$data"/>
+					<xsl:with-param name="filename" select="$filename"/>
+				</xsl:apply-templates>
+			</xsl:copy>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="scan-for-namespaces"/> <!-- just in case of errors, consider replacing by terminate -->
+<xsl:template match="*[@href and not(self::meta)]" mode="scan-for-namespaces">
+	<!-- produce a list of namespace-prefix namespace pairs separated by newlines, in reverse order found in documents 
+		reverse order so we can try to use the first namespace prefix defined if it's available-->
+	<xsl:variable name="linked" select="document(@href,.)/*"/>
+	<xsl:for-each select="$linked">
+		<xsl:apply-templates select="//*[(self::component or self::collection or self::package or self::layer) and @href]" mode="scan-for-namespaces"/>
+		<xsl:for-each select="//namespace::*[.!='http://www.w3.org/XML/1998/namespace'] | @id-namespace">
+			<!-- ignore XML namespace -->
+			<xsl:value-of select="concat(name(),' ',.,'&#xa;')"/>
+		</xsl:for-each>
+	</xsl:for-each>
+	<xsl:if test="not($linked)">
+	<xsl:message>Note: The link to <xsl:value-of select="@href"/> from <xsl:value-of select="concat(name(),' ',@id)"/> could not be resolved. Perhaps there's an error in the XML?</xsl:message>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template name="needed-namespaces">
+	<xsl:param name="foundns"/>
+	<xsl:param name="usedpre"/>
+
+	<xsl:if test="$foundns!=''">
+		<xsl:variable name="line" select="substring-before($foundns,'&#xa;')"/> <!-- always has trailing newline -->
+		<xsl:variable name="name" select="substring-after($line,' ')"/> <!-- namespace prefix -->
+		<xsl:variable name="remainder" select="substring-after($foundns,'&#xa;')"/>
+		<xsl:variable name="newprefix">
+			<xsl:if test="not(contains(concat('&#xa;',$remainder),concat('&#xa;',$line,'&#xa;'))) and
+				not(//namespace::*[.=$name] or @id-namespace[.=$name] or (not(@id-namespace) and $defaultns=$name))">
+						<xsl:apply-templates select="." mode="ns-prefix">
+							<xsl:with-param name="ns" select="$name"/>
+							<xsl:with-param name="pre" select="substring-before($line,' ')"/>
+							<xsl:with-param name="dontuse" select="$usedpre"/>
+						</xsl:apply-templates>
+			</xsl:if>
+		</xsl:variable>
+		<xsl:if test="$newprefix!=''">
+			<!-- can treat this as if it were a namespace node -->
+			<xsl:element name="{$newprefix}">
+				<xsl:value-of select="$name"/>
+			</xsl:element>
+		</xsl:if>
+		<xsl:if test="$remainder!=''">
+			<xsl:call-template name="needed-namespaces">
+				<xsl:with-param name="foundns" select="$remainder"/>
+				<xsl:with-param name="usedpre" select="concat($usedpre,' ',$newprefix,' ')"/>
+			</xsl:call-template>
+		</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="/SystemDefinition" mode="ns-prefix">
+	<!-- should be able to replace this with mechanism that uses the XSLT processor's own ability to generate namespaces -->
+	<xsl:param name="ns"/>
+	<xsl:param name="pre"/>
+	<xsl:param name="dontuse"/>
+	<xsl:param name="chars">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</xsl:param>
+	<xsl:variable name="name" select="substring(substring-after($ns,'http://www.'),1,1)"/>
+	<xsl:choose>
+		<xsl:when test="$pre!='' and $pre!='id-namespace' and not(//namespace::*[name()=$pre]) and not(contains($dontuse,concat(' ',$pre,' ')))">
+			<xsl:value-of select="$pre"/>
+		</xsl:when>
+		<xsl:when test="$ns='' and $chars=''">
+			<xsl:message terminate="yes">ERROR: Cannot create namespace prefix for downstream default namespace in <xsl:value-of select="*/@id"/></xsl:message>
+		</xsl:when>
+		<xsl:when test="$name!='' and not(contains($dontuse,concat(' ',$name,' ')))"><xsl:value-of select="$name"/></xsl:when>
+		<xsl:when test="namespace::*[name()=substring($chars,1,1)] or contains($dontuse,concat(' ',substring($chars,1,1),' '))">
+			<xsl:apply-templates mode="ns-prefix">
+				<xsl:with-param name="chars" select="substring($chars,2)"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="substring($chars,1,1)"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!-- schema handling -->
+
+<xsl:template name="set-schema">
+<xsl:attribute name="schema">
+	<xsl:apply-templates mode="my-schema" select="/SystemDefinition"/>
+</xsl:attribute>
+</xsl:template>
+
+<xsl:template name="compare-versions"><xsl:param name="v1"/><xsl:param name="v2"/>
+			<xsl:choose>
+				<xsl:when test="$v1=''"><xsl:value-of select="$v2"/></xsl:when>
+				<xsl:when test="$v1=$v2 or $v2=''"><xsl:value-of select="$v1"/></xsl:when>
+				<xsl:when test="substring-before($v1,'.') &gt; substring-before($v2,'.')"><xsl:value-of select="$v1"/></xsl:when>
+				<xsl:when test="substring-before($v1,'.') &lt; substring-before($v2,'.')"><xsl:value-of select="$v2"/></xsl:when>
+				<xsl:when test="substring-before(substring-after($v1,'.'),'.') &gt; substring-before(substring-after($v2,'.'),'.')"><xsl:value-of select="$v1"/></xsl:when>
+				<xsl:when test="substring-before(substring-after($v1,'.'),'.') &lt; substring-before(substring-after($v2,'.'),'.')"><xsl:value-of select="$v2"/></xsl:when>
+				<xsl:when test="substring-after(substring-after($v1,'.'),'.') &gt; substring-after(substring-after($v2,'.'),'.')"><xsl:value-of select="$v1"/></xsl:when>
+				<xsl:when test="substring-after(substring-after($v1,'.'),'.') &lt; substring-after(substring-after($v2,'.'),'.')"><xsl:value-of select="$v2"/></xsl:when>
+				<xsl:otherwise><xsl:value-of select="$v1"/></xsl:otherwise>
+			</xsl:choose>
+</xsl:template>
+
+<xsl:template name="compare-version-list"><xsl:param name="list"/>
+	<xsl:variable name="cur" select="substring-before($list,' ')"/>
+	<xsl:variable name="remaining" select="substring-after($list,' ')"/>
+	<xsl:choose>
+		<xsl:when test="$remaining=''"><xsl:value-of select="$cur"/></xsl:when>
+		<xsl:otherwise>
+			<xsl:variable name="nextbig">
+				<xsl:call-template name="compare-version-list">
+					<xsl:with-param name="list" select="$remaining"/>
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:call-template name="compare-versions">
+				<xsl:with-param name="v1" select="$cur"/>
+				<xsl:with-param name="v2" select="$nextbig"/>
+			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="/SystemDefinition" mode="my-schema"><xsl:param name="biggest" select="@schema"/>
+	<xsl:variable name="linked" select="//*[(self::component or self::collection or self::package or self::layer) and @href]"/>
+	<xsl:choose>
+		<xsl:when test="not($linked)"> <!-- no need to go further -->
+			<xsl:call-template name="compare-versions">
+				<xsl:with-param name="v1" select="@schema"/>
+				<xsl:with-param name="v2" select="$biggest"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+				<xsl:call-template name="compare-version-list">
+					<xsl:with-param name="list">
+						<xsl:for-each select="$linked">
+						<xsl:call-template name="compare-versions">
+							<xsl:with-param name="v1">
+								<xsl:apply-templates mode="my-schema" select="document(@href,.)/*"/>
+							</xsl:with-param>
+							<xsl:with-param name="v2" select="$biggest"/>
+						</xsl:call-template>
+						<xsl:text> </xsl:text>
+					</xsl:for-each>
+				</xsl:with-param>
+				</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="unit" mode="join">	<xsl:param name="root"/><xsl:param name="filename"/><xsl:param name="data"/>
+	 <xsl:variable name="display">
+	 	<xsl:apply-templates select="$data" mode="filter">
+			<xsl:with-param name="item" select="current()"/>
+		</xsl:apply-templates>
+	 </xsl:variable>
+	 
+	 <xsl:if test="$display != 'hide' "> <!-- if hide, remove completely from the output-->	 
+		<xsl:element name="{name()}">
+			<xsl:apply-templates select="@*" mode="join">
+				<xsl:with-param name="root" select="$root"/>
+				<xsl:with-param name="filename" select="$filename"/>
+			</xsl:apply-templates>
+		</xsl:element>
+	</xsl:if>
+</xsl:template>
+
+<!-- override mode="meta" to translate metadata sections. By default, include -->
+<xsl:template match="meta" priority="2" mode="join"><xsl:param name="data"/>
+	 <xsl:variable name="display">
+	 	<xsl:apply-templates select="$data" mode="filter">
+			<xsl:with-param name="item" select="current()"/>
+		</xsl:apply-templates>
+	 </xsl:variable>
+	 
+	<xsl:if test="$display != 'hide' "> <!-- if hide, remove completely from the output-->	
+		<xsl:apply-templates select="." mode="meta"> 
+			<xsl:with-param name="display" select="$display"/>
+			<xsl:with-param name="data" select="$data"/>
+		</xsl:apply-templates>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="meta[@rel='link-mapping']" priority="3" mode="join"/> <!--these are only used in the joining process, so remove from output -->
+
+
+<xsl:template match="*" mode="join">
+	<xsl:param name="root"/><xsl:param name="filename"/><xsl:param name="namespaces"/><xsl:param name="data"/>
+	<!-- get attribtues from overlay -->
+	<!-- test for presence, if filtered out, just return -->
+	<!-- test for children, if it has some, but they're filtered out, either return or leave as empty, dependening on filter rule
+		if had items and now has none, options:
+			still has meta: keep / delete
+			still has comments: keep / delete 
+	 -->
+	 <xsl:variable name="display">
+	 	<xsl:apply-templates select="$data" mode="filter">
+			<xsl:with-param name="item" select="current()"/>
+		</xsl:apply-templates>
+	 </xsl:variable>
+	 
+	 <xsl:if test="$display != 'hide' "> <!-- if hide, remove completely from the output-->
+		 <xsl:variable name="href">
+		 	<xsl:apply-templates select="." mode="link">
+				<xsl:with-param name="data" select="$data"/>
+			</xsl:apply-templates>
+		 </xsl:variable>
+	 		 
+		<xsl:element name="{name()}"> <!-- use this instead of <copy> so xalan doesn't add extra wrong namespaces -->
+			<xsl:apply-templates select="@*" mode="join">
+				<xsl:with-param name="namespaces" select="$namespaces"/>
+			</xsl:apply-templates>
+			<xsl:if test="$display != '' ">
+				<!-- custom attribute to indicate how this is to be represented. Blank indicates normal, hide removes from the output (see above), anything else is put in the attribute --> 
+				<xsl:attribute name="display"><xsl:value-of select="$display"/></xsl:attribute>
+			</xsl:if>
+		 	<xsl:apply-templates select="$data" mode="overlay-attributes">
+				<xsl:with-param name="item" select="current()"/>
+			</xsl:apply-templates>			
+			<xsl:choose>
+				<xsl:when test="$href !='' ">
+					<xsl:variable name="prefixmap" select="ancestor::SystemDefinition/*/meta[@rel='link-mapping']/map-prefix[starts-with($href,@link)]"/>
+					<xsl:variable name="origin" select="."/>
+					<xsl:apply-templates select="document($href,.)/*" mode="join">
+						<xsl:with-param name="origin" select="$origin"/>
+						<xsl:with-param name="data" select="$data"/>
+						<xsl:with-param name="namespaces" select="$namespaces"/>
+						<xsl:with-param name="filename">
+							<xsl:call-template name="joinpath">
+								<xsl:with-param name="file" select="$filename"/>
+								<xsl:with-param name="rel">
+									<xsl:choose>
+										<xsl:when test="$prefixmap">
+											<xsl:value-of select="$prefixmap/@to"/>
+											<xsl:value-of select="substring-after($href,$prefixmap/@link)"/>
+										</xsl:when>
+										<xsl:otherwise>
+											<xsl:value-of select="$href"/>
+										</xsl:otherwise>
+									</xsl:choose>								
+								 </xsl:with-param>
+							</xsl:call-template>					
+						</xsl:with-param>
+						<xsl:with-param name="root">
+							<xsl:value-of select="$root"/>/<xsl:call-template name="lastbefore">
+								<xsl:with-param name="string" select="$href"/>
+							</xsl:call-template>
+						</xsl:with-param>
+					</xsl:apply-templates> 
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:variable name="content">
+						<xsl:apply-templates select="*|comment()" mode="join">
+							<xsl:with-param name="root" select="$root"/>
+							<xsl:with-param name="filename" select="$filename"/>
+							<xsl:with-param name="namespaces" select="$namespaces"/>
+							<xsl:with-param name="data" select="$data"/>
+						</xsl:apply-templates>
+					</xsl:variable>
+					<xsl:apply-templates select="." mode="is-content-filtered"> <!-- add filtered="yes" if some content has been removed -->
+						<xsl:with-param name="content" select="$content"/>
+					</xsl:apply-templates>
+				 	<xsl:apply-templates select="$data" mode="overlay-meta">
+						<xsl:with-param name="item" select="current()"/>
+					</xsl:apply-templates>
+					<xsl:copy-of select="$content"/>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:element>
+	</xsl:if>
+</xsl:template>
+
+<!-- By default, do nothing. Can override template to add filtered="yes" if need to track what's a placeholder and what's been filtered 
+	implement with param name="content"
+-->
+<xsl:template mode="is-content-filtered" match="*" priority="-2"/>
+
+
+<xsl:template match="@mrp[starts-with(.,'/')] | @bldFile[starts-with(.,'/')] | @base[starts-with(.,'/')]" mode="join">
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+
+<xsl:template match="@mrp|@bldFile|@base" mode="join">	<xsl:param name="root"/><xsl:param name="filename"/>
+	<xsl:attribute name="{name()}">
+		<xsl:call-template name="joinpath">
+			<xsl:with-param name="file" select="$filename"/>
+			<xsl:with-param name="rel" select="."/>
+		</xsl:call-template>	
+	</xsl:attribute>	
+</xsl:template>
+
+
+<xsl:template match="@href" mode="join"/> <!--never copy this into the generated doc, that's the whole point of this module -->
+
+<xsl:template match="@*" mode="my-namespace"> <!-- the namespace of an ID -->
+	<xsl:choose>
+		<xsl:when test="contains(.,':')">
+			<xsl:value-of select="ancestor::*/namespace::*[name()=substring-before(current(),':')]"/>
+		</xsl:when>
+		<xsl:when test="/SystemDefinition/@id-namespace">
+			<xsl:value-of select="/SystemDefinition/@id-namespace"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="$defaultns"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="@*" mode="my-id"> <!-- the ID with namespace prefix removed -->
+	<xsl:choose>
+		<xsl:when test="contains(.,':')">
+			<xsl:value-of select="substring-after(.,':')"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="."/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="err-path">
+<xsl:if test="../@id">
+	<xsl:apply-templates select=".." mode="err-path"/>/</xsl:if>
+<xsl:value-of select="@id"/>
+</xsl:template>
+
+
+<xsl:template match="@id|@before|@replace" mode="join">
+	<xsl:param name="namespaces"/>
+	<!-- this will change the namespace prefixes for all IDs to match the root document -->
+	<xsl:variable name="ns">
+		<xsl:apply-templates select="." mode="my-namespace"/>
+	</xsl:variable>
+	<xsl:if test="$ns=''">
+		<xsl:message terminate="yes">ERROR: Could not find namespace for <xsl:value-of select="name()"/> "<xsl:value-of select="."/>" in <xsl:apply-templates select="../.." mode="err-path"/>
+		<xsl:text>&#xa;</xsl:text>
+		</xsl:message>
+	</xsl:if>
+	<xsl:variable name="prefix" select="name($namespaces[.=$ns])"/>
+	<xsl:attribute name="{name()}">
+	<xsl:choose>
+		<xsl:when test="$prefix = 'id-namespace' or  (not($namespaces[name()='id-namespace']) and $ns=$defaultns)"/> <!-- it's the default namespace, no prefix -->
+		<xsl:when test="$prefix='' and contains(.,':')">
+			<!-- complex: copy id and copy namespace (namespace should be copied already)-->
+			<xsl:value-of select="."/>
+		</xsl:when>
+		<xsl:when test="$prefix='' and $ns=$defaultns"/> <!-- no prefix and it's the default --> 
+		<xsl:when test="$prefix!=''">			<!-- just change the prefix -->
+			<xsl:value-of select="concat($prefix,':')"/>
+		</xsl:when>
+		<xsl:otherwise>
+		<xsl:message terminate="yes">ERROR: Joining error in resolving namespace for <xsl:value-of select="name()"/> "<xsl:value-of select="."/>" in <xsl:apply-templates select="../.." mode="err-path"/>
+		<xsl:text>&#xa;</xsl:text></xsl:message>
+		</xsl:otherwise>
+	</xsl:choose>
+		<xsl:apply-templates select="." mode="my-id"/>
+	</xsl:attribute>
+</xsl:template>
+
+
+
+<xsl:template match="@*|comment()" mode="join"><xsl:copy-of select="."/></xsl:template>
+
+
+<xsl:include href="path-module.xsl"/>
+
+<!-- overridable templates follow -->
+
+
+<xsl:template match="*" mode="filter" priority="-9"/> <!-- by default show --> 
+<xsl:template match="*" mode="overlay-attributes" priority="-9"/> <!-- by default do nothing --> 
+<xsl:template match="*" mode="overlay-meta" priority="-9"/> <!-- by default do nothing --> 
+<xsl:template match="/SystemDefinition" mode="add-id-ns" priority="-9"/> <!-- some tools may have an easier job if this were always present, but, by default, assume it can just stay implied -->
+
+<xsl:template match="*" mode="link" priority="-1"> <!-- can be overriden to allow custom changes to href values --> 
+<xsl:value-of select="@href"/>
+</xsl:template>
+
+
+<xsl:template match="*" mode="meta" priority="-9"><xsl:param name="data"/><xsl:param name="display"/>
+	<xsl:element name="{name()}">
+		<xsl:copy-of select="@*[name()!='href']"/> <!-- copy all attributes as is, always drop href -->
+		<xsl:choose>
+			<xsl:when test="$display='local' and @href and contains(@href,':') and not(starts-with(@href,'file:'))">
+				<!-- non-local URL: only want local URLs, so keep href as is-->
+				<xsl:copy-of select="@href"/> 
+			</xsl:when>
+			<xsl:when test="@href">
+				<xsl:copy-of select="document(@href,.)/*"/> 
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:copy-of select="*|comment()"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:element>
+</xsl:template>
+
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/joinsysdef.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+	All rights reserved.
+	This component and the accompanying materials are made available
+	under the terms of the License "Eclipse Public License v1.0"
+	which accompanies this distribution, and is available
+	at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+	Initial Contributors:
+	Nokia Corporation - initial contribution.
+	Contributors:
+	Description:
+	Create a stand-alone sysdef from a linked set of fragments
+-->
+ 	<xsl:output method="xml" indent="yes"/>
+<!--Description:This creates a stand-alone sysdef from a linked set of fragments.
+All API metadata will be removed
+-->
+<!--Input:<sysdef> - (required) The 3.0 formatsystem definition XML file to
+		process. This can be a fragment or stand-alone. 
+		If there are no linked fragments, this will just convert all
+		relative unit paths into absolute paths and embed any linked
+		metadata-->
+
+<xsl:param name="path">/os/deviceplatformrelease/foundation_system/system_model/system_definition.xml</xsl:param>
+<!-- <path> - The full system model path for this file. Use forward slashes.-->
+
+<xsl:template match="/*">
+	<xsl:apply-templates select="." mode="join"/>
+</xsl:template>
+
+
+<xsl:template match="/SystemDefinition[systemModel]">
+<xsl:apply-templates select="." mode="join">
+	<xsl:with-param name="filename" select="$path"/>
+</xsl:apply-templates>
+</xsl:template>
+
+
+
+
+<xsl:include href="joinsysdef-module.xsl"/>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/layout-module.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,762 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+ 	xmlns:s="http://www.w3.org/2000/svg" xmlns:exslt="http://exslt.org/common"
+ 	xmlns:date="http://exslt.org/dates-and-times"
+ 	exclude-result-prefixes="s exslt date">
+ 	<xsl:output method="xml" indent="yes"/>
+
+
+<xsl:variable name="abbrevs" select="document(/model/layout/info/@href,/)/display-names//abbrev"/> <!-- the abbreviations list -->
+
+<xsl:template match="/SystemDefinition" mode="add-id-ns">
+<xsl:attribute name="id-namespace"><xsl:value-of select="$defaultns"/></xsl:attribute>
+</xsl:template>
+
+<!-- merging -->
+
+
+<xsl:include href="mergesysdef-module.xsl"/>
+
+
+<xsl:template match="/model">
+	<xsl:variable name="model" select="."/>
+	
+	<xsl:variable name="sysdef"> <!-- all the merged sysdefs -->
+		<xsl:apply-templates select="." mode="first-merge"/>
+	</xsl:variable>
+	
+	<!-- now create the output by putting all global attributes into <SystemDefinition>
+		 and any global meta sections into the systemModel or other root model item 
+		this contains all the layout data needed to build the model -->
+	<xsl:for-each select="exslt:node-set($sysdef)/*">
+		<xsl:copy><xsl:copy-of select="@*"/>
+			<xsl:apply-templates select="$model" mode="layout-attributes"/>
+			<xsl:for-each select="*">
+				<xsl:copy><xsl:copy-of select="@*"/>
+					<xsl:apply-templates select="$model/*[not(self::sysdef)]" mode="layout-meta"/>
+					<xsl:copy-of select="*"/>			
+				</xsl:copy>
+			</xsl:for-each>
+		</xsl:copy>
+	</xsl:for-each>
+</xsl:template>
+
+
+<xsl:template match="/model" mode="first-merge">
+	<xsl:apply-templates select="sysdef[1]" mode="join-sysdef-from-model"/>
+</xsl:template>
+
+<xsl:template match="/model[count(sysdef) &gt; 1]" mode="first-merge">
+	<xsl:variable name="prev">
+		<xsl:apply-templates select="sysdef[1]" mode="join-sysdef-from-model"/>
+	</xsl:variable>
+	
+	<xsl:apply-templates select="sysdef[2]" mode="mergewith">
+		<xsl:with-param name="upstream" select="exslt:node-set($prev)/*"/>
+		<xsl:with-param name="up" select="current()/sysdef[1]"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="sysdef" mode="mergewith">
+	<xsl:param name="upstream"/>
+	<xsl:param name="up"/>
+	<xsl:variable name="downstream">
+		<xsl:apply-templates select="." mode="join-sysdef-from-model"/>
+	</xsl:variable>	
+	
+	<xsl:variable name="merged">
+		<xsl:apply-templates mode="merge-models" select="$upstream">
+			<xsl:with-param name="other" select="exslt:node-set($downstream)/*"/>
+			<xsl:with-param name="up" select="$up"/>
+			<xsl:with-param name="down" select="current()"/>
+		</xsl:apply-templates>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="following-sibling::sysdef">
+			<!-- more to come -->
+			<xsl:apply-templates select="following-sibling::sysdef[1]" mode="mergewith">
+				<xsl:with-param name="upstream" select="exslt:node-set($merged)/*"/>
+				<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 -->
+			</xsl:apply-templates>			
+		</xsl:when>
+		<xsl:otherwise><xsl:copy-of select="$merged"/></xsl:otherwise> <!-- we're done, just print-->
+	</xsl:choose>	
+</xsl:template>
+
+<!-- /merging -->
+
+<xsl:template match="*" mode="layout-meta">
+	<xsl:apply-templates select="*[not(self::sysdef)]" mode="global-meta"/>
+</xsl:template>
+
+<xsl:template match="* | @*" mode="layout-attributes">
+	<xsl:apply-templates select="." mode="global-attributes"/>
+</xsl:template>
+
+<xsl:template match="/model" mode="layout-attributes">
+	<xsl:apply-templates select="*[not(self::sysdef)] | @*" mode="layout-attributes"/>
+	<xsl:if test="not(layout/@detail or @detail)">
+		<xsl:attribute name="detail">component</xsl:attribute>
+	</xsl:if>
+	<!--<xsl:if test="not(layout/@placeholder-detail or @placeholder-detail )">
+		<xsl:attribute name="placeholder-detail">component</xsl:attribute>
+	</xsl:if>-->
+</xsl:template>
+
+<xsl:template match="layout" mode="layout-meta"> <!-- ensure it's grouped properly -->
+	<xsl:if test="info or ../@shapes">
+		<xsl:element name="meta"><xsl:attribute name="rel">styling</xsl:attribute>
+			<xsl:apply-templates select="../@shapes | info" mode="styling"/>
+		</xsl:element>
+	</xsl:if>
+	<xsl:apply-templates select="*[not(self::sysdef)]" mode="layout-meta"/>
+</xsl:template>
+
+
+
+<xsl:template match="/model[@revision-type='date']/@revision[contains(.,'%') and function-available('date:month-abbreviation')]" mode="layout-attributes">
+<xsl:attribute name="revision"><xsl:call-template name="format-date"/></xsl:attribute>
+</xsl:template>
+
+
+<xsl:template match="/model[@revision-type='date' and not(@revision) or @revision='%Y-%m-%d']/@revision-type" mode="layout-attributes" priority="4">
+	<xsl:copy-of select="."/>
+	<xsl:if test="function-available('date:date-time')">
+		<xsl:attribute name="revision"><xsl:value-of select="substring-before(date:date-time(),'T')"/></xsl:attribute>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template mode="layout-attributes" match="layout">
+	<xsl:copy-of select="@*"/> 
+</xsl:template>
+
+
+<!-- new attribute: <values rank="list" default="..."> where list is a space-spearated list of system model item names. 
+	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 --> 
+
+
+<xsl:template match="/values" mode="overlay-meta">
+	<xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/><xsl:param name="from"/>
+	<xsl:if test="$from[@type='style' or @type='color' or @type='overlay'] "> <!-- at this point, only pattern, style and color can have multiple values -->
+		<xsl:variable name="join"><xsl:if test="$from/@type!=''">-</xsl:if></xsl:variable>
+		<xsl:variable name="value">
+			<xsl:for-each select="/values/item/*[@ref=$id or substring-after(@ref,':')=$id]">
+				<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
+				<xsl:if test="$myns = $ns"> <!-- actual match -->
+					<xsl:element name="generator{$join}{$from/@type}">
+						 <xsl:attribute name="ref">
+							<xsl:apply-templates select=".." mode="style-id">
+								<xsl:with-param select="$from" name="base"/>
+							</xsl:apply-templates>
+						</xsl:attribute>
+					</xsl:element>
+				</xsl:if>
+			</xsl:for-each>
+		</xsl:variable>
+		<xsl:if test="exslt:node-set($value)/* or (@default and (not(@rank) or contains(concat(' ',normalize-space(@rank),' '), concat(' ',local-name($item),' ')) ))"> 
+			<xsl:element name="meta"><xsl:attribute name="rel">styling</xsl:attribute>
+				<xsl:choose>
+					<xsl:when test="exslt:node-set($value)/*"><xsl:copy-of select="$value"/></xsl:when>
+					<xsl:when test="@default">
+						<xsl:element name="generator{$join}{$from/@type}">
+						 	<xsl:attribute name="ref">
+								<xsl:apply-templates select="$from" mode="style-id"/>
+							</xsl:attribute>
+						</xsl:element>
+					</xsl:when>
+				</xsl:choose>
+			</xsl:element>
+		</xsl:if>		
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="/model/layout/display" mode="overlay-attributes">
+	<xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/>
+		<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
+		<xsl:if test="@ref=$id or substring-after(@ref,':')=$id and $myns=$ns">
+			<xsl:copy-of select="@*[name()!='ref']"/>
+		</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="/values" mode="overlay-attributes">
+	<xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/><xsl:param name="from"/>
+	<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 -->
+		<xsl:variable name="join"><xsl:if test="$from/@type!=''">-</xsl:if></xsl:variable>
+		<xsl:for-each select="/values/item/*[@ref=$id or substring-after(@ref,':')=$id]">
+			<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
+			<xsl:if test="$myns = $ns"> <!-- actual match -->
+				<xsl:attribute name="generator{$join}{$from/@type}">
+					<xsl:apply-templates select=".." mode="style-id">
+						<xsl:with-param select="$from" name="base"/>
+					</xsl:apply-templates>
+				</xsl:attribute>
+			</xsl:if>
+		</xsl:for-each>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="info" mode="style-id">
+	<xsl:value-of select="concat('i',count(preceding-sibling::info))"/>
+</xsl:template>
+
+<xsl:template match="/values" mode="style-id"><xsl:param name="base"/>
+	<xsl:apply-templates select="$base" mode="style-id"/>
+</xsl:template>
+
+<xsl:template match="/values/item" mode="style-id"><xsl:param name="base"/>
+	<xsl:apply-templates select="$base" mode="style-id"/>-<xsl:value-of select="name()"/>
+	<xsl:value-of select="count(preceding-sibling::*)"/>
+</xsl:template>
+
+<xsl:template match="info" mode="style-id">
+	<xsl:value-of select="concat('i',count(preceding-sibling::info))"/>
+</xsl:template>
+
+<xsl:template match="colors|borders|patterns|styles" mode="style-id">
+	<xsl:value-of select="concat('s',count(preceding-sibling::*))"/>
+</xsl:template>
+
+<xsl:template match="examples/cmp" mode="style-id">
+	<xsl:value-of select="concat('e',count(preceding::cmp[parent::examples]))"/>
+</xsl:template>
+
+<xsl:template match="note" mode="style-id">
+	<xsl:value-of select="concat('n',count(preceding::note))"/>
+</xsl:template>
+
+<xsl:template match="legend" mode="style-id">
+	<xsl:value-of select="concat('L',count(preceding::legend))"/>
+</xsl:template>
+
+<xsl:template match="colors/color|borders/border|patterns/overlay|styles/style" mode="style-id">
+	<xsl:apply-templates select=".." mode="style-id"/>-<xsl:value-of select="name()"/>
+	<xsl:value-of select="count(preceding-sibling::*)"/>
+</xsl:template>
+
+<xsl:template match="layout/layer-group" mode="layout-meta">
+	<xsl:element name="meta"><xsl:attribute name="rel">layer-group</xsl:attribute>
+	<xsl:copy-of select="."/>
+	</xsl:element>
+</xsl:template>
+
+<xsl:template match="layout/logo" mode="layout-meta">
+	<xsl:element name="meta"><xsl:attribute name="rel">model-logo</xsl:attribute>
+		<xsl:copy><xsl:copy-of select="@width | @height"/>
+			<xsl:choose>
+				<xsl:when test="@embed='yes' or @embed='true' ">
+					<xsl:for-each select="document(@src,.)/s:svg">
+						<xsl:copy-of select="@viewBox"/>
+						<xsl:copy-of select="*"/>
+					</xsl:for-each>
+				</xsl:when>
+				<xsl:otherwise><xsl:copy-of select="@src"/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:copy>
+	</xsl:element>
+</xsl:template>
+
+<!-- legend follows -->
+<xsl:template match="layout/legend" mode="layout-meta">
+	<xsl:element name="meta"><xsl:attribute name="rel">model-legend</xsl:attribute>
+		<xsl:copy><xsl:copy-of select="@*[name()!='literal']"/>
+			<xsl:if test="not(@literal='yes' or @literal='true') and contains(@label,'{')">
+				<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
+			</xsl:if>	
+			<xsl:apply-templates select="*" mode="layout-meta"/>
+		</xsl:copy>
+	</xsl:element>
+	
+	<!-- put footer outside of the legend since technically it should be on the bottom of the diagram -->
+	<xsl:variable name="footer">
+		<xsl:for-each select="/model/@copyright|/model/@distribution">
+			<xsl:variable name="a" select="concat('@',name())"/>
+			<!-- only use footer items if they are not referenced elsewhere in a label -->
+			<xsl:if test="not(/model/layout//legend[contains(@label,$a)]) and not(/model/layout//legend/note[contains(.,$a)])">
+				<xsl:value-of select="concat(' ',name(),' ')"/>
+			</xsl:if>
+		</xsl:for-each>
+	</xsl:variable>
+	<xsl:if test="$footer!=''">
+		<xsl:element name="meta"><xsl:attribute name="rel">model-footer</xsl:attribute>
+			<xsl:for-each select="/model/@*[contains($footer,concat(' ',name(),' '))]">
+				<xsl:element name="{name()}"/>
+			</xsl:for-each>
+		</xsl:element>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="legend" mode="layout-meta">
+	<xsl:copy>
+		<xsl:copy-of select="@*[name()!='literal']"/>
+		<xsl:if test="not(@literal='yes' or @literal='true') and contains(@label,'{')">
+			<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
+		</xsl:if>	
+		<xsl:apply-templates select="*" mode="layout-meta"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="legend/note|legend/s:svg" mode="layout-meta">
+	<xsl:copy><xsl:copy-of select="@*[name()!='literal']"/>
+		<xsl:if test="self::note and not(@literal='yes' or @literal='true') and contains(.,'{')">
+			<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
+		</xsl:if>
+		<xsl:copy-of select="node()"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="legend[s:g]" mode="layout-meta">
+<xsl:copy-of select="."/>
+</xsl:template>
+
+
+
+
+<xsl:template match="@label" mode="legend-abbrev">
+	<xsl:variable name="n" select="."/>
+	<xsl:variable name="match" select="$abbrevs[@name=$n]"/>
+	<xsl:choose>
+		<xsl:when test="not($match)"><xsl:copy-of select="."/></xsl:when>
+		<xsl:otherwise>
+			<xsl:attribute name="label"><xsl:value-of select="$match/@abbrev"/></xsl:attribute>
+			<xsl:copy-of select="$match/@font"/>
+			<xsl:if test="not($match/@font)">
+				<xsl:copy-of select="$match/ancestor::display-names/@font"/>
+			</xsl:if>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+
+<xsl:template match="legend" mode="legend-copy">
+	<xsl:copy-of select="@*[name()!='use' or name()='literal']"/>
+	<xsl:if test="not(@literal='yes' or @literal='true') and contains(@label,'{')">
+		<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
+	</xsl:if>	
+</xsl:template>
+
+<xsl:template match="legend[@use]" mode="layout-meta">
+	
+	<!-- 	$tag = bit after the # (can be empty)
+		$pre is bit before the # (can be empty)
+		$file is file pointed to by pre (can be empty) -->
+
+	<xsl:variable name="tag" select="substring-after(@use,'#')"/>
+	<xsl:variable name="pre">
+		<xsl:choose>
+			<xsl:when test="$tag!=''"><xsl:value-of select="substring-before(@use,'#')"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="@use"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+
+	<xsl:variable name="file">
+		<xsl:choose>
+			<xsl:when test="starts-with($pre,'@')"><xsl:value-of select="//model/@*[name()=substring($pre,2)]"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$pre"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	
+	<xsl:variable name="model" select="/model"/>  <!--  hack for xsltproc -->
+	<xsl:variable name="legend" select="."/>  <!--  hack for xsltproc -->
+
+	<xsl:variable name="this" select="."/>  <!--  save node just in case need to use more than once -->
+
+	
+	<xsl:choose>
+		<xsl:when test="$tag!='' and $pre=''">
+			<!-- pre is empty, but tag is not, so this legend is an info in this file -->
+			<xsl:for-each select="ancestor::layout/info[@type=$tag]">
+				<xsl:element name="legend">
+					<xsl:apply-templates select="$this" mode="legend-copy"/>
+					<xsl:apply-templates select="." mode="legend-layout">
+						<xsl:with-param name="model" select="$model"/>
+						<xsl:with-param name="legend" select="$legend"/>
+					</xsl:apply-templates>
+				</xsl:element>
+			</xsl:for-each>
+		</xsl:when>
+		<xsl:when test="$tag!=''">
+			<xsl:for-each select="document($file,/)/*/*[name()=$tag]">
+				<xsl:element name="legend">
+					<xsl:apply-templates select="$this" mode="legend-copy"/>
+					<xsl:apply-templates select="." mode="legend-layout">
+						<xsl:with-param name="model" select="$model"/>
+						<xsl:with-param name="legend" select="$legend"/>
+					</xsl:apply-templates>
+				</xsl:element>			
+			</xsl:for-each>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:for-each select="document($file,/)/*">
+				<xsl:element name="legend">
+					<xsl:apply-templates select="$this" mode="legend-copy"/>
+					<xsl:apply-templates select="." mode="legend-layout">
+						<xsl:with-param name="model" select="$model"/>
+						<xsl:with-param name="legend" select="$legend"/>
+					</xsl:apply-templates>
+				</xsl:element>			
+			</xsl:for-each>			
+			</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="info[(@type='color'  or @type='overlay' or @type='style' or @type='border') and document(@href,.)/values]" mode="legend-layout">
+	<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>
+	<xsl:attribute name="type">
+		<xsl:choose>
+			<xsl:when test="@type='color'">cbox</xsl:when>
+			<xsl:otherwise>cmp</xsl:otherwise>
+		</xsl:choose>
+	</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="text()" mode="legend-layout"/>
+
+<!-- Any ref with a type attribute that starts with a # indicates a literal ref, so just copy it -->
+<xsl:template match="*[starts-with(@type,'#')]" mode="layout-ref" priority="1"><xsl:value-of select="@type"/></xsl:template>
+
+<!-- Borders in legend -->
+
+<xsl:template match="border" mode="layout-ref">#Border<xsl:choose>
+		<xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
+		<xsl:otherwise>Shape<xsl:value-of select="count(preceding::border)"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- Colours in legend -->
+<xsl:template match="color[../@type='highlight' or ../@type='text-highlight']" mode="layout-ref">
+	<xsl:value-of select="concat('#',../@type,count(preceding::color[../@type]))"/>
+</xsl:template>
+
+<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 -->
+
+
+<!-- can have any number of these, so put in a sub-legend -->
+<xsl:template match="/shapes/examples" mode="legend-layout"><xsl:param name="model"/>
+	<xsl:param name="legend"/>	<!-- label on legend overrides label in values document -->
+	<xsl:variable name="tag" select="name()"/>
+	<xsl:variable name="content">
+		<!-- 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)	 -->
+		<xsl:choose>
+			<xsl:when test="@sort='yes'">
+				<xsl:apply-templates mode="legend-layout">
+					<xsl:sort select="@label"/>
+					<xsl:with-param name="model" select="$model"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:apply-templates mode="legend-layout"><xsl:with-param name="model" select="$model"/></xsl:apply-templates>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="count(//*[name()=$tag]) != 1">
+			<legend>
+				<xsl:if test="not($legend) or not($legend/@label) or preceding-sibling::*[name()=$tag]"><xsl:apply-templates select="@label"  mode="legend-abbrev"/></xsl:if>
+				<xsl:copy-of select="$content"/>
+			</legend>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:copy-of select="@sort|@show-unused"/>
+			<xsl:if test="not($legend) or not($legend/@label) or preceding-sibling::*[name()=$tag]"><xsl:apply-templates select="@label"  mode="legend-abbrev"/></xsl:if>
+			<xsl:copy-of select="$content"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!-- can have any number of these, so put in a sub-legend -->
+<xsl:template match="/shapes/styles|/shapes/colors|/shapes/patterns|/shapes/borders" mode="legend-layout">
+	<xsl:variable name="tag" select="name()"/>
+	<xsl:choose>
+		<xsl:when test="count(//*[name()=$tag]) != 1">
+			<xsl:element name="legend">
+				<xsl:copy-of select="@sort|@show-unused"/>
+				<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>		
+				<xsl:attribute name="type">cmp</xsl:attribute>
+			</xsl:element>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:copy-of select="@sort|@show-unused"/>
+			<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>		
+			<xsl:attribute name="type">cmp</xsl:attribute>		
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="overlay" mode="layout-ref">#Pattern<xsl:choose>
+		<xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
+		<xsl:otherwise>Overlay<xsl:value-of select="count(preceding::overlay)"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+	
+<xsl:template match="/shapes/*/*[not(@label)]" mode="legend-layout"/> <!--  don't show legend items with no label -->
+	
+
+
+<xsl:template match="/shapes" mode="as-example"><xsl:param name="at"/>
+	<xsl:choose>
+		<xsl:when test="name($at)='border' or name($at)='overlay'">
+			<xsl:attribute name="generator-{name($at)}">
+				<xsl:apply-templates  select="//*[name()=name($at) and @label=$at]" mode="style-id"/>
+			</xsl:attribute>
+		</xsl:when>
+		<xsl:when test="name($at)='style'">
+			<xsl:attribute name="generator-{name($at)}"><xsl:apply-templates  select="//style[@label=$at]" mode="style-id"/></xsl:attribute>			
+		</xsl:when>	
+		<xsl:when test="name($at)='color-highlight'">
+			<xsl:attribute name="generator-highlight">
+				<xsl:apply-templates select="//colors[@type='highlight']/color[@label=$at]" mode="style-id"/>
+			</xsl:attribute>
+		</xsl:when>	
+		<xsl:when test="name($at)='color-text-highlight'">
+			<xsl:attribute name="generator-text-highlight">
+				<xsl:apply-templates select="//colors[@type='text-highlight']/color[@label=$at]" mode="style-id"/>
+			</xsl:attribute>
+		</xsl:when>	
+		<xsl:when test="name($at)='color'">
+			<xsl:attribute name="generator-color">
+				<xsl:apply-templates select="//colors[not(@type) or @type='background']/color[@label=$at]/@color" mode="style-id"/>
+			</xsl:attribute>
+		</xsl:when>	
+	</xsl:choose>
+</xsl:template>
+
+
+
+<xsl:template match="@color" mode="generated-value"><xsl:param name="model"/>
+	<xsl:variable name="v" select="."/>
+	<xsl:variable name="m" select="//color[@label=$v]"/>
+	<xsl:choose>
+		<xsl:when test="count($m)">
+			<xsl:attribute name="generator-color"><xsl:apply-templates select="$m" mode="style-id"/></xsl:attribute>
+		</xsl:when>
+		<xsl:when test="$model//info[@type='color']">
+			<xsl:attribute name="generator-color">
+				<xsl:variable name="m0" select="$model//info[@type='color']/@href"/>
+				<xsl:apply-templates select="document($m0/@href,$m0)//item[@label=$v]" mode="style-id">
+					<xsl:with-param name="base" select="$m0"/>
+				</xsl:apply-templates>
+			</xsl:attribute>
+		</xsl:when>		
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="examples/cmp" mode="legend-layout"><xsl:param name="model"/><xsl:param name="shapes" select="/shapes"/>
+	<cmp>
+		<xsl:if test="not(@literal='yes' or @literal='true') and contains(.,'{')">
+			<xsl:attribute name="label-ref"><xsl:apply-templates mode="style-id" select="."/></xsl:attribute>
+		</xsl:if>	
+		<xsl:for-each select="@*">
+			<xsl:apply-templates select="$shapes" mode="as-example">
+				<xsl:with-param name="at" select="."/>
+			</xsl:apply-templates>
+		</xsl:for-each>
+		<xsl:apply-templates mode="generated-value" select="@color">
+			<xsl:with-param name="model" select="$model"/>
+		</xsl:apply-templates>
+		<xsl:copy-of select="text()"/>
+	</cmp>
+</xsl:template>
+
+
+<xsl:template match="/shapes/colors[not(*)]" mode="legend-layout"><xsl:param name="model"/>
+<!-- special known type which can be generated -->
+	<xsl:choose>
+		<xsl:when test="count(//colors) != 1 and @match='@ts' and $model">
+			<legend>
+				<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>
+				<xsl:attribute name="sort">yes</xsl:attribute>
+				<xsl:attribute name="type">cbox</xsl:attribute>
+			</legend>
+		</xsl:when>
+		<xsl:when test="@match='@ts' and $model">
+			<xsl:attribute name="use"><xsl:apply-templates select="." mode="style-id"/></xsl:attribute>
+			<xsl:attribute name="sort">yes</xsl:attribute>
+			<xsl:attribute name="type">cbox</xsl:attribute>
+		</xsl:when>
+		<xsl:otherwise>
+		<!--	<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">no colour data</xsl:with-param></xsl:call-template> -->
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- styling stuff  -->
+<xsl:template match="node()" mode="styling"/>
+
+<xsl:template match="@shapes" mode="styling">
+	<xsl:variable name="model" select=".."/> <!-- hack for xsltproc -->
+	<xsl:apply-templates select="document(.,.)/shapes/*" mode="styling">
+		<xsl:with-param name="model" select="$model"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+
+<xsl:template match="layout/info[@type='color' or @type='border' or @type='overlay' or @type='style']" mode="styling">
+	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
+	<xsl:variable name="base" select="."/>
+	<group style-id="{$id}">
+		<xsl:copy-of select="@type | @show-unused"/>
+		<xsl:for-each select="document(@href,.)/values">
+		<xsl:choose>
+			<xsl:when test="contains(normalize-space(@rank),' ')"/>
+			<xsl:when test="@rank"><xsl:attribute name="detail"><xsl:value-of select="@rank"/></xsl:attribute></xsl:when>
+			<xsl:otherwise><xsl:attribute name="detail">component</xsl:attribute></xsl:otherwise>
+		</xsl:choose>
+		</xsl:for-each>
+		<xsl:for-each select="document(@href,.)/values">
+			<xsl:copy-of select="@default"/>
+			<xsl:apply-templates select="@label"  mode="legend-abbrev"/>				
+			<xsl:for-each select="item">
+				<xsl:variable name="el">
+					<xsl:choose>
+						<xsl:when test="$base/@type='color'">cbox</xsl:when>
+						<xsl:otherwise>cmp</xsl:otherwise>
+					</xsl:choose>
+				</xsl:variable>
+				<xsl:element name="{$el}">
+					<xsl:attribute name="style-id">
+						<xsl:apply-templates select="." mode="style-id">
+							<xsl:with-param name="base" select="$base"/>
+						</xsl:apply-templates>
+					</xsl:attribute>
+					<xsl:apply-templates select="@label"  mode="legend-abbrev"/>	
+					<xsl:attribute name="value">
+					<xsl:choose>
+						<xsl:when test="not(starts-with(@value,'#')) and $base/@type='border' ">#Border<xsl:value-of select="@value"/></xsl:when> 
+						<xsl:when test="not(starts-with(@value,'#')) and $base/@type='overlay' ">#Pattern<xsl:value-of select="@value"/></xsl:when>
+							<!-- highlight not allowed in values files, but put here anyway -->
+						<xsl:when test="contains($base/@type,'highlight')">#<xsl:value-of select="$base/@type"/>
+							<xsl:apply-templates select="." mode="style-id">
+								<xsl:with-param name="base" select="$base"/>
+							</xsl:apply-templates></xsl:when>
+						<xsl:otherwise><xsl:value-of select="@value"/></xsl:otherwise>
+					</xsl:choose>
+					</xsl:attribute>
+				</xsl:element>
+			</xsl:for-each>
+		</xsl:for-each>
+	</group>
+</xsl:template>
+
+<xsl:template name="lgd-group-detail">
+	<xsl:choose>
+		<xsl:when test="@detail"><xsl:copy-of select="@detail"/></xsl:when>
+		<xsl:when test="self::borders or  not(@match)"><xsl:attribute name="detail">component</xsl:attribute></xsl:when>
+		<xsl:when test="@match='component' or @match='collection' or @match='package' or @match='layer'">
+			<xsl:attribute name="detail"><xsl:value-of select="@match"/></xsl:attribute>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="/shapes/colors[@match='@ts' and not(*)]" mode="styling" priority="4"/> <!-- no longer supported -->
+
+<xsl:template match="/shapes/borders|/shapes/patterns|/shapes/styles|/shapes/colors" mode="styling"><xsl:param name="model"/>
+	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
+	<group type="{name(*)}" style-id="{$id}">
+		<xsl:attribute name="type">
+			<xsl:choose>
+				<xsl:when test="self::colors and @type='background' ">color</xsl:when>
+				<xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
+				<xsl:otherwise><xsl:value-of select="name(*)"/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:attribute>
+		<xsl:call-template name="lgd-group-detail"/>
+		<xsl:copy-of select="@default"/>
+		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>	
+		<xsl:apply-templates mode="styling"><xsl:with-param name="id" select="$id"/></xsl:apply-templates>
+	</group>
+</xsl:template>
+
+<xsl:template match="/shapes/colors/color|/shapes/borders/border|/shapes/patterns/overlay|/shapes/styles/style" mode="styling">
+	<xsl:variable name="my-id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
+	<xsl:variable name="el">
+		<xsl:choose>
+			<xsl:when test="self::color[../@type='highlight' or ../@type='text-highlight']">cmp</xsl:when>
+			<xsl:when test="self::color">cbox</xsl:when>
+			<xsl:otherwise>cmp</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:element name="{$el}">
+		<xsl:attribute name="style-id"><xsl:value-of select="$my-id"/></xsl:attribute>
+		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>
+		<xsl:if test="contains(@label,'{') or @count">
+			<xsl:attribute name="label-ref"><xsl:value-of select="$my-id"/></xsl:attribute>
+		</xsl:if>
+		<xsl:if test="@value">
+			<xsl:attribute name="lookup"><xsl:value-of select="@value"/></xsl:attribute>
+		</xsl:if>
+		<xsl:attribute name="value">	
+			<xsl:choose>
+				<xsl:when test="self::style"><xsl:value-of select="."/></xsl:when>
+				<xsl:when test="self::color[not(../@type) or ../@type='background']"><xsl:value-of select="@color"/></xsl:when>
+				<xsl:otherwise><xsl:apply-templates select="." mode="layout-ref"/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:attribute>
+	</xsl:element>
+</xsl:template>
+
+
+<!-- consider making this just an optional call to template so it does nothing if it's not needed -->
+<xsl:template mode="is-content-filtered" match="*" priority="5"><xsl:param name="content"/>
+	<xsl:if test="function-available('exslt:node-set') and count(exslt:node-set($content)/*[not(self::meta)])!=count(*[not(self::meta)])"> 
+		<xsl:attribute name="filtered">yes</xsl:attribute>
+	</xsl:if>
+</xsl:template>
+
+
+
+<!-- internal routines follows -->
+
+<!-- for date formatting: only use if the date functions are *fully* supported (ie not by xalan)
+Uses unix date %-encoding, but only a few are supported (see comments)
+-->  
+<xsl:template name="format-date"><xsl:param name="date" select="."/>
+	<xsl:choose>
+		<xsl:when test="contains($date,'%')">
+			<xsl:value-of select="substring-before($date,'%')"/>
+			<xsl:variable name="rest" select="substring-after($date,'%')"/>
+			<xsl:choose>
+				<xsl:when test="starts-with($rest,'%') or $rest=''">%</xsl:when> <!-- %%     a literal % -->
+				<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) -->
+				<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)-->
+				<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)-->
+				<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)-->
+				<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)-->
+				<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)-->
+				<xsl:when test="starts-with($rest,'F')"><xsl:value-of select="date:date()"/></xsl:when><!--%F     full date; same as %Y-%m-%d-->
+				<xsl:when test="starts-with($rest,'H')"><xsl:number format="01" value="date:hour-in-day()"/></xsl:when><!--%H     hour (00..23)-->
+				<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)-->
+				<xsl:when test="starts-with($rest,'j')"><xsl:number format="001" value="date:day-in-year()"/></xsl:when><!--%j     day of year (001..366)-->
+				<xsl:when test="starts-with($rest,'k')"><xsl:number format=" 1" value="date:hour-in-day()"/></xsl:when><!--%k     hour ( 0..23)-->
+				<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)-->
+				<xsl:when test="starts-with($rest,'m')"><xsl:number format="01" value="date:month-in-year()"/></xsl:when><!--%m     month (01..12)-->
+				<xsl:when test="starts-with($rest,'M')"><xsl:number format="01" value="date:minute-in-hour()"/></xsl:when><!--%M     minute (00..59)-->
+				<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-->
+				<xsl:when test="starts-with($rest,'p')">PM</xsl:when><!--%p     locale's equivalent of either AM or PM; blank if not known-->
+				<xsl:when test="starts-with($rest,'P') and date:hour-in-day() &lt; 12">am</xsl:when><!--%P     like %p, but lower case-->
+				<xsl:when test="starts-with($rest,'P')">pm</xsl:when><!--%P     like %p, but lower case-->
+				<xsl:when test="starts-with($rest,'S')"><xsl:number format="01" value="date:second-in-minute()"/></xsl:when><!--%S     second (00..60)-->
+				<xsl:when test="starts-with($rest,'T')"><xsl:value-of select="date:time()"/></xsl:when><!--%T     time; same as %H:%M:%S-->
+				<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-->
+				<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)-->
+				<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-->
+				<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)-->
+				<xsl:when test="starts-with($rest,'Y')"><xsl:value-of select="date:year()"/></xsl:when><!--%Y     year-->
+				<xsl:otherwise><xsl:value-of select="substring($rest,1,1)"/></xsl:otherwise>
+			</xsl:choose>
+			<xsl:if test="string-length($rest) &gt; 1">
+				<xsl:call-template name="format-date">
+					<xsl:with-param name="date" select="substring($rest,2)"/>
+				</xsl:call-template>
+			</xsl:if>
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$date"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/layoutsysdef.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ 	<xsl:output method="xml" indent="yes"/>
+
+	<xsl:include href="joinmodel.xsl"/> <!-- standard joining model stuff -->
+	<xsl:include href="layout-module.xsl"/> <!-- add system model layout details -->
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/legend-module.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,587 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"   xmlns:s="http://www.w3.org/2000/svg" xmlns:exslt="http://exslt.org/common" xmlns:m="http://exslt.org/math" exclude-result-prefixes="s m exslt" >
+	<xsl:key name="ldg-use" match="group" use="@style-id"/>
+	<xsl:key name="style-ref" match="*[starts-with(name(),'generator-')]/@ref| @*[starts-with(name(),'generator-')]" use="."/>
+	<xsl:key name="styled" match="group|group/*" use="@style-id"/>	  
+	<xsl:output method="xml" cdata-section-elements="script s:script" indent="yes"/>
+
+<!-- ====== Constants ============= -->
+<xsl:variable name="cboxWidth" select="15.5"/>	<!-- the width of a sample colour in the legend (mm) -->
+<xsl:variable name="cboxHeight" select="3.1"/>	<!-- the height of a sample colour in the legend (mm) -->
+<xsl:variable name="legendDx" select="5"/><!-- the horizontal distance between items in a legend (mm) -->
+<!-- ====== Computed values ============= -->
+
+
+<xsl:template match="meta[@rel='model-footer' and *]" mode="sizing">
+	<xsl:copy><xsl:copy-of select="@*"/>
+		<xsl:attribute name="width">1</xsl:attribute> <!-- virtual width, really spans with of the model -->
+		<xsl:attribute name="height"><xsl:value-of select="$groupDy + 4.233"/></xsl:attribute>
+		<xsl:copy-of select="node()"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="meta[@rel='model-logo']" mode="sizing">
+	<xsl:copy><xsl:copy-of select="@*"/>
+	<xsl:for-each select="logo">
+		<xsl:variable name="b" select="normalize-space(@viewBox)"/>
+		<xsl:attribute name="width">
+			<xsl:variable name="x0" select="- number(substring-before($b,' '))"/>
+			<xsl:variable name="x1" select="number(substring-before(substring-after(substring-after($b,' '),' '),' '))"/>
+			<xsl:choose> <!--  is it really y1+ y0 or should it be - ? -->
+				<xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
+				<xsl:when test="@height and $b!=''">
+					<xsl:variable name="y0" select="- number(substring-before(substring-after($b,' '),' '))"/>
+					<xsl:variable name="y1" select="number(substring-after(substring-after(substring-after($b,' '),' '),' '))"/>
+					<xsl:value-of select="($x1 + $x0) * number(@height) div ($y1 + $y0)"/>
+				</xsl:when>
+				<xsl:when test="$b!=''"><xsl:value-of select="$x1 + $x0"/></xsl:when>
+				<xsl:otherwise>?</xsl:otherwise>	<!-- cannot be determined -->
+			</xsl:choose>
+			</xsl:attribute>
+			<xsl:attribute name="height">
+				<xsl:variable name="y0" select="- number(substring-before(substring-after($b,' '),' '))"/>
+				<xsl:variable name="y1" select="number(substring-after(substring-after(substring-after($b,' '),' '),' '))"/>
+				<xsl:choose> <!--  is it really y1+ y0 or should it be - ? -->
+					<xsl:when test="@height"><xsl:value-of select="@height"/></xsl:when>
+					<xsl:when test="@width and $b!=''">
+						<xsl:variable name="x0" select="- number(substring-before($b,' '))"/>
+						<xsl:variable name="x1" select="number(substring-before(substring-after(substring-after($b,' '),' '),' '))"/>
+						<xsl:value-of select="($y1 + $y0) * number(@width) div ($x1 + $x0)"/>
+					</xsl:when>
+					<xsl:when test="$b!=''"><xsl:value-of select="$y1 + $y0"/></xsl:when>
+					<xsl:otherwise>?</xsl:otherwise>	<!-- cannot be determined -->
+				</xsl:choose>
+			</xsl:attribute>
+		</xsl:for-each>
+		<xsl:copy-of select="node()"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="meta[@rel='model-legend']" mode="sizing">
+	<xsl:copy><xsl:copy-of select="@*"/>
+		<xsl:variable name="content">		
+			<xsl:apply-templates select="legend" mode="legend-copy"/>
+		</xsl:variable>
+		<xsl:variable name="height">
+			<xsl:choose>
+				<xsl:when test="exslt:node-set($content)/legend/@height"><xsl:value-of select="exslt:node-set($content)/legend/@height"/></xsl:when>
+				<xsl:when test="exslt:node-set($content)/legend/@title-height &gt; exslt:node-set($content)/legend/@min-height"><xsl:value-of select="exslt:node-set($content)/legend/@title-height"/></xsl:when>
+				<xsl:when test="exslt:node-set($content)/legend/@min-height"><xsl:value-of select="exslt:node-set($content)/legend/@min-height"/></xsl:when>
+				<xsl:when test="exslt:node-set($content)/legend[not(@min-height) and @title-height]">
+					<xsl:value-of select="exslt:node-set($content)/legend/@title-height"/>
+				</xsl:when>
+				<xsl:otherwise>0</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="width">
+			<xsl:apply-templates mode="actual-width" select="exslt:node-set($content)/legend">
+				<xsl:with-param name="h" select="(exslt:node-set($content)/legend/@height| exslt:node-set($content)/legend/@min-height) - sum(exslt:node-set($content)/legend/@ipad)"/>
+			</xsl:apply-templates>
+		</xsl:variable>
+		<xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute> <!-- externally-visible height = internal +padding-->
+		<xsl:attribute name="width"><xsl:value-of select="$width + sum(exslt:node-set($content)/legend/@title-width)"/></xsl:attribute> <!-- externally-visible width = internal + padding-->
+		<xsl:copy-of select="$content"/>
+	</xsl:copy>
+</xsl:template>
+
+<!-- legend -->
+
+<xsl:template match="*[@width]" mode="actual-width" priority="2">
+	<xsl:value-of select="@width"/>
+</xsl:template>
+
+<xsl:template match="legend[@min-width]" mode="actual-width"><xsl:param name="h"/>
+	<xsl:call-template name="sum-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="concat(@min-width - sum(*/@min-width) ,' ')"/>
+			<xsl:for-each select="*[@min-width]">
+				<xsl:apply-templates select="." mode="actual-width">
+					<xsl:with-param name="h" select="$h"/>
+				</xsl:apply-templates>
+				<xsl:text> </xsl:text>
+			</xsl:for-each>
+		</xsl:with-param> 
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="*[@min-width]" mode="actual-width" priority="-1"><xsl:message terminate="yes">Not supported</xsl:message>
+</xsl:template>
+
+
+<xsl:template match="legend[cbox]" priority="1" mode="actual-width"><xsl:param name="h"/>
+	<xsl:variable name="height">
+		<xsl:choose>
+			<xsl:when test="$h &lt; @min-height"><xsl:value-of select="@min-height"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$h"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:value-of select="sum(@label-width)  + $cboxWidth * (ceiling(   count(cbox)  div floor(($height) div $cboxHeight)) )"/>
+</xsl:template>
+
+
+<xsl:template match="node()" mode="legend-copy" priority="-2">
+	<xsl:copy><xsl:copy-of select="@*"/>
+		<xsl:apply-templates  mode="legend-copy"/>
+	</xsl:copy>
+</xsl:template>
+<xsl:template match="text()[normalize-space(.)='']" mode="legend-copy" priority="-1"/>
+
+<xsl:template match="layer" mode="legend-copy" priority="-1">
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+
+<!-- template to ensure that only the desired attributes get copied, and that width gets renamed --> 
+<xsl:template match="@*" mode="legend-root-attr"><xsl:copy-of select="."/></xsl:template>
+<xsl:template match="@label|@literal|@label-ref" mode="legend-root-attr"/>
+<xsl:template match="@width" mode="legend-root-attr">
+	<xsl:if test="contains(.,'%')">
+		<xsl:attribute name="percent-width"><xsl:value-of select="substring-before(.,'%')"/></xsl:attribute>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="meta/legend" mode="legend-copy" priority="4">
+	<xsl:variable name="content">		
+		<xsl:apply-templates  mode="legend-copy"/>
+	</xsl:variable>
+	<xsl:copy>
+		<xsl:apply-templates mode="legend-root-attr" select="@*"/>
+		<xsl:if test="@label"><xsl:apply-templates select="." mode="make-label"/></xsl:if>
+		<xsl:call-template name="legend-sizing">
+			<xsl:with-param name="content" select="exslt:node-set($content)"/>
+		</xsl:call-template>
+		<xsl:variable name="line-height">
+			<xsl:choose>
+				<xsl:when test="number(@title-scale)">
+					<xsl:value-of select="4.3 * @title-scale"/> <!-- scale 12pt by specified factor-->
+				</xsl:when>
+				<xsl:when test="@width or @maxscale">4.233</xsl:when> <!-- 12pt -->
+			<!-- 	<xsl:when test="$full-width &gt; $large-width">6.3495</xsl:when> 18 pt -->
+				<xsl:otherwise>4.3</xsl:otherwise> <!-- 12pt -->
+			</xsl:choose>		
+		</xsl:variable>
+		<xsl:attribute name="title-width">
+			<xsl:apply-templates select="/SystemDefinition" mode="legend-title-width">
+				<xsl:with-param name="h" select="$line-height"/>
+			</xsl:apply-templates>
+		</xsl:attribute>
+		<xsl:attribute name="title-height">
+			<xsl:value-of select="$line-height * 3"/>
+		</xsl:attribute>
+		<xsl:copy-of select="$content"/>		
+	</xsl:copy>
+</xsl:template>
+
+
+<xsl:template match="legend/@use" mode="legend-copy">
+	<xsl:apply-templates select="key('ldg-use',.)/*" mode="legend-copy">
+		<xsl:with-param name="show-unused" select="../@show-unused"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="@label" mode="width"><xsl:value-of select="string-length(.) *  4"/></xsl:template>
+<xsl:template match="@label[../@label-ref]" mode="width">
+	<xsl:variable name="text"><xsl:apply-templates mode="name" select=".."/></xsl:variable>
+	<xsl:value-of select="string-length($text) *  4"/>
+</xsl:template>
+
+<xsl:template name="label-width">
+	<xsl:variable name="node">
+		<t>
+			<xsl:choose>
+				<xsl:when test="@label"><xsl:apply-templates select="." mode="make-label"/></xsl:when>
+				<xsl:otherwise><xsl:apply-templates select="key('ldg-use',@use)" mode="make-label"/></xsl:otherwise>
+			</xsl:choose>
+		</t>
+	</xsl:variable>
+	<xsl:variable name="text" select="normalize-space(exslt:node-set($node)/*/@label)"/>
+	<xsl:choose>
+		<xsl:when test="$text=''">0</xsl:when> <!-- no wrapping big text -->
+		<xsl:when test="parent::meta"><xsl:value-of select="string-length($text) *  4"/></xsl:when> <!-- no wrapping big text -->
+		<!-- small text is half as big (approx) -->
+		<xsl:when test="contains($text,' ') and string-length($text) &gt; 15">15</xsl:when> <!-- wrap so it's no more than 20 wide -->
+		<xsl:otherwise><xsl:value-of select="string-length($text)"/></xsl:otherwise> <!-- don't wrap -->
+	</xsl:choose>	
+</xsl:template>
+
+<xsl:template name="legend-sizing"><xsl:param name="content"/>
+	<xsl:variable name="h">
+		<xsl:call-template name="max-from-list">
+			<xsl:with-param name="list">
+				<xsl:for-each select="$content/*/@height |$content/*/@min-height">
+					<xsl:value-of select="concat(.,' ')"/>
+				</xsl:for-each>
+				<xsl:if test="$content/cbox">
+					<xsl:value-of select="concat($cboxHeight,' ')"/>
+				</xsl:if>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="label-w">
+		<xsl:call-template name="label-width"/>
+	</xsl:variable>
+	<xsl:if test="$label-w != 0">
+	<xsl:attribute name="label-width"><xsl:value-of select="$label-w"/></xsl:attribute>
+	</xsl:if>
+	<xsl:variable name="ipad" select=" (1 - count(parent::legend)) *$legendDx"/>
+	<xsl:if test="$ipad">
+		<xsl:attribute name="ipad"><xsl:value-of select="$ipad"/></xsl:attribute>
+	</xsl:if>
+	<xsl:choose>	
+		<xsl:when test="$content/cbox">
+			<xsl:attribute name="min-width"><xsl:value-of select="$label-w + $cboxWidth"/></xsl:attribute>
+			<xsl:attribute name="max-width"><xsl:value-of select="$label-w + $cboxWidth * count($content/cbox)"/></xsl:attribute>
+			<xsl:attribute name="min-height"><xsl:value-of select="$cboxHeight"/></xsl:attribute>					
+		</xsl:when>
+		<xsl:when test="not($content/*) and parent::meta">
+			<xsl:attribute name="width">0</xsl:attribute> <!-- no legend, don't even draw the label -->
+		</xsl:when>
+		<xsl:when test="not($content/*[@width or @min-width or @max-width])">
+			<xsl:attribute name="width">100</xsl:attribute>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:variable name="minw">
+				<xsl:if test="count($content/*/@width) != count($content/*)">min-</xsl:if>
+			</xsl:variable>
+			<xsl:variable name="base-w" select="sum($content/*/@width|$content/*[following-sibling::*]/@rpad) + $label-w  + 2* $ipad"/>
+			<xsl:attribute name="{$minw}width">
+				<xsl:value-of select="$base-w + sum($content/*/@min-width) "/>
+			</xsl:attribute>
+			<xsl:if test="$content/*/@max-width">
+				<xsl:attribute name="max-width">
+					<xsl:value-of select="$base-w + sum($content/*/@max-width)"/>
+				</xsl:attribute>
+			</xsl:if>					
+			<xsl:variable name="minh">
+				<xsl:if test="count($content/*/@height) != count($content/*)">min-</xsl:if>
+			</xsl:variable>
+			<xsl:attribute name="{$minh}height"><xsl:value-of select="$h+$ipad"/></xsl:attribute>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="legend" mode="legend-copy">
+	<xsl:variable name="content">
+		<xsl:apply-templates mode="legend-copy" select="* | @use"/>
+	</xsl:variable>
+	<xsl:if test="exslt:node-set($content)/descendant-or-self::*">
+		<!-- only show if all the content is present (do we really want to do this? It means the label won't show if nothing is present) -->
+		<xsl:copy><xsl:copy-of select="@*[name()!='label' and name()!='literal' and name()!='label-ref' and name()!='show-unused' and name()!='use' and name()!='type']"/>
+<!-- 		<xsl:copy-of select="key('ldg-use',@use)/@*[name()='type' or name()='style-id']"/>-->
+			<xsl:choose>
+				<xsl:when test="@label"><xsl:apply-templates select="." mode="make-label"/></xsl:when>
+				<xsl:otherwise><xsl:apply-templates select="key('ldg-use',@use)" mode="make-label"/></xsl:otherwise>
+			</xsl:choose>
+			<xsl:call-template name="legend-sizing">
+				<xsl:with-param name="content" select="exslt:node-set($content)"/>
+			</xsl:call-template>
+			<xsl:if test="following-sibling::*">
+				<xsl:attribute name="rpad"><xsl:value-of select="$legendDx"/></xsl:attribute>
+			</xsl:if>			
+			<xsl:copy-of select="$content"/>
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="legend[not(@use or *)]" mode="legend-copy" priority="2">
+	<xsl:copy><xsl:copy-of select="@*[name()!='label' and name()!='literal' and name()!='label-ref']"/>
+		<xsl:apply-templates select="." mode="make-label"/>
+		<xsl:apply-templates select="node()" mode="legend-copy"/>
+	</xsl:copy>
+</xsl:template>
+
+
+<xsl:template match="note" mode="legend-copy">
+	<xsl:copy><xsl:copy-of select="@*[name()!='label' and name()!='literal' and name()!='label-ref' and name()!='width']"/>
+		<xsl:variable name="text"><xsl:apply-templates select="." mode="make-label"/></xsl:variable>
+		<xsl:attribute name="width">
+			<xsl:choose>
+				<xsl:when test="@width='auto'">
+					<xsl:variable name="len">
+						<xsl:call-template name="multiline-width">
+							<xsl:with-param name="t" select="$text"/>
+						</xsl:call-template>
+						</xsl:variable>
+					<xsl:variable name="h">
+						<xsl:choose>
+							<xsl:when test="@class='lgd'">4.233</xsl:when>
+							<xsl:otherwise>1.94</xsl:otherwise>
+						</xsl:choose>
+					</xsl:variable>
+					<!--  the width is a guess based on the half the (expected) font size + a border of 2.5 on each side-->
+					<xsl:value-of select="5 + $len * 0.5 * $h"/>
+				</xsl:when>
+				<xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
+				<xsl:otherwise>20</xsl:otherwise>
+			</xsl:choose>
+		</xsl:attribute>
+		<xsl:attribute name="height"><xsl:value-of select="3.1 * (1 + string-length($text) - string-length(translate($text,'&#xa;','')))"/></xsl:attribute>
+		<xsl:if test="following-sibling::*">
+			<xsl:attribute name="rpad"><xsl:value-of select="$legendDx"/></xsl:attribute>
+		</xsl:if>
+		<xsl:copy-of select="$text"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="*" mode="is-showable" priority="-1"/>
+<xsl:template match="layer | *[/SystemDefinition[@detail=name() or not(@detail) or not(@static='true' or @detail-type='fixed')]]" priority="4" mode="is-showable">1</xsl:template>
+<xsl:template match="collection[/SystemDefinition[not(@detail) or @detail='component' ]] " mode="is-showable">1</xsl:template>
+<xsl:template match="package[/SystemDefinition/@detail!='layer' ]" mode="is-showable">1</xsl:template>
+
+
+<xsl:template match="*" mode="show-unused-colorsbackground"/>
+<xsl:template match="*" mode="show-unused-colorshighlight"/>
+<xsl:template match="*" mode="show-unused-colorstext-highlight"/>
+<xsl:template match="*" mode="show-unused-patterns"/>
+<xsl:template match="*" mode="show-unused-borders"/>
+<xsl:template match="*" mode="show-unused-styles"/>
+
+<xsl:template match="cbox|cmp" mode="legend-copy"><xsl:param name="show-unused"/>
+	<xsl:variable name="show">
+		<xsl:choose>
+			<xsl:when test="self::cbox[@label='']"/> <!-- always leave out -->
+			<xsl:when test="/SystemDefinition[@detail-type='fixed' or @static='true'] and ((../@detail='component' and /SystemDefinition/@detail!='component') or  
+			(../@detail='collection' and (/SystemDefinition/@detail='layer' or /SystemDefinition/@detail='package')) or 
+			 (../@detail='package' and /SystemDefinition/@detail='layer'))"/> <!--  hide stuff outside level of detail -->
+			<xsl:when test="$show-unused='yes' or ../@show-unused='yes'">1</xsl:when>
+			<xsl:when test="key('style-ref',@style-id)"> <!-- see if it's referenced by anything -->
+				<xsl:apply-templates select="key('style-ref',@style-id)" mode="is-showable"/> 
+			</xsl:when>
+			<xsl:when test="@lookup"> <!-- anything with lookup attribute can be done fast -->
+				<xsl:apply-templates select="key(concat('use-',../@style-id),@lookup)" mode="is-showable"/>
+			</xsl:when>
+			<xsl:when test="self::cmp[parent::legend]">1<!-- it's an example: always use --></xsl:when>
+			<!-- everything else is a rule -->
+			<xsl:when test="self::cbox">
+				<xsl:apply-templates select="//component|//collection|//package|//layer" mode="show-unused-colorsbackground">
+					<xsl:with-param name="n" select="@style-id"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:when test="self::cmp[../@type='overlay']">
+				<xsl:apply-templates select="//component|//collection|//package|//layer" mode="show-unused-patterns">
+					<xsl:with-param name="n" select="@style-id"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:when test="self::cmp[../@type='border']">
+				<xsl:apply-templates select="//component" mode="show-unused-borders">
+					<xsl:with-param name="n" select="@style-id"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:when test="self::cmp[../@type='style']">
+				<xsl:apply-templates select="//component|//collection|//package|layer" mode="show-unused-styles">
+					<xsl:with-param name="n" select="@style-id"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:when test="self::cmp[../@type='highlight']">
+				<xsl:apply-templates select="//component|//collection|//package|layer" mode="show-unused-colorshighlight">
+					<xsl:with-param name="n" select="@style-id"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:when test="self::cmp[../@type='text-highlight']">
+				<xsl:apply-templates select="//component|//collection|//package|layer" mode="show-unused-colorstext-highlight">
+					<xsl:with-param name="n" select="@style-id"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:otherwise>			<xsl:message terminate="yes">[
+	
+	<xsl:value-of select="."/>
+	
+	
+	]</xsl:message>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="(@label | @lookup) and $show!='' ">
+			<xsl:element name="{name()}">
+				<!-- in some cases this had a label, but otherwise use the lookup value as the label -->
+				<xsl:attribute name="id"><xsl:value-of select="@style-id"/></xsl:attribute>
+				<xsl:copy-of select="@font"/> <!-- if any: can only be set via abbrevs file (consider removing this option) -->
+				<xsl:apply-templates select="." mode="make-label"/>
+				<xsl:choose>
+					<xsl:when test="self::cbox">					
+						<xsl:copy-of select="@value"/>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:attribute name="width"><xsl:value-of select="$cSize"/></xsl:attribute>
+						<xsl:attribute name="height"><xsl:value-of select="$cSize"/></xsl:attribute>						
+						<xsl:attribute name="generated-{../@type}"><xsl:value-of select="@value"/></xsl:attribute>
+						<xsl:if test="following-sibling::*"><xsl:attribute name="rpad"><xsl:value-of select="$legendDx"/></xsl:attribute></xsl:if>
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:element>
+		</xsl:when>
+		<xsl:when test="self::cmp[parent::legend] and normalize-space(text()!='')">
+			<xsl:copy> <!-- in some cases this had a label, but otherwise use the lookup value as the label -->
+				<xsl:copy-of select="@font"/> <!-- if any: can only be set via abbrevs file (consider removing this option) -->
+				<xsl:attribute name="width"><xsl:value-of select="$cSize"/></xsl:attribute>
+				<xsl:attribute name="height"><xsl:value-of select="$cSize"/></xsl:attribute>
+				<xsl:if test="following-sibling::*">
+					<xsl:attribute name="rpad"><xsl:value-of select="$legendDx"/></xsl:attribute>
+				</xsl:if>
+				<xsl:apply-templates select="." mode="make-label"/>			
+				<xsl:for-each select="@*[starts-with(name(),'generator')]">
+					<xsl:attribute name="generated{substring-after(name(),'generator')}">
+						<xsl:for-each select="key('styled',.)"><xsl:value-of select="@value | @default"/></xsl:for-each>							
+					</xsl:attribute>
+				</xsl:for-each>
+			</xsl:copy>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+
+
+<xsl:template match="cmp|cbox|legend|note|group|legend-layer" mode="name">
+	<xsl:choose>
+		<xsl:when test="@label-ref"><xsl:apply-templates mode="eval-label" select="."/></xsl:when> <!-- evaluated name -->
+		<xsl:when test="@abbrev"><xsl:value-of select="@abbrev"/></xsl:when> <!-- localisation override-->
+		<xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when> <!-- label override-->
+		<xsl:when test="self::legend[@use]"><xsl:apply-templates select="key('ldg-use',@use)" mode="name"/></xsl:when> <!-- for legends -->
+		<xsl:when test="name"><xsl:value-of select="name"/></xsl:when>
+		<xsl:when test="@lookup"><xsl:value-of select="@lookup"/></xsl:when>
+		<xsl:when test="@name"><xsl:value-of select="@name"/></xsl:when>
+		<xsl:when test="self::cmp"><xsl:value-of select="text()"/></xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="note[not(@label-ref)]" mode="eval-label" priority="5"><xsl:value-of select="."/></xsl:template>
+<xsl:template match="legend[not(@label-ref)]" mode="eval-label" priority="5"><xsl:value-of select="@label"/></xsl:template>
+<xsl:template match="cmp|cbox" mode="eval-label" priority="-3"><xsl:value-of select="@label"/></xsl:template>
+<xsl:template match="cmp[not(@label)] | note" mode="eval-label" priority="-2"><xsl:value-of select="."/></xsl:template>
+
+
+<!-- replace temporary legend items' labels with evaluated ones-->
+<xsl:template match="legend|cbox|cmp|group|legend-layer" mode="make-label">
+	<xsl:copy-of select="@font"/>
+	<xsl:choose>
+		<xsl:when test="@label-ref"><xsl:attribute name="label"><xsl:apply-templates mode="eval-label" select="."/></xsl:attribute></xsl:when>
+		<xsl:when test="@label"><xsl:copy-of select="@label"/></xsl:when>
+		<xsl:when test="@lookup"><xsl:attribute name="label"><xsl:value-of select="@lookup"/></xsl:attribute></xsl:when>
+		<xsl:when test="self::cmp[text()]"><xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute></xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="note" mode="make-label">
+	<xsl:choose>
+		<xsl:when test="not(@label-ref)"><xsl:copy-of select="node()"/></xsl:when>
+		<xsl:otherwise><xsl:apply-templates mode="eval-label" select="."/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!-- the title -->
+
+<xsl:template name="title-line1"> <!--  must call on SystemDefinition element-->
+	<xsl:value-of select="@name"/>
+	<xsl:if test="not(@name)"><xsl:value-of select="systemModel/@name"/></xsl:if>
+	<xsl:if test="@ver and @ver!=''">
+		<xsl:text> </xsl:text>
+		<xsl:apply-templates select="@ver" mode="as-text"/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template name="title-line2"> <!--  must call on SystemDefinition element-->
+	<xsl:if test="@label"><xsl:value-of select="@label"/></xsl:if>
+</xsl:template>
+
+<xsl:template name="title-line3"> <!--  must call on SystemDefinition element-->
+	<xsl:choose> <!-- show nothing if nothing specified, but leave tspan in case later need for it -->
+		<xsl:when test="@revision">
+			<xsl:variable name="rt"><xsl:apply-templates select="@revision-type" mode="as-text"/></xsl:variable>
+			<xsl:if test="$rt!=''">	<!--  space follows if not empty -->
+				<xsl:value-of select="concat($rt,' ')"/>							
+			</xsl:if>
+			<xsl:apply-templates select="@revision" mode="as-text"/>
+		</xsl:when>
+		<xsl:when test="@revision-type">
+			<xsl:apply-templates select="@revision-type" mode="as-text"/>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="SystemDefinition" mode="legend-title-width">
+	<xsl:param name="h"/>
+	<xsl:variable name="titleW" select="72.8"/> <!--  min title width -->
+	<xsl:variable name="len">
+		<xsl:call-template name="multiline-width">
+			<xsl:with-param name="t">	
+				<xsl:call-template name="title-line1"/>
+				<xsl:text>&#xa;</xsl:text>
+				<xsl:call-template name="title-line2"/>
+				<xsl:text>&#xa;</xsl:text>
+				<xsl:call-template name="title-line3"/>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+		<!--  the width is a guess based on 2/3 of the (expected) bold font size -->
+	<xsl:choose>
+		<!-- use min width only if title is not explicitly scaled -->
+		<xsl:when test="(5 + $len * 0.66 * $h &lt; $titleW) and not(*/meta/legend/@title-scale)"><xsl:value-of select="$titleW"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="5 + $len * 0.66 * $h"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+
+<xsl:template match="node()|@*" mode="as-text" priority="-1"><xsl:value-of select="."/></xsl:template>
+<xsl:template match="@copyright" mode="as-text">Copyright &#xa9; <xsl:value-of select="."/></xsl:template>
+
+<xsl:template match="@distribution" mode="as-text">
+	<xsl:choose>
+		<xsl:when test=".='secret'">SECRET</xsl:when>
+		<xsl:when test=".='confidential'">CONFIDENTIAL</xsl:when>
+		<xsl:when test=".='internal'">INTERNAL</xsl:when>
+		<xsl:when test=".='unrestricted'">UNRESTRICTED</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="."/>
+			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Warning: unknown security classification: <xsl:value-of select="."/></xsl:with-param></xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="@revision-type" mode="as-text">
+	<xsl:choose> <!-- known values are in uppercase -->
+		<xsl:when test=".='draft'">DRAFT</xsl:when>
+		<xsl:when test=".='issued'">ISSUED</xsl:when>
+		<xsl:when test=".='build'">Build</xsl:when>
+		<xsl:when test=".='date' and ../@revision!=''"/> <!-- don't show word 'date', just show the date -->
+		<xsl:otherwise><xsl:value-of select="normalize-space(.)"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="@ver" mode="as-text">v<xsl:value-of select="."/></xsl:template>  <!-- normal  -->
+<xsl:template match="@ver[starts-with(.,'^')]" mode="as-text"><xsl:value-of select="."/></xsl:template>  <!-- to allow SF version notation -->
+<xsl:template match="@ver[starts-with(.,'tb')]" mode="as-text"> <!-- to allow TB notation -->
+	<xsl:value-of select="concat('vTB',substring(.,3,string-length(.)-3),'.',substring(.,string-length(.)))"/>
+</xsl:template> 
+
+<!-- /title -->
+
+
+
+<!-- ============ utilities ============ -->
+
+<xsl:template name="multiline-width"><xsl:param name="t" select="."/>
+	<xsl:choose>
+		<xsl:when test="contains($t,'&#xa;')">
+			<xsl:variable name="len" select="string-length(normalize-space(substring-before($t,'&#xa;')))"/>
+			<xsl:variable name="next">
+				<xsl:call-template name="multiline-width">
+					<xsl:with-param name="t" select="substring-after($t,'&#xa;')"/>
+				</xsl:call-template>
+			</xsl:variable>
+		<xsl:choose>
+			<xsl:when test="$len &lt; $next"><xsl:value-of select="$next"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$len"/></xsl:otherwise>
+		</xsl:choose>
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="string-length(normalize-space($t))"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/legend.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,333 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/2000/svg" xmlns:s="http://www.w3.org/2000/svg"  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:exslt="http://exslt.org/common"  exclude-result-prefixes="s exslt" >
+ 
+<!-- title of the model -->
+<xsl:template mode="title" match="SystemDefinition">
+	<title>
+		<xsl:call-template name="title-line1"/>
+		<xsl:variable name="t2"><xsl:call-template name="title-line2"/></xsl:variable>
+		<xsl:variable name="t3"><xsl:call-template name="title-line3"/></xsl:variable>		
+		<xsl:if test="$t2!=''"><xsl:value-of select="concat(' ',$t2)"/></xsl:if>
+		<xsl:if test="$t3!=''"><xsl:value-of select="concat(': ',$t3)"/></xsl:if>
+	</title>
+</xsl:template>
+
+
+
+<xsl:template match="meta[@rel='model-logo']"  mode="global">
+	<xsl:param name="bottom"/>
+	<xsl:for-each select="logo">
+	<g class="logo">
+		<xsl:attribute name="transform">translate(0 <xsl:value-of select="$bottom"/>) <xsl:if test="@viewBox">
+			<xsl:variable name="b" select="normalize-space(@viewBox)"/>
+			<xsl:variable name="x0" select="- number(substring-before($b,' '))"/>
+			<xsl:variable name="y0" select="- number(substring-before(substring-after($b,' '),' '))"/>
+			<xsl:variable name="x1" select="number(substring-before(substring-after(substring-after($b,' '),' '),' '))"/>
+			<xsl:variable name="y1" select="number(substring-after(substring-after(substring-after($b,' '),' '),' '))"/>
+			<xsl:text> scale(</xsl:text>
+			<xsl:if test="@width"><xsl:value-of select="number(@width) div ($x1 + $x0)"/></xsl:if>
+			<xsl:if test="@height">
+				<xsl:text> </xsl:text><xsl:value-of select="@height div ($y1 + $y0)"/>
+			</xsl:if>
+			<xsl:if test="not(@width | @height)">1</xsl:if>
+			<xsl:text>)</xsl:text>
+			<xsl:if test="not($x0=0 and $y0=0)"> translate(<xsl:value-of select="concat($x0,' ', $y0)"/>)</xsl:if>
+		</xsl:if></xsl:attribute>
+		<xsl:choose>
+			<xsl:when test="@src">
+				<image  x="0" y="0" width="{@width}" height="{@height}" xlink:href="{@src}"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:copy-of select="*"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</g>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="meta[@rel='model-footer' and *]"  mode="global">
+	<xsl:variable name="copyright">
+		<xsl:apply-templates select="ancestor::SystemDefinition/@copyright" mode="as-text"/>	
+	</xsl:variable>
+	<xsl:variable name="distribution">
+		<xsl:apply-templates select="ancestor::SystemDefinition/@distribution" mode="as-text"/>	
+	</xsl:variable>
+	<g class="footer" transform="translate(0 {ancestor::SystemDefinition/@height - @height})">
+		<xsl:if test="$copyright != '' and copyright">
+			<text text-anchor="start" class="lgd" x="0" y="{@height}" style="font-weight: normal"><xsl:value-of select="$copyright"/></text>
+		</xsl:if>
+		<xsl:if test="$distribution !='' and distribution">
+			<text text-anchor="middle" class="lgd" x="{ancestor::SystemDefinition/@width *0.5}" y="{@height}" style="font-weight: normal"><xsl:value-of select="$distribution"/></text>
+		</xsl:if>
+	</g>
+</xsl:template>
+
+
+<!-- 
+Baisc rules:
+	No <legend> means no legend will be generated and no title will appear
+	An empty <legend/> means only the model title will appear.
+	A legend with content will generate the legend as requested. The legend lable  only appears if the legend has content  
+-->
+<xsl:template match="meta[@rel='model-legend']"  mode="global">
+	<xsl:param name="bottom"/>	
+	<xsl:variable name="lw" select="@width div @scaled"/> <!-- width of whole legend area without scaling -->
+	<xsl:for-each select="legend">
+		<xsl:variable name="h" select="(@height | @min-height)"/>
+		<xsl:variable name="w">
+			<xsl:apply-templates select="." mode="actual-width">
+				<xsl:with-param name="h" select="$h - @ipad"/>
+			</xsl:apply-templates>
+		</xsl:variable>
+				
+		<g id="legend-root" class="legend" transform="translate({ancestor::SystemDefinition/@width - $lw} {$bottom}) translate({$lw} {0}) scale({../@scaled}) translate({- $lw})">
+		
+			<!-- draw the model title -->
+			<xsl:apply-templates select="ancestor::SystemDefinition" mode="legend-label">
+				<xsl:with-param name="x" select="$lw - (@title-width * 0.5)"/>
+				<xsl:with-param name="y" select="0"/>
+			</xsl:apply-templates>
+		
+			<xsl:if test="*"> <!-- only draw if there is some legend content -->
+				<g id="legend-box"><!-- legend-box is the rectangle container of all generated legend content (ie not the title)-->
+					<xsl:if test="not(@static='true') and @float">
+						<xsl:attribute name="onmouseout">movelegend('legend-root')</xsl:attribute>
+					</xsl:if>
+					<rect class="legend" rx="{@ipad}" ry="{@ipad}" height="{$h}" width="{$w}" x="0" y="0"/>
+					<g transform="translate({@ipad} {@ipad * 0.5})">
+						<xsl:apply-templates select="@label|*">
+							<xsl:with-param name="h" select="$h - @ipad"/>
+						</xsl:apply-templates>
+					</g>
+				</g>
+			</xsl:if>
+		</g>		
+	<xsl:if test="not(@static='true') and @float">
+		<g id="legend-display" class="legend" transform="translate({ancestor::SystemDefinition/@width - $lw} {$bottom})" opacity="0.8">
+		  	<g id="legend-owner">
+				<rect id="legend-ctrl" rx="{@ipad}" ry="{@ipad}" height="{$h}" width="{$w}" x="0" y="0" visibility="hidden" pointer-events="all">
+					<xsl:attribute name="onmouseover">movelegend('legend-owner')</xsl:attribute>
+				</rect>
+		    </g>
+		</g>
+	</xsl:if>
+	</xsl:for-each>
+</xsl:template>
+
+
+<xsl:template match="@label"><xsl:param name="h"/>
+	<text text-anchor="start" class="lgd" dy="0.375em" x="0">
+		<xsl:attribute name="y"><xsl:value-of select="$h div 2 "/></xsl:attribute>
+		<xsl:for-each select=".."><xsl:call-template name="display-name"/></xsl:for-each>
+	</text>
+</xsl:template>
+
+<xsl:template match="note"><xsl:param name="h"/>
+	<xsl:variable name="off">
+	<xsl:apply-templates select="." mode="x-pos">
+					<xsl:with-param name="h" select="$h"/>
+				</xsl:apply-templates>
+	</xsl:variable>
+	<xsl:variable name="newlines" select="string-length(.) - string-length(translate(.,'&#xa;',''))"/>	
+	<text text-anchor="middle"  class="label"  dy="0.375em" x="{$off + 0.5* @width}" y="{$h div 2}">
+		<xsl:copy-of select="@style|@class"/>
+		<xsl:call-template name="multiline">
+			<xsl:with-param name="x" select="$off  + 0.5* @width"/>
+			<xsl:with-param name="n" select="-0.5 * $newlines"/>
+			<xsl:with-param name="t">
+				<xsl:apply-templates select="." mode="eval-label"/>
+			</xsl:with-param>
+		</xsl:call-template>			
+	</text>
+</xsl:template>
+
+
+<xsl:template match="SystemDefinition" mode="legend-label">
+	<xsl:param name="x"/>
+	<xsl:param name="y"/>
+	<text  text-anchor="middle" class="title" x="{$x}" y="{$y}">
+		<tspan dy="0.75em" x="{$x}">
+			<xsl:call-template name="title-line1"/>
+		</tspan>
+		<tspan dy="1em" x="{$x}">
+			<xsl:call-template name="title-line2"/>
+		</tspan>
+		<tspan font-style="italic" dy="1em" id="release-version" x="{$x}">
+			<!-- show nothing if nothing specified, but leave tspan in case later need for it -->
+			<xsl:variable name="t3"><xsl:call-template name="title-line3"/></xsl:variable>
+			<xsl:if test="@revision and starts-with($t3,'DRAFT') or (@revision-type and not(@revision))">
+				<!-- draft is in uppercase, but not bold font -->
+				<!-- or if it's just the type with no value, put in non-bold font. -->
+					<xsl:attribute name="font-weight">normal</xsl:attribute>
+			</xsl:if>
+			<xsl:value-of select="$t3"/>	
+		</tspan>
+	</text>
+</xsl:template>
+
+
+
+<xsl:template match="legend|note" mode="x-pos"><xsl:param name="h"/>
+	<xsl:variable name="x" select="sum(preceding-sibling::*/@width | preceding-sibling::*/@rpad | parent::legend[parent::meta]/@label-width)"/>
+	<xsl:choose>
+		<xsl:when test="preceding-sibling::*[not(@width)]">
+			<xsl:call-template name="sum-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="concat($x, ' ')"/>
+			<xsl:for-each select="preceding-sibling::*[not(@width)]">
+				<xsl:apply-templates select="." mode="actual-width">
+					<xsl:with-param name="h" select="$h"/>
+				</xsl:apply-templates>
+				<xsl:text> </xsl:text>			
+		</xsl:for-each>
+		</xsl:with-param> 
+	</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="$x"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="legend"><xsl:param name="h"/>
+	<g>
+		<xsl:attribute name="transform">translate(<xsl:apply-templates select="." mode="x-pos">
+			<xsl:with-param name="h" select="$h"/>
+		</xsl:apply-templates> 0)</xsl:attribute>
+		<xsl:variable name="name"><xsl:call-template name="name-value"/></xsl:variable>
+		<xsl:if test="$name!=''">
+			<text text-anchor="end"  class="label"  dy="0.375em" x="{@label-width - 1.5}" y="{$h div 2}">
+				<xsl:attribute name="width"><xsl:value-of select="@label-width - 1.5"/></xsl:attribute>
+				<xsl:if test="@font"><xsl:attribute name="style">font-family: '<xsl:value-of select="@font"/>'</xsl:attribute></xsl:if>	
+				<xsl:value-of select="$name"/>:</text>
+		</xsl:if>
+		<xsl:choose>
+			<xsl:when test="@sort='yes'">
+				<xsl:apply-templates select="*| key('ldg-use',@use)/*[@lookup or @label]">
+					<xsl:sort select="concat(@label,@lookup)"/>
+					<xsl:with-param name="h" select="$h"/>		<!-- available height  -->	
+					<xsl:with-param name="y" select="0"/>				<!-- vertical offset  -->		
+				</xsl:apply-templates>	
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:apply-templates select="*| key('ldg-use',@use)/*[@lookup or @label]">
+					<xsl:with-param name="h" select="$h"/>		<!-- available height  -->	
+					<xsl:with-param name="y" select="0"/>				<!-- vertical offset  -->		
+				</xsl:apply-templates>			
+			</xsl:otherwise>
+		</xsl:choose>
+	</g>
+</xsl:template>
+
+<xsl:template match="legend/cbox|group/cbox"><xsl:param name="h"/><!-- can only have one type per legend -->
+	<xsl:variable name="rows" select="floor(($h+0.0001) div $cboxHeight)"/> <!--  avoid rounding errors -->
+	<xsl:variable name="total" select="last()"/>
+	<xsl:variable name="cols" select="ceiling($total div $rows)"/>
+	<xsl:variable name="dy" select="($h -  floor(1 + ($total - 1) div $cols) * $cboxHeight)  div 2"/>
+	<xsl:variable name="index" select="position() - 1"/>
+
+		<g id="{@id|@style-id}">
+			<!-- id used for mouseover animations -->
+			<rect  class="cbox" height="{$cboxHeight}" width="{$cboxWidth}">
+				<xsl:apply-templates select="." mode="color"/>
+				<xsl:attribute name="x"><xsl:value-of select="sum(../@label-width) + $cboxWidth * ($index mod $cols)"/></xsl:attribute>
+				<xsl:attribute name="y"><xsl:value-of select="$dy + floor($index div $cols) * $cboxHeight"/></xsl:attribute>
+			</rect>
+			<text  text-anchor="middle" class="cbox" width="{$cboxWidth}" dy="0.375em">
+				<xsl:attribute name="x"><xsl:value-of select="sum(../@label-width) + $cboxWidth * (($index mod $cols) + 0.5)"/></xsl:attribute>
+				<xsl:attribute name="y"><xsl:value-of select="$dy + ( 0.5 + floor($index div $cols)) * $cboxHeight"/></xsl:attribute>
+				<xsl:if test="@font"><xsl:attribute name="style">font-family: '<xsl:value-of select="@font"/>'</xsl:attribute></xsl:if>				
+				<xsl:apply-templates mode="name" select="."/>
+			</text>
+		</g>
+</xsl:template>
+
+
+<!-- for drawing generated legend items -->
+
+
+<xsl:template match="*" mode="color"><xsl:attribute name="fill"><xsl:value-of select="@color"/></xsl:attribute></xsl:template>
+<xsl:template match="cbox" mode="color"><xsl:attribute name="fill"><xsl:value-of select="@value"/></xsl:attribute></xsl:template>
+
+<xsl:template match="cbox" mode="id">color-<xsl:value-of select="concat(name(),'-',count(preceding::cbox))"/></xsl:template>
+<xsl:template match="cmp" mode="id">style-<xsl:value-of select="concat(name(),'-',count(preceding::cmp))"/></xsl:template>
+<xsl:template match="*[@style-id]" mode="id"><xsl:value-of select="concat(name(),'-',@style-id)"/></xsl:template>
+
+
+
+<xsl:template match="cmp" mode="display-style">
+	<xsl:variable name="color"><xsl:apply-templates select="." mode="display-style-color"/></xsl:variable>
+	<xsl:if test="$color!=''">fill:<xsl:value-of select="$color"/>;</xsl:if>
+	<xsl:for-each select="@generated-style | generated-style/@value"><xsl:value-of select="."/>;</xsl:for-each>
+	<xsl:apply-templates select="." mode="display-style-aux"/>
+</xsl:template>
+
+<xsl:template match="cmp[@generated-color]" mode="display-style-color" priority="8"><!-- colour in legend -->
+	<xsl:value-of select="@generated-color"/>
+</xsl:template>
+
+<xsl:template match="cmp[@generated-overlay|generated-overlay]" mode="overlays" priority="8">
+	<xsl:for-each select="@generated-overlay|generated-overlay/@ref">
+		<o><xsl:value-of select="."/></o>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="cmp[@generated-border]" mode="shape" priority="8">
+	<xsl:value-of select="@generated-border"/>
+</xsl:template>
+
+<xsl:template match="cmp[@generated-text-highlight]" mode="text-filter"  priority="8">
+		<xsl:attribute name="filter">url(<xsl:value-of select="@generated-text-highlight"/>)</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="cmp[@generated-highlight]" mode="filter" priority="8">
+	<xsl:attribute name="filter">url(<xsl:value-of select="@generated-highlight"/>)</xsl:attribute>
+</xsl:template>
+
+
+<xsl:template match="group[@type='border']/cmp[@value]" mode="shape">
+	<xsl:value-of select="@value"/>
+</xsl:template>
+
+<xsl:template match="group[@type='overlay']/cmp[@value]" mode="overlays">
+	<o><xsl:value-of select="@value"/></o>
+</xsl:template>
+
+<xsl:template match="group[@type='style']/cmp[@value]" mode="display-style-aux" priority="6">
+	<xsl:value-of select="@value"/>;</xsl:template>
+
+<xsl:template match="group[@type='text-highlight']/cmp[@value]" mode="text-filter"  priority="8">
+		<xsl:attribute name="filter">url(<xsl:value-of select="@value"/>)</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="group[@type='highlight']/cmp[@value]" mode="filter" priority="8">
+	<xsl:attribute name="filter">url(<xsl:value-of select="@value"/>)</xsl:attribute>
+</xsl:template>
+
+
+<!-- end legend items -->
+
+<xsl:template name="multiline"> <!-- draw text with newlines -->
+	<xsl:param name="x" select="0"/> <!-- anchor point -->
+	<xsl:param name="n" select="1"/> <!-- spacing: default is single-spaced -->
+	<xsl:param name="t" select="."/> <!-- the text to draw -->
+<xsl:choose>
+	<xsl:when test="contains($t,'&#xa;')">
+		<tspan dy="{$n}em" x="{$x}">
+		<xsl:value-of select="normalize-space(substring-before($t,'&#xa;'))"/></tspan>	
+		<xsl:call-template name="multiline">
+			<xsl:with-param name="x" select="$x"/>
+			<xsl:with-param name="t" select="substring-after($t,'&#xa;')"/>
+		</xsl:call-template>
+	</xsl:when>
+	<xsl:otherwise>
+		<tspan dy="{$n}em" x="{$x}"><xsl:value-of select="normalize-space($t)"/></tspan>	
+	</xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+
+
+</xsl:stylesheet>
+
+	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/mergesysdef-module.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,689 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common"  exclude-result-prefixes="exslt">
+<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+	All rights reserved.
+	This component and the accompanying materials are made available
+	under the terms of the License "Eclipse Public License v1.0"
+	which accompanies this distribution, and is available
+	at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+	Initial Contributors:
+	Nokia Corporation - initial contribution.
+	Contributors:
+	Description:
+	XSLT module for merging only two sysdef files according to the 3.0.1 rules. 
+		2.x and older syntax not supported and must be converted before calling.
+
+		Requires the including XSLT to also include path-module.xsl
+-->
+	
+<xsl:variable name="defaultnamespace">http://www.symbian.org/system-definition</xsl:variable>
+
+<xsl:template match="/SystemDefinition[starts-with(@schema,'2.') or starts-with(@schema,'1.')]" priority="2" mode="merge-models">
+	<xsl:message terminate="yes">ERROR: Syntax <xsl:value-of select="@schema"/> not supported</xsl:message>
+</xsl:template>
+<!--<xsl:template match="/SystemDefinition[not(systemModel)]" priority="2" mode="merge-models">
+	<xsl:message terminate="yes">ERROR: Can only merge stand-alone system models</xsl:message>
+</xsl:template>-->
+
+<!-- stuff for dealing with namespaces -->
+
+
+<xsl:template match="node()|@*" mode="translate-namespaces"><xsl:copy-of select="."/></xsl:template>
+<!-- don't translate meta or unit tags, just copy verbatim -->
+<xsl:template match="meta|unit" mode="translate-namespaces" priority="2">
+<xsl:element name="{name()}">
+<xsl:copy-of select="@*|*|comment()"/>
+</xsl:element>
+</xsl:template>
+
+<xsl:template match="*" mode="translate-namespaces"><xsl:param name="nsdoc"/>
+<xsl:element name="{name()}">
+<xsl:apply-templates select="@*|node()" mode="translate-namespaces">
+	<xsl:with-param name="nsdoc" select="$nsdoc"/>
+</xsl:apply-templates>
+</xsl:element>
+</xsl:template>
+
+
+<xsl:template match="@id|@before|@replace" mode="translate-namespaces"><xsl:param name="nsdoc"/>
+	<xsl:attribute name="{name()}">
+		<xsl:variable name="id">
+			<xsl:choose>
+				<xsl:when test="contains(.,':')">
+					<xsl:value-of select="substring-after(.,':')"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:value-of select="."/>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="ns">
+			<xsl:choose>
+				<xsl:when test="contains(.,':')">
+					<xsl:value-of select="ancestor-or-self::*/namespace::*[name()=substring-before(current()/.,':')]"/>
+				</xsl:when>
+				<xsl:when test="ancestor::SystemDefinition/@id-namespace">
+					<xsl:value-of select="ancestor::SystemDefinition/@id-namespace"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:value-of select="$defaultnamespace"/>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:choose>
+			<xsl:when test="not($nsdoc/@id-namespace) and $defaultnamespace=$ns">
+				<xsl:value-of select="$id"/>
+			</xsl:when>
+			<xsl:when test="$nsdoc/@id-namespace=$ns">
+				<xsl:value-of select="$id"/>
+			</xsl:when>
+			<xsl:when test="$nsdoc/namespace::*[.=$ns]">
+				<xsl:value-of select="concat(name($nsdoc/namespace::*[.=$ns]),':',$id)"/>
+			</xsl:when>
+			<xsl:when test="ancestor::SystemDefinition/@id-namespace=$ns">
+				<xsl:variable name="myns">
+					<xsl:apply-templates mode="ns-prefix" select="$nsdoc">
+						<xsl:with-param name="ns" select="$ns"/>
+					</xsl:apply-templates>
+				</xsl:variable>			
+				<xsl:value-of select="concat($myns,':',$id)"/>
+			</xsl:when>
+			<xsl:otherwise> <!-- some namespace that needed to be defined --> 
+			<xsl:message>Warning: need definition for namespace "<xsl:value-of select="$ns"/>" for <xsl:value-of select="$id"/></xsl:message>
+				<xsl:value-of select="."/>					
+			</xsl:otherwise>
+		</xsl:choose>		
+	</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="SystemDefinition" mode="ns-prefix">
+	<xsl:param name="ns"/> <!-- the namespace URI -->
+	<xsl:param name="pre"/> <!-- the preferred prefix to use if possbile -->
+	<xsl:param name="dontuse"/> <!-- space prefixed, separated and terminated list of namespace prefixes to not use -->
+	<xsl:param name="chars">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</xsl:param> <!-- single letter namespace prefixes to try -->
+	<xsl:variable name="name" select="substring(substring-after($ns,'http://www.'),1,1)"/>
+	<xsl:choose>
+		<xsl:when test="$pre!='' and $pre!='id-namespace' and not(//namespace::*[name()=$pre]) and not(contains($dontuse,concat(' ',$pre,' ')))">
+			<xsl:value-of select="$pre"/>
+		</xsl:when>
+		<xsl:when test="$ns='' and $chars=''">
+			<xsl:message terminate="yes">ERROR: Cannot create namespace prefix for downstream default namespace in <xsl:value-of select="*/@id"/></xsl:message>
+		</xsl:when>
+		<xsl:when test="$name!='' and not(contains($dontuse,concat(' ',$name,' ')))"><xsl:value-of select="$name"/></xsl:when>
+		<xsl:when test="namespace::*[name()=substring($chars,1,1)] or contains($dontuse,concat(' ',substring($chars,1,1),' '))">
+			<xsl:apply-templates mode="ns-prefix">
+				<xsl:with-param name="chars" select="substring($chars,2)"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="substring($chars,1,1)"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!--  need to make sure this handles <meta> correctly -->
+
+<xsl:template match="SystemDefinition" mode="merge-models">
+	<xsl:param name="other"/>	<!-- the downstream SystemDefinition this is merged with -->
+	<xsl:param name="up" select="systemModel"/>	<!-- the element containing the origin @name used for any component from "this" model. -->
+	<xsl:param name="down" select="$other/systemModel"/> <!-- the element containing origin @name used for any component from $other model. -->
+	
+	<!-- do some testing -->
+ 	<xsl:if test="$other[starts-with(@schema,'2.') or starts-with(@schema,'1.')]">
+		<xsl:message terminate="yes">ERROR: Syntax <xsl:value-of select="$other/@schema"/> not supported</xsl:message>
+	</xsl:if>
+	<xsl:if test="name(*) != name($other/*)">
+		<xsl:message terminate="yes">ERROR: Can only merge system models of the same rank</xsl:message>
+	</xsl:if>
+
+	<xsl:copy>
+		<xsl:attribute name="schema">
+			<xsl:call-template name="compare-versions">
+				<xsl:with-param name="v1" select="@schema"/>
+				<xsl:with-param name="v2" select="$other/@schema"/>
+			</xsl:call-template>
+		</xsl:attribute>
+		<xsl:copy-of  select="@*[name()!='schema']"/> <!--  use attributes from origin model -->
+		<xsl:variable name="namespaces">
+			<xsl:copy> <!-- needs <copy> so the processor doesn't lose the namespaces -->
+				<!--copy namespaces as needed -->
+				
+				<xsl:copy-of select="namespace::*[name()!='xml']"/> <!-- all upstream namespaces -->
+
+				<xsl:variable name="cur" select="."/>
+				<xsl:for-each select="$other/namespace::*"> <!-- all namespaces in downstream not already in upstream -->
+					<xsl:if test="not((. = $cur/@id-namespace) or (not($cur/@id-namespace) and .= $defaultnamespace) or  $cur/namespace::*[.=current()])">
+							<!-- namespace in downstream not in upstream doc -->
+							<xsl:variable name="newprefix">
+								 <!-- test to see if the ns prefix already exists -->
+								<xsl:apply-templates select="$cur" mode="ns-prefix">
+									<xsl:with-param name="ns" select="."/>
+									<xsl:with-param name="pre" select="name()"/>
+								</xsl:apply-templates>
+							</xsl:variable>
+							<xsl:copy/>
+					</xsl:if>   
+				</xsl:for-each>
+				
+					<xsl:if test="not(($other/@id-namespace = @id-namespace) or (not($other/@id-namespace) and not(@id-namespace)) or (not(@id-namespace) and $other/@id-namespace = $defaultnamespace) or namespace::*[.=$other/@id-namespace])">  
+						<!-- default namespace in downstream not in upstream doc -->
+						<!-- need to make created ns a bit more intelligent -->
+						<xsl:attribute name="bar" namespace="{$other/@id-namespace}">
+							<xsl:value-of select="$other/@id-namespace"/>
+						</xsl:attribute>
+				</xsl:if>
+			</xsl:copy>
+		</xsl:variable>
+
+		
+		<!-- copy the namespaces to currently open element (the root one) -->
+		<xsl:copy-of select="namespace::*"/>
+		<xsl:for-each select="$other/namespace::*[.!=current()/namespace::*]"><xsl:copy/></xsl:for-each>
+		<xsl:for-each select="exslt:node-set($namespaces)/*/namespace::*"><xsl:copy/></xsl:for-each>
+	<!-- translate all IDs in downstream doc to use namespaces from upstream doc  
+		This is so much easier than having to propigate this info around while creating the doc-->
+	<xsl:variable name="otherdoc">
+		<xsl:apply-templates mode="translate-namespaces" select="$other">
+			<xsl:with-param name="nsdoc" select="exslt:node-set($namespaces)/* | ."/>
+		</xsl:apply-templates>
+	</xsl:variable>
+		<xsl:apply-templates mode="merge-models">
+			<xsl:with-param name="other" select="exslt:node-set($otherdoc)/*"/>
+			<xsl:with-param name="up" select="$up"/>
+			<xsl:with-param name="down" select="$down"/>
+			<xsl:with-param name="replaces" select="exslt:node-set($otherdoc)//*[self::component or self::collection or self::package or self::layer]/@replace"/>
+		</xsl:apply-templates>
+	
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="systemModel" mode="merge-models">
+	<xsl:param name="other"/>	<!-- the parent of the downstream systemModel this is merged with -->
+	<xsl:param name="up"/>
+	<xsl:param name="down"/>
+	<xsl:param name="replaces"/>
+	<xsl:copy><xsl:copy-of  select="@*"/>
+		<!--  copy metas and comments in between meta. Do not try to merge metadata between models -->
+			<xsl:copy-of select="meta | $other/systemModel/meta | comment()[following-sibling::meta]"/>	
+		<xsl:apply-templates mode="merge-models">
+			<xsl:with-param name="other" select="$other/systemModel"/>
+			<xsl:with-param name="up" select="$up"/>
+			<xsl:with-param name="down" select="$down"/>
+			<xsl:with-param name="replaces" select="$replaces"/>
+		</xsl:apply-templates>
+
+		<!-- tack on any remaining layers -->
+		<xsl:apply-templates mode="merge-copy-of" select="$other/systemModel/layer[not(@before) and not(following-sibling::*[@id=current()/layer/@id]) and not(@id=current()/layer/@id)]">
+			<xsl:with-param name="origin" select="$down"/>
+			<xsl:with-param name="root" select="current()/.."/>
+			<xsl:with-param name="replaces" select="$replaces"/>
+		</xsl:apply-templates>		
+
+		<!-- and now check for error cases, and tack those on -->
+		<xsl:call-template name="check-and-add-out-of-order-items">
+			<xsl:with-param name="match" select="$other/systemModel"/>
+			<xsl:with-param name="down" select="$down"/>
+			<xsl:with-param name="replaces" select="$replaces"/>
+		</xsl:call-template> 
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template name="check-and-add-out-of-order-items"><xsl:param name="match"/><xsl:param name="down"/><xsl:param name="replaces"/>
+	<xsl:if test="$match">
+		<!-- determine the order of the children in the upstream and downstream docs --> 
+		<xsl:variable name="up-order">
+			<xsl:for-each select="*[@id=$match/*[not(@before)]/@id]"><xsl:value-of select="@id"/><xsl:text> </xsl:text></xsl:for-each>
+		</xsl:variable>
+		<xsl:variable name="down-order">
+			<xsl:for-each select="$match/*[@id = current()/*[not(@before)]/@id]"><xsl:value-of select="@id"/> <xsl:text> </xsl:text></xsl:for-each>
+		</xsl:variable>
+
+		<!-- check for error cases, and tack those on -->
+		<xsl:if test="$up-order != $down-order">
+			<xsl:variable name="down-final" select="$match/*[@id = current()/*[not(@before)]/@id][last()]/@id"/>
+				<!-- the last item in the downstream model that is also in the upstream one -->
+
+			<xsl:variable name="out-of-order" select="$match/*[@id][not(@before=current()/*/@id) and not(@id=current()/*/@id) and following-sibling::*[@id=$down-final]]"/>
+				<!-- contains all items in the downstream model that can't be put in order-->
+			<xsl:if test="$out-of-order">
+				<xsl:message>ERROR: Order of <xsl:value-of select="name(*)"/>s in upstream document does not match order in downstream.  The following <xsl:value-of select="name(*)"/>s will be appended to the end<xsl:if test="@id"> of <xsl:value-of select="@id"/></xsl:if>: <xsl:for-each select="$out-of-order"><xsl:value-of select="concat(@id,' ')"/></xsl:for-each></xsl:message>
+			</xsl:if>
+			<xsl:apply-templates mode="merge-copy-of" select="$out-of-order">
+				<xsl:with-param name="origin" select="$down"/>
+				<xsl:with-param name="root" select="current()/ancestor::SystemDefinition"/>			
+				<xsl:with-param name="replaces" select="$replaces"/>
+			</xsl:apply-templates>			
+		</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="@*|*|comment()" mode="merge-models"><xsl:copy-of select="."/></xsl:template>
+
+
+<xsl:template match="meta|comment()[following-sibling::meta]" mode="merge-models"/>
+	<!-- copy elesewhere, not here so that metas always appear first-->
+
+
+
+<!-- merge levels attribute via std rules -->
+<xsl:template match="layer/@levels|package/@levels" mode="merge-models">
+	<xsl:param name="other"/><!-- the element contains the other @levels -->
+	<xsl:choose>
+		<!--  if they are the same, or not specified in the other,  just copy -->
+		<xsl:when test=".=$other/@levels or not($other/@levels)"><xsl:copy-of select="."/></xsl:when>
+		<xsl:when test="contains(concat(' ',normalize-space(.),' '),concat(' ',normalize-space($other/@levels),' '))">
+			<!--upstream completely contains downstream, just copy --> 
+			<xsl:copy-of select="."/>
+		</xsl:when>
+		<xsl:when test="contains(concat(' ',normalize-space($other/@levels),' '),concat(' ',normalize-space(.),' '))">
+			<!--  If this is contained is other, then use other-->
+			<xsl:copy-of select="$other/@levels"/>
+		</xsl:when>
+		<xsl:when test="contains(concat(' ',normalize-space($other/@levels),' '),' - ')">
+			<!-- if other uses - syntax, then pre/append -->
+			<xsl:variable name="lev">
+				<xsl:value-of select="substring-before(concat(' ',normalize-space($other/@levels),' '),' - ')"/>
+				<xsl:value-of select="concat(' ',.,' ')"/>
+				<xsl:value-of select="substring-after(concat(' ',normalize-space($other/@levels),' '),' - ')"/>
+			</xsl:variable>
+			<xsl:attribute name="levels"><xsl:value-of select="normalize-space($lev)"/></xsl:attribute>
+		</xsl:when>
+		<xsl:otherwise> <!--  if they differ, use the origin's levels -->
+			<xsl:message>Note: levels differ "<xsl:value-of select="."/>" vs "<xsl:value-of select="$other/@levels"/>" on <xsl:value-of select="../@id"/></xsl:message>
+			<xsl:copy-of select="."/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="copy-sorted-content">
+	<xsl:param name="base"/>
+	<xsl:param name="to-sort"/>
+	<xsl:param name="start"/>
+	<xsl:param name="end"/>
+	<xsl:param name="down"/>
+	<xsl:param name="remainder" select="/.."/>
+
+	<xsl:choose>
+		<xsl:when test="not($to-sort)"/>  <!-- nothing left to copy. stop -->
+		<xsl:when test="not($base)"/>  <!-- reached end. stop -->
+		<xsl:otherwise>
+			<xsl:for-each select="$to-sort">
+				<xsl:if test="((@before=$end/@id) or not(@before) or not($base/ancestor::SystemDefinition//*[@id=current()/@before])) and not($base[@id=current()/@id])">
+					<xsl:apply-templates mode="merge-copy-of" select=".">
+						<xsl:with-param name="origin" select="$down"/>
+						<xsl:with-param name="root" select="$end/ancestor::SystemDefinition"/>
+					</xsl:apply-templates>
+				</xsl:if>
+			</xsl:for-each>
+		</xsl:otherwise>	
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="node()" mode="merge-data">
+	<xsl:copy-of select="." />
+</xsl:template>
+
+<xsl:template match="meta" mode="merge-data">
+	<xsl:param name="metas" />
+	<!-- compare this meta against all metas in the  merged doc
+		if they are identical, then ignore this one.
+		identical is computed by translating to a string, normalising some known parts. This might be slow in some cases-->
+	<xsl:variable name="val"><xsl:apply-templates select="." mode="as-xml-text" /></xsl:variable>
+	<xsl:variable name="match">
+		<xsl:for-each select="$metas">
+			<xsl:variable name="cur"><xsl:apply-templates select="." mode="as-xml-text" /></xsl:variable>
+			<xsl:if test="$cur=$val">*</xsl:if>
+		</xsl:for-each>
+	</xsl:variable>
+	<xsl:if test="$match='' ">
+		<xsl:copy-of select="." />
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="text()[normalize-space(.)='']" mode="as-xml-text"/>
+<xsl:template match="node()" mode="as-xml-text"><xsl:value-of select="."/></xsl:template>
+<xsl:template match="comment()" mode="as-xml-text">&lt;--<xsl:value-of select="."/>--&gt;</xsl:template>
+<xsl:template match="@*" mode="as-xml-text">
+	<xsl:value-of select="concat(' ',name())"/>="<xsl:value-of select="."/>"</xsl:template>
+<xsl:template match="*" mode="as-xml-text">
+	<xsl:value-of select="concat('&lt;',name())"/>
+	<xsl:apply-templates select="@*" mode="as-xml-text"/>
+	<xsl:if test="self::meta and not(@rel)"> rel="Generic"</xsl:if>
+	<xsl:if test="self::meta and not(@type)"> type="auto"</xsl:if>
+	<xsl:text>&gt;</xsl:text>
+	<xsl:apply-templates select="node()" mode="as-xml-text"/>
+	<xsl:value-of select="concat('&lt;/',name(),'&gt;')"/>
+</xsl:template>
+
+
+<xsl:template name="best-prev"><xsl:param name="cur" select="."/><xsl:param name="alt"/>
+<xsl:if test="$alt">
+<xsl:variable name="prev" select="$cur/preceding-sibling::*[@id][1]"/> 
+<xsl:choose>
+	<xsl:when test="not($prev)"/>
+	<xsl:when test="$alt/preceding-sibling::*[@id=$prev/@id]"><xsl:value-of select="$prev/@id"/></xsl:when>
+	<xsl:otherwise>
+		<xsl:call-template name="best-prev">
+			<xsl:with-param name="cur" select="$prev"/>
+			<xsl:with-param name="alt" select="$alt"/>
+		</xsl:call-template>
+	</xsl:otherwise>
+</xsl:choose>
+</xsl:if>
+</xsl:template>
+
+<xsl:template match="layer | package | collection | component" mode="merge-models">
+	<xsl:param name="other"/>	<!-- the downstream item of the parent's rank that contains a potential items this is merged with -->
+	<xsl:param name="up"/>
+	<xsl:param name="down"/>
+	<xsl:param name="replaces"/>
+	<xsl:variable name="this" select="."/>	<!-- current item -->
+	<!-- match = this item in the downstream model -->	
+	<xsl:variable name="match" select="$other/*[@id=current()/@id]"/>
+
+	<xsl:choose>
+		<xsl:when test="$replaces[.=$this/@id] or (self::component and $match)">  <!-- replace the item instead of merge -->
+			<xsl:message>Note: <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" in "<xsl:value-of select="../@id"/>" <xsl:choose>
+					<xsl:when test="self::component and $match">overridden in downstream sysdef</xsl:when>
+					<xsl:otherwise><xsl:for-each select="$replaces[.=$this/@id]/..">replaced by <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" in "<xsl:value-of select="../@id"/>"</xsl:for-each></xsl:otherwise>
+				</xsl:choose>
+			</xsl:message>
+			<!-- if the removed item is in the downstream doc, just copy that and ignore the upstream contents -->
+			<xsl:apply-templates mode="merge-copy-of" select="$match">
+				<xsl:with-param name="origin" select="$down"/>
+				<xsl:with-param name="root" select="$this/ancestor::SystemDefinition"/>			
+				<xsl:with-param name="replaces" select="$replaces"/>
+			</xsl:apply-templates>		
+		</xsl:when>
+		<xsl:otherwise>
+			<!-- remove this if it's in the list of stuff to be replaced-->
+
+<xsl:variable name="prev-id">
+	<xsl:call-template name="best-prev">
+		<xsl:with-param name="alt" select="$match"/>
+	</xsl:call-template>
+</xsl:variable>
+
+
+	<!-- check the order of the items in the upstream and downstream doc. If they don't match up, we can't merge them nicely -->
+	<xsl:variable name="up-order">
+		<xsl:for-each select="../*[@id=$match/../*[not(@before)]/@id]"><xsl:value-of select="@id"/><xsl:text> </xsl:text></xsl:for-each>
+	</xsl:variable>
+	<xsl:variable name="down-order">
+		<xsl:for-each select="$match/../*[@id = current()/../*[not(@before)]/@id]"><xsl:value-of select="@id"/> <xsl:text> </xsl:text></xsl:for-each>
+	</xsl:variable>
+
+	<!-- prev = the previous item before the current one (no metas, only named items)-->
+	<xsl:variable name="prev" select="preceding-sibling::*[@id=$prev-id]"/> 
+
+
+	<!-- copy all items between this and prev that are solely in the downstream model -->	 		
+
+	<!-- <xsl:variable name="upstream-ids" select="ancestor::SystemDefinition//@id[parent::component or parent::collection or parent::package or parent::layer]"/> -->
+	<xsl:variable name="upstream-ids" select="../*/@id"/> <!-- this is much faster than using all IDs. before only currently works in the same parent anyway -->
+
+	<!-- $upstream-ids is used to avoid inserting an item that's being moved -->
+
+	<xsl:choose>
+		<xsl:when test="$match and $up-order != $down-order">
+		<!-- if the contents are in a different order, there's no way to merge them together. Don't try. Tack them on to the end later -->
+				<xsl:message>ERROR: Order of <xsl:value-of select="name()"/>s in upstream <xsl:value-of select="../@id"/>
+				<xsl:if test="not(../@id)">document</xsl:if> does not match the order of the <xsl:value-of select="name()"/>s in common in the downstream equivalent. Contents will not be properly merged: <xsl:value-of select="$up-order"/>  != 	<xsl:value-of select="$down-order"/></xsl:message>
+		</xsl:when>
+
+		<xsl:when test="$match and $prev">
+			<xsl:call-template name="copy-sorted-content">
+				<xsl:with-param name="base" select="../*[@id]"/>
+				<xsl:with-param name="to-sort" select="$other/*[@id and not(@before=$upstream-ids)][following-sibling::*[@id=$match/@id]][preceding-sibling::*[@id=$prev/@id]]"/>
+				<xsl:with-param name="start" select="$prev"/>
+				<xsl:with-param name="end" select="."/>
+				<xsl:with-param name="down" select="$down"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="$match and not($prev)">
+			<xsl:call-template name="copy-sorted-content">
+				<xsl:with-param name="base" select="../*[@id]"/>
+				<xsl:with-param name="to-sort" select="$other/*[@id and not(@before=$upstream-ids)][following-sibling::*[@id=$match/@id]]"/>
+				<xsl:with-param name="start" select="$prev"/>
+				<xsl:with-param name="end" select="."/>
+				<xsl:with-param name="down" select="$down"/>
+			</xsl:call-template>
+		</xsl:when>
+	</xsl:choose>
+
+ 	<!-- just copy anything identified as being before this, assume they're all ok -->
+
+	<xsl:apply-templates mode="merge-copy-of" select="$other/*[@before=current()/@id]">
+		<xsl:with-param name="remove-before" select="1"/>
+		<xsl:with-param name="origin" select="$down"/>
+		<xsl:with-param name="root" select="$this/ancestor::SystemDefinition"/>	
+		<xsl:with-param name="replaces" select="$replaces"/>
+	</xsl:apply-templates>
+	
+	<xsl:copy>
+		<xsl:apply-templates select="@*" mode="merge-models"> <!-- copy upstream attributes -->
+			<xsl:with-param name="other" select="$match"/>
+		</xsl:apply-templates>
+		<xsl:if test="self::component and not(@origin-model) and ($up/@name or ancestor::systemModel/@name)">
+			<!-- insert origin-model and optional root for components only -->
+			<xsl:attribute name="origin-model">
+				<xsl:value-of select="$up/@name"/>
+				<xsl:if test="not($up/@name)"><xsl:value-of select="ancestor::systemModel/@name"/></xsl:if>
+			</xsl:attribute>
+			<xsl:if test="not(@root)">
+				<xsl:copy-of select="$up/@root"/>
+			</xsl:if>
+		</xsl:if>
+		
+		<xsl:for-each select="$match/@*[name()!='replace']">  <!-- copy downstream attributes, only if not set on upstream -->
+			<xsl:if test="not($this/@*[name()=name(current())])"><xsl:copy-of select="."/></xsl:if>
+		</xsl:for-each>
+
+		<xsl:if test="$match/@replace"> <!-- check replace separately -->
+			<xsl:if test="not($this/ancestor::SystemDefinition//*[(self::component or self::collection or self::package or self::layer) and $match/@replace=@id])">
+				<!-- only remove replace if it's been used -->
+				<xsl:copy-of select="$match/@replace"/>
+			</xsl:if>
+		</xsl:if>
+		
+		<xsl:choose>
+			<xsl:when test="self::component">
+				<!-- copy all units, metas and comments from this
+					copy all metas in the merged component
+					copy any new comments in the merged component (not duplicates)
+					if there are no units in the this, copy all units in the merged component
+					if there are units in this, copy only the versioned units in the merged component (only those versions not already specified) -->
+				<xsl:copy-of select="*|comment() | $match/meta |$match/unit[not($this/unit)] | $match/unit[$this/unit and @version[.!=$this/unit/@version]] | $match/comment()[.!=$this/comment()]"/>				
+			</xsl:when>
+			<xsl:otherwise>
+
+				<!--  copy metas and comments in between meta. Do not try to merge metadata between models -->
+				<xsl:apply-templates select="meta | $match/meta | comment()[following-sibling::meta]" mode="merge-data">
+					<xsl:with-param name="metas" select="$match/meta"/>
+				</xsl:apply-templates>
+				<xsl:copy-of select=" $match/meta | $match/comment()[following-sibling::meta]"/>
+				
+				<xsl:apply-templates mode="merge-models">
+					<xsl:with-param name="other" select="$match"/>
+					<xsl:with-param name="up" select="$up"/>
+					<xsl:with-param name="down" select="$down"/>
+					<xsl:with-param name="replaces" select="$replaces"/>
+				</xsl:apply-templates>
+				<!--  don't copy if explicitly or implicitly placed already-->
+				<xsl:for-each select="$match/*[not(@before) and not(following-sibling::*[@id=$this/*/@id])]">
+					<xsl:if test="not($this/*[@id=current()/@id])">
+						<xsl:apply-templates mode="merge-copy-of" select=".">
+							<xsl:with-param name="origin" select="$down"/>
+							<xsl:with-param name="root" select="$this/ancestor::SystemDefinition"/>			
+							<xsl:with-param name="replaces" select="$replaces"/>
+						</xsl:apply-templates>
+					</xsl:if>
+				</xsl:for-each>
+			</xsl:otherwise>
+		</xsl:choose>
+
+		<!-- and now check for error cases, and tack those on -->
+		<xsl:call-template name="check-and-add-out-of-order-items">
+			<xsl:with-param name="match" select="$match"/>
+			<xsl:with-param name="down" select="$down"/>
+			<xsl:with-param name="replaces" select="$replaces"/>
+		</xsl:call-template> 
+
+	</xsl:copy>
+ 	</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+
+<xsl:template match="*" mode="merge-copy-of">
+	<xsl:param name="remove-before" select="0"/> <!-- set to true if any before attribute is to be removed -->
+	<xsl:param name="origin"/>	<!--the element containing the @name to use the origin-model attribute  -->
+	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
+	<xsl:param name="replaces" select="ancestor::SystemDefinition/descendant::*[(self::component or self::collection or self::package or self::layer) and not(ancestor::meta)]/@replace"/> <!-- recalculate this is necessarfy, but should just pass down as a param -->
+	<xsl:variable name="moved" select="$root/descendant::*[name()=name(current()/..) and @id!=current()/../@id]/*[@id=current()/@id]"/>
+	<xsl:choose>
+		<!-- this might slow things down, consider making optional -->
+		<xsl:when test="not(self::layer) and (count($moved) and not($moved[ancestor-or-self::*/@id=$replaces]) )">
+			<xsl:message>Warning: <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" moved in downstream model. Ignoring moved <xsl:value-of select="name()"/>
+				<xsl:text>&#xa;</xsl:text>
+			</xsl:message>
+		</xsl:when>
+		<xsl:otherwise>
+			<!-- save all content in a variable to test to see if it's got any problems (ie been removed due to errors)-->
+			<xsl:variable name="content">
+				<xsl:apply-templates select="*|comment()" mode="merge-copy-of">
+					<xsl:with-param name="origin" select="$origin"/>
+					<xsl:with-param name="root" select="$root"/>
+					<xsl:with-param name="replaces" select="$replaces"/>
+				</xsl:apply-templates>
+			</xsl:variable>
+			<xsl:choose>
+				<!-- if all elements in this have been deleted, throw out this element -->
+				<xsl:when test="not(exslt:node-set($content)/*) and *">
+					<xsl:message>Warning: All content in downstream <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" is invalid. Ignoring <xsl:value-of select="name()"/>
+						<xsl:text>&#xa;</xsl:text>
+					</xsl:message>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:copy>
+						<xsl:call-template name="merge-copy-of-atts">
+							<xsl:with-param name="remove-before" select="$remove-before"/>
+							<xsl:with-param name="root" select="$root"/>
+						</xsl:call-template>
+						<xsl:copy-of select="exslt:node-set($content)"/>
+					</xsl:copy>
+				</xsl:otherwise>
+			</xsl:choose>					
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+<xsl:template match="comment()|@*" mode="merge-copy-of">
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+
+<xsl:template name="merge-copy-of-atts">
+	<xsl:param name="remove-before" select="0"/> <!-- set to true if any before attribute is to be removed -->
+	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
+	
+	<xsl:choose>
+		<xsl:when test="$remove-before">
+			<xsl:copy-of select="@*[name()!='before' and name()!='replace']"/>
+		</xsl:when>
+		<xsl:otherwise><xsl:copy-of select="@*[name()!='replace']"/></xsl:otherwise>
+	</xsl:choose>
+	<xsl:if test="@replace and not($root/descendant::*[(self::component or self::collection or self::package or self::layer) and @id=current()/@replace])">
+		<!-- only include replace if it's not been used -->
+		<xsl:copy-of select="@replace"/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="component" mode="merge-copy-of">
+	<xsl:param name="remove-before" select="0"/> <!-- set to true if any before attribute is to be removed -->
+	<xsl:param name="origin"/>	<!--the element containing the @name to use the origin-model attribute  -->
+	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
+	<xsl:choose>
+		<!-- this might slow things down, consider making optional -->
+		<xsl:when test="$root/descendant::collection[@id!=current()/../@id]/component[@id=current()/@id]">
+			<xsl:message>Warning: <xsl:value-of select="name()"/> "<xsl:value-of select="@id"/>" moved in downstream model. Ignoring moved <xsl:value-of select="name()"/>
+				<xsl:text>&#xa;</xsl:text>
+			</xsl:message>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:copy>
+				<xsl:call-template name="merge-copy-of-atts">
+					<xsl:with-param name="remove-before" select="$remove-before"/>
+					<xsl:with-param name="root" select="$root"/>
+				</xsl:call-template>
+				<xsl:if test="not(@origin-model) and ($origin/@name or ancestor::systemModel/@name)">
+					<xsl:attribute name="origin-model">
+						<xsl:value-of select="$origin/@name"/>
+						<xsl:if test="not($origin/@name)"><xsl:value-of select="ancestor::systemModel/@name"/></xsl:if>
+					</xsl:attribute>
+					<xsl:if test="not(@root)">
+						<xsl:copy-of select="$origin/@root"/>
+					</xsl:if>
+				</xsl:if>
+				<xsl:apply-templates select="*|comment()" mode="merge-copy-of">
+					<xsl:with-param name="origin" select="$origin"/>
+					<xsl:with-param name="root" select="$root"/>
+				</xsl:apply-templates>
+			</xsl:copy>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="unit" mode="merge-copy-of">
+	<xsl:param name="origin"/>	<!--the element containing the @name to use the origin-model attribute  -->
+	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
+	<xsl:copy>
+				<xsl:apply-templates select="@*" mode="merge-copy-of">
+					<xsl:with-param name="origin" select="$origin"/>
+					<xsl:with-param name="root" select="$root"/>
+				</xsl:apply-templates>
+	</xsl:copy>
+</xsl:template>
+
+
+
+
+<xsl:template match="meta" mode="merge-copy-of">
+	<xsl:param name="origin"/>	<!--the element containing the @name to use the origin-model attribute  -->
+	<xsl:param name="root"/> 	<!--the systemModel element in the upstream doc  -->
+	<xsl:copy>
+		<xsl:apply-templates select="@*" mode="merge-copy-of">
+			<xsl:with-param name="origin" select="$origin"/>
+			<xsl:with-param name="root" select="$root"/>
+		</xsl:apply-templates>
+		<xsl:copy-of select="node()"/>
+	</xsl:copy>
+</xsl:template>
+
+
+<xsl:template match="unit/@bldFile | unit/@mrp | unit/@base | meta/@href" mode="merge-copy-of">
+	<xsl:param name="origin" select="/.."/>	<!--the element containing the @name to use the origin-model attribute  -->
+
+	<xsl:attribute name="{name()}">
+		<xsl:choose>
+			<xsl:when test="not($origin/@pathto)"><xsl:value-of select="."/></xsl:when>
+			<xsl:when test="(contains(.,'://') and not(contains(substring-before(.,'://'),'/'))) or starts-with(.,'/')"> <!-- absolute URI or absolute path-->
+				<xsl:value-of select="."/>
+			</xsl:when>
+			<xsl:when test="contains($origin/@pathto,'://') and not(contains(substring-before($origin/@pathto,'://'),'/'))"> <!-- absolute URI for downstream sysdef not valif for unit paths, just copy and raise warning-->
+				<xsl:message>ERROR: Could not resolve relative path in downstream file: <xsl:value-of select="."/> relative to absolute URI <xsl:value-of select="$origin/@pathto"/></xsl:message>
+				<xsl:value-of select="."/>
+			</xsl:when>
+		<xsl:otherwise> <!-- relative link -->
+			<xsl:call-template name="joinpath">
+				<xsl:with-param name="file" select="$origin/@pathto"/>
+				<xsl:with-param name="rel" select="."/>
+			</xsl:call-template>
+		</xsl:otherwise>
+		</xsl:choose>
+	</xsl:attribute>
+</xsl:template>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/mergesysdef.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,141 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="exslt">
+<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+	All rights reserved.
+	This component and the accompanying materials are made available
+	under the terms of the License "Eclipse Public License v1.0"
+	which accompanies this distribution, and is available
+	at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+	Initial Contributors:
+	Nokia Corporation - initial contribution.
+	Contributors:
+	Description:
+	Merge two 3.x syntax system definitions
+-->
+
+<!--Description:This merges two 3.x syntax system definitions.
+It can process two standalone sysdefs or two sysdef fragments which describe
+the same system model item.
+If the sysdefs are not the same schema, the output will use the highest schema
+value of the two.
+-->
+<!--Input:<sysdef> - (required) The system definition XML file to process in the 3.0 format, and can be a fragment or stand-alone.
+	If a fragment, this must be the same rank as the Downstream sysdef-->
+<!--Output:<sysdef> - (optional) The system definition XML file to save the output as. If not present it will write to stdout.-->
+
+	<xsl:output method="xml" indent="yes"/>
+	<xsl:param name="Downstream">mcl/System_Definition_Template.xml</xsl:param> <!-- <sysdef> - (required) The path to the downstream systef relative to the upstream one (ie the -in sysdef). -->
+	<xsl:key name="origin" match="component" use="@origin-model"/>
+
+<xsl:variable name="downstream" select="document($Downstream,.)/SystemDefinition"/>
+<xsl:param name="upname">
+	<xsl:choose>
+		<xsl:when test="$downstream[starts-with(@schema,'2.') or starts-with(@schema,'1.')]">
+			<xsl:message terminate="yes">Syntax <xsl:value-of select="@schema"/> not supported</xsl:message>
+		</xsl:when>
+		<xsl:when test="name($downstream/*)!=name(/SystemDefinition/*)">
+			<xsl:message terminate="yes">Can only merge fragments of the same rank</xsl:message>
+		</xsl:when>
+<!--		<xsl:when test="$downstream[not(systemModel)]">
+			<xsl:message terminate="yes">Needs to be a standalone system definition</xsl:message>
+		</xsl:when>-->
+		<xsl:when test="/SystemDefinition/systemModel/@name=$downstream/systemModel/@name or not(/SystemDefinition/systemModel/@name)">
+			<xsl:apply-templates mode="origin-term" select="/*">
+				<xsl:with-param name="root">Upstream</xsl:with-param>
+			</xsl:apply-templates>
+			</xsl:when>
+		<xsl:otherwise><xsl:value-of select="/SystemDefinition/systemModel/@name"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:param>
+<!-- [name] - (optional) The name used in the origin-model attribute of any component that comes from the upstream sysdef. Defaults to the name attribute on the systemModel element, or "Upstream"-->
+
+<xsl:param name="downname">
+	<xsl:choose>
+		<xsl:when test="/SystemDefinition/systemModel/@name=$downstream/systemModel/@name or not($downstream/systemModel/@name)">
+			<xsl:apply-templates mode="origin-term" select="$downstream">	
+				<xsl:with-param name="root">Downstream</xsl:with-param>
+			</xsl:apply-templates>
+			</xsl:when>
+		<xsl:when test="name($downstream/*)!=name(/SystemDefinition/*)">
+			<xsl:message terminate="yes">Can only merge fragments of the same rank</xsl:message>
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$downstream/systemModel/@name"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:param>
+<!-- [name] - (optional) The name used in the origin-model attribute of any component that comes from the downstream sysdef. Defaults to the name attribute on the systemModel element, or "Downstream"-->
+
+<xsl:template mode="origin-term" match="*">
+	<xsl:param name="root"/>
+	<xsl:param name="index"/>
+	<xsl:choose>
+		<xsl:when test="not(key('origin',concat($root,$index)))">
+			<xsl:value-of select="concat($root,$index)"/>
+		</xsl:when>
+		<xsl:when test="$index=''">
+			<xsl:apply-templates mode="origin-term" select=".">	
+				<xsl:with-param name="root" select="$root"/>
+				<xsl:with-param name="index" select="1"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates mode="origin-term" select=".">	
+				<xsl:with-param name="root" select="$root"/>
+				<xsl:with-param name="index" select="$index + 1"/>
+			</xsl:apply-templates>		
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!-- choose the greater of the two versions -->
+<xsl:template name="compare-versions"><xsl:param name="v1"/><xsl:param name="v2"/>
+			<xsl:choose>
+				<xsl:when test="$v1=$v2"><xsl:value-of select="$v1"/></xsl:when>
+				<xsl:when test="substring-before($v1,'.') &gt; substring-before($v2,'.')"><xsl:value-of select="$v1"/></xsl:when>
+				<xsl:when test="substring-before($v1,'.') &lt; substring-before($v2,'.')"><xsl:value-of select="$v2"/></xsl:when>
+				<xsl:when test="substring-before(substring-after($v1,'.'),'.') &gt; substring-before(substring-after($v2,'.'),'.')"><xsl:value-of select="$v1"/></xsl:when>
+				<xsl:when test="substring-before(substring-after($v1,'.'),'.') &lt; substring-before(substring-after($v2,'.'),'.')"><xsl:value-of select="$v2"/></xsl:when>
+				<xsl:when test="substring-after(substring-after($v1,'.'),'.') &gt; substring-after(substring-after($v2,'.'),'.')"><xsl:value-of select="$v1"/></xsl:when>
+				<xsl:when test="substring-after(substring-after($v1,'.'),'.') &lt; substring-after(substring-after($v2,'.'),'.')"><xsl:value-of select="$v2"/></xsl:when>
+				<xsl:otherwise><xsl:value-of select="$v1"/></xsl:otherwise>
+			</xsl:choose>
+</xsl:template>
+
+<!--  this merge only two files according to the 3.0.x rules. Old syntax not supported. Must be converetd before calling -->
+
+
+
+<xsl:template match="/*">
+	<xsl:variable name="upmodel">
+		<sysdef name="{$upname}"/>
+	</xsl:variable>
+	<xsl:variable name="downmodel">
+		<sysdef name="{$downname}" pathto="{$Downstream}"/>
+	</xsl:variable>
+	
+	<xsl:choose>
+		<xsl:when test="function-available('exslt:node-set')">
+			<xsl:apply-templates mode="merge-models" select=".">
+				<xsl:with-param name="other" select="$downstream"/>
+				<xsl:with-param name="up" select="exslt:node-set($upmodel)/sysdef"/>
+				<xsl:with-param name="down" select="exslt:node-set($downmodel)/sysdef"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise> <!-- no node set funcion, so don't bother setting the names -->
+			<xsl:apply-templates mode="merge-models" select=".">
+				<xsl:with-param name="other" select="$downstream"/>
+			</xsl:apply-templates> 		
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:include href="path-module.xsl"/>
+<xsl:include href="mergesysdef-module.xsl"/>
+<xsl:template match="@*[local-name()='proFile' or local-name()='qmakeArgs'  or namespace-uri()='qt']" mode="merge-copy-of">
+	<!-- this fixes a xalan-j bug where it changes the namespace in the merged model to just "qt"-->
+	<xsl:attribute name="{local-name()}" namespace="http://www.nokia.com/qt">
+		<xsl:value-of select="."/>
+	</xsl:attribute>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/overlay-module.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,263 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ 	<xsl:output method="xml" indent="yes"/>
+	<xsl:key name="named" match="*" use="@name"/>
+ 
+<xsl:template match="sysdef" mode="overlay-attributes" priority="1">  <xsl:param name="item"/>
+	<xsl:choose>
+		<xsl:when test="$item[self::SystemDefinition]">
+			<!--  add global attribtues to document node since we canalways easily find it -->
+			<xsl:apply-templates select="/model" mode="global-attributes"/>
+		</xsl:when>
+		<xsl:when test="$item/@id">
+			<!-- follwing vars to save trouble of recalulating each time -->
+			<xsl:variable name="id"><xsl:apply-templates select="$item/@id" mode="my-id"/></xsl:variable>			<!-- namespaceless ID of this here -->
+			<xsl:variable name="ns"><xsl:apply-templates select="$item/@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace -->
+			<xsl:apply-templates select="info|../layout/*" mode="overlay-attributes">
+				<xsl:with-param name="id" select="$id"/>
+				<xsl:with-param name="ns" select="$ns"/>
+				<xsl:with-param name="item" select="$item"/>
+			</xsl:apply-templates>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="sysdef" mode="overlay-meta" priority="1"><xsl:param name="item"/>
+	<xsl:if test="$item[parent::SystemDefinition]">
+		<!-- the root model item gets the global meta stuff -->
+		<xsl:apply-templates select="/model" mode="global-meta"/>
+	</xsl:if>
+	<xsl:if test="$item/@id">
+		<!-- follwing vars to save trouble of recalulating each time -->
+		<xsl:variable name="id"><xsl:apply-templates select="$item/@id" mode="my-id"/></xsl:variable>			<!-- namespaceless ID of this here -->
+		<xsl:variable name="ns"><xsl:apply-templates select="$item/@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace -->
+		<xsl:apply-templates select="info|../layout/info|document(../@deps,.)/*" mode="overlay-meta">
+			<xsl:with-param name="id" select="$id"/>
+			<xsl:with-param name="ns" select="$ns"/>
+			<xsl:with-param name="item" select="$item"/>
+		</xsl:apply-templates>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="*" mode="global-meta"/>
+<xsl:template match="/model" mode="global-meta">
+	<xsl:apply-templates select="*[not(self::sysdef)]" mode="global-meta"/>
+</xsl:template>
+
+<xsl:template match="* | @*" mode="global-attributes"/>
+<xsl:template match="/model" mode="global-attributes">
+	<xsl:apply-templates select="*[not(self::sysdef)] | @*" mode="global-attributes"/>
+</xsl:template>
+
+<xsl:template mode="global-attributes" match="@version | /model/@*">
+	<xsl:copy-of select="."/> 
+</xsl:template>
+
+<xsl:template mode="global-attributes" match="/model/@link">
+	<xsl:attribute name="base"><xsl:value-of select="."/></xsl:attribute>
+</xsl:template>
+
+<xsl:template mode="global-attributes" match="/SystemModelDeps/@name"/>
+<xsl:template mode="global-attributes" match="/SystemModelDeps/@number">
+	<xsl:attribute name="build"><xsl:value-of select="."/></xsl:attribute>
+</xsl:template>
+<xsl:template mode="global-attributes" match="/model/@deps">
+	<xsl:apply-templates select="document(.,.)/*/@*" mode="global-attributes"/>
+</xsl:template>
+
+
+<xsl:template match="/info" mode="overlay-meta" priority="2">
+	<xsl:param name="ns"/><xsl:param name="id"/><xsl:param name="from"/>
+	<xsl:for-each select="item[@ref and (@ref=$id or substring-after(@ref,':')=$id)]"> <!-- potential match of IDs -->
+		<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
+		<xsl:if test="$myns = $ns"> <!-- match -->
+			<meta><xsl:apply-templates select="/info/@data-type" mode="overlay-meta"/>
+				<xsl:if test="not(/info/@data-type)"><xsl:copy-of select="$from/@rel | $from/@type[.!='extra']"/></xsl:if>
+				<xsl:copy-of select="*|comment()"/>
+			</meta>
+		</xsl:if>
+	</xsl:for-each>	
+</xsl:template>
+
+
+<xsl:template match="info[@type='abbrev']" mode="overlay-meta" priority="2"/> <!-- only sets attributes, never content -->
+<xsl:template match="info[@href]" mode="overlay-meta" priority="1"><xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/>
+	<xsl:apply-templates select="document(@href,.)/*" mode="overlay-meta">
+		<xsl:with-param name="id" select="$id"/>
+		<xsl:with-param name="ns" select="$ns"/>
+		<xsl:with-param name="item" select="$item"/>
+		<xsl:with-param name="from" select="current()"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="info[@href]" mode="overlay-attributes" priority="1"><xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/>
+	<xsl:apply-templates select="document(@href,.)/*" mode="overlay-attributes">
+		<xsl:with-param name="id" select="$id"/>
+		<xsl:with-param name="ns" select="$ns"/>
+		<xsl:with-param name="item" select="$item"/>
+		<xsl:with-param name="from" select="current()"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+
+<!-- generic info syntax for attaching data to IDs --> 
+<xsl:template match="/info" mode="overlay-meta" priority="2">
+	<xsl:param name="ns"/><xsl:param name="id"/><xsl:param name="from"/>
+	<xsl:for-each select="item[@ref and (@ref=$id or substring-after(@ref,':')=$id)]"> <!-- potential match of IDs -->
+		<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
+		<xsl:if test="$myns = $ns"> <!-- match -->
+			<xsl:copy-of select="meta[count(@rel|@type)=count(@*)]"/> <!--copy all standard meta sections verbatim and first -->
+			<xsl:if test="*[not(self::meta[count(@rel|@type)=count(@*)])]">
+				<!-- anything not in a meta will be put in a generic meta, comments inclued. --> 
+				<meta><xsl:apply-templates select="/info/@data-type" mode="overlay-meta"/>
+					<xsl:if test="not(/info/@data-type)"><xsl:copy-of select="$from/@rel | $from/@type[.!='extra']"/></xsl:if>
+					<xsl:copy-of select="*[not(self::meta[count(@rel|@type)=count(@*)])]|comment()"/>
+				</meta>
+			</xsl:if>
+		</xsl:if>
+	</xsl:for-each>	
+</xsl:template>
+
+<xsl:template match="/info" mode="overlay-attributes" priority="2">
+	<xsl:param name="ns"/><xsl:param name="id"/><xsl:param name="from"/>
+	<xsl:for-each select="item[@ref and (@ref=$id or substring-after(@ref,':')=$id)]"> <!-- potential match of IDs -->
+		<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
+		<xsl:if test="$myns = $ns"> <!-- match -->
+			<xsl:copy-of select="@*[name()!='id' and name()!='ref' ]"/> <!-- cannot override ID, don't include ref -->
+		</xsl:if>
+	</xsl:for-each>	
+</xsl:template>
+
+<xsl:template match="/info/@data-type" mode="overlay-meta">
+	<xsl:attribute name="rel"><xsl:value-of select="."/></xsl:attribute>
+</xsl:template>
+
+
+
+<!-- S12 is well deprecated, but should still support for now. Note that use of osd attribute is slightly different from before --> 
+<xsl:template match="/Schedule12" mode="overlay-meta">
+	<xsl:param name="ns"/><xsl:param name="id"/>
+	<xsl:for-each select="//system_model[@entry=$id or substring-after(@entry,':')=$id]"> <!-- potential match of IDs -->	
+		<xsl:variable name="myns"><xsl:apply-templates select="@entry" mode="my-namespace"/></xsl:variable>
+		<xsl:if test="$myns = $ns"> <!-- match -->
+			<meta rel="Schedule12">
+				<s12>
+					<xsl:attribute name="ver"><xsl:value-of select="/Schedule12/@OS_version"/></xsl:attribute>
+					<xsl:attribute name="osd"><xsl:value-of select="name(..)"/></xsl:attribute>
+					<xsl:copy-of select="@name"/>
+				</s12>
+			</meta>
+		</xsl:if>
+	</xsl:for-each>
+</xsl:template>
+
+
+<xsl:template match="/SystemModelDeps" mode="overlay-meta">
+	<xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/>
+	<xsl:if test="$item[self::component]"> <!-- only valid for components for now-->
+		<xsl:variable name="matches" select="//Executable[@component=$id or substring-after(@component,':')=$id]"/>
+		<xsl:if test="$matches">
+			<meta rel="Dependencies" type="depmodel">	 <!-- there might be none, but tools should be able to live with an empty meta -->
+				<xsl:for-each select="$matches"> <!-- potential match of IDs -->
+					<xsl:variable name="myns"><xsl:apply-templates select="@component" mode="my-namespace"/></xsl:variable>
+					<xsl:if test="$myns = $ns"> <!-- actual match -->
+						<Bin><xsl:copy-of select="@*[name()!='component']|*"/></Bin>
+					</xsl:if>
+				</xsl:for-each>
+			</meta>
+		</xsl:if>
+	</xsl:if>
+	<xsl:variable name="matches" select="
+		Layers[$item[self::layer]]/Layer[@name=$item/@name] |
+		Blocks[$item[self::package]]/Block[@name=$item/@name] |
+		SubBlocks[$item[self::package]]/SubBlock[@name=$item/@name] | 
+		Collections[$item[self::collection]]/Collection[@name=$item/@name] |
+		Components[$item[self::component]]/Component[@name=$item/@name]"/>
+	<xsl:if test="$matches">
+		<meta rel="Dependencies" type="generic">
+			<xsl:for-each select="$matches/dep">
+				<xsl:variable name="dep" select="."/>
+				<xsl:for-each select="$item">
+					<xsl:for-each select="key('named',$dep/@name)[1]">
+						<dep ref="{@id}">
+							<xsl:copy-of select="$dep/@type"/>
+						</dep>
+					</xsl:for-each>
+				</xsl:for-each>
+			</xsl:for-each>
+		</meta>
+	</xsl:if>
+</xsl:template>
+
+
+
+<xsl:template match="/display-names" mode="overlay-attributes">
+	<xsl:param name="item"/><xsl:param name="ns"/><xsl:param name="id"/>
+	<xsl:variable name="match"> <!-- get the values of the refs that match $item --> 
+		<xsl:for-each select="abbrev[@ref and (@ref=$id or substring-after(@ref,':')=$id)]"> <!-- potential match of IDs -->
+			<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
+			<xsl:if test="$myns = $ns"> <!-- match -->
+				<xsl:value-of select="concat(@ref,' ')"/>
+			</xsl:if>
+		</xsl:for-each>
+	</xsl:variable>
+	
+	<xsl:choose>
+		<xsl:when test="$match!=''">
+			<xsl:for-each select="abbrev[@ref=substring-before($match,' ')]"> <!-- match the first in the doc -->
+				<xsl:copy-of select="@abbrev|@font|../@font"/>
+			</xsl:for-each>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:for-each select="key('named',$item/@name)[1]"> <!-- match the first in the doc -->
+				<xsl:copy-of select="@abbrev|@font|../@font"/>
+			</xsl:for-each>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+  
+ 
+<!-- unsupported proprietary format. Uses name and tag name  to match
+It's only real use is no longer needed now, but do we need to handle all the old files?
+-->
+<xsl:template match="/attributes" mode="overlay-attributes"><xsl:param name="item"/>
+	<xsl:copy-of select="key('named',$item/ancestor::layer/@name)[self::layer and @inherit='yes']/attrs/@*"/>
+	<xsl:copy-of select="key('named',$item/ancestor::package/@name)[self::block or self::package and @inherit='yes']/attrs/@*"/>
+	<xsl:copy-of select="key('named',$item/ancestor::collection/@name)[self::coll and @inherit='yes']/attrs/@*"/>
+	<xsl:copy-of select="key('named',$item/@name)[starts-with(local-name($item),local-name()) and (not(@location) or (@location=$item/../@name))]/attrs/@*"/>
+</xsl:template>
+
+
+<!-- consider supporting a techstream-like org document where it copies all data under the item and all data above it -->
+
+  <!-- no symsym support, but consider some kind of SQL lookup-->
+
+<!-- special code for delaing with links follows -->
+
+<xsl:template match="*" mode="link" priority="1"><xsl:param name="data"/>
+	<xsl:apply-templates select="$data" mode="link">
+		<xsl:with-param name="item" select="current()"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="sysdef" mode="link" priority="1"><xsl:param name="item"/>
+	<xsl:variable name="newhref">
+		<xsl:if test="$item/@id">
+			<!-- follwing vars to save trouble of recalulating each time -->
+			<xsl:variable name="id"><xsl:apply-templates select="$item/@id" mode="my-id"/></xsl:variable>			<!-- namespaceless ID of this here -->
+			<xsl:variable name="ns"><xsl:apply-templates select="$item/@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace -->
+			<xsl:for-each select="document(info/@href,.)/info/item[@href and (@ref=$id or substring-after(@ref,':')=$id)]">
+				<xsl:variable name="myns"><xsl:apply-templates select="@ref" mode="my-namespace"/></xsl:variable>
+				<xsl:if test="$myns = $ns"> <!-- match -->
+					<xsl:value-of select="concat(@href,'&#xa;')"/>
+				</xsl:if> 
+			</xsl:for-each>
+		</xsl:if>
+	</xsl:variable>
+	
+	<xsl:value-of select="substring-before($newhref,'&#xa;')"/> <!-- use first defined -->
+	<xsl:if test="$newhref='' "><xsl:value-of select="$item/@href"/></xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/path-module.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+	All rights reserved.
+	This component and the accompanying materials are made available
+	under the terms of the License "Eclipse Public License v1.0"
+	which accompanies this distribution, and is available
+	at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+	Initial Contributors:
+	Nokia Corporation - initial contribution.
+	Contributors:
+	Description:
+	XSLT module which contains named templates which process file paths
+-->
+
+ <xsl:template name="lastbefore"><xsl:param name="string"/><xsl:param name="substr" select="'/'"/>
+        <xsl:if test="contains($string,$substr)">
+                <xsl:value-of select="substring-before($string,$substr)"/>
+                <xsl:if test="contains(substring-after($string,$substr),$substr)">
+	                <xsl:value-of select="$substr"/>
+	              </xsl:if>
+        <xsl:call-template name="lastbefore">
+                <xsl:with-param name="string" select="substring-after($string,$substr)"/>
+                <xsl:with-param name="substr" select="$substr"/>
+        </xsl:call-template>
+        </xsl:if>
+</xsl:template>
+
+ <xsl:template name="joinpath"><xsl:param name="file"/><xsl:param name="rel"/>
+	<xsl:choose>
+		<xsl:when test="(contains($rel,'://') and not(contains(substring-before($rel,'://'),'/'))) or starts-with($rel,'/')"> <!-- absolute URI or absolute path-->
+			<xsl:value-of select="$rel"/>
+		</xsl:when>
+		<xsl:otherwise> <!-- relative link -->
+			<xsl:call-template name="reducepath">
+				<xsl:with-param name="file">
+					<xsl:call-template name="lastbefore">
+						<xsl:with-param name="string" select="$file"/>
+					</xsl:call-template>
+					<xsl:text>/</xsl:text>
+					<xsl:value-of select="$rel"/>
+				</xsl:with-param>
+			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+ </xsl:template>
+
+<xsl:template name="reducepath"><xsl:param name="file"/>
+	<xsl:call-template name="reducedotdotpath">
+    	<xsl:with-param name="file">
+			<xsl:call-template name="reducedotpath">
+		    	<xsl:with-param name="file" select="$file"/>
+		    </xsl:call-template>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template name="reducedotdotpath"><xsl:param name="file"/>
+	<xsl:variable name="pre">
+		<xsl:call-template name="lastbefore">
+			    <xsl:with-param name="string" select="substring-before($file,'/../')"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="starts-with($file,'../')">
+			<xsl:text>../</xsl:text>
+			<xsl:call-template name="reducedotdotpath">
+        		<xsl:with-param name="file" select="substring($file,4)"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="contains($file,'/../') and $pre='' and not(starts-with($file,'/'))"> <!-- if file is a relative path and the dotdots go up to the top dir, don't start with a slash -->
+			<xsl:call-template name="reducepath">
+        		<xsl:with-param name="file" select="substring-after($file,'/../')"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="contains($file,'/../')">
+			<xsl:call-template name="reducepath">
+        		<xsl:with-param name="file" select="concat($pre,'/',substring-after($file,'/../'))"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$file"/></xsl:otherwise>
+	</xsl:choose>
+ </xsl:template>
+
+<xsl:template name="reducedotpath"><xsl:param name="file"/>
+	<xsl:choose>	
+		<xsl:when test="starts-with($file,'./')">
+			<xsl:call-template name="reducedotpath">
+        		<xsl:with-param name="file" select="substring($file,3)"/>
+			</xsl:call-template>
+		</xsl:when>
+
+		<xsl:when test="contains($file,'/./')">
+			<xsl:call-template name="reducepath">
+        		<xsl:with-param name="file">
+	                <xsl:value-of select="substring-before($file,'/./')"/>
+			        <xsl:text>/</xsl:text>
+					<xsl:value-of select="substring-after($file,'/./')"/>
+				</xsl:with-param>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="substring($file,string-length($file) - 1) = '/.'">
+           <xsl:value-of select="substring($file,1,string-length($file) - 2)"/>
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$file"/></xsl:otherwise>
+	</xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/core/shapes.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,1031 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.w3.org/1999/XSL/Transform-" version="1.0" 
+ 	xmlns:s="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" 
+ 	xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:exslt="http://exslt.org/common">
+  	<xsl:output method="xml" indent="yes"/>
+	<xsl:param name="Model-Transform" select="'draw.xsl'"/> <!-- the location of the model.xsl relative to where the *output* of this transform is stored-->
+	<xsl:param name="Verbose" select="0"/> <!-- Verbosity level of messages. Set to 1 (or higher) to get runtime comments  -->
+	<xsl:namespace-alias stylesheet-prefix="a" result-prefix="xsl"/>
+
+<xsl:variable name="color" select="/model/layout/info[@type='color']"/>
+<xsl:variable name="borders" select="/model/layout/info[@type='border']"/>
+<xsl:variable name="overlay" select="/model/layout/info[@type='overlay']"/>
+<xsl:variable name="style" select="/model/layout/info[@type='style']"/>
+
+<xsl:template name="make-match-list"><xsl:param name="list"/><xsl:param name="suffix"/>
+	<xsl:choose>
+	<xsl:when test="0"/>
+	</xsl:choose>
+	<xsl:value-of select="concat(substring-before(concat($list,' '),' '),$suffix)"/>
+	<xsl:if test="contains($list,' ')">
+		<xsl:text>|</xsl:text>
+		<xsl:call-template name="make-match-list">
+			<xsl:with-param name="list" select="substring-after($list,' ')"/>
+			<xsl:with-param name="suffix" select="$suffix"/>
+		</xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="/model"> 
+	<a:stylesheet version="1.0" exclude-result-prefixes="s exslt">
+		<xsl:for-each select="document(@shapes,.)/shapes/namespace::*"><xsl:copy-of select="."/></xsl:for-each>
+		<a:include href="{$Model-Transform}"/>
+		<xsl:apply-templates select="document(@shapes,.)/*"/>
+
+		<!--  this is a bit redundant:  i think it's only necessary for the cmp. Either that or it can be used for the component, and the stuff to 
+			make the defaults for all components should be removed from model.xsl -->
+		<xsl:if test="$borders"> <!-- if there are borders defined in the model.xml, use those to shape the cmp borders, not the shapes.xml -->
+			<!-- default border -->	
+			<xsl:for-each select="document($borders/@href,$borders)/values/@default">
+				<!-- if the default is a type, create the actual reference. If it's a reference leave it alone -->
+				<!-- this can only ever apply to components, so ignore any other rank -->
+				<a:template match="component[not(@generator-border)]|cmp[not(@generator-border)]" mode="shape">
+					<xsl:if test="not(starts-with(.,'#'))">#Border</xsl:if>
+					<xsl:value-of select="."/>
+				</a:template>
+			</xsl:for-each>
+		</xsl:if>
+
+		<xsl:if test="$overlay"> <!-- if there are patterns defined in the model.xml, use those to shape the cmp overlays, not the shapes.xml 
+			 this should always have higher priority than templates from the shapes.xml -->
+			<!-- default overlay (usually there will be no default))-->	
+			<xsl:for-each select="document($overlay/@href,$overlay)/values/@default">
+				<!-- if the default is a type, create the actual reference. If it's a reference leave it alone -->
+				<xsl:variable name="match">
+					<xsl:call-template name="make-match-list">
+						<xsl:with-param name="list">
+							<xsl:value-of select="normalize-space(../@rank)"/>
+							<xsl:if test="not(../@rank)">*</xsl:if>
+							<xsl:if test="../@rank = 'component'"> cmp</xsl:if>
+						</xsl:with-param>
+						<xsl:with-param name="suffix">[not(@generator-overlay|meta/generator-overlay)]</xsl:with-param>
+					</xsl:call-template>
+				</xsl:variable>
+				<a:template match="{$match}" mode="overlays" priority="1">
+					<o>
+						<xsl:if test="not(starts-with(.,'#'))">#Pattern</xsl:if>
+						<xsl:value-of select="."/>
+					</o>
+				</a:template>
+			</xsl:for-each>
+		</xsl:if>
+
+		<xsl:if test="$color">
+			<xsl:for-each select="document($color/@href,$color)/values/@default">
+				<xsl:variable name="match">
+					<xsl:call-template name="make-match-list">
+						<xsl:with-param name="list">
+							<xsl:value-of select="normalize-space(../@rank)"/>
+							<xsl:if test="not(../@rank)">*</xsl:if>
+							<xsl:if test="../@rank = 'component'"> cmp</xsl:if>
+						</xsl:with-param>
+						<xsl:with-param name="suffix">[not(@generator-color|meta/generator-color)]</xsl:with-param>
+					</xsl:call-template>
+				</xsl:variable>
+				<a:template match="{$match}" mode="display-style-color" priority="1">
+					<xsl:value-of select="."/>
+				</a:template>
+			</xsl:for-each>
+		</xsl:if>
+		
+		<!-- values files with styles override any styles in the shapes file
+			Also if there are no styles in the shapes file, don't try to look for them -->
+		<xsl:if test="not(document(@shapes)/shapes/styles) or layout/info[@type='style' and @href]">
+			<a:template match="component" mode="display-style-aux"/> <!-- no  default styles -->
+		</xsl:if>
+	
+	<xsl:for-each select="link[@expr] | layout/link[@expr]">  <!-- link should be in the layout section, but in earlier version was diretcly under model. Support both -->
+		<xsl:variable name="extra">
+			<xsl:call-template name="computed-values">
+				<xsl:with-param name="text" select="@expr"/>
+			</xsl:call-template>
+		</xsl:variable>
+		<a:template mode="has-link">
+			<xsl:attribute name="match">
+				<xsl:text>*[@id</xsl:text>
+				<xsl:if test="$extra!=''"> and (<xsl:value-of select="$extra"/>)</xsl:if>
+				<xsl:text>]</xsl:text>
+			</xsl:attribute>
+			<xsl:text>1</xsl:text>
+		</a:template>
+		
+		<a:template mode="link-label">
+			<xsl:attribute name="match">
+				<xsl:text>*[@id</xsl:text>
+				<xsl:if test="$extra!=''"> and (<xsl:value-of select="$extra"/>)</xsl:if>
+				<xsl:text>]</xsl:text>
+			</xsl:attribute>
+			<a:attribute name="target">
+				<xsl:value-of select="@target"/>
+				<xsl:if test="not(@target)">details</xsl:if>
+			</a:attribute>
+			<xsl:if test="@title">
+			<a:attribute name="title">
+				<xsl:value-of select="@title"/>
+			</a:attribute>
+			</xsl:if>
+			<a:attribute name="xlink:href">
+			<xsl:call-template name="computed-label">
+				<xsl:with-param name="text" select="@expr"/>
+			</xsl:call-template>
+			</a:attribute>
+		</a:template>
+	</xsl:for-each>
+	
+	<a:template match="SystemDefinition" mode="shapes">
+		<xsl:variable name="defs" select="s:defs"/> <!-- all defs in the shapes document -->
+		<!-- check the overlay docs for all referred IDs. Make a list of all that are not defined the shapes doc -->
+		<xsl:variable name="undefinedP">
+			<xsl:for-each select="document($overlay/@href)/*">
+				<xsl:for-each select="@default | //item/@value">
+					<xsl:value-of select="concat(' ',.,' ')"/>
+				</xsl:for-each>
+			</xsl:for-each>
+			<xsl:for-each select="document(@shapes)/shapes/patterns/overlay[@type]">
+					<xsl:value-of select="concat(' ',@type,' ')"/>
+			</xsl:for-each>
+		</xsl:variable>
+		<!-- check the borders docs for all referred IDs. Make a list of all that are not defined the shapes doc -->
+		<xsl:variable name="undefinedB">
+			<xsl:for-each select="document($borders/@href)/*">
+				<xsl:for-each select="@default | //item/@value">
+					<xsl:value-of select="concat(' ',.,' ')"/>
+				</xsl:for-each>
+			</xsl:for-each>
+			<xsl:for-each select="document(@shapes)/shapes/borders/border/@type">
+					<xsl:value-of select="concat(' ',.,' ')"/>
+			</xsl:for-each>
+		</xsl:variable>	
+
+	<!-- ignore all patterns not defined: should make a warning eventually. 
+		Also nice to check to see if any ref'd ID's  (eg #xxx) are defined -->
+		
+		 <!-- no 'reference' pattern defined, so use the default one --> 
+		<xsl:if test="contains($undefinedP,' radial-grad ')"><a:call-template name="default-new-pattern"/></xsl:if>
+		 <!-- no 'new'  pattern defined, so use the default one --> 
+		<xsl:if test="contains($undefinedP,' striped-diag-up ')"><a:call-template name="default-ref-pattern"/></xsl:if>
+		 <!-- no 'deprecated'  pattern defined, so use the default one --> 
+		 <xsl:if test="contains($undefinedP,' big-X ')"><a:call-template name="default-X-pattern"/></xsl:if>
+		 
+		 <xsl:choose> <!-- can use navctrl patterns in style, so check and include if there -->
+			 <xsl:when test="contains($undefinedP,' outgrad ') or contains($undefinedP,' ingrad ')">
+			 	<a:call-template name="nav-control-patterns"/>
+			 </xsl:when>
+			 <xsl:otherwise>
+			 	<a:if test="not(@static='true') and @navctrl">
+				 	<a:call-template name="nav-control-patterns"/>
+				</a:if>
+			 </xsl:otherwise>
+		</xsl:choose>
+
+		 <!-- borders defined --> 
+		 <!--  if no borders were defined at all, throw in the default ones -->
+		<xsl:if test="contains($undefinedB,' box ') or normalize-space($undefinedB)=''"><a:call-template name="default-box-border"/></xsl:if>
+		<xsl:if test="contains($undefinedB,' box-clipLB ') or normalize-space($undefinedB)=''"><a:call-template name="default-clipLB-border"/></xsl:if>
+		<xsl:if test="contains($undefinedB,' box-clipLT ') or normalize-space($undefinedB)=''"><a:call-template name="default-clipLT-border"/></xsl:if>
+		<xsl:if test="contains($undefinedB,' box-clipRB ') or normalize-space($undefinedB)=''"><a:call-template name="default-clipRB-border"/></xsl:if>
+		<xsl:if test="contains($undefinedB,' box-clipRT ') or normalize-space($undefinedB)=''"><a:call-template name="default-clipRT-border"/></xsl:if>
+		<xsl:if test="contains($undefinedB,' box-clipAll ') or normalize-space($undefinedB)=''"><a:call-template name="default-clipAll-border"/></xsl:if>
+		<xsl:if test="contains($undefinedB,' round ')"><a:call-template name="default-round-border"/></xsl:if>
+		<xsl:if test="contains($undefinedB,' hexagon ')"><a:call-template name="default-hexagon-border"/></xsl:if>
+
+		<xsl:for-each select="document(@shapes)/shapes">
+			<xsl:copy-of select="s:defs/*"/>
+			<xsl:apply-templates select="borders|colors[@type!='background']|patterns" mode="defines"/>
+		</xsl:for-each>
+
+		
+	</a:template>
+	
+	<a:template match="*[@label-ref]" mode="eval-label">
+	<!-- next two lines are hacks to ensure this works if called accidently from a node-set or wrong file-->
+		<a:if test="not(ancestor::SystemDefinition) and @label"><a:value-of select="@label"/></a:if>
+		<a:if test="not(ancestor::SystemDefinition) and not(@label)"><a:value-of select="."/></a:if>
+		<a:variable name="id" select="@label-ref"/>
+		<xsl:variable name="abbrevs" select="document(/model/layout/info/@href,/)/display-names//abbrev"/> <!-- the abbreviations list -->
+		<a:for-each select="ancestor::SystemDefinition">
+			<a:choose>
+				<xsl:apply-templates mode="make-label-eval" select="//legend[contains(@label,'}') and not(@literal='yes' or @literal='true')]">
+					<xsl:with-param name="abbrevs" select="$abbrevs"/>
+				</xsl:apply-templates>
+				<xsl:apply-templates mode="make-label-eval" select="//note[contains(.,'}') and not(@literal='yes' or @literal='true')]">
+					<xsl:with-param name="abbrevs" select="$abbrevs"/>
+				</xsl:apply-templates>
+				<xsl:for-each select="document(layout/info/@href | @shapes,.)">
+					<xsl:apply-templates mode="make-label-eval" select="//*[(contains(@label,'}') and not(@literal='yes' or @literal='true')) or @count]">
+						<xsl:with-param name="abbrevs" select="$abbrevs"/>
+					</xsl:apply-templates>
+					<xsl:apply-templates mode="make-label-eval" select="/shapes/examples/cmp[contains(text(),'}') and not(@literal='yes' or @literal='true')]">
+						<xsl:with-param name="abbrevs" select="$abbrevs"/>
+					</xsl:apply-templates>
+				</xsl:for-each>
+			</a:choose>
+		</a:for-each>
+	</a:template>
+	</a:stylesheet>
+</xsl:template>
+
+<xsl:template mode="make-label-count" match="*"/>
+<xsl:template mode="make-label-count" match="*[@value and @count]"><xsl:param name="abbrevs"/>
+	<a:number format="{@count}">
+		<xsl:attribute name="value">count(key('use-<xsl:apply-templates select=".." mode="style-id"/>','<xsl:value-of select="@value"/>'))</xsl:attribute>	
+		<xsl:if test="$abbrevs/../@xml:lang">
+		  	<xsl:attribute name="lang"><xsl:value-of select="$abbrevs/../@xml:lang"/></xsl:attribute> 
+		</xsl:if>
+	</a:number>
+</xsl:template>
+
+<xsl:template mode="make-label-count" match="*[@count and @rule]"><xsl:param name="abbrevs"/>
+	 <a:variable name="count">
+	  <a:apply-templates>
+	  	<xsl:attribute name="select">
+	  		<xsl:choose>
+			  	<xsl:when test="not(../@match)">//component</xsl:when> <!-- the default -->
+			  		<!-- this rest might not work in all cases -->
+			  	<xsl:when test="contains(../@match,'|')">
+			  		<!-- this is ugly and might actually break some cases: just prefix all pipe-separated bits by // -->
+			  		<xsl:text>//</xsl:text>
+					<xsl:call-template name="replace">
+						<xsl:with-param name="text" select="../@match"/>
+						<xsl:with-param name="from">|</xsl:with-param>
+						<xsl:with-param name="to">|//</xsl:with-param>
+					</xsl:call-template>
+				</xsl:when>
+			  <xsl:otherwise>//<xsl:value-of select="../@match"/> <!-- should work, unless the path is something unexpected -->
+			  </xsl:otherwise>
+			 </xsl:choose>
+	  		</xsl:attribute> 
+	  	  <xsl:attribute name="mode">show-unused-<xsl:value-of select="concat(name(..),../@type)"/></xsl:attribute>
+		  <a:with-param name="n" select="$id"/>
+	  </a:apply-templates>
+	 </a:variable>
+	<a:number format="{@count}" value="string-length($count)">
+		<xsl:if test="$abbrevs/../@xml:lang">
+		  	<xsl:attribute name="lang"><xsl:value-of select="$abbrevs/../@xml:lang"/></xsl:attribute> 
+		</xsl:if>
+	</a:number>
+</xsl:template>
+
+<xsl:template mode="make-label-eval" match="*"><xsl:param name="abbrevs"/>
+	<a:when>
+		<xsl:attribute name="test">$id='<xsl:apply-templates select="." mode="style-id"/>'</xsl:attribute>
+		<xsl:if test="@literal='yes' or @literal='true'">
+			<xsl:call-template name="local-label"><xsl:with-param name="abbrevs" select="$abbrevs"/></xsl:call-template>
+		</xsl:if>
+		<xsl:if test="not(@literal='yes' or @literal='true')">
+			<xsl:call-template name="computed-label">
+				<xsl:with-param name="text">
+					<xsl:call-template name="local-label"><xsl:with-param name="abbrevs" select="$abbrevs"/></xsl:call-template>
+				</xsl:with-param>
+			</xsl:call-template>
+		</xsl:if>
+		<xsl:apply-templates mode="make-label-count" select=".">
+			<xsl:with-param name="abbrevs" select="$abbrevs"/>
+		</xsl:apply-templates>
+	</a:when>
+</xsl:template> 
+
+<xsl:template name="local-label"><xsl:param name="abbrevs"/>
+	<xsl:variable name="val">
+		<xsl:value-of select="@label"/>
+		<xsl:if test="not(@label) and (self::cmp or self::note)"><xsl:value-of select="text()"/></xsl:if>
+	</xsl:variable>
+	<xsl:variable name="match" select="$abbrevs[@name=$val]"/> <!-- nothing will have an ID, so don't try to match -->
+	<xsl:choose>
+		<xsl:when test="$match"><xsl:value-of select="$match/@abbrev"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$val"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="computed-label">	<xsl:param name="text" select="@label"/>
+	<xsl:choose>
+		<xsl:when test="contains($text,'{')">
+			<a:text><xsl:value-of select="substring-before($text,'{')"/></a:text>
+			<xsl:variable name="eval" select="substring-before(substring-after($text,'{'),'}')"/>
+			<xsl:choose>
+				<xsl:when test="starts-with($eval,'@') and string-length($eval)=string-length(translate($eval,'=/ *()[]','')) "> <!-- if this passes, then this will generally just be an attribute -->
+					<a:apply-templates select="{$eval}" mode="as-text"/>
+				</xsl:when>
+				<xsl:otherwise><a:value-of select="{$eval}"/></xsl:otherwise>
+			</xsl:choose>
+			<xsl:call-template name="computed-label">
+				<xsl:with-param name="text" select="substring-after(substring-after($text,'{'),'}')"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="$text!=''"><a:text><xsl:value-of select="$text"/></a:text></xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="computed-values"><xsl:param name="text" select="@label"/><xsl:param name="join"> and </xsl:param>
+	<xsl:if test="contains($text,'{')">
+		<xsl:value-of select="substring-before(substring-after($text,'{'),'}')"/>
+		<xsl:if test="contains(substring-after(substring-after($text,'{'),'}'),'}')">
+			<xsl:value-of select="$join"/>
+			<xsl:call-template name="computed-values">
+				<xsl:with-param name="text" select="substring-after(substring-after($text,'{'),'}')"/>
+			</xsl:call-template>
+		</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+
+
+<xsl:template match="/shapes">
+	<xsl:comment>Shapes</xsl:comment>
+	<xsl:for-each select="styles|colors|patterns|borders">
+		<xsl:if test="@use or not(*)">
+			<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>	
+		  <a:key name="{name()}-{$id}" match="group[@style-id='{$id}']/*" use="@lookup"/>
+		  	<xsl:choose>
+				<xsl:when test="@use">
+				  <a:key name="use-{$id}" >
+				  	<xsl:copy-of select=" @use"/>
+				  	<xsl:call-template name="match-syntax"/>
+				  </a:key>
+				</xsl:when>
+			</xsl:choose>
+		</xsl:if>
+	</xsl:for-each>
+
+	<xsl:if test="not($borders)"> <!-- borders must be defined in shapes.xml or values files, never both-->
+		<xsl:apply-templates select="borders"/>
+	</xsl:if>
+
+	<xsl:apply-templates select="colors"/>
+
+	<xsl:apply-templates select="patterns"/>
+	<xsl:for-each select="patterns">
+		<a:template match="*" mode="overlay-{1 + count(preceding::patterns)}" priority="-8"/>
+		<a:template match="*" mode="show-unused-{name()}-{1 + count(preceding::patterns)}" priority="-8"/>
+	</xsl:for-each>
+	
+	<xsl:if test="patterns">
+		<a:template match="*" mode="overlays">
+			<xsl:for-each select="patterns">
+				<a:apply-templates select="." mode="overlay-{position()}"/>
+			</xsl:for-each>
+		</a:template>
+		<a:template match="*" mode="show-unused-patterns"><a:param name="n"/>
+			<xsl:for-each select="patterns[(not(@show-unused='yes') or (*/@count)) and */@rule]">
+				<a:apply-templates select="." mode="show-unused-{name(.)}-{count(preceding::patterns) + 1}">
+					<a:with-param name="n" select="$n"/>
+				</a:apply-templates>
+			</xsl:for-each>
+		</a:template>
+	</xsl:if>
+
+
+<!-- concatenate all default styles for legend items -->
+  <a:template match="cmp[not(@generated-style) and not(meta/generated-style)]" mode="display-style-aux">
+		<xsl:for-each select="styles/style[not(@rule|@value)]"><xsl:value-of select="."/>;</xsl:for-each>    
+  </a:template>
+
+<!-- create style attribute in the general case-->
+<a:template match="*" mode="display-style-aux">
+	<xsl:for-each select="styles">
+		<a:apply-templates select="." mode="display-style-{position()}"/>
+	</xsl:for-each>
+</a:template>
+
+	<!--  default to nothing for each style. This will be overriden later if necesssary -->
+	<xsl:for-each select="styles">
+		<a:template match="*" mode="display-style-{position()}"/>
+	</xsl:for-each>
+	
+	<xsl:apply-templates select="styles"/>
+
+	<xsl:for-each select="(borders|styles|patterns|colors)[(not(@show-unused='yes') and not(*/@rule) and *[@label and not(@value)]) ]">
+		<!-- check to see if labelled defaults of a look-up list are shown -->
+		<a:template> <!-- default match is component -->
+			<xsl:call-template name="match-syntax"/>
+			<xsl:attribute name="mode">show-unused-<xsl:value-of select="concat(name(),@type)"/>
+				<xsl:if test="self::colors[not(@type)]">background</xsl:if>
+				<xsl:if test="self::patterns">-<xsl:value-of select="count(preceding-sibling::patterns) + 1"/></xsl:if>
+			</xsl:attribute>
+				<a:param name="n"/>
+			<a:if>
+			<xsl:attribute name="test"><xsl:text>not(</xsl:text>
+				<xsl:for-each select="*[@value]"><xsl:value-of select="../@use"/>='<xsl:value-of select="@value"/>'<xsl:if test="position()!=last()"> or </xsl:if></xsl:for-each>
+				<xsl:text>)</xsl:text>
+			</xsl:attribute>*</a:if>
+		</a:template>
+	</xsl:for-each>	
+
+	<!-- only needed for options with rule. Options with lookup values are checked elsewhere -->
+	<xsl:for-each select="(borders|styles|patterns|colors)[(not(@show-unused='yes') or (*/@count)) and */@rule]">
+		<a:template> <!-- default match is component -->
+			<xsl:call-template name="match-syntax"/>
+			<xsl:attribute name="mode">show-unused-<xsl:value-of select="concat(name(),@type)"/>
+				<xsl:if test="self::colors[not(@type)]">background</xsl:if>
+				<xsl:if test="self::patterns">-<xsl:value-of select="count(preceding-sibling::patterns) + 1"/></xsl:if>
+			</xsl:attribute>
+				<a:param name="n"/>
+				<xsl:call-template name="declare-vars"/>
+			<a:choose>
+				<xsl:for-each select="*[@rule]">
+					<a:when>
+						<xsl:attribute name="test"><xsl:apply-templates select="." mode="when-test"/></xsl:attribute>
+						<a:if>
+							<xsl:attribute name="test">$n='<xsl:apply-templates select="." mode="style-id"/>'</xsl:attribute>
+							<xsl:text>*</xsl:text>
+						</a:if>
+					</a:when>
+				</xsl:for-each>
+				<xsl:for-each select="*[not(@rule|@value)]">
+					<a:when>
+						<xsl:attribute name="test">$n='<xsl:apply-templates select="." mode="style-id"/>'</xsl:attribute>
+						<xsl:text>*</xsl:text>
+					</a:when>
+				</xsl:for-each>
+			</a:choose>
+		</a:template>
+	</xsl:for-each>
+	
+</xsl:template>
+
+<!-- remove all quoted parens -->
+<xsl:template name="replace-quotes"><xsl:param name="text" select="."/>
+	<xsl:choose>
+		<xsl:when test="contains($text,'&quot;')">
+			<xsl:value-of select="substring-before($text,'&quot;')"/>
+			<xsl:text> </xsl:text>
+			<xsl:value-of select="translate(substring-before(substring-after($text,'&quot;'),'&quot;'),'()','  ')"/>
+			<xsl:text> </xsl:text>
+			<xsl:call-template name="replace-quotes">
+				<xsl:with-param name="text" select="substring-after(substring-after($text,'&quot;'),'&quot;')"/>
+			</xsl:call-template>			
+		</xsl:when>
+		<xsl:when test='contains($text,"&apos;")'>
+			<xsl:value-of select='substring-before($text,"&apos;")'/>
+			<xsl:text> </xsl:text>
+			<xsl:value-of select='translate(substring-before(substring-after($text,"&apos;"),"&apos;"),"()","  ")'/>
+			<xsl:text> </xsl:text>
+			<xsl:call-template name="replace-quotes">
+				<xsl:with-param name="text" select='substring-after(substring-after($text,"&apos;"),"&apos;")'/>
+			</xsl:call-template>			
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- replace all instances of $from with $to -->
+<xsl:template name="replace"><xsl:param name="text"/><xsl:param name="from"/><xsl:param name="to"/>
+	<xsl:choose>
+		<xsl:when test="contains($text,$from)">
+			<xsl:value-of select="substring-before($text,$from)"/>
+			<xsl:value-of select="$to"/>
+			<xsl:call-template name="replace">
+				<xsl:with-param name="text" select="substring-after($text,$from)"/>
+				<xsl:with-param name="from" select="$from"/>
+				<xsl:with-param name="to" select="$to"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="param-length"><xsl:param name="text"/>
+<xsl:variable name="close-idx"  select="string-length(substring-before($text,')'))"/>
+<xsl:choose>
+	<xsl:when test="not(contains($text,')'))"><xsl:message terminate="yes">badly-formatted funtion: <xsl:value-of select="$text"/></xsl:message></xsl:when>
+	<xsl:when test="contains($text,'(')">
+		<xsl:variable name="open-idx"  select="string-length(substring-before($text,'('))"/>	
+		<xsl:choose>
+			<xsl:when test="$close-idx &lt; $open-idx"><xsl:value-of select="$close-idx"/></xsl:when>
+			<xsl:otherwise>
+				<xsl:variable name="len">
+					<xsl:call-template name="param-length">
+						<xsl:with-param name="text" select="substring($text,2+$open-idx)"/>
+					</xsl:call-template>
+				</xsl:variable>
+				<xsl:value-of select="2 + $open-idx + $len"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:when>
+	<xsl:otherwise><xsl:value-of select="$close-idx"/></xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="need-current"><xsl:param name="arg"/>
+<xsl:variable name="bad">'/"</xsl:variable>
+	<xsl:if test="translate(substring($arg,1,1),$bad,'')!='' ">current()/</xsl:if>
+</xsl:template>
+
+<xsl:template name="replace-function"><xsl:param name="text" select="."/>
+	<xsl:param name="function" select="'VERSION'"/>
+	<xsl:param name="before">count(exslt:node-set($Versions)/*[contains(concat(' ',.,' '),concat(' ',</xsl:param>
+	<xsl:param name="after">,' '))]/preceding-sibling::*)</xsl:param>
+	<xsl:param name="default">current()/ancestor::SystemDefinition/@ver</xsl:param>
+	<xsl:param name="need-current" select="1"/>
+	<xsl:param name="extra"/>
+	<xsl:variable name="func" select="concat($function,'(')"/>
+	<xsl:variable name="t">
+		<xsl:call-template name="replace-quotes">
+			<xsl:with-param name="text" select="$text"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="contains($t,$func)">
+			<xsl:value-of select="substring($text,1,string-length(substring-before($t,$func)))"/>
+			<xsl:variable name="pre" select="1 + string-length($func) + string-length(substring-before($t,$func))"/>
+			<xsl:variable name="a" select="substring($t,$pre)"/>
+			<xsl:variable name="r" select="substring($text,$pre)"/>
+			<xsl:variable name="len">
+				<xsl:call-template name="param-length">
+					<xsl:with-param name="text" select="$a"/>
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:variable name="arg">
+				<xsl:if test="$need-current">
+					<xsl:call-template name="need-current">
+						<xsl:with-param name="arg" select="substring($r,1,$len)"/>
+					</xsl:call-template>
+			 	</xsl:if> <!-- this needs work -->
+			 	<xsl:value-of select="substring($r,1,$len)"/>
+			 </xsl:variable>
+				<xsl:value-of select="$before"/>
+				<xsl:choose>
+					<xsl:when test="normalize-space($arg)=''"><xsl:value-of select="$default"/></xsl:when>
+					<xsl:otherwise><xsl:value-of select="$arg"/></xsl:otherwise>
+				</xsl:choose>
+				<xsl:value-of select="$extra"/>
+				<xsl:choose>
+					<xsl:when test="$extra =''"/>
+					<xsl:when test="normalize-space($arg)=''"><xsl:value-of select="$default"/></xsl:when>
+					<xsl:otherwise><xsl:value-of select="$arg"/></xsl:otherwise>
+				</xsl:choose>
+				<xsl:value-of select="$after"/>
+				<xsl:call-template name="replace-function">
+					<xsl:with-param name="text" select="substring($r,$len+2)"/>
+					<xsl:with-param name="function" select="$function"/>
+					<xsl:with-param name="before" select="$before"/>
+					<xsl:with-param name="default" select="$default"/>
+					<xsl:with-param name="after" select="$after"/>
+					<xsl:with-param name="need-current" select="$need-current"/>
+					<xsl:with-param name="extra" select="$extra"/>
+				</xsl:call-template>
+		</xsl:when>	
+		<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>		
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="*[@rule]" mode="varname"><xsl:value-of select="name()"/>-var-<xsl:value-of select="count(preceding::*[@variable])"/></xsl:template>
+<xsl:template match="*/@rule"><xsl:param name="text" select="."/>
+	<xsl:variable name="fixed0">
+		<xsl:call-template name="replace-function">
+			<xsl:with-param name="text" select="$text"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="fixed1">
+		<xsl:call-template name="replace-function">
+			<xsl:with-param name="text" select="$fixed0"/>
+			<xsl:with-param name="function">CLASS</xsl:with-param>
+			<xsl:with-param name="before">contains(concat(' ',normalize-space(@class),' '),concat(' ',</xsl:with-param>
+			<xsl:with-param name="default">1</xsl:with-param>
+			<xsl:with-param name="after">,' '))</xsl:with-param>
+			<xsl:with-param name="need-current" select="0"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="fixed2">
+		<xsl:call-template name="replace-function">
+			<xsl:with-param name="text" select="$fixed1"/>
+			<xsl:with-param name="function">NAMESPACE</xsl:with-param>
+			<xsl:with-param name="before">concat(ancestor-or-self::*/namespace::*[name()=substring-before(</xsl:with-param>
+			<xsl:with-param name="extra">,':')],ancestor::SystemDefinition/@id-namespace[not(contains(</xsl:with-param>
+			<xsl:with-param name="default">''</xsl:with-param>
+			<xsl:with-param name="after">,':'))])</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="fixed">
+		<xsl:call-template name="replace-function">
+			<xsl:with-param name="text" select="$fixed2"/>
+			<xsl:with-param name="function">VARIABLE</xsl:with-param>
+			<xsl:with-param name="before"></xsl:with-param>
+			<xsl:with-param name="default">$<xsl:apply-templates select=".." mode="varname"/></xsl:with-param>
+			<xsl:with-param name="after"></xsl:with-param>
+			<xsl:with-param name="need-current" select="0"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:value-of select="$fixed"/>
+</xsl:template>
+
+<!--=========== basic SVG definitions ==============-->
+
+
+<xsl:template match="color" mode="id">
+	<xsl:value-of select="concat(../@type,count(preceding::color[../@type]))"/>
+</xsl:template>
+
+<xsl:template match="overlay" mode="id">Pattern<xsl:choose>
+		<xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
+		<xsl:otherwise>Overlay<xsl:value-of select="count(preceding::overlay)"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="border" mode="id">Border<xsl:choose>
+		<xsl:when test="@type"><xsl:value-of select="@type"/></xsl:when>
+		<xsl:otherwise>Shape<xsl:value-of select="count(preceding::border)"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- can explictly reference self-defined pattern or border: chop off starting #  -->
+<xsl:template match="*[starts-with(@type,'#')]" mode="id" priority="1"><xsl:value-of select="substring(@type,2)"/></xsl:template>
+
+
+<xsl:template match="border[@value] | color[@value] | overlay[@value] | style[@value]" mode="when-test">
+	<xsl:if test="not(../@use)">.</xsl:if>
+	<xsl:value-of select="../@use"/>='<xsl:value-of select="@value"/>'</xsl:template>
+
+<xsl:template match="border[@rule] |color[@rule] | overlay [@rule]  | style[@rule]" mode="when-test">
+	<xsl:variable name="rule"><xsl:apply-templates select="@rule"/></xsl:variable>
+	<xsl:choose>
+		<xsl:when test="../@use">(<xsl:value-of select="../@use"/>)[<xsl:value-of select="$rule"/>]</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$rule"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="borders" mode="defines">
+	<!-- make symbols for all the (unique) borders -->
+	<xsl:for-each select="border">
+		<xsl:if test="not(@type)">
+			<symbol>
+				<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
+				<xsl:apply-templates select="." mode="model"/>
+			</symbol>
+		</xsl:if>
+	</xsl:for-each>
+	
+	<xsl:if test="$Verbose">
+		<xsl:if test="not(border[not(@value|@rule)])"><xsl:message>&#xa;warning: no default border</xsl:message></xsl:if>
+		<xsl:if test="count(border[not(@value|@rule)]) &gt; 1 "><xsl:message>&#xa;error: more than one default border</xsl:message></xsl:if>
+	</xsl:if>	
+</xsl:template>
+
+
+<xsl:template match="patterns" mode="defines">
+	<!-- make symbols for all the (unique) overlays -->
+ 	<xsl:for-each select="*"> 	
+		<xsl:if test="count(self::overlay/*) &gt; 1 "><xsl:message>&#xa;error: more than one pattern in overlay</xsl:message></xsl:if>
+		<xsl:for-each select="self::*[not(@type)]/*[1]"> <!--  should only be one -->
+			<xsl:copy><xsl:copy-of select="@*"/>
+				<xsl:attribute name="id"><xsl:apply-templates select=".." mode="id"/></xsl:attribute>
+				<xsl:copy-of select="*"/>
+			</xsl:copy>
+		</xsl:for-each>
+	</xsl:for-each>
+	
+
+	<xsl:if test="count(*[not(@value|@rule)]) &gt; 1 "><xsl:message>&#xa;error: more than one default <xsl:value-of select="name(*)"/></xsl:message></xsl:if>
+
+</xsl:template>
+
+
+<xsl:template match="border" mode="model">
+	<xsl:copy-of select="@viewBox|*"/>
+</xsl:template>
+
+<!-- Borders -->
+<xsl:template match="borders">
+		<!-- add attributes to s:use element -->
+		<a:template mode="shape" match="component">
+			<!-- <xsl:call-template name="match-syntax"/> only applies to components -->
+			<xsl:call-template name="declare-vars"/>
+			<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>	
+			<xsl:choose>
+				<xsl:when test="@use and not(border[@rule])">
+					<!-- no borders with rules, should all be default or value -->
+				      <a:variable name="c" select="key('{name()}-{$id}',{@use})/@value"/>
+				  	  <a:value-of select="$c"/>
+			         <a:if test="not($c)">#<xsl:apply-templates select="border[not(@value)][1]" mode="id"/></a:if>					
+				</xsl:when>
+				<xsl:when test="border[@rule]">
+					<!-- at least one border has a rule -->
+					<a:choose>
+						<xsl:for-each select="border[@rule]">
+							<a:when>
+								<xsl:attribute name="test"><xsl:apply-templates select="." mode="when-test"/></xsl:attribute>
+								<xsl:text>#</xsl:text>
+								<xsl:apply-templates select="." mode="id"/>
+							</a:when>
+						</xsl:for-each>
+						<a:otherwise>
+							<xsl:choose>
+								<xsl:when test="@use">
+						      			<a:variable name="c" select="key('{name()}-{$id}',{@use})/@value"/>
+						  	  		<a:value-of select="$c"/>
+					         				<a:if test="not($c)">#<xsl:apply-templates select="border[not(@value)][1]" mode="id"/></a:if>
+					         			</xsl:when>
+					         			<xsl:when test="border[not(@value)]">#<xsl:apply-templates select="border[not(@value)][1]" mode="id"/></xsl:when>
+					         		</xsl:choose>
+						</a:otherwise>
+					</a:choose> 
+				</xsl:when>
+					<!-- no rules and no @use, must just have a single default -->
+				<xsl:when test="border[not(@value)]">#<xsl:apply-templates select="border[not(@value)][1]" mode="id"/></xsl:when>
+			</xsl:choose>
+		</a:template>			
+		<xsl:if test="border[not(@value)]">
+			<a:template match="cmp" mode="shape">
+				<xsl:text>#</xsl:text><xsl:apply-templates select="border[not(@value)][1]" mode="id"/>
+			</a:template>
+		</xsl:if>
+</xsl:template>
+
+
+<!-- Colours -->
+
+
+<xsl:template match="colors[@type='highlight']" mode="defines">
+	<xsl:for-each select="color">
+		<xsl:variable name="id"><xsl:apply-templates select="." mode="id"/></xsl:variable>
+		<filter id="{$id}" filterUnits="userSpaceOnUse">
+	  		<feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/>
+	  		<feFlood flood-color="{@color}" flood-opacity="1" result="flood"/>
+			<feComposite in2="blur" in="flood" operator="atop" result="comp" />
+	  		<feMerge>    
+	  	  		<feMergeNode in="comp"/><feMergeNode in="SourceGraphic"/>
+	  		</feMerge>
+		</filter>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="colors[@type='text-highlight']" mode="defines">
+	<xsl:for-each select="color">
+		<xsl:variable name="id"><xsl:apply-templates select="." mode="id"/></xsl:variable>
+		<filter id="{$id}" filterUnits="userSpaceOnUse">
+			<feMorphology operator="dilate" in="SourceAlpha" radius="0.2" result="blur"/>
+		 	<!-- <feGaussianBlur in="SourceAlpha" stdDeviation="0.8" result="blur"/> -->
+			<feFlood flood-color="{@color}" flood-opacity="1" result="flood"/>
+			<feComposite in2="blur" in="flood" operator="atop" result="comp" />
+			<feMerge><feMergeNode in="comp"/><feMergeNode in="SourceGraphic"/></feMerge>	
+		</filter>
+	</xsl:for-each>
+</xsl:template>
+
+
+<xsl:template match="colors">
+	<a:template mode="{substring-before(@type,'highlight')}filter">
+		<xsl:call-template name="match-syntax"/>
+		<xsl:call-template name="declare-vars"/>	
+		<a:choose>
+		<xsl:for-each select="color[@value|@rule]">
+			<a:when>
+				<xsl:attribute name="test"><xsl:apply-templates select="." mode="when-test"/></xsl:attribute>			
+				<a:attribute name="filter">url(#<xsl:apply-templates select="." mode="id"/>)</a:attribute>
+			</a:when>
+		</xsl:for-each>
+		<xsl:for-each select="color[not(@value|@rule)]">
+				<a:otherwise><a:attribute name="filter">url(#<xsl:apply-templates select="." mode="id"/>)</a:attribute></a:otherwise>
+		</xsl:for-each>
+		</a:choose>
+	</a:template>		
+</xsl:template>
+
+<xsl:template name="color-select">
+  <xsl:param name="default"/>
+  <xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>  
+  <a:variable name="c" select="key('{name()}-{$id}',{@use})/@value"/>
+  <a:choose>
+    <a:when test="not($c)"><xsl:value-of select="$default"/></a:when>
+    <a:when test="count($c)=1"><a:value-of select="$c"/></a:when>
+    <a:otherwise>url(#bg<a:apply-templates select="." mode="id"/>)</a:otherwise>
+  </a:choose>
+</xsl:template>
+
+<xsl:template match="colors[@type='background' or not(@type)]" priority="1">
+	<xsl:variable name="default-color">
+		<xsl:choose>
+			<xsl:when test="color[not(@value|@rule)]"><xsl:value-of select="color[not(@value|@rule)]/@color"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="@default"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+
+<!--  possible future enhancements: 
+	computed colour: expression to generate a comma-separated rgb tripple to be put inside "rgb(...)"  -->
+	
+    <xsl:if test="@use">
+<!--    multiple colours: if there are multiple match they'll appear as a gradient-->
+	<a:template mode="multi-color">
+    	<xsl:call-template name="match-syntax"/>
+			<xsl:variable name="key"><xsl:value-of select="name()"/>-<xsl:apply-templates select="." mode="style-id"/></xsl:variable>
+			<a:call-template name="multi-color-grad">
+			<xsl:choose>
+				<xsl:when test="@spacing='proportional'"> <!-- as opposed to the default: fixed -->
+					<a:with-param name="c" select="key('{$key}',{@use})/@value"/>
+          		</xsl:when>
+				<xsl:otherwise>          		
+					<a:with-param name="key" select="'{$key}'"/>
+					<a:with-param name="c" select="{@use}"/>
+				</xsl:otherwise>
+			</xsl:choose>
+          	<a:with-param name="dir" select="'{@direction}'" /> <!--  not documented! only used for XSLT processors that can't handle sin / cos -->
+          	<a:with-param name="angle" select="'{@angle}'" />
+          	<a:with-param name="blur">
+          		<xsl:attribute name="select">
+          			<xsl:choose>
+          				<xsl:when test="not(@blur)">0</xsl:when>
+          				<xsl:otherwise>
+          					<xsl:value-of select="0.5 * 100 * @blur"/>
+          				</xsl:otherwise>
+          			</xsl:choose>
+          		</xsl:attribute>
+          	</a:with-param>
+          </a:call-template>
+    </a:template>
+    </xsl:if>
+
+	<a:template mode="display-style-color">
+		<xsl:call-template name="match-syntax"/>
+		<xsl:call-template name="declare-vars"/>	
+		<xsl:choose>
+			<xsl:when test="@use and not(color[@rule])">
+                  <xsl:call-template name="color-select">
+                    <xsl:with-param name="default" select="$default-color"/>
+                  </xsl:call-template>
+			</xsl:when>
+			<xsl:otherwise>
+				<a:choose>
+					<xsl:for-each select="color[@rule]">
+						<a:when>
+							<xsl:attribute name="test"><xsl:apply-templates select="." mode="when-test"/></xsl:attribute>
+							<xsl:value-of select="@color"/>
+						</a:when>
+					</xsl:for-each>
+					<a:otherwise>
+						<xsl:choose>
+							<xsl:when test="@use"> <!-- only useful if there's something to look up -->
+                                <xsl:call-template name="color-select">
+                                  <xsl:with-param name="default" select="$default-color"/>
+                                </xsl:call-template>
+					        </xsl:when>
+					        <xsl:otherwise>
+					        	<xsl:value-of select="$default-color"/>
+					        </xsl:otherwise>
+					       </xsl:choose>
+					</a:otherwise>
+				</a:choose> 
+			</xsl:otherwise>
+		</xsl:choose>
+	</a:template>
+	
+	<xsl:if test="(@type='background' or not(@type)) and $default-color!=''">
+		<a:template match="cmp" mode="display-style-color">
+			<xsl:value-of select="$default-color"/>
+		</a:template>
+	</xsl:if>
+	
+
+
+	<a:template mode="animate-color">
+		<xsl:call-template name="match-syntax"/>
+		<a:if test="not(ancestor::SystemDefinition/@static='true')">
+		<xsl:call-template name="declare-vars"/>	
+		<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>	
+		<xsl:choose>
+			<xsl:when test="@use and not(color[@rule])">
+				<a:for-each select="key('{name()}-{$id}',{@use})">
+					<set attributeName="opacity" attributeType="XML" to="0.5" fill="remove">
+						<xsl:attribute name="begin">{@style-id}.mouseover</xsl:attribute>
+						<xsl:attribute name="end">{@style-id}.mouseout</xsl:attribute>
+					</set>
+				</a:for-each>			
+			</xsl:when>
+			<xsl:when test="not(*) and @match='@ts'">
+				<a:for-each select="key('{name()}-{$id}',@ts)">
+					<set attributeName="opacity" attributeType="XML" to="0.5" fill="remove">
+						<xsl:attribute name="begin">{@style-id}.mouseover</xsl:attribute>
+						<xsl:attribute name="end">{@style-id}.mouseout</xsl:attribute>
+					</set>
+				</a:for-each>			
+			</xsl:when>
+			<xsl:otherwise>
+				<a:choose>
+					<xsl:for-each select="color[@rule]">
+						<a:when>
+							<xsl:attribute name="test"><xsl:apply-templates select="." mode="when-test"/></xsl:attribute>
+								<set attributeName="opacity" attributeType="XML" to="0.5" fill="remove">
+									<xsl:attribute name="begin"><xsl:apply-templates select="." mode="style-id"/>.mouseover</xsl:attribute>
+									<xsl:attribute name="end"><xsl:apply-templates select="." mode="style-id"/>.mouseout</xsl:attribute>
+								</set>
+						</a:when>
+					</xsl:for-each>
+					<xsl:if test="@use"> <!-- only useful if there's something to look up -->
+						<a:otherwise>
+							<a:for-each select="key('{name()}-{$id}',{@use})">
+								<set attributeName="opacity" attributeType="XML" to="0.5" fill="remove">
+									<xsl:attribute name="begin">{@style-id}.mouseover</xsl:attribute>
+									<xsl:attribute name="end">{@style-id}.mouseout</xsl:attribute>
+								</set>
+							</a:for-each>		
+						</a:otherwise>
+					</xsl:if>						
+				</a:choose> 
+			</xsl:otherwise>
+		</xsl:choose>
+	</a:if>	
+	</a:template>
+		
+		
+</xsl:template>
+
+
+<xsl:template match="patterns">
+	<a:template mode="overlay-{1 + count(preceding::patterns)}">
+	 	<xsl:call-template name="match-syntax"/>
+		<xsl:call-template name="declare-vars"/>	
+		<a:choose>
+			<xsl:for-each select="overlay">
+				<a:when>
+					<xsl:attribute name="test">
+						<xsl:apply-templates select="." mode="when-test"/>
+					</xsl:attribute><o>#<xsl:apply-templates mode="id" select="."/></o></a:when>
+			</xsl:for-each>
+		</a:choose>
+	</a:template>
+</xsl:template>
+
+<xsl:template name="declare-vars">
+	<xsl:for-each select="*[@variable]">
+		<a:variable>
+			<xsl:attribute name="name"><xsl:apply-templates select="." mode="varname"/></xsl:attribute>
+			<xsl:attribute name="select"><xsl:value-of select="@variable"/></xsl:attribute>
+		</a:variable>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="styles">
+	<a:template mode="display-style-{position()}">
+	  	<xsl:call-template name="match-syntax"/>
+		<!--  set any necessary variables -->
+		<xsl:call-template name="declare-vars"/>
+		<a:choose>
+			<xsl:for-each select="style[@rule]">
+				<a:when>
+					<xsl:attribute name="test"><xsl:apply-templates select="." mode="when-test"/></xsl:attribute>				
+					<xsl:value-of select="."/>
+				</a:when>
+			</xsl:for-each>
+			<xsl:for-each select="style[not(@rule|@value)]"> <!--  the default is last (if it exists)-->
+				<a:otherwise><xsl:value-of select="."/></a:otherwise>
+			</xsl:for-each>
+		</a:choose>
+		<a:text>; </a:text>
+</a:template>
+
+</xsl:template>
+
+<xsl:template name="match-syntax">
+	<xsl:choose>
+			<xsl:when test="not(@match)"><xsl:attribute name="match">component</xsl:attribute></xsl:when>
+			<xsl:when test="@match='module'"><xsl:attribute name="match">collection</xsl:attribute></xsl:when>
+			<xsl:when test="@match='logicalset' or @match='block'"><xsl:attribute name="match">package</xsl:attribute></xsl:when>
+			<xsl:when test="@match='logicalsubset' or @match='subblock'"><xsl:attribute name="match">package/package</xsl:attribute></xsl:when>
+			<xsl:otherwise><xsl:copy-of select="@match"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!--  from model.xsl:  -->
+
+<xsl:template match="*" mode="style-id">
+<xsl:message>not found</xsl:message>
+</xsl:template>
+
+<xsl:template match="item" mode="style-id">
+	<xsl:message>Generated Text not supported in values files</xsl:message>
+</xsl:template>
+
+
+<xsl:template match="info" mode="style-id">
+	<xsl:value-of select="concat('i',count(preceding-sibling::info))"/>
+</xsl:template>
+
+<xsl:template match="legend" mode="style-id">
+	<xsl:value-of select="concat('L',count(preceding::legend))"/>
+</xsl:template>
+
+<xsl:template match="note" mode="style-id">
+	<xsl:value-of select="concat('n',count(preceding::note))"/>
+</xsl:template>
+	
+<!-- what about values and items? -->
+
+<xsl:template match="colors|borders|patterns|styles|examples" mode="style-id">
+	<xsl:value-of select="concat('s',count(preceding-sibling::*))"/>
+</xsl:template>
+
+<xsl:template match="colors/color|borders/border|patterns/overlay|styles/style" mode="style-id">
+	<xsl:apply-templates select=".." mode="style-id"/>-<xsl:value-of select="name()"/>
+	<xsl:value-of select="count(preceding-sibling::*)"/>
+</xsl:template>
+
+<xsl:template match="examples/cmp" mode="style-id">
+	<xsl:value-of select="concat('e',count(preceding::cmp[parent::examples]))"/>
+</xsl:template>
+
+
+</xsl:stylesheet> 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/_stock/css/developer.css	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,253 @@
+/* Symbian Foundation
+   CSS
+   Alex Abarmovich 10-02-2009 
+   Version 5
+   Date: 10-02-2009 
+   Last modified: 17-02-2009
+*/
+   
+/* Addtitional CSS styles and style corrections */
+
+#container #contentContainer{
+min-height:500px;
+}
+
+#header {
+height:90px
+}
+
+/* variable width container  AA */
+
+body#variable_width #container {
+width: 99%;
+margin: 0 auto;
+/*overflow: hidden;  does not work with absolutely positioned #globalWrapper Wiki AA */ 
+max-width: 1250px;
+min-width: 980px;
+text-align: left;
+}
+
+/* top header AA */
+#header .right { width:548px; }
+#searchForm label { float:left; padding-top:5px; width:4.30em; }
+
+
+
+/* top navigation AA */
+#dropmenu li#m_item1 { width:9.8em; padding-left:10px; z-index:11; } /* community */
+#dropmenu li#m_item2 { width:5.25em; z-index:12; } /* code */
+#dropmenu li#m_item3 { width:9.1em; z-index:13; } /* tools */
+#dropmenu li#m_item4 { width:11.7em; z-index:14; } /* documentation */
+#dropmenu li#m_item5 { width:6.5em; z-index:15;} /* forums */
+#dropmenu li#m_item6 { width:7.3em; z-index:16;} /* learning */
+#dropmenu li#m_item7 { width:5.46em; z-index:17;} /*  about us */ 
+
+/* generic classes */
+
+#genericContent {
+padding:10px;
+}
+
+#genericContent h2 {
+margin-bottom:10px;
+}
+
+#genericContent h3 {
+margin-bottom:5px;
+}
+
+#genericContent img {
+padding:15px;
+}
+
+
+/* home page */  
+/* main promo */
+
+#siteBox div.itemCopy ul.main_promo_internal {
+margin-bottom:10px;
+padding-top:0;
+}
+
+#siteBox div.itemCopy ul.main_promo_internal li {
+min-height:10px;
+}
+
+
+/*  contact form  AA  */
+form#contactUsFrm input#ophone_ctyCode {
+width:25px;
+} 
+
+/* form submit buttons AA */
+
+p.buttons {
+padding-bottom:10px;
+margin:10px 0 20px 0;
+width:100%;
+}
+
+p.buttons input {
+float:none;
+font-size:1.1em;
+font-weight:bold;
+padding:2px 9px;
+display:block;
+min-width:20px;
+margin:0 auto;
+}
+
+#addPackageUser li.buttons {
+padding:5px 0 5px 210px;
+}
+
+.multiSelect .labelContainer .buttons {
+margin:0 0 10px 0;
+}
+
+/* Getting Started */
+
+.GetStartedBoxContent { padding:9px 10px 2px 10px; }
+
+#GetStartedBox { width:238px; margin:5px 0; height: auto !important; min-height:237px; height:237px; }
+#GetStartedBox .started { margin-bottom:5px; margin-top:5px; background-image: url('../img/btn_box.gif'); background-repeat: no-repeat; background-position: top left; height: 60px; width: 220px; padding: 3px;}
+#GetStartedBox .started p { padding-bottom:0px;}
+#GetStartedBox .started img { float:left; margin-left: 10px; margin-right:15px;}
+#GetStartedBox .BoxCenter {height:60px;}
+
+/* Tools & kits box content */
+
+div#colcontainer1 p, div#colcontainer2 p { float:left;padding: 5px 0 10px 10px;}
+
+.img_t_comm_activity_dashboard {background:transparent url(../img/t_comm_activity_dashboard.gif) no-repeat scroll left top; padding:30px 0 0; width:350px;}
+.img_t_other_tools {background:transparent url(../img/t_other_tools.gif) no-repeat scroll left top; padding:30px 0 0; width:350px;}
+.img_t_quick_links {background:transparent url(../img/t_quick_links.gif) no-repeat scroll left top; padding:25px 0 0; width:350px;}
+.img_t_featured_developer {background:transparent url(../img/t_featured_developer.gif) no-repeat scroll left top; padding:55px 0 0; width:350px;}
+.img_t_platform_dashboard {background:transparent url(../img/t_platform_dashboard.gif) no-repeat scroll left top; padding:35px 0 0; width:265px;}
+.img_t_community_news {background:transparent url(../img/t_community_news.gif) no-repeat scroll left top; padding:55px 0 0; width:350px;}
+.img_t_application_dev {background:transparent url(../img/t_application_dev.gif) no-repeat scroll left top; padding:30px 0 0; width:350px;}
+.img_t_platform_dev {background:transparent url(../img/t_platform_phone_dev.gif) no-repeat scroll left top; padding:30px 0 0; width:350px;}
+.img_t_lets_get_started {background:transparent url(../img/t_lets_get_started.gif) no-repeat scroll left top; padding:30px 0 0; width:350px;}
+
+/* User profile section */
+
+/* registration */
+
+body#user_profile form table td {
+height:25px;
+padding-left:15px;
+}
+
+body#user_profile form table td.userFormLabel {
+padding-left:0;
+}
+
+
+
+body#user_profile form#registerForm table {
+width:850px;
+}
+
+body#user_profile form#registerForm {
+margin-top:20px;
+}
+
+body#user_profile form#registerForm input {
+margin-right:3px;
+}
+
+body#user_profile #subheader {
+margin-top:10px;
+height:60px;
+}
+
+body#user_profile div.BoxFrame {
+margin-bottom:20px;
+padding-bottom:15px;
+}
+
+body#user_profile div.error {
+color:#ff0000;
+margin-bottom:2px;
+}
+
+body#user_profile td.userFormLabel {
+font-weight:700;
+text-align:right;
+}
+
+body#user_profile input#registerForm_submit,
+body#user_profile input#_submit {
+background-color:#000000; 
+color:#fee126; 
+border:none; 
+padding:2px 9px; 
+cursor:pointer; 
+font-weight:bold; 
+font-size:1.1em;
+margin-left:0; 
+}
+
+/* login */
+
+body#user_profile #formContent {
+padding:15px;
+}
+
+body#user_profile form#frmLogin div.fieldHolder {
+height:25px;
+display:inline;
+}
+
+body#user_profile form#frmLogin label {
+width:90px;
+display:inline-block;
+font-weight:700;
+height:25px;
+}
+
+body#user_profile form#frmLogin input.loginSubmit { 
+margin:0 0 20px 95px;
+}
+
+body#user_profile #loginLinks {
+margin-left:95px;
+}
+
+/* profile */
+
+body#user_profile table#user_profile_table {
+border: none;
+}
+
+body#user_profile table#user_profile_table td {
+height:25px;
+padding-left:20px;
+vertical-align:top;
+}
+
+
+code var {font-style: italic; font-family: times new roman, times, serif}
+code em.comment {font-style: italic; color: #383; font-family: arial, helvetica, sans;}
+code em.comment code {font-weight: normal; font-size: 90%!important}
+code span.opt {color: #666}
+code span.depr {text-decoration: line-through}
+code span.default, code.default {color: #338}
+code span.aux {color:blue; font: sans; padding: 0px 0.3em}
+span.namespaced {color: #e3e}
+
+div.indent {
+  margin-left: 1em;
+}
+
+div.grouped {border: 1px dashed green; margin-top: 0.6em; margin-bottom: 0.6em; padding-left: 0.3emx;}
+
+tbody.deprecated td {background-color: #eee}
+
+table.invisible td {
+	vertical-align:top;
+	}
+table.invisible th {
+	vertical-align:top;
+	width: 9em;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/_stock/css/iefix.css	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,41 @@
+/* Symbian Foundation
+   CSS
+   Alex Abarmovich 10-02-2009 
+   Version 2
+   Date: 10-02-2009 
+   Last modified: 19-02-2009
+*/
+   
+/* CSS fixes for IE6 and IE7 */
+
+* html #contentContainer  {
+height:500px;
+}
+
+
+/* variable width container */
+
+* html body#variable_width #container {
+overflow: visible;
+font-size: 100%;
+}
+
+* html body#variable_width #container {width:expression(
+(document.documentElement.offsetWidth) >1280 
+* (parseInt(document.body.currentStyle.fontSize) 
+/ parseInt(document.body.currentStyle.fontSize))?  "1250px" 
+: ((document.documentElement.offsetWidth) < 1010? "980px" : "99%")); }
+
+/* main promo */
+* html #siteBox ul li {height:35px; }
+* html #siteBox div.itemCopy ul.main_promo_internal li {
+height:10px;
+}
+
+/* buttons IE 7 */
+
+*:first-child+html p.buttons input#submitForm {
+text-align:center;
+display:block;
+width:110px;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/_stock/css/portal.css	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,582 @@
+body { font:69% Verdana, Arial, Helvetica, sans-serif; background-color:#fff; color:#000; } /* 11px */
+/* h1 { font-size:1.82em; font-weight:bold; }  20px */
+h1 { font-size:1.64em; font-weight:bold; } /* 18px */
+h1 a {color:#000;}
+h2 { font-size:1.64em; font-weight:bold; } /* 18px */
+
+.cssImg {margin:0;}
+.cssImg a {position:relative; cursor:pointer;}
+.cssImg span {display:block;overflow: hidden;height: 0 !important;}
+h3 { font-size:1.18em; font-weight:bold; } /* 13px */
+h4 { font-size:1.09em; font-weight:bold; } /* 12px */
+a { text-decoration:none; color:#0000FF; }
+a.active { text-decoration:underline; }
+a:hover { text-decoration:underline; }
+.more_info { font-size:0.91em; font-weight:bold; text-decoration:none; color:#000; background:url(../img/btn_cta.gif) no-repeat left 2px; padding-left:10px; }
+small { font-size:0.82em; }
+p { padding-bottom:1em; }
+form select, input, textarea { font-size:1em; font-family:Verdana, Arial, Helvetica, sans-serif; margin-right:10px;}
+form select {padding:2px; border: 1px solid #d1d1d1;}
+
+#container { width:980px; margin:auto; background-color:#fff; position:relative; }
+
+/* global navigation */
+#global_nav { padding:5px 10px 0 10px; font-size:0.82em; }
+#global_nav a, #global_nav a:visited { color:#000; text-decoration:none; }
+#global_nav a:hover { color:#000; text-decoration:underline; }
+#global_nav .right { width:500px; }
+#global_nav .right img { vertical-align:middle; }
+
+/* portal navigation */
+#portal_nav { margin-bottom:5px; background-color:#d1d1d1; }
+#portal_nav .divider { font-size:1.18em; line-height:2.3em; height:auto !important; min-height:2.5em; height:2.5em; }
+#portal_nav .right { float:right; }
+#portal_nav .right img { vertical-align:middle; }
+#dropmenu { display:block; padding:0; font-weight:bold; height:auto !important; min-height:17px; height:17px; }
+#dropmenu li { float:left; display:block; position:relative; padding-right:2px; background:url(../img/divider.gif) center right no-repeat; }
+#dropmenu li.right { float:right; }
+#dropmenu li a { display:block; position:relative; padding-left:0.62em; color:#000; text-decoration:none; font-size:1.18em; line-height:2.45em; height:auto !important; min-height:2.5em; height:2.5em; }
+#dropmenu li a:hover, #dropmenu li a.hover, #dropmenu li#quicklinks a:hover, #dropmenu li#quicklinks a.hover { background-color:#fee126; }
+#dropmenu li.active a { background-color:#fee126; }
+#dropmenu ul { z-index:999; position:absolute; display:none; top:auto; left:-1px; }
+#dropmenu li ul li { border:solid 1px #d1d1d1; margin-top:-1px; background-color:#fff; padding-right:0 !important; background-image:none !important; }
+#dropmenu li ul li a, #dropmenu li#quicklinks li a  { background-image:none ;padding-left:0.62em; width:14em; height:auto; float:left; background-color:#fff; font-size:1.09em; line-height:1.9em; height:auto !important; min-height:2.1em; height:2.1em;}
+#dropmenu li.active ul li a { background-color:#fff; }
+#dropmenu li ul li a:hover, #dropmenu li ul li a.hover { background-color:#000 !important; color:#fee126 !important; }
+#dropmenu li:hover ul ul, #dropmenu li:hover ul ul ul, #dropmenu li:hover ul ul ul ul { display:none; }
+#dropmenu li:hover ul, #dropmenu li li:hover ul, #dropmenu li li li:hover ul, #dropmenu li li li li:hover ul { display:block; }
+#dropmenu li#m_item1 { width:11.8em; padding-left:10px; z-index:6; } /* getting started */
+#dropmenu li#m_item2 { width:8.55em; z-index:5; } /* resources */
+#dropmenu li#m_item3 { width:15.6em; z-index:4; } /* platform & packages */
+#dropmenu li#m_item4 { width:9.5em; z-index:3;} /* comunity */
+#dropmenu li#m_item5 { width:7.5em; z-index:2;} /* learning */
+#dropmenu li#m_item6 { width:5.46em;}
+#dropmenu li.last { background:none !important;} /* about */
+#dropmenu li#quicklinks { width:12em; z-index:18; padding-right:0 !important; background:none !important; }
+#dropmenu li#quicklinks a { padding-left:3em; background:url(../img/btn_quick_link.gif) 1em center no-repeat; }
+
+ /* quick links */
+#dropmenu li#quicklinks ul { left:-45px; }
+
+/* header */
+#devnet_header, #header { padding:0 0 5px 10px; }
+#devnet_header .right, #header .right { width:548px; }
+#devnet_header #logo, #header #logo { padding:20px 0 0 0; }
+#header_form { margin-bottom:10px; }
+#header_form a, #header_form a:visited { color:#000; font-size:0.82em; }
+#searchForm { margin-right:25px; }
+#searchForm label { float:left; padding-top:5px; width:4.30em; }
+#searchForm .fieldHolder { width:230px; height:23px; background:url(../img/search_box.gif) no-repeat; float:left; margin-bottom:5px; }
+#searchForm .textInput { width:190px; height:20px; background:none; border:none; color:#000000; margin:5px 0 0 5px; }
+#searchForm #SearchButton { vertical-align:top; padding:4px; margin-right:0px; margin-left:5px; }
+#searchForm #advancefilterContainer {margin-left:4.30em;}
+#searchForm #filterLabel { margin-left:15px; }
+#searchForm #advancefilter { background-color:#fff; width:150px; height:100px; position:absolute; z-index:9999; padding:20px; display:none; border:solid 1px #d1d1d1; }
+#searchForm #advancefilter select { margin-bottom:10px; width:150px; }
+
+#LoginForm label { float:left; padding-top:3px; width:5.95em; }
+#LoginForm .fieldHolder { width:170px; height:23px; background:url(../img/login_box.gif) no-repeat; float:left; }
+#LoginForm .textInput { width:160px; height:20px; background:none; border:none; color:#000000; margin:5px 5px 0 5px; }
+#LoginForm img { vertical-align:middle; }
+#LoginForm #SignOnButton { padding-left:8px; }
+#LoginForm #LoginWelcome { margin-bottom:10px; font-weight:bold; font-style:italic; }
+#LoginForm .LoginName { margin:0 0 0 5px; vertical-align:middle; }
+#LoginForm .LoginPadding { margin-bottom:35px; }
+
+#feedbackLoginForm {float:none;}
+#feedbackLoginForm a {color:#000;}
+#feedbackLoginForm label { float:left; padding-top:3px; width:5.95em; }
+#feedbackLoginForm .fieldHolder { width:170px; height:23px; background:url(../img/login_box.gif) no-repeat; float:left; }
+#feedbackLoginForm .textInput { width:160px; height:20px; background:none; border:none; color:#000000; margin:5px 5px 0 5px; }
+#feedbackLoginForm img { vertical-align:middle; }
+#feedbackLoginForm #FeedbackSignOnButton { padding-left:8px; }
+#feedbackLoginForm .LoginPadding { margin-bottom:35px; }
+div.closeFeedbackForm {margin-bottom:5px; text-align:right;}
+
+/* subheader for subpages */
+#subheader { margin:20px 0 10px 0; padding:0 8px; }
+#subheader h1 { text-align:left; padding:0px 0 0px 13px; margin-top:5px; background:url(../img/tbar_l.gif) left no-repeat; float:left; }
+#subheader h1 span {display:block; padding:0 20px 0 0;  background:url(../img/tbar_r.gif) right no-repeat; line-height:50px;}
+
+/* common box styles */
+.homepage_rightside { padding-right:8px; } /*to fix ie6 margin issue*/
+.BoxFrame {border:solid 1px #d1d1d1;}
+.BoxFrame p.nolist { padding:2em 1em; text-align:center; }
+.BoxHeader { margin-bottom:5px; }
+.BoxContent { padding:9px 10px 9px 10px; }
+.BoxContent h2 {margin-bottom:10px;}
+.rssIcon { vertical-align:top; }
+.editorBoxContent { margin:5px 0 15px 0; }
+.editorBoxContent p { width:190px; }
+.latestBoxTop { background-color:#e5e5e5; padding:5px 0 5px 15px; }
+.latestBoxContentFrame { height:auto !important; min-height:400px; height:400px; }
+.latestBoxContent{ padding:10px 15px 0 15px; }
+.latestBoxDivider { border-top:dotted 1px #000; margin:10px 15px 0 15px; }
+.latestBoxContent small { margin-top:5px; }
+.colcontainer .BoxContent { padding:10px 15px 0 15px; border-bottom:1px solid #d1d1d1;}
+.colcontainer .last { border-bottom:none; }
+.colcontainer .more_info { font-size:1em; font-weight:normal; }
+ul.rowLinks li {float:left; display:block; position:relative; padding-right:20px; padding-bottom:10px; font-size:0.82em;}
+ul.rowLinks li a {color:#000; background:url(../img/btn_cta.gif) no-repeat left 2px; padding-left:10px; }
+.infobox .more_info { font-size:0.91em; font-weight:bold;}
+.BoxContent .title {font-weight:bold; padding-bottom:0;}
+
+
+/* site box */
+#siteBox { background:url(../img/masthead.gif) no-repeat; width:703px; height:auto !important; min-height:265px; height:265px; margin:0; }
+#siteBox a {color:#000;}
+#siteBox h1, #siteBox h2 { padding:5px 0 15px 0;}
+#siteBox .siteHeader{ font-size:1.64em; font-weight:bold;}
+#siteBox ul { padding:40px 0 0 15px; width:185px; color:#000; float:left; }
+#siteBox ul li:hover { text-decoration:underline; }
+#siteBox ul .active { background:url(../img/masthead_highlighted.gif) repeat-y; }
+#siteBox ul li { padding:5px 15px 0 15px; min-height:35px; cursor:pointer; font-weight:bold; }
+#siteBox ul li a { font-weight:bold; }
+#siteBox .itemContainer { padding:0 0 0 0; float:left; width:440px; margin:10px 0 0 40px; }
+#siteBox .itemImage { float:right; padding:0 20px 0 10px; }
+#siteBox .itemCopy { float:left; width:230px; }
+#editorBox { width:695px; height:auto !important; min-height:220px; height:220px; margin:0 0 20px 0; }
+#latestBox { width:695px; margin:5px 0 30px 0; padding-left:8px; }
+
+/* editor's choice */
+#EditorChoiceBox { width:314px; padding:10px 20px 0 20px; background-color:#fff; margin-right:1px; height:auto !important; min-height:210px; height:210px; border-right:1px solid #d1d1d1; margin-right:-1px; }
+
+/* community editor */
+#CommunityEditorBox { width:314px; background-color:#fff; padding:10px 0 0 20px; height:auto !important; min-height:210px; height:210px; border-left:1px solid #d1d1d1; }
+
+/* latest in documentation */
+#LatestDocumentationBox { width:333px; }
+#LatestDocumentationBox p { padding-bottom:0; }
+
+/* latest in forum */
+#LatestForumBox { width:333px; }
+#LatestForumBox p { padding-bottom:5px; }
+
+/* download */
+#DownloadBox { width:238px; margin:5px 0; height: auto !important; min-height:220px; height:220px; }
+#DownloadBox img { margin-bottom:10px; }
+
+/* featured packages */
+#PackageBox { width:238px; margin:5px 0; height: auto !important; min-height:220px; height:220px; }
+#PackageBox .package { margin-bottom:15px; }
+#PackageBox .package p { padding-bottom:0; }
+#PackageBox .package img { float:left; margin-right:15px; }
+
+/* top articles */
+#TopArticleBox { width:238px; margin:5px 0; height:auto !important; min-height:435px; height:435px; }
+.voteNum { font-size:1.09em; font-weight:bold; color:#000; padding:0; text-align:center; padding:5px 0 0 0; }
+.voteTitle { font-size:0.82em; font-weight:bold; text-align:center; }
+.articleListing { padding:0 0 0 40px; width:150px; float:left; }
+.articleVote { background:url(../img/vote_box.gif) no-repeat; width:45px; height:40px; float:left; }
+.ui-accordion-container .more_info { margin-left:40px; }
+.ui-accordion { list-style-type: none; }
+.ui-accordion .odd { background-color:#e5e5e5; }
+.ui-accordion li { padding:1px 0 5px 0; margin:0; }
+.ui-accordion li span { margin-bottom:3px; }
+.ui-accordion li:hover { cursor:pointer; }
+.ui-accordion li span.ui-accordion-header { display:block; color:#000; text-decoration:none; position:relative; padding:0 0 0 10px; background:url(../img/icon_drop_down.gif) no-repeat 216px 4px; font-size:1.09em; }
+.ui-accordion li .selected { font-weight:bold; }
+.ui-accordion li span.ui-accordion-header.selected { background:none; }
+
+/* subpages styles */
+.subcontent { color:#000; padding:0 8px; }
+.subcontentImage { }
+.subcontent p { padding:0 0 10px 0; }
+.subcontent h1 { margin-bottom:10px; }
+.bulletlist { margin:10px 0 0 30px; }
+ul.bulletlist { list-style-type:disc; }
+ol.bulletlist { list-style-type:decimal; margin:10px 0 0 30px; }
+.bulletlist li { margin:0 0 10px 0; }
+.bulletlistDocumentation li { float: left;margin-left:40px; margin-top: 25px; }
+.breadcrumbs { font-size:0.82em; }
+.breadcrumbs a { text-decoration:underline; }
+.columns { width:964px; margin:0px 8px; clear:both; }
+.columns .bulletlist { }
+.colcontainerspacer { height:18px; }
+.colBoxTop { background-color:#e5e5e5; padding:5px 15px 5px 15px; color:#000; font-weight:bold; }
+.colBoxTop p {font-weight:normal; padding-bottom:0em;}
+.colBoxTop img { vertical-align:middle; }
+.one_col { width:99.8%; }
+.two_col { width:49%;}
+.three_col { width:32%; }
+.three_col_center { margin-left:1.8%; }
+.three_col_right { margin-right:0.3%; }
+.three_col_double { width:66%; }
+.four_col { width:24%; }
+.four_col_center { margin-left:1%; }
+.two_col_copy { width:343px; float:left; padding:0 10px 10px 0; float:right; }
+.one_col_copy { width:780px; float:left; padding:0 10px 10px 10px; }
+.colcontainer div.BoxFrame {margin-bottom:18px; height:1%;}
+.colcontainer {margin-top:10px;}
+
+
+/*Alphabet Listing in sub content*/
+.subcontent div.types, .subcontent div.alphabets { background:#d1d1d1; line-height:3em; height:1%;}
+.subcontent div.alphabets { margin-top:10px; margin-bottom:10px;}
+.subcontent li.noMatch {padding-bottom:10px; padding-left:15px;}
+.subcontent div.types small, .subcontent div.alphabets small { float:left; display:block; position:relative; background:#d1d1d1; padding-left:8px; }
+.subcontent div.types a, .subcontent div.alphabets a { color:#000; text-decoration:none; }
+.subcontent div.types a.selected, .subcontent div.alphabets a.selected { font-weight:bold; color:#fff; }
+.subcontent #alphabeticallist { padding:0;}
+
+/* forum */
+#forum { margin:0 8px 20px 8px; padding-bottom:20px; }
+#forum h2 { padding:10px; }
+#forumListing { width:100%; }
+#forumListing th { font-size:1.09em; padding:5px 10px; background-color:#fee126; font-weight:bold; text-align:center; }
+#forumListing td { padding:5px 10px; vertical-align:top; text-align:center; }
+#forumListing .threadColumn { text-align:left; }
+#forumListing .header .leftalign { text-align:left; }
+#forumListing .even { background-color:#e5e5e5; }
+#forumListing a, #forumListing a:visited { text-decoration:none; color:#0000FF; }
+#forumListing a:hover { text-decoration:underline; }
+
+/* community page */
+.community_image { padding:10px 5px 25px; }
+.community_header { padding:10px 5px; position:relative; left:8px;}
+.community_copy { width:180px; float:left; padding:0 10px 30px 0; float:right; }
+
+/*package page*/
+.package_description {width:66%;}
+.package_description .bulletlist {margin-top:0px;}
+.downloadInfo {text-align:center; margin-top:0px; margin-bottom:0px; padding:0px;}
+#createPackageFrm label.lnowrap {white-space:nowrap}
+#createPackageFrm label span {font-weight:normal;}
+#createPackageFrm small {font-weight:normal; display:inline;}
+#addPackageUser {border-bottom:1px dotted #d1d1d1;}
+#addPackageUser ol.forms {padding:15px 15px 0 5px;}
+#addPackageUser li.buttons {padding-left:210px; font-weight:bold; margin-bottom:0px; width:400px;}
+.multiSelect {padding-left:80px; padding-top:30px;}
+.multiSelect .selectContainer {float:left; width:350px;}
+.multiSelect .labelContainer label {display:inline; float:left; padding-right:10px;}
+.multiSelect .labelContainer .buttons {float:left; padding-bottom:4px;}
+.multiSelect select {width:350px;}
+.multiSelect .moveOptContainer {float:left; padding:70px 30px;}
+.multiSelect .moveOptContainer input {margin-bottom:10px;}
+
+/* search results page */
+#searchCriteria { padding:10px 10px; margin-bottom:18px; background-color:#D1D1D1; }
+#searchCriteria input { margin-left:5px; }
+#searchResultsTab { margin-bottom:18px; }
+#searchResultsTab .desc { margin-bottom:10px; }
+#searchResultsTab ul a:hover { text-decoration:none; }
+#searchResultsTab hr { color:#D1D1D1; background-color: #D1D1D1; height: 1px; border:0 none; margin-bottom:10px; }
+#searchResultsTab dl { margin-top:10px; margin-bottom:10px; }
+#searchResultsTab dl h2 { float:left; width:150px; }
+.topSearchResults { margin-left:20px; margin-top:10px; }
+#searchResultsTab a {font-weight:bold; }
+#searchResultsTab .moreResults a { color:#D6B900; }
+.searchtab_container .ui-tabs-panel { height:auto; }
+
+/* resources > downloads page */
+#downloadsTab, .mTab { margin-bottom:18px; }
+#downloadsTab .ui-tabs-panel, .mTab .ui-tabs-panel { padding:1em 0px; }
+#downloadsTab div.types, .mTab div.types, #downloadsTab div.alphabets, .mTab div.alphabets { background:#d1d1d1; line-height:3em; height:1%;}
+#downloadsTab div.alphabets, .mTab div.alphabets { margin-top:10px; }
+#downloadsTab div.types small, #downloadsTab div.alphabets small { float:left; display:block; position:relative; background:#d1d1d1; padding-left:8px; }
+#downloadsTab div.types a, #downloadsTab div.alphabets a { color:#000; text-decoration:none; }
+#downloadsTab div.types a.selected, #downloadsTab div.alphabets a.selected { font-weight:bold; color:#fff; }
+#downloadsTab div.type, .mTab div.type { padding:1em 8px; border-bottom:1px solid #d1d1d1; margin-bottom:1em; height:1%; clear:both; }
+#downloadsTab div.last, .mTab div.last { border-bottom:none; }
+#downloadsTab div.item, .mTab div.item { padding:10px 20px; }
+#downloadsTab div.description h4 small { font-weight:normal; padding:0 5px; }
+#downloadsTab div.description { float:left; width:60%; }
+.mTab div.description { float:left; width:90%; }
+#downloadsTab div.details { float:right; width:110px; background:#d1d1d1; text-align:center; padding:5px 0; }
+#downloadsTab .subscribe { float:right; line-height:3em; width:25px; padding-right:10px; }
+#downloadsTab .subscribe a { display:block; position:relative; height:3em; background:url(../img/icon_rss_feed03.gif) right center no-repeat; text-indent:-9999em; }
+.mtabs_title {background:#d1d1d1; line-height:3em; text-align:center; margin-bottom:10px;}
+
+div.view-by-category div.left { width:60%; }
+div.view-by-category div.right { width:30%; margin-right:20px; }
+div.view-by-category #categories a.selected {font-weight:bold!important;}
+div.view-by-category div.category { padding:1em; margin-bottom:1em; }
+
+/* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
+div.rating { cursor:pointer; margin:10px; clear:both; display:block; }
+div.rating:after { content:'.'; display:block; height:0; width:0; clear:both; visibility:hidden; }
+div.cancel, div.star { float:left; width:17px; height:15px; text-indent:-999em; cursor:pointer; display:block; background:transparent; overflow:hidden; }
+div.cancel, div.cancel a { background:url('../img/delete.gif') no-repeat 0 -16px; }
+div.star, div.star a { background:url('../img/star.gif') no-repeat 0 0px; }
+div.cancel a, div.star a { display:block; width:16px; height:100%; background-position:0 0px; }
+div.star_on a { background-position:0 -16px!important; }
+div.star_hover a, div.star_live a:hover { background-position:0 -32px; }
+/* Read Only CSS */
+div.star_readonly a, div.star_readonly a:hover { cursor:default !important; }
+/* Partial Star CSS */
+div.star { background:transparent!important; overflow:hidden!important; }
+
+/* jQuery.listnav Plugin CSS - http://www.ihwy.com/labs/jquery-listnav-plugin.aspx */
+#alphabeticallist { padding:0 1em; }
+.noMatch { list-style:none; }
+.listNav { padding:0 8px; height:1%; }
+.listNav a { display:block; float:left; padding:0 5px; font-size:0.82em; }
+.listNav a.ln-last { }
+.listNav a.ln-selected { color:#fff !important; font-weight:bold; }
+.listNav a:hover { text-decoration:underline; }
+.listNav a.ln-disabled { color:#999 !important; }
+.listNav .ln-letterCount { text-align:center; font-size:0.8em; line-height:1; margin-bottom:3px; color:#666; } /* extra styling using jquery.listnav.js internally used class name */
+
+/* Forms */
+form .BoxFrame {margin-bottom:15px; width: 960px;}
+ol.forms {float: left; list-style: none; padding:15px;}
+ol.forms li {clear: both;float: left;margin: 0 0 10px;width: 100%;}
+ol.forms label {cursor: pointer;display: block;float: left;font-weight: bold;margin: 0 10px 0 0;width: 200px;}
+ol.forms label.error { padding-left:210px; color:#FF0000; width:400px; font-weight:normal; font-size:0.9em;}
+ol.forms label.loading { padding-left:210px; color:#333; width:400px; font-weight:normal; font-size:0.9em; }
+ol.forms input, ol.forms textarea {font: inherit;padding: 2px;width: 310px;}
+ol.forms textarea { height: 250px; width:500px;}
+ol.forms li.grouping label {cursor:pointer; display: block;float: left;font-weight: bold;margin: 0 10px 0 0;width: 200px; }
+ol.forms li.grouping {padding-bottom:5px; margin-bottom:0px;}
+ol.forms li.grouping ul { list-style: none; display: block;float: left;}
+ol.forms li.grouping ul label {display: inline;float: none;font-weight: normal;margin: 0;width: auto;}
+ol.forms li.grouping ul input { width: auto; }
+.buttons {float: right; padding-bottom:10px; position:relative; top:1px;}
+.buttons input {background-color:#000000; color:#fee126; border:none; padding:1px 7px; cursor:pointer; font-weight:bold; font-size:0.82em; }
+.buttons input:hover {color:#FFF;}
+.compulsory {color:#FF0000;}
+.thankyou_container {height:auto !important; min-height:500px; height:500px;}
+form input.ctyCode {width:25px;}
+form input.cNumber {width:253px;}
+
+.plussign {padding:0 5px 10px 0; margin-bottom:10px;}
+
+p.instruction {line-height:1.5em;}
+
+/* Feedback */
+div#feedbackform {width:780px; margin:0 auto;}
+div#feedbackform textarea {height:100px;}
+
+div#feedback {background-color:#fff; color:#000; z-index:99; padding:20px; position:absolute;bottom:36px; border:1px solid #d1d1d1; display:none;}
+div#feedback.signin { width: 780px !important; left:80px;}
+div#feedback.signout { left:40%;}
+div#feedback textarea {height:100px;}
+div#feedbackform li.feedback_category label.error {padding:0;}
+div#feedbackform li.grouping {padding-bottom:20px;}
+div#feedbackform li.grouping li input {display:inline; margin:0;}
+div#feedbackform li.grouping li label {display:inline; margin-right:10px;}
+
+/*Section/Sub-section Images*/
+.img_txt_community_editor {padding: 35px 0 0 0; width:250px; height:35px; background:url(../img/txt_community_editor.gif) top left no-repeat;}
+.img_txt_editor_choice {padding: 35px 0 0 0; width:215px; height:35px; background:url(../img/txt_editor_choice.gif) top left no-repeat;}
+.img_txt_download {padding: 25px 0 0 0; width:125px; height:25px; background:url(../img/txt_download.gif) top left no-repeat;}
+.img_txt_featured_package {padding: 25px 0 0 0; width:220px; height:25px; background:url(../img/txt_featured_package.gif) top left no-repeat;}
+.img_txt_latest_document {padding: 25px 0 0 0; width:230px; height:25px; background:url(../img/txt_latest_document.gif) top left no-repeat;}
+.img_txt_latest_forum {padding: 25px 0 0 0; width:160px; height:25px; background:url(../img/txt_latest_forum.gif) top left no-repeat;}
+.img_txt_top_articles {padding: 25px 0 0 0; width:145px; height:25px; background:url(../img/txt_top_articles.gif) top left no-repeat;}
+.img_t_going_open_source {padding: 48px 0 0 0; width:130px; height:48px; background:url(../img/t_going_open_source.gif) top left no-repeat;}
+.img_t_history_of_symbian {padding: 53px 0 0 0; width:125px; height:53px; background:url(../img/t_history_of_symbian.gif) top left no-repeat;}
+.img_t_leadership_team {padding: 27px 0 0 0; width:188px; height:27px; background:url(../img/t_leadership_team.gif) top left no-repeat;}
+.img_t_member_companies {padding: 48px 0 0 0; width:120px; height:48px; background:url(../img/t_member_companies.gif) top left no-repeat;}
+.img_t_foundation_members {padding: 48px 0 0 0; width:125px; height:48px; background:url(../img/t_foundation_members.gif) top left no-repeat;}
+.img_t_keynote_speeches {padding: 51px 0 0 0; width:110px; height:51px; background:url(../img/t_keynote_speeches.gif) top left no-repeat;}
+.img_t_forums {padding: 24px 0 0 0; width:80px; height:24px; background:url(../img/t_forums.gif) top left no-repeat;}
+.img_t_blog {padding: 26px 0 0 0; width:61px; height:26px; background:url(../img/t_blog.gif) top left no-repeat;}
+.img_t_wikis {padding: 24px 0 0 0; width:58px; height:24px; background:url(../img/t_wikis.gif) top left no-repeat;}
+.img_t_news {padding: 22px 0 0 0; width:174px; height:22px; background:url(../img/t_news.gif) top left no-repeat;}
+.img_t_competence {padding: 76px 0 0 0; width:144px; height:76px; background:url(../img/t_competence.gif) top left no-repeat;}
+.img_hdr_step1 {padding: 26px 0 0 0; width:68px; height:26px; background:url(../img/hdr_step1.gif) top left no-repeat;}
+.img_hdr_step2 {padding: 26px 0 0 0; width:72px; height:26px; background:url(../img/hdr_step2.gif) top left no-repeat;}
+.img_hdr_step3 {padding: 26px 0 0 0; width:72px; height:26px; background:url(../img/hdr_step3.gif) top left no-repeat;}
+.img_hdr_step4 {padding: 26px 0 0 0; width:73px; height:26px; background:url(../img/hdr_step4.gif) top left no-repeat;}
+.img_hdr_forum {padding: 25px 0 0 0; width:198px; height:25px; background:url(../img/hdr_forum.gif) top left no-repeat;}
+.img_t_training {padding: 25px 0 0 0; width:97px; height:25px; background:url(../img/t_training.gif) top left no-repeat;}
+.img_t_developer {padding: 81px 0 0 0; width:123px; height:81px; background:url(../img/t_developer.gif) top left no-repeat;}
+.img_t_universities {padding: 22px 0 0 0; width:142px; height:22px; background:url(../img/t_universities.gif) top left no-repeat;}
+.img_t_books {padding: 20px 0 0 0; width:65px; height:20px; background:url(../img/t_books.gif) top left no-repeat;}
+.img_t_events {padding: 21px 0 0 0; width:81px; height:21px; background:url(../img/t_events.gif) top left no-repeat;}
+.img_t_categories {padding: 20px 0 0 0; width:105px; height:20px; background:url(../img/t_categories.gif) top left no-repeat;}
+.img_t_documentation {padding: 22px 0 0 0; width:176px; height:22px; background:url(../img/t_documentation.gif) top left no-repeat;}
+.img_t_examplecode {padding: 28px 0 0 0; width:163px; height:28px; background:url(../img/t_examplecode.gif) top left no-repeat;}
+.img_t_tools {padding: 23px 0 0 0; width:67px; height:23px; background:url(../img/t_tools.gif) top left no-repeat;}
+.img_t_contribute_code {padding: 25px 0 0 0; width:330px; height:25px; background:url(../img/t_contribute_code.gif) top left no-repeat;}
+.img_t_develop_application {padding: 25px 0 0 0; width:415px; height:25px; background:url(../img/t_develop_application.gif) top left no-repeat;}
+.img_t_documentation_platform {padding: 25px 0 0 0; width:475px; height:24px; background:url(../img/t_documentation_platform.gif) top left no-repeat;}
+.img_t_documentation_application {padding: 25px 0 0 0; width:505px; height:24px; background:url(../img/t_documentation_application.gif) top left no-repeat;}
+.img_t_packages {padding: 25px 0 0 0; width:115px; height:25px; background:url(../img/t_packages.gif) top left no-repeat;}
+
+/* documentation style */
+.documentationLinks p {background:transparent url(../img/tbar_l.gif) no-repeat scroll left center;padding:0 0 0 13px;}
+.documentationLinks a {background:transparent url(../img/tbar_r.gif) no-repeat scroll right center;display:block;line-height:20px;padding:0 20px 0 0;}
+
+/* common style */
+.left { float:left; }
+.right { float:right; }
+.clear { clear:both; width:0; height:0; font-size:0; overflow:hidden; }
+.hidden { display:none; }
+.bold { font-weight:bold; }
+.hmarginright {margin-right:10px;}
+.pname {text-decoration:underline;}
+
+
+/* footer */
+#devnet_footer { clear:both; background-color:#000; color:#fff; padding:10px; }
+#devnet_footer ul li { float:left; display:block; background:url(../img/footer-divider.gif) right bottom no-repeat; padding-right:10px; margin-right:10px; }
+#devnet_footer ul li.last { background-image:none; }
+#devnet_footer a, #devnet_footer a:visited, #devnet_footer a:hover { color:#fff; text-decoration:none; font-size:0.82em; }
+#devnet_footer a:hover { text-decoration:underline; }
+
+
+
+/* jQuery Thickbox 3.1 CSS - http://jquery.com/demo/thickbox/ */
+/* ----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
+/* ----------------------------------------------------------------------------------------------------------------*/
+*{padding: 0; margin: 0;}
+
+/* ----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
+/* ----------------------------------------------------------------------------------------------------------------*/
+#TB_window {
+	color: #000;
+}
+
+#TB_secondLine {
+	color:#000;
+}
+
+#TB_window a:link {color: #0000FF;}
+#TB_window a:visited {color: #0000FF;}
+#TB_window a:hover {color: #0000FF; text-decoration:underline;}
+#TB_window a:active {color: #0000FF;}
+#TB_window a:focus{color: #0000FF;}
+
+/* ----------------------------------------------------------------------------------------------------------------*/
+/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
+/* ----------------------------------------------------------------------------------------------------------------*/
+#TB_overlay {
+	position: fixed;
+	z-index:100;
+	top: 0px;
+	left: 0px;
+	height:100%;
+	width:100%;
+}
+
+.TB_overlayMacFFBGHack {background: url(../img/macFFBgHack.png) repeat;}
+.TB_overlayBG {
+	background-color:#000;
+	filter:alpha(opacity=75);
+	-moz-opacity: 0.75;
+	opacity: 0.75;
+}
+
+* html #TB_overlay { /* ie6 hack */
+     position: absolute;
+     height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
+}
+
+#TB_window {
+	position: fixed;
+	background: #ffffff;
+	z-index: 102;
+	color:#000000;
+	display:none;
+	border: 4px solid #525252;
+	text-align:left;
+	top:50%;
+	left:50%;
+}
+
+* html #TB_window { /* ie6 hack */
+position: absolute;
+margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
+}
+
+#TB_window img#TB_Image {
+	display:block;
+	margin: 15px 0 0 15px;
+	border-right: 1px solid #ccc;
+	border-bottom: 1px solid #ccc;
+	border-top: 1px solid #666;
+	border-left: 1px solid #666;
+}
+
+#TB_caption{
+	height:25px;
+	padding:7px 30px 10px 25px;
+	float:left;
+}
+
+#TB_closeWindow{
+	height:25px;
+	padding:11px 25px 10px 0;
+	float:right;
+}
+
+#TB_closeAjaxWindow{
+	padding:7px 10px 5px 0;
+	margin-bottom:1px;
+	text-align:right;
+	float:right;
+}
+
+#TB_ajaxWindowTitle{
+	float:left;
+	padding:7px 0 5px 10px;
+	margin-bottom:1px;
+}
+
+#TB_title{
+	background-color:#e8e8e8;
+	height:27px;
+}
+
+#TB_ajaxContent{
+	clear:both;
+	padding:2px 15px 15px 15px;
+	overflow:auto;
+	text-align:left;
+	line-height:1.4em;
+}
+
+#TB_ajaxContent.TB_modal{
+	padding:15px;
+}
+
+#TB_ajaxContent p{
+	padding:5px 0px 5px 0px;
+}
+
+#TB_load{
+	position: fixed;
+	display:none;
+	height:13px;
+	width:208px;
+	z-index:103;
+	top: 50%;
+	left: 50%;
+	margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
+}
+
+* html #TB_load { /* ie6 hack */
+position: absolute;
+margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
+}
+
+#TB_HideSelect{
+	z-index:99;
+	position:fixed;
+	top: 0;
+	left: 0;
+	background-color:#fff;
+	border:none;
+	filter:alpha(opacity=0);
+	-moz-opacity: 0;
+	opacity: 0;
+	height:100%;
+	width:100%;
+}
+
+* html #TB_HideSelect { /* ie6 hack */
+     position: absolute;
+     height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
+}
+
+#TB_iframeContent{
+	clear:both;
+	border:none;
+	margin-bottom:-1px;
+	margin-top:1px;
+	_margin-bottom:1px;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/_stock/css/reset.css	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,12 @@
+body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {padding:0;margin:0;}
+table {border-collapse:collapse;border-spacing:0;}
+fieldset,img {border:0;}
+address,caption,cite,code,dfn,em,strong,th,var {font-weight:normal;font-style:normal;}
+ol,ul {list-style:none;}
+caption,th {text-align:left;}
+h1,h2,h3,h4,h5,h6 {font-weight: normal;font-size: 100%;}
+q:before,q:after {content:'';}
+abbr,acronym {border:0;}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/_stock/css/sdlplugin.css	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,16 @@
+body {
+    background-color: #FFFFFF;
+}
+
+.help_breadcrumbs {
+    background-color: #E5E5E5;
+    border-bottom:1px dotted #B2B2B2;
+    border-top:1px dotted #B2B2B2;
+    font-size:12px;
+    margin:10px;
+    padding:5px;
+}
+
+.help_breadcrumbs a {
+    color: black;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/_stock/css/sysdoc.css	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,493 @@
+/* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: http://www.symbianfoundation.org/legal/sfl-v10.html. */
+
+dt
+{
+font-weight: bold;
+}
+
+.topNavigation ul li {
+display: inline;
+padding-right: 20px;
+}
+
+hr {
+	border: 0px;
+	background: url(../images/css/section_hr.gif) top left repeat-x;
+	height: 15px;
+	width: 100%;
+}
+
+#authoredContent, .Bodytext {
+	padding-top: 5px;
+	line-height: 150% !important;
+	padding-bottom: 15px;
+}
+
+
+#authoredContent h1, .Bodytext h1, .Head1 h1 {
+	margin: 0px;
+	font-size: 210%;
+	font-weight: bold;
+	line-height: 1.4;
+	margin: 0.5em 0 0.8em 0;
+}
+
+#authoredContent h2, .Bodytext h2 {
+	margin: 0.8em 0 0.5em 0;
+	font-size: 170%;
+	font-weight: bold;
+	margin-left: 0px;
+}
+
+#authoredContent h3 , .Bodytext h3 {
+	padding-top: 4px;
+	padding-bottom: 4px;
+	margin: 0px;
+	font-size: 140%;
+	font-weight: bold;
+	margin-left: 0px;
+}
+
+#authoredContent h4, .Bodytext h4 {
+	padding-top: 4px;
+	padding-bottom: 4px;
+	margin: 0px;
+	font-size: 120%;
+	font-weight: bold;
+	margin-left: -0px;
+}
+
+#authoredContent h5, .Bodytext h5 {
+	padding-top: 4px;
+	padding-bottom: 4px;
+	margin: 0px;
+	font-size: 110%;
+	font-weight: bold;
+	margin-left: -0px;
+}
+
+#authoredContent table, .Bodytext table {
+	margin: 0px;
+	border: 1px solid #000000;
+	margin: 0.5em 0 1em 0;
+}
+
+#authoredContent table p, .Bodytext table p{
+	margin: 0px;
+	padding: 2px 0px;
+}
+
+#authoredContent th, .Bodytext th {
+	border: 1px solid #000000;
+	background-color: #e5e5e5;
+	font-weight: bold;
+	padding: 0.5em;
+}
+
+#authoredContent td, .Bodytext td {
+	border: 1px solid #000000;
+
+	padding: 0.5em;
+}
+
+.Bodytext td table td, .Bodytext td table, .Bodytext table, .Bodytext table td
+{
+border: none;
+padding: 0.2em;
+margin: 0;
+margin-bottom: 0.5em;
+}
+
+#authoredContent.codeblock {
+	border: 1px solid #d1d1d1; 
+	background-color: #e5e5e5;
+	padding: 5px;
+	font-family: "courier new", "courier", serif;
+	color: #444444;
+}
+
+#authoredContent ul, #authoredContent ol, .Bodytext ul, .Bodytext ol
+{
+margin-bottom: 0.8em;
+}
+
+#authoredContent ul li ul, #authoredContent ol li ol, .Bodytext ul li ul, .Bodytext ol li ol
+{
+margin-top: 0.2em;
+margin-bottom: 0.2em;
+}
+
+#authoredContent ul li, .Bodytext ul li
+{
+list-style-type: square;
+margin-left: 2.5em;
+}
+
+#authoredContent ul li ul li, .Bodytext ul li ul li
+{
+margin-left: 1.5em;
+list-style-type: disc;
+}
+
+#authoredContent ol li, .Bodytext ol li
+{
+margin-left: 2em;
+list-style-type: decimal;
+}
+
+#authoredContent.section, .Bodytext.section {
+	padding-top: 5px;
+}
+
+#authoredContent.section.section, .Bodytext.section.section {
+	padding-top: 5px;
+}
+
+
+
+
+
+#main_content {
+	background-color: #ffffff;
+	padding: 13px 5px;
+
+}
+
+
+#main_content table {
+	font-family: "verdana", sans-serif;
+	color: #222222;
+}
+
+#main_content_toc {
+	/** border-right: 1px solid #b2b2b2; **/
+	overflow: auto;
+	font-size: 0.9em;
+}
+
+#main_content_toc a {
+	font-weight: normal;
+	background-color: transparent;
+padding-bottom: 4px;
+}
+
+#main_content_sizer {
+	width: 5px;
+	background-color: #cccccc;
+	cursor: w-resize;
+}
+
+#main_content_toc a:hover {
+	background-color: #fee126;
+	text-decoration: none;
+	border: 0px;
+}
+
+#main_content_txt {
+	padding-left: 13px;
+	padding-top: 1px;
+		font-size: 1.1em;
+}
+
+
+
+.sysdoc_navigator
+{
+	font-size: 0.8em;
+	border-top: 1px dotted #b2b2b2;
+	border-bottom: 1px dotted #b2b2b2;
+}
+
+.sysdoc_navigator a {
+	background-color: #e5e5e5;
+}
+
+.sysdoc_navigator a:hover {
+	background-color: #fee126;
+	text-decoration: underline;
+	border: 0px;
+}
+
+.sysdoc_navigator_padding {
+	padding: 5px;
+	background-color: #e5e5e5;
+	font-size: 1.1em;
+}
+
+#printer_copyright {
+	display: none;
+}
+
+#printer_copyright_padding {
+	display: none;
+}
+
+.main_content_label {
+	padding-bottom: 2px;
+}
+
+.main_content_padding {
+	padding-right: 5px;
+	padding-bottom: 5px;
+}
+
+.main_content_rss {
+	width: 20px;
+	height: 20px;
+	cursor: pointer;
+	background: url(../images/css/rss.gif) top left no-repeat;
+	float: right;
+	clear: right;
+}
+
+.main_content_title {
+	padding-bottom: 10px;
+}
+
+.print_icon {
+	float: right;
+	width: 26px;
+	height: 26px;
+	background: url(../images/css/icon_print.gif) top left no-repeat;
+	cursor: pointer;
+	margin-top: -22px;
+}
+
+.subheading {
+	padding-bottom: 10px;
+}
+
+.table_border {
+	width: 384px;
+	padding-bottom: 13px;
+}
+
+.table_border_top {
+	width: 384px;
+	height: 8px;
+	font-size: 0px;
+	background: url(../images/css/table_top.gif) top left no-repeat;
+}
+
+.table_border_middle {
+	width: 384px;
+	background: url(../images/css/table_middle.gif) top left repeat-y;
+}
+
+.table_border_bottom {
+	font-size: 0px;
+	width: 384px;
+	height: 8px;
+	background: url(../images/css/table_bottom.gif) bottom left no-repeat;
+}
+
+.table_border_padding {
+	padding-top: 5px;
+	padding-left: 10px;
+	padding-right: 5px;
+	padding-bottom: 10px;
+}
+
+#authoredContent pre, .Bodytext pre
+{
+padding: 0.6em 1em;
+background-color: #eee;
+line-height: 2 !important;
+margin-bottom: 1em;
+}
+
+#authoredContent code, .Bodytext code
+{
+line-height: 1.4 !important;
+font-size: 1.2em;
+}
+
+h1 code, h2 code, h3 code, h4 code, h5 code
+{
+font-weight: bold;
+}
+
+#authoredContent ul li pre, #authoredContent ol li pre, .Bodytext ul li pre, .Bodytext ol li pre
+{
+margin-top: 1em;
+}
+
+#authoredContent p.Caption, .Bodytext p.Caption
+{
+font-style: italic;
+font-size: 0.9em;
+}
+
+.RelatedItems
+{
+font-weight: bold;
+margin: 1em 0 0.5em 0;
+}
+
+#header
+{
+width: auto;
+}
+
+#container
+{
+overflow: auto;
+}
+
+pre
+{
+overflow: auto;
+
+}
+
+
+pre code
+{
+}
+
+.Structure, .CodeBlock, .Prototype, .Instructions, .Process,
+.Guideline, .DataDescription, .Classification, .Example {
+  padding: 1em 1em 0 1em;
+  background-color: #eee;
+  margin-bottom: 1em;
+}
+
+/* CodeBlocks in blue boxes want to be blue too. */
+.Structure       pre,
+.Instructions    pre,
+.Process         pre,
+.Guideline       pre,
+.DataDescription pre,
+.Classification  pre,
+.Example         pre
+{
+  background-color: #d5d5d5 !important;
+}
+
+.apiAbstract
+{
+    margin-top: 3px;
+    margin-left: 10px;
+}
+
+/* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: http://www.symbianfoundation.org/legal/sfl-v10.html. */
+
+#authoredContent p.Caption, .Bodytext p.Caption
+{
+margin-top: -1.5em;
+}
+
+#authoredContent p.Image
+{
+margin-bottom: 0;
+padding-bottom: 0;
+}
+
+.Structure, .CodeBlock, .Prototype, .Instructions, .Process,
+.Guideline, .DataDescription, .Classification, .Example {
+  padding: 1em 1em 1em 1em;
+  background-color: #eee;
+  margin-bottom: 1em;
+}
+
+/* CodeBlocks in blue boxes want to be blue too. */
+.Structure       .CodeBlock,
+.Instructions    .CodeBlock,
+.Process         .CodeBlock,
+.Guideline       .CodeBlock,
+.DataDescription .CodeBlock,
+.Classification  .CodeBlock,
+.Example         .CodeBlock
+{
+  background-color: #cccccc;
+  border: solid #dddddd 1px;
+}
+
+.apiAbstract
+{
+    margin-top: 3px;
+    margin-left: 3px;
+}
+
+.ValueDesc { padding-left: 10px !important;}
+
+.apiAbstract:before
+{
+content: ' - ';
+}
+
+.ValueDesc
+{
+padding: 0px 0px 0px 10px !important;
+}
+
+#pageFunctions
+{
+float: right;
+margin-top: 3px;
+background-color: transparent;
+}
+
+#pageFunctions a:hover {
+	background-color: transparent;
+}
+
+.ajax-div h3
+{
+font-size: 1.1em;
+}
+
+.ajax-div h3 a
+{
+color: #0000ff !important;
+font-weight: bold !important;
+}
+
+#container
+{
+margin:0 auto;
+text-align:left;
+width:99%;
+}
+
+
+.ygtvitem, .ygtvchildren, #toc
+{
+width: 100%;
+}
+
+.ygtvtable
+{
+table-layout: fixed;
+width: 100%;
+overflow: hidden;
+}
+
+.ygtvcontent a
+{
+display: block;
+}
+
+.input-div, .output-div-container
+{
+padding: 0;
+}
+
+.error
+{
+padding: 1em;
+text-decoration: none !important;
+color: red;
+margin-right: 1em;
+font-weight: bold;
+text-align: center;
+}
+
+strong
+{
+font-weight: bold;
+}
+
+em
+{font-style: italic;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/_stock/css/ui.css	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,262 @@
+/* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: http://www.symbianfoundation.org/legal/sfl-v10.html. */
+
+body {
+	font-family: "tahoma", sans-serif;
+	font-size: 11px;
+	background-color: #888888;
+	margin: 0px;
+	padding: 0px;
+}
+
+h1 {
+	padding-top: 8px;
+	padding-bottom: 8px;
+	margin: 0px;
+	font-size: 22px;
+	font-weight: bold;
+}
+
+h2 {
+	padding-top: 6px;
+	padding-bottom: 6px;
+	margin: 0px;
+	font-size: 18px;
+	font-weight: bold;
+}
+
+h3 {
+	padding-top: 4px;
+	padding-bottom: 4px;
+	margin: 0px;
+	font-size: 14px;
+	font-weight: bold;
+}
+
+#index_table a {
+	font-weight: normal;
+	background-color: #ffffff;
+}
+
+#index_table a:hover {
+	font-weight: normal;
+	background-color: #cccccc;
+}
+
+#content_footer {
+	font-family: "verdana", sans-serif;
+}
+
+#content_footer a {
+	text-decoration: none;
+	color: #ffffff;
+}
+
+#content_footer a:hover {
+	text-decoration: underline;
+}
+
+#content_footer_links {
+	background-color: #333333;
+	color: #ffffff;
+	font-size: 13px;
+	height: 42px;
+}
+
+#content_footer_links_padding {
+	padding-top: 16px;
+	padding-left: 32px;
+}
+
+#main_content {
+	background-color: #ffffff;
+	font-size: 11px;
+	padding: 13px;
+	padding-left: 13px;
+	padding-top: 13px;
+	font-size: 12px;
+}
+
+#main_content a {
+	color: #222222;
+	background-color: #ffffff;
+	font-weight: normal;
+}
+
+#main_content a:hover {
+	background-color: #fee126;
+	text-decoration: underline;
+}
+
+#main_content table {
+	font-family: "verdana", sans-serif;
+	color: #222222;
+	font-size: 12px;
+}
+
+#main_content_toc {
+	/** border-right: 1px solid #b2b2b2; **/
+	text-decoration: underline;
+	overflow: auto;
+	font-size: 10px;
+}
+
+#main_content_toc a {
+	text-decoration: none;
+	font-weight: normal;
+	color: #222222;
+	background-color: #ffffff;
+	font-size: 10px;
+}
+
+#main_content_sizer {
+	width: 5px;
+	background-color: #cccccc;
+	cursor: w-resize;
+}
+
+#main_content_toc a:hover {
+	background-color: #fee126;
+	text-decoration: none;
+	border: 0px;
+}
+
+#main_content_txt {
+	padding-left: 13px;
+	padding-top: 1px;
+	font-size: 12px;
+}
+
+#mast {
+	font-family: "verdana", sans-serif;
+	background-color: #ffffff;
+	background: url(../images/css/ui_mast_doodles.gif) top right no-repeat;
+}
+
+#mast a {
+	text-decoration: none;
+	color: #222222;
+}
+
+#mast a:hover {
+	text-decoration: underline;
+}
+
+#mast_content {
+	background: url(../images/css/ui_logo.gif) top left no-repeat;
+	height: 60px; /** defaut: 80px **/
+}
+
+#mast_links {
+	background-color: #d1d1d1;
+	font-size: 14px;
+	height: 28px;
+}
+
+#mast_links_padding {
+	padding-top: 4px;
+	padding-left: 32px;
+}
+
+#mast_padding {
+	padding-top: 8px;
+	padding-left: 32px;
+}
+
+#mast_spacer {
+	height: 0px; /** defaut: 20px **/
+}
+
+#mast_top {
+	height: 20px;
+}
+
+#navigator {
+	border-top: 1px dotted #b2b2b2;
+	border-bottom: 1px dotted #b2b2b2;
+}
+
+#navigator a {
+	background-color: #e5e5e5;
+}
+
+#navigator a:hover {
+	background-color: #fee126;
+	text-decoration: underline;
+	border: 0px;
+}
+
+#navigator_padding {
+	padding: 5px;
+	background-color: #e5e5e5;
+}
+
+#printer_copyright {
+	display: none;
+}
+
+#printer_copyright_padding {
+	display: none;
+}
+
+.main_content_label {
+	padding-bottom: 2px;
+}
+
+.main_content_padding {
+	padding-left: 10px;
+	padding-right: 5px;
+	padding-bottom: 5px;
+}
+
+.main_content_rss {
+	width: 20px;
+	height: 20px;
+	cursor: pointer;
+	background: url(../images/css/rss.gif) top left no-repeat;
+	float: right;
+	clear: right;
+}
+
+.main_content_title {
+	padding-bottom: 10px;
+}
+
+.print_icon {
+	float: right;
+	width: 26px;
+	height: 26px;
+	background: url(../images/css/icon_print.gif) top left no-repeat;
+	cursor: pointer;
+	margin-top: -22px;
+}
+
+.table_border {
+	width: 384px;
+	padding-bottom: 13px;
+}
+
+.table_border_top {
+	width: 384px;
+	height: 8px;
+	font-size: 0px;
+	background: url(../images/css/table_top.gif) top left no-repeat;
+}
+
+.table_border_middle {
+	width: 384px;
+	background: url(../images/css/table_middle.gif) top left repeat-y;
+}
+
+.table_border_bottom {
+	font-size: 0px
+	width: 384px;
+	height: 8px;
+	background: url(../images/css/table_bottom.gif) bottom left no-repeat;
+}
+
+.table_border_padding {
+	padding-top: 5px;
+	padding-left: 10px;
+	padding-right: 5px;
+	padding-bottom: 10px;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/_stock/css/ui.tabs.css	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,114 @@
+/* Caution! Ensure accessibility in print and other media types... */
+@media projection, screen { /* Use class for showing/hiding tab content, so that visibility can be better controlled in different media types... */
+    .ui-tabs-hide {
+        display: none;
+    }
+}
+
+/* Hide useless elements in print layouts... */
+@media print {
+    .ui-tabs-nav {
+        display: none;
+    }
+}
+
+/* Skin */ /*font-size: 12px;*/
+.ui-tabs-nav, .ui-tabs-panel {
+    
+}
+.ui-tabs-nav {
+    list-style: none;
+    margin: 0;
+    padding: 0 0 0 4px;
+}
+.ui-tabs-nav:after { /* clearing without presentational markup, IE gets extra treatment */
+    display: block;
+    clear: both;
+    content: " ";
+}
+.ui-tabs-nav li {
+    float: left;
+    margin: 0 0 0 1px;
+    min-width: 84px; /* be nice to Opera */
+}
+.ui-tabs-nav a, .ui-tabs-nav a span {
+    display: block;
+    padding: 0 10px;
+    background: url(../img/bg_tab.png) no-repeat;
+	/* border: 1px ; */
+}
+.ui-tabs-nav a {
+    margin: 1px 0 0; /* position: relative makes opacity fail for disabled tab in IE */
+    padding-left: 0;
+    color: #000;
+    font-weight: bold;
+    line-height: 1.2;
+    text-align: center;
+    text-decoration: none;
+    white-space: nowrap; /* required in IE 6 */    
+    outline: 0; /* prevent dotted border in Firefox */
+}
+.ui-tabs-nav .ui-tabs-selected a {
+    position: relative;
+    top: 1px;
+    z-index: 2;
+    margin-top: 0;
+    color: #000;
+}
+.ui-tabs-nav a span {
+    width: 64px; /* IE 6 treats width as min-width */
+    min-width: 64px;
+    height: 18px; /* IE 6 treats height as min-height */
+    min-height: 18px;
+    padding-top: 6px;
+    padding-right: 0;
+}
+*>.ui-tabs-nav a span { /* hide from IE 6 */
+    width: auto;
+    height: auto;
+}
+.ui-tabs-nav .ui-tabs-selected a span {
+    padding-bottom: 1px;
+}
+.ui-tabs-nav .ui-tabs-selected a, .ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active {
+    background-position: 100% -150px;
+}
+.ui-tabs-nav a, .ui-tabs-nav .ui-tabs-disabled a:hover, .ui-tabs-nav .ui-tabs-disabled a:focus, .ui-tabs-nav .ui-tabs-disabled a:active {
+    background-position: 100% -100px;
+}
+.ui-tabs-nav .ui-tabs-selected a span, .ui-tabs-nav a:hover span, .ui-tabs-nav a:focus span, .ui-tabs-nav a:active span {
+    background-position: 0 -50px;
+}
+.ui-tabs-nav a span, .ui-tabs-nav .ui-tabs-disabled a:hover span, .ui-tabs-nav .ui-tabs-disabled a:focus span, .ui-tabs-nav .ui-tabs-disabled a:active span {
+    background-position: 0 0;
+}
+.ui-tabs-nav .ui-tabs-selected a:link, .ui-tabs-nav .ui-tabs-selected a:visited, .ui-tabs-nav .ui-tabs-disabled a:link, .ui-tabs-nav .ui-tabs-disabled a:visited { /* @ Opera, use pseudo classes otherwise it confuses cursor... */
+    cursor: text;
+}
+.ui-tabs-nav a:hover, .ui-tabs-nav a:focus, .ui-tabs-nav a:active,
+.ui-tabs-nav .ui-tabs-deselectable a:hover, .ui-tabs-nav .ui-tabs-deselectable a:focus, .ui-tabs-nav .ui-tabs-deselectable a:active { /* @ Opera, we need to be explicit again here now... */
+    cursor: pointer;
+}
+.ui-tabs-disabled {
+    opacity: .4;
+    filter: alpha(opacity=40);
+}
+.ui-tabs-panel {
+    border: 1px solid #ccc;
+    padding: 1em 8px;
+    background: #fff; /* declare background color for container to avoid distorted fonts in IE while fading */
+}
+.ui-tabs-loading em {
+    padding: 0 0 0 20px;
+    background: url(../img/loading.gif) no-repeat 0 50%;
+}
+
+/* Additional IE specific bug fixes... */
+* html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
+    display: inline-block;
+}
+*:first-child+html .ui-tabs-nav  { /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
+    display: inline-block;
+}
+
+.hptab_container .ui-tabs-panel {height:210px;}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Basic-Options.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,80 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Basic Options in System Model Generator Command-line Options</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<h1 id="Basicoptions">Basic Options</h1>
+
+<table class="TableWrap" border="1" cellpadding="1" cellspacing="0"><tr valign="top"><th>Options</th><th>Descriptions</th></tr><tr valign="top"><td class="Cell">
+		  <p>
+			<code>-h</code> 
+		  </p></td><td class="Cell">
+		  <p>
+			Displays a list of the various command-line options that you can
+			use to create a system model diagram. 
+		  </p> 
+		</td></tr><tr valign="top"><td class="Cell">
+		  <p>
+			<code>-i <var>filename</var></code> 
+		  </p></td><td class="Cell">
+		  <p>
+			Specifies the INI file. In the INI file, command-line options are used
+			and each option appears in one line. The basic syntax is  <br/><code><var>argument</var> = <var>value</var></code><br/>
+			Command line     arguments will override INI file settings.
+
+
+		  </p> 
+		  <pre><code class="cpp">w&nbsp;=&nbsp;2<br>sysdef&nbsp;=&nbsp;D:\epoc32\data\system_definition.xml<br>color&nbsp;=&nbsp;&nbsp;&nbsp;colors.xml</code></pre></td></tr></table><div class="section">
+<h2> See also</h2><p>
+		<a href="Build-Control-options.html#BuildControl">Build Control Options</a> 
+	  </p><p>
+		<a href="Files-or-uri-options.html#fileorurioptions">Files or URIs Options</a> 
+	  </p><p>
+		<a href="Labels-options.html#labeloptions">Labels Options</a> 
+	  </p><p>
+		<a href="Model-Control-options-ref.html#modelcontrol">Model Control Options</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>.&nbsp;</div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Build-Control-options.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,157 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Build Control Options in System Model Generator Command-line Options</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="BuildControl"></a><h1>Build Control Options</h1><table class="TableWrap" border="1" cellpadding="1" cellspacing="0"><tr valign="top"><th>Options</th><th>Description</th></tr>
+
+<tr valign="top"><td class="Cell"><p><code>
+-csv_columns <var>outfile</var></code></p></td><td class="Cell"><p>Comma-separated list of columns to include in
+                       the output CSV.  This does nothing if <code>-csv_output</code> is not present. By default (if 
+					   <code>-csv_columns</code> is not present), the columns will be
+                       a sorted list of all attributes on all items.
+		</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -csv_labels <var>list</var></code></p></td><td class="Cell"><p>Comma-separated list of columns labels include
+                       in the output CSV.  Do not use quotes or commas
+                       in label names. This does nothing if <code>-csv_output</code>
+                       is not present. If this list is shorter than <code>-csv_columns</code>, the remaining columns will use the
+                       attribute name as the label.
+		</td></tr><tr valign="top"><td class="Cell"><p><code>
+ -xml_output <var>outfile</var></code></p></td><td class="Cell"><p>The name of the file to save a combined system
+                       definition XML. Only items shown in the built
+                       system model will be included.
+		</td></tr><tr valign="top"><td class="Cell"><p><code>
+ -w <var>number</var></code></p></td><td class="Cell"><p>Warning levels</p>.
+		  <ul> 
+			<li>
+ 
+			  <p>
+				<code>-w 1</code>: displays errors only (default) 
+			  </p> 
+			</li>
+ 
+			<li>
+ 
+			  <p>
+				<code>-w 2</code>: displays warnings as well as errors 
+			  </p> 
+			</li>
+ 
+			<li>
+ 
+			  <p>
+				<code>-w 3</code>: displays info messages, warnings and errors.
+				
+			  </p> 
+			</li>
+ 
+			<li>
+ 
+			  <p>
+				<code>-w 4</code>: displays info messages, warnings and errors
+				along with deep syntax validation and reporting. 
+			  </p> 
+			  <p>
+				<b>Note</b>: This option can take a long time in
+				computation so do not use this warning level by default. 
+			  </p> 
+			</li>
+ 
+		  </ul>
+
+		</td></tr><tr valign="top"><td class="Cell"><p><code>
+ -lowmem  </code></p></td><td class="Cell"><p>Build the model storing more data in the temp
+                       directory and using less runtime memory. If
+                       building fails due to an out of memory
+                       condition, try running again with the <code>-lowmem</code>
+                       option.
+		</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -clean          </code></p></td><td class="Cell"><p>      Caution: if set,  it will delete the contents of
+                       the temporary directory.
+		</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -compress      </code></p></td><td class="Cell"><p>       If set, it will attempt to compress the output
+                       as an SVGZ file. In order to succeed gzip must
+                       be installed and in the <code>PATH</code>. This will also
+                       rename the output file from filename.svg to
+                       filename.svgz.
+	</p>	</td></tr><tr valign="top"><td class="Cell" id="tempdir"><p><code>
+ -tempdir <var>dir</var>    </code></p></td><td class="Cell"><p>    Temporary directory for build files. Defaults
+                       to <code>drawsvg_temp</code>
+	</p>	</td></tr><tr valign="top"><td class="Cell"><p><code>
+ -output <var>outfile</var>  </code></p></td><td class="Cell"><p>   The name of the file to save the built System
+                       Model SVG. If in the format filename.svgz, it
+                       will attempt to compress the file. If
+                       compression is not supported, it will rename the
+                       output to filename.svg. Defaults to sysmodel.svg
+                       or sysmodel.svgz if <code>-compress</code> is set. Defaults
+                       to "sysmodel.svg"
+	</p>	</td></tr><tr valign="top"><td class="Cell"><p><code>
+ -csv_output <var>outfile</var> </code></p></td><td class="Cell"><p>The name of the file to save a CSV description
+                       of the built System Model. Only items shown on
+                       the system model will be included.
+	</p>	</td></tr><tr valign="top"><td class="Cell"><p><code>
+ -xslt-param  <var>param</var> <var>string-value</var>    </code></p></td><td class="Cell"><p>     Advanced: Parameters to feed directly to the
+                       XSLT transforms. Can specify multiple times.
+	</p>	</td></tr><tr valign="top"><td class="Cell"><p><code>
+ -dictionary <var>file/uri</var> </code></p></td><td class="Cell"><p>A term dictionary file used to semi-
+                       intelligently generate the abbreviations for the
+                       names of system model entries. Anything
+                       mentioned in the Localization files overrides
+                       generated abbreviations.
+	</p>	</td></tr><tr valign="top"><td class="Cell"><p><code>
+ -log <var>outfile</var>   </code></p></td><td class="Cell"><p>     File in which to store output. Defaults to
+                       stdout
+	</p>	</td></tr></table><div class="section">
+<h2> See also</h2><p>
+		<a href="Basic-Options.html#Basicoptions">Basic Options</a> 
+	  </p><p>
+		<a href="Files-or-uri-options.html#fileorurioptions">Files or URIs Options</a> 
+	  </p><p>
+		<a href="Labels-options.html#labeloptions">Labels Options</a> 
+	  </p><p>
+		<a href="Model-Control-options-ref.html#modelcontrol">Model Control Options</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>.&nbsp;</div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Files-or-uri-options.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,143 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Files or URIs Options in System Model Generator Command-line Options</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+
+
+
+<a name="fileorurioptions"></a><h1>File or URI Options</h1>
+
+All of these take a file name (relative or absolute path) or URI of a data source
+<table class="TableWrap" border="1" cellpadding="1" cellspacing="0"><thead><tr valign="top"><th>Options</th><th>Description</th></tr>
+</thead><tbody>
+<tr valign="top"><td class="Cell"><p><code>
+ -model <var>file/uri</var> </code></p></td><td class="Cell"><p>     The location of the <a href="../SMG-Input-Files/Model-XMLFile.html#ModelXMLFile">Model XML File</a> used to
+                       build the file. Content of this file will be
+                       overridden by anything set on the command line
+                       on in an ini file. Defaults to
+                       <code><var>sysmodelgen</code>/rsc/ModelTemplate.xml</code>
+	</p></td><tr valign="top"><td class="Cell"><p><code>
+ -shapes <var>file/uri</var>  </code></p></td><td class="Cell"><p>   The location of the <a href="../SMG-Input-Files/Model-XMLFile.html#ModelXMLFile">Shapes XML File</a> file used to
+                       provide rules to control  the display of the
+                       components on the model. If not present, default
+                       behaviour  (in Shapes.xml) is used. This and the
+                       default bahaviours are overrriden by  using the
+                       -color, -border, -pattern, and -style options.
+	</p></td></tr></tr><tr valign="top"><td class="Cell"><p><code>
+ -sysinfo <var>file/uri</var>   </code></p></td><td class="Cell"><p> The location of extra component information used
+                       to provided additional  properies for
+                       components. Can specify multiple
+                       times.  </p> 
+		  <p>
+			For more information, see <a href="../SMG-Input-Files/System-Info-XMLFile.html#SystemInfoXML">SystemInfo XML File</a>. 
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -localize <var>file/uri</var> </code></p></td><td class="Cell"><p>  The location of the <a href="../SMG-Input-Files/Localisation-XMLFile.html#Localisation">Localization XML File</a> used to
+                       provide displayable names for the model
+                       entities. Can specify multiple times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -deps <var>file/uri</var>  </code></p></td><td class="Cell"><p>    The location of the <a href="../SMG-Input-Files/Dependencies-XMLFile.html#DependenciesXMLFile">Dependencies XML File</a> used
+                       to draw the depmodel.  If not present,
+                       dependencies will not be drawn
+	</p></td></tr></tbody>
+	<tbody><tr valign="top"><td class="Cell"><p><code>
+ -pattern <var>file/uri</var> </code></p></td><td class="Cell"><p>   The location of a <a href="../SMG-Input-Files/Values-XML-index.html#valuesxml">Values XML File</a> used to
+                       specify <a href="../SMG-Input-Files/Patterns-XMLFile.html#patternsxml">overlay patterns</a>. If not
+                       present, the default patterns (for new  and
+                       reference components) are used. Can specify
+                       multiple times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -border-style <var>file/uri</var></code></p></td><td class="Cell"><p>  The location of a <a href="../SMG-Input-Files/Values-XML-index.html#valuesxml">Values XML File</a> used to
+                       specify <a href="../SMG-Input-Files/Border-Style-XMLFile.html#borderstylesxml">border  styles</a>. If not
+                       present, the default border styles are used. .
+                       Can specify multiple times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -color <var>file/uri</var>   </code></p></td><td class="Cell"><p>   The location of a <a href="../SMG-Input-Files/Values-XML-index.html#valuesxml">Values XML File</a> used to
+                       specify <a href="../SMG-Input-Files/Values-XML-index.html#valuesxml">colours</a>. If not present,
+                       the default colours are used. Can specify
+                       multiple times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -border-shape <var>file/uri</var> </code></p></td><td class="Cell"><p> The location of a <a href="../SMG-Input-Files/Values-XML-index.html#valuesxml">Values XML File</a> used to
+                       specify the <a href="../SMG-Input-Files/Border-Shapes-XMLFile.html#bordershapesxml">shape (border)</a>  of each component.
+                       If not present, the default borders are used.
+                       Can specify multiple times.
+	</p></td></tr></tbody>
+	<tbody class="deprecated"><tr valign="top"><td class="Cell"><p><code>
+ -s12 <var>file/uri</var>     </code></p></td><td class="Cell depr"><p>   The location of the Schedule 12 XML file used to
+                       provide the border shapres of the components. If
+                       this a directory, the S12 XML file is found by
+                       appending
+                       "Symbian_OS_v<var>system_version</var>_Schedule12.xml" to
+                       the directory. Can specify multiple times.
+                       <br/><strong>DEPRECATED</strong>: Only works on 2.0 syntax and older                  models
+	</p></td></tr><tr valign="top"><td class="Cell depr"><p><code>
+ -levels <var>file/uri</var>   </code></p></td><td class="Cell"><p>  The location of the Levels XML file used to
+                       override the  stacking of collections. . Can
+                       specify multiple times.
+					    <br/><strong>DEPRECATED</strong>: Only works on 2.0 syntax and older              models
+					    Use a sysinfo file                       instead
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -link           </code></p></td><td class="Cell"><p>       The base URL to use for all hyperlinks in the
+                       model. A base URL will be appended by the type
+                       and name (e.g. Blocks/Comms%20Services.html) of
+                       the items to create the full URL of the linked
+                       file. Window directories will be converted into
+                       file URIs.
+					    <br/><strong>DEPRECATED</strong>: Use <code> -link-expr</code> instead.
+	</p></td></tr>
+
+	</tbody>
+</table><div class="section">
+<h2> See also</h2><p>
+		<a href="Basic-Options.html#Basicoptions">Basic Options</a> 
+	  </p><p>
+		<a href="Build-Control-options.html#BuildControl">Build Control Options</a> 
+	  </p><p>
+		<a href="Labels-options.html#labeloptions">Labels Options</a> 
+	  </p><p>
+		<a href="Model-Control-options-ref.html#modelcontrol">Model Control Options</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>.&nbsp;</div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Labels-options.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,114 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Labels Options in System Model Generator Command-line Options</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="labeloptions"></a><h1>Labels Options</h1>
+<p>All of these take a plain text value which is displayed on the model</p>
+
+<table class="TableWrap" border="1" cellpadding="1" cellspacing="0"><tr valign="top"><th>Options</th><th>Description</th></tr>
+<tr valign="top"><td class="Cell"><p><code>
+ -system_name     </code></p></td><td class="Cell"><p>       The name of the product described in the model.
+                       It appears at  the bottom right on the system model diagram. The default value is
+			<code>Symbian OS</code>. 
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -system_version    </code></p></td><td class="Cell"><p>     The version of the product described in the
+                       model. It appears  at the bottom right after the
+                       name. </p> 
+		  <p>
+			<b>Note</b>: You can set this option to an empty string, if
+			you do not want system version to appear on the system model diagram. 
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -model_name      </code></p></td><td class="Cell"><p>       The label for the model. It appears at the
+                       bottom right,  under the name. The default value is <code>System Model</code>. 
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -model_version    </code></p></td><td class="Cell"><p>      A number which appears before the model-revision-type. 
+					  If specified this overrides the
+                       build number used in any attached Dependencies XML files.  Otherwise, this defaults to <code>1</code>
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -model_version_type </code></p></td><td class="Cell"><p>    One of <code>draft</code>, <code>issued</code>, <code>build</code> or free-text
+                       value. Appears below the model label. If
+                       specified this overrides the build number used
+                       in any attached Dependencies XML files. Otherwise, this
+                       defaults to <code>draft</code>.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -legend_title    </code></p></td><td class="Cell"><p>       The title to appear in the leftmost part of the
+                       legend. The default value is <code>Key</code>. 
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -distribution      </code></p></td><td class="Cell"><p>     Text to appear on the bottom centre to indicate
+                       to whom the  model can be show. Informational
+                       only. Suggested values are <code>internal</code>, <code>secret</code>
+                       or <code>unrestrictred</code>. Not shown if not set. </p><p>
+			The location of the text can be overridden using the model XML. 
+		  </p>
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -note       </code></p></td><td class="Cell"><p>            Free text to appear inside the legend box, on
+                       the rightmost side. If multiple ones are
+                       provided, they will appear as separate boxes
+                       from left to right. Newlines and other special
+                       characters can be entity-encoded (e.g. <code class="xml">&#xa;</code>).
+                       When using entities in an INI file, you *must*
+                       quote the value, otherwise the <code>#</code> will be treated
+                       as a comment delimiter. Can specify multiple
+                       times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -copyright      </code></p></td><td class="Cell"><p>        The copyright to appear in the lower left. Set
+                       to empty string to leave out. Defaults to "<code><var>year</var> Nokia Corporation</code>".<br/>
+					   You can set this option
+			to an empty string if you don not want copyright text to appear on the system
+			model diagram. 
+	</p></td></tr>
+	</table><div class="section">
+<h2> See also</h2><p>
+		<a href="Basic-Options.html#Basicoptions">Basic Options</a> 
+	  </p><p>
+		<a href="Build-Control-options.html#BuildControl">Build Control Options</a> 
+	  </p><p>
+		<a href="Files-or-uri-options.html#fileorurioptions">Files or URIs Options</a> 
+	  </p><p>
+		<a href="Model-Control-options-ref.html#modelcontrol">Model Control Options</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>.&nbsp;</div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/Model-Control-options-ref.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,235 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Model Control Options in System Model Generator Command-line Options</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="modelcontrol"></a><h1>Model Control Options</h1><table class="TableWrap" border="1" cellpadding="1" cellspacing="0"><tr valign="top"><th>Options</th><th>Description</th></tr>
+<tbody><tr valign="top"><td class="Cell"><p><code>
+ -sysdef <var>file/uri</var>   </code></p></td><td class="Cell"><p>   Location for the System
+                       Definition XML file(s) used to build the model.
+					   Multiple files will be merged according to the normal rules. Can
+                       specify multiple times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -srcvar             </code></p></td><td class="Cell"><p> 
+ The root directory (in the local filesystem) for the system definition. The order of this parameter must match the order
+                       of the <code>-sysdef</code> parameter. Can specify multiple
+                       times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -sysdef-prefix    </code></p></td><td class="Cell"><p>      Can specify multiple times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -sysdef-path <var>path</var>  </code></p></td><td class="Cell"><p>   The directory which the system definition file
+                       should be considered to be in when turning
+                       unit's relative links into absolute paths. This
+                       is only necessary to provide if the result
+                       requires the absolute paths to be meaningful.
+                       The order of this parameter must match the order
+                       of the <code>-sysdef</code> parameter. Can specify multiple
+                       times.
+	</p></td></tr>
+	</tbody><tbody><tr valign="top"><td class="Cell"><p><code>
+ -detail <var>item-type</var>   </code></p></td><td class="Cell"><p>  The type of the smallest System Model entity to
+                       draw. One of <code>layer</code>, <code>package</code>, <code>collection</code> or
+                       <code>component</code>.  Defaults to <code>component</code>
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -detail-type fixed</code></p></td><td class="Cell"><p>    If set to <code>fixed</code>, the smallest System Model
+                       entity drawn will have a fixed with (rather then
+                       sized by their invisible components). This can
+                       be used to reduce the size and complexity of the
+                       overall model. 
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -filter-has <var>filter-name</var> </code></p></td><td class="Cell"><p>  Like <code>-filter</code>, except any filter on an item must
+                       be present in this list in order for that item
+                       to appear. Include <code>*</code> in the list in order to
+                       show items with no filters. <br/>Equivalent to <code>-show-attr filter <var>xxx</var></code>
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ <code>-show-attr</code> <var>attr<var>=<var>val</var> </code></p></td><td class="Cell"><p>  A mechanism of filtering which allows filtering
+                       based on component attribute values. If a value
+                       is set for that attribute, the component will be
+                       shown. Use in conjunction with <code>-hide-attr</code> for
+                       fine contol of what is shown. <code>class</code> and
+                       <code>filter</code> attribtues are handled specially -- see
+                       the documentation for details
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -hide-attr <var>attr<var>=val </code></p></td><td class="Cell"><p>  A mechanism of filtering which allows filtering
+                       based on component attribute values. If a value
+                       is set for that attribute, the component will
+                       not be shown on the model. Use in conjunction
+                       with <code>-show-attr</code> for fine contol of what is
+                       shown. <code>class</code> and <code>filter</code> attribtues are
+                       handled specially -- see the documentation for
+                       details
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -ignore <var>item</var>     </code></p></td><td class="Cell"><p>     The ID of a model entity to not draw. Any number
+                       of these can be used. Can specify multiple
+                       times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -ignore-meta <var>rel</var>  </code></p></td><td class="Cell"><p>   The <code>rel</code> meta value to ignore. Takes the form
+                       of "<code><var>relvalue</var></code>" or "<code><var>relvalue</var>:<var>type</var></code>". Can specify multiple
+                       times.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -version-list</code></p></td><td class="Cell"><p>    
+			Specifies the space-separated list of version numbers, ordered from
+			oldest to newest. This is used to compare version numbers in the VERSION rule
+			function. If not present, the value used are the Symbian Ltd version numbers from <code>ER5</code> through <code>9.5</code> and
+	Symbian Foundation version numbers from <code>^1</code> onward. <code>Future</code> is always last.
+	</p></td></tr>
+</tbody>
+<tbody>	
+	<tr valign="top"><td class="Cell"><p><code>
+ -placeholder <var>item-type</var></code></p></td><td class="Cell"><p>   The type of the smallest <strong>empty</strong> System Model
+                       entity to draw. One of <code>layer</code>, <code>package</code>,
+                       <code>collection</code> or <code>component</code>.  For example, if
+                       set to <code>package</code> empty layers and packages will
+                       be drawn, but empty collections will be ignored.
+                       If not set, no empty items will be drawn.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -level-detail  <span class="aux">[</span>show<span class="aux">/</span>hide</var><span class="aux">]</span> </code></p></td><td class="Cell"><p>  Toggles display of level names on packages or
+                       layers. A value of <code>show</code> will display level
+                       names inside either layers (at <code>layer</code> level of
+                       detail only) or packages (at <code>package</code> level of
+                       detail only). A value of <code>hide</code> (default) will
+                       not show any level names.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+-legend-width <var>%</var>    </code></p></td><td class="Cell"><p>   The percent width of the model the legend takes
+                       up. This will scale the size of the legend and
+                       model title, but not the logo, to fill the
+                       specified space. If a logo is included, but no
+                       width specified, the legend cannot be scaled
+                       since it will not be able to determine the
+                       available space. <br/>Note that that <code>-max-legend-scale</code> will further limit the potential width.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -legend-max-scale <var>scale</var></code></p></td><td class="Cell"><p>   Specifies the maximum scale factor for resizing
+                       the legend. If this is present and <code>-legend-width</code>
+                       is not, the legend and title will scale to 100%
+                       of the available width. If both are present the
+                       scale factor will take precedent. If neither is
+                       present, the legend will not resize. 
+		  </p> 
+		  <p>Note that
+                       when this is used, the legend can shrink if it
+                       would normally be wider than the model.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -title-scale <var>scale</var> </code></p></td><td class="Cell"><p>   Specifies the scale factor for the size of the
+                       title font (the text in the lower right). </p><p>Use
+                       this instead of CSS to control the size, since
+                       the model generator needs to explicitly know how
+                       much space to allocate for the title.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -logo <var>file/uri</var>  </code></p></td><td class="Cell"><p>      If present, the logo will be drawn in the lower-
+                       left corner of the model. If the logo is an SVG
+                       file, <code>-logo-width</code> and <code>-logo-height</code> are optional,
+                       otherwise the must both be specified
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -logo-height <var>length</var> </code></p></td><td class="Cell"><p>  Specifies the height of the logo (if any) in mm.
+                       Width is scaled along with height unless
+                       otherwise specified. Both width and height MUST
+                       be specified if a bitmap image is used
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -logo-width <var>length</var>  </code></p></td><td class="Cell"><p>  Specifies the width of the logo (if any) in mm.
+                       Height is scaled along with width unless
+                       otherwise specified. Both width and height MUST
+                       be specified if a bitmap image is used
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -legend_float <var>boolean</var> </code></p></td><td class="Cell"><p>   If set, the legend will appear when the mouse
+                       hovers over the bottom of the window. The
+                       floating legend will span the full width of the
+                       window. This may not be readable, depending on
+                       the amonent of content in the legend.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -static <var>boolean</var> </code></p></td><td class="Cell"><p>      If present, the model will not have any
+                       mouseover effects (this is  overriden when drawing dependencies).
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -navctrl <var>boolean</var>  </code></p></td><td class="Cell"><p>    If set, a navigation control widget will appear
+                       in the upper left corner of the model. The
+                       control might not work on some SVG viewers.
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -dpi <var>number</var>   </code></p></td><td class="Cell"><p>        The DPI to use when printing from the Adobe SVG
+                       Viewer. If not present, it will print well at A4             size. A value of <code>300</code> will look good on A3 size                      paper
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -model_font <var>font</var> </code></p></td><td class="Cell"><p>     The name of the base font to use to draw the
+                       model. This will be overriden by any custom CSS
+                       in the Shapes XML
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -link-expr     <var>expression</var>  </code></p></td><td class="Cell"><p>       The link used on any system model item. Any
+                       values within <code>{<span class="aux">...</span>}</code> are evaluled as an
+                       expression on the item. All xpath locations in
+                       the expresion must be set otherwise the link
+                       will not be created for the item. Can specify
+                       multiple times.
+	</p></td></tr></tbody>
+	<tbody class="deprecated"><tr valign="top"><td class="Cell"><p><code>
+ -filter <var>filter-name</var> </code></p></td><td class="Cell"><p>  The name of a filter to turn on when building
+                       the model.  All filters on an item must be
+                       present in this list in order for that item to
+                       appear. Can have any number of these Defaults to
+                       <code>java</code> and <code>gt</code>. Can specify multiple times..
+                       <br/><strong>DEPRECATED</strong>: Only works on 2.0 syntax and older
+                       models
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -coreos <span class="aux">[</span>on<span class="aux">/</span>off<span class="aux">/</span>new</var><span class="aux">]</span> 
+   </code></p></td><td class="Cell"><p>  Turn on or off Core OS colouring for 9.4 and
+                       later models -- For backwards compatibility
+                       only! Use <code>on</code> for Symbian OS 9.4 models and
+                       <code>new</code> for Symbian OS 9.5 and later models (non-
+                       Foundation)
+	</p></td></tr><tr valign="top"><td class="Cell"><p><code>
+ -page-width <var>length</var> </code></p></td><td class="Cell"><p>   The width of the drawn image (with units). If
+                       not specified it will fit the viewer window.
+                       Valid units: <code>in</code>, <code>mm</code>, <code>cm</code>, <code>px</code>, <code>pt</code>.
+                       <br/><strong>DEPRECATED</strong>: Only works on 2.0 syntax and older  models
+	</p></td></tr>
+	
+	</tbody></table><div class="section">
+<h2> See also</h2><p>
+		<a href="Basic-Options.html#Basicoptions">Basic Options</a> 
+	  </p><p>
+		<a href="Build-Control-options.html#BuildControl">Build Control Options</a> 
+	  </p><p>
+		<a href="Files-or-uri-options.html#fileorurioptions">Files or URIs Options</a> 
+	  </p><p>
+		<a href="Labels-options.html#labeloptions">Labels Options</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>.&nbsp;</div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/index.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,97 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>System Model Generator Command-line Options in Reference</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <a name=""></a>
+<h1 id="smm%2eref%2ecommandlineoptions%2dindex">System Model Generator Command-line Options</h1><p>
+	This section lists the various command-line options that you can use to
+	create a system model diagram. 
+  </p><p>
+	The following is the syntax to use a command-line option: 
+  </p>
+<p class="CommandLine">
+<code>
+SysModGen <span class="aux">[&#133;</span>  <var>Arguments</var> <span class="aux">&#133;] [</span><var>Transform</var> <var>Data-file</var> <span style="color:blue; font: sans">] &#133;</span>
+</code>
+</p>
+
+<p>The basic <var>Arguments</var> appear first, followed by an optional list of post-procesing transformations.
+The post-procesing transformations are pairs of files (described below), which operate on the generated SVG, in order, from left to right.
+</p>
+<ul>
+<li>
+<p><code><var>Transform</var></code> is an XSLT transform which operates on the generated SVG and takes 
+<code><var>Data-file</var></code> as the Data XSLT parameter.
+</p><p>There are four 
+built-in transforms, plus a framework to simplify creating new transforms.
+<ol>
+<li>css2xml.xsl will convert all <code class="xml">&lt;style&gt;</code> sections into <code>style</code> attributes. This makes the model show up better on viewers that don't support classes. It takes no data files.</li>
+<li>dependencies.xsl will take a dependencies file and add mouse-over dependency lines to the diagram. This is called automatically when using the <code>-deps</code> option.</li>
+<li>showdeps.xsl will further process a diragram with dependencies to make them always on, rather than only on when an item is moused-over.  It takes no data files.</li>
+<li>tovisio.xsl  will convert the system model SVG in Visio VDX format. Not all features are supported.  It takes no data files.</li>
+</ol>
+
+The postprocess.xsl XSLT simplifies adding mouse-over effects to a system model SVG .
+</p>
+</li>
+
+<li><code><var>Data-file</var></code> is an XML file, or one of two special values. The empty string ("") means there is no data file to supply to the XSLT transfom and <code>-</code> means that the full model input data should be used as the data file.
+Any other value is assumed to be a file or URL</li></ul>
+
+  <p>
+	<b>Note</b>: Command line options override values in the INI file and a Model XML file.
+  </p><ul class="indexlinks">
+<li>
+<a href="Basic-Options.html#Basicoptions">Basic Options</a></li>
+<li>
+<a href="Build-Control-options.html#BuildControl">Build Control Options</a></li>
+<li>
+<a href="Files-or-uri-options.html#fileorurioptions">Files or URIs Options</a></li>
+<li>
+<a href="Labels-options.html#labeloptions">Labels Options</a></li>
+<li>
+<a href="Model-Control-options-ref.html#modelcontrol">Model Control Options</a></li>
+</ul>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>.&nbsp;</div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/Command-lineOptions/troubleshooting.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,156 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Troubleshooting in Reference</title>    
+	<link href="..../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="smm%2etroubleshooting"></a><h1>Troubleshooting</h1><p>
+	  This page contains possible solutions to the common problems that you may
+	  encounter while using System Model Manager (SMM). 
+	</p><table class="TableWrap" border="1" cellpadding="1" cellspacing="0"><tr valign="top"><td class="Cell">
+		  <p>
+			<b>Common Problems</b> 
+		  </p></td><td class="Cell">
+		  <p>
+			<b>Possible Solutions</b> 
+		  </p></td></tr><tr valign="top"><td class="Cell">
+		  <p>
+			The SVG viewer displays a square instead of a unicode character. 
+		  </p></td><td class="Cell">
+		  <p>
+			This indicates that the font used does not contain the unicode
+			character, and you must use another font that contains the unicode character. 
+		  </p> 
+		  <p>
+			To change the font, edit the shapes XML file that you have added to
+			the project and add font information to it. For example, the following
+			information in the shapes XML file specifies 'Arial Unicode MS' as font for the
+			text in the system model diagram: 
+		  </p> 
+		  <div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;<br>&lt;shapes xmlns:s="http://www.w3.org/2000/svg"&gt;
+<div class="indent">&lt;s:defs&gt;<div class="indent"> &lt;s:style type="text/css"&gt;
+<div class="indent">  text {font-family: "<strong>Arial Unicode MS</strong>"!important}</div> &lt;/s:style&gt;</div>&lt;/s:defs&gt;<br/>&#133;</div>&lt;/shapes&gt;</code></div> 
+		  <p>
+			<b>Note:</b> If you are using the default shapes, create a
+			copy of the <code class="filename">shapes.xml</code> or <code class="filename">fshapes.xml</code> file available under the
+			<code class="filename"><var>SystemModelGenerator</var>\rsc</code>
+			directory and then edit the file. 
+		  </p></td></tr><tr valign="top"><td class="Cell">
+		  <p>
+			When zoomed in and mousing-over a component to see the
+			dependencies, far ends of the arrow are not visible. 
+		  </p> 
+		  <p>
+			If you zoom out to see the whole line, there is not enough detail
+			to read the text. 
+		  </p></td><td class="Cell">
+		  <p>
+			In order to get the arrows to stay visible, perform the following
+			steps: 
+		  </p> 
+
+		  <ol> 
+			<li>
+ 
+			  <p>
+				Mouse-over the component to view the dependencies. 
+			  </p> 
+			</li>
+ 
+			<li>
+ 
+			  <p>
+				Keep the mouse over the component, select the component text (
+				left-click and drag the pointer over the text) and drag the pointer out of the
+				component (with the left mouse button still down). 
+			  </p> 
+			</li>
+ 
+			<li>
+ 
+			  <p>
+				Release the mouse button and the dependencies arrows remain
+				visible until you next mouse-over and leave the component. 
+			  </p> 
+			</li>
+ 
+		  </ol>
+
+		</td></tr><tr valign="top"><td class="Cell">
+		  <p>
+			System Model Manager displayes warnings about a collection with no
+			level when building a system model. 
+		  </p></td><td class="Cell">
+		  <p>
+			This implies that you may have accidently left out a level. A
+			collection with no level is acceptable if its parent block and layer have no
+			levels defined. If there are defined levels, System Model Generator
+			automatically creates a new unnamed level on top to put all collections with no
+			levels. 
+		  </p></td></tr></table><div class="section">
+<h2> See also</h2><ul> 
+		<li>
+ 
+		  <p>
+			<a href="smmperspective-ref.html#smm%2eperspective%2eref" title="The System Model Manager perspective enables you to create and manage a system model project.">System Model Manager Perspective</a> 
+		  </p> 
+		</li>
+ 
+		<li>
+ 
+		  <p>
+			<a href="projectproperties.ref.html#smm%2eproject%2eproperties%2eref" title="The Properties dialog box enables you to view and change the properties of a system model project.">System Model Manager Project Properties</a> 
+		  </p> 
+		</li>
+ 
+		<li>
+ 
+		  <p>
+			<a href="smm_preferences_ref.html#smm%2epreferences%2eref" title="The System Model Manager preferences enable you to specify the default settings for all the new system model projects.">System Model Manager Preferences</a> 
+		  </p> 
+		</li>
+ 
+	  </ul></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Border-Shapes-XMLFile.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,103 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Border Shapes Values XML File in Values XML Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="bordershapesxml"></a><h1>Border Shapes Values XML File</h1><div class="section">
+<h2>Purpose</h2><p>
+		The border shapes values XML file is used to define the shapes of
+		components. The valid values for a border shape can be <code>box</code>,
+		<code>round</code>, <code>hexagon</code>, <code>box-clipRT</code>,
+		<code>box-clipRB</code>, <code>box-clipLT</code>, <code>box-clipLB</code>, and
+		<code>box-clipAll</code>, or a reference (<code>#<var>xxxx</var></code>) to a symbol specified in a
+		Shapes XML file. 
+	  </p><p>
+		The following figure shows the various predefined shapes: 
+	  </p><div class="Figure">
+		<p class="Image"><a name=""><img src="bordershapes.gif" alt=""  border="0"/></a></p><br clear="all"/>
+ 
+	  </div><p>
+		For information about how to define new values for border shapes, see
+		<a href="../CustomSysmodel/index.html#cust%2eindex" title="This document describes how to customise a System Model diagram using a Shapes XML file to specify the styling of components and generated legend items.">Customizing the System Model Presentation</a>. 
+	  </p><p>
+	  </p></div>
+<div class="section">
+<h2>Syntax</h2>
+<p>The Border Shapes files use the common syntax for all <a href="Values-XML-index.html">Values XML files</a>. 
+However, border shapes can only apply to components, so it is an error to set <code>rank</code> to anything other than <code>*</code> or <code>component</code>.</p>
+
+</div>
+<div class="section">
+<h2>Example</h2>
+<div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;<br>&lt;values default="box" label="Sched 12 Category"&gt;
+<div class="indent">    &lt;item label="Optional Symbian" value="box-clipLT"&gt;
+<div class="indent">         &lt;m ref="cryptolib"/&gt;</div>    &lt;/item&gt;
+<br>    &lt;item label="Common Symbian" value="box-clipLB"&gt;
+<div class="indent">         &lt;m ref="sdcarddrv"/&gt;
+<br>         &lt;m ref="cldchi1_1"/&gt;</div>    &lt;/item&gt;
+<br>    &lt;item label="Common Replace&amp;#xad;able" value="#symbol-for-CR"&gt;
+<div class="indent"> &lt;m ref="ethernetdrv"/&gt;</div>
+    &lt;/item&gt;<br>    &lt;item label="Optional Replace&amp;#xad;able" value="box-clipRT"&gt;
+	<div class="indent">&lt;m ref="omap1623"/&gt;
+	<br/>         &lt;m ref="bootstrap"/&gt;
+	<br>         &lt;m ref="wma1_1"/&gt;
+</div>    &lt;/item&gt;</div> 
+&lt;/values&gt;</code></div><p>
+		The following figure shows the generated legend for the preceding
+		border shapes values XML: 
+	  </p><div class="Figure">
+		<p class="Image"><a name=""><img src="bordershapesoutput.gif" alt=""  border="0"/></a></p><br clear="all"/>
+ 
+	  </div></div>
+<div class="section">
+<h2>See also</h2><p>
+		<a href="Colours-XMLFile.html#coloursxml">Colors Values XML File</a> 
+	  </p><p>
+		<a href="Patterns-XMLFile.html#patternsxml">Patterns Values XML File</a> 
+	  </p><p>
+		<a href="Border-Style-XMLFile.html#borderstylesxml">Border Styles Values XML File</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Border-Style-XMLFile.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,91 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Border Styles Values XML File in Values XML Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="borderstylesxml"></a><h1>Border Styles Values XML File</h1><div class="section">
+<h2>Purpose</h2><p>
+		The border styles values XML file is used to define the border styles
+		of system model items. The valid values for a border style can be any CSS property of
+		an SVG shape. 
+	  </p><p>
+		<b>Note</b>: For more information, see
+		<a href="http://www.w3.org/TR/SVG11/">Scalable Vector Graphics (SVG) 1.1
+		Specification</a>. 
+	  </p><p>
+		The CSS applies to the shape of the item and it can control the
+		stroke width, and dash pattern as well as the overall opacity. It cannot set
+		the stroke or text colors. 
+	  </p></div>
+<div class="section">
+<h2>Syntax</h2>
+<p>The Border Styles files use the common syntax for all <a href="Values-XML-index.html">Values XML files</a>. </p>
+<p>The <code>value</code> attribute can take any value valid for the <a href="http://www.w3.org/TR/SVG11/styling.html#StyleAttribute">SVG <code>style</code> attribute</a>
+</div>
+
+<div class="section">
+<h2>Example</h2>
+
+<div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;<br>&lt;values default="stroke-width: 0.4"&gt;
+<div class="indent">    &lt;item label="Plugin" value="stroke-width: 2"&gt;
+<div class="indent">        &lt;m ref="sdcarddrv"/&gt;
+<br>        &lt;m ref="audiodrv"/&gt;<br>    </div>    &lt;/item&gt;</div>&lt;/values&gt;</code></div>
+<p>
+		The following figure shows the generated legend for the preceding
+		border styles values XML: 
+	  </p><div class="Figure">
+		<p class="Image"><a name=""><img src="borderstyleoutput.gif" alt=""  border="0"/></a></p><br clear="all"/>
+ 
+	  </div></div>
+<div class="section">
+<h2>See also</h2><p>
+		<a href="Colours-XMLFile.html#coloursxml">Colors Values XML File</a> 
+	  </p><p>
+		<a href="Patterns-XMLFile.html#patternsxml">Patterns Values XML File</a> 
+	  </p><p>
+		<a href="Border-Shapes-XMLFile.html#bordershapesxml">Border Shapes Values XML File</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
Binary file sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Colorxmloutput.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Colours-XMLFile.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,98 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Colors Values XML File in Values XML Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="coloursxml"></a><h1>Colors Values XML File</h1><div class="section">
+<h2>Purpose</h2><p>
+		The colors values XML file is used to define the colors of components.
+		The valid value that can be specified for a color can be any CSS colors type.
+		For example, it can be <code>#cc00aa</code>, <code>rgb(255,18,200)</code>, or
+		<code>blue</code>. 
+	  </p><p>
+		For information about how to define new values colors, see
+		<a href="../CustomSysmodel/index.html#cust%2eindex" title="This document describes how to customise a System Model diagram using a Shapes XML file to specify the styling of components and generated legend items.">Customizing the System Model Presentation</a>. 
+	  </p><p>
+		<b>Note</b>: For more information, see
+		<a href="http://www.w3.org/TR/CSS2/">CSS2 Specification</a>. 
+	  </p></div>
+<div class="section">
+<h2>Syntax</h2>
+<p>The Colors files use the common syntax for all <a href="Values-XML-index.html">Values XML files</a>. </p>
+<p>If a system model item has more than one color applied, the colour will appear as bands across the system model item.
+</p>
+
+</div>
+<div class="section">
+<h2>Example</h2>
+<div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;
+<br>&lt;values default="grey" label="Technology Streams"&gt;
+<div class="indent">&lt;item label="Base Services" value="#8f8fbd"&gt;
+<div class="indent">   &lt;m ref="apputils"/&gt;
+<br>        &lt;m ref="cafdrm"/&gt;
+</div>    &lt;/item&gt;
+<br>    &lt;item label="Persistent Data Services" value="#993366"&gt;
+<div class="indent">   &lt;m ref="sql"/&gt;
+<br>        &lt;m ref="store"/&gt;
+<br>        &lt;m ref="dbms"/&gt;
+</div>    &lt;/item&gt;
+</div>&lt;/values&gt;</code></div>
+<p>
+		The following figure shows the generated legend for the preceding
+		colors values XML: 
+	  </p><div class="Figure">
+		<p class="Image"><img src="Colorxmloutput.gif" alt=""/></p><br clear="all"/>
+ 
+	  </div></div>
+<div class="section">
+<h2>See also</h2><p>
+		<a href="Patterns-XMLFile.html#patternsxml">Patterns Values XML File</a> 
+	  </p><p>
+		<a href="Border-Shapes-XMLFile.html#bordershapesxml">Border Shapes Values XML File</a> 
+	  </p><p>
+		<a href="Border-Style-XMLFile.html#borderstylesxml">Border Styles Values XML File</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Dependencies-XMLFile.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,72 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Legacy Dependencies XML File in System Model Generator Input Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="DependenciesXMLFile"></a><h1>Legacy Dependencies XML File</h1><div class="section">
+
+<p><big style="font-weight: bold; font-size: 250%; color: red">Deprecated!</big></p>
+
+<h2>Purpose</h2><p>
+		You can use the dependencies XML file to specify the dependencies
+		between components of a system model. This legacy syntax will only work with 2.0 and earlier System Definition files. Use the
+		<a href="Dependencies-sysinfo.html">Sysinfo dependencies</a> syntax for 3.0 and later sysdefs.
+	  </p></div>
+<div class="section">
+<h2>Syntax</h2><pre><code class="cpp">&lt;?xml version="1.0"?&gt;  <br>&lt;SystemModelDeps&gt;<br>    &lt;Executables&gt;<br>        &lt;Executable name="<var>Executable-name</var>" component="<var>component</var>"&gt;<br>                &lt;dep name="<var>dep-name</var>"&gt;&lt;/dep&gt;<br>                      &lt;dep name="<var>dep-name</var>"&gt;&lt;/dep&gt;      <br>          ....<br>        &lt;/Executable&gt;<br>    &lt;/Executables&gt;<br>&lt;/SystemModelDeps&gt;</code></pre></div>
+<div class="section">
+<h2>Example</h2><pre><code class="cpp">&lt;?xml version="1.0" encoding="UTF-8"?&gt; <br>&lt;SystemModelDeps&gt;<br><br>    &lt;Executables&gt;<br>        &lt;Executable name="bluetooth.dll" component="Bluetooth Client Library"&gt;<br>            &lt;dep name="btdevice.dll"/&gt; <br>            &lt;dep name="charconv.dll"/&gt; <br>            &lt;dep name="drtaeabi.dll"/&gt; <br>            &lt;dep name="drtrvct2_2.dll"/&gt; <br>            &lt;dep name="eirclient.dll"/&gt; <br>            &lt;dep name="esock.dll"/&gt; <br>            &lt;dep name="euser_v5.dll"/&gt; <br>            &lt;dep name="hciserverclient.dll"/&gt; <br>        &lt;/Executable&gt; <br>        &lt;Executable name="charconv.dll" component="Character Encoding and Conversion Framework"&gt;<br>            &lt;dep name="drtaeabi.dll"/&gt; <br>            &lt;dep name="drtrvct2_2.dll"/&gt; <br>            &lt;dep name="ecom.dll&qu
+ot;/&gt; <br>            &lt;dep name="efsrv.dll"/&gt; <br>            &lt;dep name="euser_v5.dll"/&gt; <br>        &lt;/Executable&gt; <br>        &lt;Executable name="hciserverclient.dll" component="Bluetooth HCI Framework 2"&gt;<br>            &lt;dep name="drtaeabi.dll"/&gt; <br>            &lt;dep name="esock.dll"/&gt; <br>            &lt;dep name="euser_v5.dll"/&gt; <br>        &lt;/Executable&gt; <br>        &lt;Executable name="sdpdatabase.dll" component="Bluetooth SDP"&gt;<br>            &lt;dep name="bluetooth.dll"/&gt; <br>            &lt;dep name="charconv.dll"/&gt; <br>            &lt;dep name="drtaeabi.dll"/&gt; <br>            &lt;dep name="drtrvct2_2.dll"/&gt; <br>            &lt;dep name="esock.dll"/&gt; <br>            &lt;dep name="euser_v5.dll"/&gt; <br>        &lt;/Executable&gt; <br>        &lt;
+Executable name="sdpserver.exe" component="Bluetooth SDP"&gt;<br>            &lt;dep name="bluetooth.dll"/&gt; <br>            &lt;dep name="drtaeabi.dll"/&gt; <br>            &lt;dep name="drtrvct2_2.dll"/&gt; <br>            &lt;dep name="eirclient.dll"/&gt; <br>            &lt;dep name="esock.dll"/&gt; <br>            &lt;dep name="euser_v5.dll"/&gt; <br>            &lt;dep name="sdpdatabase.dll"/&gt; <br>        &lt;/Executable&gt; <br>        ... <br>    &lt;/Executables&gt; <br>&lt;/SystemModelDeps&gt; </code></pre></div>
+<div class="section">
+<h2> See also</h2><p>
+		<a href="Localisation-XMLFile.html#Localisation">Localization XML File</a> 
+	  </p><p>
+		<a href="System-Info-XMLFile.html#SystemInfoXML">SystemInfo XML File</a> 
+	  </p><p>
+		<a href="Values-XML-index.html#valuesxml" title="The Values XML files are used to define default and per-component display properties. You can use a values XML file to define colors, patterns, border shapes, or border styles of the components.">Values XML File</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Dependencies-sysinfo.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,125 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Dependencies System Info File in System Model Generator Input Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="DependenciesXMLFile"></a><h1>Dependencies System Info File</h1><div class="section">
+<h2>Purpose</h2><p>
+		Dependencies of various types can be provided via a <a href="System-Info-XMLFile.html">system info file</a>. 
+		This will allow the System Model to show mouse-over dependencies
+		between components of a system model. Dependencies should only go between items of the same rank.
+	  </p>
+	  
+	  <p>
+	  Dependencies are encoded in the <a href="System-Info-XMLFile.html">System Info XML format</a> using the <code>data-type="Dependencies"</code> <small>(note the captial "D")</small>.
+	  These files will usually be generated rather than hand-crafted. The syntax is provided here for tools developers and for those doing small, manual dependency models.
+	  </p>
+	  </div>
+
+
+<div class="<var>section</var>">
+<h2>Syntax</h2><div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;  
+<br>&lt;info data-type="Dependencies" <span class="opt">id-namespace="<var>uri</var>"</span> <span class="opt"><var>&#133;namespaces&#133;</var></span> &gt;
+<div class="indent">&lt;item ref="<var>id</var>"&gt;
+<div class="indent">&lt;dep ref="<var>id</var>" <span class="opt">type="<var>type</var>"</span>/&gt;
+</br>&lt;dep ref="<var>id</var>" <span class="opt">type="<var>type</var>"</span>/&gt;
+<br/>&#133; </div>
+&lt;/item&gt;
+<br>&#133;
+</div>&lt;/item&gt;</code></div>
+
+<p>Each <code>item</code> contains any number of <code>dep</code> elements. These indicate the system model item referenced in  <code>&lt;item&gt;</code>
+is dependent on the system model item mentioned in  <code>&lt;dep&gt;</code>.
+</p>
+<ul>
+<li><code>type="<var>type</var>"</code> : The type of dependendency between the two system model items. Defaults to <code>bin</code>. Standard values are:
+<ul>
+<li><code class="default">bin</code> &mdash; Static dependencies coming from binary linkage. Shown as a solid line on the system model.</li>
+<li><code>api</code> &mdash; Static dependencies like "bin" but can be explained by a controlled API. Shown as a dashed line on the system model.</li>
+<li><code>ecom</code> &mdash; ECOM plugin load (dynamic). Shown as a dotten line on the system model. </li>
+<li><code>cs</code> &mdash; Client Server dependency between client and server binaries</li>
+<li><code>cr</code> &mdash; Central Repository key usage</li>
+<li><code>ps</code> &mdash; Publish and Subscribe key usage</li>
+<li><code>imp</code> &mdash; implements an API</li>
+<li><code>rlib</code> &mdash; RLibrary usage: binary loads another binary using RLibrary interface </li></ul>
+<p>Custom values are also legal.</p>
+</li></ul>
+
+<p>
+On the system model, forward dependencies are show in black, and reverse dependencies in blue.
+The arrowhead always points to the item it's dependent on, ie the one in <code>&lt;dep&gt;</code>.
+
+
+Only <code>api</code>  and <code>ecom</code> have special line types. All other dependencies show up as solid lines.
+	  </p><div class="Figure">
+		<p class="Image"><img src="arrows.png" alt=""  border="0"/></p><br clear="all"/>
+	  </div>
+
+<p>
+Dependency arrows, colours and line styles can all be set using CSS in the <a href="../CustomSysmodel/cust.css.html"><code>&lt;deps&gt;</code> section</a> of the Shapes XML File. 
+The dependency type is used as the class on a <code>path</code> element. For example, to set the <code>cr</code> dependencies as alternating wide and narrow dashes use:
+</p><div class="Example">
+<code class="css">
+	path.cr {<div class="indent">stroke-dasharray: 9, 3, 5, 3;</div>}
+<code></div>
+
+
+
+<div class="section">
+<h2> See also</h2><p>
+		<a href="Model-XMLFile.html#ModelXMLFile">Model XML File</a> 
+	  </p><p>
+		<a href="Shapes-XMLFile.html#ShapesXMLFile" title="You can use the shapes XML file to specify the styling of the components and its generated legend items. This includes the following UI customization:">Shapes XML File</a> 
+	  </p><p>
+		<a href="Levels-XMLFile.html#LevelsXMLFile">Levels XML File</a> 
+	  </p><p>
+		<a href="Localisation-XMLFile.html#Localisation">Localization XML File</a> 
+	  </p><p>
+		<a href="System-Info-XMLFile.html#SystemInfoXML">SystemInfo XML File</a> 
+	  </p><p>
+		<a href="Values-XML-index.html#valuesxml" title="The Values XML files are used to define default and per-component display properties. You can use a values XML file to define colors, patterns, border shapes, or border styles of the components.">Values XML File</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Dictionary-XMLFile.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,154 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Dictionary XML File in System Model Generator Input Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="Localisation"></a><h1>Dictionary XML File</h1><div class="section">
+<h2>Purpose</h2><p>
+		You can use the Dictionary XML to provide abbreviations and other short forms for specific words. 
+		The system model generator will create a <a href="Localisation-XMLFile.html">Localization XML</a> file from this when creating the system model.</p>
+
+	  
+<p>If using the Localization XML file just to provide abbreviations, you may be better of using a <a href="Dictionary-XMLFile.html">Dictionary XML file</a> instead.</p>	  
+	  
+	  </div>
+<div class="section">
+<h2>Syntax</h2>
+<div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;  
+<br>&lt;dict&gt;
+<div class="indent">&lt;word term="<var>term</var>" <span class="opt">d="<var>display-form</var>"</span> <span class="opt">abbrev="<var>abbreviation</var>"</span> <span class="opt">s="<var>short-form</var>"</span>/&gt;
+<br>    &lt;word &#133;/&gt;
+<br>    &#133;
+</div>&lt;/dict&gt;</code></div>
+
+<p>The root element <code>dict</code> takes no attributes. the <code>word</code> element specifies a word, and  three forms of information:
+	  </p><ol> 
+		<li>
+		  <p>
+			<strong>A display form</strong> 
+		  </p> 
+		</li>
+ 
+		<li>
+ 
+		  <p>
+			<strong>An abbreivation</strong> 
+		  </p> 
+		</li>
+ 
+		<li>
+ 
+		  <p>
+			<strong>A short form</strong> 
+		  </p> 
+		</li>
+ 
+	  </ol>
+
+<p>The element <code>word</code> can takes these attributes: 
+	  </p><ul> 
+		<li>
+		  <p>
+			<code class="xml">term="<var>term</var>"</code>: This is the term which is to be abbreviated. It's case sensitive and should apper the same way it appears in the system defiition <code>name</code> attribtues. Spaces are not valid, only a single word can be used.
+		  </p> 
+		</li>
+
+		<li>
+		  <p>
+			<code class="xml">d="<var>display-form</var>"</code>: An optional attribute specifing how the term will be displayed if there is enough space. This is where you would show the hyphenation or other special character replacements. This will almost always be the full length word, but with added soft hyphens. For example<br/>
+			<code class="xml">&lt;word term="Interface" d="Inter&amp;#xad;face"/&gt;<br/>
+			&lt;word term="and" d="&amp;amp;"/&gt;</code>.
+		  </p> 
+		</li>
+
+		<li>
+		  <p>
+			<code class="xml">abbrev="<var>abbreivation</var>"</code>: An optional attribute specifing a shorter abbreviation for the term which can be used if there is insufficient space for the display form.
+			This will often be used in combination with <code>d</code>, but is not required to be.
+			 For example<br/>
+			<code class="xml">&lt;word term="Supplementary" d="Suppl."/&gt;<br/>
+			&lt;word term="Documentation" d="Docs"/&gt;</code>.
+		  </p> 
+		</li>
+		<li>
+		  <p>
+			<code class="xml">s="<var>short-form</var>"</code>: An optional attribute specifing the shortest possible form of the term that still makes sense.
+			This will be used when space is very low. 
+			This can be used instead of <code>abbrev</code> or in addition to it.
+			 For example<br/>
+			<code class="xml">&lt;word term="Hardware" s="HW"/&gt;<br/>
+			&lt;word term="Database" abbrev="Dbase." s="DB"/&gt;</code>.
+		  </p> 
+		</li>
+
+
+</div>
+<div class="section">
+<h2>Example</h2>
+<div class="Example"><code class="xml">&lt;?xml version="1.0" ?&gt; 
+<br>&lt;dict&gt;
+<div class="indent">   
+  &lt;word term="Multimedia" d="Multi&amp;#xad;media" s="MM"/&gt;
+ <br/> &lt;word term="Frameworks" d="Frame&amp;#xad;works" abbrev="Fmwks." s="FW"/&gt;
+ <br/>&lt;word term="Framework" d="Frame&amp;#xad;work" abbrev="Fmwk." s="FW"/&gt;
+  <br/>&lt;word term="Adaptation" abbrev="Adapt." d="Adapta&amp;#xad;tion"/&gt;
+  <br/>&lt;word term="Bluetooth" d="Blue&amp;#xad;tooth" abbrev="Btooth." s="BT"/&gt;
+  <br/>&lt;word term="Localization" d="Localiz&amp;#xad;ation"/&gt;
+  <br/>&lt;word term="Communications" d="Communi&amp;#xad;cations" abbrev="Comms"/&gt;
+  <br/>&lt;word term="Provisioning" d="Provision&amp;#xad;ing" s="Prov."/&gt;
+  <br/>&lt;word term="Phonebook" d="Phone&amp;#xad;book" s="Phbk."/&gt;
+</div>&lt;/dict&gt;</code></div></div>
+<div class="section">
+<h2> See also</h2><p>
+		<a href="System-Info-XMLFile.html#SystemInfoXML">SystemInfo XML File</a> 
+	  </p><p>
+		<a href="Localisation-XMLFile.html">Localization XML File</a> 
+	  </p><p>
+		<a href="Dependencies-sysinfo.html">Dependencies Sysinfo File</a> 
+	  </p><p>
+		<a href="Values-XML-index.html#valuesxml" title="The Values XML files are used to define default and per-component display properties. You can use a values XML file to define colors, patterns, border shapes, or border styles of the components.">Values XML File</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Localisation-XMLFile.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,151 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Localization XML File in System Model Generator Input Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="Localisation"></a><h1>Localization XML File</h1><div class="section">
+<h2>Purpose</h2><p>
+		You can use the Localization XML file to customize the appearance of an
+		item name on the model. It enables you to perform the following tasks: 
+	  </p><ul> 
+		<li>
+ 
+		  <p>
+			Provide abbreviations of item names. For example,
+			&#8220;<code>Application Launch Services</code>&#8221;.  can appear as &#8220;<code>App. Launch
+			Services</code>&#8221;. 
+		  </p> 
+		</li>
+ 
+		<li>
+ 
+		  <p>
+			Include special characters in names, such as soft hyphens. For
+			example, "<code>Graphics Device Interface</code>" can appear as "<code>Graphics Dev&amp;#xad;ice Interface</code>". This allows the word to split across
+			multiple lines on the diagram if it is needed. 
+		  </p> 
+		</li>
+ 
+		<li>
+ 
+		  <p>
+			Provide a localized translation of a word. For example, "Device
+			Provisioning" can appear as "&#31471;&#26411;&#31649;&#29702;". 
+		  </p> 
+		</li>
+ 
+	  </ul>
+	  
+<p>If using the Localization XML file just to provide abbreviations, you may be better of using a <a href="Dictionary-XMLFile.html">Dictionary XML file</a> instead.</p>	  
+	  
+	  </div>
+<div class="section">
+<h2>Syntax</h2>
+<div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;  
+<br>&lt;display-names <span class="opt">xml:lang="<var>language-code</var></span> <span class="opt">id-namespace="<var>uri</var>"</span> <span class="opt"><var>&#133;namespaces&#133;</var></span> &gt;
+<div class="indent">    &lt;abbrev ref="<var>id</var>" abbrev="<var>abbreviation</var>"/&gt;
+<br>    &lt;abbrev name="<var>item-name</var>" abbrev="<var>abbreviation</var>"/&gt;
+<br>    &#133;
+</div>&lt;/display-names&gt;</code></div>
+
+<p>There are two ways to assign a localized name to a system model item. </p>
+<ol>
+<li><strong>By ID</strong> - you can use the <code>ref</code> attribute to specify the unique ID of a single system model item to rename.</li>
+<li><strong>By name</strong> - you can use the <code>name</code> attribute to specify that any system model item with that human-readable name will be renamed.</li>
+</ol>
+
+<p>The root element <code>display-names</code> can take these optional attributes: 
+	  </p><ul> 
+	  
+		<li>
+		  <p>
+			<code class="xml">xml:lang="<var>language-code</var>"</code>: This indicates that the file is for localisation and not just a set of abbreviations. 
+			The affects of setting this are: <ol>
+			<li>The xml:lang will be set to this value in the generated SVG. This lets you put CSS like this in the Shapes XML: 
+				<br/><code class="CSS">text.title:lang(jp) {letter-spacing: -0.15}</code><br/>
+				so that you can fine tune the diagram for different languages. 
+
+				</li>
+			<li>All generated numbers (eg when counting in the legend) will be localised (if possible) to this language.</li>
+			</ol>
+		  </p> 
+		</li>
+
+		<li>
+		  <p>
+			<code class="xml">id-namespace="<var>uri</var>"</code>: The default namespace for all <code>ref</code> attributes in the XML file. Has the same meaning, usage and default value as <code>id-namespace</code> in the <a href="http://developer.symbian.org/wiki/index.php/System_Definition/Root#Attributes">System Definition</a>.
+		  </p> 
+		</li>
+
+		<li>
+		  <p>
+			<code><var>namespaces</var></code>: Any namespace declaration should be done in the root element. ID references can use namespace prefixes to associate with system model items. See <a href="http://developer.symbian.org/wiki/index.php/System_Definition/Attributes#Namespacing_names">Namespacing names</A> in the System Definition specification.
+		  </p> 
+		</li>
+
+
+</div>
+<div class="section">
+<h2>Example</h2>
+<div class="Example"><code class="xml">&lt;?xml version="1.0" ?&gt; 
+<br>&lt;display-names xml:lang="jp"&gt;
+<div class="indent">   &lt;abbrev name="Device Provisioning" abbrev="端末管理" /&gt; 
+<br>  &lt;abbrev name="PIM App Support" abbrev="PIM アプリケーション・サポート" /&gt; 
+<br>        &lt;abbrev name="Multimedia" abbrev="マルチメディア" /&gt; 
+<br>  &lt;abbrev name="Messaging Application Support" abbrev="メッセージング・アプリケーション・サポート" /&gt; 
+<br>  &lt;abbrev name="Graphics" abbrev="グラフィックス" /&gt; 
+<br>  &lt;abbrev name="Application Framework" abbrev="アプリケーション・フレームワーク" /&gt;
+<br>  &lt;abbrev name="Plugin Compo&amp;#xad;nent" abbrev="プラグイン コンポーネント"/&gt;
+</div>&lt;/display-names&gt;</code></div></div>
+<div class="section">
+<h2> See also</h2><p>
+		<a href="System-Info-XMLFile.html#SystemInfoXML">SystemInfo XML File</a> 
+	  </p><p>
+		<a href="Dependencies-sysinfo.html">Dependencies Sysinfo File</a> 
+	  </p><p>
+		<a href="Values-XML-index.html#valuesxml" title="The Values XML files are used to define default and per-component display properties. You can use a values XML file to define colors, patterns, border shapes, or border styles of the components.">Values XML File</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Patterns-XMLFile.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,99 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Patterns Values XML File in Values XML Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="patternsxml"></a><h1>Patterns Values XML File</h1><div class="section">
+<h2>Purpose</h2><p>
+		The patterns values XML file is used to define the patterns of
+		components. The valid values for a pattern can be <code>striped-diag-up</code>,
+		<code>radial-grad</code>, <code>big-X</code> or a reference (<code>#<var>xxxx<var></code>) to a pattern specified
+		in a Shapes XML file. 
+	  </p><p>
+		The following figure shows the various predefined patterns:
+	  </p><div class="Figure">
+		<p class="Image"><img src="patterns.gif" alt=""  border="0"/></p><br clear="all"/>
+
+	  </div><p>
+		For information about how to define new values for patterns, see
+		<a href="../CustomSysmodel/index.html#cust%2eindex" title="This document describes how to customise a System Model diagram using a Shapes XML file to specify the styling of components and generated legend items.">Customizing the System Model Presentation</a>. 
+	  </p></div>
+<div class="section">
+<h2>Syntax</h2>
+<p>The Patterns files use the common syntax for all <a href="Values-XML-index.html">Values XML files</a>. </p>
+</div>
+ 
+<div class="section">
+<h2>Example</h2>
+<div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;<br>&lt;values&gt;
+<div class="indent">    &lt;item label="Reference Compo#xad;nent" value="striped-diag-up"&gt;
+<div class="indent">            &lt;component name="OMAP 1623"/&gt;
+<br>            &lt;component name="SD Card Driver"/&gt;
+<br>            &#133;
+</div>    &lt;/item&gt;
+<br>    &lt;item label="New in 9.4" value="radial-grad"&gt;
+<div class="indent">           &lt;component name="Wireless LAN"/&gt;
+<br>            &lt;component name="Graphics Effects"/&gt;
+</div>    &lt;/item&gt;
+<br>    &lt;item label="Depre&amp;#ad;cated" value="#my-pattern"&gt;
+<div class="indent">          &lt;component name="Word Engine"/&gt;
+</div>    &lt;/item&gt;
+</div>&lt;/values&gt;</code></div><p>
+		The following figure shows the generated legend for the preceding
+		patterns values XML:
+	  </p><div class="Figure">
+		<p class="Image"><a name=""><img src="patternsxmloutput.gif" alt=""  border="0"/></a></p><br clear="all"/>
+
+	  </div></div>
+<div class="section">
+<h2>See also</h2><p>
+		<a href="Colours-XMLFile.html#coloursxml">Colors Values XML File</a> 
+	  </p><p>
+		<a href="Border-Shapes-XMLFile.html#bordershapesxml">Border Shapes Values XML File</a> 
+	  </p><p>
+		<a href="Border-Style-XMLFile.html#borderstylesxml">Border Styles Values XML File</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/System-Info-XMLFile.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,145 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>SystemInfo XML File in System Model Generator Input Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <div class="section">
+<a name="SystemInfoXML"></a><h1>System Info XML File</h1><div class="section">
+<h2>Purpose</h2><p>
+		You can use the systeminfo XML file to add properties to components in
+		a system definition XML file. This is used to provide extra attributes and elements to be used by a
+		Shapes XML file, or for custom post-processing. 
+	  </p></div>
+<div class="<var>section</var>">
+<h2>Syntax</h2><div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;  
+<br>&lt;info <span class="opt">data-type="<var>rel-value</var>"</span> <span class="opt">id-namespace="<var>uri</var>"</span> <span class="opt"><var>&#133;namespaces&#133;</var></span> &gt;
+<div class="indent">&lt;item ref="<var>id</var>" &#133;/&gt;
+<br>&lt;item ref="<var>id</var>" &#133;&gt;
+<div class="indent">&#133; <em class="comment">arbitrary content</em>&#133;</div>
+&lt;/item&gt;
+<br>&#133;
+</div>&lt;/item&gt;</code></div><p>
+
+
+		The <code>item</code> element provides additional information for the referenced system model item. It can be 
+		any rank &mdash; layer, package, collection or component. 
+		The only required attribute is <b><code>ref</code></b>, which is the ID in the system definition. 
+		When you build, the data in this file is added to the elements in the system definition.
+		The attributes in the System Info file are added to the the system model item, overwriting any existing attribute by that name,
+		Any elements or comments within the <code>item</code> tag is added to a <code>meta</code> section within the item. 
+	  </p></div>
+
+
+<p>The root element <code>info</code> can take these optional attributes: 
+	  </p><ul> 
+	  		<li>
+		  <p>
+			<code class="xml">data-type="<var>rel-value</var>"</code>: The value to be but in the <code>rel</code> attribute for any <code>&lt;meta&gt;</code> elements created by this file. 
+			See <a href="http://developer.symbian.org/wiki/index.php/System_Definition/Meta#Attributes"><code>meta</code> attributes</a> for details on usage.		
+			This defaults to "<code>Generic</code>".
+		  </p> 
+		</li>
+
+
+		<li>
+		  <p>
+			<code class="xml">id-namespace="<var>uri</var>"</code>: The default namespace for all <code>ref</code> attributes in the XML file. Has the same meaning, usage and default value as <code>id-namespace</code> in the <a href="http://developer.symbian.org/wiki/index.php/System_Definition/Root#Attributes">System Definition</a>.
+		  </p> 
+		</li>
+
+		<li>
+		  <p>
+			<code><var>namespaces</var></code>: Any namespace declaration should be done in the root element. ID references can use namespace prefixes to associate with system model items. See <a href="http://developer.symbian.org/wiki/index.php/System_Definition/Attributes#Namespacing_names">Namespacing names</A> in the System Definition specification.
+		  </p> 
+		</li>
+
+
+</div>
+
+<div class="section">
+<h2>Example</h2>
+<div class="Example"><code class="xml">&lt;?xml version="1.0" encoding="ascii"?&gt;
+<br>&lt;info data-type="usage" <span class="namespaced">xmlns:my="http://example.com/mine"</span>&gt;
+<div class="indent"> &lt;item ref="connectivityservices" deprecated="9.4"/&gt;
+<br> &lt;item ref="connectivityframework" deprecated="9.4"/&gt;
+<br> &lt;item ref="ipproto-cpr" used="true"/&gt;
+<br> &lt;item ref="tcpcpr" used="true"/&gt;
+<br> &lt;item used="true" introduced="9.1" ref="devicemanagementadaptors"/&gt;
+<br> &lt;item ref="<span class="namespaced">my:</span>referencedevsoundplugins" used="true"/&gt;
+<br> &lt;item introduced="9.1" ref="clientprovisioningframework"/&gt;
+<br> &lt;item introduced="9.1" used="true" ref="clientprovisioningadaptors"/&gt;
+<br> &lt;item ref="telnetengine" introduced="6.0"/&gt;
+<br> &lt;item introduced="9.2" ref="sipframework"/&gt;
+<br> &lt;item ref="otherfileconverterplugins" used="true" introduced="5.0" deprecated="9.3"/&gt;
+<br> &lt;item ref="dataengine" introduced="5.0" deprecated="9.3"/&gt;
+<br> &lt;item ref="sheetengine" introduced="5.0" deprecated="9.3"/&gt;
+<br> &lt;item ref="wordengine" introduced="5.0" deprecated="9.3"/&gt;
+<br> &lt;item ref="help" introduced="6.0"/&gt;
+<br> &lt;item ref="agendamodel" introduced="5.0" deprecated="9.1"/&gt;
+<br> &lt;item ref="calendar" introduced="9.2"/&gt;
+<br> &lt;item ref="integratorxx600logicmodule" ref="true"/&gt;
+<br> &lt;item ref="multimediavalidationsuiteintegrationtests" introduced="9.4"/&gt;
+<br> &lt;item ref="swianalysistoolkit" ref="true"/&gt;
+<br> &lt;item ref="iphookexamples" ref="true"/&gt;
+<br> &lt;item ref="ipexamples" ref="true"/&gt;
+<br> &lt;item ref="referenceacladaptation" introduced="9.5"/&gt;
+<br> &lt;item introduced="9.5" ref="a3faudiocomponentlibrary"/&gt;
+<br> &lt;item introduced="9.5" ref="a3fdevsoundcustomisation"/&gt;
+<br> &lt;item introduced="9.5" ref="a3fdevsound"/&gt;
+<br> &lt;item introduced="9.5" ref="a3faudiocomponentframework"/&gt;
+<br> &lt;item introduced="9.5" ref="securitycommonutils"/&gt;
+<br> &lt;item introduced="9.5" ref="a3ftraceutility"/&gt;
+<br> &lt;item ref="commandshell" introduced="9.5"/&gt;
+ <br/>&lt;item ref="telnetserver" introduced="9.5"/&gt;<br> &lt;item ref="multimediaresourcecontroller" introduced="9.5"/&gt;
+ </div>&lt;/info&gt;</code></div></div>
+<div class="section">
+<h2> See also</h2><p>
+		<a href="Localisation-XMLFile.html#Localisation">Localization XML File</a> 
+	  </p><p>
+		<a href="Dependencies-sysinfo.html">Dependencies Sysinfo File</a> 
+	  </p><p>
+		<a href="Values-XML-index.html#valuesxml" title="The Values XML files are used to define default and per-component display properties. You can use a values XML file to define colors, patterns, border shapes, or border styles of the components.">Values XML File</a> 
+	  </p></div>
+</div>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009  Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>. </div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/Values-XML-index.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,179 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>Values XML Files in System Model Generator Input Files</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <a name=""></a>
+<h1>Values XML Files</h1><a name="valuesxml"></a><p>
+	The Values XML files are used to define default and per-item display
+	properties. You can use a values XML file to define colors, patterns, border
+	shapes, or border styles of the system model items. 
+  </p><p>
+	For information about how to define new values for border shapes, colors or
+	patterns, see 
+	<a href="../CustomSysmodel/index.html#cust%2eindex" title="This document describes how to customise a System Model diagram using a Shapes XML file to specify the styling of components and generated legend items.">Customizing the System Model Presentation</a>
+.
+	
+  </p><p>
+	There are four types of Values XML files: 
+  </p><ul class="indexlinks">
+<li>
+<a href="Colours-XMLFile.html#coloursxml">Colors Values XML File</a></li>
+<li>
+<a href="Patterns-XMLFile.html#patternsxml">Patterns Values XML File</a></li>
+<li>
+<a href="Border-Shapes-XMLFile.html#bordershapesxml">Border Shapes Values XML File</a> (components only)</li>
+<li>
+<a href="Border-Style-XMLFile.html#borderstylesxml">Border Styles Values XML File</a></li>
+</ul>
+
+
+<h2>Syntax</h2>
+<p>All Values XML files share the same basic syntax
+<div class="Example"><code class="xml">&lt;?xml version="1.0"?&gt;
+<br/>&lt;values <span class="opt">default="<var>presentation-value</var>"</span> <span class="opt">label="<var>label for legend section</var>"</span> <span class="default">rank="<var>item-type-list</var>"</span> <span class="default">id-namespace="<var>uri</var>" </span><span class="opt"><var>&#133;namespaces&#133;</var></span> &gt;
+<div class="indent">&lt;item <span class="opt">label="<var>label for legend</var>"</span> value="<var>presentation-value</var>"&gt;
+<div class="indent">&lt;m ref="<var>id</var>"/&gt;
+<br/>&lt;m ref="<var>id</var>"/&gt;
+<br/>&lt;m ref="<var>id</var>"/&gt;
+<br>&#133;</div>
+&lt;/item&gt;
+<br>&lt;item &#133;&gt;<div class="indent">&#133;</div>&lt;/item&gt;<br>&#133;</div>&lt;/values&gt;</code></div><p>
+		In the preceding syntax, the root element <code>values</code> contains any number of 
+		<code>item</code> tags. The various attributes for the <code>values</code> tag are: 
+	  </p><ul> 
+	  
+		<li>
+		  <p>
+			<code class="xml">rank="<var>item-type-list</var>"</code>: Space-separated list of the ranks (<code>component</code>, <code>collection</code>, <code>package</code> or  <code>layer</code>) of items the <code>default</code> value applies to.
+			Any system model item of the listed rank <em>not</em> listed in the values file will get the <code>default</code> presentation value. 
+			The (default) special value of <code>*</code> indicates this file applies to all ranks. 
+		  </p> 
+		</li>
+
+		<li>
+		  <p>
+			<code class="xml">default="<var>presentation-value</var>"</code>: Defines the
+			default presentation value for the system model item. This default value gets assigned to
+			the system model items of the specified rank to which no specific value is assigned. 
+		  </p> 
+		</li>
+ 
+		<li>
+		  <p>
+			<code class="xml">label="<var>label for legend section</var>"</code>: Defines the label that will precede the legend section.
+		  </p> 
+		</li>
+		<li>
+		  <p>
+			<code class="xml">id-namespace="<var>uri</var>"</code>: The default namespace for all <code>ref</code> attributes in the XML file. Has the same meaning, usage and default value as <code>id-namespace</code> in the <a href="http://developer.symbian.org/wiki/index.php/System_Definition/Root#Attributes">System Definition</a>.
+		  </p> 
+		</li>
+
+		<li>
+		  <p>
+			<code><var>namespaces</var></code>: Any namespace declaration should be done in the root element. ID references can use namespace prefixes to associate with system model items. See <a href="http://developer.symbian.org/wiki/index.php/System_Definition/Attributes#Namespacing_names">Namespacing names</A> in the System Definition specification.
+		  </p> 
+		</li>
+ 
+	  </ul><p>
+		Each <code class="xml">item</code> tag can have the following attributes: 
+	  </p><ul> 
+		<li>
+ 
+		  <p>
+			<code class="xml">label="<var>label for legend</var>"</code>: Defines the label for the	legend. 
+		  </p> 
+		</li>
+ 
+		<li>
+ 
+		  <p>
+			<code>value="<var>presentation-value</var>"</code>: Defines the presentation
+			value for the item (color, border shape, etc). This presentation value gets assigned to all the referenced system model items that are
+			listed within that <code>item</code> element. 
+		  </p> 
+		</li>
+ 
+	  </ul><p>
+		The <code>item</code> tag also contains <code>m</code> tags to reference the IDs of system model items.
+		 Everything referenced in an
+		<code>item</code> tag has the same presentation value. The following is the basic syntax for <code>m</code>: 
+	  </p><p>
+		<code> &lt;m ref="<var>id</var>"/&gt;</code> 
+	  </p><p>
+		Where <var>id</var> is a reference to the ID of a system model item
+		defined in a system definition file. <strong>Note:</strong> while most presentation values can apply to anything, only components can be given a border shape. 
+	  </p></div>
+
+<p>
+	<b>Notes</b>:
+  </p><ul> 
+	<li>
+ 
+	  <p>
+		You are recommended to specify a default value when using the values to
+		specify colors or shapes on components, since the components not specified in the file will
+		either be black or not show up at all. 
+	  </p>
+	</li>
+ 
+	<li>
+ 
+	  <p>
+		While creating a value XML file (colors, patterns, border shapes or
+		border styles), you can only specify predefined set of values to the items. For
+		information about the values that can be specified in each type of values XML
+		file, refer to the corresponding topic. 
+	  </p>
+	</li>
+ 
+	<li>
+ 
+	  <p>
+		All values in a values XML file must be of the same type. 
+	  </p>
+	</li>
+ 
+  </ul>
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>.&nbsp;</div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
Binary file sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/arrows.png has changed
Binary file sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/bordershapes.gif has changed
Binary file sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/bordershapesoutput.gif has changed
Binary file sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/borderstyleoutput.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/index.html	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,61 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <!-- Generated by Xbuild version: 5.0.20 -->
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<meta name="show-comments" content="" />
+	<title>System Model Generator Input Files in Reference</title>    
+	<link href="../../_stock/css/reset.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/portal.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/iefix.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/ui.tabs.css" rel="stylesheet" type="text/css" />
+	<link href="../../_stock/css/developer.css" rel="stylesheet" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/ui.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sysdoc.css" media="screen" />
+	<link rel="stylesheet" type="text/css" href="../../_stock/css/sdlplugin.css" media="screen" />
+    </head>
+    <body>
+	<div id="main_content">
+	    <table width="100%" cellpadding="0" cellspacing="0" border="0">
+		<tr>
+		    <td valign="top" width="100%">
+			<div id="main_content_txt">
+			    <div class="main_content_padding">		
+                                <div id="main">
+                                    <div id="authoredContent">
+                                        <a name=""></a>
+<h1>System Model Generator Input XML Files</h1><a name="smm%2eref%2esmginputfile%2dindex"></a><p>
+	This section lists the various input XML files that are used by System
+	Model Generator to build the system model. 
+  </p><ul class="indexlinks">
+<li>Model XML File</li>
+<li>Shapes XML File</li>
+<li><a href="Dictionary-XMLFile.html">Dictionary XML File</a></li>
+<li><a href="Localisation-XMLFile.html#Localisation">Localization XML File</a></li>
+<li><a href="System-Info-XMLFile.html#SystemInfoXML">SystemInfo XML File</a></li>
+<li><a href="Dependencies-sysinfo.html">Dependencies Sysinfo File</a></li>
+<li><a href="Dependencies-XMLFile.html#DependenciesXMLFile">Legacy Dependencies XML File</a> (for use with 2.0 and earlier System Definitions only)</li>
+<li><a href="Values-XML-index.html#valuesxml" title="The Values XML files are used to define default and per-component display properties. You can use a values XML file to define colors, patterns, border shapes, or border styles of the components.">Values XML Files</a></li>
+</ul>
+
+                                    </div>
+                                    <div id="printer_copyright">
+                                        <div id="printer_copyright_padding">
+                                            Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>
+                                        </div>
+                                    </div>
+                                </div>
+			    </div>
+			</div>
+		    </td>
+		</tr>
+	    </table>
+	    <div style="clear: both"></div>
+	</div>
+	<div id="includedFooter">
+	    <div id="devnet_footer">
+            <div style="float: left;">Copyright &copy;2009&nbsp; Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: <a href="http://www.symbianfoundation.org/legal/sfl-v10.html">SFL</a>.&nbsp;</div>
+            <div id='BUILD_VERSION'></div>
+	    </div>
+	</div>
+</body>
+</html>
Binary file sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/patterns.gif has changed
Binary file sysmodellibs/sysmodelgen/doc/sysmodel/SMG-Input-Files/patternsxmloutput.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/css-module.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,310 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ 	xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:exslt="http://exslt.org/common"
+  	exclude-result-prefixes="s exslt" >
+
+	<xsl:variable name="css">
+		<css><xsl:copy-of select="/*/@xml:lang"/>
+			<xsl:apply-templates select="//style | //s:style" mode="css"/>
+		</css>
+	</xsl:variable>
+<!-- debugging <xsl:template match="/*"><xsl:copy-of select="$css"/></xsl:template>-->
+
+ 
+<xsl:template match="s:style" mode="unstyle"/>
+
+<xsl:template match="*" mode="unstyle">
+	<xsl:copy>
+		<xsl:apply-templates select="@*" mode="unstyle"/>
+		<xsl:call-template name="style"/>
+		<xsl:apply-templates select="node()" mode="unstyle"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="@*|text()" mode="unstyle"><xsl:copy-of select="."/></xsl:template>
+<xsl:template match="@style" mode="unstyle"/>
+
+
+<xsl:template match="*" mode="style-value"><xsl:param name="property"/>
+	<xsl:variable name="this">
+		<xsl:copy>
+			<xsl:apply-templates select="@*" mode="unstyle"/>
+			<xsl:call-template name="style"/>
+		</xsl:copy>
+	</xsl:variable>
+	<xsl:value-of select="exslt:node-set($this)/*/@*[name()=$property]"/>
+</xsl:template>
+
+
+<xsl:template name="style">
+	<xsl:variable name="cur" select="."/>
+	<xsl:variable name="styles">
+		<xsl:for-each select="exslt:node-set($css)/css//item[
+			( contains(concat(' ',normalize-space($cur/@class),' '),concat(' ',@class,' ')) or not(@class) ) and 
+			( @id = $cur/@id or not(@id) ) and
+			( not(starts-with(@psuedo,'lang(')) or lang(substring-before(substring-after(@psuedo,'lang(')),')')) and
+			( @tag = local-name($cur) or not(@tag) ) and not(ancestor::media)]">
+			<xsl:variable name="found">
+				<xsl:if test="parent::parent">
+					<xsl:apply-templates select="parent::parent" mode="match">
+						<xsl:with-param name="svg" select="$cur"/>
+					</xsl:apply-templates>
+				</xsl:if>
+				<xsl:if test="not(parent::parent)">1</xsl:if>
+			</xsl:variable>
+			<xsl:if test="$found!=''">
+				<xsl:copy-of select="*"/>
+			</xsl:if>
+		</xsl:for-each>
+		<xsl:apply-templates select="@style" mode="css"/>
+	</xsl:variable>
+	<!--  debug <xsl:copy-of select="$styles"/>-->
+	<xsl:for-each select="exslt:node-set($styles)/*">
+		<xsl:if test="not(preceding-sibling::*[name()=name(current()) and @bang='important']) and not($cur/@*[name()=name(current())])">
+		<xsl:attribute name="{name()}">
+			<xsl:value-of select="."/>
+		</xsl:attribute>
+		</xsl:if>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="parent" mode="match">
+	<xsl:param name="svg"/>
+	<xsl:variable name="this" select="."/>
+	<xsl:variable name="match" select="$svg/ancestor::*[
+		( contains(concat(' ',normalize-space(@class),' '),concat(' ',$this/@class,' ')) or not($this/@class) ) and 
+		( $this/@id = @id or not($this/@id) ) and
+		( not(starts-with($this/@psuedo,'lang(')) or lang(substring-before(substring-after($this/@psuedo,'lang(')),')')) and
+		( $this/@tag = local-name() or not($this/@tag) )]"/>
+	<xsl:choose>
+		<xsl:when test="$match and parent::parent">
+			<xsl:for-each select="$match">
+				<xsl:apply-templates select="parent::parent" mode="match">
+					<xsl:with-param name="svg" select="current()"/>
+				</xsl:apply-templates>
+			</xsl:for-each>
+		</xsl:when>
+		<xsl:when test="$match">1</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="*" mode="css">
+	<xsl:call-template name="cssitem">
+		<xsl:with-param name="text">
+			<xsl:call-template name="nocomments"/>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="@style" mode="css">
+	<xsl:call-template name="parse-properties">
+		<xsl:with-param select="." name="text"/>
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template name="cssitem"><xsl:param name="text" select="."/>
+	<xsl:variable name="pre" select="normalize-space(substring-before($text,'{'))"/>
+	<xsl:variable name="post" select="substring-after($text,'{')"/>
+	<xsl:choose>
+		<xsl:when test="contains($pre,'@')">
+			<xsl:variable name="cnt">
+				<xsl:call-template name="endgroup">
+					<xsl:with-param name="text" select="$post"/>
+				</xsl:call-template>
+			</xsl:variable>		
+			<xsl:element name="{substring-before(substring-after($pre,'@'),' ')}">
+				<xsl:attribute name="type">
+					<xsl:value-of select="normalize-space(substring-after(substring-after($pre,'@'),' '))"/>
+				</xsl:attribute>
+				<xsl:call-template name="cssitem">
+					<xsl:with-param name="text" select="$cnt"/>
+				</xsl:call-template>
+		</xsl:element>
+				<xsl:call-template name="cssitem">
+					<xsl:with-param name="text" select="substring($post,string-length($cnt) +  2)"/>
+				</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:call-template name="parse-list">
+				<xsl:with-param name="list" select="$pre"/>
+				<xsl:with-param name="value-text" select="substring-before($post,'}')"/>
+			</xsl:call-template>
+			<xsl:variable name="next"  select="substring-after($post,'}')"/>
+			<xsl:if test="normalize-space($next)!=''">
+				<xsl:call-template name="cssitem">
+					<xsl:with-param name="text" select="$next"/>
+				</xsl:call-template>
+			</xsl:if>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="endgroup"><xsl:param name="text"/>
+	<xsl:variable name="open" select="substring-before($text,'{')"/>
+	<xsl:variable name="close" select="substring-before($text,'}')"/>
+	<xsl:choose>
+		<xsl:when test="contains($text,'{') and string-length($open) &lt; string-length($close)">
+			<xsl:value-of select="concat($close,'}')"/>
+			<xsl:call-template name="endgroup">
+				<xsl:with-param name="text" select="substring-after($text,'}')"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="contains($text,'}')">
+			<xsl:value-of select="$close"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="$text"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="nocomments"><xsl:param name="text" select="."/>
+	<xsl:choose>
+		<xsl:when test="contains($text,'/*')">
+			<xsl:value-of select="substring-before($text,'/*')"/>
+			<xsl:call-template name="nocomments">
+				<xsl:with-param select="substring-after(substring-after($text,'/*'),'*/')" name="text"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="$text"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+
+
+<xsl:template name="parse-list"><xsl:param name="value-text"/><xsl:param name="list"/>
+	<xsl:choose>
+		<xsl:when test="contains($list,',')">
+			<xsl:call-template name="parse-item">
+				<xsl:with-param select="normalize-space(substring-before($list,','))" name="item"/>
+				<xsl:with-param select="$value-text" name="value-text"/>
+			</xsl:call-template>
+			<xsl:call-template name="parse-list">
+				<xsl:with-param select="substring-after($list,',')" name="list"/>
+				<xsl:with-param select="$value-text" name="value-text"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:call-template name="parse-item">
+				<xsl:with-param select="normalize-space($list)" name="item"/>
+				<xsl:with-param select="$value-text" name="value-text"/>
+			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="parse-item"><xsl:param name="value-text"/><xsl:param name="item"/>
+	<xsl:choose>
+		<xsl:when test="contains($item,' ')">
+			<xsl:call-template name="parse-term">
+				<xsl:with-param select="substring-before($item,' ')" name="item"/>
+				<xsl:with-param select="$value-text" name="value-text"/>
+				<xsl:with-param select="substring-after($item,' ')" name="descend"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:call-template name="parse-term">
+				<xsl:with-param select="$item" name="item"/>
+				<xsl:with-param select="$value-text" name="value-text"/>
+			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="parse-term"><xsl:param name="value-text"/><xsl:param name="item"/><xsl:param name="descend"/>
+	<xsl:variable name="type">
+		<xsl:choose>
+			<xsl:when test="$descend=''">item</xsl:when>
+			<xsl:otherwise>parent</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:element name="{$type}">
+		<xsl:variable name="v0"> <!-- check for pseudo class -->
+			<xsl:choose>
+				<xsl:when test="contains($item,':')"><xsl:value-of select="substring-before($item,':')"/></xsl:when>
+				<xsl:otherwise><xsl:value-of select="$item"/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:if test="$v0!=$item">
+			<xsl:attribute name="pseudo"><xsl:value-of select="substring-after($item,':')"/></xsl:attribute>
+		</xsl:if>
+		<xsl:if test="$v0 != '' ">
+			<xsl:variable name="v1">
+				<xsl:choose>
+					<xsl:when test="contains($v0,'.')"><xsl:value-of select="substring-before($v0,'.')"/></xsl:when>
+					<xsl:otherwise><xsl:value-of select="$v0"/></xsl:otherwise>
+				</xsl:choose>
+			</xsl:variable>
+			<xsl:if test="$v1!=$v0">
+				<xsl:attribute name="class"><xsl:value-of select="substring-after($v0,'.')"/></xsl:attribute>
+			</xsl:if>
+			<xsl:if test="$v1 != '' ">
+				<xsl:choose>
+					<xsl:when test="starts-with($v1,'#')">
+						<xsl:attribute name="id"><xsl:value-of select="substring($v1,2)"/></xsl:attribute>
+					</xsl:when>
+					<xsl:otherwise><xsl:attribute name="tag"><xsl:value-of select="$v1"/></xsl:attribute></xsl:otherwise>
+				</xsl:choose>
+			</xsl:if>
+		</xsl:if>
+		<xsl:choose>
+			<xsl:when test="$descend!=''">
+				<xsl:call-template name="parse-item">
+					<xsl:with-param select="$descend" name="item"/>
+					<xsl:with-param select="$value-text" name="value-text"/>
+				</xsl:call-template>
+			</xsl:when>
+			<xsl:otherwise>
+			<xsl:call-template name="parse-properties">
+				<xsl:with-param select="$value-text" name="text"/>
+			</xsl:call-template>
+		</xsl:otherwise>
+		</xsl:choose>
+	</xsl:element>
+</xsl:template>
+
+
+<xsl:template name="parse-properties"><xsl:param name="text"/>
+	<xsl:choose>
+		<xsl:when test="contains($text,';')">
+		<xsl:call-template name="parse-property">
+			<xsl:with-param select="substring-before($text,';')" name="text"/>
+		</xsl:call-template>
+		<xsl:if test="normalize-space(substring-after($text,';'))!=''">
+			<xsl:call-template name="parse-properties">
+				<xsl:with-param select="substring-after($text,';')" name="text"/>
+			</xsl:call-template>
+		</xsl:if>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:call-template name="parse-property">
+				<xsl:with-param select="$text" name="text"/>
+			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="parse-property"><xsl:param name="text"/>
+<xsl:if test="contains($text,':')">
+	<xsl:variable name="post" select="substring-after($text,':')"/>
+
+	<xsl:element name="{normalize-space(substring-before($text,':'))}">
+		<xsl:choose>
+			<xsl:when test="contains($post,'!')">
+				<xsl:attribute name="bang"><xsl:value-of select="substring-after($post,'!')"/></xsl:attribute>
+				<xsl:value-of select="normalize-space(substring-before($post,'!'))"/>
+			</xsl:when>
+			<xsl:otherwise><xsl:value-of select="normalize-space($post)"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:element>
+</xsl:if>	
+
+</xsl:template>
+
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/css2xml.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,13 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ 	xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:exslt="http://exslt.org/common"
+  	exclude-result-prefixes="s exslt" >
+	<xsl:import href="css-module.xsl"/>	
+
+
+<xsl:template match="comment()" mode="unstyle"><xsl:copy-of select="."/></xsl:template>
+
+<xsl:template match="/*">
+		<xsl:apply-templates select="." mode="unstyle"/>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/dependencies.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,350 @@
+<?xml version="1.0"?>
+<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+	<xsl:import href="postprocess.xsl"/>	
+	<xsl:output method="xml"/>
+	<xsl:variable name="Size">
+		<xsl:choose>
+			<xsl:when test="/s:svg[substring-after(@class,'-')='fixed' and @class!='component-fixed']">
+				<xsl:value-of select="//s:g[@class=substring-before(/s:svg/@class,'-')]/s:rect/@width"/>
+			</xsl:when>
+			<xsl:otherwise><xsl:value-of select="//s:g[@class='component']/s:use/@width"/></xsl:otherwise>
+		</xsl:choose>
+	 </xsl:variable>
+	<xsl:key name="Using" match="Bin" use="@name"/>
+	<xsl:key name="Used-by" match="dep" use="@name"/>
+	<xsl:key name="Id" match="component|collection|package" use="@id"/>
+	<xsl:variable name="Rank" select="document('')/*/*[@name='RANK']/*"/>
+
+<xsl:template name="RANK">
+<layer rank="0"/>
+<package rank="1"/>
+<collection rank="2"/>
+<component rank="3"/>
+</xsl:template>
+	
+<xsl:template match="/" mode="my-prefix">dep-</xsl:template>
+<xsl:template match="/SystemDefinition" mode="is-present"><xsl:param name="id"/>
+	<xsl:for-each select="key('Id',$id)">
+		<xsl:choose>
+				<!-- no children and higher than the normal placeholder detail -->
+			<xsl:when test="count(meta|unit)=count(*) and /SystemDefinition/@placeholder-detail and ($Rank[name()=current()/ancestor::SystemDefinition/@placeholder-detail]/@rank &gt;= $Rank[name()=name(current())]/@rank)">1</xsl:when>
+			<xsl:when test="not(/SystemDefinition/@detail-type='fixed')"><xsl:if test="self::component">1</xsl:if></xsl:when>  
+			<xsl:when test="name()=/SystemDefinition/@detail">1</xsl:when>
+		</xsl:choose>
+	</xsl:for-each>
+</xsl:template>
+
+ <xsl:template match="/" mode="my-legend">
+ 	<!-- height="9" width="17" -->
+	<s:text text-anchor="end" dy="0.375em" class="label" x="3" y="3" width="5">Uses</s:text>
+	<s:text text-anchor="end" dy="0.375em" class="label" x="3" y="6" width="5">Used by</s:text>
+	<s:path d="M 4 3 L 14 3" class="arrow" style="stroke-width:0.3!important"/>
+	<s:path d="M 4 6 L 14 6" class="arrowF" style="stroke-width:0.3!important"/>
+	
+	<!-- add at some point:
+	<text text-anchor="end" dy="0.375em" class="label" x="24" y="1.5" >Binary</text>
+	<text text-anchor="end" dy="0.375em" class="label" x="24" y="4.5" >API</text>
+	<text text-anchor="end" dy="0.375em" class="label" x="24" y="7.5" >ECom</text>
+	<path d="M 26 1.5 L 36 1.5" class="arrow" style="stroke-width:0.3!important"/>
+	<path d="M 26 4.5 L 36 4.5" class="arrow api" style="stroke-width:0.3!important"/>
+	<path d="M 26 7.5 L 36 7.5" class="arrow ecom" style="stroke-width:0.3!important"/>
+		-->
+ </xsl:template>
+
+<xsl:template match="*" mode="my-defs">
+	<xsl:variable name="width">
+			<xsl:choose>
+			<xsl:when test="/SystemDefinition/@detail='layer'">4.8</xsl:when>
+			<xsl:when test="/SystemDefinition/@detail='package'">2.4</xsl:when>
+			<xsl:when test="/SystemDefinition/@detail='subblock'">1.2</xsl:when>
+			<xsl:when test="/SystemDefinition/@detail='collection'">0.6</xsl:when>
+			<xsl:otherwise>0.3</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+    <s:defs>
+    <s:marker id="Triangle"
+      viewBox="-1 -1 7 7" refX="5" refY="2" 
+      markerUnits="strokeWidth"
+      markerWidth="6" markerHeight="6"
+      orient="auto">
+      <s:polygon style="fill:black;stroke:black;" points="0,0 5,2 0,4 0,0"/>
+    </s:marker>
+    <s:marker id="TriangleF"
+      viewBox="-1 -1 7 7" refX="0" refY="2" 
+      markerUnits="strokeWidth"
+      markerWidth="6" markerHeight="6"
+      orient="auto">
+      <s:polygon style="fill:blue;stroke:blue;" points="5,0 5,4 0,2 5,0"/>
+    </s:marker>
+  <s:style type="text/css">
+	path.arrow {
+		marker-end: url(#Triangle);
+		fill:none;stroke: black;
+		stroke-width: 0.3px;
+	}
+	path.arrowF {
+		marker-start: url(#TriangleF);
+		fill:none;stroke: blue;
+		stroke-width: 0.3px;		
+	}
+	path.collection  {
+		stroke-width: 0.6px;	
+	}
+	path.package  {
+		stroke-width: 2.4px;	
+	}
+	path.layer  {
+		stroke-width: 4.8px;	
+	}
+	path.api {
+		stroke-dasharray: 2,1;
+	}
+	path.ecom {
+		stroke-dasharray: 0.1,2;
+		stroke-linecap: round;
+	}
+</s:style>
+  </s:defs>
+</xsl:template>
+ 
+<xsl:template name="lower-rank"><xsl:param name="e1"/><xsl:param name="e2"/>
+	<xsl:variable name="rank"> 
+		<xsl:choose>
+			<xsl:when test="$Rank[name()=$e1]/@rank &gt; $Rank[name()=$e2]/@rank">
+				<xsl:value-of select="$e1"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="$e2"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:if test="$rank!='component'">
+		<xsl:value-of select="concat(' ',$rank)"/>
+	</xsl:if>
+</xsl:template>
+ 
+ <xsl:template match="s:g" mode="my-overlay"><xsl:param name="id"/>
+ 	<!--  this is far more hacky than I'd like. Better to use a mechanism like the $used below-->
+	<xsl:variable name="libs">	<xsl:text> </xsl:text>
+ 		<xsl:for-each select="document($Data,/)/*">
+			<xsl:variable name="detail" select="/SystemDefinition/@detail"/>
+			<xsl:for-each select="key('Id',$id)/meta[@rel='Dependencies' and (@type='generic' or not(@type))]/dep">
+				<xsl:variable name="d" select="."/>
+				<xsl:for-each select="key('Id',@ref)/ancestor-or-self::*[name()=$detail]">
+					<xsl:value-of select="concat(@id,'&#9;',$d/@type,'&#9;',name(),' ')"/>
+				</xsl:for-each>
+				<xsl:for-each select="key('Id',@ref)[not(ancestor-or-self::*[name()=$detail])]">
+					<xsl:value-of select="concat(@id,'&#9;',$d/@type,'&#9;',name(),' ')"/>
+				</xsl:for-each>
+			</xsl:for-each>
+		</xsl:for-each>
+	</xsl:variable>
+	<xsl:variable name="pos">
+		<xsl:apply-templates select="." mode="item-pos"/>
+	</xsl:variable>
+	<xsl:variable name="h">
+		<xsl:apply-templates select="." mode="height"/>
+	</xsl:variable>
+	<xsl:variable name="w">
+		<xsl:apply-templates select="." mode="item-width"/>
+	</xsl:variable>
+	<xsl:variable name="e"><xsl:for-each select="document($Data,/)/*">
+		<xsl:value-of select="name(key('Id',$id))"/></xsl:for-each>
+	</xsl:variable>
+	<xsl:for-each select="//s:g[contains($libs,concat(' ',@id,'&#9;')) and @id!=$id]">
+		<xsl:variable name="type" select="substring-before(substring-after($libs,concat(' ',@id,'&#9;')),'&#9;')"/>
+		<xsl:variable name="this" select="substring-before(substring-after(substring-after($libs,concat(' ',@id,'&#9;')),'&#9;'),' ')"/>
+		<xsl:call-template name="draw-line">
+			<xsl:with-param name="class">
+				<xsl:text>arrow</xsl:text>
+				<xsl:if test="$type!='' and $type!='bin'">
+					<xsl:value-of select="concat(' ',$type)"/>
+				</xsl:if>
+				<xsl:call-template name="lower-rank">
+					<xsl:with-param name="e1" select="$e"/>
+					<xsl:with-param name="e2" select="substring-before(substring-after(substring-after($libs,concat(' ',@id,'&#9;')),'&#9;'),' ')"/>
+				</xsl:call-template>
+			</xsl:with-param>
+			<xsl:with-param name="h0" select="$h"/>
+			<xsl:with-param name="w0" select="$w"/>
+			<xsl:with-param name="origin" select="$pos"/>
+			<xsl:with-param name="end"><xsl:apply-templates select="." mode="item-pos"/></xsl:with-param>
+			<xsl:with-param name="h1"><xsl:apply-templates select="." mode="height"/></xsl:with-param>
+			<xsl:with-param name="w1"><xsl:apply-templates select="." mode="item-width"/></xsl:with-param>
+		</xsl:call-template>
+	</xsl:for-each>	
+
+	<xsl:variable name="used" select="document($Data,/)//*[name()=/SystemDefinition/@detail]/meta[@rel='Dependencies' and (@type='generic' or not(@type))]/dep[@ref=$id]"/>
+	<xsl:for-each select="//s:g[@id=$used/../../@id and @id!=$id]">
+		<xsl:call-template name="draw-line">
+			<xsl:with-param name="class">
+				<xsl:text>arrowF</xsl:text>
+				<xsl:for-each select="$used[@type and @type!='bin' and ../../@id=current()/@id]">
+					<xsl:value-of select="concat(' ',@type)"/>  
+				</xsl:for-each>
+				<xsl:call-template name="lower-rank">
+					<xsl:with-param name="e1" select="$e"/>
+					<xsl:with-param name="e2" select="name($used[../../@id=current()/@id]/../..)"/>
+				</xsl:call-template>
+			</xsl:with-param>
+			<xsl:with-param name="h0" select="$h"/>
+			<xsl:with-param name="w0" select="$w"/>
+			<xsl:with-param name="origin" select="$pos"/>
+			<xsl:with-param name="end"><xsl:apply-templates select="." mode="item-pos"/></xsl:with-param>
+			<xsl:with-param name="h1"><xsl:apply-templates select="." mode="height"/></xsl:with-param>
+			<xsl:with-param name="w1"><xsl:apply-templates select="." mode="item-width"/></xsl:with-param>
+		</xsl:call-template>
+	</xsl:for-each>	
+
+ </xsl:template>
+ 
+<!-- drawing lines follows -->
+ 
+ <xsl:template name="draw-line"><xsl:param name="origin"/><xsl:param name="end"/><xsl:param name="class"/>
+ 	<xsl:param name="h0"/><xsl:param name="h1"/>
+	<xsl:param name="w0"/><xsl:param name="w1"/>
+ 		<xsl:variable name="x0" select="substring-before($origin,',')"/>
+		<xsl:variable name="y0" select="substring-after($origin,',')"/>
+		<xsl:variable name="x1" select="substring-before($end,',')"/>
+		<xsl:variable name="y1" select="substring-after($end,',')"/>
+		<xsl:variable name="dx" select="$x1 - $x0"/>
+		<xsl:variable name="dy" select="$y1 - $y0"/>
+		<xsl:variable name="sgnY" select="($y1 &gt; $y0) * 2 - 1"/>
+		<xsl:variable name="sgnX" select="($x1 &gt; $x0) * 2 - 1"/>
+		<xsl:if test="contains(substring-after($origin,','),',')">/<xsl:value-of select="$origin"/>/</xsl:if>
+
+		<s:path class="{$class}"><xsl:attribute name="d">
+			<xsl:choose>
+				<xsl:when test="$dy=0">
+					<xsl:call-template name="draw-curve">
+						<xsl:with-param name="origin" select="$origin"/>
+						<xsl:with-param name="end" select="$end"/>			
+						<xsl:with-param name="h0" select="$h0"/>
+						<xsl:with-param name="h1" select="$h1"/>
+						<xsl:with-param name="w0" select="$w0"/>
+						<xsl:with-param name="w1" select="$w1"/>
+					</xsl:call-template>
+				</xsl:when>	
+				<xsl:when test="$dx=0">
+					<xsl:call-template name="draw-vcurve">
+						<xsl:with-param name="origin" select="$origin"/>
+						<xsl:with-param name="end" select="$end"/>
+						<xsl:with-param name="h0" select="$h0"/>			
+						<xsl:with-param name="h1" select="$h1"/>															
+						<xsl:with-param name="w0" select="$w0"/>
+						<xsl:with-param name="w1" select="$w1"/>
+					</xsl:call-template>
+				</xsl:when>	
+				<xsl:otherwise>
+					<xsl:text>M</xsl:text>
+				<xsl:choose>
+						<xsl:when test="$dx &gt; 0 and (($dy &gt; 0 and ($dx * $h0 &gt;= $dy* $w0)) or ($dy &lt;= 0 and ($dx * $h0 &gt;= -$dy* $w0)))">
+							<!-- crop against E side of origin  -->
+							<xsl:variable name="y-off" select="$w0 * 0.5 * $dy div $dx "/>
+							<xsl:value-of select="concat($x0 + 0.5 * $w0,',',$y0 + $y-off)"/>
+						</xsl:when>	
+						<xsl:when test="$dy &gt; 0 and (($dx &gt;= 0 and $dx * $h0 &lt; $dy * $w0) or ($dx &lt;= 0 and -$dx * $h0 &lt; $dy* $w0))"> <!-- and dx < dy  -->
+							<!-- crop against S side of origin  -->
+							<xsl:variable name="x-off" select="$h0 * 0.5 * $dx div $dy"/>
+						 	<xsl:value-of select="concat($x0 +  $x-off, ',' ,$y0 + 0.5 * $h0)"/>
+						</xsl:when>	
+						<xsl:when test="$dy &lt; 0 and (($dx &gt;= 0 and $dx * $h0 &lt; -$dy* $w0) or ($dx &lt;= 0 and -$dx * $h0 &lt; -$dy* $w0))">
+							<!-- crop against N side of origin  -->
+							<xsl:variable name="x-off" select="- $h0 * 0.5 * $dx div $dy"/>
+						 	<xsl:value-of select="concat($x0 +  $x-off, ',' ,$y0 - 0.5 * $h0 )"/>
+						</xsl:when>
+						<xsl:otherwise>
+							<!-- crop against W side or origin -->
+							<xsl:variable name="y-off" select=" - $w0 * 0.5 * $dy div $dx "/>
+							 <xsl:value-of select="concat($x0 - 0.5 * $w0,',',$y0 + $y-off)"/>
+						</xsl:otherwise>
+					</xsl:choose>
+					<xsl:text>L </xsl:text>
+					<xsl:choose>
+						<xsl:when test="$dx &gt; 0 and (($dy &gt; 0 and ($dx * $h1 &gt;= $dy* $w1)) or ($dy &lt;= 0 and ($dx * $h1 &gt;= -$dy* $w1)))">
+							<!-- crop against W side of end  -->
+							<xsl:value-of select="concat($x1 - 0.5 * $w1,',',$y0 + ($dx - 0.5 * $w1) * $dy div $dx)"/>
+						</xsl:when>	
+						<xsl:when test="$dy &gt; 0 and (($dx &gt;= 0 and $dx * $h1 &lt; $dy * $w1) or ($dx &lt;= 0 and -$dx * $h1 &lt; $dy* $w1))"> <!-- and dx < dy  -->
+							<!-- crop against N side of end -->
+							<xsl:value-of select="concat($x0 + ($dy - 0.5 * $h1) * $dx div $dy , ',' , $y1 - 0.5 * $h1)"/>
+						</xsl:when>	
+						<xsl:when test="$dy &lt; 0 and (($dx &gt;= 0 and $dx * $h1 &lt; -$dy* $w1) or ($dx &lt;= 0 and -$dx * $h1 &lt; -$dy* $w1))">
+							<!-- crop against S side of end -->
+							<xsl:value-of select="concat($x0 + ($dy + 0.5 * $h1) * $dx div $dy , ',' , $y1 + 0.5 * $h1)"/>
+						</xsl:when>
+						<xsl:otherwise>
+							<!-- crop against E side of end -->
+							<xsl:value-of select="concat($x1 + 0.5 * $w1,',',$y0 + ($dx + 0.5 * $w1) * $dy div $dx)"/>
+						</xsl:otherwise>
+					</xsl:choose>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:attribute>
+	</s:path>
+</xsl:template>
+
+ <xsl:template name="draw-curve"><xsl:param name="origin"/><xsl:param name="end"/><xsl:param name="class"/>
+	  	<xsl:param name="h0"/><xsl:param name="h1"/>
+	  	<xsl:param name="w0"/><xsl:param name="w1"/>
+	<xsl:variable name="x0" select="substring-before($origin,',')"/>
+	<xsl:variable name="y0" select="substring-after($origin,',')"/>
+	<xsl:variable name="x1" select="substring-before($end,',')"/>
+	<xsl:variable name="y1" select="substring-after($end,',')"/>
+	<xsl:variable name="dx" select="$x1 - $x0"/>
+	<xsl:variable name="up" select="floor($dx) mod 2 != 0"/> <!-- line is above or below componetns -->
+	<xsl:variable name="sgn" select="($dx &gt; 0 ) * 2  - 1"/>	
+	<!-- offset the x-coord so that if the components are next to each other the connection is from nearer the edge of the side
+		and if they're very far apart  the connection's closer to the centre of the side. This way the centre of the edge is not too busy 
+		(x-off approches zero as length goes to infiniity)-->
+	<xsl:variable name="x-off" select="0.25 * $sgn * $w0 * $w0 div ($sgn * $dx)"/>	
+	<xsl:value-of select="concat('M',$x0 +  $x-off,',')"/>
+	<xsl:choose>
+		<xsl:when test="($up and ($x1 &gt; $x0)) or (not($up) and ($x1 &lt; $x0)) "><xsl:value-of select="$y0 + (0.5*$h0)"/>c</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$y0 - (0.5*$h0)"/>c</xsl:otherwise>
+	</xsl:choose>
+	<xsl:variable name="peak">
+		<xsl:choose> <!--  don't think i need the 0.5 * h0 -->
+			<xsl:when test="$up"><xsl:value-of select="$sgn * (0.5 * $h0 + ($sgn * $dx div 8))"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="- $sgn * (0.5 * $h0 + ($sgn * $dx div 8))"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:variable name="x-off2" select="0.25 * $sgn * $w1 * $w1 div ($sgn * $dx)"/>	
+	<xsl:value-of select="concat(($dx   -  $x-off * 2) div 3 , ', ', $peak,' ',$dx  -  $x-off * 2 ,',', 2 * $peak, ' ',$dx -  $x-off2 * 2,',0')"/>
+</xsl:template>
+
+ <xsl:template name="draw-vcurve"><xsl:param name="origin"/><xsl:param name="end"/><xsl:param name="class"/>
+	<xsl:param name="h0"/><xsl:param name="h1"/>
+	<xsl:param name="w0"/><xsl:param name="w1"/>
+	<xsl:variable name="x0" select="substring-before($origin,',')"/>
+	<xsl:variable name="y0" select="substring-after($origin,',')"/>
+	<xsl:variable name="x1" select="substring-before($end,',')"/>
+	<xsl:variable name="y1" select="substring-after($end,',')"/>
+	<xsl:variable name="dy" select="$y1 - $y0"/>
+	<xsl:variable name="left" select="floor($dy) mod 2 != 0"/> <!-- line is above or below componetns -->
+	<xsl:variable name="sgn" select="($dy &gt; 0 ) * 2  - 1"/>	
+	<!-- offset the y-coord so that if the components are next to each other the connection is from nearer the edge of the side
+		and if they're very far apart  the connection's closer to the centre of the side. This way the centre of the edge is not too busy 
+		(y-off approches zero as length goes to infiniity)-->
+	<xsl:variable name="y-off" select="0.25 * $sgn * $h0 * ($h0 +$h1) div ($sgn * $dy)"/>	
+	
+	<xsl:text>M</xsl:text>
+	<xsl:choose>
+		<xsl:when test="($left and ($y1 &gt; $y0)) or (not($left) and ($y1 &lt; $y0)) "><xsl:value-of select="$x0 + (0.5*$w0)"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$x0 - (0.5*$w0)"/></xsl:otherwise>
+	</xsl:choose>
+	<xsl:text>,</xsl:text>
+	<xsl:value-of select="$y0 +  $y-off"/>
+	
+	<xsl:text>c</xsl:text>
+	<xsl:variable name="y-off1" select="0.25 * $sgn * $h1 * ($h0 +$h1) div ($sgn * $dy)"/>	
+	<xsl:variable name="peak"><!--  don't think i need the 0.5 * Size -->
+		<xsl:choose>
+			<xsl:when test="$left"><xsl:value-of select="$sgn * (0.5 * $w0 + ($sgn * $dy div 8))"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="- $sgn * (0.5 * $w0 + ($sgn * $dy div 8))"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:value-of select="concat($peak, ', ', ($dy  -  $y-off1 - $y-off) div 3 , ' ' , 2 * $peak, ' ',$dy  -  $y-off1 - $y-off , ' 0,',$dy -  $y-off1 - $y-off)"/>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/makeabbrev.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,200 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="exslt" >
+	<xsl:param name="dict"/> <!--  the dictionary file -->
+	<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) -->
+	<xsl:variable name="d" select="document($dict,/)/dict/word"/>
+
+<xsl:variable name="WordCut" select="10"/>
+<xsl:variable name="Cut" select="22"/>
+<xsl:variable name="Cut2" select="25"/>
+
+<xsl:template match="*" priority="-1"><xsl:apply-templates select="*|@href"/></xsl:template>
+
+<xsl:template match="@href">
+	<xsl:apply-templates select="document(.,.)/SystemDefinition/*"/>
+</xsl:template>
+
+<xsl:template match="meta/@href"/>
+
+<xsl:template match="/*" priority="1">
+<display-names><xsl:apply-templates select="*"/>
+</display-names>
+</xsl:template>
+
+<xsl:template match="/model/*" priority="5"/>
+<xsl:template match="/model/sysdef" priority="5">
+	<xsl:apply-templates select="@href"/>
+</xsl:template>
+<xsl:template match="/model/layout" priority="5">
+	<xsl:if test="$include">
+		<xsl:copy-of select="document(info[@type='abbrev']/@href,.)/display-names/*"/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="*[@name]">
+	<xsl:variable name="list">
+		<xsl:call-template name="wordlist"/>
+	</xsl:variable>
+	<xsl:variable name="w">
+		<xsl:apply-templates select="exslt:node-set($list)/w" mode="word"/>
+	</xsl:variable>
+	<xsl:variable name="v">
+		<xsl:call-template name="print">
+		<xsl:with-param name="words" select="exslt:node-set($w)"/>
+		</xsl:call-template>
+	</xsl:variable>
+	
+	<xsl:variable name="txt" >
+		<xsl:call-template name="breaks">
+			<xsl:with-param name="text">
+				<xsl:choose>
+					<xsl:when test="string-length($v) &gt; $Cut"> <!-- too long total, use abbreviation instead of display form, starting from the end -->
+						<xsl:variable name="w2">
+							<xsl:apply-templates select="exslt:node-set($w)/w[last()]" mode="pass2"/>
+						</xsl:variable>
+						<xsl:variable name="v2">
+							<xsl:call-template name="print">
+							<xsl:with-param name="words" select="exslt:node-set($w2)"/>
+							</xsl:call-template>
+						</xsl:variable>
+						<xsl:choose>
+							<xsl:when test="string-length($v2) &gt; $Cut2">
+								<xsl:variable name="w3">
+									<xsl:apply-templates select="exslt:node-set($w2)/w[last()]" mode="pass2">
+										<xsl:with-param name="at">s</xsl:with-param>
+									</xsl:apply-templates>
+								</xsl:variable>
+								<xsl:call-template name="print">
+									<xsl:with-param name="words" select="exslt:node-set($w3)"/>
+								</xsl:call-template>
+							</xsl:when>
+							<xsl:otherwise>
+								<xsl:value-of select="$v2"/>
+							</xsl:otherwise>
+						</xsl:choose>
+					</xsl:when>
+					<xsl:when test="$v != '' and $v != @name">
+						<xsl:value-of select="$v"/>
+					</xsl:when> 
+				</xsl:choose>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	
+	<xsl:if test="$txt != '' and $txt != @name">
+		<abbrev name="{@name}" abbrev="{$txt}"/>
+	</xsl:if>
+	
+	<xsl:apply-templates select="@href|*"/>
+</xsl:template>
+
+<xsl:template name="print">
+	<xsl:param name="words"/>
+	<xsl:apply-templates select="$words/w" mode="print"/>
+</xsl:template>
+
+
+
+<xsl:template mode="print" match="w">
+	<xsl:value-of select="@use"/>
+	<xsl:if test="not(@use)">
+		<xsl:value-of select="."/>
+	</xsl:if>
+	<xsl:if test="following-sibling::w">
+		<xsl:text> </xsl:text>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="layer[string-length(@id) &lt; 10]" priority="2"><!-- don't abbreviate short layer names -->
+	<xsl:apply-templates select="*"/>
+</xsl:template>
+
+<xsl:template mode="word" match="w">
+	<xsl:variable name="match" select="$d[@term=current()]"/>
+	<xsl:copy>
+	<xsl:choose>
+		<xsl:when test="(string-length(.) &gt; $WordCut) and $match/@abbrev">
+			<xsl:attribute name="use">
+			<xsl:value-of select="$match/@abbrev"/>
+			</xsl:attribute>
+		</xsl:when>
+		<xsl:when test="$match/@d">
+		<xsl:attribute name="use">
+			<xsl:value-of select="$match/@d"/>
+			</xsl:attribute>
+		</xsl:when>
+	</xsl:choose>
+	<xsl:value-of select="."/>
+	</xsl:copy>
+</xsl:template>
+
+
+
+<xsl:template name="wordlist">
+	<xsl:param name="words" select="normalize-space(@name)"/>
+<w>
+		<xsl:choose>
+			<xsl:when test="contains($words,' ')">
+				<xsl:value-of select="substring-before($words,' ')"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="$words"/>
+			</xsl:otherwise>
+		</xsl:choose>
+</w>
+	<xsl:if test="contains($words,' ')">
+		<xsl:call-template name="wordlist">
+			<xsl:with-param name="words" select="substring-after($words,' ')"/>
+		</xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="w" mode="pass2"> <!-- 2nd pass -->
+	<xsl:param name="len" select="0"/>
+	<xsl:param name="at">abbrev</xsl:param>
+	<xsl:variable name="match" select="$d[@term=current()]"/>
+	<xsl:variable name="cur">
+		<xsl:copy>
+			<xsl:choose>
+				<xsl:when test="$match/@*[name()=$at]">
+					<xsl:attribute name="use">
+						<xsl:value-of select="$match/@*[name()=$at]"/>
+					</xsl:attribute>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:copy-of select="@use"/>
+				</xsl:otherwise>
+			</xsl:choose>
+			<xsl:value-of select="."/>
+		</xsl:copy>
+	</xsl:variable>
+	
+	<xsl:variable name="mytxt">
+		<xsl:value-of select="exslt:node-set($cur)/w"/>
+	</xsl:variable>
+
+	<xsl:variable name="prev"> <!--  unprocessed text -->
+		<xsl:apply-templates select="preceding-sibling::w" mode="print"/>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="string-length($prev) + string-length($mytxt) +$len &lt;= $Cut"> <!--  shrunk all that's needed. just output the words -->
+			<xsl:copy-of select="preceding-sibling::w"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates select="preceding-sibling::w[1]" mode="pass2">
+				<xsl:with-param name="len" select="string-length($mytxt) +$len"/> 
+				<xsl:with-param name="at" select="$at"/>
+			</xsl:apply-templates>
+		</xsl:otherwise>
+	</xsl:choose>
+	<xsl:copy-of select="$cur"/>
+</xsl:template>
+
+
+<xsl:template name="breaks"><xsl:param name="text"/>
+<xsl:value-of select="$text"/>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/output-csv.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,124 @@
+<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" 
+	exclude-result-prefixes="set exslt"
+	xmlns:exslt="http://exslt.org/common"
+	xmlns:set="http://exslt.org/sets">
+	<output method="text"/>
+	<!-- 
+	tech_domain,layer,package,collection,component,old_layer,old_package<value-of select="$atts"/>
+	Foundation Tech Domain,Foundation layer,Foundation package,Foundation collection,Component,Layer,Domain,Subsystem<value-of select="$atts"/>
+	-->
+	<variable name="default-atts">layer,package,collection,component</variable>
+	<param name="atts">
+		<value-of select="$default-atts"/>
+		<call-template name="all-atts"/>
+	</param>
+	<param name="labels"><if test="starts-with($atts,$default-atts)">Layer,Package,Collection,Component</if></param>
+	
+
+<key name="tech" match="group[@type='color']/cbox" use="@style-id"/>
+  
+  
+  <template name="all-atts">
+  <variable name="all">
+  	<apply-templates select="//layer/@* | //package/@*| //collection/@*| //component/@*" mode="atts">
+			<sort select="name()"/>
+		</apply-templates>
+	</variable>
+	<for-each select="set:distinct(exslt:node-set($all)/*/@v)">
+		<sort select="."/>,<value-of select="."/>
+	</for-each>
+  </template>
+  
+<template name="labels"><param name="at" select="$atts"/><param name="label" select="$labels"/>
+	<variable name="At">
+		<choose>
+			<when test="contains($at,',')"><value-of select="substring-before($at,',')"/></when>
+			<otherwise><value-of select="$at"/></otherwise>
+		</choose>
+	</variable>
+	<variable name="Lab">
+		<choose>
+			<when test="contains($label,',')"><value-of select="substring-before($label,',')"/></when>
+			<otherwise><value-of select="$label"/></otherwise>
+		</choose>
+	</variable>
+	<choose>
+		<when test="not(contains($at,',')) and $Lab!=''"><value-of select="$Lab"/></when> <!-- at end of list, use label  -->
+		<when test="not(contains($at,','))"><value-of select="$At"/></when><!-- at end of list-->
+		<when test="$Lab!=''">
+			<value-of select="$Lab"/><text>,</text>
+			<call-template name="labels">
+				<with-param name="at" select="substring-after($at,',')"/>
+				<with-param name="label" select="substring-after($label,',')"/>
+			</call-template>
+		</when>
+		<otherwise>
+			<value-of select="$At"/><text>,</text>
+			<call-template name="labels">
+				<with-param name="at" select="substring-after($at,',')"/>
+				<with-param name="label" select="substring-after($label,',')"/>
+			</call-template>
+		</otherwise>
+	</choose>
+</template>
+  
+<template match="/SystemDefinition"><call-template name="labels"/>
+	<text>&#xa;</text>
+ <apply-templates select="systemModel/layer//component"/>
+</template> 
+
+<template match="component">
+	<call-template name="others"/>
+	<text>&#xa;</text>
+</template> 
+
+<template match="*" mode="name"><apply-templates select="@id" mode="name"/></template>
+<!-- <template match="@*" mode="name">"<value-of select="."/>"</template>
+<template match="@*[contains(.,',')]" mode="name" priority="9">"<value-of select="."/>"</template>
+-->
+<template match="@*" mode="name" priority="7">"<value-of select="."/>"</template>
+<template match="@*[not(contains(.,','))]" mode="name" priority="8"><value-of select="."/></template>
+
+<template match="@*" mode="atts" priority="-1">
+	<element name="a"><attribute name="v"><value-of select="name()"/></attribute></element>
+</template>
+
+<!--template match="@name|@old_layer|@old_package|@id|@abbrev|@plugin|@introduced|@span|@levels|@level|@tech_domain|@platform_optional|@reason" mode="atts"/-->
+<template match="@name|@abbrev|@id" mode="atts"/>
+
+<template name="others"><param name="at" select="$atts"/>
+	<variable name="a">
+		<choose>
+			<when test="contains($at,',')"><value-of select="substring-before($at,',')"/></when>
+			<otherwise><value-of select="$at"/></otherwise>
+		</choose>
+	</variable>
+	<choose>
+		<when test="$a='module' and @module"><apply-templates select="@module" mode="name"/></when>
+		<when test="$a='module'"><apply-templates select="ancestor::package[1]" mode="name"/></when>
+		<when test="$a='layer'"><apply-templates select="ancestor::layer" mode="name"/></when>
+		<when test="$a='package'"><apply-templates select="ancestor::package" mode="name"/></when>
+		<when test="$a='subpackage'"><apply-templates select="ancestor::package/package" mode="name"/></when>
+		<when test="$a='collection'"><apply-templates select="ancestor::collection" mode="name"/></when>
+		<when test="$a='component'"><apply-templates select="." mode="name"/></when>
+		<when test="$a='old_component'"><if test="@old_component!=@name"><apply-templates select="@old_component" mode="name"/></if></when>
+		<when test="$a='tech_domain' or $a='tech-domain'">"<value-of select="ancestor::package/@tech-domain"/>"</when>
+		<when test="$a='level'"><value-of select="ancestor-or-self::collection/@level"/></when>
+		<when test="$a='levels'">"<value-of select="ancestor-or-self::package/@levels"/>"</when>
+		<when test="$a='layer-levels'">"<value-of select="ancestor-or-self::layer/@levels"/>"</when>
+		<when test="$a='package-level'"><value-of select="ancestor-or-self::package/@level"/></when>
+		<when test="contains(concat($a,'&#xa;'),'-name&#xa;')"><apply-templates mode="name" select="ancestor-or-self::*[name()=substring-before($a,'-')]/@name"/></when>
+		<when test="@*[name()=$a]"><apply-templates select="@*[name()=$a]" mode="name"/></when>
+		<when test="ancestor::collection/@*[name()=$a]"><apply-templates select="ancestor::collection/@*[name()=$a]" mode="name"/></when>
+		<when test="ancestor::package/@*[name()=$a]"><apply-templates select="ancestor::package/@*[name()=$a]" mode="name"/></when>
+		<otherwise><apply-templates select="ancestor::layer/@*[name()=$a]" mode="name"/></otherwise>
+	</choose>
+	<if test="contains($at,',')">
+		<text>,</text>
+		<call-template name="others">
+			<with-param name="at" select="substring-after($at,',')"/>
+		</call-template>
+	</if>
+</template>
+
+</stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/output-sysdef.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,43 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+	<xsl:output method="xml" indent="yes"/>
+<!-- strip out build-related stuff and just leave the model + added attributes -->
+
+<xsl:param name="everything" select="1"/>
+
+<xsl:template match="@*">
+	<xsl:if test="$everything">
+		<xsl:copy-of select="."/>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="unit|@id|@name|@href|@before|layer/@levels|package/@levels | layer/@span | package/@span |
+	package/@version | package/@tech-domain | @level | 
+	 component/@deprecated |   component/@introduced|   component/@target  |   component/@purpose |  component/@class |  component/@filter | component/@origin-model ">
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+
+<xsl:template match="meta"/> <!-- should make conditional based on param -->
+
+<xsl:template match="layer|package|collection|component">
+	<xsl:copy>
+		<xsl:apply-templates select="@*"/>
+		<xsl:apply-templates select="*"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="SystemDefinition">
+	<xsl:copy><xsl:copy-of select="@schema|@id-namespace"/>
+		<xsl:apply-templates select="systemModel | layer | package | collection | component"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="systemModel">
+	<xsl:copy><xsl:copy-of select="@name"/>
+	<xsl:apply-templates select="layer|meta"/>
+	</xsl:copy>
+</xsl:template>
+
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/postprocess.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,332 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+	<xsl:output method="xml"/>
+	<xsl:param name="Data"/> <!-- The data to be overlayed onto the SVG model -->
+	<xsl:param name="Prefix"><xsl:apply-templates select="/" mode="my-prefix"/></xsl:param> <!-- The prefix for the ID, in case the plain ID is already taken -->
+	<xsl:param name="Event"><xsl:apply-templates select="/" mode="my-event"/></xsl:param> <!-- The behaviour for opening the ID section: click, popup, or mouseover. 'click' will display the group when the component is clicked. 'popup' will display the group when the component is moved over, with only one group showing at a time. 'mouseover' will display the group only when the mouse is over the component. -->
+	 <xsl:key name="id" match="s:g" use="@id"/> <!-- find id of only groups -->
+
+<!-- should override the following:
+
+	<xsl:template match="*" mode="my-script"/>	for any custom scripts (called on root node in $Data)
+	<xsl:template match="*" mode="my-defs"/>	for any custom defs (styles, shapes, etc)  (called on root node in $Data)
+	 <xsl:template match="/" mode="my-legend"/>	for any additional legend areas (called on the top-level document in $Data)
+ 	<xsl:template match="*" mode="my-release-version"/>	for custom release version text (called on tspan element containing text)
+	<xsl:template match="s:g" mode="my-overlay"><xsl:with-param name="id"/> 	the content of the group to be displayed on an event
+	<xsl:template match="/" mode="my-prefix"/>		in case the plain ID is taken, this prefix can be applied to the new groups (called on the top-level document in SVG model)
+	<xsl:template match="/" mode="my-event"/>	events can be popup, click or mouseover (the default). Also can be set by parameter
+	<xsl:template match="*" mode="is-present"><xsl:param name="id"/>	return '1' if component with $id exists, or leave empty if not
+-->
+
+<!-- no custom scripts or defs by default -->
+<xsl:template match="*" mode="my-script"/>
+<xsl:template match="*" mode="my-defs"/>
+
+ <xsl:template match="/" mode="my-legend"/> <!-- no new legend -->
+ <xsl:template match="*" mode="my-release-version"><xsl:value-of select="."/> </xsl:template> <!-- just use existing text -->
+
+<xsl:template match="*" mode="my-overlay"/>	<!-- no content by default -->
+<xsl:template match="*" mode="my-content"/>	<!-- no content by default -->
+<xsl:template match="/" mode="my-prefix">o-</xsl:template>	<!-- "o-" prefix by default -->
+<xsl:template match="/" mode="my-additional-content"/>	<!-- no content by default -->
+
+<xsl:template match="/" mode="my-event">mouseover</xsl:template> <!-- default event is mouseover -->
+<xsl:template match="*" mode="is-present"><xsl:param name="id"/></xsl:template> <!-- not present by default -->
+
+<xsl:template match="/" mode="my-valid-items">component collection package layer</xsl:template>
+
+<!-- ======= main code follows ======= -->
+
+ <xsl:template match="/s:svg">
+ 	<s:svg><xsl:apply-templates select="@*|node()"/>
+		<xsl:apply-templates select="//s:g[@id and ancestor-or-self::s:g[@class='collection' or @class='package' or @class='layer']]" mode="overlay"/>
+		<xsl:apply-templates select="/" mode="my-additional-content"/>		
+ 	</s:svg>
+ </xsl:template>
+ 
+ <!-- print custom scripts last -->
+<xsl:template match="s:script[count(following::s:script)=0]">
+	<xsl:copy><xsl:copy-of select="@*|node()"/></xsl:copy>
+	<xsl:variable name="scripts" select="//s:script"/>
+	<xsl:choose>
+		<xsl:when test="$Data!=''">
+			<xsl:apply-templates select="document($Data,/)/*" mode="my-script">
+				<xsl:with-param name="scripts" select="$scripts"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates select="." mode="my-script">
+				<xsl:with-param name="scripts" select="$scripts"/>
+			</xsl:apply-templates>			
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- print custom defs last -->
+<xsl:template match="s:defs[count(following::s:defs)=0]">
+	<xsl:copy><xsl:copy-of select="@*|node()"/></xsl:copy>
+	<xsl:variable name="defs" select="//s:defs"/>
+	<xsl:choose>
+		<xsl:when test="$Data!=''">
+			<xsl:apply-templates select="document($Data,/)/*" mode="my-defs">
+				<xsl:with-param name="defs" select="$defs"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates select="." mode="my-defs">
+				<xsl:with-param name="defs" select="$defs"/>
+			</xsl:apply-templates>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+ <xsl:template match="s:g[(@class='component' or @class='layer-detail' or @class='package' or @class='collection')]">
+	<xsl:variable name="id">
+		<xsl:choose>
+			<xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when>
+			<xsl:when test="@name"><xsl:value-of select="translate(@name,' ','')"/></xsl:when>
+		</xsl:choose>
+	 </xsl:variable>
+  	<xsl:copy>
+	 	<xsl:apply-templates select="@*[name()!='id']"/>
+	 	<xsl:variable name="items"><xsl:apply-templates select="/" mode="my-valid-items"/></xsl:variable>
+		<xsl:variable name="found">
+			<xsl:choose>
+  			<xsl:when test="$Data='' and not(contains(concat(' ',$items,' '),concat(' ',@class,' ')))"/>			
+			<xsl:when test="$Data=''">1</xsl:when>	
+			<xsl:otherwise>
+				<xsl:apply-templates select="document($Data,/)/*" mode="is-present">
+					<xsl:with-param name="id" select="$id"/>
+				</xsl:apply-templates>
+			</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:if test="$id!='' and $found!=''">
+			<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
+		</xsl:if>
+	 	<xsl:choose>
+		 	<xsl:when test="$found='' "/>
+		 	<xsl:when test="$Event='click' ">
+			 	<xsl:attribute name="onclick">on(clear('<xsl:value-of select="concat($Prefix,$id)"/>'))</xsl:attribute>
+		 	</xsl:when>
+		 	<xsl:when test="$Event='popup' ">
+			 	<xsl:attribute name="onmouseover">on(clear('<xsl:value-of select="concat($Prefix,$id)"/>'))</xsl:attribute>
+		 	</xsl:when>
+		 	<xsl:otherwise> 	
+			 	<xsl:attribute name="onmouseover">on('<xsl:value-of select="concat($Prefix,$id)"/>')</xsl:attribute>
+			 	<xsl:attribute name="onmouseout">off('<xsl:value-of select="concat($Prefix,$id)"/>')</xsl:attribute>
+			 </xsl:otherwise>
+		</xsl:choose>
+	<xsl:apply-templates select="node()"/>
+ 	</xsl:copy>
+</xsl:template>
+
+ <xsl:template match="s:g" mode="overlay"> 
+	<xsl:variable name="id" select="@id"/>
+	<xsl:variable name="found">
+		<xsl:apply-templates select="document($Data,/)/*" mode="is-present">
+			<xsl:with-param name="id" select="$id"/>
+		</xsl:apply-templates>
+	</xsl:variable> <!--  no overlay if no data file -->
+	<xsl:if test="$Data!='' and $found!=''">
+		<s:g visibility="hidden" id="{concat($Prefix,$id)}">
+			<xsl:apply-templates select="." mode="my-overlay">
+				<xsl:with-param name="id" select="$id"/>
+			</xsl:apply-templates>
+		</s:g>
+	</xsl:if>
+ </xsl:template>
+ 
+ <xsl:template match="node()|@*">
+ 	<xsl:copy>
+ 	<xsl:apply-templates select="node()|@*"/>
+ 	</xsl:copy>
+</xsl:template>
+
+
+<!-- ====== positions in model ===============-->
+
+
+ <xsl:template match="s:g" mode="item-width">
+	<xsl:choose>
+		<xsl:when test="s:use and not(s:rect)"><xsl:value-of select="s:use[1]/@width"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="s:rect[1]/@width"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+ <xsl:template match="s:g" mode="item-pos">
+	<xsl:choose>
+		<xsl:when test="s:use and not(s:rect)"><xsl:apply-templates select="s:use[1]" mode="position"/></xsl:when>
+		<xsl:otherwise><xsl:apply-templates select="s:rect[1]" mode="position"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+ <xsl:template match="s:g" mode="height">
+	<xsl:choose>
+		<xsl:when test="s:use and not(s:rect)"><xsl:value-of select="s:use[1]/@height"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="s:rect[1]/@height"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="s:rect|s:use" mode="position">
+<xsl:variable name="pos">
+	<xsl:call-template name="sumpos"><xsl:with-param name="list">
+	   <xsl:value-of select="concat(@x,' ',@y)"/> <xsl:apply-templates select="ancestor::s:g[@transform]" mode="position"/>
+	   </xsl:with-param>
+	 </xsl:call-template>
+</xsl:variable>
+	<xsl:value-of select="concat(substring-before($pos, ' ') + @width *0.5 ,',',substring-after($pos, ' ') + @height *0.5 )"/>
+</xsl:template>
+
+<xsl:template match="s:g" mode="position">
+	<xsl:variable name="pos" select="normalize-space(substring-before(substring-after(substring-after(@transform,'translate'),'('),')'))"/>
+	<xsl:choose>
+		<xsl:when test="contains($pos,' ')"> + <xsl:value-of select="$pos"/></xsl:when>
+		<xsl:otherwise> + <xsl:value-of select="$pos"/> 0</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="sumpos"><xsl:param name="list"/>
+	<xsl:variable name="cur" select="normalize-space(substring-before($list,'+'))"/>
+	<xsl:choose>
+		<xsl:when test="$cur=''"><xsl:value-of select="normalize-space($list)"/></xsl:when>
+		<xsl:otherwise>
+			<xsl:variable name="x" select="substring-before($cur,' ')"/>
+			<xsl:variable name="y" select="substring-after($cur,' ')"/>
+			<xsl:variable name="next">
+				<xsl:call-template name="sumpos">
+					<xsl:with-param name="list" select="substring-after($list,'+')"/>
+				</xsl:call-template>
+			</xsl:variable>	
+			<xsl:variable name="x1" select="substring-before($next,' ')"/>
+			<xsl:variable name="y1" select="substring-after($next,' ')"/>
+			<xsl:value-of select="concat($x1 +  $x,' ', $y1 + $y)"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- cleanup empty links -->
+<xsl:template match="s:a">
+	<xsl:choose>
+		<xsl:when test="@*"><xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy></xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates/>	
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!-- ====== legend stuff ===============-->
+
+<xsl:template match="*" mode="legend-ext-width">20</xsl:template>
+ <xsl:template match="s:g[@class='legend']">
+ <xsl:call-template name="insert-legend"><xsl:with-param name="width"><xsl:apply-templates select="." mode="legend-ext-width"/></xsl:with-param>
+ </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="insert-legend"><xsl:param name="width"/>
+	<xsl:copy>
+		<xsl:copy-of select="@*[name()!='transform']"/>
+		<xsl:attribute name="transform">
+			<xsl:value-of select="substring-before(@transform,'(')"/>
+			<xsl:variable name="t" select="normalize-space(substring-after(@transform,'('))"/>
+			<xsl:value-of select="concat('(',substring-before($t,' ') - $width ,' ')"/>
+			<xsl:value-of select="substring-after($t,' ')"/>
+		</xsl:attribute>
+		<xsl:apply-templates mode="insert-legend">
+			<xsl:with-param name="width" select="$width"/>
+ 		</xsl:apply-templates >
+	</xsl:copy>
+</xsl:template>
+
+ <xsl:template match="*" mode="insert-legend"><xsl:copy-of select="."/></xsl:template>
+
+ <xsl:template match="s:text|s:tspan" mode="insert-legend"><xsl:param name="width"/>
+ 	<xsl:copy>
+		<xsl:copy-of select="@*[name()!='x']"/>
+		<xsl:attribute name="x"><xsl:value-of select="@x +  $width"/></xsl:attribute>	
+		<xsl:choose>
+			<xsl:when test="@id='release-version'">
+				<xsl:apply-templates select="." mode="my-release-version"/>
+			 </xsl:when>
+			<xsl:otherwise>
+				<xsl:apply-templates mode="insert-legend"><xsl:with-param name="width" select="$width"/></xsl:apply-templates>
+			</xsl:otherwise>
+		</xsl:choose>	
+	</xsl:copy>
+ </xsl:template>
+ 
+ <xsl:template match="s:rect" mode="insert-legend"><xsl:param name="width"/>
+ 	<xsl:copy>
+		<xsl:copy-of select="@*[name()!='width']"/>
+		<xsl:attribute name="width"><xsl:value-of select="@width +  $width"/></xsl:attribute>	
+		<xsl:copy-of select="*|text()"/>
+	</xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="s:g" mode="insert-legend"><xsl:param name="width"/>
+ 	<xsl:copy><xsl:copy-of select="@*"/>
+		<xsl:apply-templates mode="insert-legend"><xsl:with-param name="width" select="$width"/></xsl:apply-templates>
+	</xsl:copy>
+ </xsl:template>
+ 
+
+ <xsl:template match="s:g[@id='legend-box']/s:g" mode="insert-legend"><xsl:param name="width"/>
+ 	<xsl:copy>
+		<xsl:copy-of select="@*"/>
+		<xsl:apply-templates/>
+		<xsl:if test="$width!=0">
+			<s:g>
+				<xsl:attribute name="transform">translate(<xsl:value-of select="preceding-sibling::s:rect[1]/@width - 5"/>)</xsl:attribute>
+				<xsl:variable name="legend" select="."/>
+				<xsl:choose>
+					<xsl:when test="$Data!=''">
+						<xsl:apply-templates select="document($Data,/)" mode="my-legend">
+							<xsl:with-param name="legend" select="$legend"/>
+						</xsl:apply-templates>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:apply-templates select="/" mode="my-legend">
+							<xsl:with-param name="legend" select="$legend"/>
+						</xsl:apply-templates>			
+					</xsl:otherwise>
+				</xsl:choose>			
+			</s:g>
+		</xsl:if>
+	</xsl:copy>
+ </xsl:template> 
+ 
+<!-- ======= an default implementation for SVG ======= -->
+
+<!-- find all SVG groups with an ID in the model and make them mouse-overs -->
+
+
+<!-- copy all scripts from other SVG -->
+<xsl:template match="/s:svg" mode="my-script"><xsl:copy-of select="//s:script"/></xsl:template>
+
+<!-- copy all defs from other SVG -->
+<xsl:template match="/s:svg" mode="my-defs"><xsl:copy-of select="//s:defs"/></xsl:template>
+
+<!-- position over the component -->
+<xsl:template match="s:g" mode="my-overlay"><xsl:param name="id"/>
+	<xsl:variable name="pos"><xsl:apply-templates select="." mode="item-pos"/></xsl:variable>
+	<xsl:variable name="w"><xsl:apply-templates select="." mode="item-width"/></xsl:variable>
+	<xsl:attribute name="transform">translate(<xsl:value-of select="concat(substring-before($pos,','), ' ',substring-after($pos,',') + $w *0.5)"/>) <xsl:value-of select="@transform"/></xsl:attribute>
+	<xsl:apply-templates select="document($Data,/)/*" mode="my-content">
+		<xsl:with-param name="id" select="$id"/>		
+	</xsl:apply-templates>
+</xsl:template>
+
+ <xsl:template match="/s:svg" mode="my-content"><xsl:param name="id"/>
+ 	<xsl:copy-of select="key('id',$id)"/>
+ </xsl:template>
+ 
+ <xsl:template match="/s:svg" mode="is-present"><xsl:param name="id"/>
+  	<xsl:if test="key('id',$id)">1</xsl:if>
+ </xsl:template>
+
+ 
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/sample_config.ini	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,85 @@
+
+w = 1
+tempdir = z:/work/DepToolkit_Working/deptoolkit_temp
+root = z:/src
+logfile	= z:/work/DepToolkit_Working/deptoolkit_temp/svg_log.txt
+
+# ==== Files or URIs ====
+# All of these take a file name (relative or absolute path) or URI of a data source
+
+# The location of the Model XML file to use to build the file. If this is provided all other non-build control command line and ini options are ignored.
+model = 
+
+# The location of the Shapes XML file used to provide rules to control the display of the components on the model. If not present, default behaviour (in Shapes.xml) is used. This and the default bahaviours are overrriden by using the -color, -border, -pattern, and -style options. 
+shapes = 
+
+# The location of the Localization file used to provide displayable names for the model entities. By default,  the provided "display-names.xml" is used.
+localize = 
+
+# The location of the Levels XML file used to override the stacking of collections. 
+levels = 
+
+# The location of extra component information used to provided additional properies for components.  By default,  the provided "SystemInfo.xml" is used.
+sysinfo = 
+
+# The location of the Dependencies XML file used to draw the depmodel. If not present, dependencies will not be drawn
+deps = 
+
+# The location of the Values XML file used to specify per-component colours. If not present, the default colours are used.
+color = 
+
+# The location of the Values XML file used to specify the shape (border) of each component. If not present, the default borders are used.
+border-shape = 
+
+# The location of the Values XML file used to specify per-component overlay patterns. If not present, the default patterns (for new and reference components) are used.
+pattern = 
+
+# The location of the Values XML file used to specify per-component border styles. If not present, the default border styles are used.
+border-style = 
+
+# ==== Labels ====
+# All of these take a plain text value which is displayed on the model
+  
+# The name of the product described in the model. It appears at the bottom right. Defaults to "Symbian OS"
+name = 
+
+# The version of the product described in the model. It appears at the bottom right after the name. Defaults to "Future"
+version = 
+
+# The label for the model. It appears at the bottom right, under the name. Defaults to "System Model".
+label = 
+
+# The copyright to appear in the lower left. Set to empty string to leave out. Defaults to "[this year] Symbian Software Ltd."
+copyright = 
+
+# One of "draft", "issued", "build" or free-text value. Appears below the model label. If specified this overrides the build number used by depmodel. If not building depmodel, this defaults to "draft"
+model-revision-type = 
+
+# A number which appears before th model-revisino-type.  If specified this overrides the build number used by depmodel. If not building depmodel, this defaults to "1"
+model-revision = 
+
+#Text to appear on the bottom centre to indicate to whom the model can be show. Informational only. Suggested values are "internal", "secret" or "unrestrictred". Not shown if not set.
+distribution = 
+
+# ==== Model Control  ====
+
+# coreos [on/off]	Turn on or off Core OS colouring. Defaults to "off" for  model versions before 9.4
+coreos = on
+
+# sysdef [uri-list]	Comma-separated list of locations for the System Definition XML file(s) used to build the model. Layers in the files will be stacked on top of each other in order, from bottom to top.
+sysdef = 
+
+# filter [list]		Comma-separated list of filters to turn on when building the model. Defaults to "java,gt"
+filter = 
+
+# ignore [list]		Semicolon-separated list of model entities to not draw, in the form "[item-type]:[item-name];...". Defaults to "layer:Tools and Utils and SDKENG;layer:MISC"
+ignore = 
+
+# detail [item-type]	The type of the smallest System Model entity to draw. One of "layer", "logicalset", "logicalsubset", "collection" or "component".  Defaults to "component"		
+detail = 
+
+#page-width [length]	The width of the drawn image (with units). If not specified it will fit the viewer window. Valid units: "in", "mm", "cm", "px", "pt"
+page-width = 
+
+# If present the model will not have any mouseover effects (this is overriden by builing the depmodel).
+static = 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/showdeps.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:s="http://www.w3.org/2000/svg">
+	<xsl:import href="dependencies.xsl"/>	
+	<xsl:output method="xml"/>
+
+ <xsl:template match="s:g" mode="overlay"> 
+	<xsl:variable name="id" select="@id"/>
+	<xsl:variable name="found">
+		<xsl:apply-templates select="document($Data,/)/*" mode="is-present">
+			<xsl:with-param name="id" select="$id"/>
+		</xsl:apply-templates>
+	</xsl:variable> <!--  no overlay if no data file -->
+	<xsl:if test="$Data!='' and $found!=''">
+		<xsl:apply-templates select="." mode="my-overlay">
+			<xsl:with-param name="id" select="$id"/>
+		</xsl:apply-templates>
+	</xsl:if>
+ </xsl:template>
+
+ <xsl:template match="/" mode="my-legend"/>
+ <xsl:template match="*" mode="legend-ext-width">0</xsl:template>
+
+  <xsl:template match="s:g[(@class='component' or @class='layer-detail' or @class='package' or @class='collection')]">
+  	<xsl:copy>
+  	 	<xsl:copy-of select="@*"/>
+			<xsl:apply-templates select="node()"/>
+ 	</xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/tovisio.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,1271 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns='http://schemas.microsoft.com/visio/2003/core'
+ xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="s exslt" >
+	<xsl:output method="xml"/>
+	  <xsl:key name="color" match="s:rect[@class='cbox']" use="@fill"/>
+	  <xsl:key name="named" match="*" use="@name"/>
+	  <xsl:key name="symbol" match="s:symbol" use="@id"/>
+	<xsl:variable name="Size" select="9.3"/> <!--//s:g[@class='component']/s:use/@width"/-->
+	<xsl:variable name="Scale" select="0.1"/>
+
+<xsl:include href="css-module.xsl"/>
+<!-- visio expects these in pica(?) -->
+	<xsl:variable name="legend-line-width" select="0.25"/>
+	<xsl:variable name="module-line-width" select="0.25"/>
+	<xsl:variable name="cbox-line-width" select="0.25"/>
+	<xsl:variable name="layer-line-width" select="0.7"/>
+	<xsl:variable name="logicalsubset-line-width" select="0.7"/>
+	<xsl:variable name="logicalset-line-width" select="0.7"/>
+
+
+<xsl:template match="/">
+	<VisioDocument>
+		<DocumentProperties>
+			<Title><xsl:value-of select="/s:svg/s:title"/></Title>
+		</DocumentProperties>
+	<Colors>
+		<ColorEntry IX='0' RGB='#000000'/>	
+		<ColorEntry IX='1' RGB='#E6E6E6'/>	<!-- layer, logicalsubset bg -->
+		<ColorEntry IX='2' RGB='#B3B3B3'/>		<!-- logicalset bg -->
+		<xsl:for-each select="//s:rect[@class='cbox']">
+			<ColorEntry IX='{2 + position()}'>
+				<xsl:attribute name="RGB"><xsl:apply-templates select="@fill"/></xsl:attribute>
+			</ColorEntry>
+		</xsl:for-each>
+	</Colors>
+	<FaceNames>
+		<FaceName ID='1' Name='Arial Unicode MS' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='2' Name='Symbol' UnicodeRanges='0 0 0 0' CharSets='-2147483648 0' Panos='5 5 1 2 1 7 6 2 5 7' Flags='261'/>
+		<FaceName ID='3' Name='Wingdings' UnicodeRanges='0 0 0 0' CharSets='-2147483648 0' Panos='5 0 0 0 0 0 0 0 0 0' Flags='261'/>
+		<FaceName ID='4' Name='Arial' UnicodeRanges='31367 -2147483648 8 0' CharSets='1073742335 -65536' Panos='2 11 6 4 2 2 2 2 2 4' Flags='325'/>
+		<FaceName ID='5' Name='SimSun' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='6' Name='PMingLiU' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='7' Name='MS PGothic' UnicodeRanges='-1610612033 1757936891 16 0' CharSets='1073873055 -539557888' Panos='2 11 6 0 7 2 5 8 2 4' Flags='421'/>
+		<FaceName ID='8' Name='Dotum' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='9' Name='Sylfaen' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='10' Name='Estrangelo Edessa' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='11' Name='Vrinda' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='12' Name='Shruti' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='13' Name='Mangal' UnicodeRanges='32768 0 0 0' CharSets='0 0' Panos='2 0 5 0 0 0 0 0 0 0' Flags='325'/>
+		<FaceName ID='14' Name='Tunga' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='15' Name='Sendnya' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='16' Name='Raavi' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='17' Name='Dhenu' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='18' Name='Latha' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='19' Name='Gautami' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='20' Name='Cordia New' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='21' Name='MS Farsi' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='22' Name='Gulim' UnicodeRanges='16804487 -2147483648 8 0' CharSets='536936959 539492352' Panos='2 11 6 4 2 2 2 2 2 4' Flags='327'/>
+		<FaceName ID='23' Name='Times New Roman' UnicodeRanges='31367 -2147483648 8 0' CharSets='1073742335 -65536' Panos='2 2 6 3 5 4 5 2 3 4' Flags='325'/>
+	</FaceNames>
+	<StyleSheets>	
+		<StyleSheet ID='0' NameU='No Style' Name='No Style'>
+			<StyleProp><EnableLineProps>1</EnableLineProps><EnableFillProps>1</EnableFillProps><EnableTextProps>1</EnableTextProps><HideForApply>0</HideForApply></StyleProp>
+			<Line><LineWeight>0.01</LineWeight><LineColor>0</LineColor><LinePattern>1</LinePattern></Line>
+			<Fill><FillForegnd>1</FillForegnd><FillBkgnd>0</FillBkgnd><FillPattern>1</FillPattern><ShdwForegnd>0</ShdwForegnd><ShdwBkgnd>1</ShdwBkgnd><ShapeShdwType>0</ShapeShdwType><ShapeShdwOffsetX>0</ShapeShdwOffsetX><ShapeShdwOffsetY>0</ShapeShdwOffsetY><ShapeShdwObliqueAngle>0</ShapeShdwObliqueAngle><ShapeShdwScaleFactor>1</ShapeShdwScaleFactor></Fill>
+			<TextBlock><LeftMargin>0</LeftMargin><RightMargin>0</RightMargin><TopMargin>0</TopMargin><BottomMargin>0</BottomMargin><VerticalAlign>1</VerticalAlign><TextBkgnd>0</TextBkgnd><DefaultTabStop>0.5905511811023622</DefaultTabStop><TextDirection>0</TextDirection><TextBkgndTrans F='No Formula'>0</TextBkgndTrans></TextBlock>
+			<Protection><LockWidth>0</LockWidth><LockHeight>0</LockHeight><LockMoveX>0</LockMoveX><LockMoveY>0</LockMoveY><LockAspect>0</LockAspect><LockDelete>0</LockDelete><LockBegin>0</LockBegin><LockEnd>0</LockEnd><LockRotate>0</LockRotate><LockCrop>0</LockCrop><LockVtxEdit>0</LockVtxEdit><LockTextEdit>0</LockTextEdit><LockFormat>0</LockFormat><LockGroup>0</LockGroup><LockCalcWH>0</LockCalcWH><LockSelect>0</LockSelect><LockCustProp>0</LockCustProp></Protection>
+			<LayerMem><LayerMember V='null'/></LayerMem>
+			<RulerGrid><XRulerDensity>32</XRulerDensity><YRulerDensity>32</YRulerDensity><XRulerOrigin>0</XRulerOrigin><YRulerOrigin>0</YRulerOrigin><XGridDensity>8</XGridDensity><YGridDensity>8</YGridDensity><XGridSpacing>0</XGridSpacing><YGridSpacing>0</YGridSpacing><XGridOrigin>0</XGridOrigin><YGridOrigin>0</YGridOrigin></RulerGrid>
+			<Image><Gamma>1</Gamma><Contrast>0.5</Contrast><Brightness>0.5</Brightness><Sharpen>0</Sharpen><Blur>0</Blur><Denoise>0</Denoise><Transparency>0</Transparency></Image>
+			<Group><SelectMode>1</SelectMode><DisplayMode>2</DisplayMode><IsDropTarget>0</IsDropTarget><IsSnapTarget>1</IsSnapTarget><IsTextEditTarget>1</IsTextEditTarget><DontMoveChildren>0</DontMoveChildren></Group>
+			<Layout><ShapePermeableX>0</ShapePermeableX><ShapePermeableY>0</ShapePermeableY><ShapePermeablePlace>0</ShapePermeablePlace><ShapeFixedCode>0</ShapeFixedCode><ShapePlowCode>0</ShapePlowCode><ShapeRouteStyle>0</ShapeRouteStyle><ConFixedCode>0</ConFixedCode><ConLineJumpCode>0</ConLineJumpCode><ConLineJumpStyle>0</ConLineJumpStyle><ConLineJumpDirX>0</ConLineJumpDirX><ConLineJumpDirY>0</ConLineJumpDirY><ShapePlaceFlip F='No Formula'>0</ShapePlaceFlip><ConLineRouteExt F='No Formula'>0</ConLineRouteExt><ShapeSplit>0</ShapeSplit><ShapeSplittable>0</ShapeSplittable></Layout>
+			<PageLayout><ResizePage>0</ResizePage><EnableGrid>0</EnableGrid><DynamicsOff>0</DynamicsOff><CtrlAsInput>0</CtrlAsInput><PlaceStyle>0</PlaceStyle><RouteStyle>0</RouteStyle><PlaceDepth>0</PlaceDepth><PlowCode>0</PlowCode><LineJumpCode>1</LineJumpCode><LineJumpStyle>0</LineJumpStyle><PageLineJumpDirX>0</PageLineJumpDirX><PageLineJumpDirY>0</PageLineJumpDirY><LineToNodeX>0.09842519685039369</LineToNodeX><LineToNodeY>0.09842519685039369</LineToNodeY><BlockSizeX>0.1968503937007874</BlockSizeX><BlockSizeY>0.1968503937007874</BlockSizeY><AvenueSizeX>0.2952755905511811</AvenueSizeX><AvenueSizeY>0.2952755905511811</AvenueSizeY><LineToLineX>0.09842519685039369</LineToLineX><LineToLineY>0.09842519685039369</LineToLineY><LineJumpFactorX>0.66666666666667</LineJumpFactorX><LineJumpFactorY>0.66666666666667</LineJumpFactorY><LineAdjustFrom>0</LineAdjustFrom><LineAdjustTo>0</LineAdjustTo><PlaceFlip F='No Formula'>0</PlaceFlip><LineRouteExt F='No Formula'>0</LineRouteExt><PageShapeSplit>0</PageShapeSplit></PageLayout>
+			<xsl:call-template name="printprops"/>
+			<Char IX='0'><Font>4</Font><Color>0</Color><Style>0</Style><Case>0</Case><Pos>0</Pos><FontScale>1</FontScale><Size>0.1666666666666667</Size><Highlight>0</Highlight><DoubleStrikethrough>0</DoubleStrikethrough><RTLText>0</RTLText><UseVertical>0</UseVertical><Letterspace>0</Letterspace><AsianFont>0</AsianFont><ComplexScriptFont>0</ComplexScriptFont><LocalizeFont>0</LocalizeFont><ComplexScriptSize>-1</ComplexScriptSize><LangID>2057</LangID></Char>
+			<Para IX='0'><IndFirst>0</IndFirst><IndLeft>0</IndLeft><IndRight>0</IndRight><SpLine F='-120%'>-1.2</SpLine><SpBefore>0</SpBefore><SpAfter>0</SpAfter><HorzAlign>1</HorzAlign><Bullet>0</Bullet><BulletStr V='null'/><BulletFont>0</BulletFont><LocalizeBulletFont>0</LocalizeBulletFont><BulletFontSize>-1</BulletFontSize><TextPosAfterBullet>0</TextPosAfterBullet><Flags>0</Flags></Para>
+			<Tabs IX='0'/>
+		</StyleSheet>
+		<StyleSheet ID='1' NameU='Text Only' Name='Text Only' LineStyle='3' FillStyle='3' TextStyle='3'>
+			<StyleProp><EnableLineProps>1</EnableLineProps><EnableFillProps>1</EnableFillProps><EnableTextProps>1</EnableTextProps><HideForApply>0</HideForApply></StyleProp>
+			<Line><LineWeight>0.01</LineWeight><LineColor>0</LineColor><LinePattern>0</LinePattern></Line>
+			<Fill><FillForegnd>1</FillForegnd><FillBkgnd>0</FillBkgnd><FillPattern>0</FillPattern><ShdwForegnd>0</ShdwForegnd><ShdwBkgnd>1</ShdwBkgnd></Fill>
+			<TextBlock><LeftMargin>0</LeftMargin><RightMargin>0</RightMargin><TopMargin>0</TopMargin><BottomMargin>0</BottomMargin><VerticalAlign>0</VerticalAlign><TextBkgnd>0</TextBkgnd><DefaultTabStop>0.5905511811023622</DefaultTabStop><TextDirection>0</TextDirection><TextBkgndTrans F='No Formula'>0</TextBkgndTrans></TextBlock>
+			<Para IX='0'><IndFirst>0</IndFirst><IndLeft>0</IndLeft><IndRight>0</IndRight><SpLine>-1.2</SpLine><SpBefore>0</SpBefore><SpAfter>0</SpAfter><HorzAlign>0</HorzAlign></Para>
+		</StyleSheet>
+		<StyleSheet ID='2' NameU='None' Name='None' LineStyle='3' FillStyle='3' TextStyle='3'>
+			<StyleProp><EnableLineProps>1</EnableLineProps><EnableFillProps>1</EnableFillProps><EnableTextProps>1</EnableTextProps><HideForApply>0</HideForApply></StyleProp>
+			<Line><LineWeight>0.01</LineWeight><LineColor>0</LineColor><LinePattern>0</LinePattern></Line>
+			<Fill><FillForegnd>1</FillForegnd><FillBkgnd>0</FillBkgnd><FillPattern>0</FillPattern><ShdwForegnd>0</ShdwForegnd><ShdwBkgnd>1</ShdwBkgnd></Fill>
+		</StyleSheet>
+		<StyleSheet ID='3' NameU='Normal' Name='Normal' LineStyle='0' FillStyle='0' TextStyle='0'>
+			<StyleProp><EnableLineProps>1</EnableLineProps><EnableFillProps>1</EnableFillProps><EnableTextProps>1</EnableTextProps><HideForApply>0</HideForApply></StyleProp>
+			<TextBlock><LeftMargin Unit='PT'>0.05555555555555555</LeftMargin><RightMargin Unit='PT'>0.05555555555555555</RightMargin><TopMargin Unit='PT'>0.05555555555555555</TopMargin><BottomMargin Unit='PT'>0.05555555555555555</BottomMargin><VerticalAlign>1</VerticalAlign><TextBkgnd>0</TextBkgnd><DefaultTabStop>0.5905511811023622</DefaultTabStop><TextDirection>0</TextDirection><TextBkgndTrans F='No Formula'>0</TextBkgndTrans></TextBlock>
+		</StyleSheet>
+		<StyleSheet ID='4' NameU='Guide' Name='Guide' LineStyle='3' FillStyle='3' TextStyle='3'>
+			<StyleProp><EnableLineProps>1</EnableLineProps><EnableFillProps>1</EnableFillProps><EnableTextProps>1</EnableTextProps><HideForApply>0</HideForApply></StyleProp>
+			<Line><LineWeight Unit='PT'>0</LineWeight><LineColor>4</LineColor><LinePattern>23</LinePattern></Line>
+			<Fill><FillForegnd>1</FillForegnd><FillBkgnd>0</FillBkgnd><FillPattern>0</FillPattern><ShdwForegnd>0</ShdwForegnd><ShdwBkgnd>1</ShdwBkgnd></Fill>
+			<TextBlock><LeftMargin Unit='PT'>0.05555555555555555</LeftMargin><RightMargin Unit='PT'>0.05555555555555555</RightMargin><TopMargin>0</TopMargin><BottomMargin>0</BottomMargin><VerticalAlign>2</VerticalAlign><TextBkgnd>0</TextBkgnd><DefaultTabStop>0.5905511811023622</DefaultTabStop><TextDirection>0</TextDirection><TextBkgndTrans F='No Formula'>0</TextBkgndTrans></TextBlock>
+			<Layout><ShapePermeableX>1</ShapePermeableX><ShapePermeableY>1</ShapePermeableY><ShapePermeablePlace>1</ShapePermeablePlace><ShapeFixedCode>0</ShapeFixedCode><ShapePlowCode>0</ShapePlowCode><ShapeRouteStyle>0</ShapeRouteStyle><ConFixedCode>0</ConFixedCode><ConLineJumpCode>0</ConLineJumpCode><ConLineJumpStyle>0</ConLineJumpStyle><ConLineJumpDirX>0</ConLineJumpDirX><ConLineJumpDirY>0</ConLineJumpDirY><ShapePlaceFlip F='No Formula'>0</ShapePlaceFlip><ConLineRouteExt F='No Formula'>0</ConLineRouteExt><ShapeSplit>0</ShapeSplit><ShapeSplittable>0</ShapeSplittable></Layout>
+			<Char IX='0'><Font>4</Font><Color>4</Color><Style>0</Style><Case>0</Case><Pos>0</Pos><FontScale>1</FontScale><Size>0.125</Size><Highlight>0</Highlight><Letterspace>0</Letterspace><ComplexScriptSize>-1</ComplexScriptSize><LangID>2057</LangID></Char>
+		</StyleSheet>
+		<StyleSheet ID='6' NameU='Basic' Name='Basic' LineStyle='7' FillStyle='7' TextStyle='7'>
+			<StyleProp><EnableLineProps>1</EnableLineProps><EnableFillProps>1</EnableFillProps><EnableTextProps>1</EnableTextProps><HideForApply>0</HideForApply></StyleProp>
+			<Line><LineWeight><xsl:value-of select="$module-line-width"/></LineWeight><LineColor>0</LineColor><LinePattern>1</LinePattern></Line>
+			<TextBlock><LeftMargin Unit='PT'>0.05555555555555555</LeftMargin><RightMargin Unit='PT'>0.05555555555555555</RightMargin><TopMargin Unit='PT'>0.05555555555555555</TopMargin><BottomMargin Unit='PT'>0.05555555555555555</BottomMargin><VerticalAlign>1</VerticalAlign><TextBkgnd>0</TextBkgnd><DefaultTabStop>0.5905511811023622</DefaultTabStop><TextDirection>0</TextDirection><TextBkgndTrans F='No Formula'>0</TextBkgndTrans></TextBlock>
+			<Char IX='0'><Font>4</Font><Color>0</Color><Style>0</Style><Case>0</Case><Pos>0</Pos><FontScale>1</FontScale><Size Unit='PT'>0.1111111111111111</Size><Highlight>0</Highlight><Letterspace>0</Letterspace><ComplexScriptSize>-1</ComplexScriptSize><LangID>2057</LangID></Char>
+			<Para IX='0'><IndFirst>0</IndFirst><IndLeft>0</IndLeft><IndRight>0</IndRight><SpLine>-1.2</SpLine><SpBefore>0</SpBefore><SpAfter>0</SpAfter><HorzAlign>1</HorzAlign></Para>
+			<Tabs IX='0'/>
+		</StyleSheet>
+		<StyleSheet ID='7' NameU='Visio 00 Face' Name='Visio 00 Face' LineStyle='0' FillStyle='0' TextStyle='0'>
+			<StyleProp><EnableLineProps>1</EnableLineProps><EnableFillProps>1</EnableFillProps><EnableTextProps>1</EnableTextProps><HideForApply>0</HideForApply></StyleProp>
+			<Line><LineWeight>0.01</LineWeight><LineColor>0</LineColor><LinePattern>1</LinePattern></Line>
+			<Fill><FillForegnd>1</FillForegnd><FillBkgnd>1</FillBkgnd><FillPattern>1</FillPattern><ShdwForegnd>0</ShdwForegnd><ShdwBkgnd>1</ShdwBkgnd></Fill>
+			<Char IX='0'><Font>4</Font><Color>0</Color><Style>0</Style><Case>0</Case><Pos>0</Pos><FontScale>1</FontScale><Size>0.1666666666666667</Size><Highlight>0</Highlight><Letterspace>0</Letterspace><ComplexScriptSize>-1</ComplexScriptSize><LangID>2057</LangID></Char>
+		</StyleSheet>
+	</StyleSheets>
+	<DocumentSheet NameU='TheDoc' Name='TheDoc' LineStyle='0' FillStyle='0' TextStyle='0'>
+		<DocProps><OutputFormat>0</OutputFormat><LockPreview>0</LockPreview><AddMarkup F='No Formula'>0</AddMarkup><ViewMarkup F='No Formula'>0</ViewMarkup><PreviewQuality>0</PreviewQuality><PreviewScope>0</PreviewScope><DocLangID>2057</DocLangID></DocProps>
+	</DocumentSheet>
+	<Masters>
+		<Master ID='0' NameU='Rectangle.4' Name='Rectangle.4' Prompt='Rectangle.' IconSize='1' AlignName='2' MatchByName='1' IconUpdate='0' PatternFlags='0' Hidden='0'><xsl:attribute name="UniqueID">{04C33547-0004-0000-8E40-00608CF305B2}</xsl:attribute><xsl:attribute name="BaseID">{04C33547-0004-F00D-0000-000000000000}</xsl:attribute>
+			<PageSheet LineStyle='0' FillStyle='0' TextStyle='0'><PageProps><PageWidth Unit='MM'>3.937007874015748</PageWidth><PageHeight Unit='MM'>3.937007874015748</PageHeight><ShdwOffsetX Unit='MM'>0.1181102362204724</ShdwOffsetX><ShdwOffsetY Unit='MM'>-0.1181102362204724</ShdwOffsetY><PageScale Unit='MM'>0.03937007874015748</PageScale><DrawingScale Unit='MM'>0.03937007874015748</DrawingScale><DrawingSizeType>1</DrawingSizeType><DrawingScaleType>0</DrawingScaleType><InhibitSnap F='No Formula'>0</InhibitSnap><UIVisibility F='No Formula'>0</UIVisibility><ShdwType F='No Formula'>0</ShdwType><ShdwObliqueAngle>0</ShdwObliqueAngle><ShdwScaleFactor>1</ShdwScaleFactor></PageProps>
+				<xsl:call-template name="printprops"/>
+			</PageSheet>
+			<Shapes>
+				<Shape ID='5' Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6'>
+					<XForm><PinX Unit='MM'>1.968503937007874</PinX><PinY Unit='MM'>1.968503937007874</PinY>
+					<Width Unit='MM'>1.574803149606299</Width><Height Unit='MM'>1.181102362204725</Height>
+					</XForm>
+					<Connection IX='0'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='0'>0</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='1'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='2'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height'>1.181102362204725</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='3'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='4'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Geom IX='0'><NoFill>0</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap F='No Formula'>0</NoSnap><MoveTo IX='1'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='0'>0</Y></MoveTo><LineTo IX='2'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='0'>0</Y></LineTo><LineTo IX='3'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='4'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='5'><X Unit='MM' F='Geometry1.X1'>0</X><Y Unit='MM' F='Geometry1.Y1'>0</Y></LineTo></Geom>
+				</Shape>
+			</Shapes>
+		</Master>
+		<Master ID='2' NameU='Rounded rectangle.22' Name='Rounded rectangle.22' Prompt='Rectangle with variable corner rounding.' IconSize='1' AlignName='2' MatchByName='1' IconUpdate='0' PatternFlags='0' Hidden='0'><xsl:attribute name="UniqueID">{04C3355B-000A-0000-8E40-00608CF305B2}</xsl:attribute><xsl:attribute name="BaseID">{04C3355B-000A-F00D-0000-000000000000}</xsl:attribute>
+			<PageSheet LineStyle='0' FillStyle='0' TextStyle='0'><PageProps><PageWidth Unit='MM'>3.937007874015748</PageWidth><PageHeight Unit='MM'>3.937007874015748</PageHeight><ShdwOffsetX Unit='MM'>0.1181102362204724</ShdwOffsetX><ShdwOffsetY Unit='MM'>-0.1181102362204724</ShdwOffsetY><PageScale Unit='MM'>0.03937007874015748</PageScale><DrawingScale Unit='MM'>0.03937007874015748</DrawingScale><DrawingSizeType>1</DrawingSizeType><DrawingScaleType>0</DrawingScaleType><InhibitSnap F='No Formula'>0</InhibitSnap><UIVisibility F='No Formula'>0</UIVisibility><ShdwType F='No Formula'>0</ShdwType><ShdwObliqueAngle>0</ShdwObliqueAngle><ShdwScaleFactor>1</ShdwScaleFactor></PageProps>
+				<xsl:call-template name="printprops"/>
+			</PageSheet>
+			<Shapes>
+				<Shape ID='6' Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6'>
+					<XForm><PinX Unit='MM'>1.968503937007874</PinX><PinY Unit='MM'>1.968503937007874</PinY><Width Unit='MM'>1.574803149606299</Width><Height Unit='MM'>1.181102362204725</Height></XForm>
+					<Protection><LockWidth>0</LockWidth><LockHeight>0</LockHeight><LockMoveX>0</LockMoveX><LockMoveY>0</LockMoveY><LockAspect>0</LockAspect><LockDelete>0</LockDelete><LockBegin>0</LockBegin><LockEnd>0</LockEnd><LockRotate>0</LockRotate><LockCrop>0</LockCrop><LockVtxEdit>1</LockVtxEdit><LockTextEdit>0</LockTextEdit><LockFormat>0</LockFormat><LockGroup>0</LockGroup><LockCalcWH>0</LockCalcWH><LockSelect>0</LockSelect><LockCustProp>0</LockCustProp></Protection>
+					<Connection IX='0'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height'>1.181102362204725</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='1'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='0'>0</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='2'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='3'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='4'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Scratch IX='0'><X F='MIN(Width/2,Height/2,MAX(Controls.Row_1,0))'>0.19685039</X><Y F='No Formula'>0</Y><A F='IF(Controls.Row_1&lt;Width*0,SETF("controls.x1",Width*0),IF(Controls.Row_1&gt;Width*1,SETF("controls.x1",Width*1),FALSE))'>0</A><B F='No Formula'>0</B><C F='No Formula'>0</C><D F='No Formula'>0</D></Scratch>
+					<Control ID='1'><Prompt>Adjust Corner Rounding</Prompt>
+						<X F="Height * 0.5"/><Y Unit='MM' F='0'>0</Y>
+						<XDyn Unit='MM'>0</XDyn><YDyn Unit='MM'>0</YDyn>
+						<XCon>2</XCon><YCon>1</YCon>
+						<CanGlue>0</CanGlue>
+					</Control>
+					<Geom IX='0'>
+						<NoFill>0</NoFill><NoLine F='No Formula'>0</NoLine><NoShow F='No Formula'>0</NoShow><NoSnap F='No Formula'>0</NoSnap>
+						<MoveTo IX='1'><X Unit='MM' F='Geometry1.X2-Scratch.X1'>1.377952759606299</X><Y F='MIN(0,Height/2-Scratch.X1)'>0</Y></MoveTo>
+						<ArcTo IX='2'><X Unit='MM' F='MAX(Width,Width/2+Scratch.X1)'>1.574803149606299</X><Y F='Geometry1.Y1+Scratch.X1'>0.19685039</Y><A Unit='DL' F='Scratch.X1*0.29289'>0.05765551072709999</A></ArcTo>
+						<LineTo IX='3'><X Unit='MM' F='Geometry1.X2'>1.574803149606299</X><Y Unit='MM' F='Geometry1.Y4-Scratch.X1'>0.9842519722047245</Y></LineTo>
+						<ArcTo IX='4'><X Unit='MM' F='Geometry1.X1'>1.377952759606299</X><Y Unit='MM' F='Height-Geometry1.Y1'>1.181102362204725</Y><A Unit='DL' F='Geometry1.A2'>0.05765551072709999</A></ArcTo>
+						<LineTo IX='5'><X Unit='MM' F='Geometry1.X6+Scratch.X1'>0.19685039</X><Y Unit='MM' F='Geometry1.Y4'>1.181102362204725</Y></LineTo>
+						<ArcTo IX='6'><X Unit='MM' F='Width-Geometry1.X2'>0</X><Y Unit='MM' F='Height-Geometry1.Y2'>0.9842519722047245</Y><A Unit='DL' F='Geometry1.A2'>0.05765551072709999</A></ArcTo>
+						<LineTo IX='7'><X Unit='MM' F='Geometry1.X6'>0</X><Y F='Geometry1.Y2'>0.19685039</Y></LineTo>
+						<ArcTo IX='8'><X Unit='MM' F='Geometry1.X5'>0.19685039</X><Y F='Geometry1.Y1'>0</Y><A Unit='DL' F='Geometry1.A2'>0.05765551072709999</A></ArcTo>
+						<LineTo IX='9'><X Unit='MM' F='Geometry1.X1'>1.377952759606299</X><Y F='Geometry1.Y1'>0</Y></LineTo>
+					</Geom>
+				</Shape>
+			</Shapes>
+		</Master>
+		<Master ID='3' NameU='Rectangle' Name='Rectangle' Prompt='Rectangle.' IconSize='1' AlignName='2' MatchByName='1' IconUpdate='0' PatternFlags='0' Hidden='0'><xsl:attribute name="UniqueID">{04C33547-0000-0000-8E40-00608CF305B2}</xsl:attribute><xsl:attribute name="BaseID">{04C33547-0000-F00D-0000-000000000000}</xsl:attribute>
+			<PageSheet LineStyle='0' FillStyle='0' TextStyle='0'><PageProps><PageWidth Unit='MM'>3.937007874015748</PageWidth><PageHeight Unit='MM'>3.937007874015748</PageHeight><ShdwOffsetX Unit='MM'>0.1181102362204724</ShdwOffsetX><ShdwOffsetY Unit='MM'>-0.1181102362204724</ShdwOffsetY><PageScale Unit='MM'>0.03937007874015748</PageScale><DrawingScale Unit='MM'>0.03937007874015748</DrawingScale><DrawingSizeType>1</DrawingSizeType><DrawingScaleType>0</DrawingScaleType><InhibitSnap F='No Formula'>0</InhibitSnap><UIVisibility F='No Formula'>0</UIVisibility><ShdwType F='No Formula'>0</ShdwType><ShdwObliqueAngle>0</ShdwObliqueAngle><ShdwScaleFactor>1</ShdwScaleFactor></PageProps>
+				<xsl:call-template name="printprops"/>
+			</PageSheet>
+			<Shapes>
+				<Shape ID='5' Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6'>
+					<XForm><PinX Unit='MM'>1.968503937007874</PinX><PinY Unit='MM'>1.968503937007874</PinY><Width Unit='MM'>1.574803149606299</Width><Height Unit='MM'>1.181102362204725</Height>
+					</XForm>
+					<Connection IX='0'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='0'>0</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='1'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='2'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height'>1.181102362204725</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='3'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='4'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection><Geom IX='0'><NoFill>0</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap F='No Formula'>0</NoSnap><MoveTo IX='1'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='0'>0</Y></MoveTo><LineTo IX='2'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='0'>0</Y></LineTo><LineTo IX='3'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='4'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='5'><X Unit='MM' F='Geometry1.X1'>0</X><Y Unit='MM' F='Geometry1.Y1'>0</Y></LineTo></Geom>
+				</Shape>
+			</Shapes>
+		</Master>
+		<Master ID='4' NameU='Rectangle.13' Name='Rectangle.13' Prompt='Rectangle.' IconSize='1' AlignName='2' MatchByName='1' IconUpdate='0' PatternFlags='0' Hidden='0'><xsl:attribute name="UniqueID">{04C3355B-000D-0000-8E40-00608CF305B2}</xsl:attribute><xsl:attribute name="BaseID">{04C3355B-000D-F00D-0000-000000000000}</xsl:attribute>
+			<PageSheet LineStyle='0' FillStyle='0' TextStyle='0'><PageProps><PageWidth Unit='MM'>3.937007874015748</PageWidth><PageHeight Unit='MM'>3.937007874015748</PageHeight><ShdwOffsetX Unit='MM'>0.1181102362204724</ShdwOffsetX><ShdwOffsetY Unit='MM'>-0.1181102362204724</ShdwOffsetY><PageScale Unit='MM'>0.03937007874015748</PageScale><DrawingScale Unit='MM'>0.03937007874015748</DrawingScale><DrawingSizeType>1</DrawingSizeType><DrawingScaleType>0</DrawingScaleType><InhibitSnap F='No Formula'>0</InhibitSnap><UIVisibility F='No Formula'>0</UIVisibility><ShdwType F='No Formula'>0</ShdwType><ShdwObliqueAngle>0</ShdwObliqueAngle><ShdwScaleFactor>1</ShdwScaleFactor></PageProps>
+				<xsl:call-template name="printprops"/>
+			</PageSheet>
+			<Shapes>
+				<Shape ID='5' Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6'>
+					<XForm><PinX Unit='MM'>1.968503937007874</PinX><PinY Unit='MM'>1.968503937007874</PinY><Width Unit='MM'>1.574803149606299</Width><Height Unit='MM'>1.181102362204725</Height>
+					</XForm>
+					<Connection IX='0'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='0'>0</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='1'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='2'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height'>1.181102362204725</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='3'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='4'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection><Geom IX='0'><NoFill>0</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap F='No Formula'>0</NoSnap><MoveTo IX='1'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='0'>0</Y></MoveTo><LineTo IX='2'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='0'>0</Y></LineTo><LineTo IX='3'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='4'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='5'><X Unit='MM' F='Geometry1.X1'>0</X><Y Unit='MM' F='Geometry1.Y1'>0</Y></LineTo></Geom>
+				</Shape>
+			</Shapes>
+		</Master>
+		<Master ID='5' NameU='Rectangle.15' Name='Rectangle.15' Prompt='Rectangle.' IconSize='1' AlignName='2' MatchByName='1' IconUpdate='0' PatternFlags='0' Hidden='0'><xsl:attribute name="UniqueID">{04C33565-000F-0000-8E40-00608CF305B2}</xsl:attribute><xsl:attribute name="BaseID">{04C33565-000F-F00D-0000-000000000000}</xsl:attribute>
+			<PageSheet LineStyle='0' FillStyle='0' TextStyle='0'><PageProps><PageWidth Unit='MM'>3.937007874015748</PageWidth><PageHeight Unit='MM'>3.937007874015748</PageHeight><ShdwOffsetX Unit='MM'>0.1181102362204724</ShdwOffsetX><ShdwOffsetY Unit='MM'>-0.1181102362204724</ShdwOffsetY><PageScale Unit='MM'>0.03937007874015748</PageScale><DrawingScale Unit='MM'>0.03937007874015748</DrawingScale><DrawingSizeType>1</DrawingSizeType><DrawingScaleType>0</DrawingScaleType><InhibitSnap F='No Formula'>0</InhibitSnap><UIVisibility F='No Formula'>0</UIVisibility><ShdwType F='No Formula'>0</ShdwType><ShdwObliqueAngle>0</ShdwObliqueAngle><ShdwScaleFactor>1</ShdwScaleFactor></PageProps>
+				<xsl:call-template name="printprops"/>
+			</PageSheet>
+			<Shapes>
+				<Shape ID='5' Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6'>
+					<XForm><PinX Unit='MM'>1.968503937007874</PinX><PinY Unit='MM'>1.968503937007874</PinY><Width Unit='MM'>1.574803149606299</Width><Height Unit='MM'>1.181102362204725</Height>
+					</XForm>
+					<Connection IX='0'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='0'>0</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='1'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='2'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height'>1.181102362204725</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='3'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='4'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection><Geom IX='0'><NoFill>0</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap F='No Formula'>0</NoSnap><MoveTo IX='1'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='0'>0</Y></MoveTo><LineTo IX='2'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='0'>0</Y></LineTo><LineTo IX='3'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='4'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='5'><X Unit='MM' F='Geometry1.X1'>0</X><Y Unit='MM' F='Geometry1.Y1'>0</Y></LineTo></Geom>
+				</Shape>
+			</Shapes>
+		</Master>
+		<Master ID='6' NameU='Rectangle.16' Name='Rectangle.16' Prompt='Rectangle.' IconSize='1' AlignName='2' MatchByName='1' IconUpdate='0' PatternFlags='0' Hidden='0'><xsl:attribute name="UniqueID">{04C33565-0010-0000-8E40-00608CF305B2}</xsl:attribute><xsl:attribute name="BaseID">{04C33565-0010-F00D-0000-000000000000}</xsl:attribute>
+			<PageSheet LineStyle='0' FillStyle='0' TextStyle='0'><PageProps><PageWidth Unit='MM'>3.937007874015748</PageWidth><PageHeight Unit='MM'>3.937007874015748</PageHeight><ShdwOffsetX Unit='MM'>0.1181102362204724</ShdwOffsetX><ShdwOffsetY Unit='MM'>-0.1181102362204724</ShdwOffsetY><PageScale Unit='MM'>0.03937007874015748</PageScale><DrawingScale Unit='MM'>0.03937007874015748</DrawingScale><DrawingSizeType>1</DrawingSizeType><DrawingScaleType>0</DrawingScaleType><InhibitSnap F='No Formula'>0</InhibitSnap><UIVisibility F='No Formula'>0</UIVisibility><ShdwType F='No Formula'>0</ShdwType><ShdwObliqueAngle>0</ShdwObliqueAngle><ShdwScaleFactor>1</ShdwScaleFactor></PageProps><xsl:call-template name="printprops"/></PageSheet>
+			<Shapes>
+				<Shape ID='5' Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6'>
+				<XForm><PinX Unit='MM'>1.968503937007874</PinX><PinY Unit='MM'>1.968503937007874</PinY><Width Unit='MM'>1.574803149606299</Width><Height Unit='MM'>1.181102362204725</Height>
+				</XForm>
+				<Connection IX='0'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='0'>0</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+				<Connection IX='1'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+				<Connection IX='2'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height'>1.181102362204725</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+				<Connection IX='3'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+				<Connection IX='4'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection><Geom IX='0'><NoFill>0</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap F='No Formula'>0</NoSnap><MoveTo IX='1'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='0'>0</Y></MoveTo><LineTo IX='2'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='0'>0</Y></LineTo><LineTo IX='3'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='4'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height'>1.181102362204725</Y></LineTo><LineTo IX='5'><X Unit='MM' F='Geometry1.X1'>0</X><Y Unit='MM' F='Geometry1.Y1'>0</Y></LineTo></Geom></Shape>
+			</Shapes>
+		</Master>
+		<Master ID='9' NameU='Ex' Name='Ex' Prompt='' IconSize='1' AlignName='2' MatchByName='0' IconUpdate='1' PatternFlags='24580' Hidden='0'>
+			<xsl:attribute name="UniqueID">{0BFFBCBF-0009-0000-8E40-00608CF305B2}</xsl:attribute>
+			<xsl:attribute name="BaseID">{18E63130-8321-4486-AFB0-39D3B50CFDA1}</xsl:attribute> 
+			<PageSheet LineStyle='0' FillStyle='0' TextStyle='0'>
+				<PageProps><PageWidth>8.5</PageWidth><PageHeight>11</PageHeight><ShdwOffsetX>0.125</ShdwOffsetX><ShdwOffsetY>-0.125</ShdwOffsetY><PageScale Unit='IN_F'>1</PageScale>
+					<DrawingScale Unit='IN_F'>1</DrawingScale><DrawingSizeType>1</DrawingSizeType><DrawingScaleType>0</DrawingScaleType><InhibitSnap>0</InhibitSnap><UIVisibility>0</UIVisibility><ShdwType>0</ShdwType><ShdwObliqueAngle>0</ShdwObliqueAngle><ShdwScaleFactor>1</ShdwScaleFactor></PageProps>
+			</PageSheet>
+			<Shapes>
+				<Shape ID='7' Type='Shape' LineStyle='3' FillStyle='3' TextStyle='3'><XForm><PinX>4.1875</PinX><PinY>5.5</PinY><Width>8.375</Width><Height>8.433159722222223</Height><LocPinX F='Width*0.5'>4.1875</LocPinX><LocPinY F='Height*0.5'>4.216579861111112</LocPinY><Angle>0</Angle><FlipX>0</FlipX><FlipY>0</FlipY><ResizeMode>0</ResizeMode></XForm><Fill><FillForegnd>#ffffff</FillForegnd><FillBkgnd F='Inh'>0</FillBkgnd><FillPattern F='Inh'>1</FillPattern><ShdwForegnd F='Inh'>0</ShdwForegnd><ShdwBkgnd F='Inh'>1</ShdwBkgnd><ShdwPattern F='Inh'>0</ShdwPattern><FillForegndTrans F='Inh'>0</FillForegndTrans><FillBkgndTrans F='Inh'>0</FillBkgndTrans><ShdwForegndTrans F='Inh'>0</ShdwForegndTrans><ShdwBkgndTrans F='Inh'>0</ShdwBkgndTrans><ShapeShdwType F='Inh'>0</ShapeShdwType><ShapeShdwOffsetX F='Inh'>0</ShapeShdwOffsetX><ShapeShdwOffsetY F='Inh'>0</ShapeShdwOffsetY><ShapeShdwObliqueAngle F='Inh'>0</ShapeShdwObliqueAngle><ShapeShdwScaleFactor F='Inh'>1</ShapeShdwScaleFactor></Fill><Line><LineWeight F='Inh'>0.01</LineWeight><LineColor F='Inh'>0</LineColor><LinePattern>0</LinePattern><Rounding F='Inh'>0</Rounding><EndArrowSize F='Inh'>2</EndArrowSize><BeginArrow F='Inh'>0</BeginArrow><EndArrow F='Inh'>0</EndArrow><LineCap F='Inh'>0</LineCap><BeginArrowSize F='Inh'>2</BeginArrowSize><LineColorTrans F='Inh'>0</LineColorTrans></Line><Geom IX='0'><NoFill>0</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap>0</NoSnap><MoveTo IX='1'><X F='Width*0'>0</X><Y F='Height*0'>0</Y></MoveTo><LineTo IX='2'><X F='Width*1'>8.375</X><Y F='Height*0'>0</Y></LineTo><LineTo IX='3'><X F='Width*1'>8.375</X><Y F='Height*1'>8.433159722222223</Y></LineTo><LineTo IX='4'><X F='Width*0'>0</X><Y F='Height*1'>8.433159722222223</Y></LineTo><LineTo IX='5'><X F='Geometry1.X1'>0</X><Y F='Geometry1.Y1'>0</Y></LineTo></Geom></Shape>
+				<Shape ID='5' Type='Shape' LineStyle='3' FillStyle='3' TextStyle='3'><XForm><PinX F='(BeginX+EndX)/2'>4.1875</PinX><PinY F='(BeginY+EndY)/2'>5.457722355769239</PinY><Width F='SQRT((EndX-BeginX)^2+(EndY-BeginY)^2)'>9.30524668444901</Width><Height>0</Height><LocPinX F='Width*0.5'>4.652623342224505</LocPinX><LocPinY F='Height*0.5'>0</LocPinY><Angle F='ATAN2(EndY-BeginY,EndX-BeginX)'>-0.7988612422128417</Angle><FlipX>0</FlipX><FlipY>0</FlipY><ResizeMode>0</ResizeMode></XForm><TextBlock><LeftMargin Unit='PT' F='Inh'>0.05555555555555555</LeftMargin><RightMargin Unit='PT' F='Inh'>0.05555555555555555</RightMargin><TopMargin Unit='PT' F='Inh'>0.05555555555555555</TopMargin><BottomMargin Unit='PT' F='Inh'>0.05555555555555555</BottomMargin><VerticalAlign F='Inh'>1</VerticalAlign><TextBkgnd>2</TextBkgnd><DefaultTabStop F='Inh'>0.5905511811023622</DefaultTabStop><TextDirection F='Inh'>0</TextDirection><TextBkgndTrans F='Inh'>0</TextBkgndTrans></TextBlock><XForm1D><BeginX>0.9421875000000588</BeginX><BeginY>8.791616586538481</BeginY><EndX>7.432812499999947</EndX><EndY>2.123828125</EndY></XForm1D><Line><LineWeight Unit='PT'>0.1111111111111111</LineWeight><LineColor>0</LineColor><LinePattern F='Inh'>1</LinePattern><Rounding Unit='IN'>0</Rounding><EndArrowSize F='Inh'>2</EndArrowSize><BeginArrow F='Inh'>0</BeginArrow><EndArrow F='Inh'>0</EndArrow><LineCap>0</LineCap><BeginArrowSize F='Inh'>2</BeginArrowSize><LineColorTrans F='Inh'>0</LineColorTrans></Line><Fill><FillForegnd>0</FillForegnd><FillBkgnd F='Inh'>0</FillBkgnd><FillPattern F='Inh'>1</FillPattern><ShdwForegnd F='Inh'>0</ShdwForegnd><ShdwBkgnd F='Inh'>1</ShdwBkgnd><ShdwPattern F='Inh'>0</ShdwPattern><FillForegndTrans F='Inh'>0</FillForegndTrans><FillBkgndTrans F='Inh'>0</FillBkgndTrans><ShdwForegndTrans F='Inh'>0</ShdwForegndTrans><ShdwBkgndTrans F='Inh'>0</ShdwBkgndTrans><ShapeShdwType F='Inh'>0</ShapeShdwType><ShapeShdwOffsetX F='Inh'>0</ShapeShdwOffsetX><ShapeShdwOffsetY F='Inh'>0</ShapeShdwOffsetY><ShapeShdwObliqueAngle F='Inh'>0</ShapeShdwObliqueAngle><ShapeShdwScaleFactor F='Inh'>1</ShapeShdwScaleFactor></Fill><Geom IX='0'><NoFill>1</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap>0</NoSnap><MoveTo IX='1'><X F='Width*0'>0</X><Y>0</Y></MoveTo><LineTo IX='2'><X F='Width*1'>9.30524668444901</X><Y>0</Y></LineTo></Geom></Shape>
+				<Shape ID='6' Type='Shape' LineStyle='3' FillStyle='3' TextStyle='3'><XForm><PinX F='(BeginX+EndX)/2'>4.1875</PinX><PinY F='(BeginY+EndY)/2'>5.457722355769239</PinY><Width F='SQRT((EndX-BeginX)^2+(EndY-BeginY)^2)'>9.30524668444901</Width><Height>0</Height><LocPinX F='Width*0.5'>4.652623342224505</LocPinX><LocPinY F='Height*0.5'>0</LocPinY><Angle F='ATAN2(EndY-BeginY,EndX-BeginX)'>-2.342731411376952</Angle><FlipX>0</FlipX><FlipY>0</FlipY><ResizeMode>0</ResizeMode></XForm><TextBlock><LeftMargin Unit='PT' F='Inh'>0.05555555555555555</LeftMargin><RightMargin Unit='PT' F='Inh'>0.05555555555555555</RightMargin><TopMargin Unit='PT' F='Inh'>0.05555555555555555</TopMargin><BottomMargin Unit='PT' F='Inh'>0.05555555555555555</BottomMargin><VerticalAlign F='Inh'>1</VerticalAlign><TextBkgnd>2</TextBkgnd><DefaultTabStop F='Inh'>0.5905511811023622</DefaultTabStop><TextDirection F='Inh'>0</TextDirection><TextBkgndTrans F='Inh'>0</TextBkgndTrans></TextBlock><XForm1D><BeginX>7.432812499999947</BeginX><BeginY>8.791616586538481</BeginY><EndX>0.9421875000000588</EndX><EndY>2.123828125</EndY></XForm1D><Line><LineWeight Unit='PT'>0.1111111111111111</LineWeight><LineColor>0</LineColor><LinePattern F='Inh'>1</LinePattern><Rounding Unit='IN'>0</Rounding><EndArrowSize F='Inh'>2</EndArrowSize><BeginArrow F='Inh'>0</BeginArrow><EndArrow F='Inh'>0</EndArrow><LineCap>0</LineCap><BeginArrowSize F='Inh'>2</BeginArrowSize><LineColorTrans F='Inh'>0</LineColorTrans></Line><Fill><FillForegnd>0</FillForegnd><FillBkgnd F='Inh'>0</FillBkgnd><FillPattern F='Inh'>1</FillPattern><ShdwForegnd F='Inh'>0</ShdwForegnd><ShdwBkgnd F='Inh'>1</ShdwBkgnd><ShdwPattern F='Inh'>0</ShdwPattern><FillForegndTrans F='Inh'>0</FillForegndTrans><FillBkgndTrans F='Inh'>0</FillBkgndTrans><ShdwForegndTrans F='Inh'>0</ShdwForegndTrans><ShdwBkgndTrans F='Inh'>0</ShdwBkgndTrans><ShapeShdwType F='Inh'>0</ShapeShdwType><ShapeShdwOffsetX F='Inh'>0</ShapeShdwOffsetX><ShapeShdwOffsetY F='Inh'>0</ShapeShdwOffsetY><ShapeShdwObliqueAngle F='Inh'>0</ShapeShdwObliqueAngle><ShapeShdwScaleFactor F='Inh'>1</ShapeShdwScaleFactor></Fill><Geom IX='0'><NoFill>1</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap>0</NoSnap><MoveTo IX='1'><X F='Width*0'>0</X><Y>0</Y></MoveTo><LineTo IX='2'><X F='Width*1'>9.30524668444901</X><Y>0</Y></LineTo></Geom></Shape>
+			</Shapes>
+		</Master>	
+	</Masters>
+	<Pages>
+		<xsl:call-template name="page"/>
+	</Pages>
+	<Windows ClientWidth='1280' ClientHeight='881'>
+		<Window ID='0' WindowType='Drawing' WindowState='1073741824' WindowLeft='-4' WindowTop='-23' WindowWidth='1288' WindowHeight='908' ContainerType='Page' Page='0' ViewScale='1' ViewCenterX='-2.5295275590551' ViewCenterY='-1.5698818897638'></Window>
+	</Windows>	
+	</VisioDocument>
+</xsl:template>
+
+<xsl:template match="@fill|@stroke">
+	<xsl:call-template name="color-value"><xsl:with-param name="v" select="."/></xsl:call-template>
+</xsl:template>
+
+<xsl:template name="color-value"><xsl:param name="v"/>
+	<xsl:choose>
+		<xsl:when test="$v='aliceblue'">#F0F8FF</xsl:when>
+		<xsl:when test="$v='antiquewhite'">#FAEBD7</xsl:when>
+		<xsl:when test="$v='aqua'">#0FFFF0</xsl:when>
+		<xsl:when test="$v='aquamarine'">#7FFFD4</xsl:when>
+		<xsl:when test="$v='azure'">#F0FFFF</xsl:when>
+		<xsl:when test="$v='beige'">#F5F5DC</xsl:when>
+		<xsl:when test="$v='bisque'">#FFE4C4</xsl:when>
+		<xsl:when test="$v='black'">#000000</xsl:when>
+		<xsl:when test="$v='blanchedalmond'">#FFEBCD</xsl:when>
+		<xsl:when test="$v='blue'">#00FF00</xsl:when>
+		<xsl:when test="$v='blueviolet'">#8A2BE2</xsl:when>
+		<xsl:when test="$v='brown'">#A52A2A</xsl:when>
+		<xsl:when test="$v='burlywood'">#DEB887</xsl:when>
+		<xsl:when test="$v='cadetblue'">#5F9EA0</xsl:when>
+		<xsl:when test="$v='chartreuse'">#7FFF00</xsl:when>
+		<xsl:when test="$v='chocolate'">#D2691E</xsl:when>
+		<xsl:when test="$v='coral'">#FF7F50</xsl:when>
+		<xsl:when test="$v='cornflowerblue'">#6495ED</xsl:when>
+		<xsl:when test="$v='cornsilk'">#FFF8DC</xsl:when>
+		<xsl:when test="$v='crimson'">#DC143C</xsl:when>
+		<xsl:when test="$v='cyan'">#0FFFF0</xsl:when>
+		<xsl:when test="$v='darkblue'">#008B00</xsl:when>
+		<xsl:when test="$v='darkcyan'">#08B8B0</xsl:when>
+		<xsl:when test="$v='darkgoldenrod'">#B886B0</xsl:when>
+		<xsl:when test="$v='darkgray' or $v='darkgrey'">#A9A9A9</xsl:when>
+		<xsl:when test="$v='darkgreen'">#064000</xsl:when>
+		<xsl:when test="$v='darkkhaki'">#BDB76B</xsl:when>
+		<xsl:when test="$v='darkmagenta'">#8B08B0</xsl:when>
+		<xsl:when test="$v='darkolivegreen'">#556B2F</xsl:when>
+		<xsl:when test="$v='darkorange'">#FF8C00</xsl:when>
+		<xsl:when test="$v='darkorchid'">#9932CC</xsl:when>
+		<xsl:when test="$v='darkred'">#8B0000</xsl:when>
+		<xsl:when test="$v='darksalmon'">#E9967A</xsl:when>
+		<xsl:when test="$v='darkseagreen'">#8FBC8F</xsl:when>
+		<xsl:when test="$v='darkslateblue'">#483D8B</xsl:when>
+		<xsl:when test="$v='darkslategray'">#2F4F4F</xsl:when>
+		<xsl:when test="$v='darkslategrey'">#2F4F4F</xsl:when>
+		<xsl:when test="$v='darkturquoise'">#0CED10</xsl:when>
+		<xsl:when test="$v='darkviolet'">#940D30</xsl:when>
+		<xsl:when test="$v='deeppink'">#FF1493</xsl:when>
+		<xsl:when test="$v='deepskyblue'">#0BFFF0</xsl:when>
+		<xsl:when test="$v='dimgray' or $v='dimgrey'">#696969</xsl:when>
+		<xsl:when test="$v='dodgerblue'">#1E90FF</xsl:when>
+		<xsl:when test="$v='firebrick'">#B22222</xsl:when>
+		<xsl:when test="$v='floralwhite'">#FFFAF0</xsl:when>
+		<xsl:when test="$v='forestgreen'">#228B22</xsl:when>
+		<xsl:when test="$v='fuchsia'">#FF0FF0</xsl:when>
+		<xsl:when test="$v='gainsboro'">#DCDCDC</xsl:when>
+		<xsl:when test="$v='ghostwhite'">#F8F8FF</xsl:when>
+		<xsl:when test="$v='gold'">#FFD700</xsl:when>
+		<xsl:when test="$v='goldenrod'">#DAA520</xsl:when>
+		<xsl:when test="$v='gray' or $v='grey'">#808080</xsl:when>
+		<xsl:when test="$v='green'">#080000</xsl:when>
+		<xsl:when test="$v='greenyellow'">#ADFF2F</xsl:when>
+		<xsl:when test="$v='honeydew'">#F0FFF0</xsl:when>
+		<xsl:when test="$v='hotpink'">#FF69B4</xsl:when>
+		<xsl:when test="$v='indianred'">#CD5C5C</xsl:when>
+		<xsl:when test="$v='indigo'">#4B0820</xsl:when>
+		<xsl:when test="$v='ivory'">#FFFFF0</xsl:when>
+		<xsl:when test="$v='khaki'">#F0E68C</xsl:when>
+		<xsl:when test="$v='lavender'">#E6E6FA</xsl:when>
+		<xsl:when test="$v='lavenderblush'">#FFF0F5</xsl:when>
+		<xsl:when test="$v='lawngreen'">#7CFC00</xsl:when>
+		<xsl:when test="$v='lemonchiffon'">#FFFACD</xsl:when>
+		<xsl:when test="$v='lightblue'">#ADD8E6</xsl:when>
+		<xsl:when test="$v='lightcoral'">#F08080</xsl:when>
+		<xsl:when test="$v='lightcyan'">#E0FFFF</xsl:when>
+		<xsl:when test="$v='lightgoldenrodyellow'">#FAFAD2</xsl:when>
+		<xsl:when test="$v='lightgray' or $v='lightgrey'">#D3D3D3</xsl:when>
+		<xsl:when test="$v='lightgreen'">#90EE90</xsl:when>
+		<xsl:when test="$v='lightpink'">#FFB6C1</xsl:when>
+		<xsl:when test="$v='lightsalmon'">#FFA07A</xsl:when>
+		<xsl:when test="$v='lightseagreen'">#20B2AA</xsl:when>
+		<xsl:when test="$v='lightskyblue'">#87CEFA</xsl:when>
+		<xsl:when test="$v='lightslategray'">#778899</xsl:when>
+		<xsl:when test="$v='lightslategrey'">#778899</xsl:when>
+		<xsl:when test="$v='lightsteelblue'">#B0C4DE</xsl:when>
+		<xsl:when test="$v='lightyellow'">#FFFFE0</xsl:when>
+		<xsl:when test="$v='lime'">#0FF000</xsl:when>
+		<xsl:when test="$v='limegreen'">#32CD32</xsl:when>
+		<xsl:when test="$v='linen'">#FAF0E6</xsl:when>
+		<xsl:when test="$v='magenta'">#FF0FF0</xsl:when>
+		<xsl:when test="$v='maroon'">#800000</xsl:when>
+		<xsl:when test="$v='mediumaquamarine'">#66CDAA</xsl:when>
+		<xsl:when test="$v='mediumblue'">#00CD00</xsl:when>
+		<xsl:when test="$v='mediumorchid'">#BA55D3</xsl:when>
+		<xsl:when test="$v='mediumpurple'">#9370DB</xsl:when>
+		<xsl:when test="$v='mediumseagreen'">#3CB371</xsl:when>
+		<xsl:when test="$v='mediumslateblue'">#7B68EE</xsl:when>
+		<xsl:when test="$v='mediumspringgreen'">#0FA9A0</xsl:when>
+		<xsl:when test="$v='mediumturquoise'">#48D1CC</xsl:when>
+		<xsl:when test="$v='mediumvioletred'">#C71585</xsl:when>
+		<xsl:when test="$v='midnightblue'">#191970</xsl:when>
+		<xsl:when test="$v='mintcream'">#F5FFFA</xsl:when>
+		<xsl:when test="$v='mistyrose'">#FFE4E1</xsl:when>
+		<xsl:when test="$v='moccasin'">#FFE4B5</xsl:when>
+		<xsl:when test="$v='navajowhite'">#FFDEAD</xsl:when>
+		<xsl:when test="$v='navy'">#008000</xsl:when>
+		<xsl:when test="$v='oldlace'">#FDF5E6</xsl:when>
+		<xsl:when test="$v='olive'">#808000</xsl:when>
+		<xsl:when test="$v='olivedrab'">#6B8E23</xsl:when>
+		<xsl:when test="$v='orange'">#FFA500</xsl:when>
+		<xsl:when test="$v='orangered'">#FF4500</xsl:when>
+		<xsl:when test="$v='orchid'">#DA70D6</xsl:when>
+		<xsl:when test="$v='palegoldenrod'">#EEE8AA</xsl:when>
+		<xsl:when test="$v='palegreen'">#98FB98</xsl:when>
+		<xsl:when test="$v='paleturquoise'">#AFEEEE</xsl:when>
+		<xsl:when test="$v='palevioletred'">#DB7093</xsl:when>
+		<xsl:when test="$v='papayawhip'">#FFEFD5</xsl:when>
+		<xsl:when test="$v='peachpuff'">#FFDAB9</xsl:when>
+		<xsl:when test="$v='peru'">#CD853F</xsl:when>
+		<xsl:when test="$v='pink'">#FFC0CB</xsl:when>
+		<xsl:when test="$v='plum'">#DDA0DD</xsl:when>
+		<xsl:when test="$v='powderblue'">#B0E0E6</xsl:when>
+		<xsl:when test="$v='purple'">#800800</xsl:when>
+		<xsl:when test="$v='red'">#FF0000</xsl:when>
+		<xsl:when test="$v='rosybrown'">#BC8F8F</xsl:when>
+		<xsl:when test="$v='royalblue'">#4169E1</xsl:when>
+		<xsl:when test="$v='saddlebrown'">#8B4513</xsl:when>
+		<xsl:when test="$v='salmon'">#FA8072</xsl:when>
+		<xsl:when test="$v='sandybrown'">#F4A460</xsl:when>
+		<xsl:when test="$v='seagreen'">#2E8B57</xsl:when>
+		<xsl:when test="$v='seashell'">#FFF5EE</xsl:when>
+		<xsl:when test="$v='sienna'">#A0522D</xsl:when>
+		<xsl:when test="$v='silver'">#C0C0C0</xsl:when>
+		<xsl:when test="$v='skyblue'">#87CEEB</xsl:when>
+		<xsl:when test="$v='slateblue'">#6A5ACD</xsl:when>
+		<xsl:when test="$v='slategray' or $v='slategrey'">#708090</xsl:when>
+		<xsl:when test="$v='snow'">#FFFAFA</xsl:when>
+		<xsl:when test="$v='springgreen'">#0FF7F0</xsl:when>
+		<xsl:when test="$v='steelblue'">#4682B4</xsl:when>
+		<xsl:when test="$v='tan'">#D2B48C</xsl:when>
+		<xsl:when test="$v='teal'">#080800</xsl:when>
+		<xsl:when test="$v='thistle'">#D8BFD8</xsl:when>
+		<xsl:when test="$v='tomato'">#FF6347</xsl:when>
+		<xsl:when test="$v='turquoise'">#40E0D0</xsl:when>
+		<xsl:when test="$v='violet'">#EE82EE</xsl:when>
+		<xsl:when test="$v='wheat'">#F5DEB3</xsl:when>
+		<xsl:when test="$v='white'">#FFFFFF</xsl:when>
+		<xsl:when test="$v='whitesmoke'">#F5F5F5</xsl:when>
+		<xsl:when test="$v='yellow'">#FFFF00</xsl:when>
+		<xsl:when test="$v='yellowgreen'">#9ACD32</xsl:when>
+		<xsl:when test="starts-with($v,'rgb(')">
+			<xsl:variable name="c" select="substring-before(substring-after($v,'rgb('),')')"/>
+			<xsl:text>#</xsl:text>
+			<xsl:call-template name="hex"><xsl:with-param name="v" select="substring-before($c,',')"/></xsl:call-template>
+			<xsl:call-template name="hex"><xsl:with-param name="v" select="substring-before(substring-after($c,','),',')"/></xsl:call-template>
+			<xsl:call-template name="hex"><xsl:with-param name="v" select="substring-after(substring-after($c,','),',')"/></xsl:call-template>
+		</xsl:when>
+		<xsl:when test="string-length($v)=4 and starts-with($v,'#')">#<xsl:value-of select="concat(substring($v,2,1),substring($v,2,1),substring($v,3,1),substring($v,3,1),substring($v,4,1),substring($v,4,1))"/></xsl:when> <!-- make #aaa into #aaaaaa  -->
+		<xsl:otherwise><xsl:value-of select="translate($v,'abcdef','ABCDEF')"/></xsl:otherwise>
+	</xsl:choose>	
+</xsl:template>
+
+<xsl:template name="hex"><xsl:param name="v"/>
+	<xsl:choose>
+		<xsl:when test="(floor($v div 16) mod 16 ) &gt; 9"><xsl:number value="(floor($v div 16) mod 16) - 9 " format="A"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="floor($v div 16) mod 16"/></xsl:otherwise>
+	</xsl:choose>
+	<xsl:choose>
+		<xsl:when test="($v mod 16 ) &gt; 9"><xsl:number value="($v mod 16) - 9 " format="A"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$v mod 16"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="page">
+		<Page ID='0' NameU='Page-1' ViewScale='1' ViewCenterX='-2.5295275590551' ViewCenterY='-1.5698818897638'>
+			<PageSheet LineStyle='0' FillStyle='0' TextStyle='0'>
+				<PageProps>
+					<PageWidth Unit='MM'>11.69291338582677</PageWidth>
+					<PageHeight Unit='MM'>8.26771653543307</PageHeight>
+					<ShdwOffsetX>0.1181102362204724</ShdwOffsetX><ShdwOffsetY F='-0.11811023622047DP'>-0.1181102362204724</ShdwOffsetY>
+					<PageScale Unit='MM'>0.03937007874015748</PageScale>
+					<DrawingScale Unit='MM'>0.03937007874015748</DrawingScale>
+					<DrawingSizeType>1</DrawingSizeType><DrawingScaleType>0</DrawingScaleType>
+					<InhibitSnap>0</InhibitSnap><UIVisibility F='No Formula'>0</UIVisibility><ShdwType F='No Formula'>0</ShdwType><ShdwObliqueAngle>0</ShdwObliqueAngle><ShdwScaleFactor>1</ShdwScaleFactor>
+				</PageProps>
+				<XForm><PinX>0</PinX><PinY>0</PinY><Width>1</Width><Height>1</Height><LocPinX F='Width*0'>0</LocPinX><LocPinY F='0'>0</LocPinY><Angle>0</Angle></XForm>
+				<PageLayout><ResizePage>0</ResizePage><EnableGrid>0</EnableGrid><DynamicsOff>0</DynamicsOff><CtrlAsInput>0</CtrlAsInput><PlaceStyle>0</PlaceStyle><RouteStyle>0</RouteStyle><PlaceDepth>0</PlaceDepth><PlowCode>0</PlowCode><LineJumpCode>1</LineJumpCode><LineJumpStyle>0</LineJumpStyle><PageLineJumpDirX>0</PageLineJumpDirX><PageLineJumpDirY>0</PageLineJumpDirY><LineToNodeX>0.09842519685039369</LineToNodeX><LineToNodeY>0.09842519685039369</LineToNodeY><BlockSizeX>0.1968503937007874</BlockSizeX><BlockSizeY>0.1968503937007874</BlockSizeY><AvenueSizeX>0.2952755905511811</AvenueSizeX><AvenueSizeY>0.2952755905511811</AvenueSizeY><LineToLineX>0.09842519685039369</LineToLineX><LineToLineY>0.09842519685039369</LineToLineY><LineJumpFactorX>0.66666666666667</LineJumpFactorX><LineJumpFactorY>0.66666666666667</LineJumpFactorY><LineAdjustFrom>0</LineAdjustFrom><LineAdjustTo>0</LineAdjustTo><PlaceFlip F='No Formula'>0</PlaceFlip><LineRouteExt F='No Formula'>0</LineRouteExt><PageShapeSplit>0</PageShapeSplit></PageLayout>
+				<xsl:call-template name="printprops"/>
+			</PageSheet>
+			<Shapes>
+				<xsl:apply-templates select="/s:svg/s:g"/>
+			</Shapes>		
+			<Connects>
+				<Connect FromSheet='73' FromCell='BeginX' FromPart='9' ToSheet='14' ToCell='Connections.X4' ToPart='103'/>
+				<Connect FromSheet='75' FromCell='EndX' FromPart='12' ToSheet='14' ToCell='Connections.X2' ToPart='101'/>
+			</Connects>			
+		</Page>
+</xsl:template>
+
+<xsl:template match="s:g" priority="-2">
+<xsl:comment>group: <xsl:value-of select="@class"/></xsl:comment>
+	<xsl:apply-templates select="s:g|s:rect[@class='cbox']|s:text"/>
+</xsl:template>
+
+
+<xsl:template match="s:g[@class='layer-group']">
+	<xsl:comment>Layer group </xsl:comment>
+	<Shape Type='Shape' LineStyle='3' FillStyle='3' TextStyle='3'>
+		<xsl:call-template name="ID"/>
+		<xsl:variable name="pos"><xsl:apply-templates select="s:rect[1]" mode="position"/></xsl:variable>
+	<XForm>
+	<!-- WHY? Why does it need the extra 0.5? -->
+		<PinX><xsl:value-of select=" $Scale * ( 5 + s:rect[1]/@x) "/></PinX>
+		<PinY><xsl:value-of select="$Scale * (-5 + 297 - s:rect[1]/@y)"/></PinY>
+		<Width><xsl:value-of select="s:rect[1]/@height * $Scale"/></Width>
+		<Height><xsl:value-of select="s:rect[1]/@width * $Scale"/></Height>
+		<LocPinX F="Width"/>
+		<LocPinY F="Height"/>
+		<Angle>1.5707963267949</Angle>		
+	</XForm>
+	<Line>
+		<LinePattern>0</LinePattern>
+		<Rounding><xsl:value-of select="$Scale * s:rect[1]/@rx"/></Rounding>
+	</Line>
+     <Fill>
+	<FillForegnd>
+		<xsl:call-template name="color-value">
+			<xsl:with-param name="v" select="s:rect[1]/@fill"/>
+		</xsl:call-template>
+	</FillForegnd>
+	<FillBkgnd>0</FillBkgnd><FillPattern>1</FillPattern>
+     </Fill>
+     <TextBlock><VerticalAlign>0</VerticalAlign></TextBlock>
+     <Geom IX="0">
+     <MoveTo IX='1'><X>0</X><Y>0</Y></MoveTo>
+	<LineTo IX='2'><X F='Width'/><Y>0</Y></LineTo>
+	<LineTo IX='3'><X F='Width'/><Y F='Height'/></LineTo>
+	<LineTo IX='4'><X>0</X><Y F='Height'/></LineTo>
+	<LineTo IX='5'><X>0</X><Y>0</Y></LineTo>
+     </Geom>
+	<xsl:if test="s:text">
+<!--		<TextXForm>
+	     		 <TxtPinX><xsl:value-of select="  $Scale * (s:text[1]/@y  - s:rect[1]/@x)"/></TxtPinX>	
+			<TxtAngle>1.5707963267949</TxtAngle>
+		</TextXForm>-->
+		<Char IX='0'><Font>4</Font><Color>0</Color><Style>1</Style><xsl:apply-templates mode="Font" select="s:text[1]"/><UseVertical F='Inh'>1</UseVertical></Char>
+		<xsl:element name="Text"  xml:space='preserve'><cp IX='0'/><xsl:value-of select="s:text[1]"/></xsl:element>     
+	</xsl:if>
+    </Shape>
+</xsl:template>
+
+
+<xsl:template match="s:g[@class='layer']">
+<xsl:comment>Layer</xsl:comment>
+	<xsl:apply-templates select="s:a/s:rect[@rx]|s:rect[@rx]" mode="layer"/>
+	<xsl:apply-templates select="s:g"/>
+</xsl:template>
+
+<xsl:template name="pin">
+	<LocPinX F='0'/><LocPinY F="0"/>
+</xsl:template>
+
+<xsl:template match="s:rect" mode="layer">
+	<Shape Type='Shape' LineStyle='3' FillStyle='3' TextStyle='3' Master='2'>
+		<xsl:call-template name="ID"/>
+		<XForm>
+			<xsl:variable name="pos"><xsl:apply-templates select="." mode="position"/></xsl:variable>
+			<PinX><xsl:value-of select="$Scale * substring-before($pos,',')"/></PinX>
+			<PinY><xsl:value-of select="$Scale * (297 - substring-after($pos,','))"/></PinY>
+			<Width><xsl:value-of select="@height * $Scale"/></Width><Height><xsl:value-of select="@width* $Scale"/></Height>
+			<Angle>1.5707963267949</Angle>
+			<LocPinX F='Width'/><LocPinY F="Height"/>
+		</XForm>
+		<xsl:variable name="cnt">
+			<xsl:apply-templates select="." mode="unstyle"/>
+		</xsl:variable>
+		<xsl:call-template name="line">
+			<xsl:with-param name="content" select="$cnt"/>
+		</xsl:call-template>
+		<xsl:call-template name="fill">
+			<xsl:with-param name="content" select="$cnt"/>
+		</xsl:call-template>
+		<xsl:for-each select="following-sibling::s:text[1]">
+			<xsl:call-template name="font"/>		
+		</xsl:for-each>	
+	</Shape>
+</xsl:template>
+
+<xsl:template name="ID"><xsl:param select="0" name="off"/>
+	<xsl:attribute name="ID"><xsl:value-of select="1+  count(preceding::*) + $off"/></xsl:attribute>
+</xsl:template>
+
+
+<xsl:template match="s:g[@class]" priority="-1">
+<xsl:comment>group: <xsl:value-of select="@class"/></xsl:comment>
+	
+	<Shape Type='Shape' LineStyle='6'  TextStyle='6' FillStyle='6'>
+		<xsl:call-template name="ID"/>
+		<xsl:variable name="bbox" select="s:rect[1] | s:use[1]"/>
+		<xsl:variable name="h" select="$Scale * $bbox/@height"/>
+		<xsl:variable name="pos"><xsl:apply-templates select="$bbox" mode="position"/></xsl:variable>
+		<XForm>
+			<PinX><xsl:value-of select="$Scale * substring-before($pos,',')"/></PinX>
+			<PinY><xsl:value-of select="$Scale * (297 - substring-after($pos,','))"/></PinY>
+			<Width><xsl:value-of select="$Scale * $bbox/@width"/></Width><Height><xsl:value-of select="$h"/></Height>
+			<LocPinX F='0'/><LocPinY F="Height"/>
+		</XForm>
+		<xsl:variable name="cnt">
+			<xsl:apply-templates select="s:rect|s:use" mode="unstyle"/>
+		</xsl:variable>
+		<xsl:call-template name="line">
+			<xsl:with-param name="content" select="$cnt"/>
+		</xsl:call-template>
+		<xsl:call-template name="fill">
+			<xsl:with-param name="content" select="$cnt"/>
+		</xsl:call-template>
+			
+		<xsl:for-each select="s:a/s:text[@class]|s:text[@class]">
+		<xsl:if test="@x * 2 != @width and @class!='collection'">
+			<TextXForm>
+				<TxtPinX><xsl:value-of select="(@x - $bbox/@x) * $Scale"/></TxtPinX>
+				<TxtPinY><xsl:value-of select="$h - (@y - $bbox/@y) * $Scale"/></TxtPinY>
+				<TxtWidth><xsl:value-of select="@width * $Scale"/></TxtWidth>
+			</TextXForm>
+		</xsl:if>
+			<xsl:call-template name="font"/>		
+		</xsl:for-each>			
+	<Geom IX='0'>
+			<NoFill>0</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap F='No Formula'>0</NoSnap>
+			<xsl:choose>
+				<xsl:when test="s:use/@xlink:href='#Borderbox-clipAll'">
+					<MoveTo IX='1'><X F='Width'/><Y F='Height*0.26666666666667'/></MoveTo>
+					<LineTo IX='2'><X F='Width'/><Y F='Height*0.73333333333333'/></LineTo>
+					<LineTo IX='3'><X F='Width*0.73333333333333'/><Y F='Height'/></LineTo>
+					<LineTo IX='4'><X F='Width*0.26666666666667'/><Y F='Height'/></LineTo>
+					<LineTo IX='5'><X F='Width*0'/><Y F='Height*0.73333333333333'/></LineTo>
+					<LineTo IX='6'><X F='Width*0'/><Y F='Height*0.26666666666667'/></LineTo>
+					<LineTo IX='7'><X F='Width*0.26666666666667'/><Y F='0'/></LineTo>
+					<LineTo IX='8'><X F='Width*0.73333333333333'/><Y F='0'/></LineTo>
+					<LineTo IX='9'><X F='Geometry1.X1'/><Y F='Geometry1.Y1'/></LineTo>
+				</xsl:when>
+				<xsl:when test="s:use/@xlink:href='#Borderbox-clipRT'">
+					<MoveTo IX='1'><X F='Width'/><Y F='0'/></MoveTo>
+					<LineTo IX='2'><X F='Width'/><Y F='Height*0.73333333333333'/></LineTo>
+					<LineTo IX='3'><X F='Width*0.73333333333333'/><Y F='Height'/></LineTo>
+					<LineTo IX='4'><X F='0'/><Y F='Height'/></LineTo>
+					<LineTo IX='5'><X F='0'/><Y F='0'/></LineTo>
+					<LineTo IX='6'><X F='Width*0.73333333333333'/><Y F='0'/></LineTo>
+					<LineTo IX='7'><X F='Geometry1.X1'/><Y F='Geometry1.Y1'/></LineTo>
+				</xsl:when>
+				<xsl:when test="s:use/@xlink:href='#Borderbox-clipLB'">
+					<MoveTo IX='1'><X F='Width'/><Y F='0'/></MoveTo>
+					<LineTo IX='2'><X F='Width'/><Y F='Height'/></LineTo>
+					<LineTo IX='3'><X F='0'/><Y F='Height'/></LineTo>
+					<LineTo IX='6'><X F='0'/><Y F='Height*0.26666666666667'/></LineTo>
+					<LineTo IX='7'><X F='Width*0.26666666666667'/><Y F='0'/></LineTo>
+					<LineTo IX='9'><X F='Geometry1.X1'/><Y F='Geometry1.Y1'/></LineTo>
+				</xsl:when>				
+				<xsl:when test="s:use/@xlink:href='#Borderbox-clipRB'">
+					<MoveTo IX='1'><X F='Width'/><Y F='0'/></MoveTo>
+					<LineTo IX='2'><X F='Width'/><Y F='Height'/></LineTo>
+					<LineTo IX='3'><X F='Width*0.26666666666667'/><Y F='Height'/></LineTo>
+					<LineTo IX='4'><X F='0'/><Y F='Height*0.73333333333333'/></LineTo>
+					<LineTo IX='5'><X F='0'/><Y F='0'/></LineTo>
+					<LineTo IX='6'><X F='Geometry1.X1'/><Y F='Geometry1.Y1'/></LineTo>				
+				</xsl:when>				
+				<xsl:when test="s:use/@xlink:href='#Borderbox-clipLT'">
+					<MoveTo IX='1'><X F='0'/><Y F='Height'/></MoveTo>
+					<LineTo IX='2'><X F='0'/><Y F='0'/></LineTo>
+					<LineTo IX='3'><X F='Width*0.73333333333333'/><Y F='0'/></LineTo>
+					<LineTo IX='4'><X F='Width'/><Y F='Height*0.26666666666667'/></LineTo>
+					<LineTo IX='5'><X F='Width'/><Y F='Height'/></LineTo>
+					<LineTo IX='6'><X F='Geometry1.X1'/><Y F='Geometry1.Y1'/></LineTo>
+				</xsl:when>			
+				<xsl:when test="s:use/@xlink:href='#Borderround'">					
+			      <Ellipse IX="1">
+			       <X F="Width*0.5"/>
+			       <Y F="Height*0.5"/>
+			       <A Unit="DL" F="Width*1"/>
+			       <B Unit="DL" F="Height*0.5"/>
+			       <C Unit="DL" F="Width*0.5"/>
+			       <D Unit="DL" F="Height*1"/>
+			      </Ellipse>
+				</xsl:when>				
+				<xsl:when test="starts-with(s:use/@xlink:href,'#BorderShape') and  key('symbol',substring(s:use/@xlink:href,2))/s:path/@d='M 0 0 L 0 20 L 20 20 L 20 8 L 17.6 5.6 A 2.7 2.7 30 1 0 14.4 2.4 L12 0 z' ">
+				  <MoveTo IX="1">
+			       <X F="Width*0.70911021230584"/>
+			       <Y F="Height*0.89998230538631"/>
+			      </MoveTo>
+			      <LineTo IX="2">
+			       <X F="Width*0.6"/>
+			       <Y F="Height"/>
+			      </LineTo>
+			      <LineTo IX="3">
+			       <X F="0"/><Y F="Height"/>
+			      </LineTo>
+			      <LineTo IX="4">
+			       <X F="0"/><Y F="0"/>
+			      </LineTo>
+			      <LineTo IX="5">
+			       <X F="Width"/><Y F="0"/>
+			      </LineTo>
+			      <LineTo IX="6">
+			       <X F="Width"/>
+			       <Y F="Height*0.63333333333333"/>
+			      </LineTo>
+			      <LineTo IX="7">
+			       <X F="Width*0.90296525939227"/>
+			       <Y F="Height*0.72228184555708"/>
+			      </LineTo>
+			      <EllipticalArcTo IX="8">
+			       <X F="Width*0.70911021230584"/>
+			       <Y F="Height*0.89998230538631"/>
+			       <A Unit="DL" F="Width*0.93739432237329"/>
+			       <B Unit="DL" F="Height*0.95443016986177"/>
+			       <C Unit="DA"/>
+			       <D F="Width/Height"/>
+			      </EllipticalArcTo>
+				</xsl:when>
+				<xsl:otherwise>
+					<MoveTo IX='1'><X F='0'/><Y F='Height'/></MoveTo>
+					<LineTo IX='2'><X F='0'/><Y F='0'/></LineTo>
+					<LineTo IX='3'><X F='Width'/><Y F='0'/></LineTo>
+					<LineTo IX='4'><X F='Width'/><Y F='Height'/></LineTo>
+					<LineTo IX='5'><X F='Geometry1.X1'/><Y F='Geometry1.Y1'/></LineTo>
+				</xsl:otherwise>
+			</xsl:choose>
+<!--			<MoveTo IX='1'><X F='0'/><Y F='0'/></MoveTo>
+			<LineTo IX='2'><X F='Width'/><Y F='0'/></LineTo>
+			<LineTo IX='3'><X F='Width'/><Y F='Height'/></LineTo>
+			<LineTo IX='4'><X F='0'/><Y F='Height'/></LineTo>
+			<LineTo IX='5'><X F='0'/><Y F='0'/></LineTo>-->
+	</Geom>		
+	</Shape>
+	<xsl:apply-templates select="s:g"/>	
+</xsl:template>
+
+
+<xsl:template match="s:g[@class='legend']">
+<xsl:comment>Legend</xsl:comment>
+	<Shape Type='Shape' LineStyle='1' TextStyle='3'>
+		<xsl:call-template name="ID"/>
+		<Fill><FillForegnd>#ffffff</FillForegnd><FillPattern>1</FillPattern></Fill>		
+		<xsl:for-each select="s:text[1]">
+			<XForm>
+				<xsl:variable name="pos"><xsl:apply-templates select="." mode="position"/></xsl:variable>			
+				<xsl:variable name="opos"><xsl:apply-templates select="following-sibling::s:g/s:rect[1]" mode="position"/></xsl:variable>			
+				<PinX><xsl:value-of select="$Scale * substring-before($pos,',')"/></PinX>
+				<PinY><xsl:value-of select="$Scale * (297 - substring-after($opos,','))"/></PinY>
+				<Width>6</Width><Height><xsl:value-of select="$Scale * following-sibling::s:g/s:rect[1]/@height"/></Height>
+				<LocPinX F='Width*0.5'/><LocPinY F='Height'/>
+			</XForm>
+			<TextBlock><LeftMargin Unit='PT'>0.02777777777777778</LeftMargin><RightMargin Unit='PT'>0.02777777777777778</RightMargin><TopMargin Unit='PT'>0.02777777777777778</TopMargin><BottomMargin Unit='PT'>0.02777777777777778</BottomMargin><VerticalAlign>0</VerticalAlign><TextBkgnd>0</TextBkgnd><DefaultTabStop>0.5905511811023622</DefaultTabStop><TextDirection>0</TextDirection><TextBkgndTrans F='No Formula'>0</TextBkgndTrans></TextBlock>
+			<xsl:variable name="color"><xsl:call-template name="color-value"><xsl:with-param name="v" select=" 'red' "/></xsl:call-template></xsl:variable>	
+			<Char IX='0'><Font>4</Font><Color><xsl:value-of select="$color"/></Color><Style>1</Style><xsl:apply-templates mode="Font" select="."/></Char>
+			<Char IX='1'><Font>4</Font><Color><xsl:value-of select="$color"/></Color><Style>3</Style><xsl:apply-templates mode="Font" select="."/></Char>
+			<Geom IX='0'><NoFill>0</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap F='No Formula'>0</NoSnap><MoveTo IX='1'><X F='Width*0'>0</X><Y F='Height*0'>0</Y></MoveTo><LineTo IX='2'><X F='Width*1'>3.467831298161776</X><Y F='Height*0'>0</Y></LineTo><LineTo IX='3'><X F='Width*1'>3.467831298161776</X><Y F='Height*1'>0.3645551956013876</Y></LineTo><LineTo IX='4'><X F='Width*0'>0</X><Y F='Height*1'>0.3645551956013876</Y></LineTo><LineTo IX='5'><X F='Width*0'>0</X><Y F='Height*0'>0</Y></LineTo></Geom>
+			<xsl:element name="Text"  xml:space='preserve'><cp IX='0'/><xsl:value-of select="concat(s:tspan[1],'&#xa;')"/><xsl:value-of select="s:tspan[2]"/><cp IX='1'/><xsl:value-of select="concat('&#xa;',s:tspan[3])"/></xsl:element>
+			</xsl:for-each>
+	</Shape>
+	<xsl:apply-templates select="s:g"/>
+</xsl:template>
+
+<!--<xsl:template match="s:g[not(@class='logo')]" priority="9"/>-->
+
+<xsl:template match="s:g[@class='logo' and s:title='Symbian OS']"><xsl:comment><xsl:value-of select="s:title"/> Logo</xsl:comment>
+	<xsl:variable name="pos"><xsl:apply-templates select="." mode="position"/></xsl:variable>
+			<xsl:variable name="X" select="$Scale * substring-before(normalize-space(substring-after($pos,'+')),' ')"/>
+			<xsl:variable name="Y" select="$Scale * (297 - substring-after(normalize-space(substring-after($pos,'+')),' '))"/>
+			<xsl:variable name=	"scale" select="$Scale * 10"/>
+			<xsl:variable name="id" select="count(//*)*10"/>
+
+
+<Shape ID='{$id}' Type='Group' LineStyle='8' FillStyle='8' TextStyle='8'>
+<XForm>
+	<PinX><xsl:value-of select="$X"/></PinX>
+	<PinY><xsl:value-of select="$Y"/></PinY>
+	<Width><xsl:value-of select="4.527559055118107 * $scale"/></Width>
+	<Height><xsl:value-of select="1.800607365558808* $scale"/></Height>	
+	<LocPinX F='-0.3*Height'/>
+	<LocPinY F='-0.2*Height'/>
+	<Angle>-3.1415926535898</Angle><FlipX>1</FlipX>
+</XForm>
+<Shapes>
+<!-- i dot-->
+<Shape ID='{$id+1}' Type='Shape' LineStyle='15' FillStyle='15' TextStyle='8'><XForm><PinX F='Sheet.{$id}!Width*0.68879766476156'>3.118572104235407</PinX><PinY F='Sheet.{$id}!Height*0.055680303136622'>0.1002583639443488</PinY><Width F='Sheet.{$id}!Width*0.040102027147705'>0.1815642961411839</Width><Height F='Sheet.{$id}!Height*0.10139639323556'>0.1825750925010467</Height><LocPinX F='Width*0.5'>0.09078214807059196</LocPinX><LocPinY F='Height*0.5'>0.09128754625052334</LocPinY></XForm><Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#fab83d</FillForegnd>
+</Fill><Geom IX='0'><MoveTo IX='1'><X F='Width*1'>0.1815642961411839</X><Y F='Height*0.49965397923875'>0.09122437147803084</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.49686847599165'>0.09021357511816668</X><Y F='Height*1'>0.1825750925010467</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 1,0.77785467128028,0,1, 0.7759220598469,1,0,1)'>NURBS(1, 3, 0, 0, 1,0.77785467128028,0,1, 0.7759220598469,1,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0'>0</X><Y F='Height*0.49965397923875'>0.09122437147803084</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.22407794015309,1,0,1, 0,0.77785467128028,0,1)'>NURBS(1, 3, 0, 0, 0.22407794015309,1,0,1, 0,0.77785467128028,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.50869867780097'>0.09236151738288402</X><Y F='Height*0'>0</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0,0.22283737024221,0,1, 0.2303409881698,0,0,1)'>NURBS(1, 3, 0, 0, 0,0.22283737024221,0,1, 0.2303409881698,0,0,1)</E></NURBSTo><NURBSTo IX='5'><X F='Width*1'>0.1815642961411839</X><Y F='Height*0.49965397923875'>0.09122437147803084</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.78218510786361,0,0,1, 1,0.22283737024221,0,1)'>NURBS(1, 3, 0, 0, 0.78218510786361,0,0,1, 1,0.22283737024221,0,1)</E></NURBSTo><LineTo IX='6'><X F='Width*1'>0.1815642961411839</X><Y F='Height*0.49965397923875'>0.09122437147803084</Y></LineTo></Geom></Shape>
+
+<!-- i base-->
+<Shape ID='{$id+2}' Type='Shape' LineStyle='16' FillStyle='16' TextStyle='8'><XForm><PinX F='Sheet.{$id}!Width*0.6886023173781'>3.117687657420529</PinX><PinY F='Sheet.{$id}!Height*0.34902813837625'>0.6284626367475548</PinY><Width F='Sheet.{$id}!Width*0.043841534202536'>0.1984951351689621</Width><Height F='Sheet.{$id}!Height*0.39646340607677'>0.7138749291563649</Height><LocPinX F='Width*0.5'>0.09924756758448103</LocPinX><LocPinY F='Height*0.5'>0.3569374645781824</LocPinY></XForm><Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#0082b8</FillForegnd>
+</Fill><Geom IX='0'><MoveTo IX='1'><X F='Width*0.49968173138129'>0.09918439281199015</X><Y F='Height*0'>0</Y></MoveTo><NURBSTo IX='2'><X F='Width*1'>0.1984951351689621</X><Y F='Height*0.49982300884956'>0.3568111150332008</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.77593889242521,0,0,1, 1,0.22389380530973,0,1)'>NURBS(1, 3, 0, 0, 0.77593889242521,0,0,1, 1,0.22389380530973,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.49968173138129'>0.09918439281199015</X><Y F='Height*1'>0.7138749291563649</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 1,0.77592920353982,0,1, 0.77593889242521,1,0,1)'>NURBS(1, 3, 0, 0, 1,0.77592920353982,0,1, 0.77593889242521,1,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0'>0</X><Y F='Height*0.49982300884956'>0.3568111150332008</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.22406110757479,1,0,1, 0,0.77592920353982,0,1)'>NURBS(1, 3, 0, 0, 0.22406110757479,1,0,1, 0,0.77592920353982,0,1)</E></NURBSTo><NURBSTo IX='5'><X F='Width*0.49968173138129'>0.09918439281199015</X><Y F='Height*0'>0</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0,0.22389380530973,0,1, 0.22406110757479,0,0,1)'>NURBS(1, 3, 0, 0, 0,0.22389380530973,0,1, 0.22406110757479,0,0,1)</E></NURBSTo><LineTo IX='6'><X F='Width*0.49968173138129'>0.09918439281199015</X><Y F='Height*0'>0</Y></LineTo></Geom></Shape>
+
+
+<Shape ID='{$id+3}' Type='Shape' LineStyle='17' FillStyle='17' TextStyle='8'><XForm><PinX F='Sheet.{$id}!Width*0.06116605643865'>0.276932932694675</PinX><PinY F='Sheet.{$id}!Height*0.35074731597783'>0.6315582005996634</PinY><Width F='Sheet.{$id}!Width*0.1223321128773'>0.55386586538935</Width><Height F='Sheet.{$id}!Height*0.39148129955793'>0.7049041114625431</Height><LocPinX F='Width*0.5'>0.276932932694675</LocPinX><LocPinY F='Height*0.5'>0.3524520557312715</LocPinY></XForm><Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#231f20</FillForegnd>
+</Fill><Geom IX='0'><MoveTo IX='1'><X F='Width*0.84738571037503'>0.4693380197954351</X><Y F='Height*0.25452590069905'>0.1794163538764673</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.5517382972899'>0.3055890094969169</X><Y F='Height*0.18641333572325'>0.1314035267827663</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.72762113331508,0.20666786162395,0,1, 0.64093439182407,0.18641333572325,0,1)'>NURBS(1, 3, 0, 0, 0.72762113331508,0.20666786162395,0,1, 0.64093439182407,0.18641333572325,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.39900994616297'>0.2209979891305113</X><Y F='Height*0.2789030292167'>0.1965998919942096</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.46012409891413,0.18641333572325,0,1, 0.39900994616297,0.22333751568381,0,1)'>NURBS(1, 3, 0, 0, 0.46012409891413,0.18641333572325,0,1, 0.39900994616297,0.22333751568381,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.54922894424674'>0.3041991645020997</X><Y F='Height*0.37461910736691'>0.2640705490153627</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.39900994616297,0.32658182469977,0,1, 0.43877178574687,0.35239290195376,0,1)'>NURBS(1, 3, 0, 0, 0.39900994616297,0.32658182469977,0,1, 0.43877178574687,0.35239290195376,0,1)</E></NURBSTo><LineTo IX='5'><X F='Width*0.69499954375399'>0.3849365237465071</X><Y F='Height*0.40401505646173'>0.284791874392645</Y></LineTo><NURBSTo IX='6'><X F='Width*0.93407245186605'>0.5173508468891418</X><Y F='Height*0.51102348091056'>0.3602225527477542</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.84282325029656,0.43359024914859,0,1, 0.89209781914408,0.46872199318874,0,1)'>NURBS(1, 3, 0, 0, 0.84282325029656,0.43359024914859,0,1, 0.89209781914408,0.46872199318874,0,1)</E></NURBSTo><NURBSTo IX='7'><X F='Width*1'>0.55386586538935</X><Y F='Height*0.67162573937982'>0.4734317450529055</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.97878456063509,0.55529664814483,0,1, 1,0.60889048216526,0,1)'>NURBS(1, 3, 0, 0, 0.97878456063509,0.55529664814483,0,1, 1,0.60889048216526,0,1)</E></NURBSTo><NURBSTo IX='8'><X F='Width*0.48587918605712'>0.2691118958601998</X><Y F='Height*1'>0.7049041114625431</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 1,0.8668220111131,0,1, 0.79332055844511,1,0,1)'>NURBS(1, 3, 0, 0, 1,0.8668220111131,0,1, 0.79332055844511,1,0,1)</E></NURBSTo><NURBSTo IX='9'><X F='Width*0'>0</X><Y F='Height*0.89101989603872'>0.6280835881126214</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.33803266721416,1,0,1, 0.17581439912401,0.96325506363147,0,1)'>NURBS(1, 3, 0, 0, 0.33803266721416,1,0,1, 0.17581439912401,0.96325506363147,0,1)</E></NURBSTo><LineTo IX='10'><X F='Width*0.11260151473675'>0.06236613540382168</X><Y F='Height*0.7103423552608'>0.5007232467693243</Y></LineTo><NURBSTo IX='11'><X F='Width*0.51167989780089'>0.2834020293978241</X><Y F='Height*0.81735077970963'>0.5761539251244335</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.20905192079569,0.75658720200753,0,1, 0.37551327675883,0.81735077970963,0,1)'>NURBS(1, 3, 0, 0, 0.20905192079569,0.75658720200753,0,1, 0.37551327675883,0.81735077970963,0,1)</E></NURBSTo><NURBSTo IX='12'><X F='Width*0.67127475134593'>0.3717961710682343</X><Y F='Height*0.7103423552608'>0.5007232467693243</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.60101286613742,0.81735077970963,0,1, 0.67127475134593,0.7711059329629,0,1)'>NURBS(1, 3, 0, 0, 0.60101286613742,0.81735077970963,0,1, 0.67127475134593,0.7711059329629,0,1)</E></NURBSTo><NURBSTo IX='13'><X F='Width*0.48587918605712'>0.2691118958601998</X><Y F='Height*0.59401326402581'>0.4187223920750786</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.67127475134593,0.64599390571787,0,1, 0.61287526234145,0.61265459759814,0,1)'>NURBS(1, 3, 0, 0, 0.67127475134593,0.64599390571787,0,1, 0.61287526234145,0.61265459759814,0,1)</E></NURBSTo><LineTo IX='14'><X F='Width*0.34499041883384'>0.1910784168784391</X><Y F='Height*0.57393798171715'>0.4045712430369329</Y></LineTo><NURBSTo IX='15'><X F='Width*0.12423578793686'>0.06880996219797674</X><Y F='Height*0.47786341638286'>0.3368478869258152</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.26510174285975,0.56282487901058,0,1, 0.1665754174651,0.51837246818426,0,1)'>NURBS(1, 3, 0, 0, 0.26510174285975,0.56282487901058,0,1, 0.1665754174651,0.51837246818426,0,1)</E></NURBSTo><NURBSTo IX='16'><X F='Width*0.05636919426955'>0.0312209725654047</X><Y F='Height*0.30829897831153'>0.2173212173714989</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.082124281412538,0.43735436458147,0,1, 0.05636919426955,0.36924179960566,0,1)'>NURBS(1, 3, 0, 0, 0.082124281412538,0.43735436458147,0,1, 0.05636919426955,0.36924179960566,0,1)</E></NURBSTo><NURBSTo IX='17'><X F='Width*0.52116981476412'>0.2886581704691366</X><Y F='Height*0'>0</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.05636919426955,0.12367807850869,0,1, 0.241627885756,0,0,1)'>NURBS(1, 3, 0, 0, 0.05636919426955,0.12367807850869,0,1, 0.241627885756,0,0,1)</E></NURBSTo><NURBSTo IX='18'><X F='Width*0.95072543115248'>0.5265743636729312</X><Y F='Height*0.088546334468542'>0.06241667522181275</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.71370563007574,0,0,1, 0.84054202025732,0.046244846746728,0,1)'>NURBS(1, 3, 0, 0, 0.71370563007574,0,0,1, 0.84054202025732,0.046244846746728,0,1)</E></NURBSTo><LineTo IX='19'><X F='Width*0.84738571037503'>0.4693380197954351</X><Y F='Height*0.25452590069905'>0.1794163538764673</Y></LineTo><LineTo IX='20'><X F='Width*0.84738571037503'>0.4693380197954351</X><Y F='Height*0.25452590069905'>0.1794163538764673</Y></LineTo></Geom></Shape>
+
+
+<Shape ID='{$id+4}' Type='Shape' LineStyle='17' FillStyle='17' TextStyle='8'><XForm><PinX F='Sheet.{$id}!Width*0.20261988747991'>0.9173735063066784</PinX><PinY F='Sheet.{$id}!Height*0.42804013753421'>0.7707322243989039</PinY><Width F='Sheet.{$id}!Width*0.14561752098589'>0.6592919257235173</Width><Height F='Sheet.{$id}!Height*0.53722545786261'>0.9673321163931188</Height><LocPinX F='Width*0.5'>0.3296459628617586</LocPinX><LocPinY F='Height*0.5'>0.4836660581965594</LocPinY></XForm><Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#231f20</FillForegnd>
+</Fill><Geom IX='0'><MoveTo IX='1'><X F='Width*0.27002683020314'>0.1780265088816454</X><Y F='Height*0'>0</Y></MoveTo><LineTo IX='2'><X F='Width*0.44576466078957'>0.293889041631446</X><Y F='Height*0.40190700104493'>0.3887775499140035</Y></LineTo><NURBSTo IX='3'><X F='Width*0.49885013415102'>0.3288878655918609</X><Y F='Height*0.5442789968652'>0.5264985539459376</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.46339593714067,0.44344305120167,0,1, 0.49885013415102,0.5442789968652,0,1)'>NURBS(1, 3, 0, 0, 0.46339593714067,0.44344305120167,0,1, 0.49885013415102,0.5442789968652,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.53066308930625'>0.3498618900591083</X><Y F='Height*0.43416927899687'>0.4199858875249167</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.49885013415102,0.5442789968652,0,1, 0.51858949789191,0.46760710553814,0,1)'>NURBS(1, 3, 0, 0, 0.49885013415102,0.5442789968652,0,1, 0.51858949789191,0.46760710553814,0,1)</E></NURBSTo><NURBSTo IX='5'><X F='Width*0.56975852817171'>0.3756371972357235</X><Y F='Height*0.33868861024033'>0.3276243701420225</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.53832886163281,0.41131138975967,0,1, 0.55404369490226,0.37095088819227,0,1)'>NURBS(1, 3, 0, 0, 0.53832886163281,0.41131138975967,0,1, 0.55404369490226,0.37095088819227,0,1)</E></NURBSTo><LineTo IX='6'><X F='Width*0.7217324645458'>0.4758323864075806</X><Y F='Height*0.010579937304076'>0.01023431314365834</Y></LineTo><LineTo IX='7'><X F='Width*1'>0.6592919257235173</X><Y F='Height*0.010579937304076'>0.01023431314365834</Y></LineTo><LineTo IX='8'><X F='Width*0.63319279417401'>0.4174588966252377</X><Y F='Height*0.7096394984326'>0.6864570778949583</Y></LineTo><NURBSTo IX='9'><X F='Width*0.43982368723649'>0.2899722057369635</X><Y F='Height*0.9367816091954'>0.9061789366211378</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.56400919892679,0.84273772204807,0,1, 0.51284016864699,0.90047021943574,0,1)'>NURBS(1, 3, 0, 0, 0.56400919892679,0.84273772204807,0,1, 0.51284016864699,0.90047021943574,0,1)</E></NURBSTo><NURBSTo IX='10'><X F='Width*0.195093905711'>0.1286238367931275</X><Y F='Height*1'>0.9673321163931188</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.37274817937907,0.9703500522466,0,1, 0.28593330778076,0.99190177638454,0,1)'>NURBS(1, 3, 0, 0, 0.37274817937907,0.9703500522466,0,1, 0.28593330778076,0.99190177638454,0,1)</E></NURBSTo><LineTo IX='11'><X F='Width*0.10444614794941'>0.06886050201596991</X><Y F='Height*0.88166144200627'>0.852859428638134</Y></LineTo><NURBSTo IX='12'><X F='Width*0.2681103871215'>0.1767630134318114</X><Y F='Height*0.8360762800418'>0.8087634374389202</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.16174779609046,0.87095088819227,0,1, 0.22844001533154,0.85488505747126,0,1)'>NURBS(1, 3, 0, 0, 0.16174779609046,0.87095088819227,0,1, 0.22844001533154,0.85488505747126,0,1)</E></NURBSTo><NURBSTo IX='13'><X F='Width*0.34285166730548'>0.2260393359753486</X><Y F='Height*0.7796499477534'>0.7541804340060809</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.29762361057877,0.82131661442006,0,1, 0.32138750479111,0.8025078369906,0,1)'>NURBS(1, 3, 0, 0, 0.29762361057877,0.82131661442006,0,1, 0.32138750479111,0.8025078369906,0,1)</E></NURBSTo><NURBSTo IX='14'><X F='Width*0.40034495975469'>0.2639441994703736</X><Y F='Height*0.69905956112853'>0.6762227647513057</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.36872364890763,0.75130616509927,0,1, 0.37658106554235,0.739289446186,0,1)'>NURBS(1, 3, 0, 0, 0.36872364890763,0.75130616509927,0,1, 0.37658106554235,0.739289446186,0,1)</E></NURBSTo><NURBSTo IX='15'><X F='Width*0.23859716366424'>0.157305183504366</X><Y F='Height*0.505355276907'>0.4888463895408789</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.40034495975469,0.69905956112853,0,1, 0.34285166730548,0.70128004179728,0,1)'>NURBS(1, 3, 0, 0, 0.40034495975469,0.69905956112853,0,1, 0.34285166730548,0.70128004179728,0,1)</E></NURBSTo><LineTo IX='16'><X F='Width*0'>0</X><Y F='Height*0.021421107628005'>0.02072132537728286</Y></LineTo><LineTo IX='17'><X F='Width*0.27002683020314'>0.1780265088816454</X><Y F='Height*0'>0</Y></LineTo><LineTo IX='18'><X F='Width*0.27002683020314'>0.1780265088816454</X><Y F='Height*0'>0</Y></LineTo></Geom></Shape>
+
+
+<Shape ID='{$id+5}' Type='Shape' LineStyle='17' FillStyle='17' TextStyle='8'><XForm><PinX F='Sheet.{$id}!Width*0.38566038578318'>1.746100171852979</PinX><PinY F='Sheet.{$id}!Height*0.34681776717423'>0.6244826260805785</PinY><Width F='Sheet.{$id}!Width*0.1930032148598'>0.873833453105393</Width><Height F='Sheet.{$id}!Height*0.37632446845835'>0.6776126097461085</Height><LocPinX F='Width*0.5'>0.4369167265526965</LocPinX><LocPinY F='Height*0.5'>0.3388063048730542</LocPinY></XForm><Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#231f20</FillForegnd>
+</Fill><Geom IX='0'><MoveTo IX='1'><X F='Width*0.18001735106998'>0.1573051835043664</X><Y F='Height*0'>0</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.20691150954309'>0.1808061988712878</X><Y F='Height*0.099944061159799'>0.06772335611111607</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.19346443030654,0.026664180495991,0,1, 0.19939271255061,0.049785567779228,0,1)'>NURBS(1, 3, 0, 0, 0.19346443030654,0.026664180495991,0,1, 0.19939271255061,0.049785567779228,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.39285714285714'>0.3432917137199733</X><Y F='Height*0'>0</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.25882012724118,0.034495618124184,0,1, 0.32287449392713,0,0,1)'>NURBS(1, 3, 0, 0, 0.25882012724118,0.034495618124184,0,1, 0.32287449392713,0,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.54757085020243'>0.4784857268522453</X><Y F='Height*0.080551929889987'>0.05458300343283965</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.45532099479468,0,0,1, 0.50751879699248,0.026664180495991,0,1)'>NURBS(1, 3, 0, 0, 0.45532099479468,0,0,1, 0.50751879699248,0.026664180495991,0,1)</E></NURBSTo><NURBSTo IX='5'><X F='Width*0.57735685367264'>0.5045137331188281</X><Y F='Height*0.1284728696625'>0.08705483649357826</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.55798149219202,0.09416371433899,0,1, 0.56868131868132,0.11131829200075,0,1)'>NURBS(1, 3, 0, 0, 0.55798149219202,0.09416371433899,0,1, 0.56868131868132,0.11131829200075,0,1)</E></NURBSTo><NURBSTo IX='6'><X F='Width*0.79323308270677'>0.6931536037790925</X><Y F='Height*0'>0</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.64748409485252,0.036360246130897,0,1, 0.70994794679005,0,0,1)'>NURBS(1, 3, 0, 0, 0.64748409485252,0.036360246130897,0,1, 0.70994794679005,0,0,1)</E></NURBSTo><NURBSTo IX='7'><X F='Width*0.94331983805668'>0.8243044314718887</X><Y F='Height*0.061346261420847'>0.04156900029954715</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.85280508964719,0,0,1, 0.9091960670908,0.022934924482566,0,1)'>NURBS(1, 3, 0, 0, 0.85280508964719,0,0,1, 0.9091960670908,0.022934924482566,0,1)</E></NURBSTo><NURBSTo IX='8'><X F='Width*1'>0.873833453105393</X><Y F='Height*0.30132388588477'>0.2041808646932176</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.9866975130133,0.10926720119336,0,1, 1,0.16707066940145,0,1)'>NURBS(1, 3, 0, 0, 0.9866975130133,0.10926720119336,0,1, 1,0.16707066940145,0,1)</E></NURBSTo><LineTo IX='9'><X F='Width*1'>0.873833453105393</X><Y F='Height*1'>0.6776126097461085</Y></LineTo><LineTo IX='10'><X F='Width*0.80653556969346'>0.7047777619175615</X><Y F='Height*1'>0.6776126097461085</Y></LineTo><LineTo IX='11'><X F='Width*0.80653556969346'>0.7047777619175615</X><Y F='Height*0.35110945366399'>0.2379161932037866</Y></LineTo><NURBSTo IX='12'><X F='Width*0.74421631000578'>0.6503211080297043</X><Y F='Height*0.21107589035987'>0.143027684921235</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.80653556969346,0.23401081484244,0,1, 0.79598033545402,0.21107589035987,0,1)'>NURBS(1, 3, 0, 0, 0.80653556969346,0.23401081484244,0,1, 0.79598033545402,0.21107589035987,0,1)</E></NURBSTo><NURBSTo IX='13'><X F='Width*0.61162521688837'>0.5344585752798993</X><Y F='Height*0.29367891105724'>0.1990005333488917</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.70691150954309,0.21107589035987,0,1, 0.65485829959514,0.24389334327802,0,1)'>NURBS(1, 3, 0, 0, 0.70691150954309,0.21107589035987,0,1, 0.65485829959514,0.24389334327802,0,1)</E></NURBSTo><LineTo IX='14'><X F='Width*0.61162521688837'>0.5344585752798993</X><Y F='Height*1'>0.6776126097461085</Y></LineTo><LineTo IX='15'><X F='Width*0.4224985540775'>0.3691933704415774</X><Y F='Height*1'>0.6776126097461085</Y></LineTo><LineTo IX='16'><X F='Width*0.4224985540775'>0.3691933704415774</X><Y F='Height*0.3608055192989'>0.2444863695429275</Y></LineTo><NURBSTo IX='17'><X F='Width*0.35425101214575'>0.3095563852094012</X><Y F='Height*0.20921126235316'>0.1417641894714025</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.4224985540775,0.23792653365654,0,1, 0.4091960670908,0.20921126235316,0,1)'>NURBS(1, 3, 0, 0, 0.4224985540775,0.23792653365654,0,1, 0.4091960670908,0.20921126235316,0,1)</E></NURBSTo><NURBSTo IX='18'><X F='Width*0.22325043377675'>0.1950836974544143</X><Y F='Height*0.28398284542234'>0.1924303570097575</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.31694621168305,0.20921126235316,0,1, 0.26633892423366,0.23401081484244,0,1)'>NURBS(1, 3, 0, 0, 0.31694621168305,0.20921126235316,0,1, 0.26633892423366,0.23401081484244,0,1)</E></NURBSTo><LineTo IX='19'><X F='Width*0.22325043377675'>0.1950836974544143</X><Y F='Height*1'>0.6776126097461085</Y></LineTo><LineTo IX='20'><X F='Width*0.02834008097166'>0.0247645108167521</X><Y F='Height*1'>0.6776126097461085</Y></LineTo><LineTo IX='21'><X F='Width*0.02834008097166'>0.0247645108167521</X><Y F='Height*0.31456274473243'>0.2131516823870409</Y></LineTo><NURBSTo IX='22'><X F='Width*0'>0</X><Y F='Height*0.06321088942756'>0.04283249574938162</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.02834008097166,0.17266455342159,0,1, 0.020821283979179,0.11131829200075,0,1)'>NURBS(1, 3, 0, 0, 0.02834008097166,0.17266455342159,0,1, 0.020821283979179,0.11131829200075,0,1)</E></NURBSTo><LineTo IX='23'><X F='Width*0.18001735106998'>0.1573051835043664</X><Y F='Height*0'>0</Y></LineTo><LineTo IX='24'><X F='Width*0.18001735106998'>0.1573051835043664</X><Y F='Height*0'>0</Y></LineTo></Geom></Shape>
+<!-- n-->
+<Shape ID='{$id+6}' Type='Shape' LineStyle='17' FillStyle='17' TextStyle='8'><XForm><PinX F='Sheet.{$id}!Width*0.9391074298982'>4.251864347964288</PinX><PinY F='Sheet.{$id}!Height*0.34537927163006'>0.6218924604084224</PinY><Width F='Sheet.{$id}!Width*0.12117119128416'>0.5486097243180468</Width><Height F='Sheet.{$id}!Height*0.3792014595467'>0.6827929410904385</Height><LocPinX F='Width*0.5'>0.2743048621590234</LocPinX><LocPinY F='Height*0.5'>0.3413964705452193</LocPinY></XForm><Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#231f20</FillForegnd>
+</Fill><Geom IX='0'><MoveTo IX='1'><X F='Width*0.28189774297559'>0.1546518430597181</X><Y F='Height*0'>0</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.32680792261631'>0.1792900043314874</X><Y F='Height*0.1219467061436'>0.0832643501440801</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.31045601105481,0.039970392301998,0,1, 0.32680792261631,0.081976313841598,0,1)'>NURBS(1, 3, 0, 0, 0.31045601105481,0.039970392301998,0,1, 0.32680792261631,0.081976313841598,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.46683555964993'>0.2561105276814092</X><Y F='Height*0.04940784603997'>0.03373532851057469</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.37448180561953,0.095299777942265,0,1, 0.41455550437586,0.072538860103626,0,1)'>NURBS(1, 3, 0, 0, 0.37448180561953,0.095299777942265,0,1, 0.41455550437586,0.072538860103626,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.6847075080608'>0.3756371972357323</X><Y F='Height*0.0075869726128788'>0.005180331344320125</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.53086135421465,0.022760917838637,0,1, 0.61400276370336,0.0075869726128788,0,1)'>NURBS(1, 3, 0, 0, 0.53086135421465,0.022760917838637,0,1, 0.61400276370336,0.0075869726128788,0,1)</E></NURBSTo><NURBSTo IX='5'><X F='Width*0.9765085214187'>0.5357220707297365</X><Y F='Height*0.14859363434493'>0.101458684621692</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.82012897282358,0.0075869726128788,0,1, 0.93850760018425,0.064766839378238,0,1)'>NURBS(1, 3, 0, 0, 0.82012897282358,0.0075869726128788,0,1, 0.93850760018425,0.064766839378238,0,1)</E></NURBSTo><NURBSTo IX='6'><X F='Width*1'>0.5486097243180468</X><Y F='Height*0.28737971872687'>0.1962208433592625</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.99309074159374,0.18467801628423,0,1, 1,0.22649888971133,0,1)'>NURBS(1, 3, 0, 0, 0.99309074159374,0.18467801628423,0,1, 1,0.22649888971133,0,1)</E></NURBSTo><LineTo IX='7'><X F='Width*1'>0.5486097243180468</X><Y F='Height*1'>0.6827929410904385</Y></LineTo><LineTo IX='8'><X F='Width*0.68724090280976'>0.377027042230548</X><Y F='Height*1'>0.6827929410904385</Y></LineTo><LineTo IX='9'><X F='Width*0.68724090280976'>0.377027042230548</X><Y F='Height*0.36565507031828'>0.2496667008872495</Y></LineTo><NURBSTo IX='10'><X F='Width*0.58060801473975'>0.3185272029032227</X><Y F='Height*0.22279792746114'>0.152124852160046</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.68724090280976,0.25518134715026,0,1, 0.66374942422847,0.22279792746114,0,1)'>NURBS(1, 3, 0, 0, 0.68724090280976,0.25518134715026,0,1, 0.66374942422847,0.22279792746114,0,1)</E></NURBSTo><NURBSTo IX='11'><X F='Width*0.35997236296637'>0.1974843388090961</X><Y F='Height*0.31032568467802'>0.2118881869372093</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.51681252878858,0.22279792746114,0,1, 0.43367111929986,0.25703182827535,0,1)'>NURBS(1, 3, 0, 0, 0.51681252878858,0.22279792746114,0,1, 0.43367111929986,0.25703182827535,0,1)</E></NURBSTo><LineTo IX='12'><X F='Width*0.35997236296637'>0.1974843388090961</X><Y F='Height*1'>0.6827929410904385</Y></LineTo><LineTo IX='13'><X F='Width*0.042376784891756'>0.02324831627695143</X><Y F='Height*1'>0.6827929410904385</Y></LineTo><LineTo IX='14'><X F='Width*0.042376784891756'>0.02324831627695143</X><Y F='Height*0.29330125832716'>0.200264028798728</Y></LineTo><NURBSTo IX='15'><X F='Width*0'>0</X><Y F='Height*0.064766839378238'>0.04422234074419915</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.042376784891756,0.20928941524796,0,1, 0.028327959465684,0.12953367875648,0,1)'>NURBS(1, 3, 0, 0, 0.042376784891756,0.20928941524796,0,1, 0.028327959465684,0.12953367875648,0,1)</E></NURBSTo><LineTo IX='16'><X F='Width*0.28189774297559'>0.1546518430597181</X><Y F='Height*0'>0</Y></LineTo><LineTo IX='17'><X F='Width*0.28189774297559'>0.1546518430597181</X><Y F='Height*0'>0</Y></LineTo></Geom></Shape>
+<!-- a-->
+<Shape ID='{$id+7}' Type='Shape' LineStyle='17' FillStyle='17' TextStyle='8'><XForm>
+<PinX F='Sheet.{$id}!Width*0.79417362475442'>3.595667986092844</PinX>
+<PinY F='Sheet.{$id}!Height*0.35211564100765'>0.6340220167268359</PinY>
+<Width F='Sheet.{$id}!Width*0.11678982854081'>0.5287728457556354</Width>
+<Height F='Sheet.{$id}!Height*0.38916567258438'>0.7007345764780822</Height><LocPinX F='Width*0.5'>0.2643864228778177</LocPinX><LocPinY F='Height*0.5'>0.3503672882390411</LocPinY></XForm><Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#231f20</FillForegnd>
+</Fill><Geom IX='0'><MoveTo IX='1'><X F='Width*0.99761051373955'>0.5275093503058033</X><Y F='Height*0.33393436711143'>0.2339993573093043</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.97538829151732'>0.5157588426223406</X><Y F='Height*0.1644428416877'>0.1152307850248828</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 1,0.23278038225748,0,1, 0.99259259259259,0.20320952037504,0,1)'>NURBS(1, 3, 0, 0, 1,0.23278038225748,0,1, 0.99259259259259,0.20320952037504,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.57228195937873'>0.302607160235302</X><Y F='Height*0'>0</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.92664277180406,0.059141723764875,0,1, 0.78231780167264,0,0,1)'>NURBS(1, 3, 0, 0, 0.92664277180406,0.059141723764875,0,1, 0.78231780167264,0,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.22986857825568'>0.1215482622740579</X><Y F='Height*0.055355210962856'>0.03878931030991179</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.45710872162485,0,0,1, 0.35221027479092,0.016949152542373,0,1)'>NURBS(1, 3, 0, 0, 0.45710872162485,0,0,1, 0.35221027479092,0.016949152542373,0,1)</E></NURBSTo><NURBSTo IX='5'><X F='Width*0.027001194743131'>0.01427749858312748</X><Y F='Height*0.13306887847097'>0.09324596419776855</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.14169653524492,0.083122971510999,0,1, 0.092712066905616,0.10169491525424,0,1)'>NURBS(1, 3, 0, 0, 0.14169653524492,0.083122971510999,0,1, 0.092712066905616,0.10169491525424,0,1)</E></NURBSTo><LineTo IX='6'><X F='Width*0.1663082437276'>0.08793928330846486</X><Y F='Height*0.31013342949874'>0.2173212173714948</Y></LineTo><NURBSTo IX='7'><X F='Width*0.52783751493429'>0.2791061448683873</X><Y F='Height*0.20320952037504'>0.1423959371963179</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.30083632019116,0.24179588892896,0,1, 0.42293906810036,0.20320952037504,0,1)'>NURBS(1, 3, 0, 0, 0.30083632019116,0.24179588892896,0,1, 0.42293906810036,0.20320952037504,0,1)</E></NURBSTo><NURBSTo IX='8'><X F='Width*0.67479091995221'>0.3568111150331932</X><Y F='Height*0.34331049404977'>0.2405695336484467</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.64802867383513,0.20320952037504,0,1, 0.67479091995221,0.23800937612694,0,1)'>NURBS(1, 3, 0, 0, 0.64802867383513,0.20320952037504,0,1, 0.67479091995221,0.23800937612694,0,1)</E></NURBSTo><LineTo IX='9'><X F='Width*0.67479091995221'>0.3568111150331932</X><Y F='Height*0.38189686260368'>0.2676083362748981</Y></LineTo><NURBSTo IX='10'><X F='Width*0.60143369175627'>0.3180218047232806</X><Y F='Height*0.38027407140281'>0.2664711903700441</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.64802867383513,0.38027407140281,0,1, 0.6258064516129,0.38027407140281,0,1)'>NURBS(1, 3, 0, 0, 0.64802867383513,0.38027407140281,0,1, 0.6258064516129,0.38027407140281,0,1)</E></NURBSTo><NURBSTo IX='11'><X F='Width*0'>0</X><Y F='Height*0.70483231157591'>0.493900371340213</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.20286738351254,0.38027407140281,0,1, 0,0.48341146772449,0,1)'>NURBS(1, 3, 0, 0, 0.20286738351254,0.38027407140281,0,1, 0,0.48341146772449,0,1)</E></NURBSTo><NURBSTo IX='12'><X F='Width*0.43010752688172'>0.2274291809701655</X><Y F='Height*1'>0.7007345764780822</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0,0.89307609087631,0,1, 0.15173237753883,1,0,1)'>NURBS(1, 3, 0, 0, 0,0.89307609087631,0,1, 0.15173237753883,1,0,1)</E></NURBSTo><NURBSTo IX='13'><X F='Width*0.99808841099164'>0.5277620493957698</X><Y F='Height*0.68355571583123'>0.4789911250321693</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.69486260454002,1,0,1, 0.99808841099164,0.88532275513884,0,1)'>NURBS(1, 3, 0, 0, 0.69486260454002,1,0,1, 0.99808841099164,0.88532275513884,0,1)</E></NURBSTo><LineTo IX='14'><X F='Width*0.99761051373955'>0.5275093503058033</X><Y F='Height*0.33393436711143'>0.2339993573093043</Y></LineTo><LineTo IX='15'><X F='Width*0.99761051373955'>0.5275093503058033</X><Y F='Height*0.33393436711143'>0.2339993573093043</Y></LineTo><LineTo IX='16'><X F='Geometry1.X1'>0.5275093503058033</X><Y F='Geometry1.Y1'>0.2339993573093043</Y></LineTo></Geom><Geom IX='1'><MoveTo IX='1'><X F='Width*0.66499402628435'>0.3516307836888736</X><Y F='Height*0.76938333934367'>0.5391335084442792</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.49390681003584'>0.2611645094807392</X><Y F='Height*0.83393436711143'>0.5843666455483455</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.61600955794504,0.80995311936531,0,1, 0.55483870967742,0.83393436711143,0,1)'>NURBS(1, 3, 0, 0, 0.61600955794504,0.80995311936531,0,1, 0.55483870967742,0.83393436711143,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.34958183990442'>0.1848493843107511</X><Y F='Height*0.69581680490444'>0.4875828940910451</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.41075268817204,0.83393436711143,0,1, 0.34958183990442,0.7695636494771,0,1)'>NURBS(1, 3, 0, 0, 0.41075268817204,0.83393436711143,0,1, 0.34958183990442,0.7695636494771,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.65543608124253'>0.3465768018895345</X><Y F='Height*0.55174900829427'>0.3866296076492872</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.34958183990442,0.583122971511,0,1, 0.42771804062127,0.55174900829427,0,1)'>NURBS(1, 3, 0, 0, 0.34958183990442,0.583122971511,0,1, 0.42771804062127,0.55174900829427,0,1)</E></NURBSTo><LineTo IX='5'><X F='Width*0.67025089605735'>0.3544104736785096</X><Y F='Height*0.55174900829427'>0.3866296076492872</Y></LineTo><LineTo IX='6'><X F='Width*0.66499402628435'>0.3516307836888736</X><Y F='Height*0.76938333934367'>0.5391335084442792</Y></LineTo><LineTo IX='7'><X F='Width*0.66499402628435'>0.3516307836888736</X><Y F='Height*0.76938333934367'>0.5391335084442792</Y></LineTo></Geom></Shape>
+
+<!-- b-->
+<Shape ID='{$id+8}' Type='Shape' LineStyle='17' FillStyle='17' TextStyle='8'>
+<XForm>
+<PinX F='Sheet.{$id}!Width*0.57569152973745'>2.606477398417586</PinX>
+<PinY F='Sheet.{$id}!Height*0.2711388674479'>0.4882146418159622</PinY>
+<Width F='Sheet.{$id}!Width*0.129571128773'>0.5866409373580704</Width>
+<Height F='Sheet.{$id}!Height*0.5422777348958'>0.9764292836319244</Height>
+<LocPinX F='Width*0.5'>0.2933204686790352</LocPinX><LocPinY F='Height*0.5'>0.4882146418159622</LocPinY>
+</XForm>
+<Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#231f20</FillForegnd></Fill>
+<Geom IX='0'><MoveTo IX='1'><X F='Width*0.54986000430756'>0.3225703883426996</X><Y F='Height*0.28778467908903'>0.2810013880431448</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.30799052336851'>0.1806798493263054</X><Y F='Height*0.34226190476191'>0.3341945464811697</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.44561705793668,0.28778467908903,0,1, 0.3661425802283,0.30499482401656,0,1)'>NURBS(1, 3, 0, 0, 0.44561705793668,0.28778467908903,0,1, 0.3661425802283,0.30499482401656,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.31466724100797'>0.1845966852207934</X><Y F='Height*0.28234989648033'>0.2756947071538366</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.31272883911264,0.33165113871636,0,1, 0.31466724100797,0.30227743271222,0,1)'>NURBS(1, 3, 0, 0, 0.31272883911264,0.33165113871636,0,1, 0.31466724100797,0.30227743271222,0,1)</E></NURBSTo><LineTo IX='4'><X F='Width*0.31466724100797'>0.1845966852207934</X><Y F='Height*0.12124741200828'>0.1183895236494696</Y></LineTo><NURBSTo IX='5'><X F='Width*0.30368296360112'>0.1781528584266378</X><Y F='Height*0'>0</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.31466724100797,0.074663561076604,0,1, 0.31272883911264,0.046583850931677,0,1)'>NURBS(1, 3, 0, 0, 0.31466724100797,0.074663561076604,0,1, 0.31272883911264,0.046583850931677,0,1)</E></NURBSTo><LineTo IX='6'><X F='Width*0'>0</X><Y F='Height*0.042701863354038'>0.04169534984453165</Y></LineTo><NURBSTo IX='7'><X F='Width*0.019814774930001'>0.01162415813847498</X><Y F='Height*0.21040372670807'>0.205444360143048</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.01550721516261,0.081262939958592,0,1, 0.019814774930001,0.12655279503106,0,1)'>NURBS(1, 3, 0, 0, 0.01550721516261,0.081262939958592,0,1, 0.019814774930001,0.12655279503106,0,1)</E></NURBSTo><LineTo IX='8'><X F='Width*0.018737884988154'>0.01099241041355838</X><Y F='Height*0.76229296066253'>0.7443251694973729</Y></LineTo><NURBSTo IX='9'><X F='Width*0.50592289468016'>0.2967950811660775</X><Y F='Height*1'>0.9764292836319244</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.018737884988154,0.86801242236025,0,1, 0.17079474477708,1,0,1)'>NURBS(1, 3, 0, 0, 0.018737884988154,0.86801242236025,0,1, 0.17079474477708,1,0,1)</E></NURBSTo><NURBSTo IX='10'><X F='Width*0.78979108335128'>0.4633237814542409</X><Y F='Height*0.95108695652174'>0.9286691556281899</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.61705793667887,1,0,1, 0.7124703855266,0.988483436853,0,1)'>NURBS(1, 3, 0, 0, 0.61705793667887,1,0,1, 0.7124703855266,0.988483436853,0,1)</E></NURBSTo><NURBSTo IX='11'><X F='Width*1'>0.5866409373580704</X><Y F='Height*0.63392857142857'>0.6189864208738077</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.92957139780314,0.8847049689441,0,1, 1,0.77251552795031,0,1)'>NURBS(1, 3, 0, 0, 0.92957139780314,0.8847049689441,0,1, 1,0.77251552795031,0,1)</E></NURBSTo><NURBSTo IX='12'><X F='Width*0.54986000430756'>0.3225703883426996</X><Y F='Height*0.28778467908903'>0.2810013880431448</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 1,0.42093685300207,0,1, 0.82683609735085,0.28778467908903,0,1)'>NURBS(1, 3, 0, 0, 1,0.42093685300207,0,1, 0.82683609735085,0.28778467908903,0,1)</E></NURBSTo><LineTo IX='13'><X F='Width*0.54986000430756'>0.3225703883426996</X><Y F='Height*0.28778467908903'>0.2810013880431448</Y></LineTo><LineTo IX='14'><X F='Geometry1.X1'>0.3225703883426996</X><Y F='Geometry1.Y1'>0.2810013880431448</Y></LineTo></Geom><Geom IX='1'><MoveTo IX='1'><X F='Width*0.62954986000431'>0.3693197199865704</X><Y F='Height*0.8082298136646'>0.7891792579664891</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.48546198578505'>0.284791874392652</X><Y F='Height*0.86128364389234'>0.840982571409691</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.60521214731854,0.8440734989648,0,1, 0.55869050183071,0.86128364389234,0,1)'>NURBS(1, 3, 0, 0, 0.60521214731854,0.8440734989648,0,1, 0.55869050183071,0.86128364389234,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.31919017876373'>0.1872500256654446</X><Y F='Height*0.81741718426501'>0.7981500756603084</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.40534137411157,0.86128364389234,0,1, 0.3590351066121,0.83876811594203,0,1)'>NURBS(1, 3, 0, 0, 0.40534137411157,0.86128364389234,0,1, 0.3590351066121,0.83876811594203,0,1)</E></NURBSTo><LineTo IX='4'><X F='Width*0.31919017876373'>0.1872500256654446</X><Y F='Height*0.49016563146998'>0.4786120763972224</Y></LineTo><NURBSTo IX='5'><X F='Width*0.48783114365712'>0.2861817193874724</X><Y F='Height*0.43555900621118'>0.4252925684142154</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.35688132672841,0.4648033126294,0,1, 0.4100796898557,0.43555900621118,0,1)'>NURBS(1, 3, 0, 0, 0.35688132672841,0.4648033126294,0,1, 0.4100796898557,0.43555900621118,0,1)</E></NURBSTo><NURBSTo IX='6'><X F='Width*0.64958001292268'>0.3810702276700285</X><Y F='Height*0.52212732919255'>0.5098204140081316</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.56536721947017,0.43555900621118,0,1, 0.62718070213224,0.46350931677019,0,1)'>NURBS(1, 3, 0, 0, 0.56536721947017,0.43555900621118,0,1, 0.62718070213224,0.46350931677019,0,1)</E></NURBSTo><NURBSTo IX='7'><X F='Width*0.66271807021322'>0.3887775499140149</X><Y F='Height*0.63806935817805'>0.6230296063132751</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.6607796683179,0.55124223602484,0,1, 0.66271807021322,0.57686335403727,0,1)'>NURBS(1, 3, 0, 0, 0.6607796683179,0.55124223602484,0,1, 0.66271807021322,0.57686335403727,0,1)</E></NURBSTo><NURBSTo IX='8'><X F='Width*0.62954986000431'>0.3693197199865704</X><Y F='Height*0.8082298136646'>0.7891792579664891</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.66271807021322,0.72192028985507,0,1, 0.65625673056214,0.77083333333333,0,1)'>NURBS(1, 3, 0, 0, 0.66271807021322,0.72192028985507,0,1, 0.65625673056214,0.77083333333333,0,1)</E></NURBSTo><LineTo IX='9'><X F='Width*0.62954986000431'>0.3693197199865704</X><Y F='Height*0.8082298136646'>0.7891792579664891</Y></LineTo></Geom>
+</Shape>
+<Shape ID='{$id+9}' Type='Shape' LineStyle='17' FillStyle='17' TextStyle='8'><XForm><PinX F='Sheet.{$id}!Width*0.84076397570995'>3.806608551442684</PinX><PinY F='Sheet.{$id}!Height*0.81510069468809'>1.467676314527476</PinY><Width F='Sheet.{$id}!Width*0.10626897660296'>0.4811390672968658</Width><Height F='Sheet.{$id}!Height*0.36979861062382'>0.6658621020626642</Height><LocPinX F='Width*0.5'>0.2405695336484329</LocPinX><LocPinY F='Height*0.5'>0.3329310510313321</LocPinY></XForm><Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#231f20</FillForegnd>
+</Fill><Geom IX='0'><MoveTo IX='1'><X F='Width*0.24816176470588'>0.1194003200093314</X><Y F='Height*0.20379506641366'>0.1356994113121999</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.50105042016807'>0.2410749318283679</X><Y F='Height*0.11062618595825'>0.07366178472533552</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.3188025210084,0.1415559772296,0,1, 0.4030987394958,0.11062618595825,0,1)'>NURBS(1, 3, 0, 0, 0.3188025210084,0.1415559772296,0,1, 0.4030987394958,0.11062618595825,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.68828781512605'>0.3311621574015453</X><Y F='Height*0.15901328273245'>0.1058809186961139</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.5703781512605,0.11062618595825,0,1, 0.6328781512605,0.12675521821632,0,1)'>NURBS(1, 3, 0, 0, 0.5703781512605,0.11062618595825,0,1, 0.6328781512605,0.12675521821632,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.81460084033613'>0.3919362885385687</X><Y F='Height*0.29563567362429'>0.1968525910841815</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.7436974789916,0.19127134724858,0,1, 0.78571428571429,0.23681214421252,0,1)'>NURBS(1, 3, 0, 0, 0.7436974789916,0.19127134724858,0,1, 0.78571428571429,0.23681214421252,0,1)</E></NURBSTo><NURBSTo IX='5'><X F='Width*0.85766806722689'>0.4126576139158514</X><Y F='Height*0.50151802656547'>0.3339418473912029</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.84348739495798,0.35426944971537,0,1, 0.85766806722689,0.42296015180266,0,1)'>NURBS(1, 3, 0, 0, 0.84348739495798,0.35426944971537,0,1, 0.85766806722689,0.42296015180266,0,1)</E></NURBSTo><NURBSTo IX='6'><X F='Width*0.75656512605042'>0.3640130390972348</X><Y F='Height*0.78975332068311'>0.5258668062210249</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.85766806722689,0.62599620493359,0,1, 0.82405462184874,0.72220113851992,0,1)'>NURBS(1, 3, 0, 0, 0.85766806722689,0.62599620493359,0,1, 0.82405462184874,0.72220113851992,0,1)</E></NURBSTo><NURBSTo IX='7'><X F='Width*0.49947478991597'>0.2403168345584678</X><Y F='Height*0.89127134724858'>0.5934638127871622</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.6890756302521,0.85749525616698,0,1, 0.60346638655462,0.89127134724858,0,1)'>NURBS(1, 3, 0, 0, 0.6890756302521,0.85749525616698,0,1, 0.60346638655462,0.89127134724858,0,1)</E></NURBSTo><NURBSTo IX='8'><X F='Width*0.2436974789916'>0.117252377744616</X><Y F='Height*0.79070208728653'>0.526498553945945</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.3967962184874,0.89127134724858,0,1, 0.31144957983193,0.85787476280835,0,1)'>NURBS(1, 3, 0, 0, 0.3967962184874,0.89127134724858,0,1, 0.31144957983193,0.85787476280835,0,1)</E></NURBSTo><NURBSTo IX='9'><X F='Width*0.14206932773109'>0.06835510383602939</X><Y F='Height*0.51537001897533'>0.3431653641749883</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.17594537815126,0.72371916508539,0,1, 0.14206932773109,0.63187855787476,0,1)'>NURBS(1, 3, 0, 0, 0.17594537815126,0.72371916508539,0,1, 0.14206932773109,0.63187855787476,0,1)</E></NURBSTo><NURBSTo IX='10'><X F='Width*0.24816176470588'>0.1194003200093314</X><Y F='Height*0.20379506641366'>0.1356994113121999</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.14206932773109,0.36982922201139,0,1, 0.17725840336134,0.26603415559772,0,1)'>NURBS(1, 3, 0, 0, 0.14206932773109,0.36982922201139,0,1, 0.17725840336134,0.26603415559772,0,1)</E></NURBSTo><LineTo IX='11'><X F='Geometry1.X1'>0.1194003200093314</X><Y F='Geometry1.Y1'>0.1356994113121999</Y></LineTo></Geom><Geom IX='1'><MoveTo IX='1'><X F='Width*0.059611344537814'>0.02868134671123594</X><Y F='Height*0.75407969639469'>0.5021130917641439</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.23608193277311'>0.1135882409400955</X><Y F='Height*0.93396584440228'>0.6218924604084333</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.09952731092437,0.83017077798861,0,1, 0.15835084033613,0.89013282732448,0,1)'>NURBS(1, 3, 0, 0, 0.09952731092437,0.83017077798861,0,1, 0.15835084033613,0.89013282732448,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.50026260504202'>0.2406958831934179</X><Y F='Height*1'>0.6658621020626642</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.31381302521008,0.97798861480076,0,1, 0.40178571428571,1,0,1)'>NURBS(1, 3, 0, 0, 0.31381302521008,0.97798861480076,0,1, 0.40178571428571,1,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.75420168067227'>0.3628758931923846</X><Y F='Height*0.9404174573055'>0.6261883449378659</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.59112394957983,1,0,1, 0.67568277310924,0.98007590132827,0,1)'>NURBS(1, 3, 0, 0, 0.59112394957983,1,0,1, 0.67568277310924,0.98007590132827,0,1)</E></NURBSTo><NURBSTo IX='5'><X F='Width*0.93566176470588'>0.4501834287759266</X><Y F='Height*0.76470588235294'>0.509188666283213</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.83245798319328,0.90056925996205,0,1, 0.89285714285714,0.84193548387097,0,1)'>NURBS(1, 3, 0, 0, 0.83245798319328,0.90056925996205,0,1, 0.89285714285714,0.84193548387097,0,1)</E></NURBSTo><NURBSTo IX='6'><X F='Width*1'>0.4811390672968658</X><Y F='Height*0.50170777988615'>0.3340681969361843</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.97846638655462,0.68728652751423,0,1, 1,0.59981024667932,0,1)'>NURBS(1, 3, 0, 0, 0.97846638655462,0.68728652751423,0,1, 1,0.59981024667932,0,1)</E></NURBSTo><NURBSTo IX='7'><X F='Width*0.9390756302521'>0.4518259728607117</X><Y F='Height*0.24231499051233'>0.1613483689438346</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 1,0.40493358633776,0,1, 0.97951680672269,0.31859582542695,0,1)'>NURBS(1, 3, 0, 0, 1,0.40493358633776,0,1, 0.97951680672269,0.31859582542695,0,1)</E></NURBSTo><NURBSTo IX='8'><X F='Width*0.76207983193277'>0.3666663795418852</X><Y F='Height*0.063946869070208'>0.04257979665941466</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.89863445378151,0.16603415559772,0,1, 0.83954831932773,0.10664136622391,0,1)'>NURBS(1, 3, 0, 0, 0.89863445378151,0.16603415559772,0,1, 0.83954831932773,0.10664136622391,0,1)</E></NURBSTo><NURBSTo IX='9'><X F='Width*0.50026260504202'>0.2406958831934179</X><Y F='Height*0'>0</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.6843487394958,0.021442125237192,0,1, 0.59716386554622,0,0,1)'>NURBS(1, 3, 0, 0, 0.6843487394958,0.021442125237192,0,1, 0.59716386554622,0,0,1)</E></NURBSTo><NURBSTo IX='10'><X F='Width*0.13970588235294'>0.06721795793117921</X><Y F='Height*0.13624288425047'>0.09071897329809818</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.35320378151261,0,0,1, 0.23293067226891,0.045540796963947,0,1)'>NURBS(1, 3, 0, 0, 0.35320378151261,0,0,1, 0.23293067226891,0.045540796963947,0,1)</E></NURBSTo><NURBSTo IX='11'><X F='Width*0'>0</X><Y F='Height*0.51290322580645'>0.3415228200902041</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.046481092436974,0.226944971537,0,1, 0,0.35256166982922,0,1)'>NURBS(1, 3, 0, 0, 0.046481092436974,0.226944971537,0,1, 0,0.35256166982922,0,1)</E></NURBSTo><NURBSTo IX='12'><X F='Width*0.059611344537814'>0.02868134671123594</X><Y F='Height*0.75407969639469'>0.5021130917641439</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0,0.5977229601518,0,1, 0.01969537815126,0.67817836812144,0,1)'>NURBS(1, 3, 0, 0, 0,0.5977229601518,0,1, 0.01969537815126,0.67817836812144,0,1)</E></NURBSTo></Geom></Shape>
+<Shape ID='{$id+10}' Type='Shape' LineStyle='17' FillStyle='17' TextStyle='8'><XForm><PinX F='Sheet.{$id}!Width*0.95544684318628'>4.325842006552052</PinX><PinY F='Sheet.{$id}!Height*0.81510069468809'>1.467676314527476</PinY><Width F='Sheet.{$id}!Width*0.089106313627434'>0.4034340971320827</Width><Height F='Sheet.{$id}!Height*0.36979861062382'>0.6658621020626642</Height><LocPinX F='Width*0.5'>0.2017170485660414</LocPinX><LocPinY F='Height*0.5'>0.3329310510313321</LocPinY></XForm><Line><LineWeight>0.001666666666666667</LineWeight><LineColor>1</LineColor><LinePattern>0</LinePattern><LineCap>1</LineCap></Line><Fill><FillForegnd>#231f20</FillForegnd>
+</Fill><Geom IX='0'><MoveTo IX='1'><X F='Width*0.94644534920138'>0.3818283249399175</X><Y F='Height*0.57362428842505'>0.3819546744849037</Y></MoveTo><NURBSTo IX='2'><X F='Width*0.77920450986533'>0.3143576679187665</X><Y F='Height*0.47514231499051'>0.3163792606385015</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.91042906357657,0.53396584440228,0,1, 0.85468211713122,0.5011385199241,0,1)'>NURBS(1, 3, 0, 0, 0.91042906357657,0.53396584440228,0,1, 0.85468211713122,0.5011385199241,0,1)</E></NURBSTo><NURBSTo IX='3'><X F='Width*0.49451926088318'>0.1995059315288306</X><Y F='Height*0.41366223908918'>0.2754420080638698</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.72784215471344,0.45768500948767,0,1, 0.63294707171939,0.43719165085389,0,1)'>NURBS(1, 3, 0, 0, 0.72784215471344,0.45768500948767,0,1, 0.63294707171939,0.43719165085389,0,1)</E></NURBSTo><NURBSTo IX='4'><X F='Width*0.2380206702161'>0.09602565418740551</X><Y F='Height*0.34478178368121'>0.2295771232348852</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.35609145004698,0.39032258064516,0,1, 0.27059191982462,0.3673624288425,0,1)'>NURBS(1, 3, 0, 0, 0.35609145004698,0.39032258064516,0,1, 0.27059191982462,0.3673624288425,0,1)</E></NURBSTo><NURBSTo IX='5'><X F='Width*0.18728468524898'>0.07555702790008854</X><Y F='Height*0.25920303605313'>0.1725934784473617</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.20419668023802,0.32258064516129,0,1, 0.18728468524898,0.29392789373814,0,1)'>NURBS(1, 3, 0, 0, 0.20419668023802,0.32258064516129,0,1, 0.18728468524898,0.29392789373814,0,1)</E></NURBSTo><NURBSTo IX='6'><X F='Width*0.25806451612903'>0.104112025066343</X><Y F='Height*0.15673624288425'>0.104364724156311</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.18728468524898,0.21916508538899,0,1, 0.21108675227059,0.18519924098672,0,1)'>NURBS(1, 3, 0, 0, 0.18728468524898,0.21916508538899,0,1, 0.21108675227059,0.18519924098672,0,1)</E></NURBSTo><NURBSTo IX='7'><X F='Width*0.48355778264955'>0.1950836974544131</X><Y F='Height*0.11423149905123'>0.07606242608002124</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.30535546507986,0.12846299810247,0,1, 0.38051988725337,0.11423149905123,0,1)'>NURBS(1, 3, 0, 0, 0.30535546507986,0.12846299810247,0,1, 0.38051988725337,0.11423149905123,0,1)</E></NURBSTo><NURBSTo IX='8'><X F='Width*0.70748512370811'>0.2854236221175612</X><Y F='Height*0.1607210626186'>0.1070180646009661</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.58221108675227,0.11423149905123,0,1, 0.65706232383339,0.12979127134725,0,1)'>NURBS(1, 3, 0, 0, 0.58221108675227,0.11423149905123,0,1, 0.65706232383339,0.12979127134725,0,1)</E></NURBSTo><NURBSTo IX='9'><X F='Width*0.77826495458816'>0.3139786192838157</X><Y F='Height*0.23757115749526'>0.1581896303192541</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.73943000313185,0.18026565464896,0,1, 0.76291888506107,0.20588235294118,0,1)'>NURBS(1, 3, 0, 0, 0.73943000313185,0.18026565464896,0,1, 0.76291888506107,0.20588235294118,0,1)</E></NURBSTo><LineTo IX='10'><X F='Width*0.93329157532102'>0.3765216440506149</X><Y F='Height*0.18899430740038'>0.1258441468034943</Y></LineTo><NURBSTo IX='11'><X F='Width*0.89696210460382'>0.3618650968325349</X><Y F='Height*0.13643263757116'>0.09084532284308622</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.92358283745694,0.17058823529412,0,1, 0.91168180394613,0.15313092979127,0,1)'>NURBS(1, 3, 0, 0, 0.92358283745694,0.17058823529412,0,1, 0.91168180394613,0.15313092979127,0,1)</E></NURBSTo><NURBSTo IX='12'><X F='Width*0.72878170999061'>0.2940153911764371</X><Y F='Height*0.034724857685009'>0.02312196673196695</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.85812715314751,0.091650853889943,0,1, 0.80206702160977,0.057685009487666,0,1)'>NURBS(1, 3, 0, 0, 0.85812715314751,0.091650853889943,0,1, 0.80206702160977,0.057685009487666,0,1)</E></NURBSTo><NURBSTo IX='13'><X F='Width*0.4760413404322'>0.192051308374811</X><Y F='Height*0'>0</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.65549639837144,0.011574952561669,0,1, 0.57124960851863,0,0,1)'>NURBS(1, 3, 0, 0, 0.65549639837144,0.011574952561669,0,1, 0.57124960851863,0,0,1)</E></NURBSTo><NURBSTo IX='14'><X F='Width*0.24021296586283'>0.09691010100229063</X><Y F='Height*0.033206831119544'>0.02211117037209946</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.38928906984027,0,0,1, 0.31067961165049,0.011195445920304,0,1)'>NURBS(1, 3, 0, 0, 0.38928906984027,0,0,1, 0.31067961165049,0.011195445920304,0,1)</E></NURBSTo><NURBSTo IX='15'><X F='Width*0.07892264328218'>0.03184008533582372</X><Y F='Height*0.12998102466793'>0.08654943831364687</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.16943313498277,0.055218216318785,0,1, 0.11556529909176,0.087476280834914,0,1)'>NURBS(1, 3, 0, 0, 0.16943313498277,0.055218216318785,0,1, 0.11556529909176,0.087476280834914,0,1)</E></NURBSTo><NURBSTo IX='16'><X F='Width*0.02348888192922'>0.009476215873756964</X><Y F='Height*0.26698292220114'>0.1777738097916838</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.041966802380206,0.17248576850095,0,1, 0.02348888192922,0.21821631878558,0,1)'>NURBS(1, 3, 0, 0, 0.041966802380206,0.17248576850095,0,1, 0.02348888192922,0.21821631878558,0,1)</E></NURBSTo><NURBSTo IX='17'><X F='Width*0.068587535233323'>0.02767055035137058</X><Y F='Height*0.3876660341556'>0.2581321204011444</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.02348888192922,0.31157495256167,0,1, 0.038521766363921,0.35180265654649,0,1)'>NURBS(1, 3, 0, 0, 0.02348888192922,0.31157495256167,0,1, 0.038521766363921,0.35180265654649,0,1)</E></NURBSTo><NURBSTo IX='18'><X F='Width*0.20576260569997'>0.08301165105411214</X><Y F='Height*0.47779886148008'>0.3181481542682738</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.098653304102725,0.42352941176471,0,1, 0.14406514249922,0.45370018975332,0,1)'>NURBS(1, 3, 0, 0, 0.098653304102725,0.42352941176471,0,1, 0.14406514249922,0.45370018975332,0,1)</E></NURBSTo><NURBSTo IX='19'><X F='Width*0.45443156905731'>0.1833331897709516</X><Y F='Height*0.53814041745731'>0.3583273095730041</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.25336673974319,0.49677419354839,0,1, 0.33604760413404,0.5168880455408,0,1)'>NURBS(1, 3, 0, 0, 0.25336673974319,0.49677419354839,0,1, 0.33604760413404,0.5168880455408,0,1)</E></NURBSTo><NURBSTo IX='20'><X F='Width*0.6836830566865'>0.2758210566988207</X><Y F='Height*0.5853889943074'>0.3897883462738743</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.57250234888819,0.5595825426945,0,1, 0.64891951143126,0.57533206831119,0,1)'>NURBS(1, 3, 0, 0, 0.57250234888819,0.5595825426945,0,1, 0.64891951143126,0.57533206831119,0,1)</E></NURBSTo><NURBSTo IX='21'><X F='Width*0.79987472596304'>0.3226967378876711</X><Y F='Height*0.64231499051233'>0.4276932097689002</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.73692452239273,0.60075901328273,0,1, 0.77575947384905,0.61973434535104,0,1)'>NURBS(1, 3, 0, 0, 0.73692452239273,0.60075901328273,0,1, 0.77575947384905,0.61973434535104,0,1)</E></NURBSTo><NURBSTo IX='22'><X F='Width*0.83651738177263'>0.3374796346507348</X><Y F='Height*0.72163187855787'>0.4805073195719725</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.82430316316943,0.66489563567362,0,1, 0.83651738177263,0.69127134724858,0,1)'>NURBS(1, 3, 0, 0, 0.82430316316943,0.66489563567362,0,1, 0.83651738177263,0.69127134724858,0,1)</E></NURBSTo><NURBSTo IX='23'><X F='Width*0.79987472596304'>0.3226967378876711</X><Y F='Height*0.80436432637571'>0.5355957211847491</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.83651738177263,0.75142314990512,0,1, 0.82430316316943,0.77912713472486,0,1)'>NURBS(1, 3, 0, 0, 0.83651738177263,0.75142314990512,0,1, 0.82430316316943,0.77912713472486,0,1)</E></NURBSTo><NURBSTo IX='24'><X F='Width*0.68869401816474'>0.2778426494185581</X><Y F='Height*0.86394686907021'>0.5752694783095473</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.77575947384905,0.82960151802657,0,1, 0.73849044785468,0.84952561669829,0,1)'>NURBS(1, 3, 0, 0, 0.77575947384905,0.82960151802657,0,1, 0.73849044785468,0.84952561669829,0,1)</E></NURBSTo><NURBSTo IX='25'><X F='Width*0.51612903225806'>0.208224050132686</X><Y F='Height*0.88576850094877'>0.5897996759826429</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.6385844033824,0.87855787476281,0,1, 0.58095834638271,0.88576850094877,0,1)'>NURBS(1, 3, 0, 0, 0.6385844033824,0.87855787476281,0,1, 0.58095834638271,0.88576850094877,0,1)</E></NURBSTo><NURBSTo IX='26'><X F='Width*0.31788286877545'>0.12824478815818</X><Y F='Height*0.85711574952562'>0.5707208946901453</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.4428437206389,0.88576850094877,0,1, 0.37676166614469,0.87609108159393,0,1)'>NURBS(1, 3, 0, 0, 0.4428437206389,0.88576850094877,0,1, 0.37676166614469,0.87609108159393,0,1)</E></NURBSTo><NURBSTo IX='27'><X F='Width*0.18759787034137'>0.07568337744507211</X><Y F='Height*0.78178368121442'>0.5205601253317215</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.25869088631381,0.83795066413662,0,1, 0.21547134356405,0.81290322580645,0,1)'>NURBS(1, 3, 0, 0, 0.25869088631381,0.83795066413662,0,1, 0.21547134356405,0.81290322580645,0,1)</E></NURBSTo><NURBSTo IX='28'><X F='Width*0.15471343564046'>0.06241667522181157</X><Y F='Height*0.7314990512334'>0.4870774959111162</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.17413091136862,0.76717267552182,0,1, 0.16348261822737,0.75028462998102,0,1)'>NURBS(1, 3, 0, 0, 0.17413091136862,0.76717267552182,0,1, 0.16348261822737,0.75028462998102,0,1)</E></NURBSTo><LineTo IX='29'><X F='Width*0'>0</X><Y F='Height*0.77988614800759'>0.519296629881888</Y></LineTo><NURBSTo IX='30'><X F='Width*0.045098653304102'>0.01819433447761321</X><Y F='Height*0.84724857685009'>0.5641507183510016</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.011274663326025,0.8034155597723,0,1, 0.026307547760727,0.82599620493359,0,1)'>NURBS(1, 3, 0, 0, 0.011274663326025,0.8034155597723,0,1, 0.026307547760727,0.82599620493359,0,1)</E></NURBSTo><NURBSTo IX='31'><X F='Width*0.23081741309114'>0.09311961465278704</X><Y F='Height*0.96185958254269'>0.6404658435209922</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.090197306608205,0.89829222011385,0,1, 0.15220795490135,0.93643263757116,0,1)'>NURBS(1, 3, 0, 0, 0.090197306608205,0.89829222011385,0,1, 0.15220795490135,0.93643263757116,0,1)</E></NURBSTo><NURBSTo IX='32'><X F='Width*0.52333228938302'>0.2111300896673045</X><Y F='Height*1'>0.6658621020626642</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.30942687128093,0.98728652751423,0,1, 0.40714062010648,1,0,1)'>NURBS(1, 3, 0, 0, 0.30942687128093,0.98728652751423,0,1, 0.40714062010648,1,0,1)</E></NURBSTo><NURBSTo IX='33'><X F='Width*0.77200125274037'>0.311451628384148</X><Y F='Height*0.96204933586338'>0.6405921930659803</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.61603507673035,1,0,1, 0.6987159411212,0.98728652751423,0,1)'>NURBS(1, 3, 0, 0, 0.61603507673035,1,0,1, 0.6987159411212,0.98728652751423,0,1)</E></NURBSTo><NURBSTo IX='34'><X F='Width*0.94112120263076'>0.3796803826752006</X><Y F='Height*0.8561669829222'>0.5700891469652252</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.84528656435954,0.93681214421252,0,1, 0.90165988098967,0.90151802656546,0,1)'>NURBS(1, 3, 0, 0, 0.84528656435954,0.93681214421252,0,1, 0.90165988098967,0.90151802656546,0,1)</E></NURBSTo><NURBSTo IX='35'><X F='Width*1'>0.4034340971320827</X><Y F='Height*0.71100569259962'>0.4734317450529034</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 0.98058252427184,0.81062618595825,0,1, 1,0.76223908918406,0,1)'>NURBS(1, 3, 0, 0, 0.98058252427184,0.81062618595825,0,1, 1,0.76223908918406,0,1)</E></NURBSTo><NURBSTo IX='36'><X F='Width*0.94644534920138'>0.3818283249399175</X><Y F='Height*0.57362428842505'>0.3819546744849037</Y><A>0</A><B>1</B><C>0</C><D>1</D><E Unit='NURBS' F='NURBS(1, 3, 0, 0, 1,0.65920303605313,0,1, 0.98214844973379,0.6134724857685,0,1)'>NURBS(1, 3, 0, 0, 1,0.65920303605313,0,1, 0.98214844973379,0.6134724857685,0,1)</E></NURBSTo></Geom></Shape>
+</Shapes></Shape>
+</xsl:template>
+
+
+<xsl:template match="s:g[@class='legend']/s:g"><xsl:comment>Legend item</xsl:comment>
+	<Shape Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6'>
+		<xsl:call-template name="ID"/>
+		<xsl:apply-templates mode="Line" select="."/>
+		<Fill><FillForegnd>#ffffff</FillForegnd><FillPattern>1</FillPattern></Fill>		
+		<xsl:for-each select="s:rect[1]">
+			<XForm>
+				<xsl:variable name="pos"><xsl:apply-templates select="." mode="position"/></xsl:variable>			
+				<PinX><xsl:value-of select="$Scale * substring-before($pos,',')"/></PinX>
+				<PinY><xsl:value-of select="$Scale * (297 - substring-after($pos,','))"/></PinY>
+				<Width><xsl:value-of select="@width * $Scale"/></Width><Height><xsl:value-of select="@height * $Scale"/></Height>
+				<LocPinX F='0'/><LocPinY F="Height"/>
+			</XForm>
+		</xsl:for-each>
+		<Char IX='0'><Font>4</Font><Color>0</Color><Style>1</Style><xsl:apply-templates mode="Font" select="."/></Char>
+		<xsl:for-each select="s:g/s:text[@class='lgd'][1]"> <!--  first should be the legend title (eg: key) -->
+			<TextXForm>
+				<TxtPinX><xsl:value-of select="@x * $Scale"/></TxtPinX>
+				<TxtPinY><xsl:value-of select="(../../s:rect[1]/@height) * $Scale * 0.5"/></TxtPinY>
+				<TxtWidth><xsl:value-of select="1"/></TxtWidth>
+				<TxtHeight F='Height'/>
+				<TxtLocPinX F='0'/>
+				<TxtLocPinY F='TxtHeight*0.5'/>
+			</TextXForm>
+			<xsl:element name="Text"  xml:space='preserve'><cp IX='0'/><xsl:value-of select="."/></xsl:element>			
+		</xsl:for-each>	
+		<Control ID='1'><X>0.19685039</X><Y>0</Y><XDyn Unit='MM'>0</XDyn><YDyn Unit='MM'>0</YDyn><XCon>2</XCon><YCon>1</YCon><CanGlue>0</CanGlue><Prompt>Adjust Corner Rounding</Prompt></Control>
+			<Connection IX='0'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height'>1.181102362204725</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='1'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='0'>0</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='2'><X Unit='MM' F='Width*0'>0</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='3'><X Unit='MM' F='Width'>1.574803149606299</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Connection IX='4'><X Unit='MM' F='Width*0.5'>0.7874015748031497</X><Y Unit='MM' F='Height*0.5'>0.5905511811023623</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+					<Scratch IX='0'><X F='Height * 0.33'/><Y F='No Formula'>0</Y><A F='IF(Controls.Row_1&lt;Width*0,SETF("controls.x1",Width*0),IF(Controls.Row_1&gt;Width*1,SETF("controls.x1",Width*1),FALSE))'>0</A><B F='No Formula'>0</B><C F='No Formula'>0</C><D F='No Formula'>0</D></Scratch>
+					<Control ID='1'>
+						<X F="Height / 3"/><Y Unit='MM' F='0'>0</Y>
+						<XDyn Unit='MM'>0</XDyn><YDyn Unit='MM'>0</YDyn>
+						<XCon>2</XCon><YCon>1</YCon>
+						<CanGlue>0</CanGlue>
+					</Control>
+					<Geom IX='0'>
+						<NoFill>0</NoFill><NoLine F='No Formula'>0</NoLine><NoShow F='No Formula'>0</NoShow><NoSnap F='No Formula'>0</NoSnap>
+						<MoveTo IX='1'><X Unit='MM' F='Geometry1.X2-Scratch.X1'/><Y F='MIN(0,Height/2-Scratch.X1)'/></MoveTo>
+						<ArcTo IX='2'><X Unit='MM' F='MAX(Width,Width/2+Scratch.X1)'/><Y F='Geometry1.Y1+Scratch.X1'/><A Unit='DL' F='Scratch.X1*0.29289'/></ArcTo>
+						<LineTo IX='3'><X Unit='MM' F='Geometry1.X2'/><Y Unit='MM' F='Geometry1.Y4-Scratch.X1'/></LineTo>
+						<ArcTo IX='4'><X Unit='MM' F='Geometry1.X1'/><Y Unit='MM' F='Height-Geometry1.Y1'/><A Unit='DL' F='Geometry1.A2'/></ArcTo>
+						<LineTo IX='5'><X Unit='MM' F='Geometry1.X6+Scratch.X1'/><Y Unit='MM' F='Geometry1.Y4'/></LineTo>
+						<ArcTo IX='6'><X Unit='MM' F='Width-Geometry1.X2'/><Y Unit='MM' F='Height-Geometry1.Y2'/><A Unit='DL' F='Geometry1.A2'/></ArcTo>
+						<LineTo IX='7'><X Unit='MM' F='Geometry1.X6'/><Y F='Geometry1.Y2'/></LineTo>
+						<ArcTo IX='8'><X Unit='MM' F='Geometry1.X5'/><Y F='Geometry1.Y1'/><A Unit='DL' F='Geometry1.A2'/></ArcTo>
+						<LineTo IX='9'><X Unit='MM' F='Geometry1.X1'/><Y F='Geometry1.Y1'/></LineTo>
+					</Geom>
+	</Shape>	
+	<xsl:apply-templates select="s:g/s:text"/>
+	<xsl:apply-templates select="s:g"/>
+</xsl:template>
+
+
+
+
+<xsl:template match="s:text">
+<xsl:comment>Legend text (<xsl:value-of select="."/>)</xsl:comment>
+<xsl:if test="not(../@id)">
+	<Shape Type='Shape' LineStyle="1" FillStyle="1" TextStyle='3'>
+		<xsl:call-template name="ID"/>
+		<XForm>
+		<xsl:variable name="dy" select="count(self::s:text[@width and starts-with(@transform,'rotate(-90')]) * 0.5 * @width"/>
+			<xsl:variable name="pos"><xsl:apply-templates select="." mode="position"/></xsl:variable>
+			<PinX><xsl:value-of select="$Scale * substring-before($pos,',')"/></PinX>
+			<PinY><xsl:value-of select="$Scale * (297 - substring-after($pos,',') + $dy)"/></PinY>
+			<Width><xsl:value-of select="@width * $Scale"/></Width><Height>0</Height>
+			<LocPinX F='Width'/><LocPinY F="Height"/>
+			<xsl:if test="starts-with(@transform,'rotate(-90')">
+			<Angle>1.5707963267949</Angle>
+			</xsl:if>
+		</XForm>
+		<xsl:call-template name="font"/>
+</Shape>
+</xsl:if>
+</xsl:template>
+
+<xsl:template match="s:g[@class='legend']/s:g/s:g/s:text">
+<xsl:if test="position()!=1"> <!-- legend title already drawn -->
+<xsl:comment>Legend text  (<xsl:value-of select="."/>)</xsl:comment>
+
+<Shape Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6'>
+		<xsl:call-template name="ID"/>
+		<XForm>
+			<xsl:variable name="pos"><xsl:apply-templates select="." mode="position"/></xsl:variable>		
+			<xsl:variable name="dx">
+				<xsl:choose>
+					<xsl:when test="(@class='lgd') and @width"><xsl:value-of select="0.5* @width"/></xsl:when>
+					<xsl:otherwise>100</xsl:otherwise>
+				</xsl:choose>
+			</xsl:variable>
+		<!--	<xsl:message><xsl:value-of select="$pos"/> / <xsl:apply-templates select="../../s:rect" mode="position"/> / <xsl:value-of select="@x"/></xsl:message>-->
+		 	<PinX><xsl:value-of select="$Scale * (substring-before($pos,',') - 0.5*  $dx )"/></PinX>			
+			<PinY><xsl:value-of select="$Scale * (297 - substring-after($pos,','))"/></PinY>
+		<Width><xsl:choose>
+			<xsl:when test="@width"><xsl:value-of select="@width * $Scale"/></xsl:when>
+			<xsl:otherwise>10</xsl:otherwise>
+		</xsl:choose></Width>
+			<LocPinX F='0'/><LocPinY F="Height * 0.5"/>
+		</XForm>
+		<Para IX='0'><HorzAlign>
+		<xsl:choose><xsl:when test="@text-anchor='middle'">1</xsl:when>
+		<xsl:otherwise>0</xsl:otherwise>
+		</xsl:choose></HorzAlign></Para>
+		<TextBlock><LeftMargin>0</LeftMargin><RightMargin>0</RightMargin><TopMargin>0</TopMargin><BottomMargin>0</BottomMargin></TextBlock>
+		<Char IX='0'><Font>4</Font><Color>0</Color><Style>1</Style><xsl:apply-templates mode="Font" select="."/></Char>
+		<xsl:choose>
+			<xsl:when test="s:tspan">
+			<xsl:element name="Text"  xml:space='preserve'><cp IX='0'/><xsl:for-each select="s:tspan"><xsl:value-of select="."/><xsl:if test="position()!=last()">&#xa;</xsl:if></xsl:for-each></xsl:element>
+		</xsl:when>
+		<xsl:otherwise><xsl:element name="Text"  xml:space='preserve'><cp IX='0'/><xsl:value-of select="."/></xsl:element></xsl:otherwise>
+		</xsl:choose>
+	</Shape>	
+</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="s:svg/s:g[not(@class) and s:text and not(s:g)]">
+<xsl:for-each select="s:text">
+	<xsl:comment>non-legend descriptive text "<xsl:value-of select="."/>"</xsl:comment>
+	<Shape Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6'>
+		<xsl:call-template name="ID"/>
+		<XForm>
+			<xsl:variable name="pos"><xsl:apply-templates select="." mode="position"/></xsl:variable>
+			<PinX><xsl:value-of select="$Scale * substring-before($pos,',')"/></PinX>
+			<PinY><xsl:value-of select="$Scale * (297 - substring-after($pos,','))"/></PinY>
+			<Width>10</Width>
+			<LocPinX F='0'/><LocPinY F="Height * 0.5"/>
+		</XForm>
+		<Para IX='0'><HorzAlign>
+		<xsl:choose><xsl:when test="@text-anchor='middle'">1</xsl:when>
+		<xsl:otherwise>0</xsl:otherwise>
+		</xsl:choose></HorzAlign></Para>
+		<Char IX='0'><Font>4</Font><Color>0</Color><Style>1</Style><xsl:apply-templates mode="Font" select="."/></Char>
+		<xsl:element name="Text"  xml:space='preserve'><cp IX='0'/><xsl:value-of select="."/></xsl:element>
+	</Shape>	
+</xsl:for-each>
+</xsl:template>
+
+
+<xsl:template match="s:rect[@class='cbox']">
+<xsl:comment>cbox</xsl:comment>
+	<Shape Type='Shape' LineStyle='6' FillStyle='6' TextStyle='6' Master='3'>
+		<xsl:call-template name="ID"/>
+		<XForm>
+			<xsl:variable name="pos"><xsl:apply-templates select="." mode="position"/></xsl:variable>
+			<PinX><xsl:value-of select="$Scale * substring-before($pos,',')"/></PinX>
+			<PinY><xsl:value-of select="$Scale* (297 - substring-after($pos,','))"/></PinY>
+			<Width><xsl:value-of select="@width * $Scale"/></Width><Height><xsl:value-of select="@height * $Scale"/></Height>
+			<LocPinX F='0'/><LocPinY F="Height"/>
+		</XForm>
+		<xsl:apply-templates mode="Line" select="."/>
+		<xsl:variable name="color"><xsl:call-template name="color"><xsl:with-param name="c" select="@fill "/></xsl:call-template></xsl:variable>	
+
+		<Fill><FillForegnd><xsl:value-of select="$color"/></FillForegnd><FillBkgnd>1</FillBkgnd><FillPattern>1</FillPattern><ShdwForegnd>0</ShdwForegnd><ShdwBkgnd>1</ShdwBkgnd></Fill>
+		<Connection IX='0'><X F='Inh'>0.4556939945017345</X><Y F='Inh'>0</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection><Connection IX='1'><X F='Inh'>0.911387989003469</X><Y F='Inh'>0.09113879890034685</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection><Connection IX='2'><X F='Inh'>0.4556939945017345</X><Y F='Inh'>0.1822775978006937</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection><Connection IX='3'><X F='Inh'>0</X><Y F='Inh'>0.09113879890034685</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection><Connection IX='4'><X F='Inh'>0.4556939945017345</X><Y F='Inh'>0.09113879890034685</Y><DirX Unit='NUM' F='No Formula'>0</DirX><DirY Unit='NUM' F='No Formula'>0</DirY><Type F='No Formula'>0</Type><AutoGen F='No Formula'>0</AutoGen><Prompt F='No Formula' V='null'/></Connection>
+		<Para IX='0'><IndFirst>0</IndFirst><IndLeft>0</IndLeft><IndRight>0</IndRight><SpLine>-1</SpLine><SpBefore>0</SpBefore><SpAfter>0</SpAfter><HorzAlign>1</HorzAlign></Para>
+
+		<TextBlock><LeftMargin Unit='PT'>0.02777777777777778</LeftMargin><RightMargin Unit='PT'>0.02777777777777778</RightMargin><TopMargin Unit='PT'>0.02777777777777778</TopMargin><BottomMargin Unit='PT'>0.02777777777777778</BottomMargin><VerticalAlign>1</VerticalAlign><TextBkgnd>0</TextBkgnd><DefaultTabStop F='Inh'>0.5905511811023622</DefaultTabStop><TextDirection>0</TextDirection><TextBkgndTrans F='No Formula'>0</TextBkgndTrans></TextBlock>
+		<Geom IX='0'><NoFill F='Inh'>0</NoFill><NoLine F='Inh'>0</NoLine><NoShow F='Inh'>0</NoShow><NoSnap F='No Formula'>0</NoSnap><MoveTo IX='1'><X F='Inh'>0</X><Y F='Inh'>0</Y></MoveTo><LineTo IX='2'><X F='Inh'>0.911387989003469</X><Y F='Inh'>0</Y></LineTo><LineTo IX='3'><X F='Inh'>0.911387989003469</X><Y F='Inh'>0.1822775978006937</Y></LineTo><LineTo IX='4'><X F='Inh'>0</X><Y F='Inh'>0.1822775978006937</Y></LineTo><LineTo IX='5'><X F='Inh'>0</X><Y F='Inh'>0</Y></LineTo></Geom>
+		<Char IX='0'><Font>4</Font><Color>0</Color><Style>1</Style><xsl:apply-templates mode="Font" select="."/></Char>
+		<xsl:element name="Text"  xml:space='preserve'><cp IX='0'/><xsl:value-of select="following-sibling::s:text"/></xsl:element>
+	</Shape>
+</xsl:template>					
+			
+
+<xsl:template name="line"><xsl:param name="content"/>
+	<xsl:variable name="w0" select="translate(exslt:node-set($content)/*/@stroke-width,' ','')"/>
+	<xsl:variable name="w">
+		<xsl:choose>
+			<xsl:when test="contains($w0,'px')"><xsl:value-of select="substring-before($w0,'px') * $Scale div  2.835 "/></xsl:when>
+			<xsl:when test="contains($w0,'pt')"><xsl:value-of select="substring-before($w0,'pt') *2 div 72"/></xsl:when>
+			<xsl:when test="number($w0)!='Nan'"><xsl:value-of select="$w0 * $Scale div  2.835"/></xsl:when>
+			<xsl:when test="@class='cbox'"><xsl:value-of select="$cbox-line-width*2 div 72"/></xsl:when>
+			<xsl:when test="@class='layer' or @class='layer-detail'"><xsl:value-of select="$layer-line-width*2 div 72"/></xsl:when>
+			<xsl:when test="@class='logicalset'  or @class='block'"><xsl:value-of select="$logicalset-line-width*2 div 72"/></xsl:when>
+			<xsl:when test="@class='logicalsubset'  or @class='subblock'"><xsl:value-of select="$logicalsubset-line-width*2 div 72"/></xsl:when>
+			<xsl:when test="@class='module' or @class='collection'"><xsl:value-of select="$module-line-width*2 div 72"/></xsl:when>
+			<xsl:when test="@class='legend'"><xsl:value-of select="$legend-line-width*2 div 72"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="0.4 *2 div 72"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>	
+
+	<Line>
+		<LineWeight><xsl:value-of select="$w"/></LineWeight>
+		<LineColor>0</LineColor>
+		<LinePattern>1</LinePattern>
+		<LineCap>1</LineCap>
+		<xsl:if test="exslt:node-set($content)/s:rect/@rx">
+			<Rounding><xsl:value-of select="$Scale * exslt:node-set($content)/s:rect/@rx"/></Rounding>
+		</xsl:if>
+	</Line>
+</xsl:template>
+
+<xsl:template match="*" mode="Line">
+	<xsl:variable name="w">
+		<xsl:choose>
+			<xsl:when test="@class='cbox'"><xsl:value-of select="$cbox-line-width"/></xsl:when>
+			<xsl:when test="@class='layer' or @class='layer-detail'"><xsl:value-of select="$layer-line-width"/></xsl:when>
+			<xsl:when test="@class='logicalset'  or @class='block'"><xsl:value-of select="$logicalset-line-width"/></xsl:when>
+			<xsl:when test="@class='logicalsubset'  or @class='subblock'"><xsl:value-of select="$logicalsubset-line-width"/></xsl:when>
+			<xsl:when test="@class='module' or @class='collection'"><xsl:value-of select="$module-line-width"/></xsl:when>
+			<xsl:when test="@class='legend'"><xsl:value-of select="$legend-line-width"/></xsl:when>
+			<xsl:otherwise>0.4</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<Line>
+		<LineWeight><xsl:value-of select="$w*2 div 72"/></LineWeight>
+		<LineColor>0</LineColor><LinePattern>1</LinePattern><LineCap>1</LineCap>
+	</Line>
+</xsl:template>	
+
+
+<xsl:template name="fill"><xsl:param name="content"/>
+		<Fill>
+			<xsl:variable name="color">
+				<xsl:call-template name="color-value">
+					<xsl:with-param name="v" select="exslt:node-set($content)/*[1]/@fill"/>
+				</xsl:call-template>
+				</xsl:variable>	
+			<xsl:variable name="pattern" select="substring-before(substring-after(exslt:node-set($content)/*[starts-with(@fill,'url(#')]/@fill,'#'),')')"/>
+			<xsl:choose>
+				<xsl:when test="$pattern='Patternstriped-diag-up' ">
+					<FillForegnd>1</FillForegnd>
+					<FillBkgnd><xsl:value-of select="$color"/></FillBkgnd>
+					<FillPattern>16</FillPattern>
+					<ShdwForegnd F='Inh'>0</ShdwForegnd><ShdwBkgnd F='Inh'>1</ShdwBkgnd>
+				</xsl:when>
+				<xsl:when test="$pattern='Patternradial-grad'">
+					<FillForegnd>1</FillForegnd>
+					<FillBkgnd><xsl:value-of select="$color"/></FillBkgnd>
+					<FillPattern>40</FillPattern>
+					<FillPattern>40</FillPattern>
+					<ShdwForegnd F='Inh'>0</ShdwForegnd><ShdwBkgnd F='Inh'>1</ShdwBkgnd>
+				</xsl:when>
+				<xsl:when test="$pattern='Patternbig-X'">
+					<FillForegnd><xsl:value-of select="$color"/></FillForegnd>				
+					<FillPattern F='USE("Ex")'/>
+					<FillBkgnd><xsl:apply-templates select="//s:pattern[@id='depr' or @id='Patternbig-X']/*/@stroke[1]"/></FillBkgnd>
+				</xsl:when>
+				<xsl:otherwise>
+					<FillForegnd><xsl:value-of select="$color"/></FillForegnd>
+					<FillBkgnd>1</FillBkgnd>
+					<FillPattern>1</FillPattern>
+				</xsl:otherwise>
+			</xsl:choose>
+		</Fill>
+</xsl:template>
+
+<xsl:template mode="draw-text" match="s:text">
+	<xsl:element name="Text"  xml:space='preserve'><cp IX='0'/><xsl:value-of select="."/></xsl:element>
+	<xsl:variable name="s1">
+		<xsl:choose>
+			<xsl:when test="@class='cbox'">5</xsl:when>
+			<xsl:when test="@class='layer' or @class='layer-detail'">12</xsl:when>
+			<xsl:when test="@class='logicalset' or @class='block' or @class='package'">12</xsl:when>
+			<xsl:when test="@class='component' or @class='cmp'">6</xsl:when>
+			<xsl:when test="@class='logicalsubset' or @class='subblock'">9</xsl:when>
+			<xsl:when test="@class='module' or @class='collection'">8</xsl:when>
+			<xsl:when test="@class='title'">18</xsl:when>
+			<xsl:when test="@class='legend' or @class='lgd' or ../@class='legend'">12</xsl:when>
+			<xsl:when test="@class='label'">5.5</xsl:when>
+			<xsl:when test="@class='lgrp'">36</xsl:when>
+		</xsl:choose>
+	</xsl:variable>
+		<Char IX='0'><Font>4</Font>
+		<Color>
+		<xsl:call-template name="color-value">
+			<xsl:with-param name="v"  select="@fill"/>
+		</xsl:call-template>
+		</Color>
+		<Style>
+			<xsl:choose>
+				<xsl:when test="@font-weight='normal'">0</xsl:when>
+				<xsl:when test="@font-weight='bold'">1</xsl:when>
+				<xsl:when test="@font-style='italic'">2</xsl:when>
+				<xsl:otherwise>0</xsl:otherwise>
+			</xsl:choose>
+		</Style>
+		<Size>
+		<xsl:choose>
+			<xsl:when test="contains(@font-size,'px')"><xsl:value-of select="substring-before(@font-size,'px') *  2.835 * 2 div 72 "/></xsl:when>
+			<xsl:when test="contains(@font-size,'pt')"><xsl:value-of select="substring-before(@font-size,'pt') * $Scale * 2 div 72"/></xsl:when>
+			<xsl:when test="number(@font-size)!='Nan'"><xsl:value-of select="@font-size *  2.835 * 2 div 72 "/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$s1*2 div 72 * $Scale div  0.1"/></xsl:otherwise>
+		</xsl:choose>
+		</Size>
+	</Char>
+	<TextBlock><VerticalAlign>
+	<xsl:choose> <!-- top middle bottom -->
+				<xsl:when test="@dy='0.375em'">1</xsl:when>
+				<xsl:when test="@dy='1em' or @dy='0.75em'">0</xsl:when>
+				<xsl:otherwise>2</xsl:otherwise>
+		</xsl:choose>
+	</VerticalAlign></TextBlock>
+	<Para IX='0'><IndFirst>0</IndFirst><IndLeft>0</IndLeft><IndRight>0</IndRight><SpLine>-1</SpLine><SpBefore>0</SpBefore><SpAfter>0</SpAfter>
+		<HorzAlign>
+			<xsl:choose>
+				<xsl:when test="@text-anchor='start'">0</xsl:when>
+				<xsl:when test="@text-anchor='end'">2</xsl:when>
+				<xsl:when test="@text-anchor='middle'">1</xsl:when>
+				<xsl:otherwise>0</xsl:otherwise>
+		</xsl:choose></HorzAlign>
+	</Para>
+	<Tabs IX='0'/>
+</xsl:template>
+
+<xsl:template name="font">
+	<xsl:variable name="this">
+		<xsl:copy>
+			<xsl:apply-templates select="@*" mode="unstyle"/>
+			<xsl:call-template name="style"/>
+			<xsl:copy-of select="node()"/>
+		</xsl:copy>
+	</xsl:variable>
+	<xsl:apply-templates select="exslt:node-set($this)/s:text" mode="draw-text"/>
+</xsl:template>
+
+<xsl:template name="fontUNUSED">
+	<!-- <xsl:value-of select="exslt:node-set($this)/*/@*[name()=$property]"/>-->
+	<xsl:variable name="weight" select="exslt:node-set($this)/s:text/@font-weight"/>
+	<xsl:variable name="s0"  select="exslt:node-set($this)/s:text/@font-size"/>
+	<xsl:variable name="h-align"  select="exslt:node-set($this)/s:text/@text-anchor"/>
+	<xsl:message>
+	<xsl:value-of select="@dy"/>
+	</xsl:message>
+	<xsl:variable name="s1">
+		<xsl:choose>
+			<xsl:when test="@class='cbox'">5</xsl:when>
+			<xsl:when test="@class='layer' or @class='layer-detail'">12</xsl:when>
+			<xsl:when test="@class='logicalset' or @class='block' or @class='package'">12</xsl:when>
+			<xsl:when test="@class='component' or @class='cmp'">6</xsl:when>
+			<xsl:when test="@class='logicalsubset' or @class='subblock'">9</xsl:when>
+			<xsl:when test="@class='module' or @class='collection'">8</xsl:when>
+			<xsl:when test="@class='title'">18</xsl:when>
+			<xsl:when test="@class='legend' or @class='lgd' or ../@class='legend'">12</xsl:when>
+			<xsl:when test="@class='label'">5.5</xsl:when>
+			<xsl:when test="@class='lgrp'">36</xsl:when>
+		</xsl:choose>
+	</xsl:variable>
+		<Char IX='0'><Font>4</Font>
+		<Color>
+		<xsl:call-template name="color-value">
+			<xsl:with-param name="v"  select="exslt:node-set($this)/s:text/@fill"/>
+		</xsl:call-template>
+		</Color>
+		<Style>
+			<xsl:choose>
+				<xsl:when test="$weight='normal'">0</xsl:when>
+				<xsl:when test="$weight='bold'">1</xsl:when>
+				<xsl:otherwise>0</xsl:otherwise>
+			</xsl:choose>
+		</Style>
+		<Size>
+		<xsl:choose>
+			<xsl:when test="contains($s0,'px')"><xsl:value-of select="substring-before($s0,'px') *  2.835 * 2 div 72 "/></xsl:when>
+			<xsl:when test="contains($s0,'pt')"><xsl:value-of select="substring-before($s0,'pt') * $Scale * 2 div 72"/></xsl:when>
+			<xsl:when test="number($s0)!='Nan'"><xsl:value-of select="$s0 *  2.835 * 2 div 72 "/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$s1*2 div 72 * $Scale div  0.1"/></xsl:otherwise>
+		</xsl:choose>
+		</Size>
+	</Char>
+	<Para IX='0'><IndFirst>0</IndFirst><IndLeft>0</IndLeft><IndRight>0</IndRight><SpLine>-1</SpLine><SpBefore>0</SpBefore><SpAfter>0</SpAfter>
+		<HorzAlign>
+			<xsl:choose>
+				<xsl:when test="$h-align='start'">0</xsl:when>
+				<xsl:when test="$h-align='end'">2</xsl:when>
+				<xsl:when test="$h-align='middle'">1</xsl:when>
+				<xsl:otherwise>0</xsl:otherwise>
+		</xsl:choose></HorzAlign>
+	</Para>
+	<Tabs IX='0'/>		
+</xsl:template>
+
+
+<xsl:template match="*" mode="Font">
+	<xsl:variable name="s">
+		<xsl:choose>
+			<xsl:when test="@class='cbox'">5</xsl:when>
+			<xsl:when test="@class='layer' or @class='layer-detail'">12</xsl:when>
+			<xsl:when test="@class='logicalset' or @class='block'">12</xsl:when>
+			<xsl:when test="@class='component' or @class='cmp'">6</xsl:when>
+			<xsl:when test="@class='logicalsubset' or @class='subblock'">9</xsl:when>
+			<xsl:when test="@class='module' or @class='collection'">8</xsl:when>
+			<xsl:when test="@class='title'">18</xsl:when>
+			<xsl:when test="@class='legend' or @class='lgd' or ../@class='legend'">12</xsl:when>
+			<xsl:when test="@class='label'">5.5</xsl:when>
+			<xsl:when test="@class='lgrp'">36</xsl:when>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:if test="position()!=1">
+	<xsl:message><xsl:value-of select="position()"/></xsl:message></xsl:if>
+	<Size><xsl:value-of select="$s*2 div 72 * $Scale div  0.1"/></Size>
+</xsl:template>
+
+<xsl:template name="color"><xsl:param name="c" select="substring-before(substring-after(s:use[1]/@style,'fill:'),';')"/>
+<xsl:call-template name="color-value">
+<xsl:with-param name="v" select="$c"/>
+</xsl:call-template>
+<!--
+	<xsl:variable name="color" select="count(  key('color',$c)/preceding-sibling::s:rect[@class='cbox']     ) +  3"/>
+		<xsl:message><xsl:value-of select="$c"/></xsl:message>
+	<xsl:choose>
+		<xsl:when test="$color=3 and not(key('color',$c))">#aaaaaa</xsl:when>
+		<xsl:when test="$color &lt; 24"><xsl:value-of select="$color"/></xsl:when>
+		<xsl:otherwise><xsl:apply-templates  select="key('color',$c)/@fill"/></xsl:otherwise>
+	</xsl:choose>-->
+</xsl:template>
+
+
+
+					
+<!-- ====== positions in model  from overlay.xsl ===============-->
+
+
+<xsl:template match="s:use|s:rect|s:text" mode="position">
+	<xsl:variable name="pos">
+		<xsl:call-template name="sumpos">
+			<xsl:with-param name="list">
+		   		<xsl:value-of select="concat(@x,' ',@y)"/>
+		   		<xsl:apply-templates select="ancestor::s:g[@transform]" mode="position"/>
+		   </xsl:with-param>
+		 </xsl:call-template>
+	</xsl:variable>
+	<xsl:value-of select="concat(substring-before($pos, ' ') + $Size *0.5 ,',',substring-after($pos, ' ') + $Size *0.5 )"/>
+</xsl:template>
+
+<xsl:template match="s:g" mode="position">
+	<xsl:variable name="pos" select="normalize-space(substring-before(substring-after(substring-after(@transform,'translate'),'('),')'))"/>
+	<xsl:choose>
+		<xsl:when test="contains($pos,' ')"> + <xsl:value-of select="$pos"/></xsl:when>
+		<xsl:otherwise> + <xsl:value-of select="$pos"/> 0</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="sumpos"><xsl:param name="list"/>
+	<xsl:variable name="cur" select="normalize-space(substring-before($list,'+'))"/>
+	<xsl:choose>
+		<xsl:when test="$cur=''"><xsl:value-of select="normalize-space($list)"/></xsl:when>
+		<xsl:otherwise>
+			<xsl:variable name="x" select="substring-before($cur,' ')"/>
+			<xsl:variable name="y" select="substring-after($cur,' ')"/>
+			<xsl:variable name="next">
+				<xsl:call-template name="sumpos">
+					<xsl:with-param name="list" select="substring-after($list,'+')"/>
+				</xsl:call-template>
+			</xsl:variable>	
+			<xsl:variable name="x1" select="substring-before($next,' ')"/>
+			<xsl:variable name="y1" select="substring-after($next,' ')"/>
+			<xsl:value-of select="concat($x1 +  $x,' ', $y1 + $y)"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="printprops">
+	<PrintProps>
+		<PageLeftMargin>0.25</PageLeftMargin>
+		<PageRightMargin>0.25</PageRightMargin>
+		<PageTopMargin>0.25</PageTopMargin>
+		<PageBottomMargin>0.25</PageBottomMargin>
+		<ScaleX>1</ScaleX>
+		<ScaleY>1</ScaleY>
+		<PagesX>1</PagesX>
+		<PagesY>1</PagesY>
+		<CenterX>0</CenterX>
+		<CenterY>0</CenterY>
+		<OnPage>1</OnPage>
+		<PrintGrid>0</PrintGrid>
+		<PrintPageOrientation>2</PrintPageOrientation>
+		<PaperKind>8</PaperKind>
+		<PaperSource>7</PaperSource>
+	</PrintProps>
+</xsl:template>
+
+
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/validate-raw.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,176 @@
+<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" 	xmlns:set="http://exslt.org/sets">
+<output method="text"/>
+<key name="name" match="component|collection|package|layer" use="@id"/>
+
+<template match="/*" priority="-1">
+ERROR: Invalid root element: <value-of select="name()"/>
+</template>
+
+<template match="*" priority="-5">
+ERROR: Invalid element: <value-of select="name()"/>
+</template>
+
+
+
+<template match="component/Build"/> <!-- for depmodel -->
+
+<template match="@*" priority="-5">
+NOTE: unexpected attribute "<value-of select="name()"/>" on &lt;<value-of select="name(..)"/>&gt;</template>
+
+
+<template match="text()">
+<if test="normalize-space(.)!=''">
+ERROR: unexepected text: <value-of select="."/></if>
+</template>
+
+
+<template match="/SystemDefinition">
+<if test="not(systemModel/@name)">
+Note: missing System Model name</if>
+<for-each select="systemModel//*[@id]">
+	<if test="count(key('name',@id)) &gt; 1">
+ERROR: duplicate name for <value-of select="name()"/> "<value-of select="@id"/>" (<value-of select="count(key('name',@id))"/>)	<apply-templates mode="location" select=".."/></if>
+</for-each>
+<apply-templates select="@schema | node()"/>
+<call-template name="extra-atts"/>
+<call-template name="extra-atts"><with-param name="item">collection</with-param></call-template>
+<call-template name="extra-atts"><with-param name="item">package</with-param></call-template>
+<call-template name="extra-atts"><with-param name="item">layer</with-param></call-template>
+<variable name="levels">
+	<for-each select="set:distinct(//@level)">
+	   <value-of select="concat(.,' ')"/>
+   </for-each>
+  </variable>
+<if test="$levels!=''">
+Note: Level names used: <value-of select="normalize-space($levels)"/></if>
+</template>
+
+<template name="extra-atts"><param name="item">component</param>
+<variable name="atts">
+	<for-each select="//*[name()=$item]/@*"><variable name="n" select="name()"/>
+	<if test="not(following::*[name()=$item]/@*[name()=$n])">
+	   <apply-templates mode="extra" select="."/></if>
+	</for-each>
+</variable>
+<if test="$atts!=''">
+Note: Extra <value-of select="$item"/> attributes: <value-of select="normalize-space($atts)"/></if>
+</template>
+
+<template match="@*" mode="extra">
+	   <value-of select="concat(name(), ' ')"/>
+</template>
+
+
+<template match="collection/@level | package/@level | package/@span | layer/@span| layer/@levels | package/@levels | @name | @id | @before |component/@filter |component/@contract |component/@deprecated |component/@class |component/@introduced |component/@purpose|component/@target" mode="extra"/>
+
+
+<template match="/SystemDefinition/@schema">
+<choose>
+	<when test="starts-with(.,'3.')"/>
+<otherwise>
+ERROR: unsupported syntax: <value-of select="."/></otherwise>
+</choose>
+</template>
+
+
+
+<template match="@level">
+WARNING: invalid attribute "<value-of select="name()"/>" on &lt;<value-of select="name(..)"/>&gt;</template>
+	
+<template match="systemModel/layer|layer/package|package/package| package/collection| collection/component |
+	SystemDefinition/layer| SystemDefinition/package| SystemDefinition/collection| SystemDefinition/component">
+	<apply-templates select="@*|node()"/>
+</template>
+
+
+<template match="layer|package|collection|component" priority="-3">
+ERROR: &lt;<value-of select="name()"/> name="<value-of select="@id"/>"&gt; cannot be a child of &lt;<value-of select="name(..)"/>&gt;</template>
+
+
+
+<template match="package/@level">
+<if test="not(contains(concat(' ',normalize-space(../../@levels), ' '),concat(' ',normalize-space(.), ' ')))">
+ERROR: Invalid level name "<value-of select="."/>" on <value-of select="name(..)"/> "<value-of select="../@id"/>" (<value-of select="../../@levels"/>)</if>
+</template>
+
+<template match="collection/@level">
+<choose>
+	<when test="ancestor::package/@levels">
+		<if test="not(contains(concat(' ',normalize-space(ancestor::package/@levels), ' '),concat(' ',normalize-space(.), ' ')))">
+ERROR: Invalid level name "<value-of select="."/>" on <value-of select="name(..)"/> "<value-of select="../@id"/>" (<value-of select="../../@levels"/>)</if>
+	</when>
+	<otherwise>
+		<if test="not(contains(concat(' ',normalize-space(ancestor::layer/@levels), ' '),concat(' ',normalize-space(.), ' ')))">
+ERROR: Invalid level name "<value-of select="."/>" on <value-of select="name(..)"/> "<value-of select="../@id"/>" (<value-of select="../../@levels"/>)</if>
+	</otherwise>
+</choose>
+</template>
+
+
+
+<template match="component/@plugin">
+	<if test=".!='Y' and .!='N'">
+WARNING: invalid <value-of select="name()"/> value "<value-of select="."/>" on &lt;<value-of select="name(..)"/> name="<value-of select="../@id"/>"&gt;</if>
+</template>
+
+
+<template match="logicalset|logicalsubset|module|SystemBuild">
+ERROR: using 1.x syntax element: &lt;<value-of select="name()"/>&gt;</template>
+
+<template match="unit/@name | unit/@unitID">
+<if test="not(starts-with(/SystemDefinition/@schema,'1.'))">
+WARNING: using 1.x syntax attribute: &lt;<value-of select="concat(name(..),' ',name())"/>="<value-of select="."/>"&gt;</if>
+</template>
+
+<template match="@name | layer/@levels |package/@levels | component/@class | component/@filter | component/@introduced  | component/@deprecated | component/@contract"> <!-- validate elsewhere -->
+	<if test=".=''">
+ERROR: attribute "<value-of select="name()"/>" on &lt;<value-of select="name(..)"/>&gt; must not be empty</if>
+</template>
+
+<template match="systemModel|meta">
+	<apply-templates select="@*|node()"/>
+</template>
+
+<template match="meta/*"/> <!-- anything's valid-->
+
+<template match="meta/@href | meta/@rel | meta/@type"/>
+
+<template match="unit[starts-with(/SystemDefinition/@schema,'1.')]/@contract"/>
+
+
+<template match="unit/@mrp | unit/@bldFile">
+<choose>
+<when test="starts-with(/SystemDefinition/@schema,'1.')">
+	<if test="contains(.,'/')">
+WARINING: path separator must be "\" for <value-of select="name()"/>="<value-of select="."/>"</if>
+</when>
+<otherwise>
+	<if test="contains(.,'\')">
+WARINING: path separator must be "/" for <value-of select="name()"/>="<value-of select="."/>"</if>
+</otherwise>
+</choose>
+</template>
+
+
+<template match="unit/@version | unit/@priority | unit/@filter | unit/@root"/> <!-- handle later-->
+<template match="package/@* | prebuilt/@*"/> <!-- handle later-->
+
+<template match="unit|component/package|prebuilt">
+	<if test="*">
+WARNING: &lt;<value-of select="name()"/>&gt; must be empty.</if>
+
+<if test="not(starts-with(/SystemDefinition/@schema,'1.'))">
+<if test="count(../unit | ../package | ../prebuilt) != 1 and count(../*[@filter or @version]) != count(../*)">
+WARNING: multiple units must have "version" or "filter" attributes (<value-of select="../@id"/>)</if>
+<if test="self::prebuilt or self::package">
+ERROR: using 1.x syntax element: &lt;<value-of select="name()"/>&gt;</if>
+</if>
+<apply-templates select="@*"/>
+</template>
+
+<template mode="location" match="*">
+<for-each select="ancestor::*[(self::layer or self::package or self::collection) and @name]">[<value-of select="substring(name(),1,1)"/>] <value-of select="@id"/>
+	<if test="position()=1"> / </if>
+</for-each>
+</template>
+</stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/extra/validate.xsl	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,16 @@
+<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" 	xmlns:set="http://exslt.org/sets">
+<import href="validate-raw.xsl"/>
+<output method="text"/>
+<!-- for validating the generated temp XML file -->
+
+
+
+<template match="SystemDefinition/@*"/> <!-- any attributes ok-->
+
+
+<template match="component/@* | collection/@* | package/@* | layer/@*" priority="-4"/>
+
+<template match="@abbrev|@align|component/@old_model|@*[starts-with(name(),'generat')]" mode="extra"/>
+
+
+</stylesheet>
--- a/sysmodellibs/sysmodelgen/group/build.xml	Wed Oct 13 14:00:36 2010 +0100
+++ b/sysmodellibs/sysmodelgen/group/build.xml	Wed Oct 13 16:21:25 2010 +0100
@@ -19,13 +19,15 @@
 
 	<property name="zip.folder" value="${epoc.build}/zips/" />
 	
-	<property name="current.version" value="1.0.0" />
+	<property name="current.version" value="2.0.0" />
 	
 	<property name="src.folder" value="${basedir}/src" />
 	
-	<property name="doc.folder" value="${basedir}/docs" />
+	<property name="xslt.folder" value="${basedir}/core" />
 	
-	<property name="resources.folder" value="${basedir}/resources" />
+	<property name="resources.folder" value="${basedir}/rsc" />
+
+	<property name="extras.folder" value="${basedir}/extra" />
 	
 	<property name="installer.folder" value="${basedir}/installer" />
 	
@@ -47,31 +49,36 @@
 		
 		<mkdir dir="${zip.folder}"/>
 		
-		<copy file="${src.folder}/svg/DrawSvg.pl" tofile="${temp.folder}/SysModGen.pl"/>
+		<copy file="${basedir}/SysModGen.pl" tofile="${temp.folder}/SysModGen.pl"/>
 		
-		<copy todir="${temp.folder}/documentation" >
-			<fileset dir="${doc.folder}/">
-				<exclude name="**/DISTRIBUTION.POLICY"/>
-				<exclude name="**/SystemModelToolkitInstaller_main.jpg" />
-			</fileset>
-		</copy>
-		
-		<copy todir="${temp.folder}">
+		<copy todir="${temp.folder}/src">
 			<fileset dir="${src.folder}/">
-				<exclude name="**/DISTRIBUTION.POLICY"/>
+				<exclude name="**/DISTRIBUTION.POLICY.S60"/>
 				<exclude name="**/*.pl"/>
 			</fileset>
 		</copy>
 		
-		<copy todir="${temp.folder}/resources">
+		<copy todir="${temp.folder}/rsc">
 			<fileset dir="${resources.folder}/">
-				<exclude name="**/DISTRIBUTION.POLICY"/>
+				<exclude name="**/DISTRIBUTION.POLICY.S60"/>
+			</fileset>
+		</copy>
+
+		<copy todir="${temp.folder}/extra">
+			<fileset dir="${extras.folder}/">
+				<exclude name="**/DISTRIBUTION.POLICY.S60"/>
+			</fileset>
+		</copy>
+
+		<copy todir="${temp.folder}/core">
+			<fileset dir="${xslt.folder}/">
+				<exclude name="**/DISTRIBUTION.POLICY.S60"/>
 			</fileset>
 		</copy>
 		
 		<copy todir="${release.folder}/SystemModelGenerator">
 			<fileset dir="${temp.folder}">
-				<exclude name="**/DISTRIBUTION.POLICY"/>
+				<exclude name="**/DISTRIBUTION.POLICY.S60"/>
 			</fileset>
 		</copy>
 		
@@ -97,27 +104,23 @@
 		<pathconvert property="prop.dist.contents" refid="dist.contents.SystemModelGenerator" pathsep="${line.separator}"/>
 		<echo>${prop.dist.contents}</echo>
 		
-		<fileset id="dist.contents.common" dir="${release.folder}/SystemModelGenerator/common" includes="*"/>
-		<pathconvert property="prop.dist.contents.common" refid="dist.contents.common" pathsep="${line.separator}"/>
-		<echo>${prop.dist.contents.common}</echo>
-
-		<fileset id="dist.contents.documentation" dir="${release.folder}/SystemModelGenerator/documentation" includes="*"/>
-		<pathconvert property="prop.dist.contents.documentation" refid="dist.contents.documentation" pathsep="${line.separator}"/>
-		<echo>${prop.dist.contents.documentation}</echo>
+		<fileset id="dist.contents.core" dir="${release.folder}/SystemModelGenerator/core" includes="*"/>
+		<pathconvert property="prop.dist.contents.core" refid="dist.contents.core" pathsep="${line.separator}"/>
+		<echo>${prop.dist.contents.core}</echo>
 		
-		<fileset id="dist.contents.svg" dir="${release.folder}/SystemModelGenerator/svg" includes="*"/>
-		<pathconvert property="prop.dist.contents.svg" refid="dist.contents.svg" pathsep="${line.separator}"/>
-		<echo>${prop.dist.contents.svg}</echo>
+		<fileset id="dist.contents.src" dir="${release.folder}/SystemModelGenerator/src" includes="*"/>
+		<pathconvert property="prop.dist.contents.src" refid="dist.contents.src" pathsep="${line.separator}"/>
+		<echo>${prop.dist.contents.src}</echo>
 		
-		<fileset id="dist.contents.auxiliary" dir="${release.folder}/SystemModelGenerator/resources/auxiliary" includes="*"/>
-		<pathconvert property="prop.dist.contents.auxiliary" refid="dist.contents.auxiliary" pathsep="${line.separator}"/>
-		<echo>${prop.dist.contents.auxiliary}</echo>
+		<fileset id="dist.contents.extra" dir="${release.folder}/SystemModelGenerator/extra" includes="*"/>
+		<pathconvert property="prop.dist.contents.extra" refid="dist.contents.extra" pathsep="${line.separator}"/>
+		<echo>${prop.dist.contents.extra}</echo>
 		
-		<fileset id="dist.contents.Xalan" dir="${release.folder}/SystemModelGenerator/resources/installed/Xalan" includes="*"/>
+		<fileset id="dist.contents.Xalan" dir="${release.folder}/SystemModelGenerator/rsc/installed/Xalan" includes="*"/>
 		<pathconvert property="prop.dist.contents.Xalan" refid="dist.contents.Xalan" pathsep="${line.separator}"/>
 		<echo>${prop.dist.contents.Xalan}</echo>
 		
-		<fileset id="dist.contents.xsd" dir="${release.folder}/SystemModelGenerator/resources/xsd" includes="*"/>
+		<fileset id="dist.contents.xsd" dir="${release.folder}/SystemModelGenerator/src/old/resources/xsd" includes="*"/>
 		<pathconvert property="prop.dist.contents.xsd" refid="dist.contents.xsd" pathsep="${line.separator}"/>
 		<echo>${prop.dist.contents.xsd}</echo>
 		
--- a/sysmodellibs/sysmodelgen/installer/SystemModelToolkit.nsi	Wed Oct 13 14:00:36 2010 +0100
+++ b/sysmodellibs/sysmodelgen/installer/SystemModelToolkit.nsi	Wed Oct 13 16:21:25 2010 +0100
@@ -2,8 +2,8 @@
 ; Script generated by the HM NIS Edit Script Wizard.
 
 ; HM NIS Edit Wizard helper defines
-!define PRODUCT_NAME "SystemModelToolkit"
-!define PRODUCT_VERSION "1.1.9"
+!define PRODUCT_NAME "SystemModelGenerator"
+!define PRODUCT_VERSION "2.0.0"
 !define PRODUCT_PUBLISHER "Symbian Software Ltd"
 !define PRODUCT_WEB_SITE "http://www.symbian.com"
 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
@@ -18,7 +18,7 @@
 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico"
 
 ; Welcome page
-!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of SystemModelToolkit 1.1\n\nClick Next to continue..."
+!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of SystemModelGenerator 2.0\n\nClick Next to continue..."
 !insertmacro MUI_PAGE_WELCOME
 ; License page
 !define MUI_LICENSEPAGE_CHECKBOX
@@ -39,8 +39,8 @@
 ; MUI end ------
 
 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
-OutFile "SystemModelToolkitInstaller.exe"
-InstallDir "D:\SystemModelToolkit"
+OutFile "SystemModelGeneratorInstaller.exe"
+InstallDir "C:\Apps\SystemModelGenerator"
 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
 ShowInstDetails show
 ShowUnInstDetails show
@@ -51,7 +51,7 @@
 
   SetOutPath "$INSTDIR"
   SetOverwrite try
-  File "..\src\old\svg\DrawSvg.pl"
+  File "..\SysModGen.pl"
 
   SetOutPath "$INSTDIR\src\old\svg"
   SetOverwrite try
@@ -98,6 +98,39 @@
   SetOverwrite try
   File "..\src\Logger.pm"
   File "..\src\LogItem.pm"
+  File "..\src\SysModelGen.pm"
+
+
+  SetOutPath "$INSTDIR\core"
+  SetOverwrite try
+  File "..\core\draw-model.xsl"
+  File "..\core\draw.xsl"
+  File "..\core\filtersysdef-module.xsl"
+  File "..\core\joinmodel.xsl"
+  File "..\core\joinsysdef-module.xsl"
+  File "..\core\joinsysdef.xsl"
+  File "..\core\layout-module.xsl"
+  File "..\core\layoutsysdef.xsl"
+  File "..\core\legend-module.xsl"
+  File "..\core\legend.xsl"
+  File "..\core\mergesysdef-module.xsl"
+  File "..\core\mergesysdef.xsl"
+  File "..\core\overlay-module.xsl"
+  File "..\core\shapes.xsl"
+
+  SetOutPath "$INSTDIR\extra"
+  SetOverwrite try
+  File "..\extra\css-module.xsl"
+  File "..\extra\css2xml.xsl"
+  File "..\extra\dependencies.xsl"
+  File "..\extra\makeabbrev.xsl"
+  File "..\extra\output-csv.xsl"
+  File "..\extra\output-sysdef.xsl"
+  File "..\extra\postprocess.xsl"
+  File "..\extra\tovisio.xsl"
+  File "..\extra\validate-raw.xsl"
+  File "..\extra\validate.xsl"
+  File "..\extra\sample_config.ini"
 
   SetOutPath "$INSTDIR\rsc\installed\Xalan"
   SetOverwrite try
@@ -106,16 +139,15 @@
   File "..\rsc\installed\Xalan\XalanMessages_1_8.dll"
   File "..\rsc\installed\Xalan\xerces-c_2_5_0.dll"
 
-  SetOutPath "$INSTDIR\resources\auxiliary"
+  SetOutPath "$INSTDIR\rsc"
   SetOverwrite try
-  File "..\resources\auxiliary\system_model_colors.xml"
-  File "..\resources\auxiliary\display-names.xml"
-  File "..\resources\auxiliary\Levels.xml"
-  File "..\resources\auxiliary\Levels91.xml"
-  File "..\resources\auxiliary\Shapes.xml"
-  File "..\resources\auxiliary\Example-shapes.xml"
-  File "..\resources\auxiliary\SystemInfo.xml"
-
+  File "..\rsc\dictionary.xml"
+  File "..\rsc\fshapes.xml"
+  File "..\rsc\ModelTemplate.94.xml"
+  File "..\rsc\ModelTemplate.95.xml"
+  File "..\rsc\ModelTemplate.older.xml"
+  File "..\rsc\ModelTemplate.xml"
+  File "..\rsc\shapes.xml"
 
 
 SectionEnd
@@ -147,10 +179,42 @@
 Section Uninstall
 
   Delete "$INSTDIR\uninst.exe"
+  Delete "$INSTDIR\core\draw-model.xsl"
+  Delete "$INSTDIR\core\draw.xsl"
+  Delete "$INSTDIR\core\filtersysdef-module.xsl"
+  Delete "$INSTDIR\core\joinmodel.xsl"
+  Delete "$INSTDIR\core\joinsysdef-module.xsl"
+  Delete "$INSTDIR\core\joinsysdef.xsl"
+  Delete "$INSTDIR\core\layout-module.xsl"
+  Delete "$INSTDIR\core\layoutsysdef.xsl"
+  Delete "$INSTDIR\core\legend-module.xsl"
+  Delete "$INSTDIR\core\legend.xsl"
+  Delete "$INSTDIR\core\mergesysdef-module.xsl"
+  Delete "$INSTDIR\core\mergesysdef.xsl"
+  Delete "$INSTDIR\core\overlay-module.xsl"
+  Delete "$INSTDIR\core\shapes.xsl"
+  Delete "$INSTDIR\extra\css-module.xsl"
+  Delete "$INSTDIR\extra\css2xml.xsl"
+  Delete "$INSTDIR\extra\dependencies.xsl"
+  Delete "$INSTDIR\extra\makeabbrev.xsl"
+  Delete "$INSTDIR\extra\output-csv.xsl"
+  Delete "$INSTDIR\extra\output-sysdef.xsl"
+  Delete "$INSTDIR\extra\postprocess.xsl"
+  Delete "$INSTDIR\extra\sample_config.ini"
+  Delete "$INSTDIR\extra\tovisio.xsl"
+  Delete "$INSTDIR\extra\validate-raw.xsl"
+  Delete "$INSTDIR\extra\validate.xsl"
+  Delete "$INSTDIR\rsc\dictionary.xml"
+  Delete "$INSTDIR\rsc\fshapes.xml"
   Delete "$INSTDIR\rsc\installed\Xalan\Xalan-C_1_8.dll"
   Delete "$INSTDIR\rsc\installed\Xalan\Xalan.exe"
   Delete "$INSTDIR\rsc\installed\Xalan\XalanMessages_1_8.dll"
   Delete "$INSTDIR\rsc\installed\Xalan\xerces-c_2_5_0.dll"
+  Delete "$INSTDIR\rsc\ModelTemplate.94.xml"
+  Delete "$INSTDIR\rsc\ModelTemplate.95.xml"
+  Delete "$INSTDIR\rsc\ModelTemplate.older.xml"
+  Delete "$INSTDIR\rsc\ModelTemplate.xml"
+  Delete "$INSTDIR\rsc\shapes.xml"
   Delete "$INSTDIR\src\old\resources\auxiliary\display-names.xml"
   Delete "$INSTDIR\src\old\resources\auxiliary\Example-shapes.xml"
   Delete "$INSTDIR\src\old\resources\auxiliary\Levels.xml"
@@ -179,13 +243,21 @@
   Delete "$INSTDIR\src\old\svg\Postprocess.xsl"
   Delete "$INSTDIR\src\old\svg\Shapes.xsl"
   Delete "$INSTDIR\src\old\svg\sysdefdowngrade.xsl"
+  Delete "$INSTDIR\src\old\svg\validate-raw.xsl"
+  Delete "$INSTDIR\src\old\svg\validate.xsl"
   Delete "$INSTDIR\src\Logger.pm"
   Delete "$INSTDIR\src\LogItem.pm"
+  Delete "$INSTDIR\src\SysModelGen.pm"
+  Delete "$INSTDIR\SysModGen.pl"
 
   RMDir "$INSTDIR\src\old\svg"
   RMDir "$INSTDIR\common"
+  RMDir "$INSTDIR\src\old\resources\installed\Xalan"
+  RMDir "$INSTDIR\src\old\resources\installed"
   RMDir "$INSTDIR\src\old\resources\auxiliary"
   RMDir "$INSTDIR\src\old\resources"
+  RMDir "$INSTDIR\core"
+  RMDir "$INSTDIR\extra"
   RMDir "$INSTDIR\rsc"
   RMDir "$INSTDIR"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/rsc/ModelTemplate.94.xml	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<model name="Symbian OS" label="System Model" shapes="shapes.xml" ver="9.4">
+	<!-- for Symbian 9.4 models -->
+	<ignore type="layer" name="Tools and Utils and SDKENG"/>
+	<ignore type="layer" name="MISC"/>
+	<ignore type="layer" name="UI"/>
+	<layout>
+		<layer-group color="rgb(143,188,143)" from="HAL" to="Application Services">
+			<layer-group color="rgb(93,155,205)" from="Kernel Services" to="OS Services" label="Core OS"/>	
+		</layer-group>
+		<legend label="Key">
+		</legend>
+	</layout>
+</model>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/rsc/ModelTemplate.95.xml	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<model name="Symbian OS" label="System Model" shapes="shapes.xml">
+	<!-- for Symbian 9.5 models -->
+	<ignore type="layer" name="Tools and Utils and SDKENG"/>
+	<ignore type="layer" name="MISC"/>
+	<ignore type="block" name="Techview"/>
+	<layout>
+		<layer-group color="rgb(143,188,143)" from="Hardware" to="Application Services">
+			<layer-group color="rgb(93,155,205)" from="Kernel Services" to="OS Services" label="Core OS"/>	
+		</layer-group>
+		<legend label="Key">
+		</legend>
+	</layout>
+</model>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/rsc/ModelTemplate.older.xml	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<model name="Symbian OS" label="System Model" shapes="shapes.xml">
+	<!-- for 9.3 and earlier models -->
+
+	<ignore type="layer" name="Tools and Utils and SDKENG"/>
+	<ignore type="layer" name="MISC"/>
+	<ignore type="layer" name="UI"/>
+	<layout>
+		<display name="UI Framework" align="right"/>
+		<display name="Application Services" align="left"/>
+		<legend label="Key">
+		</legend>
+	</layout>
+</model>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/rsc/ModelTemplate.xml	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<model name="Symbian" label="System Model" shapes="shapes.xml">
+	<layout>
+		<legend label="Key">
+			<legend use="@shapes#colors"/>
+			<legend use="@shapes#styles"/>
+			<legend use="@shapes#patterns"/>
+			<legend use="@shapes#borders"/>
+		</legend>
+	</layout>
+</model>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/rsc/dictionary.xml	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,146 @@
+<dict>
+  <word term="Application" abbrev="App" d="Appli&#xad;cation"/>
+  <word term="Applications" abbrev="Apps" d="Appli&#xad;cations"/>
+  <word term="Reference" abbrev="Ref"/>
+  <word term="and" d="&amp;"/>
+  <word term="Management" abbrev="Mgmt." d="Manage&#xad;ment"/>
+  <word term="Connection" d="Connec&#xad;tion" abbrev="Conn."/>
+  <word term="Interfaces" d="Inter&#xad;faces"/>
+  <word term="Interface" d="Inter&#xad;face"/>
+  <word term="Interworking" d="Inter&#xad;working"/>
+  <word term="Restricted" abbrev="Restr."/>
+  <word term="PacketVideo" d="Packet&#xad;Video"/>
+  <word term="ImagePrint" d="Image&#xad;Print"/>
+  <word term="Verification" d="Verifica&#xad;tion"/>
+  <word term="Postprocessor" abbrev="Post-proc."/>
+  <word term="Supplementary" abbrev="Suppl."/>
+  <word term="Parameters" d="Param&#xad;eters"/>
+  <word term="Middleware" d="Middle&#xad;ware"/>
+  <word term="Multimedia" d="Multi&#xad;media" s="MM"/>
+  <word term="Frameworks" d="Frame&#xad;works" abbrev="Fmwks." s="FW"/>
+  <word term="Framework" d="Frame&#xad;work" abbrev="Fmwk." s="FW"/>
+  <word term="Component" d="Compo&#xad;nent" abbrev="Cmp."/>
+  <word term="compo" d="Cmp."/>
+  <word term="Components" d="Compo&#xad;nents" abbrev="Cmp."/>
+  <word term="Customisation" d="Custom&#xad;isation"/>
+  <word term="Device" d="Dev&#xad;ice"/>
+  <word term="Adaptation" abbrev="Adapt." d="Adapta&#xad;tion"/>
+  <word term="Bluetooth" d="Blue&#xad;tooth" abbrev="Btooth." s="BT"/>
+  <word term="Implementations" d="Implemen&#xad;tations" abbrev="Impl."/>
+  <word term="Implementation" d="Implemen&#xad;tation" abbrev="Impl."/>
+  <word term="Documentation" abbrev="Docs"/>
+  <word term="Networking" d="Network&#xad;ing"/>
+  <word term="Compression" d="Compres&#xad;sion"/>
+  <word term="Conversation" d="Conversa&#xad;tion"/>
+  <word term="Libraries" abbrev="Libs"/>
+  <word term="Certificates" d="Certif&#xad;icates"/>
+  <word term="Environment" d="Environ&#xad;ment" abbrev="Env."/>
+  <word term="Recognition" d="Recog&#xad;nition"/>
+  <word term="Hardware" s="HW"/>
+  <word term="Software" s="SW"/>
+  <word term="ScreenGrabber" d="Screen&#xad;Grabber"/>
+  <word term="Subsystem" d="Sub&#xad;system"/>
+  <word term="Localisation" d="Localis&#xad;ation"/>
+  <word term="Localization" d="Localiz&#xad;ation"/>
+  <word term="Translation" d="Trans&#xad;lation"/>
+  <word term="Abstraction" d="Abstrac&#xad;tion"/>
+  <word term="Characterisation" d="Character&#xad;isation"/>
+  
+  <word term="Transport" d="Trans&#xad;port"/>
+  <word term="Transports" d="Trans&#xad;ports"/>
+  <word term="Permission" d="Permis&#xad;sion"/>
+  <word term="Configuration" abbrev="Config."/>
+  <word term="Customization" abbrev="Custom&#xad;ization"/>
+  <word term="Configurator" abbrev="Config&#xad;urator"/>
+  <word term="Communications" d="Communi&#xad;cations" abbrev="Comms"/>
+  <word term="Connectivity" abbrev="Connect&#xad;ivity"/>
+  <word term="Integration" abbrev="Integ"/>
+  
+  <word term="Initialization" abbrev="Init"/>
+  <word term="Memory" d="Mem&#xad;ory"/>
+  <word term="Notification" d="Notifica&#xad;tion"/>
+  <word term="Architecture" abbrev="App. Arch."/>
+  <word term="Converter" abbrev="Cnvrter."/>
+    <word term="Converters" abbrev="Cnvrters."/>
+  <word term="Converged" d="Con&#xad;verged"/>
+  <word term="Dictionary" d="Dictio&#xad;nary"/>
+  <word term="Recognisers" d="Recog&#xad;nisers"/>
+  <word term="Recogniser" d="Recog&#xad;niser"/>
+  <word term="Recognizers" d="Recog&#xad;nizers"/>
+  <word term="Recognizer" d="Recog&#xad;nizer"/>
+  <word term="Homescreen" d="Home&#xad;screen"/>
+  
+  <word term="Provisioning" d="Provision&#xad;ing" s="Prov."/>
+  <word term="Messaging" abbrev="Msg." d="Messag&#xad;ing"/>
+  <word term="Message" abbrev="Msg."/>
+  <word term="Scheduled" abbrev="Sched."/>
+  <word term="Repository" d="Repos&#xad;itory"/>
+  <word term="Character" abbrev="Char."/>
+  <word term="Encoding" abbrev="Encode."/>
+  <word term="Conversion" abbrev="Conv." d="Conver&#xad;sion"/>
+  <word term="Ethernet" abbrev="Ether."/>
+  <word term="Bootstrap" d="Boot&#xad;strap"/>
+  <word term="Emulator" d="Emu&#xad;lator"/>
+  <word term="Database" abbrev="Dbase." s="DB"/>
+  <word term="Controller" abbrev="Contrllr."/>
+  <word term="Multimode" d="Multi&#xad;mode"/>
+  <word term="Phonebook" d="Phone&#xad;book" s="Phbk."/>
+  <word term="Standard" abbrev="Std."/>
+  <word term="Scheduler" d="Sched&#xad;uler"/>
+  <word term="Rasteriser" abbrev="Rster."/>
+  <word term="Formatting" d="Formatt&#xad;ing"/>
+  <word term="Visualization" d="Visualiza&#xad;tion"/>
+  <word term="Redistribution" d="Redistrib&#xad;ution"/>
+  <word term="Personalization" d="Personal&#xad;ization"/>
+  <word term="Navigation" abbrev="Nav"/>
+  <word term="Validation" d="Valida&#xad;tion"/>
+  <word term="Processor" d="Proces&#xad;sor"/>
+  <word term="Integrator" abbrev="Integrtr."/>
+  <word term="Motherboard" d="Mother&#xad;board"/>
+  <word term="Subconnection" abbrev="Subconn."/>
+  <word term="StrongArm" d="Strong&#xad;Arm"/>
+  <word term="Broadcast" d="Broad&#xad;cast"/>
+  
+  <word term="Extension"  d="Exten&#xad;sion" abbrev="Ext."/>
+  <word term="Extensions" d="Exten&#xad;sions" abbrev="Ext."/>
+  <word term="Transmitter" abbrev="Transmit."/>
+  <word term="Cryptography" abbrev="Crypto."/>
+  <word term="Composition" d="Composi&#xad;tion"/>
+  <word term="Engine" s="Eng."/>
+  <word term="Address" abbrev="Addr"/>
+  <word term="Comparator" d="Compar&#xad;ator"/>
+  <word term="Codewarrior" d="Code&#xad;Warrior"/>
+  <word term="installation" d="Install&#xad;ation"/>
+  <word term="Installation" d="Install&#xad;ation"/>
+  <word term="Infrastructure" d="Infra&#xad;structure"/>
+  <word term="Development" d="Develop&#xad;ment"/>
+  <word term="Diagnostics" d="Diagnos&#xad;tics"/>
+  <word term="Triggering" d="Trigger&#xad;ing"/>
+  	
+  	<word term="Command" abbrev="Cmd."/>
+  	<word term="Description" d="Descrip&#xad;tion"/>
+  	<word term="Transforms" d="Trans&#xad;forms"/>
+  	<word term="Messages" abbrev="Msgs"/>
+  	<word term="Mechanism" d="Mechan&#xad;ism"/>
+  	<word term="Backstepping" d="Back&#xad;stepping"/>
+  <word term="Monitoring" d="Monitor&#xad;ing"/>
+   <word term="Authentication" d="Authenti&#xad;cation"/> 
+   <word term="Authorisation" d="Authori&#xad;sation"/> 
+  	<word term="Enhancements" d="Enhance&#xad;ments"/>
+  	<word term="Pictographs" d="Picto&#xad;graphs"/>
+  	<word term="Thumbnail" d="Thumb&#xad;nail"/>
+  	<word term="Accelerator" d="Accel&#xad;erator"/>
+  	<word term="Landmarks" d="Land&#xad;marks"/>
+  	<word term="Camcorder" d="Cam&#xad;corder"/>
+  	<word term="Connected" d="Con&#xad;nected"/>
+  	<word term="Accelaration" d="Accelara&#xad;tion"/>
+  	<word term="Simulation" d="Simula&#xad;tion"/>
+  	<word term="Rendering" d="Render&#xad;ing"/>
+  	<word term="Loudmouth" d="Loud&#xad;mouth"/>
+  	<word term="NaviEngine" d="Navi&#xad;Engine"/>
+  	<word term="Baseport" d="Base&#xad;port"/>
+  	<word term="Controllers" d="Con&#xad;trollers"/>
+  	<word term="Performance" d="Perfor&#xad;mance"/>
+  	<word term="Generator" d="Gener&#xad;ator"/>
+  	<word term="Foundation" d="Found&#xad;ation"/>
+</dict>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/rsc/fshapes.xml	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<shapes xmlns:s="http://www.w3.org/2000/svg">
+<s:defs>
+    <s:style type="text/css">
+	svg.package-fixed text.lgd,  svg.package text.lgd,  
+	svg.package-fixed text.layer, 	svg.package text.layer
+	svg.package text.package, svg.package-fixed text.package {
+		font-size: 17px;
+		font-weight: normal
+	} 
+	#legend-box text.lgd {font-size: 4.233px}
+	
+	svg.collection-fixed text.lgd, svg.collection text.lgd, 
+	svg.collection-fixed text.layer,  svg.collection text.layer {
+		font-size: 12px;
+		font-weight: normal
+	} 
+	svg.collection-fixed	text.package {
+		font-size: 6px;
+		font-weight: normal;
+	}
+	svg.collection-fixed  #legend-box g.component use {stroke-width: 0.0882px;}
+	
+	text.title:lang(jp) {letter-spacing: -0.15}
+	#legend-box  text.lgd:lang(zh)  {
+		font-size: 3.5px!important;
+	}
+    </s:style>
+</s:defs>
+
+<patterns match="collection"> 
+	<overlay rule="count(component[@deprecated]) = count(component)" label="Contrib&#xad;uted as Depre&#xad;cated" count=" (1)" type="big-X"/>
+</patterns>
+
+    <styles match="collection" label="Contribution to Symbian Foundation">
+		<style rule="component[contains(@id,':')] and component[not(contains(@id,':'))]" label="Partial Contribu&#xad;tion">fill: white;stroke-width: 1.4!important; stroke-dasharray: 2,3</style>
+ 	  <style rule="component" label="Initial Contribu&#xad;tion">fill:#ddd</style>
+  </styles>
+  
+<colors default="grey" match="package" use="@tech-domain" label="Technology Domain">
+	<color color="tan" value="hb" label="OS Base Services" count=" (1)"/>
+	<color color="rgb(228,14,98)" value="se" label="Security" count=" (1)"/>
+	<color color="whitesmoke" value="lo" label="Location" count=" (1)"/>
+	<color color="darkkhaki" value="vc" label="Personal Communications" count=" (1)"/>
+	<color color="moccasin" value="dc" label="Data Communications" count=" (1)"/>
+	<color color="orchid" value="de" label="Device Connectivity" count=" (1)"/>
+	<color color="darkseagreen" value="dm" label="Device Management" count=" (1)"/>
+	<color color="lightpink" value="pr" label="Productivity" count=" (1)"/>
+	<color color="rgb(175,212,240)" value="mm" label="Multimedia" count=" (1)"/>
+	<color color="#ffff00" value="ma" label="Multimedia Apps" count=" (1)"/>
+	<color color="orange" value="ui" label="User Interface" count=" (1)"/>
+	<color color="slateblue" value="rt" label="Runtimes and Web" count=" (1)"/>
+	<color color="darkgray" value="to" label="Tools" count=" (1)"/>
+	<color color="#dd5" value="ocp" label="Operator Comple&#xad;mentary Packages" count=" (1)"/> 
+</colors> 
+</shapes>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/rsc/shapes.xml	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,99 @@
+<?xml version="1.0"?>
+<shapes xmlns:s="http://www.w3.org/2000/svg">
+
+	<borders label="Usage"> <!-- borders to use for component classes -->
+		<border type="box"/>
+		<border label="Imported Compo&#xad;nent" rule="unit/@prebuilt" type="hexagon"/>
+		<border rule="CLASS('plugin')" label="Plugin"  viewBox="0 0 20 20">
+			<s:path d="M 0 0 L 0 20 L 20 20 L 20 8 L 17.6 5.6 A 2.7 2.7 30 1 0 14.4 2.4 L12 0 z" stroke="black"/>
+		</border>
+		<border rule="CLASS('config')" type="box-clipAll" label="Config&#xad;uration"/>
+		<border rule="CLASS('doc')" type="box-clipRT" label="Document&#xad;ation"/>
+		<border rule="CLASS('api')" type="round" label="Inter&#xad;face"/>
+	</borders>
+
+	<!-- pattern sections are separate so mutiple ones can apply
+		The order in here is they order they are overlaid over the component -->
+	<patterns>
+		<overlay rule="not(unit)" label="Place&#xad;holder">
+			<s:radialGradient gradientUnits="userSpaceOnUse" cx="10" cy="10" r="14">
+				<s:stop offset="15%" stop-color="white" stop-opacity="0"/>
+				<s:stop offset="20%" stop-color="white" stop-opacity="0.75"/>
+				<s:stop offset="25%" stop-color="white" stop-opacity="0"/>
+				<s:stop offset="35%" stop-color="white" stop-opacity="0"/>
+				<s:stop offset="40%" stop-color="white" stop-opacity="0.75"/>
+				<s:stop offset="45%" stop-color="white" stop-opacity="0"/>
+				<s:stop offset="55%" stop-color="white" stop-opacity="0"/>
+				<s:stop offset="60%" stop-color="white" stop-opacity="0.75"/>
+				<s:stop offset="65%" stop-color="white" stop-opacity="0"/>
+			</s:radialGradient>
+		</overlay>
+	</patterns>
+
+	<patterns>
+		<overlay rule="@purpose='development'" type="striped-diag-up" label="Test"/>
+	</patterns>
+
+
+	<!-- use VERSION function rather than compare @deprecated and @introduced directly (it resolves equivalent version numbers, eg 9.4 = ^2 -->
+	<patterns>
+		<overlay rule="@deprecated and (VERSION(@deprecated) &lt;=  VERSION('^2'))" label="Depre&#xad;cated in ^2" count=" (1)">
+			<s:pattern patternUnits="userSpaceOnUse" x="0" y="0" width="100%" height="100%" viewBox="0 0 10 10">
+				<s:path d="M 1 1 L 9 9 M 1 9  L 9 1" stroke="yellow" stroke-width="0.7" stroke-linecap="round"/>
+			</s:pattern>
+		</overlay>
+		<overlay rule="VERSION(@deprecated)=VERSION('^3')" label="Depre&#xad;cated in ^3" count=" (1)">
+			<s:pattern patternUnits="userSpaceOnUse" x="0" y="0" width="100%" height="100%" viewBox="0 0 10 10">
+				<s:path d="M 1 1 L 9 9 M 1 9  L 9 1" stroke="blue" stroke-width="0.7" stroke-linecap="round"/>
+			</s:pattern>
+		</overlay>
+		<overlay rule="VERSION(@deprecated)=VERSION('^4') " label="Depre&#xad;cated in ^4" count=" (1)">
+			<s:pattern patternUnits="userSpaceOnUse" x="0" y="0" width="100%" height="100%" viewBox="0 0 10 10">
+				<s:path d="M 1 1 L 9 9 M 1 9  L 9 1" stroke="yellow" stroke-width="0.7" stroke-linecap="round"/>
+			</s:pattern>
+		</overlay>
+	</patterns>
+
+
+	<patterns>
+		<overlay rule="VERSION(@introduced) = VERSION('^2')" type="radial-grad" label="New in ^2" count=" (1)"/>
+		<overlay rule="VERSION(@introduced) = VERSION('^3')" label="New in ^3" count=" (1)">
+			<s:radialGradient gradientUnits="userSpaceOnUse" cx="10" cy="10" r="14">
+				<s:stop offset="0%" stop-color="yellow" stop-opacity="1"/>
+				<s:stop offset="85%" stop-opacity="0" stop-color="white" />
+				<s:stop offset="100%" stop-opacity="0" stop-color="white" />
+			</s:radialGradient>
+		</overlay>
+		<overlay rule="VERSION(@introduced) = VERSION('^4')" label="New in ^4" count=" (1)">
+			<s:radialGradient gradientUnits="userSpaceOnUse" cx="10" cy="10" r="14">
+				<s:stop offset="0%" stop-color="rgb(180  52 255)" stop-opacity="1"/>
+				<s:stop offset="85%" stop-opacity="0" stop-color="white" />
+				<s:stop offset="100%" stop-opacity="0" stop-color="white" />
+			</s:radialGradient>
+		</overlay>
+	</patterns>
+
+	<styles show-unused="yes">
+		<style>stroke-width: 0.5</style>
+		<style rule="@purpose='mandatory'" label="Mandatory Compo&#xad;nent">stroke-width: 2</style>
+	</styles>
+
+	<!-- Foundation tech domain colours -->
+	<colors default="grey" match="package" use="@tech-domain" label="Technology Domain">
+		<color color="tan" value="hb" label="OS Base Services" count=" (1)"/>
+		<color color="rgb(228,14,98)" value="se" label="Security" count=" (1)"/>
+
+		<color color="whitesmoke" value="lo" label="Location" count=" (1)"/>
+		<color color="darkkhaki" value="vc" label="Personal Communications" count=" (1)"/>
+		<color color="moccasin" value="dc" label="Data Communications" count=" (1)"/>
+		<color color="orchid" value="de" label="Device Connectivity" count=" (1)"/>
+		<color color="darkseagreen" value="dm" label="Device Management" count=" (1)"/>
+		<color color="lightpink" value="pr" label="Productivity" count=" (1)"/>
+		<color color="rgb(175,212,240)" value="mm" label="Multimedia" count=" (1)"/>
+		<color color="#ffff00" value="ma" label="Multimedia Apps" count=" (1)"/>
+
+		<color color="orange" value="ui" label="User Interface" count=" (1)"/>
+		<color color="slateblue" value="rt" label="Runtimes and Web" count=" (1)"/>
+		<color color="darkgray" value="to" label="Tools" count=" (1)"/>
+	</colors>
+</shapes>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/SysModelGen.pm	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,1372 @@
+# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# Package:      SysModelGen
+# Build an SVG System Model diagram
+# 
+#
+
+package SysModelGen;
+
+use Cwd;
+use Cwd 'abs_path';
+use File::Copy;
+use File::Path;
+use FindBin;
+use lib $FindBin::Bin."/../common";
+use Getopt::Long qw(:config no_ignore_case);
+use File::Basename;
+use File::Spec;
+use Logger;
+use Env qw(@PATH);
+use Env qw(@PATHEXT);
+use Env qw(@CLASSPATH);
+use strict;
+
+my @Filters;
+
+
+use constant KSystemModelGenerator							=> 201;
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   new
+# Purpose:      
+# Input:        None (extracted from command line args)
+# Output:       A reference to itself
+#-------------------------------------------------------------------------------------------------
+sub new
+	{
+    my $package = shift;
+    my $self = {};              # Create reference to object
+    bless $self,  $package;    # Associate a reference with class name
+    
+	my $dataroot =&SystemModelXmlDataDir();
+	my @yr = gmtime();
+	my %Args = (
+	'iHelp'						=> {'param' => "h",
+		 'desc' => 'Help on usage'}, 
+	'iIniFile'					=> { 'param' => "i=s", 'type'=>'file',
+		'desc' => 'An INI file listing one argument per line, with the syntax: <argument> = <value>. Command line arguments will override ini file settings.' }, 
+	'iDiagram'				=> { 'param' => "output=s" , default=>"sysmodel.svg",'type'=>'outfile',
+		 'class' => 'Build Control', 'desc' => 'The name of the file to save the built System Model SVG. If in the format filename.svgz, it will attempt to compress the file. If compression is not supported, it will rename the output to filename.svg. Defaults to sysmodel.svg or sysmodel.svgz if -compress is set.'},
+	'iOutputCsv'				=> { 'param' => "csv_output=s" , 'type'=>'outfile',
+		 'class' => 'Build Control', 'desc' => 	'The name of the file to save a CSV description of the built System Model. Only items shown on the system model will be included.'},
+	'iCsvColumns'				=> { 'param' => "csv_columns=s" , 'type'=>'outfile',
+		 'class' => 'Build Control', 'desc' => 	'Comma-separated list of columns to include in the output CSV.  This does nothing if -csv_output is not present. By default (if -csv_columns is not present), the columns will be a sorted list of all attributes on all items. '},
+	'iCsvLabels'				=> { 'param' => "csv_labels=s" , 'type'=>'outfile',
+		 'class' => 'Build Control', 'desc' => 	'Comma-separated list of columns labels include in the output CSV.  Do not use quotes or commas in label names. This does nothing if -csv_output is not present. If this list is shorter than -csv_columns, the remaining columns will use the attribute name as the label. '},
+	'iOutputXml'				=> { 'param' => 'xml_output=s' ,'type'=>'outfile',
+		 'class' => 'Build Control', 'desc' => 'The name of the file to save a combined system definition XML. Only items shown in the built system model will be included.'},
+	'iWarningLevel'					=> { 'param' => "w=s", 'type' => 'number',
+		'class' =>'Build Control', 'desc' =>  'Warning level. 1: errors only (default), 2: warnings as well as errors, 3: info messages, warnings and errors, 4: all plus deep syntax validation and reporting -- note that this can take a long time to compute so do not use this warning level by default'},
+	'iLowMem'					=> { 'param' => "lowmem",
+		'class' =>'Build Control', 'desc' =>  'Build the model storing more data in the temp directory and using less runtime memory. If building fails due to an out of memory condition, try running again with the -lowmem option.'},
+	"iClean"				=> { 'param' => 'clean' ,
+		'class' => 'Build Control',  'desc' =>'Caution: if set,  it will delete the contents of the temporary directory.'},
+	'iCompress'				=> { 'param' => "compress", 
+		 'class' => 'Build Control', 'desc' => 	'If set, it will attempt to compress the output as an SVGZ file. In order to success gzip must be installed and in the PATH. This will also rename the output file from filename.svg to filename.svgz.'},
+	'iTemporaryDirectory'				=> { 'param' => "tempdir=s", 'default' => 'drawsvg_temp','type'=>'dir',
+		 'class' => 'Build Control', 'desc' =>  'Temporary directory for build files.'},
+	'iLogFile'				=> { 'param' => "log=s", 'type'=>'outfile',
+		'class' => 'Build Control', 'desc' =>  'File in which to store output. Defaults to stdout'},
+	'iModel'				=> { 'param' => "model=s" ,'type'=>'file/uri', 'default' => "$dataroot/ModelTemplate.xml",
+		'class' => 'Files or URIs', 'desc' => 'The location of the Model XML file to use to build the file. Content of this file will be overridden by anything set on the command line on in an ini file'},
+	'iSysDefFile'				=> { 'param' => "sysdef=s",  'multi' => 1,'type'=>'file/uri', 'xpath' => '/model/sysdef',
+		 'class' => 'Model Control', 'desc' =>  'The System Definition XML file(s) used to build the model.'},
+	"iSourceRoot"			=> {'param'=>'srcvar=s' ,'multi' => 1,
+		 'class' =>  'Model Control'},
+	'iPathPrefix'				=> {'param' => 'sysdef-prefix=s',   'multi' => 1, 'class' =>  'Model Control','type'=>'file/uri',},
+	"iSysDefPath"			=> {'param' => "sysdef-path=s",  'multi' => 1,'type'=>'path',
+		 'class' => 'Model Control', 'desc' =>  'The directory which the system definition file should be considered to be in when turning unit\'s relative links into absolute paths. This is only necessary to provide if the result requires the absolute paths to be meaningful. The order of this parameter must match the order of the -sysdef parameter'},
+	'iShapes'				=> { 'param' => "shapes=s", 'xpath' => '/model/@shapes','type'=>'file/uri',
+		 'class' => 'Files or URIs', 'desc' => 'The location of the Shapes XML file used to provide rules to control  the display of the system model items. If not present, default behaviour  (in Shapes.xml) is used. This and the default bahaviours are overrriden by  using the -color, -border, -pattern, and -style options. '},
+	'iLink'				=> { 'param' => "link=s",  'xpath' => '/model/@link',
+		 'class' => 'Files or URIs', 'desc' => 'The base URL to use for all hyperlinks in the model. A base URL will be appended by the type and name (e.g. Blocks/Comms%20Services.html) of the items to create the full URL of the linked file. Window directories will be converted into file URIs.'},
+	'iLinkExpr'				=> { 'param' => "link-expr=s",   'multi' => 1, 'xpath' => 'model/link',
+		 'class' => 'Model Control', 'desc' => 'The link used on any system model item. Any values within {...} are evaluled as an expression on the item. All xpath locations in the expresion must be set otherwise the link will not be created for the item'},
+	'iName'			=> { 'param' => "system_name=s" ,  'xpath' => '/model/@name',
+		  'class' => "Labels", 'desc' =>'The name of the product described in the model. It appears at  the bottom right.'},
+	'iRelease'		=> { 'param' => "system_version=s" , 'xpath' => '/model/@ver',
+		  'class' =>"Labels", 'desc' =>'The version of the product described in the model. It appears  at the bottom right after the name.'},
+	'iLabel'			=> { 'param' => "model_name=s" ,  'xpath' => '/model/@label',
+		  'class' =>"Labels", 'desc' =>'The label for the model. It appears at the bottom right,  under the name.'},
+	'iRevision'		=> { 'param' => "model_version=s",  'xpath' => '/model/@revision',
+		'class' =>"Labels", 'desc' =>'A number which appears before the model-revision-type.   If specified this overrides the build number used by depmodel.  If not building depmodel, this defaults to "1"'},
+	'iRevisionType'	=> { 'param' => "model_version_type=s",   'xpath' => '/model/@revision-type',
+		 'class' =>"Labels", 'desc' =>'One of "draft", "issued", "build", "date" or free-text value. Appears below the model label. If specified this overrides the build number used by DepToolkit.If not building depmodel, this defaults to "draft"'},
+	'iCopyright'			=> { 'param' => "copyright=s", 'default' => (1900+$yr[5])." Nokia Corporation",  'xpath' => '/model/@copyright',
+		 'class' =>"Labels", 'desc' =>'The copyright to appear in the lower left. Set to empty string to leave out.'},
+	'iDistribution'		=> { 'param' => "distribution=s",   'xpath' => '/model/@distribution',
+		 'class' => "Labels", 'desc' =>'Text to appear on the bottom centre to indicate to whom the  model can be shown. Informational only. Suggested values are "internal", "secret" or "unrestrictred". Not shown if not set.'},
+	'iLgdTitle'		=> { 'param' => "legend_title=s",  'xpath' => '/model/layout/legend/@label',
+		'class' =>"Labels", 'desc' =>'The title to appear in the leftmost part of the legend.'},
+	'iLgdFloat'		=> { 'param' => "legend_float=s",  'xpath' => '/model/layout/legend/@float', 'type' => 'boolean',
+		'class' =>"Model Control", 'desc' =>'If set, the legend will appear when the mouse hovers over the bottom of the window. The floating legend will span the full width of the window. This may not be readable, depending on the amonent of content in the legend.'},
+	'iCoreOs'				=> { 'param' => "coreos=s", 'type' => 'on/off/new',
+		 'class' =>'Model Control', 'desc' => 'Turn on or off Core OS colouring for 9.4 and later models -- For backwards compatibility only! Use "on" for Symbian OS 9.4 models and "new" for Symbian OS 9.5 and later models (non-Foundation)'},
+
+	'iExtra'				=> { 'multi' => 1, 'param' => "sysinfo=s",'type'=>'file/uri',  info=>'extra',  'xpath' => '/model/sysdef',
+		 'class' => 'Files or URIs', 'desc' =>  'The location of extra component information used to provided additional  properies for components.  By default,  the provided "SystemInfo.xml" is used.'},
+	'iLocalize'			=> {  'multi' => 1, 'param' => "localize=s", 'xpath' => '/model/layout','type'=>'file/uri',  info=>'abbrev',
+		 'class' => 'Files or URIs', 'desc' => 'The location of the Localization file used to provide displayable names for the model entities.'},
+	'iDict'			=> { 'param' => "dictionary=s", 'type'=>'file/uri', 
+		 'class' => 'Build Control', 'desc' => 'A term dictionary file used to semi-intelligently generate the abbreviations for the names of system model entries. Anything mentioned in the Localization files overrides generated abbreviations.'},
+	'iS12'				=>  { 'multi' => 1, 'param' => "s12=s",'type'=>'file/uri' , info=>'s12', 'xpath' => '/model/sysdef',
+		'depr' => "Only works on 2.0 syntax and older models",
+		 'class' => 'Files or URIs', 'desc' =>  'The location of the Schedule 12 XML file used to provide the border shapres of the components. If this a directory, the S12 XML file is found by appending "Symbian_OS_v[system_version]_Schedule12.xml" to the directory.'},
+	'iLevels'				=> {  'multi' => 1, 'param' => "levels=s",'type'=>'file/uri' , info=>'levels', 'xpath' => '/model/sysdef',
+		'depr' => "Only works on 2.0 syntax and older models. Use info file instead",
+		'class' =>'Files or URIs', 'desc' => 'The location of the Levels XML file used to override the  stacking of collections. '},
+	'iDepsFile'				=> { 'multi' => 1, 'param' => "deps=s",  'xpath' => '/model/sysdef','type'=>'file/uri',  info=>'extra', 
+		'class' => 'Files or URIs', 'desc' =>  'The location of a sysinfo file containing Dependencies.  If not present, dependencies will not be drawn'},
+
+	'iColor'				=> {  'multi' => 1, 'param' => "color=s", 'xpath' => '/model/layout','type'=>'file/uri', 'info'=>'color',
+		 'class' =>'Files or URIs', 'desc' =>  'The location of a Values XML file used to specify per-component colours. If not present, the default colours are used.'},
+	'iBorder'		=> {  'multi' => 1, 'param' => "border-shape=s", 'xpath' => '/model/layout','type'=>'file/uri','info'=>'border',
+		 'class' =>'Files or URIs', 'desc' => 'The location of a Values XML file used to specify the shape (border)  of each component. If not present, the default borders are used.'},
+	'iOverlay'				=> { 'multi' => 1, 'param' => "pattern=s", 'xpath' => '/model/layout','type'=>'file/uri','info'=>'overlay',
+		 'class' => 'Files or URIs', 'desc' =>  'The location of a Values XML file used to specify per-component overlay patterns. If not present, the default patterns (for new  and reference components) are used.'},
+	'iStyle'		=> { 'multi' => 1, 'param' => "border-style=s", 'xpath' => '/model/layout','type'=>'file/uri','info'=>'style',
+		 'class' => 'Files or URIs', 'desc' =>  'The location of a Values XML file used to specify per-component border  styles. If not present, the default border styles are used. '},
+
+	'iFilter'				=>{ 'type' => 'filter-name', 'multi' => 1, 'param' => "filter=s",
+		'depr' => "Only works on 2.0 syntax and older models",
+		 'class' =>'Model Control', 'desc' => 'The name of a filter to turn on when building the model.  All filters on an item must be present in this list in order for that item to appear. Can have any number of these Defaults to "java" and "gt"'},
+	'iFilterHas'			=>{ 'type' => 'filter-name', 'ordered' => 1,'param' => "filter-has=s",
+		'class' => 'Model Control', 'desc' =>'Like -filter, except any filter on an item must be present in this list in order for that item to appear. Include "*" in the list in order to show items with no filters. Equivalent to "-show-attr filter xxx"'},
+	'iShow'			=> {  'type' =>  'attr[=val]',  'ordered' => 1,'param' => "show-attr=s",
+		'class' =>'Model Control', 'desc' => 'A mechanism of filtering which allows filtering based on component attribute values. If a value is set for that attribute, the component will be shown. Use in conjunction with -hide-attr for fine contol of what is shown. "class" and "filter" attribtues are handled specially -- see the documentation for details'},
+	'iHide'			=> { 'type' =>  'attr[=val]', 'ordered' => 1,'param' => "hide-attr=s",
+		 'class' =>'Model Control', 'desc' => 'A mechanism of filtering which allows filtering based on component attribute values. If a value is set for that attribute, the component will not be shown on the model. Use in conjunction with -show-attr for fine contol of what is shown. "class" and "filter" attribtues are handled specially -- see the documentation for details'},
+	'iIgnore'				=> { 'type' => 'item', 'multi' => 1, 'param' => "ignore=s", 'xpath' => '/model/ignore',
+		 'class' =>'Model Control', 'desc' => 'The ID of a model entity to not draw. Any number of these can be used'},
+	'iIgnoreMeta'				=> { 'type' => 'item', 'multi' => 1, 'param' => "ignore-meta=s", 'xpath' => '/model/ignore',
+		 'class' =>'Model Control', 'desc' => 'The "rel" meta value to ignore. Takes the form of [relvalue] or [relvalue]:[type]. Any number of these can be used'},
+
+	'iNavCtrl'				=>{'param' => "navctrl=s" , 'type'=>'boolean' , 'xpath' => '/model/layout/@navctrl',
+		'class' =>'Model Control', 'desc' => 'If set, a navigation control widget will appear in the upper left corner of the model. The control might not work on some SVG viewers.'},
+	'iDetail'				=>{'param' => "detail=s", 'type' =>  'item-type' ,  'xpath' => '/model/layout/@detail',
+		'class' =>'Model Control', 'desc' => 'The type of the smallest System Model entity to draw. One of "layer", "package", "collection" or "component".  Defaults to "component"'},
+	'iLevelDetail'				=>{'param' => "level-detail=s", 'type' =>  'show/hide' ,  'xpath' => '/model/layout/@levels',
+		'class' =>'Model Control', 'desc' => 'Toggles display of level names on packages or layers. A value of "show" will display level names inside either layers (at "layer" level of detail only) or packages (at "package" level of detail only). A value of "hide" (default) will not show any level names.'},
+	'iDetailType'				=> { 'param' => "detail-type=s", 'type' => 'type' , 'xpath' => '/model/layout/@detail-type',
+		'class' =>'Model Control', 'desc' => 'If set to "fixed", the smallest System Model entity drawn will have a fixed with (rather then sized by their invisible components). This can be used to reduce the size and complexity of the overall model.'},
+	'iPlaceholderDetail'				=> { 'param' => "placeholder=s", 'type' => 'item-type' , 'xpath' => '/model/layout/@placeholder-detail',
+		'class' =>'Model Control', 'desc' => 'The type of the smallest *empty* System Model entity to draw. One of "layer", "package", "collection" or "component".  For example, if set to "package" empty layers and packages will be drawn, but empty collections will be ignored. If not set, no empty items will be drawn.'},
+	'iPageWidth'			=>{'param' => "page-width=s", 'type' =>  'length', 'xpath' => '/model/layout/@page-width', 
+		'depr' => "Only works on 2.0 syntax and older models",
+		 'class' =>'Model Control', 'desc' => 'The width of the drawn image (with units). If not specified it will fit the viewer window. Valid units: "in", "mm", "cm", "px", "pt"'},
+	'iStatic'				=> { 'param' => "static=s", 'type' => 'boolean', 'xpath' => '/model/layout/@static',
+		'class' =>'Model Control', 'desc' => 'If present, the model will not have any mouseover effects (this is  overriden by builing the depmodel).'},
+	'iPrintResolution'				=>{ 'param' => "dpi=s", 'type' =>  'number', 'xpath' => '/model/layout/@resolution',
+		'class' =>'Model Control', 'desc' => 'The DPI to use when printing from the Adobe SVG Viewer. If not present, it will print well at A4 size. A value of 300 will look good on A3 size paper'},
+	'iModelFont'				=>{'param' => "model_font=s", 'type' =>'font', 'xpath' => '/model/layout/@font',
+		'class' =>'Model Control', 'desc' => 'The name of the base font to use to draw the model. This will be overriden by any custom CSS in the Shapes XML'},
+	'iVersions'			=>  { 'param' => "version-list=s", 
+		 'class' =>'Model Control'},
+	'iLogoSrc'				=>{ 'param' => "logo=s",  'type'=>'file/uri', 'xpath' => '/model/layout/logo/@src',
+		 'class' => 'Model Control', 'desc' => 'If present, the logo will be drawn in the lower-left corner of the model. If the logo is an SVG file, -logo-width and -logo-height are optional, otherwise the must both be specified'},
+	'iLogoEmbed'				=>{ 'xpath' => '/model/layout/logo/@embed',	 'class' => 'Model Control' },
+	'iLogoHeight'				=> { 'param' => "logo-height=s", 'type' =>   'length', 'xpath' => '/model/layout/logo/@height',
+		 'class' =>'Model Control', 'desc' => 'Specifies the height of the logo (if any) in mm. Width is scaled along with height unless otherwise specified. Both width and height MUST be specified if a bitmap image is used'},
+	'iLogoWidth'				=> { 'param' => "logo-width=s", 'type' =>  'length', 'xpath' => '/model/layout/logo/@width',
+		 'class' =>'Model Control', 'desc' => 'Specifies the width of the logo (if any) in mm. Height is scaled along with width unless otherwise specified. Both width and height MUST be specified if a bitmap image is used'},
+	'iLegendWidth'			=>{ 'param' => "legend-width=s", 'type' =>  '%', 'xpath' => '/model/layout/legend/@width',
+		 'class' => 'Model Control', 'desc' =>'The percent width of the model the legend takes up. This will scale the size of the legend and model title, but not the logo, to fill the specified space. If a logo is included, but no width specified, the legend cannot be scaled since it will not be able to determine the available space. Note that that -max-legend-scale will further limit the potential width.'},
+	'iLegendMaxScale'			=>{ 'param' => "legend-max-scale=s", 'type' =>   'scale',   'xpath' => '/model/layout/legend/@maxscale',
+		'class' => 'Model Control', 'desc' =>'Specifies the maximum scale factor for resizing the legend. If this is present and -legend-width is not, the legend and title will scale to 100% of the available width. If both are present the scale factor will take precedent. If neither is present, the legend will not resize. Note that when this is used, the legend can shrink if it would normally be wider than the model.'},
+	'iTitleScale'			=> { 'param' => "title-scale=s", 'type' =>  'scale',  'xpath' => '/model/layout/legend/@title-scale',
+		 'class' => 'Model Control', 'desc' =>'Specifies the scale factor for the size of the title font (the text in the lower right). Use this instead of CSS to control the size, since the model generator needs to explicitly know how much space to allocate for the title.'},
+	'iXsltParam'			=>{  'multi' => 2, 'param' => "xslt-param=s",
+		 'class' =>'Build Control', 'desc' => 'Advanced: Parameters to feed directly to the XSLT transforms'},
+	'iLegendNote'			=>{  'multi' => 1, 'param' => "note=s", 'xpath' => '/model/layout/legend/note',
+		 'class' => 'Labels', 'desc' => 'Free text to appear inside the legend box, on the rightmost side. If multiple ones are provided, they will appear as separate boxes from left to right. Newlines and other special characters can be entity-encoded (e.g. &#xa;). When using entities in an INI file, you *must* quote the value, otherwise the # will be treated as a comment delimiter.',}
+				);
+
+	$self->{iArgs} = \%Args;
+
+    
+    # basic test of command line:
+    if (scalar(@ARGV) == 0)
+    	{
+		$self->Help();
+		exit Logger::KErrorNone;	# nothing to do. Leave
+    	}
+    
+    # process the input:
+    $self->ParseCommandLineOptions();
+    
+    $self->{iReturnCode} = Logger::KErrorNone;
+    return $self;
+	}
+
+
+sub ParseCommandLineOptions()
+	{
+	my $self = shift;
+
+	my %opt;
+	while(my ($n,$b) = each %{$self->{iArgs}} )
+		{
+		if(!$b->{'param'}) {next}  # not a command line arg
+		my @ps = ($b->{'param'});
+		($ps[1]=$ps[0]) =~ tr/_-/-_/;
+		if($ps[1] eq $ps[0]) {shift(@ps)}
+		foreach my $p (@ps)
+			{ 
+			if($b->{'multi'}==1)
+				{
+				$opt{$p} = \@{$self->{$n}};
+				} 
+			elsif($b->{'multi'}==2)
+				{
+				$opt{$p} = \%{$self->{$n}};
+				} 
+			elsif($b->{'ordered'})
+				{
+				$opt{$p} = \&OrderedOption;
+				} 
+			else
+				{
+				$opt{$p} = \$self->{$n};
+				}
+			}
+		}
+
+	foreach (@ARGV) {
+		# some MS products replace "-" with en-dash in an effort to be "intelligent". 
+		# This replaces all leading en-dashes in the command line with "-" 
+		# There is a small risk that the en-dash is intentional and this will clobber it. 
+		s/^\x96/-/; 
+	}
+
+	GetOptions(%opt);
+
+	if ($self->{'iHelp'})
+	    {
+	   	$self->Help();
+	   	exit Logger::KErrorNone;
+	   	}
+
+	# set read files to absolute paths
+	my $dir  = cwd;
+	
+	while(my ($n,$b) = each %{$self->{iArgs}} )
+		{
+		my $type =$b->{'type'};
+		if( $type eq 'file'  or $type eq 'dir' or $type eq 'file/uri')
+			{
+			if($self->{$n} eq '') {next} # no value, so do nothing
+			if ($b->{'multi'} == 1)
+				{
+				foreach my $v (@{$self->{$n}})
+					{
+				 	$v =&fixFile($type,$dir,$v);
+					}
+				} 
+			elsif ($b->{'multi'} == 2)
+				{
+				while(my ($var,$val)=each (%{$self->{$n}}))
+					{
+				 	$self->{$n}->{$var}=&fixFile($type,$dir,$val);
+					}
+				}
+			else
+				{
+			 	$self->{$n}  = &fixFile($type,$dir,$self->{$n} );
+				}
+			}
+		}	
+
+
+	@{$self->{'iFiltering'}} = @Filters;
+	@Filters=();
+	my $i=0;
+	for($i=0;$i<=$#ARGV;$i++)
+		{ # check remaining args to ensure they are valid
+			if($ARGV[$i]=~/^(http|file):\/\//) { # assume URLs are correct
+				next;			
+				}
+			if($ARGV[$i] eq "-" || $ARGV[$i] eq "") 
+				{ #special values to use nothing or use the tmp file, but only valid for odd numbered args
+				if($i%2==1) {next}
+				$self->HelpBase();
+				&Logger::LogFatal("Invalid syntax", KSystemModelGenerator, 0,Logger::KIncorrectSyntax);
+				}
+			if(!(-e $ARGV[$i])) {
+				$self->HelpBase();
+				&Logger::LogFatal("file $ARGV[$i] does not exist", KSystemModelGenerator, 0,Logger::KFileDoesNotExist);
+			}
+		}
+	$self->ReadIniFile();
+	
+	if($self->{'iDetail'}) 
+		{	# for ease of BC with ini files
+		$self->{'iDetail'} =~  s/^(block|subblock|logical(sub)?set)$/package/ ||
+		$self->{'iDetail'} =~  s/^(module)$/collection/;
+		}
+	
+
+	while(my ($n,$b) = each %{$self->{iArgs}} ) # set defaults
+		{
+		if($b->{'default'} and !defined $self->{$n})
+			{
+			$self->{$n} =$b->{'default'};
+			}
+		if($b->{'type'} eq 'boolean' and (defined $self->{$n}))
+			{ #set booleans to true/false
+			if($self->{$n} == 1 or $self->{$n} =~/^(yes|on|true|y)$/i)
+				{
+				$self->{$n} = 'true';
+				} 
+			else
+				{
+				$self->{$n} = 'false';
+				}
+			}	
+		}
+
+	# computed defaults:
+
+	# if saving to .svgz, try to compress
+	$self->{iCompress} = $self->{iCompress} || ( $self->{iDiagram} =~ /\.svgz$/i );
+
+	if($self->{'iLogoSrc'} =~ /\.svg$/i)	# embed SVG logos only
+		{
+		$self->{'iLogoEmbed'}= "yes";
+		}
+
+	if(defined $self->{iCoreOs} and  ($self->{'iModel'} eq $self->{'iArgs'}->{'iModel'}->{'default'}))
+		{
+		my $dataroot =&SystemModelXmlDataDir();
+		if($self->{iCoreOs}=~/(on|yes|true)$/i )
+			{
+			$self->{'iModel'} = "$dataroot/ModelTemplate.94.xml",
+			}
+		elsif($self->{iCoreOs}=~/(off|no|false)$/i )
+			{
+			$self->{'iModel'} = "$dataroot/ModelTemplate.xml",
+			}
+		elsif(! ($self->{iCoreOs}=~/^[0-9]+$/ ))	# any other non-number
+			{
+			$self->{'iModel'} = "$dataroot/ModelTemplate.95.xml",
+			}
+		}
+
+
+	$self->{iTemporaryDirectory} =  &fixFile('dir', cwd,$self->{iTemporaryDirectory} ); # now gives the full path name $self->{iTemporaryDirectory}
+
+	mkpath $self->{iTemporaryDirectory} if ! -d $self->{iTemporaryDirectory};
+
+	# set the log file if needed:
+	$Logger::LOGFILE = $self->{iLogFile} if $self->{iLogFile};
+
+	# set the correct warning level:
+	#  -w=1: errors only (default)
+	#  -w=2: warnings as well as errors
+	#  -w=3: info messages, warnings and errors.
+	if (defined $self->{iWarningLevel} and $self->{iWarningLevel} > 1)
+		{
+		if ($self->{iWarningLevel} == 2)
+			{
+			$self->{iWarningLevel} = LogItem::WARNING;
+			}
+		elsif ($self->{iWarningLevel} == 3)
+			{
+			$self->{iWarningLevel} = LogItem::INFO;
+			}
+		else # for anything higher than set it to LogItem::VERBOSE
+			{
+			$self->{iWarningLevel} = LogItem::VERBOSE;
+			}
+		} 
+	else
+		{
+		$self->{iWarningLevel} = LogItem::ERROR;
+		}
+	# set the logger up:
+	$Logger::SEVERITY = $self->{iWarningLevel};
+
+	#determine the XSLT Processor we need to use
+	$self->{'iXslt'} = XsltProcessor();
+
+	}
+
+sub OrderedOption() {
+	my $var = shift;
+	my $val = shift;
+	if($var=~/^(show|hide)-attr$/) {
+		my $f = "<filter xmlns='' display='$1' ";
+		if($val=~s/^([^=]+)=//) {$f.="select='$1' value='$val'/>"}
+		else {$f.="select='$val'/>"}
+		push(@Filters,$f);
+	} elsif($var eq 'filter-has' && $val eq '*') {
+		push(@Filters,"<filter xmlns='' display='show' select='*'/>");
+	}elsif($var eq 'filter-has') {
+		if(!scalar(@Filters)) { # if the 1st is showing a filter than that implies everythig without a filter is turned off 
+			push(@Filters,'<filter xmlns="" select="*" display="hide"/>');
+		}
+		foreach my $v (split(/,/,$val)) {
+			push(@Filters,"<filter xmlns='' display='show' select='filter' value='$v'/>");
+		}
+	}
+}
+
+
+sub fixFile {
+	my $type = shift;
+	my $dir = shift;
+	my $val = shift;
+	if($val eq '') {return}
+ 	$val  = &FullPath("$dir/",	$val );
+	if($type eq 'file/uri') { $val =&FileAsUrl($val)}
+	return $val;
+}
+
+
+sub FullPath {
+	my $root = shift;
+	my $file = shift;
+	
+	# If the file is not specified then return null
+	if (!$file) {
+		return;
+	}
+	
+	
+	# If the file is a URL or Windows path then return it as is
+	if ($file =~ /:/) {
+		return $file;
+	}
+
+	# If the file is a windows remote path then return it as is
+	if ($file =~ /\\\\/ || $file =~ /\/\//) {
+		return $file;
+	}
+	
+	if ($root && !-e $root) {
+		&Logger::LogFatal("root$root does not exist");
+	}
+	
+	if (-f $root) {
+		$root = File::Basename::dirname($root)
+	}
+
+	# if root is empty or the same dir, then file is relative
+	if($root eq '' or $root eq '.') {
+		return $file;
+	}	
+	
+	# If the file is relative from the root then we want to add the drive letter to the file (if one exists)
+	if ($file =~ s/^[\\\/]// ) {
+		if ($root =~ /^([a-z]:)/i) {
+			return File::Spec->catdir($1, $file);
+		} else {	# it's a unix path, put the / back on
+			return "/$file";
+		}
+	}
+	
+	# Return the concatenated root and filename
+	return File::Spec->catdir($root, $file);
+}
+
+
+sub ReadIniFile()
+	{
+	my $self = shift;
+	my %setHere;
+	return if ! defined $self->{iIniFile};
+	
+	# Log a fatal error if the ini file is defined but doesn't exist:
+	&Logger::LogFatal("ini file does not exist\"$self->{iIniFile}\": $!", KSystemModelGenerator) if ! -e $self->{iIniFile};
+	
+	open(INI, $self->{iIniFile}) or 
+		&Logger::LogFatal("Could not open the ini file \"$self->{iIniFile}\": $!", KSystemModelGenerator);
+	
+	&Logger::LogInfo("Reading ini file \"$self->{iIniFile}...", KSystemModelGenerator);
+	
+
+	my %IniMap;		# map from ini var to internal var
+	foreach my $a (keys %{$self->{'iArgs'}})  {
+		my $v = $self->{'iArgs'}->{$a}->{'param'};
+		$v=~s/=.*//;
+		$IniMap{$v}=$a;
+		$v=~tr/-_/_-/;		# allow both model_name and model-name
+		$IniMap{$v}=$a;
+	}
+
+	my $iniDir = $self->{iIniFile};
+	$iniDir =~ s,[^\\//]+$,,;
+	#$iniDir .= '\\';
+
+	foreach my $line (<INI>)
+		{
+		$line =~ s/^\s*//; 		# remove spaces
+		$line =~ s/\s*$//;		# a/a
+		$line =~ s/\n$//; 		# remove new line
+		if($line =~/"/) {
+			$line =~ s/^(([^"#]*"[^"]*")+)#.*$/$1/; 		# remove comments indicated by # (to the end of the line)
+		}  else {
+			$line =~ s/#.*$//; 		# remove comments indicated by # (to the end of the line)
+		}
+		next if $line eq ""; 	# ignore blank lines
+		if ($line =~ m/([^=]+)\s*=\s*(.*)/)
+			{
+			my $argType = lc $1; 	# case-insensitive
+			my $argValue = $2; 		# case-sensitive as it can have strings intended for html output
+						
+			$argType =~ s/^\s*//; # remove spaces on either end (Cannot use s/\s+// as this will not be suitable for html text)
+			$argType =~ s/\s*$//;
+			$argValue =~ s/^\s*//;
+			$argValue =~ s/\s*$//;
+			
+			$argValue =~ s/^'//; # no need for quotes around the values
+			$argValue =~ s/'$//;
+			$argValue =~ s/^"//;
+			$argValue =~ s/"$//;
+
+			if(!defined $IniMap{$argType}) {next}
+			my $param = $IniMap{$argType};
+			if($self->{'iArgs'}->{$param}->{'ordered'}) {
+				&OrderedOption($argType, $argValue);
+			} else {
+				my $type = $self->{'iArgs'}->{$param}->{'type'};
+				# make sure all files mentioned are taken relative to the ini file
+				if($type eq 'file'  or $type eq 'outfile' or $type eq 'dir' or $type eq 'file/uri')
+					{
+					$argValue =&fixFile($type,$iniDir,$argValue);
+					}
+
+				# do not override! Only set values that have not been set on command line already
+
+				if ($self->{'iArgs'}->{$param}->{'multi'} == 1) {
+					if(scalar(@{$self->{$param}})==0 || $setHere{$param}) {
+				 		push(@{$self->{$param}}, $argValue) ;
+						$setHere{$param}=1;
+					}
+				} elsif ($self->{'iArgs'}->{$param}->{'multi'} == 2) {
+					$argValue=~s/^([^=]+)=//;
+					if(scalar(%{$self->{$param}})==0 || $setHere{$param}) {
+				 		$self->{$param}->{$1}=$argValue;
+						$setHere{$param} = 1;
+					}
+				} else 
+					{
+				 	$self->{$param} = $argValue if ! $self->{$param}; 
+					}
+				}
+			}
+		}
+
+	close(INI);
+	@{$self->{'iFiltering'}} = @Filters if ! @{$self->{'iFiltering'}}; 
+	@Filters=();
+	}
+
+sub getModel()
+	{
+	my $self = shift;
+
+	my $tempDirectoryPathname = $self->{iTemporaryDirectory};
+	my $modelXml = "$tempDirectoryPathname/Model.xml";
+
+	if(defined $self->{'iModelCreated'}) {return $modelXml}
+
+	my $needsMod=0;
+	# the following needs a bit of work
+	foreach my $param (keys %{$self->{'iArgs'}})  {
+		if (! ($self->{'iArgs'}->{$param}->{'class'} =~ /^(Build Control|)$/ ))
+			{
+			if ($self->IsSet($param)) {$needsMod=1; last}
+			}
+	}
+	# if no parameters are set that would impact the model, just use the raw Model XML provided
+	if(!$needsMod) {return $self->{iModel}}
+
+	my $dir = $self->{iModel};
+	$dir=~s,[^/\\]+$,,;
+
+	my $command = $self->XsltTransformCmd("-",$self->{'iModel'},$modelXml,1);  # does not take any params
+
+	open XSLT, "|$command" 
+	#open XSLT, ">$tempDirectoryPathname/xslt.xsl"
+		||	&Logger::LogFatal("error in running $command", KSystemModelGenerator);
+	my $basedir = &FileAsUrl($dir);
+	$basedir=~s,/$,,; # make sure no //
+print XSLT '<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
+<variable name="fullpath">',$basedir,'/</variable>
+<template match="@*" priority="-2"><copy-of select="."/></template>
+<template match="@href|model/@shapes|logo/@src|legend/@use[not(starts-with(.,&apos;@&apos;) or starts-with(.,&apos;#&apos;))]" priority="-1">
+	<choose>
+		<when test="$fullpath!=&apos;&apos; and not(contains(.,&apos;:&apos;) or starts-with(.,&apos;/&apos;))">
+			<attribute name="{name()}"><value-of select="concat($fullpath,.)"/></attribute>
+		</when>
+		<otherwise><copy-of select="."/></otherwise>
+	</choose>
+</template>
+<template match="*" mode="attr"><apply-templates select="@*"/></template>
+<template match="*" mode="content" priority="-1"><apply-templates select="*"/></template>
+<template match="*" mode="legend"><copy-of select="."/></template>
+<template match="note" mode="legend"><copy><copy-of select="@*"/><apply-templates select="." mode="content"/></copy></template>
+<template match="model" mode="content">
+	<call-template name="sysdef"/>
+	<call-template name="filter"/>
+	<apply-templates select="*"/>
+</template>
+<template match="/shapes/*"><param name="m"/>
+	<if test="not(preceding-sibling::*[name()=name(current())] or $m//legend[@use=concat(\'@shapes#\',name(current()))])">
+	<element name="legend" namespace="">
+		<attribute name="use">@shapes#<value-of select="name()"/></attribute>
+	</element></if>
+</template>
+<template match="/shapes/*[namespace-uri(.)!=',"''",']"/>
+<template match="note" mode="content" priority="-1"><apply-templates select="node()"/></template>
+<template match="*">
+<copy><apply-templates select="." mode="attr"/><apply-templates select="." mode="content"/></copy>
+</template>
+';
+
+my %at;
+my %info='';
+	foreach my $param (keys %{$self->{'iArgs'}})  {
+		my $cur = $self->{'iArgs'}->{$param};
+		if (! ($cur->{'class'} =~ /^(Build Control|)$/) && $self->IsSet($param) ) {
+			if($cur->{'xpath'}) {
+				my $x = $cur->{'xpath'};
+				my $match = $x;
+				$x=~s,/([^/]+)$,,;
+				my $item = $1;
+				if($item=~s/^@//) {
+					if($self->{$param} ne '') {
+						if($self->{'iArgs'}->{$param}->{'type'} ne 'boolean' || $self->{$param} eq 'true') { # if boolean and false, don't set attribute in XML
+							$at{$x}.="\t<attribute name=\"$item\">".&SafeXml($self->{$param})."</attribute>\n";
+						}
+					}
+					print XSLT "<template match=\"$match\"/>\n";
+				}  elsif($item eq 'note') { # just in case there's other things that can take plan text later, can add them here
+					if($cur->{'multi'}==1) {
+						my $count =0;
+						foreach my $n (@{$self->{$param}}) {
+							print XSLT "<template match=\"$item\[count(preceding::$item)=$count\]\" mode=\"content\">",&SafeXml($n),"</template>\n";
+							$count++;
+						}
+					}  elsif(!$cur->{'multi'}) {
+						my $n =$self->{$param};
+						print XSLT "<template match=\"$match\" mode=\"content\">&SafeXml($n)</template>\n";
+					}
+				}  elsif($cur->{'info'}) {
+					my $t = $cur->{'info'};
+					if( ! ($self->{'iArgs'}->{$param}->{'dontclear'} ))	{ # can force it to be included anyway if necessary
+						print XSLT "<template match=\"$match/info\[\@type='$t'\]\"/>\n"; # remove from doc, add explicitly
+					}
+					if($cur->{'multi'}==1){
+						foreach my $n (@{$self->{$param}}) {
+							if($n ne '') {
+								$info{$match}.="\t<info xmlns='' type='$t' href='$n'/>\n";
+							}
+						}
+					} elsif(!$cur->{'multi'}){
+						$info{$match}.="\t<info xmlns='' type='$t'  href='",$self->{$param},"'/>\n";
+					}
+				} elsif($param eq 'iIgnore' or $param eq 'iIgnoreMeta' or $param eq 'iLinkExpr' or $param eq 'iSysDefFile') {
+					print XSLT "<template match='",$cur->{'xpath'},"'/>\n"	# ignore any already present if set
+				}		
+			} elsif($param eq 'iModel' || $param eq 'iSysDefPath' || $param eq 'iPathPrefix' || $param eq 'iSourceRoot') {
+			} else {
+				print STDERR "$param   ",$self->{$param},"\n";  # should not get here
+			}
+		}
+	}
+	if(scalar @{$self->{'iFiltering'}}) {
+		print XSLT "<template match='filter'/>\n"	# ignore all already present if set
+	}
+	while (my ($a,$b) = each(%at) ){
+		print XSLT "<template match=\"$a\" mode=\"attr\">\n\t<apply-templates select=\"@*\"/>\n$b</template>\n";
+	}
+	print XSLT '<template name="sysdef">';
+	my $count=0;
+	foreach my $sys (@{$self->{'iSysDefFile'}}) {
+		$count++;
+		print XSLT "\n\t<element name='sysdef' namespace=''>\n";
+		print XSLT "\t\t<attribute name='href'>$sys</attribute>\n";
+		my $src=$count;
+		if(scalar(@{$self->{'iSourceRoot'}}) == 1) {$src=0}
+		if($self->{'iSourceRoot'}->[$src]) {
+			print XSLT "\t\t<attribute name='root'>",$self->{'iSourceRoot'}->[$src],"</attribute>\n";
+		}
+		$src=$count;
+		if(scalar(@{$self->{'iPathPrefix'}}) == 1) {$src=0}
+		if($self->{'iPathPrefix'}->[$src]) {
+			print XSLT "\t\t<attribute name='path-prefix'>",$self->{'iPathPrefix'}->[$src],"</attribute>\n";
+		}
+		$src=$count;
+		if(scalar(@{$self->{'iSysDefPath'}}) == 1) {$src=0}
+		if($self->{'iSysDefPath'}->[$src]) {
+			print XSLT "\t\t<attribute name='path'>",$self->{'iSysDefPath'}->[$src],"</attribute>\n";
+		}
+		print XSLT $info{'/model/sysdef'}, 
+			"<apply-templates select=\"/model/sysdef/info\"/>\n\t</element>\n";
+		$count++;
+	}
+	foreach my $link (@{$self->{'iLinkExpr'}}) {
+		print XSLT "\t<element name='link' namespace=''><attribute name='expr'>",&SafeXml($link),"</attribute></element>\n";
+	}
+	print XSLT "</template>\n",
+		"<template name=\"filter\">\n";
+	foreach my $ig (@{$self->{'iIgnore'}}) {
+		print XSLT "\t<ignore xmlns='' ";
+		if($ig=~/^(layer|package|block|logicalset|logicalsubset|subblock|collection|module|component):(.*)$/) {print XSLT "type='$1' name='$2'/>\n"}
+		elsif($ig=~/:.*\//) {print XSLT "namespace='$ig'/>\n"} # assume it's a namespace if it has a colon and a slash
+		else {print XSLT "ref='$ig'/>\n"}
+	}
+	foreach my $ig (@{$self->{'iIgnoreMeta'}}) {
+		print XSLT "\t<ignore xmlns='' ";
+		if($ig=~/^(.*):(.*)$/) {print XSLT "meta-type='$2' meta='$1'/>\n"}
+		else {print XSLT "meta='$ig'/>\n"}
+	}
+	print XSLT join("\n\t",@{$self->{'iFiltering'}}),
+		"</template>\n";
+
+	print XSLT '<template match="layout/legend" mode="content">',"\n";
+	if($self->{'iShapes'}) {print XSLT 	' <apply-templates select="document(\'',$self->{'iShapes'},'\',.)/shapes/*|*"><with-param name="m" select="current()"/></apply-templates>',"\n";}
+	foreach my $link ('iColor','iBorder','iOverlay'	,	'iStyle') {
+		my $type=$self->{'iArgs'}->{$link}->{'info'};
+		if(scalar @{$self->{$link}}) {
+			my $use ="#$type";
+			print XSLT "\t<if test=\"not(//legend[\@use='$use'])\">";
+		} else {
+			print XSLT "\t<if test=\"../info[\@type='$type']\">";
+		}
+		print XSLT "<legend xmlns=\"\" use=\"#$type\"/></if>\n";
+	}
+	$count =1;
+	my $notes='';
+	foreach my $n (@{$self->{'iLegendNote'}}) {
+		$notes.="\t<if test='count(//note) &lt; $count'><note xmlns='' width='auto'>".&SafeXml($n)."</note></if>\n";
+	}
+	print XSLT "$notes</template>\n",
+		 '<template match="layout/legend[legend]" mode="content">',
+		"\n\t<apply-templates select='*' mode='legend'/>\n$notes</template>\n",
+		'<template match="layout" mode="content">',"\n",$info{'/model/layout'};
+	if($self->{'iLogoSrc'}) {
+		print XSLT "\t<if test='not(//logo)'><element name='logo' namespace=''>\n",$at{'/model/layout/logo'},"\t</element></if>\n";
+	}
+	print XSLT "\t<apply-templates select='*'/></template>\n";
+	print XSLT "</stylesheet>\n";
+	close XSLT;
+	$self->{'iModelCreated'}=1;
+	return $modelXml;
+	}
+
+
+sub GetXsltDir()
+	{
+	my $self = shift;
+	my $xsltDir = $FindBin::Bin."/core";  # calcluated w.r.t root of Dep directory
+	return $xsltDir;
+	}
+
+
+sub GetExtrasDir()
+	{
+	my $self = shift;
+	my $dir = $FindBin::Bin."/extra";  # calcluated w.r.t root of Dep directory
+	return $dir;
+	}
+
+
+
+sub FileAsUrl() 
+	{
+	my $file = $_[0];
+	if($file=~/^..+:/){ return $file}	# already a URL
+	if(-f $file)
+		{ # abs_path only works on dirs, so strip off file name and put it back when done
+		if(! ($file=~/^[a-z]:[\\\/][^\\\/]+$/i))
+			{ # if it's in the root dir, do nothing
+			my $tail = "/$file";
+			# if it's just a file name, need to find cwd;
+			if($file =~ s,([\\/][^\\/]+)$,,)
+				{
+				$tail = $1;
+				}
+			else {$file = "."}
+			$file = abs_path($file)."$tail";
+			}
+		} 
+	elsif (-d $file)
+		{
+		$file = abs_path($file);
+		}  # else does not exist, so just convert to unix-style path
+	$file=~tr/\\/\//;	
+	return "file:///$file";
+	}
+
+
+sub RunCmd() {
+	my $command = shift;
+	open(EXE,"$command 2>&1|");
+	while(<EXE>){
+		chomp;
+		s/^XSLT Message: //;
+		s/\.Source tree node:.*$//;
+		if($_ ne '') {
+			if(s/^note: //i) {
+				&Logger::LogInfo($_, KSystemModelGenerator,2, 100);
+			} elsif(s/^Warning: //) {
+				&Logger::LogWarning($_,  KSystemModelGenerator,2, 600);
+			} elsif(s/^Error: //i) {
+				&Logger::LogError($_,  KSystemModelGenerator,2, 400);
+			} else {
+				print STDERR "$_\n";
+			}
+		}
+	}
+	close(EXE);
+	return $?;
+}
+
+sub ShouldCreateDepmodel()
+	{
+	my $self = shift;
+	if (@{$self->{iDepsFile}})
+		{
+		return 1;
+		}
+	my $should = 0;
+	my $model = $self->getModel();
+	my $t = $/;
+	$/='>';
+	open(M,$model);
+	while(<M>)
+		{
+		if(/<model\s.*deps=/){$should=1;last;}
+		if(/<info\s.*data-type="Dependencies"/){$should=1;last;}
+		}
+	close M;
+	$/ = $t;
+	return $should
+	}
+
+
+sub XsltTransformCmd()
+	{
+	my $self = shift;
+	my $command = $self->{'iXslt'} . ' ' ;
+
+	if(join('',@PATH)=~/\\/) {
+		# use windows path
+		$command =~ s#\/#\\#g;
+	}
+
+	if($command =~ /xalan\.jar/i) {
+		return $command.	XalanJTransformCmd(@_);
+	}
+	if($command =~ /xsltproc/i) {
+		return $command.	XsltprocTransformCmd(@_);
+	}
+
+	return $command.	XalanTransformCmd(@_);
+	}
+
+sub XalanTransformCmd()
+	{
+	my $xslt = shift;
+	my $from = shift;
+	my $to = shift;
+	my $indent = shift;
+	my %params = (scalar @_) ? %{$_[0]} : ();
+
+	if($from=~/ /) {$from= "\"$from\""}
+	if($to=~/ /) {$to= "\"$to\""}
+	if($xslt=~/ /) {$xslt= "\"$xslt\""}
+
+	my $command;
+	while (my($p,$v) = each(%{$_[0]}))
+		{
+		$v =~ s/"/&quot;/g;	# replace quotes with entities
+		$command.= " -p $p \"$v\"";
+		}
+
+	if($indent >=0) {
+		$command .= " -i $indent";
+	}
+	if($to ne '') {
+		$command .= " -o $to";
+	}
+	return "$command $from $xslt";
+	}
+
+
+sub XalanJTransformCmd()
+	{
+	my $xslt = shift;
+	my $from = shift;
+	my $to = shift;
+	my $indent = shift;		# not used in versions of xalan.jar we expect to see
+	my %params = (scalar @_) ? %{$_[0]} : ();
+	
+	if($from=~/ /) {$from= "\"$from\""}
+	if($to=~/ /) {$to= "\"$to\""}
+	if($xslt=~/ /) {$xslt= "\"$xslt\""}
+
+	my $command;
+	while (my($p,$v) = each(%{$_[0]}))
+		{
+		$v =~ s/"/&quot;/g;	# replace quotes with entities
+		$command.= " -param $p \"$v\"";
+		}
+
+	if($to ne '') {
+		$command .= " -out $to";
+	}
+
+	die &Logger::LogError("Model transforms are not supported using Xalan-J", KSystemModelGenerator, 1) if ($xslt eq '-');
+
+	$command .= " -xsl $xslt";
+	$command .= " -in $from";
+	return $command;
+	}
+
+sub XsltTransform()
+	{
+	my $self = shift;
+	my $to=$_[2];
+	my $command = $self->XsltTransformCmd(@_);
+	&Logger::LogInfo("System Call: $command", KSystemModelGenerator,3,800);
+	if($to eq '') {return `$command`}
+	return &RunCmd($command);
+	}
+
+sub XsltprocTransformCmd()
+	{
+	my $xslt = shift;
+	my $from = shift;
+	my $to = shift;
+	my $indent = shift;
+	my %params = (scalar @_) ? %{$_[0]} : ();
+	my $command;
+
+	if($from=~/ /) {$from= "\"$from\""}
+	if($to=~/ /) {$to= "\"$to\""}
+	if($xslt=~/ /) {$xslt= "\"$xslt\""}
+
+	while (my($p,$v) = each(%{$_[0]}))
+		{
+		$v =~ s/"/&quot;/g;
+		$command.= " --param $p \"$v\"";
+		}
+
+	if($to ne '') {
+		$command .= " -o $to";
+	}
+	return "$command $xslt $from";
+	}
+
+
+sub makeAbbrev 
+	{
+	my $self = shift;
+	my $xsltDir = $self->GetExtrasDir();
+	my %params = (
+		'dict' => "'".$self->{'iDict'}."'"
+	);
+	if(scalar @{$self->{'iSysDefFile'}}) 
+		{ # if sysdefs provided, create one abbrev file for each
+		my $count = 1;
+		if(! (scalar @{$self->{'iLocalize'}}))
+			{ # do not fitler out any abbrev already in the model template
+			$self->{'iArgs'}->{'iLocalize'}->{'dontclear'}=1;
+			}
+		foreach my $sysdef (@{$self->{'iSysDefFile'}}) 
+			{
+			my $afile =  $self->{'iTemporaryDirectory'} . "/abbrev$count.xml";
+			my $error = $self->XsltTransform("$xsltDir/makeabbrev.xsl",$sysdef,$afile,1,\%params);
+			&Logger::LogError("Xalan error ($error) occured in creating abbrev file", KSystemModelGenerator, 1) if $error;
+			# prepend generated file to the list (order does not matter since the same name appearing twice will have the same abbreviation)
+			unshift(@{$self->{'iLocalize'}}, &FileAsUrl($afile));
+			$count++;
+			}
+		}
+	else
+		{ # no sysdefs provided, run against template model xml
+		if(scalar @{$self->{'iLocalize'}})
+			{# if localize files provided, include = 0, which means it will ignore any localize files in the model template
+				# if there are none provided, then any in the model template will be appended to the generated file
+				# this is only needed for the case where it's run on the model. When run on the sysdef, inclusion has no meaning
+			$params{'include'} = 0; 
+			}
+		my $afile =  $self->{'iTemporaryDirectory'} . "/abbrev.xml";
+		my $error = $self->XsltTransform("$xsltDir/makeabbrev.xsl",$self->{'iModel'},$afile,1,\%params);
+		&Logger::LogError("Xalan error ($error) occured in creating abbrev file", KSystemModelGenerator, 1) if $error;
+		# prepend generated file to the list
+		unshift(@{$self->{'iLocalize'}}, &FileAsUrl($afile));	
+		}
+	}
+
+sub Draw()
+	{
+	my $self = shift;
+	my $genSvg = $self->{'iDiagram'} ne '';
+	my $genCsv = $self->{'iOutputCsv'} ne '';
+	my $genXml = $self->{'iOutputXml'} ne '';
+	my $error; 
+
+	if(!$genSvg && !$genCsv && !$genXml)  
+		{
+        &Logger::LogFatal("Must specify at least one type of output file. Cannot continue...", KSystemModelGenerator, 0,Logger::KNothingToDo);		
+		}
+	
+	# Step 0:
+	# Prepare some file names and create output directory:
+
+	# construct full path name:
+	
+	my $xsltDir = $self->GetXsltDir();	
+	my $extraDir = $self->GetExtrasDir();	
+	my $tempDirectoryPathname = $self->{'iTemporaryDirectory'};
+	my $tempStuctureFile = "$tempDirectoryPathname/system_definition_tmp.xml";
+	my $tempXslFile = "$tempDirectoryPathname/styling_tmp.xsl";
+	my $tempModelFile = "$tempDirectoryPathname/model_tmp.svg";
+	my $tempModelFile2 = "$tempDirectoryPathname/model_tmp2.svg";
+	my $modelXsl = $xsltDir."/layoutsysdef.xsl";
+
+	if($self->{'iDict'})	
+		{
+		&Logger::LogInfo("Create an abbreviation file...", KSystemModelGenerator, 0);
+		$self->makeAbbrev();
+		}
+
+	&Logger::LogInfo("Generating Model XML...", KSystemModelGenerator, 0);
+	my $modelXml = $self->getModel();
+
+	# Step 2 - 
+	&Logger::LogInfo("Generating merged sysdef XML...", KSystemModelGenerator, 0);
+	$error = $self->XsltTransform($modelXsl,$modelXml,$tempStuctureFile,1);  # does not take any params
+				
+	&Logger::LogError("Xalan error ($error) occured in combining sysdefs", KSystemModelGenerator, 1) if $error;
+
+	# Step 3 - validation
+	if($self->{iWarningLevel} == LogItem::VERBOSE )
+		{
+		&Logger::LogInfo("Validating merged XML...", KSystemModelGenerator, 0);
+		my $errors = $self->XsltTransform($extraDir."/validate.xsl",$tempStuctureFile,'',-1);
+		&Logger::LogList(split(/\n/,$errors));
+		}
+
+	if($genSvg)
+		{ # only needed for model building 
+		&Logger::LogInfo("Generating Model Diagram...", KSystemModelGenerator, 0);
+		
+		# Step 4
+		&Logger::LogInfo("Creating styling XSLT...", KSystemModelGenerator, 1);
+		$error = $self->XsltTransform("$xsltDir/shapes.xsl",$modelXml,$tempXslFile,1,
+				{%{$self->{'iXsltParam'}},'Model-Transform' =>  "'".&FileAsUrl("$xsltDir/draw.xsl")."'" });
+		&Logger::LogError("Xalan error ($error) occured generating Styling transform", KSystemModelGenerator, 2) if $error;
+	
+		if($self->{iLowMem})
+			{ # split step 5 into parts so we don't use as much runtime memory
+			# Step 5a
+			my $tempDetailsFile = "$tempDirectoryPathname/system_definition_draw.xml";			
+			&Logger::LogInfo("Generating temp details XML", KSystemModelGenerator, 1);
+			$error = $self->XsltTransform($tempXslFile,$tempStuctureFile,$tempDetailsFile,1,
+				{%{$self->{'iXsltParam'}},'Run' => "'calc'" }  );
+			&Logger::LogError("Xalan error ($error) occured in building temp datafile", KSystemModelGenerator, 2) if $error;
+			# Step 5b
+			&Logger::LogInfo("Generating SVG model...", KSystemModelGenerator, 1);
+			$error = $self->XsltTransform($tempXslFile,$tempDetailsFile,$tempModelFile,1,
+				{%{$self->{'iXsltParam'}},'Run' => "'draw'" }  );
+			&Logger::LogError("Xalan error ($error) occured in building SVG", KSystemModelGenerator, 2) if $error;
+			}
+		else
+			{
+			# Step 5
+			&Logger::LogInfo("Generating SVG model...", KSystemModelGenerator, 1);
+			$error = $self->XsltTransform($tempXslFile,$tempStuctureFile,$tempModelFile,1,$self->{'iXsltParam'});
+			&Logger::LogError("Xalan error ($error) occured in building SVG", KSystemModelGenerator, 2) if $error;
+			}
+		if ($self->ShouldCreateDepmodel()) {	# insert as 1st transform
+			@ARGV=( $extraDir."/dependencies.xsl",'-',@ARGV)
+		}
+
+		my $tmpsvg = $tempModelFile;
+		while(scalar(@ARGV)) {
+			my $transform = shift(@ARGV);
+			my $datafile = shift(@ARGV);
+			if($datafile eq '-') {$datafile = &FileAsUrl($tempStuctureFile)}
+			elsif($datafile ne '') {$datafile = &FileAsUrl($datafile)}
+			# save to the output if this is the last transform
+			# otherwise save to tempModelFile2 if reading from tempModelFile, and vis versa
+			my $saveto = $self->{'iDiagram'};
+			if(scalar(@ARGV))	 {
+				$saveto = ($tmpsvg eq $tempModelFile) ? $tempModelFile2 : $tempModelFile;
+			}
+			# Step 6
+			&Logger::LogInfo("Applying post-processing transformation...", KSystemModelGenerator,1);
+			my %p = %{$self->{'iXsltParam'}};  
+			if($datafile ne '') {
+				$p{'Data'}="'$datafile'";	# optional -- only if needed for transform
+			}
+			$error = $self->XsltTransform($transform,$tmpsvg,$saveto,1,\%p);
+			&Logger::LogError("Xalan error ($error) occured in post-processing SVG file", KSystemModelGenerator, 2) if $error;
+			$tmpsvg = $saveto; # read from this next time.
+		}
+		if ($tmpsvg ne $self->{'iDiagram'}) {
+			open(OUT,">".$self->{iDiagram});
+			open(IN,$tmpsvg);
+			print OUT <IN>;
+			close OUT;
+			close IN;
+		}
+	
+		my $zipname = $self->{iDiagram};
+		my $unzipname = $zipname;
+		$zipname =~ s/\.svg$/.svgz/i;
+		$unzipname =~ s/\.svgz$/.svg/i;
+		my $compressed = 0;
+		if($self->{iCompress})
+			{
+			my $gzip = &GzipCommand();
+			if($gzip)
+				{
+				&Logger::LogInfo("Compressing output model", KSystemModelGenerator,1);
+				my $command = "$gzip ".$self->{iDiagram};
+				&Logger::LogInfo("System Call: $command", KSystemModelGenerator,2);
+				$error = &RunCmd($command);# this should generate the sysmodel.svg in the output directory
+				&Logger::LogError("Gzip error ($error) occured when comrpessing SVG", KSystemModelGenerator, 2) if $error;
+				&Logger::LogInfo("Renaming output to : $zipname", KSystemModelGenerator,2);		
+				rename $self->{iDiagram}.".gz", $zipname;
+				$compressed = 1;
+				}
+			}
+		if(!$compressed && $unzipname ne $self->{iDiagram}) 
+			{
+			&Logger::LogInfo("Renaming output to : $unzipname", KSystemModelGenerator,1);		
+			rename $self->{iDiagram}, $unzipname;	
+			}
+		}
+	# create CSV if desired
+	if($genCsv)
+		{
+		&Logger::LogInfo("Generating CSV output", KSystemModelGenerator, 0);
+		my %p;
+		if($self->{iCsvColumns})
+			{
+			$p{'atts'}="'".$self->{iCsvColumns}."'";
+			}
+		if($self->{iCsvLabels})
+			{
+			$p{'labels'}="'".$self->{iCsvLabels}."'";
+			}
+		$error = $self->XsltTransform($extraDir."/output-csv.xsl",$tempStuctureFile,$self->{iOutputCsv},-1,\%p);
+		&Logger::LogError("Xalan error ($error) occured in CSV output...", KSystemModelGenerator, 1) if $error;
+		}
+		
+	# create sysdef XML if desired
+	
+	if($genXml)
+		{
+		&Logger::LogInfo("Generating XML output", KSystemModelGenerator, 0);
+		$error = $self->XsltTransform($extraDir."/output-sysdef.xsl",$tempStuctureFile,$self->{iOutputXml},1,$self->{'iXsltParam'});
+		&Logger::LogError("Xalan error ($error) occured in Sysdef output...", KSystemModelGenerator, 1) if $error;
+		}
+
+	# delete the contents of the temp directory if -clean is specified by the user:
+	if ($self->{iClean})
+		{
+		&Logger::LogInfo("Deleting contents of the temp directory $self->{iTemporaryDirectory}...", KSystemModelGenerator,0);
+		$self->DeleteTempDirectory();
+		}	
+	}
+
+
+
+sub SafeXml {
+	my $txt = shift;
+	if(!($txt=~/&#?[0-9a-z]+;/i))
+		{	# if not entity-encoded, entity encode the stuff
+		$txt=~ s/([&<>\x7f-\xff])/"&#".ord($1).";"/eg;
+		}
+	return $txt;	
+}
+
+sub IsSet()
+	{
+	my $self = shift;
+	my $param = shift;
+	if ($self->{'iArgs'}->{$param}->{'multi'} == 1)
+		{
+		 if (scalar @{$self->{$param}} ) {return 1}
+		}
+	elsif ($self->{'iArgs'}->{$param}->{'multi'} == 2)
+		{
+		if (scalar %{$self->{$param}} ) {return 1}
+		}
+	elsif (defined $self->{$param}){return 1}
+	return 0;
+	}
+
+
+sub SystemModelXmlDataDir()
+	{
+	my $file =$FindBin::Bin."/rsc";
+	return $file;
+	}
+
+
+#-----------------------------------------------------------------------------
+# Xalan
+#-----------------------------------------------------------------------------
+my $KXalanDirectory = $FindBin::Bin."/rsc/installed/Xalan";
+my $KXalan = $KXalanDirectory."/xalan.exe";
+sub Xalan()
+	{
+	my $xalan = &FindInPath("xalan");	
+	if($xalan ne '') {
+		if($xalan=~/ /) {return "\"$xalan\""}
+		return $xalan
+	}
+	# not found, use windows built-in version
+	$xalan = $KXalan;
+	return $xalan;
+	}
+
+sub XsltProcessor()
+	{
+	#first try xalan-c
+	my $proc = &FindInPath("xalan");	
+	if($proc ne '') {
+		if($proc=~/ /) {return "\"$proc\""}
+		return $proc
+	}
+	# now try xsltproc
+	my $proc = &FindInPath("xsltproc");	
+	if($proc ne '')
+		{
+		if($proc=~/ /) {return "\"$proc\""}
+		return $proc
+		}
+	# now try xalan-j
+	foreach my $dir(@CLASSPATH) 
+		{
+		my $file = "$dir/xalan.jar";
+		if(-e $file)
+			{
+			if($file=~/ /) {$file="\"$file\""}
+			return "java -jar $file";	# assume java is installed. Why would ever have a CLASSPATH and not have java?
+			}
+		}
+	# not found, use windows built-in version. If we're not in windows this will fail, but since we have no other options we may as well try it.
+	$proc = $KXalan;
+	$proc = $FindBin::Bin."/../../resources/installed/Xalan/xalan.exe" if ! -e $proc;
+	if($proc=~/ /) {return "\"$proc\""}
+	return $proc;
+	}
+
+
+#-----------------------------------------------------------------------------
+# Gzip
+#-----------------------------------------------------------------------------
+sub GzipCommand
+	{ # returns empty if gzip not in path
+	my $dir = &FindInPath("gzip");	
+	if($dir ne '')  {return "gzip -9"}
+	return "";
+	}
+
+sub FindInPath
+	{
+	my $exe = shift;
+	foreach my $d (@PATH)
+		{
+		my $dir = $d;
+		$dir=~s,[\\\/]$,,;	# remove trailing slash
+		$dir.="/$exe";	# try w/o extension
+		foreach my $ext ('',@PATHEXT) {
+			if(-f "$dir$ext" && -x "$dir$ext") {return "$dir$ext"}		# must be a file and must be executable
+			}
+		}
+	return "";
+	}
+
+
+#-------------------
+
+
+sub DeleteTempDirectory()
+	{
+	my $self = shift;
+	# This will delete all files in the $self->{iTemporaryDirectory}
+	rmtree $self->{iTemporaryDirectory};
+	}
+
+sub Help()
+	{
+	my $self = shift;
+	my ($param,$text);
+
+	my @helporder = ('','', 'Build Control', '','Files or URIs',"All of these take a file name (relative or absolute path) or URI of a data source",
+		"Labels","All of these take a plain text value which is displayed on the model",'Model Control','');
+
+format STDERR =
+ @<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+$param,                               $text,
+                       ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
+                       $text
+.
+
+
+my @list =(
+ 'Switch',               'Explanation' );
+
+for(my $i=0;$i<=$#helporder;$i+=2) {
+	my $item=$helporder[$i];
+	my $next = $helporder[$i+1];
+	if($next ne '') {$next="\n$next"}
+	if($item ne '') {
+		push (@list,"==== $item ====$next");
+	}
+	foreach my $b (sort values %{$self->{'iArgs'}})  {
+		if(!$b->{'param'}) {next} # not an arg
+		my $a = $b->{'param'};
+		if ($b->{'class'} eq $item) {
+			if ($a=~s/=.*// && $b->{'type'} ne '') {
+				$a .= ' ['.$b->{'type'}.']';
+			}
+			my $ex = $b->{'desc'};
+			if($b->{'default'}) { $ex.=  ($ex=~/./ ? '. ' : ''  ). 'Defaults to "'.$b->{'default'}.'"'}
+			if($b->{'multi'}) { $ex.=  ($ex=~/./ ? '. ' : ''  ). "Can specify multiple times."}
+			if($b->{'depr'}) { $ex.=  ($ex=~/./ ? '. ' : ''  ). "DEPRECATED: ".$b->{'depr'}}
+			push(@list,'-'.$a,$ex);
+		}
+	}
+}
+
+$self->HelpBase();
+print STDERR "\nArguments:\n";
+  my $head=2;
+while(@list) {
+	$param = shift(@list);
+	if($head<=0 and !($param=~/^-/)){print STDERR "\n$param\n";next;}
+	$text = shift(@list);
+	write STDERR ;
+	$head--;
+}
+	return;
+	}
+
+sub HelpBase()
+	{
+	print STDERR "Usage: $0 [Arguments] [Transform Data-file] ...\n";
+	}
+1;
--- a/sysmodellibs/sysmodelgen/src/common/DepConstants.pm	Wed Oct 13 14:00:36 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,467 +0,0 @@
-#!perl
-# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-package DepConstants;
-
-use FindBin;
-use lib $FindBin::Bin;
-use strict;
-use Cwd;
-
-# -------------------------------------------------------
-# 	Data stores, etc
-# -------------------------------------------------------
-my $KDataDirectory = $FindBin::Bin."deptoolkit_data";
-sub DataDirectory     { return $KDataDirectory; }
-
-my $KDataFile = $FindBin::Bin."deptoolkit_data"; # this is the default value, to be used if the user hasn't specified a value
-sub DataFile     { return $KDataFile; }
-
-# -------------------------------------------------------
-# 	Html and icons files:
-# -------------------------------------------------------
-my $KIconsSourceDirectory = $FindBin::Bin."/../resources/html/icons";
-sub IconsSource() { return $KIconsSourceDirectory; }
-
-my $KZoomInIcon = "dep_zoom_in.gif";
-my $KZoomInDisabledIcon = "dep_zoom_in_disabled.gif";
-my $KTopOfPageIcon = "dep_top_of_page.gif";
-my $KSeperatorIcon = "dep_separator.gif";
-my $KArrowIcon = "dep_arrow.gif";
-my $KAtSignIcon = "dep_at_sign.gif";
-my $KHierarchyIcon = "dep_hierarchy.gif";
-my $KSysDefIcon = "dep_sysdef.gif";
-my $KLayerIcon = "dep_layer.gif";
-my $KBlockIcon = "dep_block.gif";
-my $KSubBlockIcon = "dep_sub_block.gif";
-my $KCollectionIcon = "dep_collection.gif";
-my $KComponentIcon = "dep_component.gif";
-my $KExeIcon = "dep_exe.gif";
-my $KWarningIcon = "dep_warning.gif";
-
-sub ZoomInIcon() { return $KZoomInIcon; }
-sub ZoomInDisabledIcon() { return $KZoomInDisabledIcon; }
-sub TopOfPageIcon() { return $KTopOfPageIcon; }
-sub SeperatorIcon() { return $KSeperatorIcon; }
-sub ArrowIcon() { return $KArrowIcon; }
-sub AtSignIcon() { return $KAtSignIcon; }
-sub HierarchyIcon() { return $KHierarchyIcon; }
-sub SysDefIcon() { return $KSysDefIcon; }
-sub LayerIcon() { return $KLayerIcon; }
-sub BlockIcon() { return $KBlockIcon; }
-sub SubBlockIcon() { return $KSubBlockIcon; }
-sub CollectionIcon() { return $KCollectionIcon; }
-sub ComponentIcon() { return $KComponentIcon; }
-sub ExeIcon() { return $KExeIcon; }
-sub WarningIcon() {return $KWarningIcon; }
-
-# Following methods contsruct the HTML image tags using the source directory
-# (For output files, use the ImgHtml() by passing the /icons directory file names)
-sub ZoomInImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KZoomInIcon", 'Causal details of relationship');
-	}
-
-sub ZoomInDisabledImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KZoomInDisabledIcon", 'Manual dependency: no details available');
-	}
-
-sub TopOfPageImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KTopOfPageIcon", 'Top', "\#_top");
-	}
-
-sub SeperatorImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KSeperatorIcon");
-	}
-
-sub ArrowImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KArrowIcon");
-	}
-
-sub AtSignImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KAtSignIcon", 'is located at');
-	}
-
-sub HierarchyImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KHierarchyIcon", "System Model Hierarchy");
-	}
-
-sub SysDefImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KSysDefIcon");
-	}
-
-sub LayerImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KLayerIcon", "Layer");
-	}
-
-sub BlockImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KBlockIcon", "Block");
-	}
-
-sub SubBlockImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KSubBlockIcon", "Sub-block");
-	}
-
-sub CollectionImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KCollectionIcon", "Collection");
-	}
-
-sub ComponentImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KComponentIcon", "Component");
-	}
-
-sub ExeImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KExeIcon", "Executable");
-	}
-
-sub WarningImgHtml()
-	{
-	my $hrefRelativeDepth = $_[0] ? $_[0] : 0;
-	return RelativeImgHtml($hrefRelativeDepth, "icons/$KWarningIcon", "Warning");
-	}
-
-# Genric:
-sub RelativeImgHtml()
-	{
-	my $hrefRelativeDepth = shift;
-	my $img = shift; # image file
-	my $alt = shift; # tool tip text
-	my $url = shift; # if a url is given, turn it into a href
-	
-    my $relativeDirText = ""; # where the main index file is.
-	$relativeDirText = "../" x $hrefRelativeDepth if defined $hrefRelativeDepth;
-    $relativeDirText =~ s@\/$@@; # now remove the trailing slash
-    $img = $relativeDirText."/".$img;
-    
-    return ImgHtml($img, $alt, $url);
-	}
-
-sub ImgHtml()
-	{
-	my $img = shift; # image file
-	my $alt = shift; # tool tip text
-	my $url = shift; # if a url is given, turn it into a href
-	my $imgHtml = "";
-	return $imgHtml if $img eq "";
-	$imgHtml .= "<a href='$url'>" if $url;
-	$imgHtml .= "<img src='$img'";
-	$imgHtml .= " alt='$alt'" if $alt; # optional
-	$imgHtml .= " border = '0'>";
-	$imgHtml .= "</a>" if $url;
-	return $imgHtml;
-	}
-
-
-# -------------------------------------------------------
-# 	Homepage and other files:
-# -------------------------------------------------------
-my $KHtmlSourceDirectory = $FindBin::Bin."/../resources/html";
-sub HtmlSourceDirectory() { return $KHtmlSourceDirectory; }
-
-my $KHomepageFileName = "index.html";
-my $KHomepage = $KHtmlSourceDirectory."/".$KHomepageFileName;
-sub HomepageFileName() { return $KHomepageFileName; }
-sub Homepage() { return $KHomepage; }
-
-my $KSysModelHtmlName = "sysmodel.html";
-sub SysModelHtmlName() { return $KSysModelHtmlName; }
-
-my @KAuxiliaryHtmlFiles = ("metrics.html", "model_criteria.html",  "user_guide.html", "coupling.pdf");
-sub AuxiliaryHtmlFiles() { return @KAuxiliaryHtmlFiles; }
-
-my $KCssStylesheetFileName = "dep.css";
-my $KCssStylesheet = $FindBin::Bin."/../resources/html/css/".$KCssStylesheetFileName;
-sub CssStylesheetFileName() { return $KCssStylesheetFileName; }
-sub CssStylesheet() { return $KCssStylesheet; }
-
-my $KInstallerImageFileName = "DepToolkitInstaller_main.jpg";
-my $KInstallerImage = $FindBin::Bin."/../resources/html/images/DepToolkitInstaller_main.jpg";
-sub InstallerImageFileName() { return $KInstallerImage; }
-sub InstallerImage() { return $KInstallerImage; }
-
-my $KCustomisationJavaScript = "custom.js";
-sub CustomisationJavaScript() { return $KCustomisationJavaScript; }
-
-# -------------------------------------------------------
-#	Misc constants:
-# -------------------------------------------------------
-# Relationship type between two items:
-use constant KDependency						=> 1;
-use constant KDependent							=> 2;
-# Dependency type between two items:
-use constant KStaticDependency					=> 1;
-use constant KDynamicDependency					=> 2;
-use constant KManualDependency					=> 3;
-
-# -------------------------------------------------------
-# 	ERROR & WARNING CODES
-# -------------------------------------------------------
-
-use constant KErrorNone							=> 0;
-
-use constant KIncorrectSyntax					=> 1;
-use constant KFileDoesNotExist					=> 2;
-use constant KCannotOpenFile					=> 3;
-use constant KInvalidROMLog						=> 4;
-use constant KBinaryNotInROM					=> 5;
-use constant KNoBinariesInROM					=> 6;
-use constant KBinaryDoesNotExist				=> 7;
-use constant KMapFileDoesNotExist				=> 8;
-use constant KFailure							=> 9;
-
-# System_Definition.xml error codes:
-use constant KSysDefNotFound					=> 31;
-use constant KInvalidSysDefXML					=> 32;
-use constant KConfigurationNotFound				=> 33;
-
-# Graphing error codes:
-use constant KDotExeNotFound					=> 41;
-
-# HTML rendering error codes:
-#
-
-# Codes for scripts and modules (starting at 100):
-use constant KStartOfScriptCodes				=> 100;
-use constant KUnknownModule						=> 100;
-use constant KModel								=> 101;
-use constant KFileMaps							=> 102;
-use constant KDepInfo							=> 103;
-use constant KDepInfoToLinkDeps					=> 104;
-use constant KDepInfoToHtml						=> 105;
-use constant KDepsTree							=> 106;
-use constant KModelEngine						=> 107;
-use constant KDepRendererCommon					=> 108;
-use constant KDepSummariesRenderer				=> 109;
-use constant KDepDetailsRenderer				=> 110;
-use constant KGenGraphs							=> 111;
-use constant KSysDefParser						=> 112;
-use constant KSysModelDepsGenerator				=> 113;
-use constant KDepsCommon						=> 114;
-use constant KDotDigraph						=> 115;
-
-# Logging severity levels:
-use constant ERROR 								=> 1;
-use constant WARNING							=> 2;
-use constant INFO 								=> 3;
-use constant VERBOSE							=> 4;
-
-# Script or module-level error codes (starting at 200):
-use constant KUnknownModuleError				=> 200;
-use constant KModelError						=> 201;
-use constant KFileMapsError						=> 202;
-use constant KDepInfoError						=> 203;
-use constant KDepInfoToLinkDepsError			=> 204;
-use constant KDepInfoToHtmlError				=> 205;
-use constant KDepsTreeError						=> 206;
-use constant KModelEngineError					=> 207;
-use constant KDepRendererCommonError			=> 208;
-use constant KDepSummariesRendererError			=> 209;
-use constant KDepDetailsRendererError			=> 210;
-use constant KGenGraphsError					=> 211;
-use constant KSysDefParserError					=> 212;
-use constant KSysModelDepsGeneratorError		=> 213;
-use constant KDepsCommonError					=> 214;
-use constant KDotDigraphError					=> 215;
-
-# Script or module-level warning codes (starting at 300):
-use constant KUnknownModuleWarning				=> 300;
-use constant KModelWarning						=> 301;
-use constant KFileMapsWarning					=> 302;
-use constant KDepInfoWarning					=> 303;
-use constant KDepInfoToLinkDepsWarning			=> 304;
-use constant KDepInfoToHtmlWarning				=> 305;
-use constant KDepsTreeWarning					=> 306;
-use constant KModelEngineWarning				=> 307;
-use constant KDepRendererCommonWarning			=> 308;
-use constant KDepSummariesRendererWarning		=> 309;
-use constant KDepDetailsRendererWarning			=> 310;
-use constant KGenGraphsWarning					=> 311;
-use constant KSysDefParserWarning				=> 312;
-use constant KSysModelDepsGeneratorWarning		=> 313;
-use constant KDepsCommonWarning					=> 314;
-use constant KDotDigraphWarning					=> 315;
-
-# Script or module-level info codes (starting at 400):
-use constant KUnknownModuleInfo					=> 400;
-use constant KModelInfo							=> 401;
-use constant KFileMapsInfo						=> 402;
-use constant KDepInfoInfo						=> 403;
-use constant KDepInfoToLinkDepsInfo				=> 404;
-use constant KDepInfoToHtmlInfo					=> 405;
-use constant KDepsTreeInfo						=> 406;
-use constant KModelEngineInfo					=> 407;
-use constant KDepRendererCommonInfo				=> 408;
-use constant KDepSummariesRendererInfo			=> 409;
-use constant KDepDetailsRendererInfo			=> 410;
-use constant KGenGraphsInfo						=> 411;
-use constant KSysDefParserInfo					=> 412;
-use constant KSysModelDepsGeneratorInfo			=> 413;
-use constant KDepsCommonInfo					=> 414;
-use constant KDotDigraphInfo					=> 415;
-
-my @KUnknownModuleCodes       		= (KUnknownModuleError, KUnknownModuleWarning, KUnknownModuleInfo);
-my @KModelCodes       				= (KModelError, KModelWarning, KModelInfo);
-my @KFileMapsCodes 					= (KFileMapsError, KFileMapsWarning, KFileMapsInfo);
-my @KDepInfoCodes 					= (KDepInfoError, KDepInfoWarning, KDepInfoInfo);
-my @KDepInfoToHtmlCodes 		 	= (KDepInfoToHtmlError, KDepInfoToHtmlWarning, KDepInfoToHtmlInfo);
-my @KDepInfoToLinkDepsCodes 		= (KDepInfoToLinkDepsError, KDepInfoToLinkDepsWarning, KDepInfoToLinkDepsInfo);
-my @KDepsTreeCodes       			= (KDepsTreeError, KDepsTreeWarning, KDepsTreeInfo);
-my @KModelEngineCodes				= (KModelEngineError, KModelEngineWarning, KModelEngineInfo);
-my @KDepRendererCommonCodes			= (KDepRendererCommonError, KDepRendererCommonWarning, KDepRendererCommonInfo);
-my @KDepSummariesRendererCodes     	= (KDepSummariesRendererError, KDepSummariesRendererWarning, KDepSummariesRendererInfo);
-my @KDepDetailsRendererCodes       	= (KDepDetailsRendererError, KDepDetailsRendererWarning, KDepDetailsRendererInfo);
-my @KGenGraphsCodes       			= (KGenGraphsError, KGenGraphsWarning, KGenGraphsInfo);
-my @KSysDefParserCodes       		= (KSysDefParserError, KSysDefParserWarning, KSysDefParserInfo);
-my @KSysModelDepsGeneratorCodes   	= (KSysModelDepsGeneratorError, KSysModelDepsGeneratorWarning, KSysModelDepsGeneratorInfo);
-my @KDepsCommonCodes   				= (KDepsCommonError, KDepsCommonWarning, KDepsCommonInfo);
-my @KDotDigraphCodes   				= (KDotDigraphError, KDotDigraphWarning, KDotDigraphInfo);
-
-sub ModuleErrorCodes()
-	{
-	my $moduleCode = shift;
-	--(my $level = shift); # decrement as it's an index into an array
-	return 0 if $moduleCode < KStartOfScriptCodes or $level < 0 or $level > 2;
-	return $KModelCodes[$level] 				if ($moduleCode == KModel);
-	return $KFileMapsCodes[$level] 				if ($moduleCode == KFileMaps);
-	return $KDepInfoCodes[$level] 				if ($moduleCode == KDepInfo);
-	return $KDepInfoToLinkDepsCodes[$level]		if ($moduleCode == KDepInfoToLinkDeps);
-	return $KDepInfoToHtmlCodes[$level] 		if ($moduleCode == KDepInfoToHtml);
-	return $KDepsTreeCodes[$level] 				if ($moduleCode == KDepsTree);
-	return $KModelEngineCodes[$level] 			if ($moduleCode == KModelEngine);
-	return $KDepRendererCommonCodes[$level] 	if ($moduleCode == KDepRendererCommon);
-	return $KDepSummariesRendererCodes[$level] 	if ($moduleCode == KDepSummariesRenderer);
-	return $KDepDetailsRendererCodes[$level] 	if ($moduleCode == KDepDetailsRenderer);
-	return $KGenGraphsCodes[$level] 			if ($moduleCode == KGenGraphs);
-	return $KSysDefParserCodes[$level] 			if ($moduleCode == KSysDefParser);
-	return $KSysModelDepsGeneratorCodes[$level] if ($moduleCode == KSysModelDepsGenerator);
-	return $KDepsCommonCodes[$level]			if ($moduleCode == KDepsCommon);
-	return $KDotDigraphCodes[$level]			if ($moduleCode == KDotDigraph);
-	
-	return $KUnknownModuleCodes[$level];
-	}
-
-#-----------------------------------------------------------------------------
-# EPOCROOT, NM, CPPFILT, PETRAN
-#-----------------------------------------------------------------------------
-my $EPOCROOT = $ENV{EPOCROOT};
-
-# Global Variables:
-my $NM          = "nm.exe";
-my $CPPFILT     = "c++filt.exe";
-my $PETRAN      = "petran.exe";
-my $ELFTRAN     = "elftran.exe";
-
-sub EPOCROOT    { return $EPOCROOT; } 
-sub NM          { return $NM; }
-sub CPPFILT     { return $CPPFILT; }
-sub PETRAN      { return $PETRAN; }
-sub ELFTRAN     { return $ELFTRAN; }
-
-#-----------------------------------------------------------------------------
-# DOT (Graphing tool)
-#-----------------------------------------------------------------------------
-my $KDOTDirectory = $FindBin::Bin."/../resources/installed/Dot";
-my $KDOT = $KDOTDirectory."/dot.exe -q";
-sub Dot     	{ return $KDOT." -q1"; }
-
-my $KNEATO = $KDOTDirectory."/neato.exe";
-sub Neato     	{ return $KNEATO; }
-
-# -------------------------------------------------------
-# 	Auxiliary files:
-# -------------------------------------------------------
-my $KAuxiliaryDirectory = $FindBin::Bin."/resources/auxiliary";
-my $KSystemModelColorsXmlFile = $KAuxiliaryDirectory."/system_model_colors.xml";
-my $KSystemModelExtraInfoXmlFile = $KAuxiliaryDirectory."/SystemInfo.xml";
-
-sub SystemModelColorsXmlFile()
-	{
-	my $colorsFile = $KSystemModelColorsXmlFile;
-	$colorsFile = $FindBin::Bin."/../../resources/auxiliary/system_model_colors.xml" if ! -e $colorsFile;
-	return $colorsFile;
-	}
-
-sub SystemModelXmlDataDir()
-	{
-	my $file = $KAuxiliaryDirectory;
-	$file = $FindBin::Bin."/../../resources/auxiliary" if ! -e $file;
-	return $file;
-	}
-
-#-----------------------------------------------------------------------------
-# Xalan
-#-----------------------------------------------------------------------------
-my $KXalanDirectory = $FindBin::Bin."/resources/installed/Xalan";
-my $KXalan = $KXalanDirectory."/xalan.exe";
-sub Xalan()
-	{
-	my $xalan = $KXalan;
-	$xalan = $FindBin::Bin."/../../resources/installed/Xalan/xalan.exe" if ! -e $xalan;
-	return $xalan;
-	}
-
-my $KSystemoModelSVG = $FindBin::Bin."/../temp/sysmodel.svg";
-sub SystemoModelSVG { return $KSystemoModelSVG; }
-
-#-----------------------------------------------------------------------------
-# Gzip
-#-----------------------------------------------------------------------------
-sub GzipCommand
-	{ # returns empty if gzip not in path
-	foreach my $dir (split(/;/,$ENV{'PATH'}))
-		{
-		$dir.="\\gzip.exe";
-		if(-e $dir) {return "gzip -9"}
-		}
-	return "";
-	}
-
-
-#-----------------------------------------------------------------------------
-# Logging
-#-----------------------------------------------------------------------------
-my $KLogDirectory = $FindBin::Bin."/../temp";
-my $KDepToolkitLogFile = $KLogDirectory."/log.txt";
-sub LogFile { return $KDepToolkitLogFile; }
-
-1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/xsd/sysinfo.xsd	Wed Oct 13 16:21:25 2010 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="info">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded" minOccurs="0">
+        <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
+          <xs:complexType>
+          	<xs:simpleContent>
+          		<xs:extension base="xs:string">
+          			<xs:attribute type="xs:string" name="ref" use="required" />
+          			<xs:attribute type="xs:NMTOKEN" name="status" use="optional" />
+          			<xs:attribute type="xs:NMTOKEN" name="percent" use="optional" />
+          		</xs:extension>
+          	</xs:simpleContent>
+          </xs:complexType>
+        </xs:element>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
\ No newline at end of file