Prepare old system model generator for 2.0 update
authorBob Rosenberg <bob.rosenberg@nokia.com>
Wed, 13 Oct 2010 14:00:36 +0100
changeset 6 5b32dc297d05
parent 3 e7e0ae78773e
child 7 3c36c452f013
Prepare old system model generator for 2.0 update
sysmodellibs/sysmodelgen/docs/SystemModelToolkitInstaller_main.jpg
sysmodellibs/sysmodelgen/docs/dep.css
sysmodellibs/sysmodelgen/docs/sample_drawsvg.ini
sysmodellibs/sysmodelgen/installer/SystemModelToolkit.nsi
sysmodellibs/sysmodelgen/resources/auxiliary/Example-shapes.xml
sysmodellibs/sysmodelgen/resources/auxiliary/Levels.xml
sysmodellibs/sysmodelgen/resources/auxiliary/Levels91.xml
sysmodellibs/sysmodelgen/resources/auxiliary/Shapes.xml
sysmodellibs/sysmodelgen/resources/auxiliary/SystemInfo.xml
sysmodellibs/sysmodelgen/resources/auxiliary/display-names.xml
sysmodellibs/sysmodelgen/resources/auxiliary/system_model_colors.xml
sysmodellibs/sysmodelgen/resources/installed/Xalan/Xalan-C_1_8.dll
sysmodellibs/sysmodelgen/resources/installed/Xalan/Xalan.exe
sysmodellibs/sysmodelgen/resources/installed/Xalan/XalanMessages_1_8.dll
sysmodellibs/sysmodelgen/resources/installed/Xalan/xerces-c_2_5_0.dll
sysmodellibs/sysmodelgen/resources/xsd/Border-shapes.xsd
sysmodellibs/sysmodelgen/resources/xsd/Border-styles.xsd
sysmodellibs/sysmodelgen/resources/xsd/Colours.xsd
sysmodellibs/sysmodelgen/resources/xsd/Levels.xsd
sysmodellibs/sysmodelgen/resources/xsd/Localisation.xsd
sysmodellibs/sysmodelgen/resources/xsd/Patterns.xsd
sysmodellibs/sysmodelgen/resources/xsd/Shapes.xsd
sysmodellibs/sysmodelgen/rsc/installed/Xalan/Xalan-C_1_8.dll
sysmodellibs/sysmodelgen/rsc/installed/Xalan/Xalan.exe
sysmodellibs/sysmodelgen/rsc/installed/Xalan/XalanMessages_1_8.dll
sysmodellibs/sysmodelgen/rsc/installed/Xalan/xerces-c_2_5_0.dll
sysmodellibs/sysmodelgen/src/LogItem.pm
sysmodellibs/sysmodelgen/src/Logger.pm
sysmodellibs/sysmodelgen/src/common/LogItem.pm
sysmodellibs/sysmodelgen/src/common/Logger.pm
sysmodellibs/sysmodelgen/src/old/resources/auxiliary/Example-shapes.xml
sysmodellibs/sysmodelgen/src/old/resources/auxiliary/Levels.xml
sysmodellibs/sysmodelgen/src/old/resources/auxiliary/Levels91.xml
sysmodellibs/sysmodelgen/src/old/resources/auxiliary/Shapes.xml
sysmodellibs/sysmodelgen/src/old/resources/auxiliary/SystemInfo.xml
sysmodellibs/sysmodelgen/src/old/resources/auxiliary/display-names.xml
sysmodellibs/sysmodelgen/src/old/resources/auxiliary/system_model_colors.xml
sysmodellibs/sysmodelgen/src/old/resources/xsd/Border-shapes.xsd
sysmodellibs/sysmodelgen/src/old/resources/xsd/Border-styles.xsd
sysmodellibs/sysmodelgen/src/old/resources/xsd/Colours.xsd
sysmodellibs/sysmodelgen/src/old/resources/xsd/Levels.xsd
sysmodellibs/sysmodelgen/src/old/resources/xsd/Localisation.xsd
sysmodellibs/sysmodelgen/src/old/resources/xsd/Patterns.xsd
sysmodellibs/sysmodelgen/src/old/resources/xsd/Shapes.xsd
sysmodellibs/sysmodelgen/src/old/svg/Draw.xsl
sysmodellibs/sysmodelgen/src/old/svg/DrawSvg.pl
sysmodellibs/sysmodelgen/src/old/svg/DrawSvg.pm
sysmodellibs/sysmodelgen/src/old/svg/Legend.xsl
sysmodellibs/sysmodelgen/src/old/svg/Model.xsl
sysmodellibs/sysmodelgen/src/old/svg/ModelTemplate.mid.xml
sysmodellibs/sysmodelgen/src/old/svg/ModelTemplate.older.xml
sysmodellibs/sysmodelgen/src/old/svg/ModelTemplate.xml
sysmodellibs/sysmodelgen/src/old/svg/Overlay.xsl
sysmodellibs/sysmodelgen/src/old/svg/Postprocess.xsl
sysmodellibs/sysmodelgen/src/old/svg/Shapes.xsl
sysmodellibs/sysmodelgen/src/old/svg/output-csv.xsl
sysmodellibs/sysmodelgen/src/old/svg/output-sysdef.xsl
sysmodellibs/sysmodelgen/src/old/svg/sysdefdowngrade.xsl
sysmodellibs/sysmodelgen/src/old/svg/validate-raw.xsl
sysmodellibs/sysmodelgen/src/old/svg/validate.xsl
sysmodellibs/sysmodelgen/src/svg/Draw.xsl
sysmodellibs/sysmodelgen/src/svg/DrawSvg.pl
sysmodellibs/sysmodelgen/src/svg/DrawSvg.pm
sysmodellibs/sysmodelgen/src/svg/Legend.xsl
sysmodellibs/sysmodelgen/src/svg/Model.xsl
sysmodellibs/sysmodelgen/src/svg/ModelTemplate.mid.xml
sysmodellibs/sysmodelgen/src/svg/ModelTemplate.older.xml
sysmodellibs/sysmodelgen/src/svg/ModelTemplate.xml
sysmodellibs/sysmodelgen/src/svg/Overlay.xsl
sysmodellibs/sysmodelgen/src/svg/Postprocess.xsl
sysmodellibs/sysmodelgen/src/svg/Shapes.xsl
sysmodellibs/sysmodelgen/src/svg/output-csv.xsl
sysmodellibs/sysmodelgen/src/svg/output-sysdef.xsl
sysmodellibs/sysmodelgen/src/svg/validate-raw.xsl
sysmodellibs/sysmodelgen/src/svg/validate.xsl
Binary file sysmodellibs/sysmodelgen/docs/SystemModelToolkitInstaller_main.jpg has changed
--- a/sysmodellibs/sysmodelgen/docs/dep.css	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-body {
-	background: white;
-}
-
-table {
-	border-width:1;
-	border-color:#006699;
-	border-collapse:collapse;
-}
-
-td {
-	border-width:1;
-	border-color:#bebebe;
-	border-collapse:collapse;
-}
-
-tr {
-	border-width:1;
-	border-color:#bebebe;
-	border-collapse:collapse;
-}
-
-table.toc {
-	border-width:0;
-	border-color:#006699;
-	border-collapse:collapse;
-}
-
-td.toc {
-	border-width:0;
-	border-color:#bebebe;
-	border-collapse:collapse;
-}
-
-tr.toc {
-	height:10px;
-	border-width:0;
-	border-color:#bebebe;
-	border-collapse:collapse;
-}
-
-a:hover {
-    text-decoration:underline;
-    color:#27408b;
-} 
-
-a {
-    text-decoration:none;
-    color:#006699;
-} 
-
-a.heading1 {
-    text-decoration:none;
-    color:#000000;
-} 
-
-a.heading2 {
-    text-decoration:none;
-    color:#000000;
-} 
-
-a.heading3 {
-    text-decoration:none;
-    color:#ffffff;
-} 
-
-a.heading4 {
-    text-decoration:none;
-    color:#006699;
-} 
-
-hr.separator {
-    height: 1px;
-    color: #bebebe;
-}
-
-hr {
-    height: 1px;
-    color: #cdaa7d;
-}
-
-ol {
-	color: 
-}
-
-li { 
-	margin: 0em;
-	color:black;
-}
-
-p { 
-	margin: 0.5em
-}
-
-img {
-	vertical-align:middle;
-}
--- a/sysmodellibs/sysmodelgen/docs/sample_drawsvg.ini	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-
-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 = 
--- a/sysmodellibs/sysmodelgen/installer/SystemModelToolkit.nsi	Tue Aug 10 14:29:28 2010 +0300
+++ b/sysmodellibs/sysmodelgen/installer/SystemModelToolkit.nsi	Wed Oct 13 14:00:36 2010 +0100
@@ -3,7 +3,7 @@
 
 ; HM NIS Edit Wizard helper defines
 !define PRODUCT_NAME "SystemModelToolkit"
-!define PRODUCT_VERSION "1.1.8"
+!define PRODUCT_VERSION "1.1.9"
 !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}"
@@ -51,40 +51,63 @@
 
   SetOutPath "$INSTDIR"
   SetOverwrite try
-  File "..\src\svg\DrawSvg.pl"
-  File "..\src\svg\distribution.policy"
+  File "..\src\old\svg\DrawSvg.pl"
 
-  SetOutPath "$INSTDIR\svg"
+  SetOutPath "$INSTDIR\src\old\svg"
   SetOverwrite try
-  File "..\src\svg\Model.xsl"
-  File "..\src\svg\Draw.xsl"
-  File "..\src\svg\Legend.xsl"
-  File "..\src\svg\DrawSvg.pm"
-  File "..\src\svg\ModelTemplate.xml"
-  File "..\src\svg\ModelTemplate.older.xml"
-  File "..\src\svg\Overlay.xsl"
-  File "..\src\svg\Postprocess.xsl"
-  File "..\src\svg\Shapes.xsl"
+  File "..\src\old\svg\Draw.xsl"
+  File "..\src\old\svg\DrawSvg.pl"
+  File "..\src\old\svg\DrawSvg.pm"
+  File "..\src\old\svg\Legend.xsl"
+  File "..\src\old\svg\Model.xsl"
+  File "..\src\old\svg\ModelTemplate.mid.xml"
+  File "..\src\old\svg\ModelTemplate.older.xml"
+  File "..\src\old\svg\ModelTemplate.xml"
+  File "..\src\old\svg\output-csv.xsl"
+  File "..\src\old\svg\output-sysdef.xsl"
+  File "..\src\old\svg\Overlay.xsl"
+  File "..\src\old\svg\Postprocess.xsl"
+  File "..\src\old\svg\Shapes.xsl"
+  File "..\src\old\svg\sysdefdowngrade.xsl"
+  File "..\src\old\svg\validate-raw.xsl"
+  File "..\src\old\svg\validate.xsl"
+
+  SetOutPath "$INSTDIR\src\old\resources\auxiliary"
+  SetOverwrite try
+  File "..\src\old\resources\auxiliary\display-names.xml"
+  File "..\src\old\resources\auxiliary\Example-shapes.xml"
+  File "..\src\old\resources\auxiliary\Levels.xml"
+  File "..\src\old\resources\auxiliary\Levels91.xml"
+  File "..\src\old\resources\auxiliary\Shapes.xml"
+  File "..\src\old\resources\auxiliary\system_model_colors.xml"
+  File "..\src\old\resources\auxiliary\SystemInfo.xml"
 
 
-  SetOutPath "$INSTDIR\common"
+  SetOutPath "$INSTDIR\src\old\resources\xsd"
   SetOverwrite try
-  File "..\src\common\DepConstants.pm"
-  File "..\src\common\Logger.pm"
-  File "..\src\common\LogItem.pm"
-  File "..\src\common\distribution.policy"
+  File "..\src\old\resources\xsd\Border-shapes.xsd"
+  File "..\src\old\resources\xsd\Border-styles.xsd"
+  File "..\src\old\resources\xsd\Colours.xsd"
+  File "..\src\old\resources\xsd\Levels.xsd"
+  File "..\src\old\resources\xsd\Localisation.xsd"
+  File "..\src\old\resources\xsd\Patterns.xsd"
+  File "..\src\old\resources\xsd\Shapes.xsd"
 
-  SetOutPath "$INSTDIR\resources\installed\Xalan"
+  
+  SetOutPath "$INSTDIR\src"
   SetOverwrite try
-  File "..\resources\installed\Xalan\DISTRIBUTION.POLICY"
-  File "..\resources\installed\Xalan\Xalan-C_1_8.dll"
-  File "..\resources\installed\Xalan\Xalan.exe"
-  File "..\resources\installed\Xalan\XalanMessages_1_8.dll"
-  File "..\resources\installed\Xalan\xerces-c_2_5_0.dll"
+  File "..\src\Logger.pm"
+  File "..\src\LogItem.pm"
+
+  SetOutPath "$INSTDIR\rsc\installed\Xalan"
+  SetOverwrite try
+  File "..\rsc\installed\Xalan\Xalan-C_1_8.dll"
+  File "..\rsc\installed\Xalan\Xalan.exe"
+  File "..\rsc\installed\Xalan\XalanMessages_1_8.dll"
+  File "..\rsc\installed\Xalan\xerces-c_2_5_0.dll"
 
   SetOutPath "$INSTDIR\resources\auxiliary"
   SetOverwrite try
-  File "..\resources\auxiliary\DISTRIBUTION.POLICY"
   File "..\resources\auxiliary\system_model_colors.xml"
   File "..\resources\auxiliary\display-names.xml"
   File "..\resources\auxiliary\Levels.xml"
@@ -93,16 +116,6 @@
   File "..\resources\auxiliary\Example-shapes.xml"
   File "..\resources\auxiliary\SystemInfo.xml"
 
-  SetOutPath "$INSTDIR\docs"
-  SetOverwrite try
-  File "..\docs\Building the System Model.doc"
-  File "..\docs\Customising the System Model Presentation.doc"
-  File "..\docs\distribution.policy"
-  File "..\docs\dep.css"
-  File "..\docs\guide.css"
-  File "..\docs\sample_drawsvg.ini"
-  File "..\docs\SystemModelToolkitInstaller_main.jpg"
-  File "..\docs\user_guide_system_model_toolkit.html"
 
 
 SectionEnd
@@ -134,50 +147,46 @@
 Section Uninstall
 
   Delete "$INSTDIR\uninst.exe"
-  Delete "$INSTDIR\DrawSvg.pl"
-  Delete "$INSTDIR\distribution.policy"
-  Delete "$INSTDIR\svg\Draw.xsl"
-  Delete "$INSTDIR\svg\Legend.xsl"
-  Delete "$INSTDIR\svg\DrawSvg.pm"
-  Delete "$INSTDIR\svg\Model.xsl"
-  Delete "$INSTDIR\svg\ModelTemplate.xml"
-  Delete "$INSTDIR\svg\ModelTemplate.older.xml"
-  Delete "$INSTDIR\svg\Overlay.xsl"
-  Delete "$INSTDIR\svg\Postprocess.xsl"
-  Delete "$INSTDIR\svg\Shapes.xsl"
-  Delete "$INSTDIR\common\DepConstants.pm"
-  Delete "$INSTDIR\common\Logger.pm"
-  Delete "$INSTDIR\common\LogItem.pm"
-  Delete "$INSTDIR\common\distribution.policy"
-  Delete "$INSTDIR\resources\installed\Xalan\DISTRIBUTION.POLICY"
-  Delete "$INSTDIR\resources\installed\Xalan\Xalan-C_1_8.dll"
-  Delete "$INSTDIR\resources\installed\Xalan\Xalan.exe"
-  Delete "$INSTDIR\resources\installed\Xalan\XalanMessages_1_8.dll"
-  Delete "$INSTDIR\resources\installed\Xalan\xerces-c_2_5_0.dll"
-  Delete "$INSTDIR\resources\auxiliary\DISTRIBUTION.POLICY"
-  Delete "$INSTDIR\resources\auxiliary\system_model_colors.xml"
-  Delete "$INSTDIR\resources\auxiliary\display-names.xml"
-  Delete "$INSTDIR\resources\auxiliary\Levels.xml"
-  Delete "$INSTDIR\resources\auxiliary\Levels91.xml"
-  Delete "$INSTDIR\resources\auxiliary\Shapes.xml"
-  Delete "$INSTDIR\resources\auxiliary\Example-shapes.xml"
-  Delete "$INSTDIR\resources\auxiliary\SystemInfo.xml"
-  Delete "$INSTDIR\docs\Building the System Model.doc"
-  Delete "$INSTDIR\docs\Customising the System Model Presentation.doc"
-  Delete "$INSTDIR\docs\distribution.policy"
-  Delete "$INSTDIR\docs\dep.css"
-  Delete "$INSTDIR\docs\guide.css"
-  Delete "$INSTDIR\docs\sample_drawsvg.ini"
-  Delete "$INSTDIR\docs\SystemModelToolkitInstaller_main.jpg"
-  Delete "$INSTDIR\docs\user_guide_system_model_toolkit.html"
+  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\src\old\resources\auxiliary\display-names.xml"
+  Delete "$INSTDIR\src\old\resources\auxiliary\Example-shapes.xml"
+  Delete "$INSTDIR\src\old\resources\auxiliary\Levels.xml"
+  Delete "$INSTDIR\src\old\resources\auxiliary\Levels91.xml"
+  Delete "$INSTDIR\src\old\resources\auxiliary\Shapes.xml"
+  Delete "$INSTDIR\src\old\resources\auxiliary\system_model_colors.xml"
+  Delete "$INSTDIR\src\old\resources\auxiliary\SystemInfo.xml"
+  Delete "$INSTDIR\src\old\resources\xsd\Border-shapes.xsd"
+  Delete "$INSTDIR\src\old\resources\xsd\Border-styles.xsd"
+  Delete "$INSTDIR\src\old\resources\xsd\Colours.xsd"
+  Delete "$INSTDIR\src\old\resources\xsd\Levels.xsd"
+  Delete "$INSTDIR\src\old\resources\xsd\Localisation.xsd"
+  Delete "$INSTDIR\src\old\resources\xsd\Patterns.xsd"
+  Delete "$INSTDIR\src\old\resources\xsd\Shapes.xsd"
+  Delete "$INSTDIR\src\old\svg\Draw.xsl"
+  Delete "$INSTDIR\src\old\svg\DrawSvg.pl"
+  Delete "$INSTDIR\src\old\svg\DrawSvg.pm"
+  Delete "$INSTDIR\src\old\svg\Legend.xsl"
+  Delete "$INSTDIR\src\old\svg\Model.xsl"
+  Delete "$INSTDIR\src\old\svg\ModelTemplate.mid.xml"
+  Delete "$INSTDIR\src\old\svg\ModelTemplate.older.xml"
+  Delete "$INSTDIR\src\old\svg\ModelTemplate.xml"
+  Delete "$INSTDIR\src\old\svg\output-csv.xsl"
+  Delete "$INSTDIR\src\old\svg\output-sysdef.xsl"
+  Delete "$INSTDIR\src\old\svg\Overlay.xsl"
+  Delete "$INSTDIR\src\old\svg\Postprocess.xsl"
+  Delete "$INSTDIR\src\old\svg\Shapes.xsl"
+  Delete "$INSTDIR\src\old\svg\sysdefdowngrade.xsl"
+  Delete "$INSTDIR\src\Logger.pm"
+  Delete "$INSTDIR\src\LogItem.pm"
 
-  RMDir "$INSTDIR\svg"
+  RMDir "$INSTDIR\src\old\svg"
   RMDir "$INSTDIR\common"
-  RMDir "$INSTDIR\resources\installed\Xalan"
-  RMDir "$INSTDIR\resources\installed"
-  RMDir "$INSTDIR\resources\auxiliary"
-  RMDir "$INSTDIR\resources"
-  RMDir "$INSTDIR\docs"
+  RMDir "$INSTDIR\src\old\resources\auxiliary"
+  RMDir "$INSTDIR\src\old\resources"
+  RMDir "$INSTDIR\rsc"
   RMDir "$INSTDIR"
 
   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
--- a/sysmodellibs/sysmodelgen/resources/auxiliary/Example-shapes.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-<shapes xmlns:s="http://www.w3.org/2000/svg">
-
-	<s:defs>   
-		<!-- bright circle pattern -->
-		<s:radialGradient id="new" gradientUnits="userSpaceOnUse" cx="10" cy="10" r="14">
-			<s:stop offset="0%" stop-color="white" stop-opacity="1"/>
-			<s:stop offset="100%" stop-opacity="0" stop-color="white" />
-		</s:radialGradient>
-
-		<!-- diagonal line pattern -->
-		<s:linearGradient id="ref" spreadMethod="repeat" gradientUnits="userSpaceOnUse" x1="0%" x2="15%" y1="0%" y2="15%">
-			<s:stop offset="0%" stop-opacity="0" stop-color="white" />
-			<s:stop offset="20%" stop-color="white" stop-opacity="1" />
-			<s:stop offset="40%" stop-opacity="0" stop-color="white" />
-			<s:stop offset="100%" stop-opacity="0" stop-color="white" />
-		</s:linearGradient>
-	</s:defs>
-
-	<!-- for some processors, /*/systemModel is much faster than //systemModel -->
-	
-	<!-- borders to use for OSD components -->
-	<!-- bracket, function or axis notation not allowed in use. Can only use blah/blah/@blah form -->
-	<borders use="s12[@ver=/*/systemModel/@ver]/@osd" label="Sched 12 Category" show-unused="yes">
-		<border type="box"/>
-		<border value="OS" type="box-clipLT"  label="Optional Symbian"/>
-		<border value="CS"  type="box-clipLB" label="Common Symbian"/>
-		<border value="CR"  type="box-clipRB"  label="Common Replace&#xad;able"/>
-		<border value="OR" viewBox="0 0 20 20"  label="Optional Replace&#xad;able">
-  			<s:path d="M 0 0 L 0 20 L 20 20 L 20 5 L 15 0 z" stroke="black" />
-  		</border>	
-		<border value="T-R" type="box-clipAll" label="Refer&#xad;ence/Test"/>
-	</borders>
-	
-	<patterns  show-unused="yes"> <!-- this is very slow, don't check if used -->
-		<overlay rule="s12[@ver=/*/systemModel/@ver]/@ref='true' or @ref='true'" type="striped-diag-up" label="Reference Compo&#xad;nent"/>
-		<overlay rule="@since = /*/systemModel/@ver or @introduced = /*/systemModel/@ver" type="radial-grad" label="New in {@ver}"/>
-	</patterns>
-	
-	<styles>
-		<style>stroke-width: 0.4</style>
-		<style rule="@plugin='true'" label="Plugin Compo&#xad;nent">stroke-width: 2</style>
-	</styles>
-<!--	<styles>
-		<style rule="Build and not(Build/*)" label="No build info">stroke-dasharray: 2,3; </style>
-	</styles> -->
-	 
-	 
-	<colors default="grey" use="@ts" label="Technology Streams">
-		 <color label="Connectivity Services" value="#cfb53b"/>
-		 <color label="Internet and Web Services" value="#ff8f68"/>
-		 <color label="Location Based Services" value="green"/>
-		 <color label="Java" value="#c0d9d9"/>
-		 <color label="Messaging" value="red"/>
-		 <color label="Multimedia" value="#8fbc8f"/>
-		 <color label="PIM Application Services" value="#ffff80"/>
-		 <color label="UI Frameworks" value="#00ff00"/>
-		 <color label="OS Packaging" value="#a29040"/>
-		 <color label="Platform Tools" value="#BAC97E"/>
-		 <color label="Software Engineering Tools" value="#56a1a1"/>
-		 <color label="Technical Documentation" value="#6A5182"/>
-		 <color label="Test Product" value="#544A38"/>
-		 <color label="System Engineering" value="#615FAD"/>
-		 <color label="Base Services" value="#8f8fbd"/>
-		 <color label="Baseband Adaption" value="#5f9f9f"/>
-		 <color label="Comms Framework" value="#527f76"/>
-		 <color label="Crypto Services" value="yellow"/>
-		 <color label="Development Boards" value="#934900"/>
-		 <color label="Kernel" value="#00ffff"/>
-		 <color label="Multimedia Protocols" value="#eaadea"/>
-		 <color label="IP Networking" value="#ff7f00"/>
-		 <color label="Open Environment" value="#817485"/>
-		 <color label="Peripherals" value="#008000"/>
-		 <color label="Persistent Data Services" value="#993366"/>
-		 <color label="Shortlink" value="#db7093"/>
-		 <color label="Telephony Services" value="#3299cc"/>
-		 <color label="Text and I18n Services" value="#9f9f5f"/> 
-	</colors>
-	<!-- these can also go in the model.xml in a legend element -->
-	<examples>
-		<cmp color="Graphics">Plug-in</cmp>
-		<cmp overlay="Reference Compo&#xad;nent" border="Common Symbian">Reference</cmp>
-		<cmp overlay="New in {@ver}">New {@ver}</cmp>
-		<!--<cmp style="No build info">No build info</cmp>	-->	
-	</examples>
-
-<!-- stuff without rule is the fallback option (used only if others are not used) -->
-</shapes>
--- a/sysmodellibs/sysmodelgen/resources/auxiliary/Levels.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<levels>
-<block name="Generic OS Services" levels="Libraries Services"/>
-	<collection name="Generic Services" level="Services"/>
-	<collection name="Generic Libraries" level="Libraries"/>	
-</levels>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/resources/auxiliary/Levels91.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-<?xml version="1.0"?>
-<levels>
-<block name="Generic OS Services" levels="Libraries Services"/>
-	<collection name="Generic Services" level="Services"/>
-	<collection name="Generic Libraries" level="Libraries"/>	
-
-
-<layer name="Kernel Services and Hardware Interface" levels="Hardware-dependent Hardware-independent"/>
-  	<collection name="ASSP" level="Hardware-dependent"/>
-  	<collection name="Kernel Services"  level="Hardware-independent"/>
-  	<collection name="Logical Device Drivers" level="Hardware-independent"/>
-  	<collection name="Variant" level="Hardware-dependent"/>
-  	<collection name="Localisation" level="Hardware-independent"/>
-  	<collection name="Screen Driver" level="Hardware-dependent"/>
-  	
-  <layer name="Base Services" levels="Kernel-interface System-interface"/>
-  	<collection name="Low Level Libraries and Frameworks" level="System-interface"/>
-  	<collection name="User Library and File Server" level="Kernel-interface"/>
-  	<collection name="User Side Hardware Abstraction" level="Kernel-interface"/>
-  	<collection name="Text Mode Shell" level="System-interface"/>
-  
-  <layer name="OS Services"  levels="hardware-interface plugin framework server application-interface"/>
-  	<collection name="Comms Process and Settings"   level="server"/>
-  	<collection name="Telephony Utilities" level="application-interface"/>
-  	<collection name="Telephony Server" level="server"/>
-  	<collection name="SMS Protocol Plugins" level="framework"/>
-  	<collection name="SMS Utilities" level="application-interface"/>
-  	<collection name="Telephony Server Plugins" level="plugin"/>
-  	<collection name="Telephony Reference Platform"  level="plugin"/>
-  
-  	<collection name="Serial Comms Server"  level="application-interface"/>
-  	<collection name="Short Link" level="server"/>
-  	<collection name="OBEX" level="application-interface"/>
-  	<collection name="USB Manager" level="application-interface"/>
-  	<collection name="Short Link Protocol Plugins" level="framework"/>
-  	<collection name="Serial Comms Server Plugins"  level="plugin"/>
-  
-  	<collection name="TCP/IP Security" level="application-interface"/>
-  	<collection name="TCP/IP Utilities" level="application-interface"/>
-  	<collection name="Sockets Server" level="server"/>
-  	<collection name="Network Protocol Plugins" level="framework"/>
-  	<collection name="Networking Plugins"  level="plugin"/>
-  	<collection name="Link Layer Control" level="hardware-interface"/>
-  	<collection name="WAP Stack" level="application-interface"/>
-  	<collection name="QoS Interface"  level="server"/>
-  
-  	<collection name="Multimedia" level="application-interface"/>
-  	<collection name="Windowing Framework" level="server"/>
-  	<collection name="OpenGL ES" level="server"/>
-  	<collection name="Graphics and Printing Services" level="framework"/>
-  	<collection name="Graphics Device Interface"  level="plugin"/>
-  	<collection name="OpenVG" level="plugin"/>
-  	<collection name="EGL"  level="plugin"/>
-  
-  	<collection name="Service Providers" level="server"/>
-  	<collection name="Service Framework" level="framework"/>
-  	<collection name="Connectivity PC Side" level="framework"/>
-  	<collection name="Device Connection"  level="plugin"/>
-  
-  <layer name="Application Services"  levels="generic specific"/>
-  	<collection name="PIM App Services" level="specific"/>
-  	<collection name="PIM App Support" level="generic"/>
-  	<collection name="Office App Engines" level="specific"/>
-  	<collection name="Other App Services" level="specific"/>
-  	<collection name="Messaging App Support" level="generic"/>
-  	<collection name="Content Handling" level="specific"/>
-  	<collection name="Data Sync Services" level="specific"/>
-  	<collection name="Device Provisioning" level="specific"/>
-  	<collection name="Client Provisioning" level="specific"/>
-  	<collection name="Internet and Web Application Support" level="generic"/>
-  	<collection name="Application Launch Services" level="generic"/>
-  	<collection name="Application Framework" level="specific"/>
-  	<collection name="Printing Support" level="generic"/>
-  	<collection name="Multimedia Protocols" level="generic"/>
-  	<collection name="Text Rendering" level="generic"/>
-  
-  <layer name="Programming Support" levels="config package profile"/>
-  	<collection name="MIDP 2.0 Profile" level="profile"/>
-  	<collection name="MIDP 2.0 Packages" level="package"/>
-  	<collection name="CLDC 1.1" level="config"/>
-  	<collection name="Bluetooth and SMS Push" level="config"/>
-  	<collection name="Low Level Plugins"  level="config"/>
-  	<collection name="Virtual Machine" level="package"/>
-</levels>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/resources/auxiliary/Shapes.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<shapes xmlns:s="http://www.w3.org/2000/svg">
-	
-	<!-- borders to use for OSD components -->
-	<borders use="s12/@osd" label="Sched 12 Category" show-unused="yes">
-		<border type="box"/>
-		<border value="OS" type="box-clipLT" label="Optional Symbian"/>
-		<border value="CS"  type="box-clipLB" label="Common Symbian"/>
-		<border value="CR"  type="box-clipRB" label="Common Replace&#xad;able"/>
-		<border value="OR" type="box-clipRT" label="Optional Replace&#xad;able"/>
-		<border value="T-R" type="box-clipAll" label="Refer&#xad;ence/Test"/>
-	</borders>
-	
-	<patterns show-unused="yes"> <!-- this could be very slow, don't check if used -->
-		 <overlay rule="@deprecated and (VERSION(@deprecated) &lt;=  VERSION())" label="Depre&#xad;cated Compo&#xad;nent" type="big-X"/> 
-		<overlay rule="s12/@ref='true' or @ref='true'" type="striped-diag-up" label="Reference Compo&#xad;nent"/>
-		<overlay rule="@since = /*/systemModel/@ver or @introduced = /*/systemModel/@ver" type="radial-grad" label="New in {@ver}"/>
-	</patterns>
-	
-	<styles>
-		<style>stroke-width: 0.4</style>
-		<style rule="@plugin='true'" label="Plugin Compo&#xad;nent">stroke-width: 2</style>
-	</styles>
-</shapes>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/resources/auxiliary/SystemInfo.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,362 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<model>
- <c removed="9.2" name="Application Installer"/>
- <c introduced="8.0" name="Content Handling Framework"/>
- <c name="Java MIDlet Installer" introduced="7.0s"/>
- <c name="SIS Installer" introduced="7.0s"/>
- <c introduced="9.1" name="System Starter"/>
- <c name="View Server" introduced="6.0"/>
- <c plugin="Y" name="BIO Messaging Parsers"/>
- <c introduced="8.0" name="Content Access Frmwrk. for DRM"/>
- <c introduced="8.0" name="Content Access Framework to support DRM"/>
- <c introduced="8.0" name="Device Management Plugins" plugin="Y"/>
- <c introduced="9.1" name="Content Access Framework for DRM"/>
- <c name="Reference DRM Agent" ref="true" introduced="8.0"/>
- <c introduced="8.0" plugin="Y" name="MMF Recognisers"/>
- <c name="SMIL Parser" introduced="8.0"/>
- <c plugin="Y" name="WAP Push Handlers" introduced="6.2"/>
- <c plugin="Y" name="Web Recognisers"/>
- <c removed="" plugin="Y" name="Data Sync Plugins"/>
- <c introduced="8.0" name="Sync Initiation"/>
- <c introduced="8.0" name="Device Management Framework"/>
- <c plugin="Y" introduced="9.1" name="Device Management Adaptors"/>
- <c introduced="9.1" name="Client Provisioning Framework"/>
- <c introduced="9.1" plugin="Y" name="Client Provisioning Adaptors"/>
- <c name="Bookmark Support" introduced="9.1"/>
- <c name="FTP Engine" introduced="6.0"/>
- <c plugin="Y" name="HTTP Filter Plugins"/>
- <c plugin="Y" name="HTTP Protocol Plugins" introduced="6.2"/>
- <c name="HTTP Transport Framework" introduced="6.2"/>
- <c name="URI Permission Services" introduced="9.4"/>
- <c name="HTTP Transport Plugins" plugin="Y"/>
- <c name="HTTP Utilities Library" introduced="6.2"/>
- <c name="Network Address and Port Translation" introduced="9.4" plugin="Y"/>
- <c name="Telnet Engine" introduced="6.0"/>
- <c name="WAP Push Framework" introduced="6.1"/>
- <c plugin="Y" name="WAP Push MTM"/>
- <c plugin="Y" name="BIO Watchers"/>
- <c plugin="Y" introduced="8.1" name="CDMA MTM"/>
- <c plugin="Y" name="IMAP4 MTM"/>
- <c plugin="Y" name="OBEX MTMs"/>
- <c plugin="Y" name="POP3 MTM"/>
- <c plugin="Y" name="Scheduled Send MTM"/>
- <c outsource="9.0" plugin="Y" name="SMS MTM"/>
- <c plugin="Y" name="SMTP MTM"/>
- <c introduced="9.0" name="RTP"/>
- <c outsource="9.1" introduced="9.1" name="SIP Framework"/>
- <c name="SIP Connection Provider Plugins" introduced="9.2"/>
- <c name="Convert" plugin="Y" introduced="5.0" deprecated="9.3"/>
- <c name="Data Engine" introduced="5.0" deprecated="9.3"/>
- <c name="Sheet Engine" introduced="5.0" deprecated="9.3"/>
- <c name="Word Engine" introduced="5.0" deprecated="9.3"/>
- <c name="Help" introduced="6.0"/>
- <c introduced="9.1" name="Timezone"/>
- <c name="World Server" introduced="7.0" deprecated="9.1"/>
- <c name="Agenda Model" introduced="5.0" deprecated="9.1"/>
- <c name="Calendar" introduced="9.2"/>
- <c plugin="Y" name="Agenda Versit Plugin"/>
- <c name="Contacts Model" introduced="5.0"/>
- <c name="Alarm Server" introduced="7.0"/>
- <c introduced="8.1" name="Backup Restore Notification"/>
- <c outsource="9.0" name="Chinese Calendar Converter" introduced="6.1"/>
- <c name="Other File Converter Plugins" plugin="Y" deprecated="9.3"/>
- <c plugin="Y" name="File Converter Plugins"/>
- <c name="vCard and vCal" introduced="5.0"/>
- <c introduced="ER5" name="Application Utilities"/>
- <c name="Central Repository 2" introduced="8.1"/>
- <c name="Central Repository" introduced="7.0s"/>
- <c plugin="Y" name="Character Encoding and Conversion Plugins"/>
- <c name="Feature Registry" introduced="9.2" deprecated="9.5"/>
- <c name="DBMS Emulation Library" introduced="9.3"/>
- <c outsource="9.0" plugin="Y" name="Media Device Framework Plugins"/>
- <c introduced="6.2" name="Plugin Framework"/>
- <c name="Power, Memory and Disk Management" introduced="7.0"/>
- <c name="Power and Memory Notification Service" introduced="6.0"/>
- <c name="Domain Manager" introduced="7.0"/>
- <c name="Hardware Resources Manager" introduced="9.5"/>
- <c plugin="Y" name="WBXML Parser" introduced="7.0s"/>
- <c name="XML Framework" introduced="7.0s"/>
- <c plugin="Y" name="XML Parser" introduced="7.0s"/>
- <c introduced="6.0" name="Zip Compression Library"/>
- <c introduced="9.1" plugin="Y" name="FAT Filename Conversion Plugins"/>
- <c plugin="Y" name="File Systems"/>
- <c plugin="Y" name="ROFS File System"/>
- <c plugin="Y" name="USB Mass Storage File System"/>
- <c plugin="Y" name="LFFS File System"/>
- <c plugin="Y" name="NTFS File System"/>
- <c name="ROM File System" plugin="Y"/>
- <c name="LFFS File System" plugin="Y"/>
- <c name="FAT32 File System" plugin="Y"/>
- <c name="FAT File System" plugin="Y"/>
- <c name="Composite File System" plugin="Y"/>
- <c name="ISO9660 File System" plugin="Y"/>
- <c plugin="Y" name="NAND Flash Translation Layer" introduced="7.0s" deprecated="9.1"/>
- <c plugin="Y" name="File System Plugins"/>
- <c plugin="Y" name="Bluetooth 1.0" introduced="8.0">
-  <location>Programming Support/Java J2ME/Bluetooth and SMS Push</location>
- </c>
- <c plugin="Y" name="WMA 1.1">
-  <location>Programming Support/Java J2ME/Bluetooth and SMS Push</location>
- </c>
- <c plugin="Y" name="LCDUI Plugin"/>
- <c plugin="Y" name="Runtime Plugin"/>
- <c name="Bluetooth 1.0" introduced="8.0">
-  <location>Programming Support/Java J2ME/MIDP 2.0 Packages</location>
- </c>
- <c name="JTWI 1.0" introduced="8.0"/>
- <c outsource="9.1" name="Mobile 3D 1.0" introduced="8.0"/>
- <c name="Mobile Media API 1.1" introduced="8.0"/>
- <c name="WMA 1.1">
-  <location>Programming Support/Java J2ME/MIDP 2.0 Packages</location>
- </c>
- <c introduced="9.1" plugin="Y" ref="true" name="MIDP GSM Security RP"/>
- <c plugin="Y" ref="true" name="Security Policy"/>
- <c introduced="9.0" ref="true" name="OMAP 1623"/>
- <c name="Kernel Architecture 2" introduced="8.0"/>
- <c name="SD Card Driver" ref="true" plugin="Y"/>
- <c plugin="Y" outsource="9.0" ref="true" name="Audio Driver" introduced="7.0s"/>
- <c plugin="Y" name="Ethernet Driver"/>
- <c plugin="Y" outsource="9.0" ref="true" name="MIDI Driver" introduced="8.0"/>
- <c plugin="Y" name="Other LDDs"/>
- <c plugin="Y" outsource="9.0" introduced="8.0" ref="true" name="Speech Driver"/>
- <c plugin="Y" name="USB Driver"/>
- <c plugin="Y" outsource="9.0" ref="true" name="Video Driver" introduced="8.0"/>
- <c plugin="Y" name="Media Drivers"/>
- <c name="Bootstrap" ref="true"/>
- <c ref="true" name="Emulator"/>
- <c ref="true" name="Lubbock Variant"/>
- <c introduced="9.0" ref="true" name="OMAP H2"/>
- <c ref="true" name="OMAP H4"/>
- <c ref="true" name="OMAP H4 Variant"/>
- <c ref="true" plugin="Y" name="PDDs"/>
- <c plugin="Y" name="Peripheral Bus Controllers"/>
- <c plugin="Y" name="Locale Support"/>
- <c plugin="Y" name="Screen Driver" introduced="6.1"/>
- <c plugin="Y" name="MMS MTM"/>
- <c name="Baseband Channel Adaptor" introduced="8.1"/>
- <c name="Inter-System Communication" introduced="9.5"/>
- <c name="Baseband Channel Adaptor for C32" plugin="Y"/>
- <c name="Baseband Channel Adaptor for ISC" plugin="Y"/>
- <c introduced="9.3" name="Wireless LAN"/>
- <c introduced="9.1" name="Bluetooth Audio Video Remote Control Profile"/>
- <c introduced="9.1" name="Bluetooth Generic Audio Video Distribution Profile"/>
- <c name="Bluetooth HCI Proxy">
-  <location note="Not shown (belongs to Short Link)"/>
- </c>
- <c outsource="No" introduced="9.1" name="Bluetooth OBEX 1.0"/>
- <c introduced="9.1" name="Cell Broadcast Services"/>
- <c name="Assabet BSP" ref="true"/>
- <c name="INTEGRATOR_CM1136" ref="true"/>
- <c name="INTEGRATOR_CM920" ref="true"/>
- <c name="INTEGRATOR_CORE" ref="true"/>
- <c outsource="No" name="Linkup BSP"/>
- <c name="IP Hook Examples" ref="true"/>
- <c name="IP Examples" ref="true"/>
- <c introduced="9.1" name="Timezone compiler"/>
- <c introduced="9.1" name="Timezone database"/>
- <c introduced="9.1" name="Timezone localization"/>
- <c name="Crypto SPI Plugins" plugin="Y" introduced="9.5"/>
- <c name="SWI Analysis Toolkit" ref="true"/>
- <c plugin="Y" name="Ethernet NIF"/>
- <c plugin="Y" name="Ethernet Over IR Packet Driver"/>
- <c plugin="Y" name="Ethernet Packet Driver"/>
- <c plugin="Y" name="PPP Compression Plugins"/>
- <c outsource="9.0" plugin="Y" name="PPP NIF"/>
- <c plugin="Y" ref="true" name="SLIP NIF"/>
- <c plugin="Y" name="Tunnel NIF"/>
- <c outsource="9.0" plugin="Y" name="Core IPSec PRT"/>
- <c name="IP Event Notifier" plugin="Y"/>
- <c outsource="9.0" plugin="Y" introduced="7.0s" name="QoS Framework PRT"/>
- <c outsource="9.0" plugin="Y" name="TCP/IPv4/v6 PRT"/>
- <c plugin="Y" name="Bluetooth PAN Profile" introduced="8.1"/>
- <c plugin="Y" name="CSD AGT"/>
- <c plugin="Y" name="GPRS/UMTS QOS PRT"/>
- <c plugin="Y" name="NULL AGT"/>
- <c plugin="Y" name="PSD AGT"/>
- <c name="Connection Provider Plugin" plugin="Y"/>
- <c removed="9.1" name="Connection AGT" plugin="Y"/>
- <c name="Subconnection Parameters" plugin="Y"/>
- <c ref="true" name="WAP Short Stack" introduced="8.0"/>
- <c plugin="Y" name="Bluetooth CSY"/>
- <c plugin="Y" name="IrDA CSY"/>
- <c plugin="Y" name="Serial Port CSY"/>
- <c plugin="Y" name="USB CSY"/>
- <c name="Bluetooth Protocol Client APIs" introduced="8.0"/>
- <c name="HCI Framework" introduced="9.2"/>
- <c introduced="9.1" name="Remote Control Framework"/>
- <c ref="true" name="Bluetooth HCI"/>
- <c plugin="Y" name="Bluetooth Stack PRT"/>
- <c plugin="Y" name="IrDA PRT"/>
- <c name="CDMA SMS Stack" plugin="Y" introduced="8.1"/>
- <c name="SMS Stack" plugin="Y"/>
- <c plugin="Y" introduced="8.1" name="CDMA SMS Plugins"/>
- <c plugin="Y" introduced="8.1" name="CDMA WAP Protocol"/>
- <c plugin="Y" introduced="8.1" name="CDMA WAP PRT"/>
- <c plugin="Y" name="SMS PRT"/>
- <c plugin="Y" name="WAP PRT"/>
- <c ref="true" plugin="Y" name="TRP CSY"/>
- <c ref="true" plugin="Y" name="TRP TSY"/>
- <c introduced="8.1" name="Etel CDMA"/>
- <c introduced="8.1" name="ETel CDMA"/>
- <c name="ETel SIM Toolkit" introduced="6.1"/>
- <c plugin="Y" introduced="8.1" ref="true" name="CDMA TSY"/>
- <c introduced="8.1" plugin="Y" outsource="9.0" ref="true" name="MultiMode TSY"/>
- <c introduced="8.0" plugin="Y" ref="true" name="SIM TSY"/>
- <c name="Dial" deprecated="9.1"/>
- <c name="Phonebook Sync" plugin="Y"/>
- <c plugin="Y" name="Telephony Watchers"/>
- <c name="Bearer Abstraction Layer" introduced="8.0"/>
- <c introduced="8.0" name="Server Socket"/>
- <c name="Service Broker" introduced="8.0"/>
- <c name="Remote File Server" introduced="8.0"/>
- <c introduced="9.0" name="Secure Backup Engine"/>
- <c introduced="9.0" name="Backup Engine"/>
- <c introduced="9.0" name="Secure Backup Socket Server"/>
- <c name="Software Install Server" introduced="8.0"/>
- <c name="C Standard Library" introduced="ER5"/>
- <c name="Certificate and Key Management" introduced="6.0"/>
- <c name="Event Logger" introduced="6.0"/>
- <c name="Task Scheduler" introduced="6.0"/>
- <c ref="true" plugin="Y" name="FreeType Font Rasteriser"/>
- <c ref="true" name="Reference Fonts"/>
- <c ref="true" plugin="Y" name="Printer Drivers"/>
- <c removed="" ref="true" name="Reference Bitmap Fonts"/>
- <c introduced="8.0" name="Colour Palette"/>
- <c introduced="9.5" name="OpenVG Implementation" ref="true"/>
- <c introduced="9.1" name="Broadcast Tuner"/>
- <c name="Camera Framework" introduced="7.0s"/>
- <c ref="true" name="Camera" introduced="7.0s"/>
- <c ref="true" name="Camera Plugins" plugin="Y" introduced="7.0s"/>
- <c name="Imaging Frameworks" introduced="7.0s"/>
- <c name="Image Conversion Library" introduced="7.0s"/>
- <c plugin="Y" name="Imaging Plugins" introduced="7.0s"/>
- <c plugin="Y" name="Image Conversion Library Plugins" introduced="7.0s"/>
- <c name="Multimedia Framework" introduced="7.0s"/>
- <c plugin="Y" name="Multimedia Framework Plugins" introduced="7.0s"/>
- <c outsource="9.2" introduced="8.0" ref="true" plugin="Y" name="OpenGL ES"/>
- <c introduced="9.2" name="OpenGL ES Display Properties"/>
- <c name="OpenGL ES Framework" introduced="8.0"/>
- <c name="UI Look and Feel" introduced="6.0"/>
- <c name="UIKON" introduced="6.0"/>
- <c plugin="Y" name="UIKON Error Resolver Plugin" ref="true"/>
- <c name="Error Resolver Data" ref="true"/>
- <c introduced="9.1" name="Animation"/>
- <c name="BMP Animation" introduced="6.0"/>
- <c plugin="Y" name="Clock"/>
- <c name="Graphics Effects" introduced="9.2"/>
- <c name="MUX CSY" plugin="Y" ref="true"/>
- <c name="TRP AGT" plugin="Y" ref="true"/>
- <c name="User Prompt Service" introduced="9.5"/>
- <c name="Location Based Services" introduced="9.2"/>
- <c name="OBEX Extension API" introduced="9.2"/>
- <c name="Text Shaper Plugin" introduced="9.2" plugin="Y"/>
- <c name="SQL" introduced="9.3"/>
- <c name="Open Environment Core" introduced="9.4"/>
- <c name="Root Certificates" introduced="7.0s"/>
- <c name="EGL Implementation" ref="true" introduced="9.4"/>
- <c name="EGL API" ref="true" introduced="9.4"/>
- <c introduced="8.0" ref="true" name="OpenGL ES Implementation"/>
- <c introduced="8.0" ref="true" name="OpenGL ES API"/>
- <c ref="true" plugin="Y" name="iType Font Rasteriser" introduced="9.5"/>
- <c ref="true" introduced="9.5" name="OpenVG API"/>
- <c name="Phonebook Access Profile" introduced="9.2"/>
- <c name="Location Framework" introduced="9.2"/>
- <c name="LBS Plugins" introduced="9.2"/>
- <c name="LBS Network Test" introduced="9.2"/>
- <c name="Location Server" introduced="9.2"/>
- <c name="Network Request Handler" introduced="9.2"/>
- <c name="A-GPS Location Manager" introduced="9.2"/>
- <c name="Network Location Manager" introduced="9.2"/>
- <c name="Network Gateway" introduced="9.2"/>
- <c name="Network Protocol Module" introduced="9.2" plugin="Y" ref="true"/>
- <c name="MTP Framework" introduced="9.4"/>
- <c name="MTP File and Folder Provider" introduced="9.4"/>
- <c name="MTP USB Transport" introduced="9.4" plugin="Y"/>
- <c name="MTP Integration Test" introduced="9.4"/>
- <c name="TRP Dispatch Layer Plugins" plugin="Y"/>
- <c name="UTRACE" introduced="9.3" deprecated="9.4"/>
- <c name="WLDDATABASEKIT" introduced="6.0" deprecated="9.1"/>
- <c name="WLDTOOLS" introduced="5.0" deprecated="9.1"/>
- <c name="File-based Certificate and Key Stores" introduced="8.0"/>
- <c name="Surface Manager LDD" introduced="9.5"/>
- <c name="Common Graphics Headers" introduced="9.5"/>
- <c name="Graphics Composition Engine" introduced="9.5"/>
- <c name="Composition Engine Adaptation" introduced="9.5"/>
- <c name="Graphics Resource Content Update" introduced="9.5"/>
- <c name="HTML to RichText Converter" plugin="Y"/>
- <c name="File Converter Plugins" plugin="Y"/>
- <c name="RichText to HTML Converter" plugin="Y"/>
- <c introduced="9.1" name="Time Zone Server"/>
- <c introduced="9.1" name="Time Zone Compiler"/>
- <c introduced="9.1" name="Time Zone Database"/>
- <c introduced="9.1" name="Time Zone Localisation"/>
- <c name="Secure Software Install Device Tools" ref="true"/>
- <c name="CAF Recogniser Configuration" ref="true"/>
- <c plugin="Y" name="POP3 and SMTP MTM"/>
- <c name="Chart" introduced="5.0" deprecated="9.3"/>
- <c name="World Server" introduced="7.0" deprecated="9.1"/>
- <c name="World Database Kit" deprecated="9.1"/>
- <c name="World Tools" deprecated="9.1"/>
- <c name="Cotulla ASSP" ref="true"/>
- <c name="E32 Utilities" ref="true"/>
- <c name="Unistore2 Emulator Support" ref="true" introduced="9.4"/>
- <c name="Integrator Unistore2 NAND Logic Module" ref="true"/>
- <c introduced="9.0" ref="true" name="OMAP H2 BSP"/>
- <c name="Unistore2 Boot Support" ref="true"/>
- <c ref="true" name="Emulator BSP"/>
- <c name="Integrator ARM1136 Core Module" ref="true"/>
- <c name="Integrator ARM920 Core Module" ref="true"/>
- <c name="Integrator Core Modules" ref="true"/>
- <c name="Integrator Motherboard" ref="true"/>
- <c name="Integrator SSR NAND Logic Module" ref="true"/>
- <c name="Integrator XX600 Logic Module" ref="true"/>
- <c name="OMAP H2 SDIO" ref="true"/>
- <c name="OMAP H4 SDIO" ref="true"/>
- <c name="OMAP H2 Unistore2" ref="true"/>
- <c name="OMAP H4 Unistore2" ref="true"/>
- <c name="H4 Boot Loader" ref="true"/>
- <c name="OMAP H4 Mini Environment Boot Loader" ref="true"/>
- <c name="StrongArm 1100 ASSP" ref="true"/>
- <c name="System On Chip ASSP" ref="true"/>
- <c name="Template Variant" ref="true"/>
- <c name="OMAP H4 BSP" ref="true"/>
- <c name="Lubbock BSP" ref="true"/>
- <c name="SIP Params" plugin="Y"/>
- <c name="SIP Subconnection Provider" plugin="Y"/>
- <c name="SIP Connection Provider" plugin="Y"/>
- <c name="SIP Connection Plugins" plugin="Y" introduced="9.5"/>
- <c name="Data Sync Adaptors" plugin="Y"/>
- <c name="PLP Variant" deprecated="9.0"/>
- <c name="PLP Remote Link" deprecated="9.0"/>
- <c name="Event Broadcast" deprecated="9.0"/>
- <c name="OpenMAX" introduced="9.4"/>
- <c name="Multimedia Validation Suite Integration Tests" introduced="9.4"/>
- <c name="Multimedia Validation Suite Agents" introduced="9.4"/>
- <c name="Multimedia Validation Suite Application" introduced="9.4"/>
- <c name="Assabet BSP" deprecated="8.0"/>
- <c name="StrongArm 1100 ASSP" deprecated="8.0"/>
- <c name="Reference DevSound Plugins" plugin="Y"/>
- <c name="Bluetooth DevSound Plugin" plugin="Y"/>
- <c name="A-GPS Reference Module" plugin="Y"/>
- <c name="SIP Dummy PRT" plugin="Y"/>
- <c name="MTP File and Folder Provider" plugin="Y"/>
- <c name="Weak Crypto SPI" introduced="9.5"/>
- <c name="Strong Crypto SPI" introduced="9.5"/>
- <c name="Feature Manager" introduced="9.6"/>
- <c name="IP CPR Shim" plugin="Y"/>
- <c name="GPRS QOS PRT" plugin="Y"/>
- <c name="UMTS QOS PRT" plugin="Y"/>
- <c name="Predictor Compression" plugin="Y"/>
- <c name="Stac LZS Compression" plugin="Y"/>
- <c name="MPPC" plugin="Y"/>
- <c name="UMTS/GPRS SCPR" plugin="Y"/>
- <c name="QOS 3GPP CPR" plugin="Y"/>
- <c name="PDP SCPR" plugin="Y"/>
- <c name="IP CPR" plugin="Y"/>
- <c name="IP SCPR" plugin="Y"/>
- <c name="QOS IP SCPR" plugin="Y"/>
- <c name="IP Proto-CPR" plugin="Y"/>
- <c name="TCP CPR" plugin="Y"/>
- <c name="Graphics Composition Engine" introduced="9.5"/>
- <c name="Mass Storage Driver" introduced="9.5"/>
-</model>
--- a/sysmodellibs/sysmodelgen/resources/auxiliary/display-names.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<display-names>
-	<abbrev name="PIM App Services" abbrev="PIM Application Services"/>
-	<abbrev name="Other App Services" abbrev="Other Application Services"/>
-	<abbrev name="Office App Engines" abbrev="Office Application Engines"/>
-	<abbrev name="Device Provisioning" abbrev="Device Management"/>
-	<abbrev name="PIM App Support" abbrev="PIM Application Support"/>
-	<abbrev name="Internet and Web Application Support" abbrev="Internet &amp; Web App Support"/>
-	<abbrev  name="Application Launch Services" abbrev="App. Launch Services"/>
-	<abbrev  name="QoS Interface" abbrev="QOS Interface"/>
-	<abbrev name="Serial Comms and Short Link Services" abbrev="Serial Comms &amp; Short Link Services"/>
-	<abbrev name="Multimedia and Graphics Services" abbrev="Multimedia &amp; Graphics Services"/>
-	<abbrev name="Kernel Services and Hardware Interface" abbrev="Kernel Services &amp; Hardware Interface"/>
-	<!--abbrev name="J2ME" abbrev="Java J2ME"/-->
-	<abbrev name="Localisation" abbrev="Localis&#xAD;ation"/>
-	<abbrev name="Character Conversion Framework" abbrev="Character Conversion"/>
-	<abbrev name="UI Toolkit" abbrev="UI Support"/>
-	<abbrev name="Bluetooth and SMS Push" abbrev="Bluetooth &amp; SMS Push"/>
-	<abbrev name="Telephony Reference Platform" abbrev="Telephony Ref. Platform"/>
-	<abbrev  name="Graphics Device Interface" abbrev="Graphics Dev&#xad;ice Interface"/>
-	<abbrev name="User Side Hardware Abstraction" abbrev="User Side Hardware &#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;Abstrac- &#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;tion"/>
-	<abbrev name="Generic Open Libraries" abbrev="Generic Open Libs."/>
-	<abbrev name="System State Management" abbrev="State Management"/>
-	<abbrev name="Comms Process and Settings" abbrev="Comms Proc. &amp; Settings"/>
-	<abbrev name="Baseband Adaptation Plugins" abbrev="Baseband Adaptation"/>
-	<abbrev name="Location Request Management" abbrev="Location Request Mgmt."/>    
-	<abbrev name="Graphics Hardware Adaptation" abbrev="Graphics HW Adapt."/>
-	<abbrev name="Multimedia Hardware Adaptation" abbrev="Multimedia HW Adapt."/>
-	<abbrev name="Multimedia Hardware Adaptation Interfaces" abbrev="Multimedia HW Adapt."/>
-	<abbrev name="Open Environment Utilities" abbrev="Open Env. Utilities"/>
-	<abbrev name="Common Application Services" abbrev="Common App Services"/>
-	<abbrev name="Base Connection Providers" abbrev="Base Connec&#xad;tion Providers"/>
-	<abbrev name="Shortlink Logical Device Drivers" abbrev="Shortlink LDD"/>
-</display-names>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/resources/auxiliary/system_model_colors.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,806 +0,0 @@
-<?xml version="1.0"?>
-<values default="grey" label="Technology Streams">
-  <item label="Base Services" value="#8f8fbd">
-    <component name="Application Utilities"/>
-    <component name="Syslibs Subsystem Documentation"/>
-    <component name="Plugin Framework"/>
-    <component name="Zip Compression Library"/>
-    <component name="Feature Registry"/>
-    <component name="Power, Memory and Disk Management"/>
-    <component name="Power and Memory Notification Service"/>
-    <component name="C Standard Library"/>
-    <component name="System Agents"/>
-    <component name="System Agent"/>
-    <component name="Task Scheduler"/>
-    <component name="XML Framework"/>
-    <component name="XML Parser"/>
-    <component name="WBXML Parser"/>
-    <component name="Feature Manager"/>
-    <component name="Syslibs Documentation"/>
-  </item>
-  <item label="Baseband Adaption" value="#5f9f9f">
-    <component name="ETel CDMA"/>
-    <component name="ETel Multimode"/>
-    <component name="ETel Packet Data"/>
-    <component name="ETel SIM Toolkit"/>
-    <component name="ETel Server and Core"/>
-    <component name="ETel Config"/>
-    <component name="TRP TSY"/>
-    <component name="SIM TSY"/>
-    <component name="MultiMode TSY"/>
-    <component name="CDMA TSY"/>
-    <component name="TRP CSY"/>
-    <component name="Baseband Channel Adaptor"/>
-    <component name="Baseband Channel Adaptor for C32"/>
-    <component name="Hardware Resources Manager"/>
-    <component name="MUX CSY"/>
-    <component name="TRP AGT"/>
-    <component name="Inter-System Communication"/>
-    <component name="S60 Compatibility Headers"/>
-    <component name="TRP Dispatch Layer Plugins"/>
-    <component name="Baseband Channel Adaptor for ISC"/>
-  </item>
-  <item label="Comms Framework" value="#527f76">
-    <component name="Comms Database"/>
-    <component name="File Logger"/>
-    <component name="ESock Server"/>
-    <component name="Network Interface Manager"/>
-    <component name="Comms Root Server"/>
-    <component name="Comms Framework"/>
-    <component name="Comms Elements"/>
-    <component name="Network Controller"/>
-    <component name="BBI"/>
-    <component name="MBuf Manager"/>
-    <component name="C32 Serial Server"/>
-    <component name="Serial Port CSY"/>
-    <component name="Comms Tools"/>
-    <component name="Comms Infrastructure Documentation"/>
-    <component name="Comms Root Server Config"/>
-    <component name="Comms Database Shim"/>
-    <component name="Default Comms Database"/>
-    <component name="Comms Database Install Default"/>
-    <component name="Prepare Default Comms Database"/>
-    <component name="Install Default Comms Database"/>
-    <component name="ESock Server Config"/>
-    <component name="IP CPR Shim"/>
-    <component name="Comms Debug Utility"/>
-    <component name="C32 Serial Server Config"/>
-    <component name="Networking Dialog API"/>
-    <component name="Agent Dialog"/>
-  </item>
-  <item label="Crypto Services" value="yellow">
-    <component name="TLS Provider"/>
-    <component name="Authentication Services"/>
-    <component name="Certificate and Key Management"/>
-    <component name="Weak Cryptography Library"/>
-    <component name="Strong Cryptography Library"/>
-    <component name="Weak Crypto SPI"/>
-    <component name="Strong Crypto SPI"/>
-    <component name="Crypto SPI Plugins"/>
-    <component name="Security Utils"/>
-    <component name="Security Config"/>
-    <component name="Crypto Token Framework"/>
-    <component name="File-based Certificate and Key Stores"/>
-    <component name="Root Certificates"/>
-    <component name="ASN PKCS"/>
-    <component name="Java MIDlet Installer"/>
-    <component name="Secure Software Install"/>
-    <component name="Secure Software Install Device Tools"/>
-    <component name="SWI Analysis Toolkit"/>
-    <component name="Secure Software Install SIS Tools"/>
-    <component name="OpenSSL Library"/>
-    <component name="SIS Installer"/>
-    <component name="MAKEKEYS"/>
-    <component name="Content Access Framework for DRM"/>
-    <component name="CAF Recogniser Configuration"/>
-    <component name="Certificate Store"/>
-    <component name="Key Store"/>
-    <component name="Cryptography Library"/>
-    <component name="Reference DRM Agent"/>
-    <component name="Security Common Utils"/>
-    <component name="User Prompt Service"/>
-    <component name="Security Documentation"/>
-    <component name="CAF Recogniser Config"/>
-    <component name="CAF Streaming Support"/>
-    <component name="Open Crypto Libraries"/>
-  </item>
-  <item label="Development Boards" value="#934900">
-    <component name="OMAP 1623"/>
-    <component name="OMAP 2420"/>
-    <component name="OMAP H4HRP Variant"/>
-    <component name="OMAP H2"/>
-    <component name="OMAP H4"/>
-    <component name="Lubbock Variant"/>
-    <component name="OMAP H2 BSP"/>
-    <component name="OMAP H2 SDIO"/>
-    <component name="OMAP H4 SDIO"/>
-    <component name="OMAP H2 Unistore2"/>
-    <component name="OMAP H4 Unistore2"/>
-    <component name="H4 Boot Loader"/>
-    <component name="OMAP H4 Mini Environment Boot Loader"/>
-    <component name="StrongArm 1100 ASSP"/>
-    <component name="OMAP H4 BSP"/>
-    <component name="Lubbock BSP"/>
-  </item>
-  <item label="Kernel" value="#00ffff">
-    <component name="Board Support Packages"/>
-    <component name="Bootstrap"/>
-    <component name="Kernel Architecture 2"/>
-    <component name="Integrator BSP support for Unistore2"/>
-    <component name="User HAL"/>
-    <component name="User Library"/>
-    <component name="E32 Tests"/>
-    <component name="Flash Translation Layer"/>
-    <component name="E32 Tools"/>
-    <component name="E32 Perl Tools"/>
-    <component name="Emulator BSP"/>
-    <component name="User-Side Hardware Abstraction"/>
-    <component name="System On Chip ASSP"/>
-    <component name="Template Variant"/>
-    <component name="Kernel Trace Tool"/>
-    <component name="E32 Utilities"/>
-    <component name="Base Documentation"/>
-  </item>
-  <item label="Multimedia Protocols" value="#eaadea">
-    <component name="RTP"/>
-    <component name="SIP Framework"/>
-    <component name="SIP Connection Provider Plugins"/>
-    <component name="SIP Connection Provider"/>
-    <component name="SIP Dummy PRT"/>
-    <component name="SIP State Machine"/>
-    <component name="SIP Params"/>
-    <component name="SIP Subconnection Provider"/>
-    <component name="SIP Connection Plugins"/>
-  </item>
-  <item label="IP Networking" value="#ff7f00">
-    <component name="ETHER AGT"/>
-    <component name="TLS"/>
-    <component name="IPShim"/>
-    <component name="PPP Compression Plugins"/>
-    <component name="PPP NIF"/>
-    <component name="Ethernet NIF"/>
-    <component name="Ethernet Over IR Packet Driver"/>
-    <component name="Ethernet Packet Driver"/>
-    <component name="PDP NIF"/>
-    <component name="Raw IP NIF"/>
-    <component name="SLIP NIF"/>
-    <component name="Tunnel NIF"/>
-    <component name="CGI"/>
-    <component name="Connection Provider Plugin"/>
-    <component name="GPRS/UMTS QOS PRT"/>
-    <component name="QoS Framework PRT"/>
-    <component name="Subconnection Parameters"/>
-    <component name="IP Hook"/>
-    <component name="IP Hook Examples"/>
-    <component name="IP Examples"/>
-    <component name="Internet Sockets"/>
-    <component name="IP Event Notifier"/>
-    <component name="IPSec"/>
-    <component name="TCP/IPv4/v6 PRT"/>
-    <component name="Core IPSec PRT"/>
-    <component name="VPN"/>
-    <component name="Mobile IP"/>
-    <component name="NWSS WAP Stack"/>
-    <component name="WAP Message API"/>
-    <component name="WAP Short Stack"/>
-    <component name="DHCP"/>
-    <component name="DND"/>
-    <component name="CSD AGT"/>
-    <component name="NULL AGT"/>
-    <component name="PSD AGT"/>
-    <component name="Connection AGT"/>
-    <component name="AgentPr"/>
-    <component name="ConnProv"/>
-    <component name="SubConnProv"/>
-    <component name="MetaConnProv"/>
-    <component name="ShimPr"/>
-    <component name="Wireless LAN"/>
-    <component name="SCHEDULER"/>
-    <component name="QoS Scheduler"/>
-    <component name="Network Address and Port Translation"/>
-    <component name="EAP Framework"/>
-    <component name="EAP Plugins for WiFi"/>
-    <component name="Networking Documentation"/>
-    <component name="Networking Dialog Stub"/>
-    <component name="Dialog Default"/>
-    <component name="DND Config"/>
-    <component name="Legacy Networking"/>
-    <component name="Networking Test"/>
-    <component name="Networking ROM"/>
-    <component name="Networking Unit Test"/>
-    <component name="Networking Examples"/>
-    <component name="Example Internet Utilities"/>
-    <component name="Internet Test Utils"/>
-    <component name="IPv6 to 4 Tunnel"/>
-    <component name="IP Administration Tool"/>
-    <component name="IP Analyzer"/>
-    <component name="IP Protocol Analyzer"/>
-    <component name="Name Resolver Utility"/>
-    <component name="IP Probe"/>
-    <component name="IPsec"/>
-    <component name="Network Security"/>
-    <component name="TCP/IPv4/v6 Config"/>
-    <component name="GPRS/UMTS QoS PRT"/>
-    <component name="GPRS/UMTS QoS Interface"/>
-    <component name="QoS Interface"/>
-    <component name="IPv6 Config"/>
-    <component name="GPRS QOS PRT"/>
-    <component name="UMTS QOS PRT"/>
-    <component name="QOS Extn API"/>
-    <component name="QoS Extn API"/>
-    <component name="PPP Config"/>
-    <component name="Predictor Compression"/>
-    <component name="MPPC"/>
-    <component name="Stac LZS Compression"/>
-    <component name="Reference CPR"/>
-    <component name="Reference SCPR"/>
-    <component name="QoS Framework Config"/>
-    <component name="QoS Library"/>
-    <component name="PF QoS Library"/>
-    <component name="IP CPR"/>
-    <component name="IP SCPR"/>
-    <component name="QOS IP SCPR"/>
-    <component name="QoS IP SCPR"/>
-    <component name="IP Network Layer"/>
-    <component name="IP Transport Layer"/>
-    <component name="IP Proto-CPR"/>
-    <component name="TCP CPR"/>
-    <component name="UMTS/GPRS SCPR"/>
-    <component name="QOS 3GPP CPR"/>
-    <component name="QoS 3GPP CPR"/>
-    <component name="PDP Layer"/>
-    <component name="PDP SCPR"/>
-  </item>
-  <item label="Open Environment" value="#817485">
-    <component name="Open Environment Core"/>
-    <component name="Command Shell"/>
-    <component name="Telnet Server"/>
-    <component name="OpenSSL"/>
-  </item>
-  <item label="Peripherals" value="#008000">
-    <component name="Audio Driver"/>
-    <component name="Emulator"/>
-    <component name="Ethernet Driver"/>
-    <component name="File Server"/>
-    <component name="File Systems"/>
-    <component name="Text Shell"/>
-    <component name="Text Window Server"/>
-    <component name="Media Drivers"/>
-    <component name="MIDI Driver"/>
-    <component name="Other LDDs"/>
-    <component name="PDDs"/>
-    <component name="Peripheral Bus Controllers"/>
-    <component name="SD Card Driver"/>
-    <component name="Speech Driver"/>
-    <component name="Video Driver"/>
-    <component name="Domain Manager"/>
-    <component name="SDIO Tests"/>
-    <component name="Assabet BSP"/>
-    <component name="Integrator BSP"/>
-    <component name="ROM File System"/>
-    <component name="ROFS"/>
-    <component name="ROFS File System"/>
-    <component name="USB Mass Storage File System"/>
-    <component name="LFFS"/>
-    <component name="LFFS File System"/>
-    <component name="FAT32 File System"/>
-    <component name="FAT File System"/>
-    <component name="Composite File System"/>
-    <component name="NTFS"/>
-    <component name="NTFS File System"/>
-    <component name="ISO9660 File System"/>
-    <component name="File System Plugins"/>
-    <component name="NAND Flash Translation Layer"/>
-    <component name="Cotulla ASSP"/>
-    <component name="Unistore2 Emulator Support"/>
-    <component name="Integrator Unistore2 NAND Logic Module"/>
-    <component name="Unistore2 Boot Support"/>
-    <component name="Integrator ARM1136 Core Module"/>
-    <component name="Integrator ARM920 Core Module"/>
-    <component name="Integrator Core Modules"/>
-    <component name="Integrator Motherboard"/>
-    <component name="Integrator SSR NAND Logic Module"/>
-    <component name="Integrator XX600 Logic Module"/>
-    <component name="Local Media Subsystem"/>
-    <component name="SD Card 3C Driver"/>
-    <component name="SD Card 4C Driver"/>
-    <component name="File Server Tests"/>
-    <component name="Base Starter"/>
-    <component name="Sound Driver"/>
-    <component name="Serial Port Driver"/>
-    <component name="Legacy Drivers"/>
-    <component name="USB Client Driver"/>
-    <component name="Unistore2 Drivers"/>
-    <component name="Unistore2 Core"/>
-    <component name="Unistore2 Crash Logger"/>
-    <component name="Generic Board Support Packages"/>
-  </item>
-  <item label="Persistent Data Services" value="#993366">
-    <component name="SQL"/>
-    <component name="Store"/>
-    <component name="DBMS"/>
-    <component name="Central Repository"/>
-    <component name="Event Logger"/>
-    <component name="DBMS Emulation Library"/>
-    <component name="SQLite 3 API"/>
-  </item>
-  <item label="Shortlink" value="#db7093">
-    <component name="Bluetooth CSY"/>
-    <component name="Bluetooth HCI"/>
-    <component name="Bluetooth Manager"/>
-    <component name="Bluetooth PAN Profile"/>
-    <component name="Bluetooth Protocol Client APIs"/>
-    <component name="Bluetooth SDP"/>
-    <component name="Bluetooth Stack PRT"/>
-    <component name="IrDA CSY"/>
-    <component name="IrDA PRT"/>
-    <component name="Remote Control Framework"/>
-    <component name="Remote Control Profile"/>
-    <component name="USB CSY"/>
-    <component name="USB Manager"/>
-    <component name="OBEX Extension API"/>
-    <component name="OBEX Protocol"/>
-    <component name="Bluetooth Profiles"/>
-    <component name="HCI Framework"/>
-    <component name="USB Driver"/>
-    <component name="Bluetooth PBAP"/>
-    <component name="Bluetooth AVRCP"/>
-    <component name="Phonebook Access Profile"/>
-    <component name="Mass Storage Driver"/>
-    <component name="OMAP USB Host Controller Driver"/>
-    <component name="OMAP USB Host Controller Driver Template"/>
-    <component name="USB Host and OTG Drivers"/>
-    <component name="USB Host and OTG Stack"/>
-    <component name="Bluetooth Documentation"/>
-    <component name="IrDA Documentation"/>
-    <component name="Shortlink Documentation"/>
-    <component name="USB Class and Manager Documentation"/>
-    <component name="USB Manager Tests"/>
-    <component name="Bluetooth Examples and Tests"/>
-    <component name="USB Documentation"/>
-    <component name="USB Test"/>
-    <component name="Bluetooth Example Tests"/>
-    <component name="IrDA Stack"/>
-    <component name="IrDA Test"/>
-    <component name="IrDA Config"/>
-    <component name="Bluetooth HCI Extension Interface"/>
-    <component name="Bluetooth HCI Framework 2"/>
-    <component name="Bluetooth HCI Framework 1"/>
-    <component name="Bluetooth HCI 2 Reference Implementations"/>
-    <component name="Bluetooth Notifiers Support"/>
-    <component name="Bluetooth HCI Proxy"/>
-    <component name="Bluetooth HCI Implementation"/>
-    <component name="Bluetooth Stack"/>
-    <component name="Bluetooth Notifiers"/>
-    <component name="Bluetooth Config"/>
-    <component name="Bluetooth GAVDP"/>
-    <component name="Bluetooth ROM"/>
-    <component name="Bluetooth User"/>
-    <component name="Bluetooth Common"/>
-    <component name="Bluetooth Client Library"/>
-    <component name="Bluetooth Build Utilities"/>
-  </item>
-  <item label="Telephony Services" value="#3299cc">
-    <component name="ETel 3rd Party API"/>
-    <component name="SMS PRT"/>
-    <component name="SMS Utilities"/>
-    <component name="Phonebook Sync"/>
-    <component name="CDMA SMS Plugins"/>
-    <component name="CDMA WAP PRT"/>
-    <component name="Dial"/>
-    <component name="Fax Client and Server"/>
-    <component name="GSM Utilities"/>
-    <component name="Telephony Watchers"/>
-    <component name="WAP PRT"/>
-    <component name="Packet Logger"/>
-    <component name="Secondary PDP context UMTS Driver"/>
-    <component name="Common TSY"/>
-    <component name="Multimode TSY"/>
-    <component name="Telephony Confidential Documentation"/>
-    <component name="Telephony Documentation"/>
-    <component name="SMS Stack"/>
-    <component name="CDMA SMS Stack"/>
-  </item>
-  <item label="Text and I18n Services" value="#9f9f5f">
-    <component name="Character Encoding and Conversion Framework"/>
-    <component name="Character Encoding and Conversion Plugins"/>
-    <component name="Text Handling"/>
-    <component name="FAT Filename Conversion Plugins"/>
-    <component name="Text Shaper Plugin"/>
-    <component name="Text Formatting"/>
-    <component name="Locale Support"/>
-    <component name="Number Formatting"/>
-  </item>
-  <item label="Connectivity Services" value="#cfb53b">
-    <component name="Secure Backup Engine"/>
-    <component name="Backup Engine"/>
-    <component name="Active Backup Client"/>
-    <component name="Connectivity Framework"/>
-    <component name="Connectivity Services"/>
-    <component name="Bearer Abstraction Layer"/>
-    <component name="M-Router"/>
-    <component name="m-Router"/>
-    <component name="ConnectQI"/>
-    <component name="ConnectQI SDK"/>
-    <component name="PLP Variant"/>
-    <component name="PLP Remote Link"/>
-    <component name="Event Broadcast"/>
-    <component name="Remote File Server"/>
-    <component name="Secure Backup Socket Server"/>
-    <component name="Server Socket"/>
-    <component name="Service Broker"/>
-    <component name="Software Install Server"/>
-    <component name="Sync Initiation"/>
-    <component name="OMA SyncML DM Interface"/>
-    <component name="OMA SyncML Framework"/>
-    <component name="OMA SyncML Common Framework"/>
-    <component name="OMA Data Sync"/>
-    <component name="OMA SyncML Data Sync"/>
-    <component name="Data Sync Adaptors"/>
-    <component name="Mobile Active Sync"/>
-    <component name="MTP Framework"/>
-    <component name="MTP USB Transport"/>
-    <component name="MTP File and Folder Provider"/>
-    <component name="OMA SyncML Integration Test"/>
-    <component name="Device Management Integration Test"/>
-    <component name="PC Side Connection Manager"/>
-    <component name="MTP PTP-IP Transport"/>
-  </item>
-  <item label="Device Provisioning" value="#ebc79e">
-    <component name="Device Management Framework"/>
-    <component name="Device Management Adaptors"/>
-    <component name="Client Provisioning Framework"/>
-    <component name="Client Provisioning Adaptors"/>
-  </item>
-  <item label="Graphics" value="#32cd99">
-    <component name="Bit GDI"/>
-    <component name="Colour Palette"/>
-    <component name="EGL API"/>
-    <component name="EGL Implementation"/>
-    <component name="Font Store"/>
-    <component name="Font and Bitmap Server"/>
-    <component name="FreeType Font Rasteriser"/>
-    <component name="GDI"/>
-    <component name="GDITOOLS"/>
-    <component name="GDTRAN"/>
-    <component name="Graphics Surfaces"/>
-    <component name="OpenGL ES"/>
-    <component name="OpenGL ES Framework"/>
-    <component name="OpenVG API"/>
-    <component name="OpenVG Implementation"/>
-    <component name="Printer Driver Support"/>
-    <component name="Printer Drivers"/>
-    <component name="Reference Fonts"/>
-    <component name="Screen Driver"/>
-    <component name="UI Bench"/>
-    <component name="Window Server"/>
-    <component name="iType Font Rasteriser"/>
-    <component name="Surface Manager LDD"/>
-    <component name="Common Graphics Headers"/>
-    <component name="Composition Engine Adaptation"/>
-    <component name="Graphics Resource Content Update"/>
-    <component name="MemSpy"/>
-    <component name="Printing Services"/>
-    <component name="Graphics Documentation"/>
-    <component name="Graphics Test Harness"/>
-    <component name="GDI Tools"/>
-    <component name="Bitmap Font Tools"/>
-    <component name="OpenGL ES API"/>
-    <component name="OpenGL ES Implementation"/>
-    <component name="Graphics Composition Engine"/>
-    <component name="Graphics Data Resource"/>
-    <component name="Graphics Data Resource Adaptation"/>
-  </item>
-  <item label="Internet and Web Services" value="#ff8f68">
-    <component name="HTTP Protocol Plugins"/>
-    <component name="HTTP Transport Framework"/>
-    <component name="HTTP Transport Plugins"/>
-    <component name="HTTP Examples"/>
-    <component name="URI Permission Services"/>
-    <component name="WAP Push Framework"/>
-    <component name="WAP Push Handlers"/>
-    <component name="WAP Push MTM"/>
-    <component name="WAP Base"/>
-    <component name="HTTP Utilities Library"/>
-    <component name="Bookmark Support"/>
-    <component name="Web Recognisers"/>
-    <component name="FTP Engine"/>
-    <component name="Telnet Engine"/>
-    <component name="WAP Push Support"/>
-    <component name="HTTP Filter Plugins"/>
-  </item>
-  <item label="Location Based Services" value="green">
-    <component name="Location Server"/>
-    <component name="Network Request Handler"/>
-    <component name="A-GPS Location Manager"/>
-    <component name="Network Location Manager"/>
-    <component name="Lbs Admin"/>
-    <component name="LBS Admin"/>
-    <component name="Network Gateway"/>
-    <component name="Network Protocol Module"/>
-    <component name="A-GPS Reference Module"/>
-    <component name="Location Based Services"/>
-    <component name="Location Admin"/>
-    <component name="Privacy Protocol Module"/>
-  </item>
-  <item label="Java" value="#c0d9d9">
-    <component name="CLDC Hi 1.1"/>
-    <component name="Java IO"/>
-    <component name="Java Lang"/>
-    <component name="Java Utilities"/>
-    <component name="MIDP Device Control"/>
-    <component name="MIDP GSM Security RP"/>
-    <component name="MIDP IO"/>
-    <component name="MIDP LCDUI"/>
-    <component name="MIDP MIDlet"/>
-    <component name="MIDP RMS"/>
-    <component name="LCDUI Plugin"/>
-    <component name="Runtime Plugin"/>
-    <component name="Security Policy"/>
-    <component name="Bluetooth 1.0"/>
-    <component name="Bluetooth 1.1"/>
-    <component name="Bluetooth 1.1 Push"/>
-    <component name="WMA 1.1"/>
-    <component name="WMA 1.1 Push"/>
-    <component name="JTWI 1.0"/>
-    <component name="Mobile Media API 1.1"/>
-    <component name="Mobile 3D 1.0"/>
-    <component name="Mobile 3D 1.1"/>
-    <component name="MIDP PIM"/>
-    <component name="MIDP File GCF"/>
-  </item>
-  <item label="Messaging" value="red">
-    <component name="Message Store"/>
-    <component name="Message Server and Store"/>
-    <component name="Watcher Framework"/>
-    <component name="IMAP4 MTM"/>
-    <component name="POP3 MTM"/>
-    <component name="SMTP MTM"/>
-    <component name="POP3 and SMTP MTM"/>
-    <component name="MMS Settings"/>
-    <component name="MMS Configuration"/>
-    <component name="MSG URLHANDLER"/>
-    <component name="Message URL Handler"/>
-    <component name="Scheduled Send MTM"/>
-    <component name="Send As"/>
-    <component name="OBEX MTMs"/>
-    <component name="SMIL Parser"/>
-    <component name="BIO Messaging Framework"/>
-    <component name="BIO Messaging Parsers"/>
-    <component name="BIO Watchers"/>
-    <component name="SMS MTM"/>
-    <component name="Fax MTM"/>
-    <component name="MSG TEST"/>
-    <component name="Messaging Test"/>
-    <component name="MMS MTM"/>
-    <component name="CDMA MTM"/>
-  </item>
-  <item label="Multimedia" value="#8fbc8f">
-    <component name="Camera"/>
-    <component name="Camera Server"/>
-    <component name="Camera Driver"/>
-    <component name="Camera Framework"/>
-    <component name="Broadcast Tuner"/>
-    <component name="Tuner Server"/>
-    <component name="Tuner Driver"/>
-    <component name="Broadcast Radio Tuner"/>
-    <component name="Speech Recognition Controller"/>
-    <component name="Image Conversion Library"/>
-    <component name="Imaging Frameworks"/>
-    <component name="Image Conversion Library Plugins"/>
-    <component name="Imaging Plugins"/>
-    <component name="MMF Recognisers"/>
-    <component name="Multimedia Framework Plugins"/>
-    <component name="DevSound API"/>
-    <component name="Reference DevSound Plugins"/>
-    <component name="Video HAI"/>
-    <component name="Bluetooth DevSound Plugin"/>
-    <component name="ICL Integration Tests"/>
-    <component name="MMF Integration Tests"/>
-    <component name="ICL Unit Tests"/>
-    <component name="MMF Unit Tests"/>
-    <component name="Multimedia Test Framework Unit Tests"/>
-    <component name="Multimedia Test Framework"/>
-    <component name="Multimedia Framework"/>
-    <component name="Multimedia Validation Suite"/>
-    <component name="Multimedia Validation Suite Application"/>
-    <component name="Multimedia Validation Suite Agents"/>
-    <component name="MVS Integration Tests"/>
-    <component name="Media Device Framework Plugins"/>
-    <component name="Multimedia Device Framework"/>
-    <component name="Mobile TV DVB-H Receiver HAI"/>
-    <component name="MDF Unit Tests"/>
-    <component name="Camera Unit Tests"/>
-    <component name="Tuner Unit Tests"/>
-    <component name="Mobile TV DVB-H Unit Tests"/>
-    <component name="Multimedia Test Agent"/>
-    <component name="Multimedia Test Tools"/>
-    <component name="MMF Characterisation Validation"/>
-    <component name="Multimedia Documentation"/>
-    <component name="Multimedia Utility Library"/>
-    <component name="Camera Plugins"/>
-    <component name="Media Device Framework"/>
-    <component name="OpenMAX"/>
-    <component name="DevSound Hardware Device API"/>
-    <component name="DevSound Plugin Support"/>
-    <component name="Multimedia Resource Controller"/>
-    <component name="A3F Audio Component Library"/>
-    <component name="A3F DevSound Customisation"/>
-    <component name="A3F DevSound"/>
-    <component name="A3F Audio Component Framework"/>
-    <component name="A3F Trace Utility"/>
-    <component name="Reference ACL Adaptation"/>
-    <component name="Metadata Utility Framework"/>
-    <component name="Metadata Parser Plugin"/>
-    <component name="Video Renderer"/>
-    <component name="A3F Integration Tests"/>
-    <component name="A3F Server Start"/>
-  </item>
-  <item label="PIM Application Services" value="#ffff80">
-    <component name="Agenda Model"/>
-    <component name="Agenda Versit Plugin"/>
-    <component name="Alarm Server"/>
-    <component name="Chinese Calendar Converter"/>
-    <component name="CalInterimAPI"/>
-    <component name="Calendar"/>
-    <component name="Time Zone Localisation"/>
-    <component name="Time Zone Server"/>
-    <component name="Time Zone Compiler"/>
-    <component name="Time Zone Database"/>
-    <component name="Timezone"/>
-    <component name="Time Zone Localisation Resource Factory"/>
-    <component name="WLDDATABASEKIT"/>
-    <component name="World Database Kit"/>
-    <component name="WLDTOOLS"/>
-    <component name="World Tools"/>
-    <component name="World Server"/>
-    <component name="Contacts Model"/>
-    <component name="Backup Restore Notification"/>
-    <component name="Chart"/>
-    <component name="HTML to RichText Converter"/>
-    <component name="Core Apps Test"/>
-    <component name="Data Engine"/>
-    <component name="Help"/>
-    <component name="File Converter Plugins"/>
-    <component name="RichText to HTML Converter"/>
-    <component name="Sheet Engine"/>
-    <component name="vCard and vCal"/>
-    <component name="Word Engine"/>
-    <component name="Agenda Model Test"/>
-    <component name="Alarm Server Test"/>
-    <component name="World Server Test"/>
-    <component name="Application Engines Documentation"/>
-    <component name="Application Services Documentation"/>
-    <component name="Other File Converter Plugins"/>
-    <component name="Time Zone Localization"/>
-  </item>
-  <item label="UI Frameworks" value="#00ff00">
-    <component name="Animation"/>
-    <component name="UI Graphics Utilities"/>
-    <component name="FEP Base"/>
-    <component name="Front End Processor"/>
-    <component name="Clock"/>
-    <component name="Graphics Effects"/>
-    <component name="System Starter"/>
-    <component name="UIKON"/>
-    <component name="BMP Animation"/>
-    <component name="Grid"/>
-    <component name="Application Architecture"/>
-    <component name="UI Look and Feel"/>
-    <component name="View Server"/>
-    <component name="Printing UI Support"/>
-    <component name="MIME Recognition Framework"/>
-    <component name="Content Handling Framework"/>
-    <component name="Control Environment"/>
-    <component name="File Converter Framework"/>
-    <component name="UIKON Error Resolver Plugin"/>
-    <component name="Error Resolver Data"/>
-    <component name="UI Frameworks Documentation"/>
-  </item>
-  <item label="Product Creation Tools" value="#a29040">
-    <component name="SDK Builder"/>
-    <component name="CBRTOOLS"/>
-    <component name="CDB"/>
-    <component name="TESTTOOLS_DESKTOP"/>
-    <component name="KITSETUPAPP"/>
-    <component name="NAVIGATION_PAGES"/>
-    <component name="PRODUCTINSTALLER"/>
-    <component name="RUNPERL"/>
-    <component name="SDKINFO"/>
-    <component name="SISAR"/>
-    <component name="SDKPKG-MANAGER"/>
-    <component name="SDKPKG-TOOLS"/>
-    <component name="EMULATOR_LAUNCHER"/>
-    <component name="PKGMGRGUI"/>
-    <component name="TOOLS_STUBS"/>
-    <component name="PERLLIBRARY"/>
-    <component name="SPLASH"/>
-    <component name="JAVALIBRARY"/>
-    <component name="DUMMY"/>
-    <component name="ASSERTION"/>
-    <component name="ENUM"/>
-    <component name="ENVVAR"/>
-    <component name="FILESYS"/>
-    <component name="INSTALLUTILS"/>
-    <component name="JADE"/>
-    <component name="JAVAHELP"/>
-    <component name="LANGCONFIG"/>
-    <component name="LOGGER"/>
-    <component name="MBMCODEC"/>
-    <component name="MNEMONICFIX"/>
-    <component name="PATHBROWSER"/>
-    <component name="SHELLEXEC"/>
-    <component name="SWINGWORKER"/>
-    <component name="TESTCASERUNNER"/>
-    <component name="TOOLBARPANEL"/>
-    <component name="BCCOMPARATOR"/>
-    <component name="KITCOMPARATOR"/>
-    <component name="BSPBUILDER"/>
-    <component name="Compiler Runtime Support"/>
-    <component name="Tools Documentation"/>
-  </item>
-  <item label="Development Tools" value="#BAC97E">
-    <component name="BUILD-TOOLS"/>
-    <component name="BUILDSYSTEMTOOLS"/>
-    <component name="RAPTOR"/>
-    <component name="E32TOOLS EKA2"/>
-    <component name="ROMKIT_EKA2"/>
-    <component name="REDISTRIBUTION"/>
-    <component name="Debug"/>
-    <component name="Trace Framework"/>
-    <component name="Run Mode Debugger"/>
-  </item>
-  <item label="Test Environment" value="#56a1a1">
-    <component name="AGENDA"/>
-    <component name="AGENTNOTIFIER"/>
-    <component name="AUDIO"/>
-    <component name="BLUETOOTHUI"/>
-    <component name="BURTESTSERVER"/>
-    <component name="CAPTOOLS"/>
-    <component name="CHATSCRIPTS"/>
-    <component name="CINIDATA"/>
-    <component name="CONNECTUI"/>
-    <component name="CONTACTS"/>
-    <component name="CONTACUI"/>
-    <component name="EIKSTD"/>
-    <component name="EXTRAS"/>
-    <component name="LEAVESCAN"/>
-    <component name="MESSAGINGUI"/>
-    <component name="MIGRATIONTOOL"/>
-    <component name="PHONEUI"/>
-    <component name="PROGRAMCHECKER"/>
-    <component name="RESOURCE_HANDLER"/>
-    <component name="RESOURCE_HANDLER_UI"/>
-    <component name="SMOKETEST"/>
-    <component name="STATAPI"/>
-    <component name="STAT_DESKTOP"/>
-    <component name="STAT_DEVICE"/>
-    <component name="SYSTEMMONITOR"/>
-    <component name="Simple App"/>
-    <component name="TESTDRIVER"/>
-    <component name="TESTEXECUTE"/>
-    <component name="TESTTOOLS_UTILITIES"/>
-    <component name="TIMEW"/>
-    <component name="USBUI"/>
-    <component name="Use Case Controller"/>
-    <component name="SHELL"/>
-    <component name="STARTUP"/>
-    <component name="STATUSPANE"/>
-    <component name="UIKLAF"/>
-    <component name="IAPSTATUSAPP"/>
-  </item>
-  <item label="Technical Documentation" value="#6A5182">
-    <component name="DEVELOPERLIBRARY"/>
-    <component name="Developer Library Tools"/>
-    <component name="Developer Library Help"/>
-    <component name="Developer Library Source"/>
-    <component name="Developer Library HTML"/>
-  </item>
-  <item label="Test Product" value="#544A38">
-    <component name="Subsystem Tests"/>
-  </item>
-  <item label="System Engineering" value="#615FAD">
-    <component name="DEPMODEL"/>
-    <component name="System Documentation"/>
-  </item>
-</values>
Binary file sysmodellibs/sysmodelgen/resources/installed/Xalan/Xalan-C_1_8.dll has changed
Binary file sysmodellibs/sysmodelgen/resources/installed/Xalan/Xalan.exe has changed
Binary file sysmodellibs/sysmodelgen/resources/installed/Xalan/XalanMessages_1_8.dll has changed
Binary file sysmodellibs/sysmodelgen/resources/installed/Xalan/xerces-c_2_5_0.dll has changed
--- a/sysmodellibs/sysmodelgen/resources/xsd/Border-shapes.xsd	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
-  <xs:element name="values">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
-          <xs:complexType>
-            <xs:sequence>
-              <xs:element name="component" maxOccurs="unbounded" minOccurs="0">
-                <xs:complexType>
-                  <xs:simpleContent>
-                    <xs:extension base="xs:string">
-                      <xs:attribute type="xs:string" name="name" use="required"/>
-                    </xs:extension>
-                  </xs:simpleContent>
-                </xs:complexType>
-              </xs:element>
-            </xs:sequence>
-            <xs:attribute type="xs:string" name="label" use="optional"/>
-            <xs:attribute name="value" use="required">
-                            <xs:annotation>
-                            	<xs:documentation>The regular expression on the "value" attribute is as follows: 1) one of the special keywords as specified or 2) "#" followed by one or more characters</xs:documentation>
-                            </xs:annotation>
-                            <xs:simpleType>
-            		<xs:restriction base="xs:string">
-            			<xs:pattern
-            				value="box|round|hexagon|box-clipRT|box-clipRB|box-clipLT|box-clipLB|box-clipAll|#.+">
-            			</xs:pattern>
-            		</xs:restriction>
-            	</xs:simpleType>
-            </xs:attribute>
-          </xs:complexType>
-        </xs:element>
-      </xs:sequence>
-      <xs:attribute type="xs:string" name="default" use="optional"/>
-      <xs:attribute type="xs:string" name="label" use="optional"/>
-    </xs:complexType>
-  </xs:element>
-</xs:schema>
--- a/sysmodellibs/sysmodelgen/resources/xsd/Border-styles.xsd	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
-  <xs:element name="values">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
-          <xs:complexType>
-            <xs:sequence>
-              <xs:element name="component" maxOccurs="unbounded" minOccurs="0">
-                <xs:complexType>
-                  <xs:simpleContent>
-                    <xs:extension base="xs:string">
-                      <xs:attribute type="xs:string" name="name" use="required"/>
-                    </xs:extension>
-                  </xs:simpleContent>
-                </xs:complexType>
-              </xs:element>
-            </xs:sequence>
-            <xs:attribute type="xs:string" name="label" use="optional"/>
-            <xs:attribute name="value" use="required" type="xs:string"/>
-          </xs:complexType>
-        </xs:element>
-      </xs:sequence>
-      <xs:attribute type="xs:string" name="default" use="optional"/>
-      <xs:attribute type="xs:string" name="label" use="optional"/>
-    </xs:complexType>
-  </xs:element>
-</xs:schema>
--- a/sysmodellibs/sysmodelgen/resources/xsd/Colours.xsd	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified"
-	elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
-	<xs:element name="values">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
-					<xs:complexType>
-						<xs:sequence>
-							<xs:element name="component" maxOccurs="unbounded"
-								minOccurs="0">
-								<xs:complexType>
-									<xs:simpleContent>
-										<xs:extension base="xs:string">
-											<xs:attribute type="xs:string" name="name" use="required" />
-										</xs:extension>
-									</xs:simpleContent>
-								</xs:complexType>
-							</xs:element>
-						</xs:sequence>
-						<xs:attribute type="xs:string" name="label" use="optional" />
-						<xs:attribute name="value" use="required">
-							<xs:annotation>
-								<xs:documentation>The regular expression in the constraint of
-									the "value" attribute is: 1) a valid rgb() expression or 2) a
-									valid hex number or 3) a valid alpha expression or 4) a three
-									digit hex triple or 5) a valid %rgb() expression.</xs:documentation>
-							</xs:annotation>
-							<xs:simpleType>
-<!-- TODO: Need to modify the last pattern below (%rgb() to accept digits from 0 to 100 instead of from 1 to 99 -->
-								<xs:restriction base="xs:string">
-									<xs:pattern
-										value="rgb\((((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5])),\s?){2}(((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))){1}\)|#(([0-9a-fA-F]){6})|([A-Z,a-z]+)|#([0-9a-fA-F]){3}|rgb\(([1-9][0-9]{0,1}%,\s?){2}([1-9][0-9]{0,1}%)\)">
-									</xs:pattern>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-					</xs:complexType>
-				</xs:element>
-			</xs:sequence>
-			<xs:attribute type="xs:string" name="default" use="optional" />
-			<xs:attribute type="xs:string" name="label" use="optional" />
-		</xs:complexType>
-	</xs:element>
-</xs:schema>
--- a/sysmodellibs/sysmodelgen/resources/xsd/Levels.xsd	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
-  <xs:element name="levels">
-    <xs:complexType>
-      <xs:choice maxOccurs="unbounded" minOccurs="0">
-        <xs:element name="block" maxOccurs="unbounded" minOccurs="0">
-          <xs:complexType>
-          	<xs:simpleContent>
-          		<xs:extension base="xs:string">
-          			<xs:attribute type="xs:string" name="name"
-          				use="required" />
-          			<xs:attribute type="xs:NMTOKEN" name="level"
-          				use="optional" />
-          			<xs:attribute type="xs:NMTOKENS" name="levels"
-          				use="optional" />
-          			<xs:attribute type="xs:int" name="span"
-          				use="optional" />
-          		</xs:extension>
-          	</xs:simpleContent>
-          </xs:complexType>
-        </xs:element>
-        <xs:element name="collection" maxOccurs="unbounded" minOccurs="0">
-          <xs:complexType>
-            <xs:simpleContent>
-              <xs:extension base="xs:string">
-                <xs:attribute type="xs:string" name="name" use="required"/>
-                <xs:attribute type="xs:NMTOKEN" name="level" use="required"/>
-              </xs:extension>
-            </xs:simpleContent>
-          </xs:complexType>
-        </xs:element>
-        <xs:element name="layer" maxOccurs="unbounded" minOccurs="0">
-          <xs:complexType>
-            <xs:simpleContent>
-              <xs:extension base="xs:string">
-                <xs:attribute type="xs:string" name="name" use="required"/>
-                <xs:attribute type="xs:NMTOKENS" name="levels" use="optional"/>
-                <xs:attribute type="xs:int" name="span" use="optional"/>
-              </xs:extension>
-            </xs:simpleContent>
-          </xs:complexType>
-        </xs:element>
-      </xs:choice>
-    </xs:complexType>
-  </xs:element>
-</xs:schema>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/resources/xsd/Localisation.xsd	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
-  <xs:element name="display-names">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element name="abbrev" maxOccurs="unbounded" minOccurs="0">
-          <xs:complexType>
-            <xs:simpleContent>
-              <xs:extension base="xs:string">
-                <xs:attribute type="xs:string" name="name" use="required"/>
-                <xs:attribute type="xs:string" name="abbrev" use="required"/>
-              </xs:extension>
-            </xs:simpleContent>
-          </xs:complexType>
-        </xs:element>
-      </xs:sequence>
-      <xs:attribute type="xs:string" name="font" use="optional"/>
-    </xs:complexType>
-  </xs:element>
-</xs:schema>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/resources/xsd/Patterns.xsd	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
-  <xs:element name="values">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
-          <xs:complexType>
-            <xs:sequence>
-              <xs:element name="component" maxOccurs="unbounded" minOccurs="0">
-                <xs:complexType>
-                  <xs:simpleContent>
-                    <xs:extension base="xs:string">
-                      <xs:attribute type="xs:string" name="name" use="required"/>
-                    </xs:extension>
-                  </xs:simpleContent>
-                </xs:complexType>
-              </xs:element>
-            </xs:sequence>
-            <xs:attribute type="xs:string" name="label" use="optional"/>
-            <xs:attribute name="value" use="required">
-                            <xs:annotation>
-                            	<xs:documentation>The regular expression on the "value" attribute is as follows: 1) one of the special keywords as specified or 2) "#" followed by one or more characters</xs:documentation>
-                            </xs:annotation>
-                            <xs:simpleType>
-            		<xs:restriction base="xs:string">
-            			<xs:pattern
-            				value="striped-diag-up|radial-grad|big-X|#.+">
-            			</xs:pattern>
-            		</xs:restriction>
-            	</xs:simpleType>
-            </xs:attribute>
-          </xs:complexType>
-        </xs:element>
-      </xs:sequence>
-      <xs:attribute type="xs:string" name="default" use="optional"/>
-      <xs:attribute type="xs:string" name="label" use="optional"/>
-    </xs:complexType>
-  </xs:element>
-</xs:schema>
--- a/sysmodellibs/sysmodelgen/resources/xsd/Shapes.xsd	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,389 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
-	targetNamespace="http://www.symbian.com/Shapes" xmlns="http://www.symbian.com/Shapes"
-	elementFormDefault="qualified" attributeFormDefault="unqualified"
-	xmlns:svg="http://www.w3.org/2000/svg">
-	<xs:import namespace="http://www.w3.org/2000/svg"
-		schemaLocation="http://www.w3.org/TR/2002/WD-SVG11-20020108/SVG.xsd" />
-	<xs:element name="shapes">
-		<xs:complexType>
-			<xs:sequence>
-				<!--
-					<xs:element ref="svg:defs" xmlns:svg="http://www.w3.org/2000/svg"
-					maxOccurs="unbounded" minOccurs="0"/>
-				-->
-				<xs:element name="borders" maxOccurs="unbounded"
-					minOccurs="0">
-					<xs:complexType>
-						<xs:sequence>
-							<xs:element name="border" maxOccurs="unbounded"
-								minOccurs="1">
-								<xs:complexType mixed="true">
-									<xs:sequence>
-										<xs:element ref="svg:path" minOccurs="0"
-											xmlns:svg="http://www.w3.org/2000/svg" maxOccurs="unbounded" />
-									</xs:sequence>
-									<xs:attribute name="type" use="optional">
-										<xs:annotation>
-											<xs:documentation>
-												The regular expression on the
-												"type"
-												attribute is as follows: 1)
-												one of the special keywords as
-												specified or 2) "#" followed by
-												one or more character
-											</xs:documentation>
-										</xs:annotation>
-										<xs:simpleType>
-											<xs:restriction base="xs:string">
-												<xs:pattern
-													value="box|round|hexagon|box-clipRT|box-clipRB|box-clipLT|box-clipLB|box-clipAll|#.+">
-												</xs:pattern>
-											</xs:restriction>
-										</xs:simpleType>
-									</xs:attribute>
-									<xs:attribute type="xs:string" name="value" use="optional" />
-									<xs:attribute type="xs:string" name="viewBox" use="optional" />
-									<xs:attribute name="rule" type="xs:string" use="optional">
-									</xs:attribute>
-									<xs:attribute name="label" use="optional" default="no">
-										<xs:simpleType>
-											<xs:restriction base="xs:string">
-												<xs:enumeration value="yes"></xs:enumeration>
-												<xs:enumeration value="no"></xs:enumeration>
-											</xs:restriction>
-										</xs:simpleType>
-									</xs:attribute>
-								</xs:complexType>
-							</xs:element>
-						</xs:sequence>
-						<xs:attribute type="xs:string" name="match" use="optional"
-							default="component" />
-						<xs:attribute type="xs:string" name="use" use="optional" />
-						<xs:attribute type="xs:string" name="label" use="optional" />
-						<xs:attribute name="sort" use="optional" default="no">
-							<xs:simpleType>
-								<xs:restriction base="xs:string">
-									<xs:enumeration value="yes"></xs:enumeration>
-									<xs:enumeration value="no"></xs:enumeration>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-						<xs:attribute name="show-unused" use="optional"
-							default="no">
-							<xs:simpleType>
-								<xs:restriction base="xs:string">
-									<xs:enumeration value="yes"></xs:enumeration>
-									<xs:enumeration value="no"></xs:enumeration>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-						<xs:attribute name="literal" use="optional" default="no">
-							<xs:simpleType>
-								<xs:restriction base="xs:string">
-									<xs:enumeration value="yes"></xs:enumeration>
-									<xs:enumeration value="no"></xs:enumeration>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-					</xs:complexType>
-				</xs:element>
-				<xs:element name="patterns" maxOccurs="unbounded"
-					minOccurs="0">
-					<xs:complexType>
-						<xs:sequence>
-							<xs:element name="overlay" maxOccurs="unbounded"
-								minOccurs="1">
-								<xs:complexType>
-									<xs:sequence>
-										<xs:element ref="svg:path" minOccurs="0"
-											xmlns:svg="http://www.w3.org/2000/svg" maxOccurs="unbounded" />
-									</xs:sequence>
-									<xs:attribute name="type" use="optional">
-										<xs:annotation>
-											<xs:documentation>
-												The regular expression on the
-												"type"
-												attribute is as follows: 1)
-												one of the special keywords as
-												specified
-          						</xs:documentation>
-										</xs:annotation>
-										<xs:simpleType>
-											<xs:restriction base="xs:string">
-												<xs:pattern
-													value="box|round|hexagon|box-clipRT|box-clipRB|box-clipLT|box-clipLB|box-clipAll|#.+">
-												</xs:pattern>
-												<xs:enumeration value="big-X"></xs:enumeration>
-												<xs:enumeration value="striped-diag-up">
-												</xs:enumeration>
-												<xs:enumeration value="radial-grad">
-												</xs:enumeration>
-											</xs:restriction>
-										</xs:simpleType>
-									</xs:attribute>
-									<xs:attribute type="xs:string" name="value" use="optional" />
-
-									<xs:attribute type="xs:string" name="label" use="optional" />
-									<xs:attribute type="xs:string" name="viewBox" use="optional" />
-									<xs:attribute name="rule" type="xs:string" use="optional">
-									</xs:attribute>
-									<xs:attribute name="literal" use="optional"
-										default="no">
-										<xs:simpleType>
-											<xs:restriction base="xs:string">
-												<xs:enumeration value="yes"></xs:enumeration>
-												<xs:enumeration value="no"></xs:enumeration>
-											</xs:restriction>
-										</xs:simpleType>
-									</xs:attribute>
-								</xs:complexType>
-							</xs:element>
-						</xs:sequence>
-						<xs:attribute type="xs:string" name="match" default="component"
-							use="optional" />
-						<xs:attribute type="xs:string" name="use" use="optional" />
-						<xs:attribute type="xs:string" name="label" use="optional" />
-						<xs:attribute name="sort" default="no" use="optional">
-							<xs:simpleType>
-								<xs:restriction base="xs:string">
-									<xs:enumeration value="yes"></xs:enumeration>
-									<xs:enumeration value="no"></xs:enumeration>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-						<xs:attribute name="show-unused" use="optional"
-							default="no">
-							<xs:simpleType>
-								<xs:restriction base="xs:string">
-									<xs:enumeration value="yes"></xs:enumeration>
-									<xs:enumeration value="no"></xs:enumeration>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-						<xs:attribute name="literal" default="no" use="optional">
-							<xs:simpleType>
-								<xs:restriction base="xs:string">
-									<xs:enumeration value="yes"></xs:enumeration>
-									<xs:enumeration value="no"></xs:enumeration>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-					</xs:complexType>
-				</xs:element>
-				<xs:element name="styles" maxOccurs="unbounded"
-					minOccurs="0">
-					<xs:complexType>
-						<xs:sequence>
-							<xs:element name="style" maxOccurs="unbounded"
-								minOccurs="1">
-								<xs:complexType>
-									<xs:simpleContent>
-										<xs:extension base="xs:string">
-											<xs:attribute type="xs:string" name="rule" use="optional" />
-											<xs:attribute type="xs:string" name="label" use="optional" />
-											<xs:attribute type="xs:string" name="value" use="optional" />
-											<xs:attribute name="literal" use="optional"
-												default="no">
-												<xs:simpleType>
-													<xs:restriction base="xs:string">
-														<xs:enumeration value="yes">
-														</xs:enumeration>
-														<xs:enumeration value="no">
-														</xs:enumeration>
-													</xs:restriction>
-												</xs:simpleType>
-											</xs:attribute>
-										</xs:extension>
-									</xs:simpleContent>
-								</xs:complexType>
-							</xs:element>
-						</xs:sequence>
-						<xs:attribute type="xs:string" name="match" default="component"
-							use="optional" />
-						<xs:attribute type="xs:string" name="use" use="optional" />
-						<xs:attribute type="xs:string" name="label" use="optional" />
-						<xs:attribute name="sort" default="no" use="optional">
-							<xs:simpleType>
-								<xs:restriction base="xs:string">
-									<xs:enumeration value="yes"></xs:enumeration>
-									<xs:enumeration value="no"></xs:enumeration>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-						<xs:attribute name="show-unused" use="optional"
-							default="no">
-							<xs:simpleType>
-								<xs:restriction base="xs:string">
-									<xs:enumeration value="yes"></xs:enumeration>
-									<xs:enumeration value="no"></xs:enumeration>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-						<xs:attribute name="literal" use="optional" default="no">
-							<xs:simpleType>
-								<xs:restriction base="xs:string">
-									<xs:enumeration value="yes"></xs:enumeration>
-									<xs:enumeration value="no"></xs:enumeration>
-								</xs:restriction>
-							</xs:simpleType>
-						</xs:attribute>
-					</xs:complexType>
-				</xs:element>
-				<xs:element name="colors" maxOccurs="unbounded"
-					minOccurs="0">
-					<xs:complexType>
-						<xs:sequence>
-							<xs:element name="color" maxOccurs="unbounded"
-								minOccurs="1">
-								<xs:complexType>
-									<xs:simpleContent>
-										<xs:extension base="xs:string">
-											<xs:attribute type="xs:string" name="label" use="optional" />
-											<xs:attribute type="xs:string" name="value" use="optional" />
-											<xs:attribute type="xs:string" name="rule" use="optional" />
-											<xs:attribute name="color" use="required">
-												<xs:annotation>
-													<xs:documentation>
-														The regular expression in the constraint
-														of
-														the "value" attribute is: 1) a valid rgb() expression or
-														2) a
-														valid hex number or 3) a valid alpha expression or 4)
-														a
-														three
-														digit hex triple or 5) a valid %rgb() expression.
-          								</xs:documentation>
-          							</xs:annotation>
-          							<xs:simpleType>
-<!-- TODO: Need to modify the last pattern below (%rgb() to accept digits from 0 to 100 instead of from 1 to 99 -->
-								<xs:restriction base="xs:string">
-									<xs:pattern
-										value="rgb\((((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5])),\s?){2}(((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))){1}\)|#(([0-9a-fA-F]){6})|([A-Z,a-z]+)|#([0-9a-fA-F]){3}|rgb\(([1-9][0-9]{0,1}%,\s?){2}([1-9][0-9]{0,1}%)\)">
-									</xs:pattern>
-								</xs:restriction>
-							</xs:simpleType>
-          						</xs:attribute>
-          						<xs:attribute name="literal" use="optional" default="no">
-          							<xs:simpleType>
-          								<xs:restriction
-          									base="xs:string">
-          									<xs:enumeration
-          										value="yes">
-          									</xs:enumeration>
-          									<xs:enumeration
-          										value="no">
-          									</xs:enumeration>
-          								</xs:restriction>
-          							</xs:simpleType>
-          						</xs:attribute>
-          					</xs:extension>
-          				</xs:simpleContent>
-          			</xs:complexType>
-          		</xs:element>
-          	</xs:sequence>
-          	<xs:attribute name="default" use="optional">
-          		<xs:annotation>
-          			<xs:documentation>
-          				The regular expression in the constraint of
-									the "value" attribute is: 1) a valid rgb() expression or 2) a
-									valid hex number or 3) a valid alpha expression or 4) a three
-									digit hex triple or 5) a valid %rgb() expression.
-          			</xs:documentation>
-          		</xs:annotation>
-          		<xs:simpleType>
-<!-- TODO: Need to modify the last pattern below (%rgb() to accept digits from 0 to 100 instead of from 1 to 99 -->
-								<xs:restriction base="xs:string">
-									<xs:pattern
-										value="rgb\((((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5])),\s?){2}(((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))){1}\)|#(([0-9a-fA-F]){6})|([A-Z,a-z]+)|#([0-9a-fA-F]){3}|rgb\(([1-9][0-9]{0,1}%,\s?){2}([1-9][0-9]{0,1}%)\)">
-									</xs:pattern>
-								</xs:restriction>
-							</xs:simpleType>
-          	</xs:attribute>
-          	<xs:attribute type="xs:string" name="match" use="optional"
-          		default="component" />
-          	<xs:attribute type="xs:string" name="use" use="optional" />
-          	<xs:attribute type="xs:string" name="label"
-          		use="optional" />
-          	<xs:attribute name="sort" use="optional" default="no">
-          		<xs:simpleType>
-          			<xs:restriction base="xs:string">
-          				<xs:enumeration value="yes"></xs:enumeration>
-          				<xs:enumeration value="no"></xs:enumeration>
-          			</xs:restriction>
-          		</xs:simpleType>
-          	</xs:attribute>
-          	<xs:attribute name="show-unused" use="optional"
-          		default="no">
-          		<xs:simpleType>
-          			<xs:restriction base="xs:string">
-          				<xs:enumeration value="yes"></xs:enumeration>
-          				<xs:enumeration value="no"></xs:enumeration>
-          			</xs:restriction>
-          		</xs:simpleType>
-          	</xs:attribute>
-          	<xs:attribute name="type" use="optional"
-          		default="background">
-          		<xs:simpleType>
-          			<xs:restriction base="xs:string">
-          				<xs:enumeration value="background"></xs:enumeration>
-          				<xs:enumeration value="text-highlight"></xs:enumeration>
-          				<xs:enumeration value="highlight"></xs:enumeration>
-          			</xs:restriction>
-          		</xs:simpleType>
-          	</xs:attribute>
-          	<xs:attribute name="literal" use="optional"
-          		default="no">
-          		<xs:simpleType>
-          			<xs:restriction base="xs:string">
-          				<xs:enumeration value="yes"></xs:enumeration>
-          				<xs:enumeration value="no"></xs:enumeration>
-          			</xs:restriction>
-          		</xs:simpleType>
-          	</xs:attribute>
-          </xs:complexType>
-        </xs:element>
-        <xs:element name="examples" maxOccurs="unbounded" minOccurs="0">
-          <xs:complexType>
-          	<xs:sequence>
-          		<xs:element name="cmp" maxOccurs="unbounded"
-          			minOccurs="0">
-          			<xs:complexType>
-          				<xs:simpleContent>
-          					<xs:extension base="xs:string">
-          						<xs:attribute type="xs:string"
-          							name="color" use="optional" />
-          						<xs:attribute type="xs:string"
-          							name="overlay" use="optional" />
-          						<xs:attribute type="xs:string"
-          							name="border" use="optional" />
-          						<xs:attribute name="highlight"
-          							type="xs:string" use="optional">
-          						</xs:attribute>
-          						<xs:attribute name="text-highlight"
-          							type="xs:string" use="optional">
-          						</xs:attribute>
-          						<xs:attribute name="style"
-          							type="xs:string" use="optional">
-          						</xs:attribute>
-          					</xs:extension>
-          				</xs:simpleContent>
-          			</xs:complexType>
-          		</xs:element>
-          	</xs:sequence>
-          	<xs:attribute type="xs:string" name="label"
-          		use="optional" />
-          	<xs:attribute name="literal" use="optional" default="no">
-          		<xs:simpleType>
-          			<xs:restriction base="xs:string">
-          				<xs:enumeration value="yes"></xs:enumeration>
-          				<xs:enumeration value="no"></xs:enumeration>
-          			</xs:restriction>
-          		</xs:simpleType>
-          	</xs:attribute>
-          </xs:complexType>
-        </xs:element>
-      </xs:sequence>
-    </xs:complexType>
-  </xs:element>
-</xs:schema>
\ No newline at end of file
Binary file sysmodellibs/sysmodelgen/rsc/installed/Xalan/Xalan-C_1_8.dll has changed
Binary file sysmodellibs/sysmodelgen/rsc/installed/Xalan/Xalan.exe has changed
Binary file sysmodellibs/sysmodelgen/rsc/installed/Xalan/XalanMessages_1_8.dll has changed
Binary file sysmodellibs/sysmodelgen/rsc/installed/Xalan/xerces-c_2_5_0.dll has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/LogItem.pm	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,108 @@
+# 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 LogItem;
+
+use FindBin;
+use lib $FindBin::Bin;
+use strict;
+
+use constant ERROR 								=> 1;
+use constant WARNING							=> 2;
+use constant INFO 								=> 3;
+use constant VERBOSE							=> 4;
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   new
+# Purpose:      Constructor
+# 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 %parameters = @_;
+	$self->{iMessage} 	= $parameters{'msg'} ? $parameters{'msg'} : "";
+	$self->{iCode} 		= $parameters{'code'} ? $parameters{'code'} : 0;
+	$self->{iModule} 	= $parameters{'module'} ? $parameters{'module'} : 0;
+	$self->{iSeverity} 	= $parameters{'severity'} ? $parameters{'severity'} : 3; # default is INFO
+	$self->{iDepth}		= $parameters{'depth'} ? $parameters{'depth'} : 0;
+	
+	$self->{iCode} = 0;
+	
+	$self->{iDate} 		= scalar(localtime);
+    return $self;
+	}
+
+sub Message()
+	{
+	my $self = shift;
+	$self->{iMessage} = $_[0] if $_[0];
+	return $self->{iMessage};
+	}
+
+sub Module()
+	{
+	my $self = shift;
+	$self->{iModule} = $_[0] if $_[0];
+	return $self->{iModule};
+	}
+
+sub Severity()
+	{
+	my $self = shift;
+	$self->{iSeverity} = $_[0] if $_[0];
+	return $self->{iSeverity};
+	}
+
+sub Depth()
+	{
+	my $self = shift;
+	$self->{iDepth} = $_[0] if $_[0];
+	return $self->{iDepth};
+	}
+
+sub Date()
+	{
+	my $self = shift;
+	$self->{iDate} = $_[0] if $_[0];
+	return $self->{iDate};
+	}
+
+sub Code()
+	{
+	my $self = shift;
+	$self->{iCode} = $_[0] if $_[0];
+	return $self->{iCode};
+	}
+
+sub LogText()
+	{
+	my $self = shift;
+	return $self->SeverityText()."(".$self->{iCode}.") [".$self->{iDate}."]: "." " x $self->{iDepth}.$self->{iMessage}."\n";
+	}
+
+sub SeverityText()
+	{
+	my $self = shift;
+	return "  ERROR" if $self->Severity() == ERROR;
+	return "WARNING" if $self->Severity() == WARNING;
+	return "VERBOSE" if $self->Severity() == VERBOSE;
+	return "   INFO";
+	}
+
+1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/Logger.pm	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,209 @@
+# 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 Logger;
+
+use FindBin;
+use lib $FindBin::Bin;
+
+use LogItem;
+
+
+# -------------------------------------------------------
+# 	ERROR & WARNING CODES
+# -------------------------------------------------------
+
+use constant KErrorNone							=> 0;
+
+use constant KIncorrectSyntax					=> 1;
+use constant KFileDoesNotExist					=> 2;
+use constant KCannotOpenFile					=> 3;
+use constant KBinaryDoesNotExist				=> 7;
+use constant KFailure							=> 9;
+use constant KNothingToDo							=> 10;
+use constant KUnknownError				=> 200;
+
+# System_Definition.xml error codes:
+use constant KSysDefNotFound					=> 31;
+use constant KInvalidSysDefXML					=> 32;
+use constant KConfigurationNotFound				=> 33;
+
+# Global statics:
+
+# This is expected to be set by the client code using $Logger::LOGFILE
+# If it's not defined, the logging is done to stdout
+$LOGFILE = "";
+
+$SEVERITY = LogItem::ERROR;
+
+# Forward declarations:
+sub Log($$$$);
+sub LogFatal($$$);
+sub LogError($$$);
+sub LogWarning($$$);
+sub LogInfo($$$);
+sub LogRaw($);
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   Log
+# Purpose:      Logs to the screen
+# Input:        Messsage, Module Code, Severity
+# Output:       None
+#-------------------------------------------------------------------------------------------------
+sub Log($$$$)
+	{
+	my $message = $_[0];
+	my $callingModule = $_[1];
+	my $severity = $_[2] ? $_[2] : LogItem::INFO;
+	my $depth = $_[3] ? $_[3] : 0;
+	
+	# log this only if its severity level is less than or equal to the user-defined level:
+	#  -w1: errors only (default)
+	#  -w2: warnings as well as errors
+	#  -w3: info messages, warnings and errors.
+	return if $severity > $SEVERITY;
+	
+	my $code = $callingModule;
+	my $logItem = new LogItem(msg => $message, code => $code, severity => $severity, depth => $depth);
+	&WriteToFile($logItem->LogText());
+	}
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   LogFatal
+# Purpose:      Logs to the screen
+# Input:        Message Module Code
+# Output:       None
+#-------------------------------------------------------------------------------------------------
+sub LogFatal($$$)
+	{
+	my $message = $_[0];
+	my $callingModule = $_[1];
+	my $depth = $_[2] ? $_[2] : 0;
+	my $exitCode = $_[3] ? $_[3] : KFailure;
+	&Log("Fatal! ".$message, $callingModule, LogItem::ERROR, $depth);
+	exit $exitCode;
+	}
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   LogError
+# Purpose:      Logs to the screen
+# Input:        Message Module Code
+# Output:       None
+#-------------------------------------------------------------------------------------------------
+sub LogError($$$)
+	{
+	my $message = $_[0];
+	my $callingModule = $_[1];
+	my $depth = $_[2] ? $_[2] : 0;
+	&Log($message, $callingModule, LogItem::ERROR, $depth);
+	}
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   LogWarning
+# Purpose:      Logs to the screen
+# Input:        Message Module Code
+# Output:       None
+#-------------------------------------------------------------------------------------------------
+sub LogWarning($$$)
+	{
+	# first check the severity level:
+	return if $SEVERITY < LogItem::WARNING;
+	
+	my $message = $_[0];
+	my $callingModule = $_[1];
+	my $depth = $_[2] ? $_[2] : 0;
+	&Log($message, $callingModule, LogItem::WARNING, $depth);
+	}
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   LogInfo
+# Purpose:      Logs to the screen
+# Input:        Message Module Code
+# Output:       None
+#-------------------------------------------------------------------------------------------------
+sub LogInfo($$$)
+	{
+	# first check the severity level:
+	return if $SEVERITY < LogItem::INFO;
+	
+	my $message = $_[0];
+	my $callingModule = $_[1];
+	my $depth = $_[2] ? $_[2] : 0;
+	&Log($message, $callingModule, LogItem::INFO, $depth);
+	}
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   LogRaw
+# Purpose:      Logs a piece of raw text to the screen
+# Input:        Messsage string
+# Output:       None
+#-------------------------------------------------------------------------------------------------
+sub LogRaw($)
+	{
+	# only log raw text if the warning level is on info - i.e. the most verbose:
+	return if $SEVERITY < LogItem::INFO;
+	&WriteToFile($_[0]);
+	}
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   LogList
+# Purpose:      Logs a list of log items
+# Input:        array of logs starting with ERROR, WARNING or Note
+# Output:       None
+#-------------------------------------------------------------------------------------------------
+sub LogList
+	{
+	foreach my $log (@_) 
+		{
+		$log.="\n";
+		if($log=~s/^ERROR:\s*//)
+			{
+			&LogError($log,KUnknownError,1);
+			}
+		elsif($log=~s/^WARNING:\s*//)
+			{
+			&LogWarning($log,KUnknownError,1);
+			}
+		elsif($log=~s/^Note:\s*//)
+			{
+			&LogInfo($log,KUnknownError,1);
+			}
+		else
+			{
+			&LogRaw($log);
+			}
+		}
+	}
+
+#-------------------------------------------------------------------------------------------------
+# Subroutine:   WriteToFile
+# Purpose:      
+# Input:        A message string
+# Output:       None
+#-------------------------------------------------------------------------------------------------
+sub WriteToFile()
+	{
+	my $message = shift;
+	if ($LOGFILE ne "")
+		{
+		open(LOGFILE, ">> $LOGFILE") or die "Can't open the log file '$LOGFILE': $!";
+		print LOGFILE $message;
+		}
+	else
+		{
+		print $message; # print to stdout
+		}
+	}
+
+1;
--- a/sysmodellibs/sysmodelgen/src/common/LogItem.pm	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-# 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 LogItem;
-
-use FindBin;
-use lib $FindBin::Bin;
-use DepConstants;
-
-#-------------------------------------------------------------------------------------------------
-# Subroutine:   new
-# Purpose:      Constructor
-# 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 %parameters = @_;
-	$self->{iMessage} 	= $parameters{'msg'} ? $parameters{'msg'} : "";
-	$self->{iCode} 		= $parameters{'code'} ? $parameters{'code'} : 0;
-	$self->{iModule} 	= $parameters{'module'} ? $parameters{'module'} : 0;
-	$self->{iSeverity} 	= $parameters{'severity'} ? $parameters{'severity'} : 3; # default is INFO
-	$self->{iDepth}		= $parameters{'depth'} ? $parameters{'depth'} : 0;
-	
-	$self->{iCode} = &DepConstants::ModuleErrorCodes($self->{iModule}, $self->{iSeverity}) if $self->{iCode} == 0;
-	
-	$self->{iDate} 		= scalar(localtime);
-    return $self;
-	}
-
-sub Message()
-	{
-	my $self = shift;
-	$self->{iMessage} = $_[0] if $_[0];
-	return $self->{iMessage};
-	}
-
-sub Module()
-	{
-	my $self = shift;
-	$self->{iModule} = $_[0] if $_[0];
-	return $self->{iModule};
-	}
-
-sub Severity()
-	{
-	my $self = shift;
-	$self->{iSeverity} = $_[0] if $_[0];
-	return $self->{iSeverity};
-	}
-
-sub Depth()
-	{
-	my $self = shift;
-	$self->{iDepth} = $_[0] if $_[0];
-	return $self->{iDepth};
-	}
-
-sub Date()
-	{
-	my $self = shift;
-	$self->{iDate} = $_[0] if $_[0];
-	return $self->{iDate};
-	}
-
-sub Code()
-	{
-	my $self = shift;
-	$self->{iCode} = $_[0] if $_[0];
-	return $self->{iCode};
-	}
-
-sub LogText()
-	{
-	my $self = shift;
-	return $self->SeverityText()."(".$self->{iCode}.") [".$self->{iDate}."]: "." " x $self->{iDepth}.$self->{iMessage}."\n";
-	}
-
-sub SeverityText()
-	{
-	my $self = shift;
-	return "  ERROR" if $self->Severity() == DepConstants::ERROR;
-	return "WARNING" if $self->Severity() == DepConstants::WARNING;
-	return "   INFO";
-	}
-
-1;
--- a/sysmodellibs/sysmodelgen/src/common/Logger.pm	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-# 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 Logger;
-
-use FindBin;
-use lib $FindBin::Bin;
-
-use DepConstants;
-use LogItem;
-
-# Global statics:
-
-# This is expected to be set by the client code using $Logger::LOGFILE
-# If it's not defined, the logging is done to stdout
-$LOGFILE = "";
-
-$SEVERITY = DepConstants::ERROR;
-
-# Forward declarations:
-sub Log($$$$);
-sub LogFatal($$$);
-sub LogError($$$);
-sub LogWarning($$$);
-sub LogInfo($$$);
-sub LogRaw($);
-
-#-------------------------------------------------------------------------------------------------
-# Subroutine:   Log
-# Purpose:      Logs to the screen
-# Input:        Messsage, Module Code, Severity
-# Output:       None
-#-------------------------------------------------------------------------------------------------
-sub Log($$$$)
-	{
-	my $message = $_[0];
-	my $callingModule = $_[1];
-	my $severity = $_[2] ? $_[2] : DepConstants::INFO;
-	my $depth = $_[3] ? $_[3] : 0;
-	
-	# log this only if its severity level is less than or equal to the user-defined level:
-	#  -w1: errors only (default)
-	#  -w2: warnings as well as errors
-	#  -w3: info messages, warnings and errors.
-	return if $severity > $SEVERITY;
-	
-	my $code = &DepConstants::ModuleErrorCodes($callingModule, $severity);
-	my $logItem = new LogItem(msg => $message, code => $code, severity => $severity, depth => $depth);
-	&WriteToFile($logItem->LogText());
-	}
-
-#-------------------------------------------------------------------------------------------------
-# Subroutine:   LogFatal
-# Purpose:      Logs to the screen
-# Input:        Message Module Code
-# Output:       None
-#-------------------------------------------------------------------------------------------------
-sub LogFatal($$$)
-	{
-	my $message = $_[0];
-	my $callingModule = $_[1];
-	my $depth = $_[2] ? $_[2] : 0;
-	my $exitCode = $_[3] ? $_[3] : DepConstants::KFailure;
-	&Log("Fatal! ".$message, $callingModule, DepConstants::ERROR, $depth);
-	exit $exitCode;
-	}
-
-#-------------------------------------------------------------------------------------------------
-# Subroutine:   LogError
-# Purpose:      Logs to the screen
-# Input:        Message Module Code
-# Output:       None
-#-------------------------------------------------------------------------------------------------
-sub LogError($$$)
-	{
-	my $message = $_[0];
-	my $callingModule = $_[1];
-	my $depth = $_[2] ? $_[2] : 0;
-	&Log($message, $callingModule, DepConstants::ERROR, $depth);
-	}
-
-#-------------------------------------------------------------------------------------------------
-# Subroutine:   LogWarning
-# Purpose:      Logs to the screen
-# Input:        Message Module Code
-# Output:       None
-#-------------------------------------------------------------------------------------------------
-sub LogWarning($$$)
-	{
-	# first check the severity level:
-	return if $SEVERITY < DepConstants::WARNING;
-	
-	my $message = $_[0];
-	my $callingModule = $_[1];
-	my $depth = $_[2] ? $_[2] : 0;
-	&Log($message, $callingModule, DepConstants::WARNING, $depth);
-	}
-
-#-------------------------------------------------------------------------------------------------
-# Subroutine:   LogInfo
-# Purpose:      Logs to the screen
-# Input:        Message Module Code
-# Output:       None
-#-------------------------------------------------------------------------------------------------
-sub LogInfo($$$)
-	{
-	# first check the severity level:
-	return if $SEVERITY < DepConstants::INFO;
-	
-	my $message = $_[0];
-	my $callingModule = $_[1];
-	my $depth = $_[2] ? $_[2] : 0;
-	&Log($message, $callingModule, DepConstants::INFO, $depth);
-	}
-
-#-------------------------------------------------------------------------------------------------
-# Subroutine:   LogRaw
-# Purpose:      Logs a piece of raw text to the screen
-# Input:        Messsage string
-# Output:       None
-#-------------------------------------------------------------------------------------------------
-sub LogRaw($)
-	{
-	# only log raw text if the warning level is on info - i.e. the most verbose:
-	return if $SEVERITY < DepConstants::INFO;
-	&WriteToFile($_[0]);
-	}
-
-#-------------------------------------------------------------------------------------------------
-# Subroutine:   LogList
-# Purpose:      Logs a list of log items
-# Input:        array of logs starting with ERROR, WARNING or Note
-# Output:       None
-#-------------------------------------------------------------------------------------------------
-sub LogList
-	{
-	foreach $log (@_) 
-		{
-		$log.="\n";
-		if($log=~s/^ERROR:\s*//)
-			{
-			&LogError($log,DepConstants::KUnknownModuleError,1);
-			}
-		elsif($log=~s/^WARNING:\s*//)
-			{
-			&LogWarning($log,DepConstants::KUnknownModuleError,1);
-			}
-		elsif($log=~s/^Note:\s*//)
-			{
-			&LogInfo($log,DepConstants::KUnknownModuleError,1);
-			}
-		else
-			{
-			&LogRaw($log);
-			}
-		}
-	}
-
-#-------------------------------------------------------------------------------------------------
-# Subroutine:   WriteToFile
-# Purpose:      
-# Input:        A message string
-# Output:       None
-#-------------------------------------------------------------------------------------------------
-sub WriteToFile()
-	{
-	my $message = shift;
-	if ($LOGFILE ne "")
-		{
-		open(LOGFILE, ">> $LOGFILE") or die "Can't open the log file '$LOGFILE': $!";
-		print LOGFILE $message;
-		}
-	else
-		{
-		print $message; # print to stdout
-		}
-	}
-
-1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/auxiliary/Example-shapes.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<shapes xmlns:s="http://www.w3.org/2000/svg">
+
+	<s:defs>   
+		<!-- bright circle pattern -->
+		<s:radialGradient id="new" gradientUnits="userSpaceOnUse" cx="10" cy="10" r="14">
+			<s:stop offset="0%" stop-color="white" stop-opacity="1"/>
+			<s:stop offset="100%" stop-opacity="0" stop-color="white" />
+		</s:radialGradient>
+
+		<!-- diagonal line pattern -->
+		<s:linearGradient id="ref" spreadMethod="repeat" gradientUnits="userSpaceOnUse" x1="0%" x2="15%" y1="0%" y2="15%">
+			<s:stop offset="0%" stop-opacity="0" stop-color="white" />
+			<s:stop offset="20%" stop-color="white" stop-opacity="1" />
+			<s:stop offset="40%" stop-opacity="0" stop-color="white" />
+			<s:stop offset="100%" stop-opacity="0" stop-color="white" />
+		</s:linearGradient>
+	</s:defs>
+
+	<!-- for some processors, /*/systemModel is much faster than //systemModel -->
+	
+	<!-- borders to use for OSD components -->
+	<!-- bracket, function or axis notation not allowed in use. Can only use blah/blah/@blah form -->
+	<borders use="s12[@ver=/*/systemModel/@ver]/@osd" label="Sched 12 Category" show-unused="yes">
+		<border type="box"/>
+		<border value="OS" type="box-clipLT"  label="Optional Symbian"/>
+		<border value="CS"  type="box-clipLB" label="Common Symbian"/>
+		<border value="CR"  type="box-clipRB"  label="Common Replace&#xad;able"/>
+		<border value="OR" viewBox="0 0 20 20"  label="Optional Replace&#xad;able">
+  			<s:path d="M 0 0 L 0 20 L 20 20 L 20 5 L 15 0 z" stroke="black" />
+  		</border>	
+		<border value="T-R" type="box-clipAll" label="Refer&#xad;ence/Test"/>
+	</borders>
+	
+	<patterns  show-unused="yes"> <!-- this is very slow, don't check if used -->
+		<overlay rule="s12[@ver=/*/systemModel/@ver]/@ref='true' or @ref='true'" type="striped-diag-up" label="Reference Compo&#xad;nent"/>
+		<overlay rule="@since = /*/systemModel/@ver or @introduced = /*/systemModel/@ver" type="radial-grad" label="New in {@ver}"/>
+	</patterns>
+	
+	<styles>
+		<style>stroke-width: 0.4</style>
+		<style rule="@plugin='true'" label="Plugin Compo&#xad;nent">stroke-width: 2</style>
+	</styles>
+<!--	<styles>
+		<style rule="Build and not(Build/*)" label="No build info">stroke-dasharray: 2,3; </style>
+	</styles> -->
+	 
+	 
+	<colors default="grey" use="@ts" label="Technology Streams">
+		 <color label="Connectivity Services" value="#cfb53b"/>
+		 <color label="Internet and Web Services" value="#ff8f68"/>
+		 <color label="Location Based Services" value="green"/>
+		 <color label="Java" value="#c0d9d9"/>
+		 <color label="Messaging" value="red"/>
+		 <color label="Multimedia" value="#8fbc8f"/>
+		 <color label="PIM Application Services" value="#ffff80"/>
+		 <color label="UI Frameworks" value="#00ff00"/>
+		 <color label="OS Packaging" value="#a29040"/>
+		 <color label="Platform Tools" value="#BAC97E"/>
+		 <color label="Software Engineering Tools" value="#56a1a1"/>
+		 <color label="Technical Documentation" value="#6A5182"/>
+		 <color label="Test Product" value="#544A38"/>
+		 <color label="System Engineering" value="#615FAD"/>
+		 <color label="Base Services" value="#8f8fbd"/>
+		 <color label="Baseband Adaption" value="#5f9f9f"/>
+		 <color label="Comms Framework" value="#527f76"/>
+		 <color label="Crypto Services" value="yellow"/>
+		 <color label="Development Boards" value="#934900"/>
+		 <color label="Kernel" value="#00ffff"/>
+		 <color label="Multimedia Protocols" value="#eaadea"/>
+		 <color label="IP Networking" value="#ff7f00"/>
+		 <color label="Open Environment" value="#817485"/>
+		 <color label="Peripherals" value="#008000"/>
+		 <color label="Persistent Data Services" value="#993366"/>
+		 <color label="Shortlink" value="#db7093"/>
+		 <color label="Telephony Services" value="#3299cc"/>
+		 <color label="Text and I18n Services" value="#9f9f5f"/> 
+	</colors>
+	<!-- these can also go in the model.xml in a legend element -->
+	<examples>
+		<cmp color="Graphics">Plug-in</cmp>
+		<cmp overlay="Reference Compo&#xad;nent" border="Common Symbian">Reference</cmp>
+		<cmp overlay="New in {@ver}">New {@ver}</cmp>
+		<!--<cmp style="No build info">No build info</cmp>	-->	
+	</examples>
+
+<!-- stuff without rule is the fallback option (used only if others are not used) -->
+</shapes>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/auxiliary/Levels.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<levels>
+<block name="Generic OS Services" levels="Libraries Services"/>
+	<collection name="Generic Services" level="Services"/>
+	<collection name="Generic Libraries" level="Libraries"/>	
+</levels>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/auxiliary/Levels91.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<levels>
+<block name="Generic OS Services" levels="Libraries Services"/>
+	<collection name="Generic Services" level="Services"/>
+	<collection name="Generic Libraries" level="Libraries"/>	
+
+
+<layer name="Kernel Services and Hardware Interface" levels="Hardware-dependent Hardware-independent"/>
+  	<collection name="ASSP" level="Hardware-dependent"/>
+  	<collection name="Kernel Services"  level="Hardware-independent"/>
+  	<collection name="Logical Device Drivers" level="Hardware-independent"/>
+  	<collection name="Variant" level="Hardware-dependent"/>
+  	<collection name="Localisation" level="Hardware-independent"/>
+  	<collection name="Screen Driver" level="Hardware-dependent"/>
+  	
+  <layer name="Base Services" levels="Kernel-interface System-interface"/>
+  	<collection name="Low Level Libraries and Frameworks" level="System-interface"/>
+  	<collection name="User Library and File Server" level="Kernel-interface"/>
+  	<collection name="User Side Hardware Abstraction" level="Kernel-interface"/>
+  	<collection name="Text Mode Shell" level="System-interface"/>
+  
+  <layer name="OS Services"  levels="hardware-interface plugin framework server application-interface"/>
+  	<collection name="Comms Process and Settings"   level="server"/>
+  	<collection name="Telephony Utilities" level="application-interface"/>
+  	<collection name="Telephony Server" level="server"/>
+  	<collection name="SMS Protocol Plugins" level="framework"/>
+  	<collection name="SMS Utilities" level="application-interface"/>
+  	<collection name="Telephony Server Plugins" level="plugin"/>
+  	<collection name="Telephony Reference Platform"  level="plugin"/>
+  
+  	<collection name="Serial Comms Server"  level="application-interface"/>
+  	<collection name="Short Link" level="server"/>
+  	<collection name="OBEX" level="application-interface"/>
+  	<collection name="USB Manager" level="application-interface"/>
+  	<collection name="Short Link Protocol Plugins" level="framework"/>
+  	<collection name="Serial Comms Server Plugins"  level="plugin"/>
+  
+  	<collection name="TCP/IP Security" level="application-interface"/>
+  	<collection name="TCP/IP Utilities" level="application-interface"/>
+  	<collection name="Sockets Server" level="server"/>
+  	<collection name="Network Protocol Plugins" level="framework"/>
+  	<collection name="Networking Plugins"  level="plugin"/>
+  	<collection name="Link Layer Control" level="hardware-interface"/>
+  	<collection name="WAP Stack" level="application-interface"/>
+  	<collection name="QoS Interface"  level="server"/>
+  
+  	<collection name="Multimedia" level="application-interface"/>
+  	<collection name="Windowing Framework" level="server"/>
+  	<collection name="OpenGL ES" level="server"/>
+  	<collection name="Graphics and Printing Services" level="framework"/>
+  	<collection name="Graphics Device Interface"  level="plugin"/>
+  	<collection name="OpenVG" level="plugin"/>
+  	<collection name="EGL"  level="plugin"/>
+  
+  	<collection name="Service Providers" level="server"/>
+  	<collection name="Service Framework" level="framework"/>
+  	<collection name="Connectivity PC Side" level="framework"/>
+  	<collection name="Device Connection"  level="plugin"/>
+  
+  <layer name="Application Services"  levels="generic specific"/>
+  	<collection name="PIM App Services" level="specific"/>
+  	<collection name="PIM App Support" level="generic"/>
+  	<collection name="Office App Engines" level="specific"/>
+  	<collection name="Other App Services" level="specific"/>
+  	<collection name="Messaging App Support" level="generic"/>
+  	<collection name="Content Handling" level="specific"/>
+  	<collection name="Data Sync Services" level="specific"/>
+  	<collection name="Device Provisioning" level="specific"/>
+  	<collection name="Client Provisioning" level="specific"/>
+  	<collection name="Internet and Web Application Support" level="generic"/>
+  	<collection name="Application Launch Services" level="generic"/>
+  	<collection name="Application Framework" level="specific"/>
+  	<collection name="Printing Support" level="generic"/>
+  	<collection name="Multimedia Protocols" level="generic"/>
+  	<collection name="Text Rendering" level="generic"/>
+  
+  <layer name="Programming Support" levels="config package profile"/>
+  	<collection name="MIDP 2.0 Profile" level="profile"/>
+  	<collection name="MIDP 2.0 Packages" level="package"/>
+  	<collection name="CLDC 1.1" level="config"/>
+  	<collection name="Bluetooth and SMS Push" level="config"/>
+  	<collection name="Low Level Plugins"  level="config"/>
+  	<collection name="Virtual Machine" level="package"/>
+</levels>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/auxiliary/Shapes.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<shapes xmlns:s="http://www.w3.org/2000/svg">
+	
+	<!-- borders to use for OSD components -->
+	<borders use="s12/@osd" label="Sched 12 Category" show-unused="yes">
+		<border type="box"/>
+		<border value="OS" type="box-clipLT" label="Optional Symbian"/>
+		<border value="CS"  type="box-clipLB" label="Common Symbian"/>
+		<border value="CR"  type="box-clipRB" label="Common Replace&#xad;able"/>
+		<border value="OR" type="box-clipRT" label="Optional Replace&#xad;able"/>
+		<border value="T-R" type="box-clipAll" label="Refer&#xad;ence/Test"/>
+	</borders>
+	
+	<patterns show-unused="yes"> <!-- this could be very slow, don't check if used -->
+		 <overlay rule="@deprecated and (VERSION(@deprecated) &lt;=  VERSION())" label="Depre&#xad;cated Compo&#xad;nent" type="big-X"/> 
+		<overlay rule="s12/@ref='true' or @ref='true'" type="striped-diag-up" label="Reference Compo&#xad;nent"/>
+		<overlay rule="@since = /*/systemModel/@ver or @introduced = /*/systemModel/@ver" type="radial-grad" label="New in {@ver}"/>
+	</patterns>
+	
+	<styles>
+		<style>stroke-width: 0.4</style>
+		<style rule="@plugin='true'" label="Plugin Compo&#xad;nent">stroke-width: 2</style>
+	</styles>
+</shapes>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/auxiliary/SystemInfo.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,362 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<model>
+ <c removed="9.2" name="Application Installer"/>
+ <c introduced="8.0" name="Content Handling Framework"/>
+ <c name="Java MIDlet Installer" introduced="7.0s"/>
+ <c name="SIS Installer" introduced="7.0s"/>
+ <c introduced="9.1" name="System Starter"/>
+ <c name="View Server" introduced="6.0"/>
+ <c plugin="Y" name="BIO Messaging Parsers"/>
+ <c introduced="8.0" name="Content Access Frmwrk. for DRM"/>
+ <c introduced="8.0" name="Content Access Framework to support DRM"/>
+ <c introduced="8.0" name="Device Management Plugins" plugin="Y"/>
+ <c introduced="9.1" name="Content Access Framework for DRM"/>
+ <c name="Reference DRM Agent" ref="true" introduced="8.0"/>
+ <c introduced="8.0" plugin="Y" name="MMF Recognisers"/>
+ <c name="SMIL Parser" introduced="8.0"/>
+ <c plugin="Y" name="WAP Push Handlers" introduced="6.2"/>
+ <c plugin="Y" name="Web Recognisers"/>
+ <c removed="" plugin="Y" name="Data Sync Plugins"/>
+ <c introduced="8.0" name="Sync Initiation"/>
+ <c introduced="8.0" name="Device Management Framework"/>
+ <c plugin="Y" introduced="9.1" name="Device Management Adaptors"/>
+ <c introduced="9.1" name="Client Provisioning Framework"/>
+ <c introduced="9.1" plugin="Y" name="Client Provisioning Adaptors"/>
+ <c name="Bookmark Support" introduced="9.1"/>
+ <c name="FTP Engine" introduced="6.0"/>
+ <c plugin="Y" name="HTTP Filter Plugins"/>
+ <c plugin="Y" name="HTTP Protocol Plugins" introduced="6.2"/>
+ <c name="HTTP Transport Framework" introduced="6.2"/>
+ <c name="URI Permission Services" introduced="9.4"/>
+ <c name="HTTP Transport Plugins" plugin="Y"/>
+ <c name="HTTP Utilities Library" introduced="6.2"/>
+ <c name="Network Address and Port Translation" introduced="9.4" plugin="Y"/>
+ <c name="Telnet Engine" introduced="6.0"/>
+ <c name="WAP Push Framework" introduced="6.1"/>
+ <c plugin="Y" name="WAP Push MTM"/>
+ <c plugin="Y" name="BIO Watchers"/>
+ <c plugin="Y" introduced="8.1" name="CDMA MTM"/>
+ <c plugin="Y" name="IMAP4 MTM"/>
+ <c plugin="Y" name="OBEX MTMs"/>
+ <c plugin="Y" name="POP3 MTM"/>
+ <c plugin="Y" name="Scheduled Send MTM"/>
+ <c outsource="9.0" plugin="Y" name="SMS MTM"/>
+ <c plugin="Y" name="SMTP MTM"/>
+ <c introduced="9.0" name="RTP"/>
+ <c outsource="9.1" introduced="9.1" name="SIP Framework"/>
+ <c name="SIP Connection Provider Plugins" introduced="9.2"/>
+ <c name="Convert" plugin="Y" introduced="5.0" deprecated="9.3"/>
+ <c name="Data Engine" introduced="5.0" deprecated="9.3"/>
+ <c name="Sheet Engine" introduced="5.0" deprecated="9.3"/>
+ <c name="Word Engine" introduced="5.0" deprecated="9.3"/>
+ <c name="Help" introduced="6.0"/>
+ <c introduced="9.1" name="Timezone"/>
+ <c name="World Server" introduced="7.0" deprecated="9.1"/>
+ <c name="Agenda Model" introduced="5.0" deprecated="9.1"/>
+ <c name="Calendar" introduced="9.2"/>
+ <c plugin="Y" name="Agenda Versit Plugin"/>
+ <c name="Contacts Model" introduced="5.0"/>
+ <c name="Alarm Server" introduced="7.0"/>
+ <c introduced="8.1" name="Backup Restore Notification"/>
+ <c outsource="9.0" name="Chinese Calendar Converter" introduced="6.1"/>
+ <c name="Other File Converter Plugins" plugin="Y" deprecated="9.3"/>
+ <c plugin="Y" name="File Converter Plugins"/>
+ <c name="vCard and vCal" introduced="5.0"/>
+ <c introduced="ER5" name="Application Utilities"/>
+ <c name="Central Repository 2" introduced="8.1"/>
+ <c name="Central Repository" introduced="7.0s"/>
+ <c plugin="Y" name="Character Encoding and Conversion Plugins"/>
+ <c name="Feature Registry" introduced="9.2" deprecated="9.5"/>
+ <c name="DBMS Emulation Library" introduced="9.3"/>
+ <c outsource="9.0" plugin="Y" name="Media Device Framework Plugins"/>
+ <c introduced="6.2" name="Plugin Framework"/>
+ <c name="Power, Memory and Disk Management" introduced="7.0"/>
+ <c name="Power and Memory Notification Service" introduced="6.0"/>
+ <c name="Domain Manager" introduced="7.0"/>
+ <c name="Hardware Resources Manager" introduced="9.5"/>
+ <c plugin="Y" name="WBXML Parser" introduced="7.0s"/>
+ <c name="XML Framework" introduced="7.0s"/>
+ <c plugin="Y" name="XML Parser" introduced="7.0s"/>
+ <c introduced="6.0" name="Zip Compression Library"/>
+ <c introduced="9.1" plugin="Y" name="FAT Filename Conversion Plugins"/>
+ <c plugin="Y" name="File Systems"/>
+ <c plugin="Y" name="ROFS File System"/>
+ <c plugin="Y" name="USB Mass Storage File System"/>
+ <c plugin="Y" name="LFFS File System"/>
+ <c plugin="Y" name="NTFS File System"/>
+ <c name="ROM File System" plugin="Y"/>
+ <c name="LFFS File System" plugin="Y"/>
+ <c name="FAT32 File System" plugin="Y"/>
+ <c name="FAT File System" plugin="Y"/>
+ <c name="Composite File System" plugin="Y"/>
+ <c name="ISO9660 File System" plugin="Y"/>
+ <c plugin="Y" name="NAND Flash Translation Layer" introduced="7.0s" deprecated="9.1"/>
+ <c plugin="Y" name="File System Plugins"/>
+ <c plugin="Y" name="Bluetooth 1.0" introduced="8.0">
+  <location>Programming Support/Java J2ME/Bluetooth and SMS Push</location>
+ </c>
+ <c plugin="Y" name="WMA 1.1">
+  <location>Programming Support/Java J2ME/Bluetooth and SMS Push</location>
+ </c>
+ <c plugin="Y" name="LCDUI Plugin"/>
+ <c plugin="Y" name="Runtime Plugin"/>
+ <c name="Bluetooth 1.0" introduced="8.0">
+  <location>Programming Support/Java J2ME/MIDP 2.0 Packages</location>
+ </c>
+ <c name="JTWI 1.0" introduced="8.0"/>
+ <c outsource="9.1" name="Mobile 3D 1.0" introduced="8.0"/>
+ <c name="Mobile Media API 1.1" introduced="8.0"/>
+ <c name="WMA 1.1">
+  <location>Programming Support/Java J2ME/MIDP 2.0 Packages</location>
+ </c>
+ <c introduced="9.1" plugin="Y" ref="true" name="MIDP GSM Security RP"/>
+ <c plugin="Y" ref="true" name="Security Policy"/>
+ <c introduced="9.0" ref="true" name="OMAP 1623"/>
+ <c name="Kernel Architecture 2" introduced="8.0"/>
+ <c name="SD Card Driver" ref="true" plugin="Y"/>
+ <c plugin="Y" outsource="9.0" ref="true" name="Audio Driver" introduced="7.0s"/>
+ <c plugin="Y" name="Ethernet Driver"/>
+ <c plugin="Y" outsource="9.0" ref="true" name="MIDI Driver" introduced="8.0"/>
+ <c plugin="Y" name="Other LDDs"/>
+ <c plugin="Y" outsource="9.0" introduced="8.0" ref="true" name="Speech Driver"/>
+ <c plugin="Y" name="USB Driver"/>
+ <c plugin="Y" outsource="9.0" ref="true" name="Video Driver" introduced="8.0"/>
+ <c plugin="Y" name="Media Drivers"/>
+ <c name="Bootstrap" ref="true"/>
+ <c ref="true" name="Emulator"/>
+ <c ref="true" name="Lubbock Variant"/>
+ <c introduced="9.0" ref="true" name="OMAP H2"/>
+ <c ref="true" name="OMAP H4"/>
+ <c ref="true" name="OMAP H4 Variant"/>
+ <c ref="true" plugin="Y" name="PDDs"/>
+ <c plugin="Y" name="Peripheral Bus Controllers"/>
+ <c plugin="Y" name="Locale Support"/>
+ <c plugin="Y" name="Screen Driver" introduced="6.1"/>
+ <c plugin="Y" name="MMS MTM"/>
+ <c name="Baseband Channel Adaptor" introduced="8.1"/>
+ <c name="Inter-System Communication" introduced="9.5"/>
+ <c name="Baseband Channel Adaptor for C32" plugin="Y"/>
+ <c name="Baseband Channel Adaptor for ISC" plugin="Y"/>
+ <c introduced="9.3" name="Wireless LAN"/>
+ <c introduced="9.1" name="Bluetooth Audio Video Remote Control Profile"/>
+ <c introduced="9.1" name="Bluetooth Generic Audio Video Distribution Profile"/>
+ <c name="Bluetooth HCI Proxy">
+  <location note="Not shown (belongs to Short Link)"/>
+ </c>
+ <c outsource="No" introduced="9.1" name="Bluetooth OBEX 1.0"/>
+ <c introduced="9.1" name="Cell Broadcast Services"/>
+ <c name="Assabet BSP" ref="true"/>
+ <c name="INTEGRATOR_CM1136" ref="true"/>
+ <c name="INTEGRATOR_CM920" ref="true"/>
+ <c name="INTEGRATOR_CORE" ref="true"/>
+ <c outsource="No" name="Linkup BSP"/>
+ <c name="IP Hook Examples" ref="true"/>
+ <c name="IP Examples" ref="true"/>
+ <c introduced="9.1" name="Timezone compiler"/>
+ <c introduced="9.1" name="Timezone database"/>
+ <c introduced="9.1" name="Timezone localization"/>
+ <c name="Crypto SPI Plugins" plugin="Y" introduced="9.5"/>
+ <c name="SWI Analysis Toolkit" ref="true"/>
+ <c plugin="Y" name="Ethernet NIF"/>
+ <c plugin="Y" name="Ethernet Over IR Packet Driver"/>
+ <c plugin="Y" name="Ethernet Packet Driver"/>
+ <c plugin="Y" name="PPP Compression Plugins"/>
+ <c outsource="9.0" plugin="Y" name="PPP NIF"/>
+ <c plugin="Y" ref="true" name="SLIP NIF"/>
+ <c plugin="Y" name="Tunnel NIF"/>
+ <c outsource="9.0" plugin="Y" name="Core IPSec PRT"/>
+ <c name="IP Event Notifier" plugin="Y"/>
+ <c outsource="9.0" plugin="Y" introduced="7.0s" name="QoS Framework PRT"/>
+ <c outsource="9.0" plugin="Y" name="TCP/IPv4/v6 PRT"/>
+ <c plugin="Y" name="Bluetooth PAN Profile" introduced="8.1"/>
+ <c plugin="Y" name="CSD AGT"/>
+ <c plugin="Y" name="GPRS/UMTS QOS PRT"/>
+ <c plugin="Y" name="NULL AGT"/>
+ <c plugin="Y" name="PSD AGT"/>
+ <c name="Connection Provider Plugin" plugin="Y"/>
+ <c removed="9.1" name="Connection AGT" plugin="Y"/>
+ <c name="Subconnection Parameters" plugin="Y"/>
+ <c ref="true" name="WAP Short Stack" introduced="8.0"/>
+ <c plugin="Y" name="Bluetooth CSY"/>
+ <c plugin="Y" name="IrDA CSY"/>
+ <c plugin="Y" name="Serial Port CSY"/>
+ <c plugin="Y" name="USB CSY"/>
+ <c name="Bluetooth Protocol Client APIs" introduced="8.0"/>
+ <c name="HCI Framework" introduced="9.2"/>
+ <c introduced="9.1" name="Remote Control Framework"/>
+ <c ref="true" name="Bluetooth HCI"/>
+ <c plugin="Y" name="Bluetooth Stack PRT"/>
+ <c plugin="Y" name="IrDA PRT"/>
+ <c name="CDMA SMS Stack" plugin="Y" introduced="8.1"/>
+ <c name="SMS Stack" plugin="Y"/>
+ <c plugin="Y" introduced="8.1" name="CDMA SMS Plugins"/>
+ <c plugin="Y" introduced="8.1" name="CDMA WAP Protocol"/>
+ <c plugin="Y" introduced="8.1" name="CDMA WAP PRT"/>
+ <c plugin="Y" name="SMS PRT"/>
+ <c plugin="Y" name="WAP PRT"/>
+ <c ref="true" plugin="Y" name="TRP CSY"/>
+ <c ref="true" plugin="Y" name="TRP TSY"/>
+ <c introduced="8.1" name="Etel CDMA"/>
+ <c introduced="8.1" name="ETel CDMA"/>
+ <c name="ETel SIM Toolkit" introduced="6.1"/>
+ <c plugin="Y" introduced="8.1" ref="true" name="CDMA TSY"/>
+ <c introduced="8.1" plugin="Y" outsource="9.0" ref="true" name="MultiMode TSY"/>
+ <c introduced="8.0" plugin="Y" ref="true" name="SIM TSY"/>
+ <c name="Dial" deprecated="9.1"/>
+ <c name="Phonebook Sync" plugin="Y"/>
+ <c plugin="Y" name="Telephony Watchers"/>
+ <c name="Bearer Abstraction Layer" introduced="8.0"/>
+ <c introduced="8.0" name="Server Socket"/>
+ <c name="Service Broker" introduced="8.0"/>
+ <c name="Remote File Server" introduced="8.0"/>
+ <c introduced="9.0" name="Secure Backup Engine"/>
+ <c introduced="9.0" name="Backup Engine"/>
+ <c introduced="9.0" name="Secure Backup Socket Server"/>
+ <c name="Software Install Server" introduced="8.0"/>
+ <c name="C Standard Library" introduced="ER5"/>
+ <c name="Certificate and Key Management" introduced="6.0"/>
+ <c name="Event Logger" introduced="6.0"/>
+ <c name="Task Scheduler" introduced="6.0"/>
+ <c ref="true" plugin="Y" name="FreeType Font Rasteriser"/>
+ <c ref="true" name="Reference Fonts"/>
+ <c ref="true" plugin="Y" name="Printer Drivers"/>
+ <c removed="" ref="true" name="Reference Bitmap Fonts"/>
+ <c introduced="8.0" name="Colour Palette"/>
+ <c introduced="9.5" name="OpenVG Implementation" ref="true"/>
+ <c introduced="9.1" name="Broadcast Tuner"/>
+ <c name="Camera Framework" introduced="7.0s"/>
+ <c ref="true" name="Camera" introduced="7.0s"/>
+ <c ref="true" name="Camera Plugins" plugin="Y" introduced="7.0s"/>
+ <c name="Imaging Frameworks" introduced="7.0s"/>
+ <c name="Image Conversion Library" introduced="7.0s"/>
+ <c plugin="Y" name="Imaging Plugins" introduced="7.0s"/>
+ <c plugin="Y" name="Image Conversion Library Plugins" introduced="7.0s"/>
+ <c name="Multimedia Framework" introduced="7.0s"/>
+ <c plugin="Y" name="Multimedia Framework Plugins" introduced="7.0s"/>
+ <c outsource="9.2" introduced="8.0" ref="true" plugin="Y" name="OpenGL ES"/>
+ <c introduced="9.2" name="OpenGL ES Display Properties"/>
+ <c name="OpenGL ES Framework" introduced="8.0"/>
+ <c name="UI Look and Feel" introduced="6.0"/>
+ <c name="UIKON" introduced="6.0"/>
+ <c plugin="Y" name="UIKON Error Resolver Plugin" ref="true"/>
+ <c name="Error Resolver Data" ref="true"/>
+ <c introduced="9.1" name="Animation"/>
+ <c name="BMP Animation" introduced="6.0"/>
+ <c plugin="Y" name="Clock"/>
+ <c name="Graphics Effects" introduced="9.2"/>
+ <c name="MUX CSY" plugin="Y" ref="true"/>
+ <c name="TRP AGT" plugin="Y" ref="true"/>
+ <c name="User Prompt Service" introduced="9.5"/>
+ <c name="Location Based Services" introduced="9.2"/>
+ <c name="OBEX Extension API" introduced="9.2"/>
+ <c name="Text Shaper Plugin" introduced="9.2" plugin="Y"/>
+ <c name="SQL" introduced="9.3"/>
+ <c name="Open Environment Core" introduced="9.4"/>
+ <c name="Root Certificates" introduced="7.0s"/>
+ <c name="EGL Implementation" ref="true" introduced="9.4"/>
+ <c name="EGL API" ref="true" introduced="9.4"/>
+ <c introduced="8.0" ref="true" name="OpenGL ES Implementation"/>
+ <c introduced="8.0" ref="true" name="OpenGL ES API"/>
+ <c ref="true" plugin="Y" name="iType Font Rasteriser" introduced="9.5"/>
+ <c ref="true" introduced="9.5" name="OpenVG API"/>
+ <c name="Phonebook Access Profile" introduced="9.2"/>
+ <c name="Location Framework" introduced="9.2"/>
+ <c name="LBS Plugins" introduced="9.2"/>
+ <c name="LBS Network Test" introduced="9.2"/>
+ <c name="Location Server" introduced="9.2"/>
+ <c name="Network Request Handler" introduced="9.2"/>
+ <c name="A-GPS Location Manager" introduced="9.2"/>
+ <c name="Network Location Manager" introduced="9.2"/>
+ <c name="Network Gateway" introduced="9.2"/>
+ <c name="Network Protocol Module" introduced="9.2" plugin="Y" ref="true"/>
+ <c name="MTP Framework" introduced="9.4"/>
+ <c name="MTP File and Folder Provider" introduced="9.4"/>
+ <c name="MTP USB Transport" introduced="9.4" plugin="Y"/>
+ <c name="MTP Integration Test" introduced="9.4"/>
+ <c name="TRP Dispatch Layer Plugins" plugin="Y"/>
+ <c name="UTRACE" introduced="9.3" deprecated="9.4"/>
+ <c name="WLDDATABASEKIT" introduced="6.0" deprecated="9.1"/>
+ <c name="WLDTOOLS" introduced="5.0" deprecated="9.1"/>
+ <c name="File-based Certificate and Key Stores" introduced="8.0"/>
+ <c name="Surface Manager LDD" introduced="9.5"/>
+ <c name="Common Graphics Headers" introduced="9.5"/>
+ <c name="Graphics Composition Engine" introduced="9.5"/>
+ <c name="Composition Engine Adaptation" introduced="9.5"/>
+ <c name="Graphics Resource Content Update" introduced="9.5"/>
+ <c name="HTML to RichText Converter" plugin="Y"/>
+ <c name="File Converter Plugins" plugin="Y"/>
+ <c name="RichText to HTML Converter" plugin="Y"/>
+ <c introduced="9.1" name="Time Zone Server"/>
+ <c introduced="9.1" name="Time Zone Compiler"/>
+ <c introduced="9.1" name="Time Zone Database"/>
+ <c introduced="9.1" name="Time Zone Localisation"/>
+ <c name="Secure Software Install Device Tools" ref="true"/>
+ <c name="CAF Recogniser Configuration" ref="true"/>
+ <c plugin="Y" name="POP3 and SMTP MTM"/>
+ <c name="Chart" introduced="5.0" deprecated="9.3"/>
+ <c name="World Server" introduced="7.0" deprecated="9.1"/>
+ <c name="World Database Kit" deprecated="9.1"/>
+ <c name="World Tools" deprecated="9.1"/>
+ <c name="Cotulla ASSP" ref="true"/>
+ <c name="E32 Utilities" ref="true"/>
+ <c name="Unistore2 Emulator Support" ref="true" introduced="9.4"/>
+ <c name="Integrator Unistore2 NAND Logic Module" ref="true"/>
+ <c introduced="9.0" ref="true" name="OMAP H2 BSP"/>
+ <c name="Unistore2 Boot Support" ref="true"/>
+ <c ref="true" name="Emulator BSP"/>
+ <c name="Integrator ARM1136 Core Module" ref="true"/>
+ <c name="Integrator ARM920 Core Module" ref="true"/>
+ <c name="Integrator Core Modules" ref="true"/>
+ <c name="Integrator Motherboard" ref="true"/>
+ <c name="Integrator SSR NAND Logic Module" ref="true"/>
+ <c name="Integrator XX600 Logic Module" ref="true"/>
+ <c name="OMAP H2 SDIO" ref="true"/>
+ <c name="OMAP H4 SDIO" ref="true"/>
+ <c name="OMAP H2 Unistore2" ref="true"/>
+ <c name="OMAP H4 Unistore2" ref="true"/>
+ <c name="H4 Boot Loader" ref="true"/>
+ <c name="OMAP H4 Mini Environment Boot Loader" ref="true"/>
+ <c name="StrongArm 1100 ASSP" ref="true"/>
+ <c name="System On Chip ASSP" ref="true"/>
+ <c name="Template Variant" ref="true"/>
+ <c name="OMAP H4 BSP" ref="true"/>
+ <c name="Lubbock BSP" ref="true"/>
+ <c name="SIP Params" plugin="Y"/>
+ <c name="SIP Subconnection Provider" plugin="Y"/>
+ <c name="SIP Connection Provider" plugin="Y"/>
+ <c name="SIP Connection Plugins" plugin="Y" introduced="9.5"/>
+ <c name="Data Sync Adaptors" plugin="Y"/>
+ <c name="PLP Variant" deprecated="9.0"/>
+ <c name="PLP Remote Link" deprecated="9.0"/>
+ <c name="Event Broadcast" deprecated="9.0"/>
+ <c name="OpenMAX" introduced="9.4"/>
+ <c name="Multimedia Validation Suite Integration Tests" introduced="9.4"/>
+ <c name="Multimedia Validation Suite Agents" introduced="9.4"/>
+ <c name="Multimedia Validation Suite Application" introduced="9.4"/>
+ <c name="Assabet BSP" deprecated="8.0"/>
+ <c name="StrongArm 1100 ASSP" deprecated="8.0"/>
+ <c name="Reference DevSound Plugins" plugin="Y"/>
+ <c name="Bluetooth DevSound Plugin" plugin="Y"/>
+ <c name="A-GPS Reference Module" plugin="Y"/>
+ <c name="SIP Dummy PRT" plugin="Y"/>
+ <c name="MTP File and Folder Provider" plugin="Y"/>
+ <c name="Weak Crypto SPI" introduced="9.5"/>
+ <c name="Strong Crypto SPI" introduced="9.5"/>
+ <c name="Feature Manager" introduced="9.6"/>
+ <c name="IP CPR Shim" plugin="Y"/>
+ <c name="GPRS QOS PRT" plugin="Y"/>
+ <c name="UMTS QOS PRT" plugin="Y"/>
+ <c name="Predictor Compression" plugin="Y"/>
+ <c name="Stac LZS Compression" plugin="Y"/>
+ <c name="MPPC" plugin="Y"/>
+ <c name="UMTS/GPRS SCPR" plugin="Y"/>
+ <c name="QOS 3GPP CPR" plugin="Y"/>
+ <c name="PDP SCPR" plugin="Y"/>
+ <c name="IP CPR" plugin="Y"/>
+ <c name="IP SCPR" plugin="Y"/>
+ <c name="QOS IP SCPR" plugin="Y"/>
+ <c name="IP Proto-CPR" plugin="Y"/>
+ <c name="TCP CPR" plugin="Y"/>
+ <c name="Graphics Composition Engine" introduced="9.5"/>
+ <c name="Mass Storage Driver" introduced="9.5"/>
+</model>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/auxiliary/display-names.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<display-names>
+	<abbrev name="PIM App Services" abbrev="PIM Application Services"/>
+	<abbrev name="Other App Services" abbrev="Other Application Services"/>
+	<abbrev name="Office App Engines" abbrev="Office Application Engines"/>
+	<abbrev name="Device Provisioning" abbrev="Device Management"/>
+	<abbrev name="PIM App Support" abbrev="PIM Application Support"/>
+	<abbrev name="Internet and Web Application Support" abbrev="Internet &amp; Web App Support"/>
+	<abbrev  name="Application Launch Services" abbrev="App. Launch Services"/>
+	<abbrev  name="QoS Interface" abbrev="QOS Interface"/>
+	<abbrev name="Serial Comms and Short Link Services" abbrev="Serial Comms &amp; Short Link Services"/>
+	<abbrev name="Multimedia and Graphics Services" abbrev="Multimedia &amp; Graphics Services"/>
+	<abbrev name="Kernel Services and Hardware Interface" abbrev="Kernel Services &amp; Hardware Interface"/>
+	<!--abbrev name="J2ME" abbrev="Java J2ME"/-->
+	<abbrev name="Localisation" abbrev="Localis&#xAD;ation"/>
+	<abbrev name="Character Conversion Framework" abbrev="Character Conversion"/>
+	<abbrev name="UI Toolkit" abbrev="UI Support"/>
+	<abbrev name="Bluetooth and SMS Push" abbrev="Bluetooth &amp; SMS Push"/>
+	<abbrev name="Telephony Reference Platform" abbrev="Telephony Ref. Platform"/>
+	<abbrev  name="Graphics Device Interface" abbrev="Graphics Dev&#xad;ice Interface"/>
+	<abbrev name="User Side Hardware Abstraction" abbrev="User Side Hardware &#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;Abstrac- &#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;tion"/>
+	<abbrev name="Generic Open Libraries" abbrev="Generic Open Libs."/>
+	<abbrev name="System State Management" abbrev="State Management"/>
+	<abbrev name="Comms Process and Settings" abbrev="Comms Proc. &amp; Settings"/>
+	<abbrev name="Baseband Adaptation Plugins" abbrev="Baseband Adaptation"/>
+	<abbrev name="Location Request Management" abbrev="Location Request Mgmt."/>    
+	<abbrev name="Graphics Hardware Adaptation" abbrev="Graphics HW Adapt."/>
+	<abbrev name="Multimedia Hardware Adaptation" abbrev="Multimedia HW Adapt."/>
+	<abbrev name="Multimedia Hardware Adaptation Interfaces" abbrev="Multimedia HW Adapt."/>
+	<abbrev name="Open Environment Utilities" abbrev="Open Env. Utilities"/>
+	<abbrev name="Common Application Services" abbrev="Common App Services"/>
+	<abbrev name="Base Connection Providers" abbrev="Base Connec&#xad;tion Providers"/>
+	<abbrev name="Shortlink Logical Device Drivers" abbrev="Shortlink LDD"/>
+</display-names>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/auxiliary/system_model_colors.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,806 @@
+<?xml version="1.0"?>
+<values default="grey" label="Technology Streams">
+  <item label="Base Services" value="#8f8fbd">
+    <component name="Application Utilities"/>
+    <component name="Syslibs Subsystem Documentation"/>
+    <component name="Plugin Framework"/>
+    <component name="Zip Compression Library"/>
+    <component name="Feature Registry"/>
+    <component name="Power, Memory and Disk Management"/>
+    <component name="Power and Memory Notification Service"/>
+    <component name="C Standard Library"/>
+    <component name="System Agents"/>
+    <component name="System Agent"/>
+    <component name="Task Scheduler"/>
+    <component name="XML Framework"/>
+    <component name="XML Parser"/>
+    <component name="WBXML Parser"/>
+    <component name="Feature Manager"/>
+    <component name="Syslibs Documentation"/>
+  </item>
+  <item label="Baseband Adaption" value="#5f9f9f">
+    <component name="ETel CDMA"/>
+    <component name="ETel Multimode"/>
+    <component name="ETel Packet Data"/>
+    <component name="ETel SIM Toolkit"/>
+    <component name="ETel Server and Core"/>
+    <component name="ETel Config"/>
+    <component name="TRP TSY"/>
+    <component name="SIM TSY"/>
+    <component name="MultiMode TSY"/>
+    <component name="CDMA TSY"/>
+    <component name="TRP CSY"/>
+    <component name="Baseband Channel Adaptor"/>
+    <component name="Baseband Channel Adaptor for C32"/>
+    <component name="Hardware Resources Manager"/>
+    <component name="MUX CSY"/>
+    <component name="TRP AGT"/>
+    <component name="Inter-System Communication"/>
+    <component name="S60 Compatibility Headers"/>
+    <component name="TRP Dispatch Layer Plugins"/>
+    <component name="Baseband Channel Adaptor for ISC"/>
+  </item>
+  <item label="Comms Framework" value="#527f76">
+    <component name="Comms Database"/>
+    <component name="File Logger"/>
+    <component name="ESock Server"/>
+    <component name="Network Interface Manager"/>
+    <component name="Comms Root Server"/>
+    <component name="Comms Framework"/>
+    <component name="Comms Elements"/>
+    <component name="Network Controller"/>
+    <component name="BBI"/>
+    <component name="MBuf Manager"/>
+    <component name="C32 Serial Server"/>
+    <component name="Serial Port CSY"/>
+    <component name="Comms Tools"/>
+    <component name="Comms Infrastructure Documentation"/>
+    <component name="Comms Root Server Config"/>
+    <component name="Comms Database Shim"/>
+    <component name="Default Comms Database"/>
+    <component name="Comms Database Install Default"/>
+    <component name="Prepare Default Comms Database"/>
+    <component name="Install Default Comms Database"/>
+    <component name="ESock Server Config"/>
+    <component name="IP CPR Shim"/>
+    <component name="Comms Debug Utility"/>
+    <component name="C32 Serial Server Config"/>
+    <component name="Networking Dialog API"/>
+    <component name="Agent Dialog"/>
+  </item>
+  <item label="Crypto Services" value="yellow">
+    <component name="TLS Provider"/>
+    <component name="Authentication Services"/>
+    <component name="Certificate and Key Management"/>
+    <component name="Weak Cryptography Library"/>
+    <component name="Strong Cryptography Library"/>
+    <component name="Weak Crypto SPI"/>
+    <component name="Strong Crypto SPI"/>
+    <component name="Crypto SPI Plugins"/>
+    <component name="Security Utils"/>
+    <component name="Security Config"/>
+    <component name="Crypto Token Framework"/>
+    <component name="File-based Certificate and Key Stores"/>
+    <component name="Root Certificates"/>
+    <component name="ASN PKCS"/>
+    <component name="Java MIDlet Installer"/>
+    <component name="Secure Software Install"/>
+    <component name="Secure Software Install Device Tools"/>
+    <component name="SWI Analysis Toolkit"/>
+    <component name="Secure Software Install SIS Tools"/>
+    <component name="OpenSSL Library"/>
+    <component name="SIS Installer"/>
+    <component name="MAKEKEYS"/>
+    <component name="Content Access Framework for DRM"/>
+    <component name="CAF Recogniser Configuration"/>
+    <component name="Certificate Store"/>
+    <component name="Key Store"/>
+    <component name="Cryptography Library"/>
+    <component name="Reference DRM Agent"/>
+    <component name="Security Common Utils"/>
+    <component name="User Prompt Service"/>
+    <component name="Security Documentation"/>
+    <component name="CAF Recogniser Config"/>
+    <component name="CAF Streaming Support"/>
+    <component name="Open Crypto Libraries"/>
+  </item>
+  <item label="Development Boards" value="#934900">
+    <component name="OMAP 1623"/>
+    <component name="OMAP 2420"/>
+    <component name="OMAP H4HRP Variant"/>
+    <component name="OMAP H2"/>
+    <component name="OMAP H4"/>
+    <component name="Lubbock Variant"/>
+    <component name="OMAP H2 BSP"/>
+    <component name="OMAP H2 SDIO"/>
+    <component name="OMAP H4 SDIO"/>
+    <component name="OMAP H2 Unistore2"/>
+    <component name="OMAP H4 Unistore2"/>
+    <component name="H4 Boot Loader"/>
+    <component name="OMAP H4 Mini Environment Boot Loader"/>
+    <component name="StrongArm 1100 ASSP"/>
+    <component name="OMAP H4 BSP"/>
+    <component name="Lubbock BSP"/>
+  </item>
+  <item label="Kernel" value="#00ffff">
+    <component name="Board Support Packages"/>
+    <component name="Bootstrap"/>
+    <component name="Kernel Architecture 2"/>
+    <component name="Integrator BSP support for Unistore2"/>
+    <component name="User HAL"/>
+    <component name="User Library"/>
+    <component name="E32 Tests"/>
+    <component name="Flash Translation Layer"/>
+    <component name="E32 Tools"/>
+    <component name="E32 Perl Tools"/>
+    <component name="Emulator BSP"/>
+    <component name="User-Side Hardware Abstraction"/>
+    <component name="System On Chip ASSP"/>
+    <component name="Template Variant"/>
+    <component name="Kernel Trace Tool"/>
+    <component name="E32 Utilities"/>
+    <component name="Base Documentation"/>
+  </item>
+  <item label="Multimedia Protocols" value="#eaadea">
+    <component name="RTP"/>
+    <component name="SIP Framework"/>
+    <component name="SIP Connection Provider Plugins"/>
+    <component name="SIP Connection Provider"/>
+    <component name="SIP Dummy PRT"/>
+    <component name="SIP State Machine"/>
+    <component name="SIP Params"/>
+    <component name="SIP Subconnection Provider"/>
+    <component name="SIP Connection Plugins"/>
+  </item>
+  <item label="IP Networking" value="#ff7f00">
+    <component name="ETHER AGT"/>
+    <component name="TLS"/>
+    <component name="IPShim"/>
+    <component name="PPP Compression Plugins"/>
+    <component name="PPP NIF"/>
+    <component name="Ethernet NIF"/>
+    <component name="Ethernet Over IR Packet Driver"/>
+    <component name="Ethernet Packet Driver"/>
+    <component name="PDP NIF"/>
+    <component name="Raw IP NIF"/>
+    <component name="SLIP NIF"/>
+    <component name="Tunnel NIF"/>
+    <component name="CGI"/>
+    <component name="Connection Provider Plugin"/>
+    <component name="GPRS/UMTS QOS PRT"/>
+    <component name="QoS Framework PRT"/>
+    <component name="Subconnection Parameters"/>
+    <component name="IP Hook"/>
+    <component name="IP Hook Examples"/>
+    <component name="IP Examples"/>
+    <component name="Internet Sockets"/>
+    <component name="IP Event Notifier"/>
+    <component name="IPSec"/>
+    <component name="TCP/IPv4/v6 PRT"/>
+    <component name="Core IPSec PRT"/>
+    <component name="VPN"/>
+    <component name="Mobile IP"/>
+    <component name="NWSS WAP Stack"/>
+    <component name="WAP Message API"/>
+    <component name="WAP Short Stack"/>
+    <component name="DHCP"/>
+    <component name="DND"/>
+    <component name="CSD AGT"/>
+    <component name="NULL AGT"/>
+    <component name="PSD AGT"/>
+    <component name="Connection AGT"/>
+    <component name="AgentPr"/>
+    <component name="ConnProv"/>
+    <component name="SubConnProv"/>
+    <component name="MetaConnProv"/>
+    <component name="ShimPr"/>
+    <component name="Wireless LAN"/>
+    <component name="SCHEDULER"/>
+    <component name="QoS Scheduler"/>
+    <component name="Network Address and Port Translation"/>
+    <component name="EAP Framework"/>
+    <component name="EAP Plugins for WiFi"/>
+    <component name="Networking Documentation"/>
+    <component name="Networking Dialog Stub"/>
+    <component name="Dialog Default"/>
+    <component name="DND Config"/>
+    <component name="Legacy Networking"/>
+    <component name="Networking Test"/>
+    <component name="Networking ROM"/>
+    <component name="Networking Unit Test"/>
+    <component name="Networking Examples"/>
+    <component name="Example Internet Utilities"/>
+    <component name="Internet Test Utils"/>
+    <component name="IPv6 to 4 Tunnel"/>
+    <component name="IP Administration Tool"/>
+    <component name="IP Analyzer"/>
+    <component name="IP Protocol Analyzer"/>
+    <component name="Name Resolver Utility"/>
+    <component name="IP Probe"/>
+    <component name="IPsec"/>
+    <component name="Network Security"/>
+    <component name="TCP/IPv4/v6 Config"/>
+    <component name="GPRS/UMTS QoS PRT"/>
+    <component name="GPRS/UMTS QoS Interface"/>
+    <component name="QoS Interface"/>
+    <component name="IPv6 Config"/>
+    <component name="GPRS QOS PRT"/>
+    <component name="UMTS QOS PRT"/>
+    <component name="QOS Extn API"/>
+    <component name="QoS Extn API"/>
+    <component name="PPP Config"/>
+    <component name="Predictor Compression"/>
+    <component name="MPPC"/>
+    <component name="Stac LZS Compression"/>
+    <component name="Reference CPR"/>
+    <component name="Reference SCPR"/>
+    <component name="QoS Framework Config"/>
+    <component name="QoS Library"/>
+    <component name="PF QoS Library"/>
+    <component name="IP CPR"/>
+    <component name="IP SCPR"/>
+    <component name="QOS IP SCPR"/>
+    <component name="QoS IP SCPR"/>
+    <component name="IP Network Layer"/>
+    <component name="IP Transport Layer"/>
+    <component name="IP Proto-CPR"/>
+    <component name="TCP CPR"/>
+    <component name="UMTS/GPRS SCPR"/>
+    <component name="QOS 3GPP CPR"/>
+    <component name="QoS 3GPP CPR"/>
+    <component name="PDP Layer"/>
+    <component name="PDP SCPR"/>
+  </item>
+  <item label="Open Environment" value="#817485">
+    <component name="Open Environment Core"/>
+    <component name="Command Shell"/>
+    <component name="Telnet Server"/>
+    <component name="OpenSSL"/>
+  </item>
+  <item label="Peripherals" value="#008000">
+    <component name="Audio Driver"/>
+    <component name="Emulator"/>
+    <component name="Ethernet Driver"/>
+    <component name="File Server"/>
+    <component name="File Systems"/>
+    <component name="Text Shell"/>
+    <component name="Text Window Server"/>
+    <component name="Media Drivers"/>
+    <component name="MIDI Driver"/>
+    <component name="Other LDDs"/>
+    <component name="PDDs"/>
+    <component name="Peripheral Bus Controllers"/>
+    <component name="SD Card Driver"/>
+    <component name="Speech Driver"/>
+    <component name="Video Driver"/>
+    <component name="Domain Manager"/>
+    <component name="SDIO Tests"/>
+    <component name="Assabet BSP"/>
+    <component name="Integrator BSP"/>
+    <component name="ROM File System"/>
+    <component name="ROFS"/>
+    <component name="ROFS File System"/>
+    <component name="USB Mass Storage File System"/>
+    <component name="LFFS"/>
+    <component name="LFFS File System"/>
+    <component name="FAT32 File System"/>
+    <component name="FAT File System"/>
+    <component name="Composite File System"/>
+    <component name="NTFS"/>
+    <component name="NTFS File System"/>
+    <component name="ISO9660 File System"/>
+    <component name="File System Plugins"/>
+    <component name="NAND Flash Translation Layer"/>
+    <component name="Cotulla ASSP"/>
+    <component name="Unistore2 Emulator Support"/>
+    <component name="Integrator Unistore2 NAND Logic Module"/>
+    <component name="Unistore2 Boot Support"/>
+    <component name="Integrator ARM1136 Core Module"/>
+    <component name="Integrator ARM920 Core Module"/>
+    <component name="Integrator Core Modules"/>
+    <component name="Integrator Motherboard"/>
+    <component name="Integrator SSR NAND Logic Module"/>
+    <component name="Integrator XX600 Logic Module"/>
+    <component name="Local Media Subsystem"/>
+    <component name="SD Card 3C Driver"/>
+    <component name="SD Card 4C Driver"/>
+    <component name="File Server Tests"/>
+    <component name="Base Starter"/>
+    <component name="Sound Driver"/>
+    <component name="Serial Port Driver"/>
+    <component name="Legacy Drivers"/>
+    <component name="USB Client Driver"/>
+    <component name="Unistore2 Drivers"/>
+    <component name="Unistore2 Core"/>
+    <component name="Unistore2 Crash Logger"/>
+    <component name="Generic Board Support Packages"/>
+  </item>
+  <item label="Persistent Data Services" value="#993366">
+    <component name="SQL"/>
+    <component name="Store"/>
+    <component name="DBMS"/>
+    <component name="Central Repository"/>
+    <component name="Event Logger"/>
+    <component name="DBMS Emulation Library"/>
+    <component name="SQLite 3 API"/>
+  </item>
+  <item label="Shortlink" value="#db7093">
+    <component name="Bluetooth CSY"/>
+    <component name="Bluetooth HCI"/>
+    <component name="Bluetooth Manager"/>
+    <component name="Bluetooth PAN Profile"/>
+    <component name="Bluetooth Protocol Client APIs"/>
+    <component name="Bluetooth SDP"/>
+    <component name="Bluetooth Stack PRT"/>
+    <component name="IrDA CSY"/>
+    <component name="IrDA PRT"/>
+    <component name="Remote Control Framework"/>
+    <component name="Remote Control Profile"/>
+    <component name="USB CSY"/>
+    <component name="USB Manager"/>
+    <component name="OBEX Extension API"/>
+    <component name="OBEX Protocol"/>
+    <component name="Bluetooth Profiles"/>
+    <component name="HCI Framework"/>
+    <component name="USB Driver"/>
+    <component name="Bluetooth PBAP"/>
+    <component name="Bluetooth AVRCP"/>
+    <component name="Phonebook Access Profile"/>
+    <component name="Mass Storage Driver"/>
+    <component name="OMAP USB Host Controller Driver"/>
+    <component name="OMAP USB Host Controller Driver Template"/>
+    <component name="USB Host and OTG Drivers"/>
+    <component name="USB Host and OTG Stack"/>
+    <component name="Bluetooth Documentation"/>
+    <component name="IrDA Documentation"/>
+    <component name="Shortlink Documentation"/>
+    <component name="USB Class and Manager Documentation"/>
+    <component name="USB Manager Tests"/>
+    <component name="Bluetooth Examples and Tests"/>
+    <component name="USB Documentation"/>
+    <component name="USB Test"/>
+    <component name="Bluetooth Example Tests"/>
+    <component name="IrDA Stack"/>
+    <component name="IrDA Test"/>
+    <component name="IrDA Config"/>
+    <component name="Bluetooth HCI Extension Interface"/>
+    <component name="Bluetooth HCI Framework 2"/>
+    <component name="Bluetooth HCI Framework 1"/>
+    <component name="Bluetooth HCI 2 Reference Implementations"/>
+    <component name="Bluetooth Notifiers Support"/>
+    <component name="Bluetooth HCI Proxy"/>
+    <component name="Bluetooth HCI Implementation"/>
+    <component name="Bluetooth Stack"/>
+    <component name="Bluetooth Notifiers"/>
+    <component name="Bluetooth Config"/>
+    <component name="Bluetooth GAVDP"/>
+    <component name="Bluetooth ROM"/>
+    <component name="Bluetooth User"/>
+    <component name="Bluetooth Common"/>
+    <component name="Bluetooth Client Library"/>
+    <component name="Bluetooth Build Utilities"/>
+  </item>
+  <item label="Telephony Services" value="#3299cc">
+    <component name="ETel 3rd Party API"/>
+    <component name="SMS PRT"/>
+    <component name="SMS Utilities"/>
+    <component name="Phonebook Sync"/>
+    <component name="CDMA SMS Plugins"/>
+    <component name="CDMA WAP PRT"/>
+    <component name="Dial"/>
+    <component name="Fax Client and Server"/>
+    <component name="GSM Utilities"/>
+    <component name="Telephony Watchers"/>
+    <component name="WAP PRT"/>
+    <component name="Packet Logger"/>
+    <component name="Secondary PDP context UMTS Driver"/>
+    <component name="Common TSY"/>
+    <component name="Multimode TSY"/>
+    <component name="Telephony Confidential Documentation"/>
+    <component name="Telephony Documentation"/>
+    <component name="SMS Stack"/>
+    <component name="CDMA SMS Stack"/>
+  </item>
+  <item label="Text and I18n Services" value="#9f9f5f">
+    <component name="Character Encoding and Conversion Framework"/>
+    <component name="Character Encoding and Conversion Plugins"/>
+    <component name="Text Handling"/>
+    <component name="FAT Filename Conversion Plugins"/>
+    <component name="Text Shaper Plugin"/>
+    <component name="Text Formatting"/>
+    <component name="Locale Support"/>
+    <component name="Number Formatting"/>
+  </item>
+  <item label="Connectivity Services" value="#cfb53b">
+    <component name="Secure Backup Engine"/>
+    <component name="Backup Engine"/>
+    <component name="Active Backup Client"/>
+    <component name="Connectivity Framework"/>
+    <component name="Connectivity Services"/>
+    <component name="Bearer Abstraction Layer"/>
+    <component name="M-Router"/>
+    <component name="m-Router"/>
+    <component name="ConnectQI"/>
+    <component name="ConnectQI SDK"/>
+    <component name="PLP Variant"/>
+    <component name="PLP Remote Link"/>
+    <component name="Event Broadcast"/>
+    <component name="Remote File Server"/>
+    <component name="Secure Backup Socket Server"/>
+    <component name="Server Socket"/>
+    <component name="Service Broker"/>
+    <component name="Software Install Server"/>
+    <component name="Sync Initiation"/>
+    <component name="OMA SyncML DM Interface"/>
+    <component name="OMA SyncML Framework"/>
+    <component name="OMA SyncML Common Framework"/>
+    <component name="OMA Data Sync"/>
+    <component name="OMA SyncML Data Sync"/>
+    <component name="Data Sync Adaptors"/>
+    <component name="Mobile Active Sync"/>
+    <component name="MTP Framework"/>
+    <component name="MTP USB Transport"/>
+    <component name="MTP File and Folder Provider"/>
+    <component name="OMA SyncML Integration Test"/>
+    <component name="Device Management Integration Test"/>
+    <component name="PC Side Connection Manager"/>
+    <component name="MTP PTP-IP Transport"/>
+  </item>
+  <item label="Device Provisioning" value="#ebc79e">
+    <component name="Device Management Framework"/>
+    <component name="Device Management Adaptors"/>
+    <component name="Client Provisioning Framework"/>
+    <component name="Client Provisioning Adaptors"/>
+  </item>
+  <item label="Graphics" value="#32cd99">
+    <component name="Bit GDI"/>
+    <component name="Colour Palette"/>
+    <component name="EGL API"/>
+    <component name="EGL Implementation"/>
+    <component name="Font Store"/>
+    <component name="Font and Bitmap Server"/>
+    <component name="FreeType Font Rasteriser"/>
+    <component name="GDI"/>
+    <component name="GDITOOLS"/>
+    <component name="GDTRAN"/>
+    <component name="Graphics Surfaces"/>
+    <component name="OpenGL ES"/>
+    <component name="OpenGL ES Framework"/>
+    <component name="OpenVG API"/>
+    <component name="OpenVG Implementation"/>
+    <component name="Printer Driver Support"/>
+    <component name="Printer Drivers"/>
+    <component name="Reference Fonts"/>
+    <component name="Screen Driver"/>
+    <component name="UI Bench"/>
+    <component name="Window Server"/>
+    <component name="iType Font Rasteriser"/>
+    <component name="Surface Manager LDD"/>
+    <component name="Common Graphics Headers"/>
+    <component name="Composition Engine Adaptation"/>
+    <component name="Graphics Resource Content Update"/>
+    <component name="MemSpy"/>
+    <component name="Printing Services"/>
+    <component name="Graphics Documentation"/>
+    <component name="Graphics Test Harness"/>
+    <component name="GDI Tools"/>
+    <component name="Bitmap Font Tools"/>
+    <component name="OpenGL ES API"/>
+    <component name="OpenGL ES Implementation"/>
+    <component name="Graphics Composition Engine"/>
+    <component name="Graphics Data Resource"/>
+    <component name="Graphics Data Resource Adaptation"/>
+  </item>
+  <item label="Internet and Web Services" value="#ff8f68">
+    <component name="HTTP Protocol Plugins"/>
+    <component name="HTTP Transport Framework"/>
+    <component name="HTTP Transport Plugins"/>
+    <component name="HTTP Examples"/>
+    <component name="URI Permission Services"/>
+    <component name="WAP Push Framework"/>
+    <component name="WAP Push Handlers"/>
+    <component name="WAP Push MTM"/>
+    <component name="WAP Base"/>
+    <component name="HTTP Utilities Library"/>
+    <component name="Bookmark Support"/>
+    <component name="Web Recognisers"/>
+    <component name="FTP Engine"/>
+    <component name="Telnet Engine"/>
+    <component name="WAP Push Support"/>
+    <component name="HTTP Filter Plugins"/>
+  </item>
+  <item label="Location Based Services" value="green">
+    <component name="Location Server"/>
+    <component name="Network Request Handler"/>
+    <component name="A-GPS Location Manager"/>
+    <component name="Network Location Manager"/>
+    <component name="Lbs Admin"/>
+    <component name="LBS Admin"/>
+    <component name="Network Gateway"/>
+    <component name="Network Protocol Module"/>
+    <component name="A-GPS Reference Module"/>
+    <component name="Location Based Services"/>
+    <component name="Location Admin"/>
+    <component name="Privacy Protocol Module"/>
+  </item>
+  <item label="Java" value="#c0d9d9">
+    <component name="CLDC Hi 1.1"/>
+    <component name="Java IO"/>
+    <component name="Java Lang"/>
+    <component name="Java Utilities"/>
+    <component name="MIDP Device Control"/>
+    <component name="MIDP GSM Security RP"/>
+    <component name="MIDP IO"/>
+    <component name="MIDP LCDUI"/>
+    <component name="MIDP MIDlet"/>
+    <component name="MIDP RMS"/>
+    <component name="LCDUI Plugin"/>
+    <component name="Runtime Plugin"/>
+    <component name="Security Policy"/>
+    <component name="Bluetooth 1.0"/>
+    <component name="Bluetooth 1.1"/>
+    <component name="Bluetooth 1.1 Push"/>
+    <component name="WMA 1.1"/>
+    <component name="WMA 1.1 Push"/>
+    <component name="JTWI 1.0"/>
+    <component name="Mobile Media API 1.1"/>
+    <component name="Mobile 3D 1.0"/>
+    <component name="Mobile 3D 1.1"/>
+    <component name="MIDP PIM"/>
+    <component name="MIDP File GCF"/>
+  </item>
+  <item label="Messaging" value="red">
+    <component name="Message Store"/>
+    <component name="Message Server and Store"/>
+    <component name="Watcher Framework"/>
+    <component name="IMAP4 MTM"/>
+    <component name="POP3 MTM"/>
+    <component name="SMTP MTM"/>
+    <component name="POP3 and SMTP MTM"/>
+    <component name="MMS Settings"/>
+    <component name="MMS Configuration"/>
+    <component name="MSG URLHANDLER"/>
+    <component name="Message URL Handler"/>
+    <component name="Scheduled Send MTM"/>
+    <component name="Send As"/>
+    <component name="OBEX MTMs"/>
+    <component name="SMIL Parser"/>
+    <component name="BIO Messaging Framework"/>
+    <component name="BIO Messaging Parsers"/>
+    <component name="BIO Watchers"/>
+    <component name="SMS MTM"/>
+    <component name="Fax MTM"/>
+    <component name="MSG TEST"/>
+    <component name="Messaging Test"/>
+    <component name="MMS MTM"/>
+    <component name="CDMA MTM"/>
+  </item>
+  <item label="Multimedia" value="#8fbc8f">
+    <component name="Camera"/>
+    <component name="Camera Server"/>
+    <component name="Camera Driver"/>
+    <component name="Camera Framework"/>
+    <component name="Broadcast Tuner"/>
+    <component name="Tuner Server"/>
+    <component name="Tuner Driver"/>
+    <component name="Broadcast Radio Tuner"/>
+    <component name="Speech Recognition Controller"/>
+    <component name="Image Conversion Library"/>
+    <component name="Imaging Frameworks"/>
+    <component name="Image Conversion Library Plugins"/>
+    <component name="Imaging Plugins"/>
+    <component name="MMF Recognisers"/>
+    <component name="Multimedia Framework Plugins"/>
+    <component name="DevSound API"/>
+    <component name="Reference DevSound Plugins"/>
+    <component name="Video HAI"/>
+    <component name="Bluetooth DevSound Plugin"/>
+    <component name="ICL Integration Tests"/>
+    <component name="MMF Integration Tests"/>
+    <component name="ICL Unit Tests"/>
+    <component name="MMF Unit Tests"/>
+    <component name="Multimedia Test Framework Unit Tests"/>
+    <component name="Multimedia Test Framework"/>
+    <component name="Multimedia Framework"/>
+    <component name="Multimedia Validation Suite"/>
+    <component name="Multimedia Validation Suite Application"/>
+    <component name="Multimedia Validation Suite Agents"/>
+    <component name="MVS Integration Tests"/>
+    <component name="Media Device Framework Plugins"/>
+    <component name="Multimedia Device Framework"/>
+    <component name="Mobile TV DVB-H Receiver HAI"/>
+    <component name="MDF Unit Tests"/>
+    <component name="Camera Unit Tests"/>
+    <component name="Tuner Unit Tests"/>
+    <component name="Mobile TV DVB-H Unit Tests"/>
+    <component name="Multimedia Test Agent"/>
+    <component name="Multimedia Test Tools"/>
+    <component name="MMF Characterisation Validation"/>
+    <component name="Multimedia Documentation"/>
+    <component name="Multimedia Utility Library"/>
+    <component name="Camera Plugins"/>
+    <component name="Media Device Framework"/>
+    <component name="OpenMAX"/>
+    <component name="DevSound Hardware Device API"/>
+    <component name="DevSound Plugin Support"/>
+    <component name="Multimedia Resource Controller"/>
+    <component name="A3F Audio Component Library"/>
+    <component name="A3F DevSound Customisation"/>
+    <component name="A3F DevSound"/>
+    <component name="A3F Audio Component Framework"/>
+    <component name="A3F Trace Utility"/>
+    <component name="Reference ACL Adaptation"/>
+    <component name="Metadata Utility Framework"/>
+    <component name="Metadata Parser Plugin"/>
+    <component name="Video Renderer"/>
+    <component name="A3F Integration Tests"/>
+    <component name="A3F Server Start"/>
+  </item>
+  <item label="PIM Application Services" value="#ffff80">
+    <component name="Agenda Model"/>
+    <component name="Agenda Versit Plugin"/>
+    <component name="Alarm Server"/>
+    <component name="Chinese Calendar Converter"/>
+    <component name="CalInterimAPI"/>
+    <component name="Calendar"/>
+    <component name="Time Zone Localisation"/>
+    <component name="Time Zone Server"/>
+    <component name="Time Zone Compiler"/>
+    <component name="Time Zone Database"/>
+    <component name="Timezone"/>
+    <component name="Time Zone Localisation Resource Factory"/>
+    <component name="WLDDATABASEKIT"/>
+    <component name="World Database Kit"/>
+    <component name="WLDTOOLS"/>
+    <component name="World Tools"/>
+    <component name="World Server"/>
+    <component name="Contacts Model"/>
+    <component name="Backup Restore Notification"/>
+    <component name="Chart"/>
+    <component name="HTML to RichText Converter"/>
+    <component name="Core Apps Test"/>
+    <component name="Data Engine"/>
+    <component name="Help"/>
+    <component name="File Converter Plugins"/>
+    <component name="RichText to HTML Converter"/>
+    <component name="Sheet Engine"/>
+    <component name="vCard and vCal"/>
+    <component name="Word Engine"/>
+    <component name="Agenda Model Test"/>
+    <component name="Alarm Server Test"/>
+    <component name="World Server Test"/>
+    <component name="Application Engines Documentation"/>
+    <component name="Application Services Documentation"/>
+    <component name="Other File Converter Plugins"/>
+    <component name="Time Zone Localization"/>
+  </item>
+  <item label="UI Frameworks" value="#00ff00">
+    <component name="Animation"/>
+    <component name="UI Graphics Utilities"/>
+    <component name="FEP Base"/>
+    <component name="Front End Processor"/>
+    <component name="Clock"/>
+    <component name="Graphics Effects"/>
+    <component name="System Starter"/>
+    <component name="UIKON"/>
+    <component name="BMP Animation"/>
+    <component name="Grid"/>
+    <component name="Application Architecture"/>
+    <component name="UI Look and Feel"/>
+    <component name="View Server"/>
+    <component name="Printing UI Support"/>
+    <component name="MIME Recognition Framework"/>
+    <component name="Content Handling Framework"/>
+    <component name="Control Environment"/>
+    <component name="File Converter Framework"/>
+    <component name="UIKON Error Resolver Plugin"/>
+    <component name="Error Resolver Data"/>
+    <component name="UI Frameworks Documentation"/>
+  </item>
+  <item label="Product Creation Tools" value="#a29040">
+    <component name="SDK Builder"/>
+    <component name="CBRTOOLS"/>
+    <component name="CDB"/>
+    <component name="TESTTOOLS_DESKTOP"/>
+    <component name="KITSETUPAPP"/>
+    <component name="NAVIGATION_PAGES"/>
+    <component name="PRODUCTINSTALLER"/>
+    <component name="RUNPERL"/>
+    <component name="SDKINFO"/>
+    <component name="SISAR"/>
+    <component name="SDKPKG-MANAGER"/>
+    <component name="SDKPKG-TOOLS"/>
+    <component name="EMULATOR_LAUNCHER"/>
+    <component name="PKGMGRGUI"/>
+    <component name="TOOLS_STUBS"/>
+    <component name="PERLLIBRARY"/>
+    <component name="SPLASH"/>
+    <component name="JAVALIBRARY"/>
+    <component name="DUMMY"/>
+    <component name="ASSERTION"/>
+    <component name="ENUM"/>
+    <component name="ENVVAR"/>
+    <component name="FILESYS"/>
+    <component name="INSTALLUTILS"/>
+    <component name="JADE"/>
+    <component name="JAVAHELP"/>
+    <component name="LANGCONFIG"/>
+    <component name="LOGGER"/>
+    <component name="MBMCODEC"/>
+    <component name="MNEMONICFIX"/>
+    <component name="PATHBROWSER"/>
+    <component name="SHELLEXEC"/>
+    <component name="SWINGWORKER"/>
+    <component name="TESTCASERUNNER"/>
+    <component name="TOOLBARPANEL"/>
+    <component name="BCCOMPARATOR"/>
+    <component name="KITCOMPARATOR"/>
+    <component name="BSPBUILDER"/>
+    <component name="Compiler Runtime Support"/>
+    <component name="Tools Documentation"/>
+  </item>
+  <item label="Development Tools" value="#BAC97E">
+    <component name="BUILD-TOOLS"/>
+    <component name="BUILDSYSTEMTOOLS"/>
+    <component name="RAPTOR"/>
+    <component name="E32TOOLS EKA2"/>
+    <component name="ROMKIT_EKA2"/>
+    <component name="REDISTRIBUTION"/>
+    <component name="Debug"/>
+    <component name="Trace Framework"/>
+    <component name="Run Mode Debugger"/>
+  </item>
+  <item label="Test Environment" value="#56a1a1">
+    <component name="AGENDA"/>
+    <component name="AGENTNOTIFIER"/>
+    <component name="AUDIO"/>
+    <component name="BLUETOOTHUI"/>
+    <component name="BURTESTSERVER"/>
+    <component name="CAPTOOLS"/>
+    <component name="CHATSCRIPTS"/>
+    <component name="CINIDATA"/>
+    <component name="CONNECTUI"/>
+    <component name="CONTACTS"/>
+    <component name="CONTACUI"/>
+    <component name="EIKSTD"/>
+    <component name="EXTRAS"/>
+    <component name="LEAVESCAN"/>
+    <component name="MESSAGINGUI"/>
+    <component name="MIGRATIONTOOL"/>
+    <component name="PHONEUI"/>
+    <component name="PROGRAMCHECKER"/>
+    <component name="RESOURCE_HANDLER"/>
+    <component name="RESOURCE_HANDLER_UI"/>
+    <component name="SMOKETEST"/>
+    <component name="STATAPI"/>
+    <component name="STAT_DESKTOP"/>
+    <component name="STAT_DEVICE"/>
+    <component name="SYSTEMMONITOR"/>
+    <component name="Simple App"/>
+    <component name="TESTDRIVER"/>
+    <component name="TESTEXECUTE"/>
+    <component name="TESTTOOLS_UTILITIES"/>
+    <component name="TIMEW"/>
+    <component name="USBUI"/>
+    <component name="Use Case Controller"/>
+    <component name="SHELL"/>
+    <component name="STARTUP"/>
+    <component name="STATUSPANE"/>
+    <component name="UIKLAF"/>
+    <component name="IAPSTATUSAPP"/>
+  </item>
+  <item label="Technical Documentation" value="#6A5182">
+    <component name="DEVELOPERLIBRARY"/>
+    <component name="Developer Library Tools"/>
+    <component name="Developer Library Help"/>
+    <component name="Developer Library Source"/>
+    <component name="Developer Library HTML"/>
+  </item>
+  <item label="Test Product" value="#544A38">
+    <component name="Subsystem Tests"/>
+  </item>
+  <item label="System Engineering" value="#615FAD">
+    <component name="DEPMODEL"/>
+    <component name="System Documentation"/>
+  </item>
+</values>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/xsd/Border-shapes.xsd	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="values">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="component" maxOccurs="unbounded" minOccurs="0">
+                <xs:complexType>
+                  <xs:simpleContent>
+                    <xs:extension base="xs:string">
+                      <xs:attribute type="xs:string" name="name" use="required"/>
+                    </xs:extension>
+                  </xs:simpleContent>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
+            <xs:attribute type="xs:string" name="label" use="optional"/>
+            <xs:attribute name="value" use="required">
+                            <xs:annotation>
+                            	<xs:documentation>The regular expression on the "value" attribute is as follows: 1) one of the special keywords as specified or 2) "#" followed by one or more characters</xs:documentation>
+                            </xs:annotation>
+                            <xs:simpleType>
+            		<xs:restriction base="xs:string">
+            			<xs:pattern
+            				value="box|round|hexagon|box-clipRT|box-clipRB|box-clipLT|box-clipLB|box-clipAll|#.+">
+            			</xs:pattern>
+            		</xs:restriction>
+            	</xs:simpleType>
+            </xs:attribute>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute type="xs:string" name="default" use="optional"/>
+      <xs:attribute type="xs:string" name="label" use="optional"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/xsd/Border-styles.xsd	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="values">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="component" maxOccurs="unbounded" minOccurs="0">
+                <xs:complexType>
+                  <xs:simpleContent>
+                    <xs:extension base="xs:string">
+                      <xs:attribute type="xs:string" name="name" use="required"/>
+                    </xs:extension>
+                  </xs:simpleContent>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
+            <xs:attribute type="xs:string" name="label" use="optional"/>
+            <xs:attribute name="value" use="required" type="xs:string"/>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute type="xs:string" name="default" use="optional"/>
+      <xs:attribute type="xs:string" name="label" use="optional"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/xsd/Colours.xsd	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified"
+	elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+	<xs:element name="values">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="component" maxOccurs="unbounded"
+								minOccurs="0">
+								<xs:complexType>
+									<xs:simpleContent>
+										<xs:extension base="xs:string">
+											<xs:attribute type="xs:string" name="name" use="required" />
+										</xs:extension>
+									</xs:simpleContent>
+								</xs:complexType>
+							</xs:element>
+						</xs:sequence>
+						<xs:attribute type="xs:string" name="label" use="optional" />
+						<xs:attribute name="value" use="required">
+							<xs:annotation>
+								<xs:documentation>The regular expression in the constraint of
+									the "value" attribute is: 1) a valid rgb() expression or 2) a
+									valid hex number or 3) a valid alpha expression or 4) a three
+									digit hex triple or 5) a valid %rgb() expression.</xs:documentation>
+							</xs:annotation>
+							<xs:simpleType>
+<!-- TODO: Need to modify the last pattern below (%rgb() to accept digits from 0 to 100 instead of from 1 to 99 -->
+								<xs:restriction base="xs:string">
+									<xs:pattern
+										value="rgb\((((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5])),\s?){2}(((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))){1}\)|#(([0-9a-fA-F]){6})|([A-Z,a-z]+)|#([0-9a-fA-F]){3}|rgb\(([1-9][0-9]{0,1}%,\s?){2}([1-9][0-9]{0,1}%)\)">
+									</xs:pattern>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+					</xs:complexType>
+				</xs:element>
+			</xs:sequence>
+			<xs:attribute type="xs:string" name="default" use="optional" />
+			<xs:attribute type="xs:string" name="label" use="optional" />
+		</xs:complexType>
+	</xs:element>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/xsd/Levels.xsd	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="levels">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded" minOccurs="0">
+        <xs:element name="block" maxOccurs="unbounded" minOccurs="0">
+          <xs:complexType>
+          	<xs:simpleContent>
+          		<xs:extension base="xs:string">
+          			<xs:attribute type="xs:string" name="name"
+          				use="required" />
+          			<xs:attribute type="xs:NMTOKEN" name="level"
+          				use="optional" />
+          			<xs:attribute type="xs:NMTOKENS" name="levels"
+          				use="optional" />
+          			<xs:attribute type="xs:int" name="span"
+          				use="optional" />
+          		</xs:extension>
+          	</xs:simpleContent>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="collection" maxOccurs="unbounded" minOccurs="0">
+          <xs:complexType>
+            <xs:simpleContent>
+              <xs:extension base="xs:string">
+                <xs:attribute type="xs:string" name="name" use="required"/>
+                <xs:attribute type="xs:NMTOKEN" name="level" use="required"/>
+              </xs:extension>
+            </xs:simpleContent>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="layer" maxOccurs="unbounded" minOccurs="0">
+          <xs:complexType>
+            <xs:simpleContent>
+              <xs:extension base="xs:string">
+                <xs:attribute type="xs:string" name="name" use="required"/>
+                <xs:attribute type="xs:NMTOKENS" name="levels" use="optional"/>
+                <xs:attribute type="xs:int" name="span" use="optional"/>
+              </xs:extension>
+            </xs:simpleContent>
+          </xs:complexType>
+        </xs:element>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/xsd/Localisation.xsd	Wed Oct 13 14:00:36 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="display-names">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="abbrev" maxOccurs="unbounded" minOccurs="0">
+          <xs:complexType>
+            <xs:simpleContent>
+              <xs:extension base="xs:string">
+                <xs:attribute type="xs:string" name="name" use="required"/>
+                <xs:attribute type="xs:string" name="abbrev" use="required"/>
+              </xs:extension>
+            </xs:simpleContent>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute type="xs:string" name="font" use="optional"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/xsd/Patterns.xsd	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="values">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="item" maxOccurs="unbounded" minOccurs="0">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="component" maxOccurs="unbounded" minOccurs="0">
+                <xs:complexType>
+                  <xs:simpleContent>
+                    <xs:extension base="xs:string">
+                      <xs:attribute type="xs:string" name="name" use="required"/>
+                    </xs:extension>
+                  </xs:simpleContent>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
+            <xs:attribute type="xs:string" name="label" use="optional"/>
+            <xs:attribute name="value" use="required">
+                            <xs:annotation>
+                            	<xs:documentation>The regular expression on the "value" attribute is as follows: 1) one of the special keywords as specified or 2) "#" followed by one or more characters</xs:documentation>
+                            </xs:annotation>
+                            <xs:simpleType>
+            		<xs:restriction base="xs:string">
+            			<xs:pattern
+            				value="striped-diag-up|radial-grad|big-X|#.+">
+            			</xs:pattern>
+            		</xs:restriction>
+            	</xs:simpleType>
+            </xs:attribute>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+      <xs:attribute type="xs:string" name="default" use="optional"/>
+      <xs:attribute type="xs:string" name="label" use="optional"/>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/resources/xsd/Shapes.xsd	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,389 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	targetNamespace="http://www.symbian.com/Shapes" xmlns="http://www.symbian.com/Shapes"
+	elementFormDefault="qualified" attributeFormDefault="unqualified"
+	xmlns:svg="http://www.w3.org/2000/svg">
+	<xs:import namespace="http://www.w3.org/2000/svg"
+		schemaLocation="http://www.w3.org/TR/2002/WD-SVG11-20020108/SVG.xsd" />
+	<xs:element name="shapes">
+		<xs:complexType>
+			<xs:sequence>
+				<!--
+					<xs:element ref="svg:defs" xmlns:svg="http://www.w3.org/2000/svg"
+					maxOccurs="unbounded" minOccurs="0"/>
+				-->
+				<xs:element name="borders" maxOccurs="unbounded"
+					minOccurs="0">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="border" maxOccurs="unbounded"
+								minOccurs="1">
+								<xs:complexType mixed="true">
+									<xs:sequence>
+										<xs:element ref="svg:path" minOccurs="0"
+											xmlns:svg="http://www.w3.org/2000/svg" maxOccurs="unbounded" />
+									</xs:sequence>
+									<xs:attribute name="type" use="optional">
+										<xs:annotation>
+											<xs:documentation>
+												The regular expression on the
+												"type"
+												attribute is as follows: 1)
+												one of the special keywords as
+												specified or 2) "#" followed by
+												one or more character
+											</xs:documentation>
+										</xs:annotation>
+										<xs:simpleType>
+											<xs:restriction base="xs:string">
+												<xs:pattern
+													value="box|round|hexagon|box-clipRT|box-clipRB|box-clipLT|box-clipLB|box-clipAll|#.+">
+												</xs:pattern>
+											</xs:restriction>
+										</xs:simpleType>
+									</xs:attribute>
+									<xs:attribute type="xs:string" name="value" use="optional" />
+									<xs:attribute type="xs:string" name="viewBox" use="optional" />
+									<xs:attribute name="rule" type="xs:string" use="optional">
+									</xs:attribute>
+									<xs:attribute name="label" use="optional" default="no">
+										<xs:simpleType>
+											<xs:restriction base="xs:string">
+												<xs:enumeration value="yes"></xs:enumeration>
+												<xs:enumeration value="no"></xs:enumeration>
+											</xs:restriction>
+										</xs:simpleType>
+									</xs:attribute>
+								</xs:complexType>
+							</xs:element>
+						</xs:sequence>
+						<xs:attribute type="xs:string" name="match" use="optional"
+							default="component" />
+						<xs:attribute type="xs:string" name="use" use="optional" />
+						<xs:attribute type="xs:string" name="label" use="optional" />
+						<xs:attribute name="sort" use="optional" default="no">
+							<xs:simpleType>
+								<xs:restriction base="xs:string">
+									<xs:enumeration value="yes"></xs:enumeration>
+									<xs:enumeration value="no"></xs:enumeration>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+						<xs:attribute name="show-unused" use="optional"
+							default="no">
+							<xs:simpleType>
+								<xs:restriction base="xs:string">
+									<xs:enumeration value="yes"></xs:enumeration>
+									<xs:enumeration value="no"></xs:enumeration>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+						<xs:attribute name="literal" use="optional" default="no">
+							<xs:simpleType>
+								<xs:restriction base="xs:string">
+									<xs:enumeration value="yes"></xs:enumeration>
+									<xs:enumeration value="no"></xs:enumeration>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+					</xs:complexType>
+				</xs:element>
+				<xs:element name="patterns" maxOccurs="unbounded"
+					minOccurs="0">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="overlay" maxOccurs="unbounded"
+								minOccurs="1">
+								<xs:complexType>
+									<xs:sequence>
+										<xs:element ref="svg:path" minOccurs="0"
+											xmlns:svg="http://www.w3.org/2000/svg" maxOccurs="unbounded" />
+									</xs:sequence>
+									<xs:attribute name="type" use="optional">
+										<xs:annotation>
+											<xs:documentation>
+												The regular expression on the
+												"type"
+												attribute is as follows: 1)
+												one of the special keywords as
+												specified
+          						</xs:documentation>
+										</xs:annotation>
+										<xs:simpleType>
+											<xs:restriction base="xs:string">
+												<xs:pattern
+													value="box|round|hexagon|box-clipRT|box-clipRB|box-clipLT|box-clipLB|box-clipAll|#.+">
+												</xs:pattern>
+												<xs:enumeration value="big-X"></xs:enumeration>
+												<xs:enumeration value="striped-diag-up">
+												</xs:enumeration>
+												<xs:enumeration value="radial-grad">
+												</xs:enumeration>
+											</xs:restriction>
+										</xs:simpleType>
+									</xs:attribute>
+									<xs:attribute type="xs:string" name="value" use="optional" />
+
+									<xs:attribute type="xs:string" name="label" use="optional" />
+									<xs:attribute type="xs:string" name="viewBox" use="optional" />
+									<xs:attribute name="rule" type="xs:string" use="optional">
+									</xs:attribute>
+									<xs:attribute name="literal" use="optional"
+										default="no">
+										<xs:simpleType>
+											<xs:restriction base="xs:string">
+												<xs:enumeration value="yes"></xs:enumeration>
+												<xs:enumeration value="no"></xs:enumeration>
+											</xs:restriction>
+										</xs:simpleType>
+									</xs:attribute>
+								</xs:complexType>
+							</xs:element>
+						</xs:sequence>
+						<xs:attribute type="xs:string" name="match" default="component"
+							use="optional" />
+						<xs:attribute type="xs:string" name="use" use="optional" />
+						<xs:attribute type="xs:string" name="label" use="optional" />
+						<xs:attribute name="sort" default="no" use="optional">
+							<xs:simpleType>
+								<xs:restriction base="xs:string">
+									<xs:enumeration value="yes"></xs:enumeration>
+									<xs:enumeration value="no"></xs:enumeration>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+						<xs:attribute name="show-unused" use="optional"
+							default="no">
+							<xs:simpleType>
+								<xs:restriction base="xs:string">
+									<xs:enumeration value="yes"></xs:enumeration>
+									<xs:enumeration value="no"></xs:enumeration>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+						<xs:attribute name="literal" default="no" use="optional">
+							<xs:simpleType>
+								<xs:restriction base="xs:string">
+									<xs:enumeration value="yes"></xs:enumeration>
+									<xs:enumeration value="no"></xs:enumeration>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+					</xs:complexType>
+				</xs:element>
+				<xs:element name="styles" maxOccurs="unbounded"
+					minOccurs="0">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="style" maxOccurs="unbounded"
+								minOccurs="1">
+								<xs:complexType>
+									<xs:simpleContent>
+										<xs:extension base="xs:string">
+											<xs:attribute type="xs:string" name="rule" use="optional" />
+											<xs:attribute type="xs:string" name="label" use="optional" />
+											<xs:attribute type="xs:string" name="value" use="optional" />
+											<xs:attribute name="literal" use="optional"
+												default="no">
+												<xs:simpleType>
+													<xs:restriction base="xs:string">
+														<xs:enumeration value="yes">
+														</xs:enumeration>
+														<xs:enumeration value="no">
+														</xs:enumeration>
+													</xs:restriction>
+												</xs:simpleType>
+											</xs:attribute>
+										</xs:extension>
+									</xs:simpleContent>
+								</xs:complexType>
+							</xs:element>
+						</xs:sequence>
+						<xs:attribute type="xs:string" name="match" default="component"
+							use="optional" />
+						<xs:attribute type="xs:string" name="use" use="optional" />
+						<xs:attribute type="xs:string" name="label" use="optional" />
+						<xs:attribute name="sort" default="no" use="optional">
+							<xs:simpleType>
+								<xs:restriction base="xs:string">
+									<xs:enumeration value="yes"></xs:enumeration>
+									<xs:enumeration value="no"></xs:enumeration>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+						<xs:attribute name="show-unused" use="optional"
+							default="no">
+							<xs:simpleType>
+								<xs:restriction base="xs:string">
+									<xs:enumeration value="yes"></xs:enumeration>
+									<xs:enumeration value="no"></xs:enumeration>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+						<xs:attribute name="literal" use="optional" default="no">
+							<xs:simpleType>
+								<xs:restriction base="xs:string">
+									<xs:enumeration value="yes"></xs:enumeration>
+									<xs:enumeration value="no"></xs:enumeration>
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+					</xs:complexType>
+				</xs:element>
+				<xs:element name="colors" maxOccurs="unbounded"
+					minOccurs="0">
+					<xs:complexType>
+						<xs:sequence>
+							<xs:element name="color" maxOccurs="unbounded"
+								minOccurs="1">
+								<xs:complexType>
+									<xs:simpleContent>
+										<xs:extension base="xs:string">
+											<xs:attribute type="xs:string" name="label" use="optional" />
+											<xs:attribute type="xs:string" name="value" use="optional" />
+											<xs:attribute type="xs:string" name="rule" use="optional" />
+											<xs:attribute name="color" use="required">
+												<xs:annotation>
+													<xs:documentation>
+														The regular expression in the constraint
+														of
+														the "value" attribute is: 1) a valid rgb() expression or
+														2) a
+														valid hex number or 3) a valid alpha expression or 4)
+														a
+														three
+														digit hex triple or 5) a valid %rgb() expression.
+          								</xs:documentation>
+          							</xs:annotation>
+          							<xs:simpleType>
+<!-- TODO: Need to modify the last pattern below (%rgb() to accept digits from 0 to 100 instead of from 1 to 99 -->
+								<xs:restriction base="xs:string">
+									<xs:pattern
+										value="rgb\((((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5])),\s?){2}(((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))){1}\)|#(([0-9a-fA-F]){6})|([A-Z,a-z]+)|#([0-9a-fA-F]){3}|rgb\(([1-9][0-9]{0,1}%,\s?){2}([1-9][0-9]{0,1}%)\)">
+									</xs:pattern>
+								</xs:restriction>
+							</xs:simpleType>
+          						</xs:attribute>
+          						<xs:attribute name="literal" use="optional" default="no">
+          							<xs:simpleType>
+          								<xs:restriction
+          									base="xs:string">
+          									<xs:enumeration
+          										value="yes">
+          									</xs:enumeration>
+          									<xs:enumeration
+          										value="no">
+          									</xs:enumeration>
+          								</xs:restriction>
+          							</xs:simpleType>
+          						</xs:attribute>
+          					</xs:extension>
+          				</xs:simpleContent>
+          			</xs:complexType>
+          		</xs:element>
+          	</xs:sequence>
+          	<xs:attribute name="default" use="optional">
+          		<xs:annotation>
+          			<xs:documentation>
+          				The regular expression in the constraint of
+									the "value" attribute is: 1) a valid rgb() expression or 2) a
+									valid hex number or 3) a valid alpha expression or 4) a three
+									digit hex triple or 5) a valid %rgb() expression.
+          			</xs:documentation>
+          		</xs:annotation>
+          		<xs:simpleType>
+<!-- TODO: Need to modify the last pattern below (%rgb() to accept digits from 0 to 100 instead of from 1 to 99 -->
+								<xs:restriction base="xs:string">
+									<xs:pattern
+										value="rgb\((((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5])),\s?){2}(((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))){1}\)|#(([0-9a-fA-F]){6})|([A-Z,a-z]+)|#([0-9a-fA-F]){3}|rgb\(([1-9][0-9]{0,1}%,\s?){2}([1-9][0-9]{0,1}%)\)">
+									</xs:pattern>
+								</xs:restriction>
+							</xs:simpleType>
+          	</xs:attribute>
+          	<xs:attribute type="xs:string" name="match" use="optional"
+          		default="component" />
+          	<xs:attribute type="xs:string" name="use" use="optional" />
+          	<xs:attribute type="xs:string" name="label"
+          		use="optional" />
+          	<xs:attribute name="sort" use="optional" default="no">
+          		<xs:simpleType>
+          			<xs:restriction base="xs:string">
+          				<xs:enumeration value="yes"></xs:enumeration>
+          				<xs:enumeration value="no"></xs:enumeration>
+          			</xs:restriction>
+          		</xs:simpleType>
+          	</xs:attribute>
+          	<xs:attribute name="show-unused" use="optional"
+          		default="no">
+          		<xs:simpleType>
+          			<xs:restriction base="xs:string">
+          				<xs:enumeration value="yes"></xs:enumeration>
+          				<xs:enumeration value="no"></xs:enumeration>
+          			</xs:restriction>
+          		</xs:simpleType>
+          	</xs:attribute>
+          	<xs:attribute name="type" use="optional"
+          		default="background">
+          		<xs:simpleType>
+          			<xs:restriction base="xs:string">
+          				<xs:enumeration value="background"></xs:enumeration>
+          				<xs:enumeration value="text-highlight"></xs:enumeration>
+          				<xs:enumeration value="highlight"></xs:enumeration>
+          			</xs:restriction>
+          		</xs:simpleType>
+          	</xs:attribute>
+          	<xs:attribute name="literal" use="optional"
+          		default="no">
+          		<xs:simpleType>
+          			<xs:restriction base="xs:string">
+          				<xs:enumeration value="yes"></xs:enumeration>
+          				<xs:enumeration value="no"></xs:enumeration>
+          			</xs:restriction>
+          		</xs:simpleType>
+          	</xs:attribute>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="examples" maxOccurs="unbounded" minOccurs="0">
+          <xs:complexType>
+          	<xs:sequence>
+          		<xs:element name="cmp" maxOccurs="unbounded"
+          			minOccurs="0">
+          			<xs:complexType>
+          				<xs:simpleContent>
+          					<xs:extension base="xs:string">
+          						<xs:attribute type="xs:string"
+          							name="color" use="optional" />
+          						<xs:attribute type="xs:string"
+          							name="overlay" use="optional" />
+          						<xs:attribute type="xs:string"
+          							name="border" use="optional" />
+          						<xs:attribute name="highlight"
+          							type="xs:string" use="optional">
+          						</xs:attribute>
+          						<xs:attribute name="text-highlight"
+          							type="xs:string" use="optional">
+          						</xs:attribute>
+          						<xs:attribute name="style"
+          							type="xs:string" use="optional">
+          						</xs:attribute>
+          					</xs:extension>
+          				</xs:simpleContent>
+          			</xs:complexType>
+          		</xs:element>
+          	</xs:sequence>
+          	<xs:attribute type="xs:string" name="label"
+          		use="optional" />
+          	<xs:attribute name="literal" use="optional" default="no">
+          		<xs:simpleType>
+          			<xs:restriction base="xs:string">
+          				<xs:enumeration value="yes"></xs:enumeration>
+          				<xs:enumeration value="no"></xs:enumeration>
+          			</xs:restriction>
+          		</xs:simpleType>
+          	</xs:attribute>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/Draw.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,2303 @@
+<?xml version="1.0"?>
+ <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:doc="tooldoc"  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="doc s m exslt" >
+	  <xsl:key name="color" match="legend/cbox" use="@value"/>
+	  <xsl:key name="color-value" match="component" use="@ts"/>
+	  <xsl:key name="lgrp-bottom" match="layer-group" use="@from"/>
+	  <xsl:key name="lgrp-top" match="layer-group" use="@to"/>
+	  <xsl:key name="layer" match="layer" use="@name"/>
+	  <xsl:key name="ldg-use" match="group" use="@style-id"/>
+	  <xsl:key name="styled" match="group|group/*" use="@style-id"/>	  
+	<xsl:output method="xml" cdata-section-elements="script s:script" indent="yes"/>
+
+<xsl:param name="Use-as-name" doc:desc="The attribute to use as the item name. Falls back to 'name'" select="'long-name'"/>
+<xsl:param name="Base" doc:desc="The base URL for hyperlinks." select="/SystemDefinition/systemModel/@link"/>
+<xsl:param name="Page-width" select="/SystemDefinition/systemModel/@page-width" doc:desc="The width (specify units) of the page. This overrrides the values specified in the model. The model will automatically adjust from landspace to portrait if its dimensions are more appropriate to portrait."/>
+<xsl:param name="Detail" doc:desc="The level of detail to show in the diagram. Value is the name of the lowest element to show. If the Static parameter is set to false, mousing-over an item will show its detailed content. by default this is 'component'">
+<xsl:choose>
+	<xsl:when test="/SystemDefinition/systemModel/@detail"><xsl:value-of select="/SystemDefinition/systemModel/@detail"/></xsl:when>
+	<xsl:otherwise>component</xsl:otherwise>
+</xsl:choose>
+</xsl:param>
+<xsl:variable name="pre-Static"><xsl:choose><xsl:when test="/SystemDefinition/systemModel/@static='true'">1</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:variable>
+<xsl:param name="Static" doc:desc="Set to '1' to get no mouseover or animation efffects" select="$pre-Static='1'"/>
+
+<!-- ====== Constants ============= -->
+<xsl:variable name="groupDx" select="number('2.1')"/> <!-- the horizontal distance between groups (mm) -->
+<xsl:variable name="groupDy" select="number('3.2')"/> <!-- the vertical distance between groups (mm) -->
+<xsl:variable name="cSize" select="number('9.3')"/> <!-- the width and height of a component (mm) -->
+<xsl:variable name="mSize" select="number('15.6')"/> <!-- the height and minimum width of a collection (mm) -->
+<xsl:variable name="inlineLabel" select="3 * $cSize"/> <!-- the max width of an inline label. 3 time width of a collection. I don't like this. Should compute somehow and make local variable -->
+<xsl:variable name="detail-block-space" select="6"/>
+<xsl:variable name="legendDx" select="number('5')"/><!-- the horizontal distance between items in a legend (mm) -->
+<xsl:variable name="lgrpDx" select="number('5')"/> <!-- the width of a layer group border (mm)-->
+<xsl:variable name="lgrpLabelDx" select="number('15')"/> <!-- the width of a layer group title (mm) -->
+<xsl:variable name="large-width" select="500"/> <!-- cutoff width to be considered a wide model and thus need larger title size -->
+<!-- ====== Computed values ============= -->
+
+
+	<!-- Space separated ordered list of version numbers. Not all need be valid. Used to determine if a component is deprecated or not -->
+<xsl:variable name="Versions">
+	<xsl:choose>
+		<xsl:when test="/*/systemModel/@version-list"><xsl:value-of select="/*/systemModel/@version-list"/></xsl:when>
+		<xsl:otherwise>ER5 ER5U 6.0 6.1 6.2 7.0 7.0s 8.0 8.0a 8.0b 8.1 8.1a 8.1b 9.0 9.1 9.2 9.3 9.4 9.5 9.6 Future</xsl:otherwise>
+	</xsl:choose>
+</xsl:variable>
+
+
+ <!-- the full horizontal width of a layer (mm). This is computed from the width of the widest layer, and SHOULD have a min value of 388.5 -->
+<xsl:variable name="full-width"><!-- the width  of the model -->
+	<xsl:call-template name="max-from-list">
+		<xsl:with-param name="list">
+			<xsl:for-each select="//layer">
+				<xsl:variable name="span-width"> <!-- space taken up by spanning layers-->
+					<xsl:call-template name="sum-list">
+						<xsl:with-param name="list">0 <xsl:for-each select="following-sibling::layer">
+							<xsl:if test="@span and position() - @span &lt;= 0"><xsl:apply-templates select="." mode="min-width"/><xsl:value-of select="concat(' ',$groupDx,' ')"/></xsl:if></xsl:for-each>
+						</xsl:with-param> 
+					</xsl:call-template>
+				</xsl:variable>	
+				<xsl:variable name="w"><xsl:apply-templates select="." mode="min-width"/></xsl:variable><!-- the width of the content -->
+				<xsl:value-of select="concat($span-width + $w,' ')"/>
+			</xsl:for-each>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:variable>
+
+<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="//systemModel/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="//systemModel/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:variable name="view-width" select="$full-width +  12.8 +  2 * $groupDy + $left-borders + $right-borders"/><!-- the horizontal width of the page in pixels,including empty margins -->
+
+<!-- ==================== draw ==================== -->
+
+<!-- well known patterns -->
+
+<xsl:template name="default-new-pattern">
+	<radialGradient id="Patternradial-grad"  gradientUnits="userSpaceOnUse"  cx="10" cy="10" r="14">
+		<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="15%" y1="0%" y2="15%">
+		<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="userSpaceOnUse" 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>
+
+<!-- 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"/> 
+		<!-- 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="*" mode="filter"/> <!-- filters for all items -->
+<xsl:template match="*" mode="text-filter"/> <!-- fitler for just text -->
+
+<xsl:template match="/SystemDefinition">
+<xsl:if test="systemModel/@resolution"><xsl:processing-instruction name="AdobeSVGViewer">resolution="<xsl:value-of select="systemModel/@resolution"/>"</xsl:processing-instruction></xsl:if>
+<svg  version="1.1" onload="wrapalltext()">
+	<xsl:attribute name="class">
+		<xsl:value-of select="$Detail"/>
+		<xsl:if test="/SystemDefinition/systemModel/@detail-type">-<xsl:value-of select="/SystemDefinition/systemModel/@detail-type"/></xsl:if>
+	</xsl:attribute>
+	<xsl:copy-of select="@xml:lang"/> <!-- localized language -->
+	<xsl:variable name="page-height">
+		<xsl:call-template name="sum-list">
+			<xsl:with-param name="list">
+				<xsl:value-of select="concat($groupDy,' ')"/>
+				<xsl:for-each select="systemModel/layer[not(@span)] | systemModel/legend-layer">
+					<xsl:apply-templates select="." mode="height"/>
+					<xsl:value-of select="concat(' ',$groupDy + $lgrpDx * (count(key('lgrp-top',@name)) +  count(key('lgrp-bottom',@name))),' ')"/>
+				</xsl:for-each>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+		 <!-- has groupDy margin around all edges -->
+	<xsl:attribute name="viewBox"><xsl:value-of select="concat(-$groupDy - $left-borders ,' 0 ',$view-width ,' ', $page-height)"/></xsl:attribute>
+	
+	<xsl:if test="$Page-width!=''">
+		<xsl:attribute name="width"><xsl:value-of select="$Page-width"/></xsl:attribute>
+		<xsl:variable name="unit" select="translate($Page-width,'0123456789-.','')"/>
+		<xsl:attribute name="height">
+			<xsl:choose>
+				<xsl:when test="$page-height &gt; ($view-width *  297 div 210)"><xsl:value-of select="297 * number(substring-before($Page-width,$unit)) div 210"/></xsl:when>
+				<xsl:otherwise><xsl:value-of select="210 * number(substring-before($Page-width,$unit)) div 297"/></xsl:otherwise>
+			</xsl:choose>
+		<xsl:value-of select="$unit"/></xsl:attribute>
+	
+	</xsl:if>
+	<xsl:apply-templates select="systemModel" mode="title"/>
+	<defs>
+
+    <style type="text/css">
+    text.layer, text.block, text.subblock, 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.block {
+		font-size: 4.233px;  /*  12pt  */
+		font-weight: bold;
+	}
+	text.label {		
+		font-size: 1.940px;  /*  5.5pt  */
+		font-weight: bold
+	}
+	text.cbox {		
+		font-size: 1.411px;  /*  4pt  */
+		font-weight: bold
+	}
+	text.lgrp {
+		font-size: 12.699px;  /*  36pt  */
+		font-weight: normal;
+	}
+<!-- block font sizes -->
+svg.subblock text.block,
+svg.subblock-fixed text.block {
+		font-size: 7.7605px;  /*  22pt  */
+	}
+svg.block text.block,
+svg.block-fixed text.block {
+		font-size: 11.288px;  /*  32pt  */
+		font-weight: normal;
+	}
+
+svg.subblock-fixed text.block, 
+svg.block-fixed text.block {
+	}
+
+<!-- subblock font sizes -->
+	text.subblock {
+		font-size: 2.822px;  /*  8pt  */
+	}
+	
+	svg.collection text.subblock,
+	svg.collection-fixed text.subblock  {
+		font-size: 4.233px;  /*  12pt  */
+	}
+	
+	svg.subblock text.subblock,
+	svg.subblock-fixed text.subblock  {
+		font-size: 7.055px;  /*  20pt  */
+	}
+<!-- collection font sizes -->
+	text.collection {
+		font-size: 2.469px;  /*  7pt  */
+	}
+	
+	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.subblock, rect.block  {
+		stroke-width: 0.2469px;  /*  0.7pt  */
+		stroke: black
+	}
+	rect.layer {
+		fill: #e6e6e6
+	}
+	rect.block {
+		fill: #b3b3b3
+	}
+	rect.subblock {
+		fill: #e6e6e6
+	}
+	rect.collection {
+		fill: white
+	}
+	rect.legend {
+		fill: white
+	}
+ </style>	
+ 		<xsl:apply-templates select="." mode="shapes"/>
+ 
+	</defs>
+		<!-- next line is a hack for Xalan -->
+		<xsl:comment>Drawing in static mode: <xsl:value-of select="$pre-Static=1"/></xsl:comment>	
+
+<script type="text/ecmascript"> 
+<!-- for creating / finding elements by namespace -->
+var svgns="http://www.w3.org/2000/svg";
+
+<!-- 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="$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:if test="not($Static)"><!-- show level lables -->
+<!--function resizeLabel(node) {
+	var list = node.getElementsByTagNameNS(svgns,'text');
+	if(list.length==0) return;
+	var txt = list.item(0);
+	node=node.firstChild;
+	while(node &amp;&amp; node.nodeType!=1) node=node.nextSibling;
+	if(!node || node==txt) return;
+	if(node.hasAttribute('transform')) return;
+	var scale  = (1.6+txt.getComputedTextLength()) / 20;
+	var x = Number(txt.getAttribute('x'))
+	node.setAttribute('transform', 'translate('+ x+') scale('+scale+' 1) translate('+ (-x)+') ');
+}-->
+</xsl:if>
+
+<!--  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 -->
+<![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.1');
+	if( node.getComputedTextLength() > len) 
+		node.setAttribute('letter-spacing','-0.2');
+}
+
+function whatSize(txt) { // convert a length into pixels
+	if(txt.match(/^[0-9.-]+$/)) return txt;
+	var a = document.createElementNS(svgns,'rect');
+	a.setAttribute('x',0);
+	a.setAttribute('y',0);
+	a.setAttribute('width',txt);
+	var l = a.getBBox().width;
+	delete a;
+	return l;
+}
+
+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('ref')) {
+		w = document.getElementById(cur.getAttribute('ref')).getBBox().width * 0.9;
+	} else 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');
+	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
+	var align =cur.getAttribute('dominant-baseline');
+	if(align=='' || align=='ideographic') {
+		cur.setAttribute('dy',(1-nlines)+"em");
+	 } else{
+	 	 if(align=='mathematical')
+			cur.setAttribute('dy',((1-nlines ) / 2 )+"em");
+		else if(align=='hanging') 
+			cur.setAttribute('dy',"0em")
+	 }
+}
+  ]]> </script>
+<xsl:apply-templates select="systemModel/*[last()]">
+	<xsl:with-param name="y" select="$groupDy"/>
+</xsl:apply-templates>
+	<xsl:apply-templates mode="validate"/>
+</svg>
+</xsl:template>
+
+<xsl:template match="component|collection|subblock|block|layer" mode="id"><xsl:value-of select="translate(@name,' ','')"/></xsl:template>
+
+<xsl:template name="linkable-content"><xsl:param name="show"/>
+	<xsl:choose> <!-- don't use <a> unless there is a valid link -->
+		<xsl:when test="string-length($Base)=0 or self::cmp">
+			<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 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="self::component[name]"><xsl:value-of select="name"/></xsl:when>		<!-- deprecated abbrev forms for components -->
+		<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:otherwise><xsl:value-of select="@name"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- ============ Detail options============ -->
+
+<!-- don't show when not enough detail -->
+<xsl:template match="component[$Detail!='component' and ($Static or /SystemDefinition/systemModel/@detail-type='fixed')]" priority="9"/>
+<xsl:template match="collection[$Detail!='component' and $Detail!='collection' and ($Static  or /SystemDefinition/systemModel/@detail-type='fixed')]" priority="9"/>
+<xsl:template match="block[$Detail='layer'  and ($Static  or /SystemDefinition/systemModel/@detail-type='fixed') ]" priority="9"/>
+<xsl:template match="subblock[($Detail='block' or $Detail='layer') and ($Static  or /SystemDefinition/systemModel/@detail-type='fixed')]" priority="9"/>
+
+<xsl:template match="*[$Detail='component' ]" mode="detail-stuff" priority="9"/>
+<xsl:template match="*" mode="detail-stuff" priority="-5"/>
+
+<xsl:template match="*[boolean($Static)]" mode="detail-stuff" priority="7"/>
+<xsl:template match="*[/SystemDefinition/systemModel/@detail-type='fixed']" mode="detail-stuff" priority="8">
+	<xsl:param name="s" select="'content'"/>
+	<xsl:if test="$s='mouseover' and (name()=$Detail or (self::block and not(subblock) and $Detail='subblock') or  (self::layer and not(block) and ($Detail='subblock' or $Detail='block')))">
+<!-- 		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>-->
+	</xsl:if>
+</xsl:template>
+<xsl:template match="collection[$Detail!='collection'] | *[($Detail='collection') and not(self::collection)] | subblock[$Detail='block']" mode="detail-stuff" priority="5"/>
+
+<xsl:template match="collection|subblock|block[not(subblock) or $Detail='block'] | layer[$Detail=name()]" mode="detail-stuff"><xsl:param name="s" select="'content'"/>
+	<xsl:choose>
+		<xsl:when test="$s='mouseover'">
+<!-- 			<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>-->
+			<xsl:attribute name="onmouseover">on('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>');off('<xsl:value-of select="name()"/>-label-<xsl:apply-templates select="." mode="id"/>');</xsl:attribute>
+			<xsl:attribute name="onmouseout">off('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>');on('<xsl:value-of select="name()"/>-label-<xsl:apply-templates select="." mode="id"/>');</xsl:attribute>
+		</xsl:when>
+		<xsl:when test="$s='text'">
+			<xsl:attribute name="id"><xsl:value-of select="name()"/>-label-<xsl:apply-templates select="." mode="id"/></xsl:attribute>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:attribute name="id"><xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/></xsl:attribute>
+			<xsl:attribute name="visibility">hidden</xsl:attribute>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="block[$Detail='subblock' and collection and subblock] | layer[($Detail='block' or $Detail='subblock')  and collection and block]" mode="detail-stuff"><xsl:param name="s" select="'content'"/>
+	<xsl:if test="$s='mouseover'">
+		<xsl:attribute name="onmouseover"><xsl:for-each select="collection">on('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>');</xsl:for-each></xsl:attribute>
+		<xsl:attribute name="onmouseout"><xsl:for-each select="collection">off('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>');</xsl:for-each></xsl:attribute>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template priority="8" match="block[subblock and $Detail='subblock']/collection | layer[block  and ($Detail='subblock' or $Detail='block')]/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:apply-templates select="." mode="id"/></xsl:attribute>
+		<xsl:attribute name="visibility">hidden</xsl:attribute>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="layer[$Detail=name() or not(block|subblock)]" mode="detail-stuff"><xsl:param name="s" select="'content'"/>
+	<xsl:choose>
+		<xsl:when test="$s='mouseover'">
+			<xsl:if test="$Detail=name()"><!-- <xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>--></xsl:if>	
+			<xsl:attribute name="onmouseover">on('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>')</xsl:attribute>
+			<xsl:attribute name="onmouseout">off('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>')</xsl:attribute>
+		</xsl:when>
+		<xsl:when test="$s!='text'">
+			<xsl:attribute name="id"><xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/></xsl:attribute>
+			<xsl:attribute name="visibility">hidden</xsl:attribute>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+<xsl:template match="*[$Detail='layer' and not(self::layer)]" mode="detail-stuff"/>
+
+
+<!-- ============ labelclass ============ -->
+
+<xsl:template match="*" mode="label-class">
+	<xsl:attribute name="class"><xsl:choose>
+	<xsl:when test="self::block">block</xsl:when>
+	<xsl:when test="self::subblock">subblock</xsl:when>
+	<xsl:when test="self::layer">layer</xsl:when>
+	<xsl:when test="self::component">component</xsl:when>
+	<xsl:when test="self::collection">collection</xsl:when>
+	<xsl:otherwise><xsl:message>Error</xsl:message></xsl:otherwise>
+</xsl:choose></xsl:attribute>
+</xsl:template>
+
+
+<!-- ============ hyperlinks ============ -->
+
+<xsl:template match="*" mode="link-label"/>
+<xsl:template match="*[@name]" mode="link-label">
+<xsl:attribute name="target">details</xsl:attribute>
+<xsl:attribute name="xlink:href"><xsl:value-of select="$Base"/>/<xsl:choose>
+	<xsl:when test="self::block">Blocks</xsl:when>
+	<xsl:when test="self::subblock">SubBlocks</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:message>Error</xsl:message></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="//systemModel[@font]">'<xsl:value-of select="//systemModel/@font"/>'</xsl:when>
+		<xsl:otherwise>Arial</xsl:otherwise>
+	</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($st,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="*[generator-color]">
+  <xsl:call-template name="multi-color-grad">
+   <xsl:with-param name="key" select="'styled'"/>
+   <xsl:with-param name="c" select="generator-color/@ref"/>
+   <xsl:with-param name="blur" select="0"/>
+  </xsl:call-template>
+</xsl:template>
+
+<!-- ============ 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:template name="min-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="min"><xsl:choose>
+		<xsl:when test="$next=''"><xsl:value-of select="$cur + 1"/></xsl:when>
+		<xsl:otherwise><xsl:call-template name="min-from-list">
+			<xsl:with-param name="list" select="$next"/>
+		</xsl:call-template></xsl:otherwise>
+	</xsl:choose></xsl:variable>
+	<xsl:choose>
+		<xsl:when test="$cur &lt; $min"><xsl:value-of select="$cur"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$min"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<!-- returns the first smallest value -->
+<xsl:template name="min-from-list-with-index"><xsl:param name="list"/><xsl:param name="start" select="0"/>
+	<xsl:variable name="cur" select="substring-before($list,' ')"/>
+	<xsl:variable name="next" select="substring-after($list,' ')"/>
+	<xsl:variable name="min"><xsl:choose>
+		<xsl:when test="$next=''"><xsl:value-of select="concat($cur,':',$start)"/></xsl:when>
+		<xsl:otherwise><xsl:call-template name="min-from-list-with-index">
+			<xsl:with-param name="list" select="$next"/>
+			<xsl:with-param name="start" select="$start + 1"/>
+		</xsl:call-template></xsl:otherwise>
+	</xsl:choose></xsl:variable>
+	<xsl:choose>
+		<xsl:when test="$cur &lt;= substring-before($min,':')"><xsl:value-of select="concat($cur,':',$start)"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$min"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="list-range"><xsl:param name="list"/><xsl:param name="from" select="0"/><xsl:param name="to"/>
+	<xsl:if test="$from &lt; 1"><xsl:value-of select="concat(substring-before($list,' '),' ' )"/></xsl:if>
+	<xsl:if test="$to &gt; 0">
+		<xsl:call-template name="list-range">
+			<xsl:with-param name="list" select="substring-after($list,' ')"/>
+			<xsl:with-param name="from" select="$from - 1"/>
+			<xsl:with-param name="to" select="$to - 1"/>
+		</xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+<!-- modes:
+
+n-levels:	the number of levels available to children of that item
+level-range: 	the bottom and top level this item spans in its parent
+-->
+
+<xsl:template mode="validate" match="node()" priority="-4"/>
+<xsl:template mode="validate" match="*" priority="-2"><xsl:apply-templates mode="validate" select="*"/></xsl:template>
+
+<!-- ====== Components ============= -->
+
+<xsl:template match="*" mode="display-style-color" priority="-2"/>
+<xsl:template match="*" mode="animate-color" priority="-2"/><!-- change back to -2 to enable -->
+
+
+<xsl:template match="*[@generator-color]" mode="animate-color" priority="4">
+	<xsl:if test="not($Static)">
+		<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="*[generator-color]" mode="animate-color" priority="4">
+	<xsl:if test="not($Static)">
+		<xsl:for-each select="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>
+
+<!-- for legend-copy generated legend items -->
+
+<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]" mode="overlay-style" priority="8">
+	<xsl:text>fill: url(</xsl:text>
+	<xsl:value-of select="@generated-overlay"/>
+	<xsl:text>); stroke: none; stroke-width: 0;</xsl:text>
+</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>
+
+<!-- end legend-copy  items -->
+
+<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>
+
+<!--  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(generator-color)=1]" mode="display-style-color" priority="8">
+	<xsl:for-each select="key('styled',generator-color/@ref)">
+		<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="*[count(generator-color) &gt; 1]" mode="display-style-color" priority="8">
+	<xsl:variable name="ref" select="key('styled',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]" mode="overlay-style" priority="8">
+	<xsl:text>fill: url(</xsl:text>
+	<xsl:for-each select="key('styled',@generator-overlay)">
+		<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
+	</xsl:for-each>	
+	<xsl:text>); stroke: none; stroke-width: 0;</xsl:text>
+</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 | 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" mode="display-style-color" priority="-1">
+	<xsl:variable name="c"><xsl:value-of select="key('color',@ts)/@color"/></xsl:variable>
+	<xsl:choose>
+		<xsl:when test="$c!=''"><xsl:value-of select="$c"/></xsl:when>
+		<xsl:otherwise>grey</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="component" mode="overlay-style" priority="-2"> <!-- since deprecated, replaced with introduced -->
+	<xsl:if test="@introduced = //systemModel/@ver or @since = //systemModel/@ver or @ref">
+		<xsl:text>fill:</xsl:text>
+		<xsl:choose>
+			<xsl:when test="@since = //systemModel/@ver">url(#Patternradial-grad)</xsl:when> <!-- to be removed -->
+			<xsl:when test="@introduced = //systemModel/@ver">url(#Patternradial-grad)</xsl:when>
+			<xsl:when test="@ref">url(#Patternstriped-diag-up)</xsl:when>
+			<xsl:otherwise>none</xsl:otherwise>
+		</xsl:choose>
+		<xsl:text>; stroke: none; stroke-width: 0;</xsl:text>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="component|cmp" mode="overlay-style" priority="-3">fill: none; stroke: none; stroke-width: 0;</xsl:template>
+
+<xsl:template match="component|cmp" mode="shape" priority="-1">#Borderbox<xsl:choose>
+      <xsl:when test="self::cmp"/>
+      <xsl:when test="s12/@osd='CS'">-clipLB</xsl:when>
+      <xsl:when test="s12/@osd='OS'">-clipLT</xsl:when>
+      <xsl:when test="s12/@osd='CR'">-clipRB</xsl:when>
+      <xsl:when test="s12/@osd='OR'">-clipRT</xsl:when>
+      <xsl:when test="s12/@osd='T-R'">-clipAll</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="component|cmp">
+	<xsl:param name="spacing" select="0"/>
+	<xsl:variable name="x-pos" select="($cSize + $spacing) * (position() - 1)"/>
+	<g class="component"><xsl:apply-templates select="." mode="filter"/>
+		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
+		<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="{$cSize}" height="{$cSize}" 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-style"/></xsl:variable>
+		<xsl:if test="$overlay!=''">
+			<use width="{$cSize}" height="{$cSize}" x="{$x-pos}" y="0" style="{$overlay}" xlink:href="{$ref}"/>
+		</xsl:if>
+		<xsl:call-template name="linkable-content">
+			<xsl:with-param name="show">
+				<text text-anchor="middle" dominant-baseline="mathematical"  class="component" y="4.8">
+					<xsl:attribute name="x"><xsl:value-of select="$x-pos + 0.5 * $cSize"/></xsl:attribute>
+					<xsl:apply-templates select="." mode="wrap"><xsl:with-param name="w" select="$cSize"/></xsl:apply-templates>
+					<xsl:call-template name="display-name"/>
+				</text>
+			</xsl:with-param>
+		</xsl:call-template>
+	</g>
+</xsl:template>
+
+
+<xsl:template match="component|cmp" mode="wrap"><xsl:param name="w"/>
+	<xsl:variable name="s"><xsl:call-template name="name-value"/></xsl:variable>
+	<!-- 7 is a pretty arbitrary limit. But not bad -->
+	<xsl:if test=" string-length($s) &gt; 7"><xsl:attribute name="width"><xsl:value-of select="$w"/></xsl:attribute></xsl:if>
+</xsl:template>
+
+<!-- ====== Collections ============= -->
+
+<xsl:template match="collection" mode="height"><xsl:value-of select="$mSize"/></xsl:template>
+
+<xsl:template match="collection" mode="width">
+	<xsl:variable name="num" select="count(component)"/>
+	<xsl:choose>
+		<xsl:when test="$Detail=name() and /SystemDefinition/systemModel/@detail-type='fixed'">
+			<xsl:value-of select="$mSize"/>
+		</xsl:when>
+		<xsl:when test="$num=0">0</xsl:when>	
+		<xsl:when test="$num=1"><xsl:value-of select="$mSize"/></xsl:when> <!-- cannot be thinner than square-->
+		<xsl:otherwise><xsl:value-of select="$num * $cSize"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="collection"><xsl:param name="levels"/>
+	<xsl:variable name="w" ><xsl:apply-templates mode="width"  select="."/></xsl:variable>
+	<xsl:variable name="index"><xsl:apply-templates select="." mode="level-index"/></xsl:variable>
+
+	<xsl:variable name="y">
+		<xsl:call-template name="level-top">
+			<xsl:with-param name="index" select="$index"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="x">
+		<xsl:call-template name="x-pos">
+			<xsl:with-param name="levels" select="$levels"/>
+			<xsl:with-param name="range" select="concat($index,' ',$index)"/>
+		</xsl:call-template>
+	</xsl:variable>
+	
+	<g class="{name()}"><xsl:apply-templates select="." mode="filter"/>
+		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
+		<xsl:attribute name="transform">translate(<xsl:value-of select="concat($x,' ',$y)"/>)</xsl:attribute>
+		<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="{$mSize}" width="{$w}">
+			<xsl:call-template name="styles"/>
+		</rect>
+		<xsl:call-template name="linkable-content">
+			<xsl:with-param name="show">
+				<text  text-anchor="start" dominant-baseline="hanging" class="collection" y="0.4" x="1.4">
+					<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'text'"/></xsl:apply-templates>
+					<xsl:attribute name="width"><xsl:value-of select="$w - 1.4"/></xsl:attribute>
+					<xsl:if test="$Detail='collection' ">
+						<xsl:attribute name='text-anchor'>middle</xsl:attribute>
+						<xsl:attribute name='x'><xsl:value-of select="$w * 0.5"/></xsl:attribute>
+						<xsl:attribute name='dominant-baseline'>mathematical</xsl:attribute>						
+						<xsl:attribute name="y"><xsl:value-of select="$mSize * 0.5"/></xsl:attribute>
+					</xsl:if>
+					<xsl:call-template name="display-name"/>
+				</text>
+			</xsl:with-param>
+		</xsl:call-template>
+		<g transform="translate(0 {$mSize - $cSize})">
+			<xsl:apply-templates select="." mode="detail-stuff"/>
+			<xsl:apply-templates select="*"/>
+		</g>
+	</g>
+	<xsl:apply-templates select="following-sibling::*[1]">
+		<xsl:with-param name="levels">
+			<xsl:call-template name="sum-levels">
+				<xsl:with-param name="levels" select="$levels"/>
+				<xsl:with-param name="range" select="concat($index,' ',$index)"/>
+				<xsl:with-param name="width" select="$w"/>
+			</xsl:call-template>
+		</xsl:with-param>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="collection" mode="post-levels"><xsl:param name="levels"/>
+	<xsl:variable name="index"><xsl:apply-templates select="." mode="level-index"/></xsl:variable>
+	<xsl:variable name="next">
+		<xsl:call-template name="sum-levels">
+			<xsl:with-param name="levels" select="$levels"/>
+			<xsl:with-param name="range" select="concat($index,' ',$index)"/>
+			<xsl:with-param name="width"><xsl:apply-templates mode="width"  select="."/></xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	
+	<xsl:if test="not(following-sibling::*)"><xsl:value-of select="$next"/></xsl:if>
+	<xsl:apply-templates select="following-sibling::*[1]" mode="post-levels">
+		<xsl:with-param name="levels" select="$next"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+
+<!-- if no levels, it can only be at index 0 -->
+<xsl:template match="collection[not(ancestor::*[@levels])]" mode="level-index" priority="4">0</xsl:template>
+
+
+<xsl:template match="collection[not(@level) and ancestor::block[@level and not(@levels)]]" mode="level-index" priority="3">
+	<!-- this is in a block with a level (but no levels), so use that level -->
+	<xsl:for-each select="ancestor::block">
+		<xsl:call-template name="level-index"/>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template match="collection[not(@level)]" mode="level-index" priority="2">
+	<!-- this has an ancestor with levels, so this is on the (extra) top level -->
+	<xsl:variable name="n"><xsl:apply-templates select="ancestor::*[@levels][1]" mode="n-levels"/></xsl:variable> <!-- n = number of levels this collection can see -->
+	<xsl:value-of select="$n - 1"/>
+	<!-- warning: no level -->
+</xsl:template>
+
+<xsl:template mode="validate" match="collection[not(@level) and ancestor::*[@levels] and not(ancestor::block[@level])]">
+	<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">
+		<xsl:value-of select="name()"/> with no level (<xsl:value-of select="@name"/>)</xsl:with-param></xsl:call-template>
+</xsl:template>
+
+<xsl:template mode="validate" match="collection[not(@level) and ancestor::block[@level]]">
+	<xsl:if test="$Verbose">
+		<xsl:call-template name="Caller-Note"><xsl:with-param name="text">
+			<xsl:value-of select="name()"/> with no level (<xsl:value-of select="@name"/>) given same level as parent</xsl:with-param></xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+<!--xsl:template mode="validate" match="collection[@level and not(contains(ancestor::*/@levels,'level'))]">
+	<xsl:message>&#xa;Error: invalid level on <xsl:value-of select="name()"/> (<xsl:value-of select="@name"/>)</xsl:message>
+</xsl:template-->
+
+<xsl:template match="collection" mode="level-index">
+	<!-- thiis has a level and an ancestor with levels -->
+	<xsl:call-template name="level-index"/>
+</xsl:template>
+
+<!-- ====== Sub-blocks ============= -->
+
+<xsl:template match="subblock[/SystemDefinition/systemModel/@detail-type='fixed' and $Detail=name()]" priority="5" mode="width">
+	<xsl:value-of select="$mSize * 3"/>
+</xsl:template>
+
+<xsl:template match="block[/SystemDefinition/systemModel/@detail-type='fixed' and $Detail=name()]" priority="5" mode="width">
+	<xsl:value-of select="$mSize * 5"/>
+</xsl:template>
+
+<xsl:template match="block[/SystemDefinition/systemModel/@detail-type='fixed' and not(subblock) and ($Detail='subblock')]" priority="5" mode="width">
+	<xsl:value-of select="$mSize * 3"/>
+</xsl:template>
+
+<xsl:template match="subblock|block" mode="width">
+	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select="."/></xsl:variable>
+	<xsl:variable name="levels">	
+		<xsl:apply-templates select="*[1]" mode="post-levels">
+			<xsl:with-param name="levels">
+				<xsl:call-template name="zeros">
+					<xsl:with-param name="n" select="$n"/>
+				</xsl:call-template>
+			</xsl:with-param>
+		</xsl:apply-templates>
+	</xsl:variable>
+	<xsl:variable name="w-base">
+		<xsl:call-template name="max-from-list">
+			<xsl:with-param name="list" select="$levels"/>	
+		</xsl:call-template>
+	</xsl:variable>
+
+	<xsl:variable name="range">
+		<xsl:choose>
+			<xsl:when test="@levels">0 <xsl:value-of select="$n - 1"/></xsl:when>
+			<xsl:otherwise><xsl:apply-templates select="." mode="level-range"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
+	<xsl:variable name="min">
+		<xsl:call-template name="min-from-list-with-index">
+			<xsl:with-param name="list">
+				<xsl:call-template name="list-range">
+					<xsl:with-param name="list" select="$levels"/>
+					<xsl:with-param name="from" select="$r0"/>
+					<xsl:with-param name="to" select="substring-after($range,' ')"/>
+				</xsl:call-template>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="min-label-width">
+		<xsl:apply-templates select="." mode="min-label-width"/>
+	</xsl:variable>
+	<xsl:variable name="min-level-width" select="substring-before($min,':')"/>
+	<xsl:choose>
+		<xsl:when test="($w-base - $min-level-width) &lt; $min-label-width"><xsl:value-of select="$min-level-width +  $min-label-width"/></xsl:when>
+		<xsl:when test="/SystemDefinition/systemModel/@detail-type='fixed' and ($Detail='collection') and $w-base &lt; 2*$mSize">
+			<xsl:value-of select="2*$mSize"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$w-base"/></xsl:otherwise>
+	</xsl:choose>	
+</xsl:template>
+
+<xsl:template match="subblock" mode="height">
+	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
+	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>	
+	<xsl:variable name="r1" select="number(substring-after($range,' '))"/>
+	<!-- height is from number of levels -->
+	<xsl:value-of select="($r1 - $r0 + 1) * ($mSize +  $groupDy) - $groupDy"/>
+</xsl:template>
+
+<!-- ============= range of levels ============= -->
+
+<!-- spans full height of parent, so uses parent's range -->
+<xsl:template match="subblock" mode="level-range">
+	<xsl:apply-templates select=".." mode="level-range"/>
+</xsl:template>
+<xsl:template match="block[@levels]/subblock" mode="level-range" priority="1">
+	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select=".."/></xsl:variable>
+	<xsl:value-of select="concat('0 ',$n - 1)"/>
+</xsl:template>
+
+<xsl:template mode="n-levels" match="subblock">
+	<xsl:apply-templates select=".." mode="n-levels"/>
+</xsl:template>
+<!-- ============= draw ============= -->
+
+<xsl:template match="subblock"><xsl:param name="levels"/> <!-- can contain only collections -->
+	<xsl:variable name="width"><xsl:apply-templates select="." mode="width"/></xsl:variable>
+	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
+	<xsl:variable name="r1" select="number(substring-after($range,' '))"/>	
+	<xsl:variable name="x"><xsl:call-template name="x-pos">
+			<xsl:with-param name="levels" select="$levels"/>
+			<xsl:with-param name="range" select="$range"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="y">
+		<xsl:call-template name="level-top">
+			<xsl:with-param name="index" select="$r1"/>
+		</xsl:call-template>
+	</xsl:variable>	
+	
+	<g class="{name()}" transform="translate({$x})"><xsl:apply-templates select="." mode="filter"/>
+		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>	
+		<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>		
+		<xsl:attribute name="transform">translate( <xsl:value-of select="$x"/>)</xsl:attribute>
+		<xsl:apply-templates select="." mode="animate-color"/>
+        <xsl:apply-templates select="." mode="multi-color"/>		
+		<xsl:variable name="height"><xsl:apply-templates select="." mode="height"/></xsl:variable> 
+		<rect class="{name()}" x="0" height="{$height}" width="{$width}" y ="{$y}">
+			<xsl:if test="$Detail=name()">
+				<!-- to make room for the block label -->
+				<xsl:attribute name="height"><xsl:value-of select="$height - $detail-block-space"/></xsl:attribute>
+			</xsl:if>
+			<xsl:call-template name="styles"/>
+		</rect>
+
+		<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="subblock" dominant-baseline="mathematical" x="{$width * 0.5}" width="{$width}" y="{$y + 0.5 * ($height - $detail-block-space)}">
+					<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'text'"/></xsl:apply-templates>
+					<xsl:apply-templates select="." mode="label">
+						<xsl:with-param name="width" select="$width"/>
+					</xsl:apply-templates>
+					<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="*[1]">
+				<xsl:with-param name="levels">
+					<xsl:call-template name="zeros"><xsl:with-param name="n" select="string-length($levels) - string-length(translate($levels,' ',''))"/></xsl:call-template>
+				</xsl:with-param>
+			</xsl:apply-templates>
+		</g>	
+	</g>	
+	<xsl:apply-templates select="following-sibling::*[1]">
+		<xsl:with-param name="levels">
+			<xsl:call-template name="sum-levels">
+				<xsl:with-param name="levels" select="$levels"/>
+				<xsl:with-param name="range" select="$range"/>
+				<xsl:with-param name="width" select="$width"/>
+			</xsl:call-template>
+		</xsl:with-param>
+	</xsl:apply-templates>	
+</xsl:template>
+
+
+<xsl:template match="subblock" mode="post-levels"><xsl:param name="levels"/>
+	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
+	<xsl:variable name="next">
+		<xsl:call-template name="sum-levels">
+			<xsl:with-param name="levels" select="$levels"/>
+			<xsl:with-param name="range" select="$range"/>
+			<xsl:with-param name="width"><xsl:apply-templates mode="width"  select="."/></xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	
+	<xsl:if test="not(following-sibling::*)"><xsl:value-of select="$next"/></xsl:if>
+	<xsl:apply-templates select="following-sibling::*[1]" mode="post-levels">
+		<xsl:with-param name="levels" select="$next"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="subblock" mode="min-label-width">
+	<xsl:value-of select="$inlineLabel"/>
+</xsl:template>
+
+<xsl:template match="subblock" mode="label"><xsl:param name="width"/>
+	<xsl:call-template name="inline-label">
+		<xsl:with-param name="width" select="$width"/>
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="subblock[$Detail=name()]" mode="label" priority="4"/>
+
+<!-- ====== Blocks  ============= -->
+
+<!-- height determined by: (in order) 
+@levels => height of the levels
+@span => eight spanned 
+not(@levels) and not(@level) => full of parent
+-->
+
+
+
+	<!-- min-height is always independent of parent -->
+<xsl:template match="block[@levels]" mode="min-height" priority="6">
+	<xsl:variable name="h"><xsl:apply-templates mode="level-heights" select="."/></xsl:variable>
+	<xsl:call-template name="sum-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="$groupDy * (string-length($h)  - string-length(translate($h,' ','')) - 1)"/> <!-- spacing between levels: needed? -->
+			<xsl:value-of select="concat(' ',$h)"/>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="block" mode="min-height" priority="5">
+	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
+	<xsl:variable name="n" select="number(substring-after($range,' ')) - number(substring-before($range,' ')) + 1"/>
+	<xsl:value-of select="$n * ($mSize + $groupDy)  - $groupDy "/>
+</xsl:template>
+
+<!-- if a spanned layer contains just a single block, then increase the size to fill the entire layer -->
+<xsl:template match="layer[@span &gt; 0]/block[not(@level) and count(../*)=1]" mode="max-height" priority="4">
+	<xsl:variable name="h"><xsl:apply-templates mode="height" select=".."/></xsl:variable>
+	<xsl:variable name="padding"><xsl:apply-templates select=".." mode="padding"/></xsl:variable>
+	<xsl:value-of select="$h - substring-before($padding,' ') - substring-after($padding,' ')"/>
+</xsl:template>
+
+
+<!-- max-height is always dependent on parent -->
+<xsl:template match="block" mode="max-height">
+	<xsl:variable name="h">
+		<xsl:apply-templates mode="level-heights" select="..">
+			<xsl:with-param name="range">
+				<xsl:apply-templates select="." mode="level-range"/>
+			</xsl:with-param>
+		</xsl:apply-templates>
+	</xsl:variable>
+	<xsl:call-template name="sum-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="$groupDy * (string-length($h)  - string-length(translate($h,' ','')) - 1)"/> <!-- spacing between levels: needed? -->
+			<xsl:value-of select="concat(' ',$h)"/><!-- insert some border here-->
+		</xsl:with-param>
+	</xsl:call-template>	
+</xsl:template>
+
+
+	<!-- independent of parent -->
+<xsl:template match="layer[not(@levels)]/block[@levels]" mode="height" priority="7">
+	<xsl:call-template name="max-from-list">
+		<xsl:with-param name="list">
+			<xsl:for-each select="../block[@levels]">
+				<xsl:apply-templates mode="min-height" select="."/><xsl:text> </xsl:text>
+			</xsl:for-each>
+		</xsl:with-param>
+	</xsl:call-template>	
+</xsl:template>
+
+	<!-- NOT independent of parent -->
+<xsl:template match="block[@levels]" mode="height" priority="6">
+	<xsl:variable name="h0"><xsl:apply-templates mode="min-height" select="."/></xsl:variable>
+	<xsl:variable name="h1"><xsl:apply-templates mode="max-height" select="."/></xsl:variable>
+	<xsl:choose>
+		<xsl:when test="$h1 &gt; $h0"><xsl:value-of select="$h1"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$h0"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+	<!-- no @levels, so height depends on number of levels spanned and size of levels in parent-->
+<xsl:template match="block" mode="height" priority="5">
+	<xsl:apply-templates mode="max-height" select="."/>
+</xsl:template>
+
+
+
+<xsl:template match="block"><xsl:param name="levels"/>
+	<xsl:variable name="w"><xsl:apply-templates select="." mode="width"/></xsl:variable>
+	<xsl:variable name="h"><xsl:apply-templates select="." mode="height"/></xsl:variable>
+	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
+	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
+	<xsl:variable name="r1" select="number(substring-after($range,' '))"/>		
+	
+	<xsl:variable name="x">
+		<xsl:call-template name="x-pos">
+			<xsl:with-param name="levels" select="$levels"/>
+			<xsl:with-param name="range" select="$range"/>
+		</xsl:call-template>
+	</xsl:variable>
+
+	<!-- if this has a level, top ends at that level, otherwise this goes all the way to top of layer -->
+	<xsl:variable name="y"> <!-- the start of the box -->
+		<xsl:apply-templates select="ancestor::layer" mode="level-top">
+			<xsl:with-param name="index" select="$r1"/>
+		</xsl:apply-templates>
+	</xsl:variable>
+
+	<xsl:variable name="translate-y">
+		<xsl:choose>
+			<xsl:when test="@levels"><xsl:value-of select="$y"/></xsl:when>
+			<xsl:otherwise>0</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	
+	<xsl:variable name="padding"><xsl:apply-templates select=".." mode="padding"/></xsl:variable>
+	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select=".."/></xsl:variable>	
+	<xsl:variable name="padding-top">
+		<xsl:choose>
+			<xsl:when test="$r1 = number($n) - 1"><xsl:value-of select="substring-before($padding,' ')"/></xsl:when>
+			<xsl:otherwise>0</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable> 
+	<xsl:variable name="padding-bottom">
+		<xsl:choose>
+			<xsl:when test="$r0 = 0"><xsl:value-of select="substring-after($padding,' ')"/></xsl:when>
+			<xsl:otherwise>0</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable> 
+
+	<g class="{name()}">
+		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
+		<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="{$w}" height="{$h +  $padding-top + $padding-bottom}" y="{$y - $translate-y - $padding-top}">
+			<xsl:call-template name="styles"/>
+		</rect>		
+		<xsl:variable name="text-off"> <!--  middle-align if not showing children -->
+			<xsl:choose>
+				<xsl:when test="($Detail=name()) and $n!=1"><xsl:value-of select="$h *0.5 + $padding-bottom div 2"/></xsl:when>
+				
+				<xsl:when test="($Detail='subblock' and not(subblock)) or $Detail='block'"><xsl:value-of select="$h *0.5 + $padding-bottom div 2"/></xsl:when>
+				<xsl:otherwise>0</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="text-align"> <!--  middle-align if not showing children -->
+			<xsl:choose>
+				<xsl:when test="($Detail=name()) and $n!=1">mathematical</xsl:when>				
+				<xsl:when test="($Detail='subblock' and not(subblock)) or $Detail='block'">mathematical</xsl:when>
+				<xsl:otherwise>ideographic</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="min-h"> <!-- height of this if it were the only block in the layer -->
+			<xsl:apply-templates select="." mode="min-height"/>
+		</xsl:variable>
+	<!-- label goes here -->
+		<xsl:call-template name="linkable-content">
+			<xsl:with-param name="show">
+				<text text-anchor="middle" class="block" width="{$w}" x="{$w div 2}" y="{ $y + $h - $text-off + $padding-bottom  - $translate-y - 1 }" dominant-baseline="{$text-align}">
+					<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'text'"/></xsl:apply-templates>
+					<xsl:choose>
+						<xsl:when test="$mSize  &lt;= $h - $min-h "/>  <!--  plenty of room on bottom, no need for inline label -->
+						<xsl:when test="$Detail='collection' or $Detail='component'  or $Detail='layer'  or ( ($Detail='subblock') and subblock )">
+							<xsl:apply-templates select="." mode="label">
+								<xsl:with-param name="width" select="$w"/>
+							</xsl:apply-templates>
+						</xsl:when>
+					</xsl:choose>
+					<xsl:call-template name="display-name"/>
+				</text>
+			</xsl:with-param>
+		</xsl:call-template>
+		<g><xsl:apply-templates select="." mode="detail-stuff"/>
+	<!--<xsl:if test="@levels">
+		<xsl:call-template name="levels-labels">
+		<xsl:call-template>
+		<xsl:message/>
+	</xsl:if>-->
+		
+			<xsl:apply-templates select="*[1]">
+				<xsl:with-param name="levels">
+					<xsl:call-template name="zeros">
+						<xsl:with-param name="n"><xsl:apply-templates mode="n-levels" select="."/></xsl:with-param>
+					</xsl:call-template>				
+				</xsl:with-param>
+			</xsl:apply-templates>	
+		</g>
+	</g>
+	<xsl:apply-templates select="following-sibling::*[1]">
+		<xsl:with-param name="levels">
+			<xsl:call-template name="sum-levels">
+				<xsl:with-param name="levels" select="$levels"/>
+				<xsl:with-param name="range" select="$range"/>
+				<xsl:with-param name="width" select="$w"/>
+			</xsl:call-template>
+		</xsl:with-param>
+	</xsl:apply-templates>	
+</xsl:template>
+
+
+<xsl:template match="block" mode="post-levels"><xsl:param name="levels"/>
+	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
+	<xsl:variable name="next">
+		<xsl:call-template name="sum-levels">
+			<xsl:with-param name="levels" select="$levels"/>
+			<xsl:with-param name="range" select="$range"/>
+			<xsl:with-param name="width"><xsl:apply-templates mode="width"  select="."/></xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	
+	<xsl:if test="not(following-sibling::*)"><xsl:value-of select="$next"/></xsl:if>
+	<xsl:apply-templates select="following-sibling::*[1]" mode="post-levels">
+		<xsl:with-param name="levels" select="$next"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="block" mode="min-label-width">
+	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
+	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
+	<xsl:variable name="padding"><xsl:apply-templates select=".." mode="padding"/></xsl:variable>
+	
+	
+	<xsl:variable name="h"><xsl:apply-templates select="." mode="height"/></xsl:variable>
+	<xsl:variable name="mh"><xsl:apply-templates select="." mode="min-height"/></xsl:variable>
+	<xsl:choose>
+		<xsl:when test="$mSize  &lt;= $h - $mh ">0</xsl:when>  <!--  plenty of room on bottom, no need for inline label -->
+		<xsl:when test="$r0 != 0 or number(substring-after($padding,' '))=0"><xsl:value-of select="$inlineLabel"/></xsl:when>
+		<xsl:otherwise>0</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="inline-label"><xsl:param name="width"/>
+	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select="."/></xsl:variable>
+	<xsl:variable name="widths">
+		<xsl:apply-templates select="*[1]" mode="post-levels">
+			<xsl:with-param name="levels">
+				<xsl:call-template name="zeros">
+					<xsl:with-param name="n" select="$n"/>
+				</xsl:call-template>
+			</xsl:with-param>
+		</xsl:apply-templates>	
+	</xsl:variable>
+	<xsl:variable name="range">
+		<xsl:choose>
+			<xsl:when test="@levels">0 <xsl:value-of select="$n - 1"/></xsl:when>
+			<xsl:otherwise><xsl:apply-templates select="." mode="level-range"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
+
+	<xsl:variable name="min">
+		<xsl:call-template name="min-from-list-with-index">
+			<xsl:with-param name="list">
+				<xsl:call-template name="list-range">
+					<xsl:with-param name="list" select="$widths"/>
+					<xsl:with-param name="from" select="$r0"/>										
+					<xsl:with-param name="to" select="substring-after($range,' ')"/>
+				</xsl:call-template>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="w0" select="$width - substring-before($min,':')"/>
+	<xsl:variable name="level" select="$r0 +  number(substring-after($min,':'))"/>
+	<xsl:variable name="x-center" select="$width - 0.5 * $w0"/>
+	<xsl:variable name="y">
+		<xsl:for-each select="*[1]">
+			<xsl:call-template name="level-top">
+				<xsl:with-param name="index" select="$level"/>
+			</xsl:call-template>
+		</xsl:for-each>
+	</xsl:variable>
+	<xsl:variable name="h"><xsl:choose>
+		<xsl:when test="ancestor::block[@levels]">
+			<xsl:apply-templates select="ancestor::block" mode="level-height">
+				<xsl:with-param name="index" select="$level"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates select="ancestor::layer" mode="level-height">
+				<xsl:with-param name="index" select="$level"/>
+			</xsl:apply-templates>
+		</xsl:otherwise>
+	</xsl:choose></xsl:variable>
+
+	<xsl:attribute name="dominant-baseline">mathematical</xsl:attribute>
+	<xsl:attribute name="width"><xsl:value-of select="$w0"/></xsl:attribute>
+	<xsl:attribute name="x"><xsl:value-of select="$x-center"/></xsl:attribute>
+	<xsl:attribute name="y"><xsl:value-of select="$y +  0.5 * $h"/></xsl:attribute>
+</xsl:template>
+
+
+<xsl:template match="block" mode="label"><xsl:param name="width"/>
+	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
+	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
+	<xsl:variable name="padding"><xsl:apply-templates select=".." mode="padding"/></xsl:variable>
+	<xsl:if test="$r0 != 0 or number(substring-after($padding,' '))=0">
+		<!-- need to put label on a level -->
+		<xsl:call-template name="inline-label">
+			<xsl:with-param name="width" select="$width"/>
+		</xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="block" mode="level-height"><xsl:param name="level"/>
+	<xsl:apply-templates select="descendant::collection[1]" mode="height"/>
+</xsl:template>
+
+<xsl:template mode="n-levels" match="block[not(@levels)]" priority="2">
+	<xsl:apply-templates select=".." mode="n-levels"/>
+</xsl:template>
+
+<xsl:template mode="n-levels" match="block">
+	<xsl:variable name="levels" select="normalize-space(@levels)"/>
+	<xsl:variable name="n" select="string-length($levels)  - string-length(translate($levels,' ','')) +1"/> <!-- number of spaces +1 -->
+	<xsl:choose>
+			<!-- if there are no levels, there is one implicit level -->
+		<xsl:when test="$levels='' ">1</xsl:when>
+			<!-- if there are any collections with no level, we add an extra on top -->
+		<xsl:when test="descendant::collection[not(@level)]"><xsl:value-of select="$n + 1"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$n"/></xsl:otherwise>
+	</xsl:choose>		
+</xsl:template>
+
+
+<!-- ============= range of levels ============= -->
+
+<!-- no levels in parent, always spans full height (of one) -->
+<xsl:template match="layer[not(@levels)]/block" mode="level-range" priority="7">0 0</xsl:template>
+
+<!-- explictly specifies the @level and @span -->
+<!-- a block with a @level means all on a single level or spans a number of levels down-->
+<xsl:template match="block[@level]" mode="level-range" priority="5">
+	<xsl:variable name="level"><xsl:call-template name="level-index"/></xsl:variable>
+	<xsl:choose>
+		<xsl:when test="@span &gt; 0">
+			<xsl:value-of select="$level - @span + 1"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="$level"/>
+		</xsl:otherwise>
+	</xsl:choose>
+	<xsl:value-of select="concat(' ',$level)"/>
+</xsl:template>
+
+<!-- no @level but @levels in parent, is full range of parent -->
+<xsl:template match="block" mode="level-range">
+	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select=".."/></xsl:variable>
+	<xsl:value-of select="concat('0 ',$n - 1)"/>
+</xsl:template>
+
+<!-- ====== Layers ============= -->
+
+<xsl:template match="layer[@span&gt;0]" mode="height">
+	<xsl:call-template name="sum-list">
+		<xsl:with-param name="list">
+			<xsl:variable name="span" select="@span"/>
+			<xsl:text>0 </xsl:text>
+	 		<xsl:for-each select="preceding-sibling::layer[position() &lt;= $span]">
+				<xsl:if test="not(@span) or @span=0">		
+					<xsl:apply-templates select="." mode="height"/>
+					<xsl:text> </xsl:text>
+					<xsl:if test="position()!=last()">
+						<xsl:value-of select="concat($lgrpDx * count(key('lgrp-top',@name)),' ')"/>
+					</xsl:if>								
+					<xsl:if test="position()!=1">
+						<xsl:value-of select="concat($groupDy + $lgrpDx * count(key('lgrp-bottom',@name)),' ')"/>
+					</xsl:if>
+				</xsl:if>
+			</xsl:for-each>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+
+<xsl:template match="layer" mode="height">
+	<xsl:variable name="pre"> <!-- space on top -->
+		<xsl:value-of select="concat($groupDy,' ')"/>
+	</xsl:variable>
+	
+	<xsl:variable name="post"> <!-- space on bottom -->
+		<xsl:value-of select="concat($groupDy,' ')"/>
+	</xsl:variable>
+
+	<xsl:variable name="h"><xsl:apply-templates mode="level-heights" select="."/></xsl:variable>
+	<xsl:call-template name="sum-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="$groupDy * (string-length($h)  - string-length(translate($h,' ','')) - 1)"/> <!-- spacing between levels -->
+			<xsl:value-of select="concat(' ',$pre,$post)"/>
+			<xsl:apply-templates mode="padding" select="."/>
+			<xsl:value-of select="concat(' ',$h)"/>
+		</xsl:with-param>
+	</xsl:call-template>	
+</xsl:template>
+
+
+<xsl:template match="layer" mode="min-width">
+	<xsl:call-template name="max-from-list">
+		<xsl:with-param name="list">	
+			<xsl:apply-templates select="*[1]" mode="post-levels">
+				<xsl:with-param name="levels">
+					<xsl:call-template name="zeros">
+						<xsl:with-param name="n">
+							<xsl:apply-templates mode="n-levels" select="."/>
+						</xsl:with-param>
+					</xsl:call-template>
+				</xsl:with-param>
+			</xsl:apply-templates>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+
+<xsl:template match="layer" mode="padding">0 0</xsl:template>
+<xsl:template match="layer[block and not(collection)]" mode="padding" priority="1">
+	<xsl:value-of select="concat($groupDy,' ',$groupDy + 4.23)"/>
+</xsl:template>
+
+
+
+<xsl:template match="layer"><xsl:param name="y" select="0"/>
+
+	<xsl:variable name="top-space" select="$lgrpDx * count(key('lgrp-top',@name))"/>
+	<xsl:variable name="bottom-space" select="$lgrpDx * count(key('lgrp-bottom',@name))"/>
+
+	<xsl:variable name="h"><xsl:apply-templates select="." mode="height"/></xsl:variable>
+	<xsl:variable name="w"><xsl:apply-templates select="." mode="min-width"/></xsl:variable><!-- the width of the content -->
+	<xsl:variable name="span-width"> <!-- space taken up by spanning layers-->
+		<xsl:call-template name="sum-list">
+			<xsl:with-param name="list">0 <xsl:for-each select="following-sibling::layer">
+				<xsl:if test="@span and position() - @span &lt;= 0"><xsl:apply-templates select="." mode="min-width"/><xsl:value-of select="concat(' ',$groupDx,' ')"/></xsl:if></xsl:for-each>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>	
+	<xsl:variable name="my-width" select="$full-width - $span-width"/> <!-- the width of this layer -->
+	<g class="{name()}" transform="translate(0 {$y + $top-space})"><xsl:apply-templates select="." mode="filter"/>
+		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>	
+		<xsl:apply-templates select="." mode="animate-color"/>	
+        <xsl:apply-templates select="." mode="multi-color"/>		
+		<xsl:call-template name="linkable-content">
+			<xsl:with-param name="show">
+				<rect x="0.3" y="0.3" width="9.3" rx="4.65" ry="4.65" class="{name()}" height="{$h}">
+					<xsl:call-template name="styles"><xsl:with-param name="for" select="'label'"/></xsl:call-template>
+				</rect>
+				<text  text-anchor="middle" dominant-baseline="mathematical" class="layer" transform="rotate(-90)" 
+					 y="4.95" width="{$h}" x="{ -($h div 2 ) -  0.3}">
+					<xsl:call-template name="display-name"/>
+				</text>
+			</xsl:with-param>
+		</xsl:call-template>
+		<xsl:variable name="x-off">
+			<xsl:choose>
+				<xsl:when test="$my-width &lt;= $w">0</xsl:when> <!-- should never be less than -->
+				<xsl:when test="@align='left'">0</xsl:when>
+				<xsl:when test="@align='right'"><xsl:value-of select="$my-width - $w"/></xsl:when>
+				<xsl:otherwise><xsl:value-of select="0.5 * ($my-width - $w)"/></xsl:otherwise> <!-- align='center' -->
+			</xsl:choose>
+		</xsl:variable>
+
+		<xsl:variable name="padding"><xsl:apply-templates select="." mode="padding"/></xsl:variable>
+		<g class="layer-detail" transform="translate({12.8 + $x-off} {$groupDy +  substring-before($padding,' ')})">
+			<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>
+			<rect x="{-$x-off}" class="{name()}" y="{- $groupDy - substring-before($padding,' ')}" width="{$my-width}" height="{$h}">
+				<xsl:call-template name="styles"/>
+			</rect>
+			<g><xsl:apply-templates select="." mode="detail-stuff"/>
+				<xsl:apply-templates select="*[1]">
+					<xsl:with-param name="levels">
+						<xsl:call-template name="zeros">
+							<xsl:with-param name="n">
+								<xsl:apply-templates mode="n-levels" select="."/>
+							</xsl:with-param>
+						</xsl:call-template>
+					</xsl:with-param>
+				</xsl:apply-templates>
+			</g>
+		</g>			
+	</g>
+	<xsl:apply-templates select="preceding-sibling::*[1]">
+		<xsl:with-param name="y" select="$y + $h + $groupDy + $top-space + $bottom-space"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="layer[@span &gt; 0]"><xsl:param name="y" select="0"/>
+	<xsl:variable name="top-space" select="$lgrpDx * count(key('lgrp-top',preceding-sibling::layer[not(@span)][1]/@name))"/>
+	<xsl:variable name="h"><xsl:apply-templates select="." mode="height"/></xsl:variable>
+	<xsl:variable name="w"><xsl:apply-templates select="." mode="min-width"/></xsl:variable><!-- the width of the content -->
+	<xsl:variable name="span-width"> <!-- space taken up by spanning layers-->
+		<xsl:call-template name="sum-list">
+			<xsl:with-param name="list">0 <xsl:for-each select="following-sibling::layer">
+				<xsl:if test="@span and position() - @span &lt;= 0"><xsl:apply-templates select="." mode="min-width"/><xsl:value-of select="concat(' ',$groupDx,' ')"/></xsl:if></xsl:for-each>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>		
+	<xsl:variable name="padding"><xsl:apply-templates select="." mode="padding"/></xsl:variable>
+	<xsl:variable name="x-off" select="$full-width - $w - $span-width"/>
+	<g class="{name()}" transform="translate(0 {$y + $top-space})"><xsl:apply-templates select="." mode="filter"/>
+		<g class="layer-detail">
+			<xsl:attribute name="transform">translate(<xsl:value-of select="concat(12.8 + $x-off,' ')"/>
+				<xsl:choose>
+					<xsl:when test="count(*)&gt;1 or not(block)"><xsl:value-of select="$groupDy + substring-before($padding,' ')"/></xsl:when>
+					<xsl:otherwise><xsl:value-of select="substring-before($padding,' ')"/></xsl:otherwise>
+				</xsl:choose>)</xsl:attribute>
+			<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>
+			<rect x="0" class="{name()}" y="{-$groupDy - substring-before($padding,' ') }" width="{$w}" height="{$h}">
+				<xsl:if test="count(*)=1 and block"><xsl:attribute name="y"><xsl:value-of select=" -number(substring-before($padding,' '))"/></xsl:attribute></xsl:if>
+				<xsl:call-template name="styles"/>
+			</rect>
+				<xsl:call-template name="linkable-content">
+					<xsl:with-param name="show">
+						<text  text-anchor="middle" dominant-baseline="ideographic" class="layer" width="{$w}" x="{$w div 2}">
+							<xsl:attribute name="y"><xsl:value-of select="$h - $groupDy - 2.3"/></xsl:attribute>
+							<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="*[1]">
+					<xsl:with-param name="levels">
+						<xsl:call-template name="zeros">
+							<xsl:with-param name="n">
+								<xsl:apply-templates mode="n-levels" select="."/>
+							</xsl:with-param>
+						</xsl:call-template>
+					</xsl:with-param>
+				</xsl:apply-templates>
+			</g>
+		</g>
+	</g>
+	<xsl:apply-templates select="preceding-sibling::*[1]">
+		<xsl:with-param name="y" select="$y"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<!-- return a list of the heights of all the levels. should only be called on a layer or block -->
+
+
+<xsl:template match="layer-group"><xsl:param name="y" select="0"/>
+	<xsl:apply-templates select="." mode="lgrp"/>
+	<xsl:apply-templates select="preceding-sibling::*[1]">
+		<xsl:with-param name="y" select="$y"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<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>
+
+
+<xsl:template match="layer-group" mode="lgrp"><xsl:param name="left" select="- $left-borders"/><xsl:param name="right" select="$view-width - $left-borders - 2 * $groupDy"/>
+	<!-- use indexes to make life easier -->
+	<xsl:variable name="from" select="1 +  count(key('layer',@from)/preceding-sibling::layer)"/>
+	<xsl:variable name="to" select="1 +  count(key('layer',@to)/preceding-sibling::layer)"/>
+	<xsl:choose>
+		<xsl:when test="not(key('layer',@from))">
+			<xsl:message>&#xa;Error:  layer "<xsl:value-of select="@from"/>" does not exist"</xsl:message>
+		</xsl:when>
+		<xsl:when test="not(key('layer',@to))">
+			<xsl:message>&#xa;Error:  layer "<xsl:value-of select="@to"/>" does not exist"</xsl:message>
+		</xsl:when>
+		<xsl:when test="$from &gt; $to">
+			<xsl:message>&#xa;Error: "<xsl:value-of select="@from"/>" is after "<xsl:value-of select="@to"/>"</xsl:message>
+		</xsl:when>
+		<xsl:when test="key('layer',@to)[@span]">
+			<xsl:message>&#xa;Error: Layer group cannot be bounded by spanned layer "<xsl:value-of select="@to"/>"</xsl:message>
+		</xsl:when>
+		<xsl:when test="key('layer',@from)[@span]">
+			<xsl:message>&#xa;Error: Layer group cannot be bounded by spanned layer "<xsl:value-of select="@from"/>"</xsl:message>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:variable name="to-name" select="@to"/>
+			<xsl:variable name="from-name" select="@from"/>
+			<xsl:variable name="parent-to" select="count(ancestor::layer-group[@to=$to-name])"/>
+			<xsl:variable name="child-to" select="1+ count(descendant::layer-group[@to=$to-name])"/>
+			<xsl:variable name="child-from" select="1+ count(descendant::layer-group[@from=$from-name])"/>
+			<xsl:variable name="start">
+				<xsl:call-template name="sum-list">
+					<xsl:with-param name="list">
+						<xsl:value-of select="concat($groupDy + $lgrpDx *  $parent-to,' ')"/>
+						<xsl:for-each select="key('layer',@to)/following-sibling::layer[not(@span)]">
+							<xsl:apply-templates select="." mode="height"/>
+							<xsl:value-of select="concat(' ',$groupDy + $lgrpDx* (count(key('lgrp-top',@name))+ count(key('lgrp-bottom',@name))),' ')"/>
+						</xsl:for-each>
+					</xsl:with-param>
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:variable name="height">
+				<xsl:call-template name="sum-list">
+					<xsl:with-param name="list">
+						<xsl:value-of select="concat($lgrpDx *  ($child-to+ $child-from),' ')"/>					
+						<xsl:for-each select="//systemModel/layer[position() &gt;= $from and position() &lt;= $to][not(@span)]">
+							<xsl:apply-templates select="." mode="height"/>
+							<xsl:text> </xsl:text>
+							<xsl:if test="position()!=last()">
+								<xsl:value-of select="concat($lgrpDx * count(key('lgrp-top',@name)),' ')"/>
+							</xsl:if>								
+							<xsl:if test="position()!=1">
+								<xsl:value-of select="concat($groupDy + $lgrpDx * count(key('lgrp-bottom',@name)),' ')"/>
+							</xsl:if>
+						</xsl:for-each>
+					</xsl:with-param>
+				</xsl:call-template>
+			</xsl:variable>
+			<g class="{name()}">
+				<rect width="{$right - $left}" height="{$height}" x="{$left}" y="{$start }" rx="4.65"  fill="{@color}"/>
+				<xsl:if test="@label">
+					<text text-anchor="middle" dominant-baseline="mathematical" 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>
+
+<!--level should always be '0', so ignore it and just give height of layer -->
+<xsl:template mode="level-height" match="layer[not(@levels)]" priority="5">
+	<xsl:call-template name="max-from-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="concat($mSize,' ')"/> <!-- min size is one collection height -->
+		<xsl:for-each select="*[@levels]">
+			<xsl:apply-templates select="." mode="height"/>
+			<xsl:text> </xsl:text>
+		</xsl:for-each>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+<!-- layer has levels -->
+<xsl:template mode="level-height" match="layer"><xsl:param name="level"/>
+<!--	 find all blocks which this contains and use a factor of their heights,
+	min is height of collection -->
+	<xsl:call-template name="max-from-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="concat($mSize, ' ')"/>
+			<xsl:for-each select="block[@levels]"> <!-- only check self-heighted stuff -->
+				<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
+				<xsl:variable name="r0" select="number(substring-before($range,' '))"/>
+				<xsl:variable name="r1" select="number(substring-after($range,' '))"/>		
+				<xsl:if test="($r0 &lt;=$level)  and ($r1 &gt;=$level)">
+					<xsl:variable name="h"><xsl:apply-templates select="." mode="min-height"/></xsl:variable>
+					<xsl:value-of select="concat($h div ($r1 - $r0 +1), ' ')"/>
+				</xsl:if>
+			</xsl:for-each>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+
+
+
+<xsl:template mode="n-levels" match="layer"> <!-- number of levels available to children of this layer -->
+	<xsl:variable name="levels" select="normalize-space(@levels)"/>
+	<xsl:variable name="n" select="string-length($levels)  - string-length(translate($levels,' ','')) +1"/> <!-- number of spaces +1 -->
+	<xsl:choose>
+			<!-- if there are no levels, there is one implicit level -->
+		<xsl:when test="$levels='' ">1</xsl:when>
+			<!-- if there are any collections with no level, we add an extra on top -->
+		<xsl:when test="collection[not(@level)] or block[not(@levels) and not(@level)]/descendant::collection[not(@level)]"><xsl:value-of select="$n + 1"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$n"/></xsl:otherwise>
+	</xsl:choose>		
+</xsl:template>
+
+<!-- should never be called -->
+<xsl:template match="layer" mode="level-range">0 0</xsl:template>
+
+
+<!-- ====== Levels ============= -->
+
+<!--
+options: 
+	layer[@levels]/block[@levels]/collection[@level]
+		use collection/@level in context of block/@levels
+	layer[@levels]/block[@levels]/collection[not(@level)]
+		use '' (unnamed top level, increase n-levels in block) in context of block/@levels
+	layer[@levels]/block[not(@levels) and not(@level)]/collection[@level]
+		use collection/@level in context of layer/@levels
+	layer[@levels]/block[not(@levels) and not(@level)]/collection[not(@level)]
+		use '' (unnamed top level, increase n-levels in layer) in context of layer/@levels
+	layer[@levels]/block[not(@levels) and @level]/collection[@level]
+		use collection/@level in context of layer/@levels (warning if @level is not in range of parent)
+	layer[@levels]/block[not(@levels) and @level]/collection[not(@level)]
+		use block/@level in context of layer/@levels (raise warning)
+	layer[not(@levels)]/block[not(@levels) and not(@level)]/collection[@level]
+		use '' (raise warning)
+	layer[not(@levels)]/block[not(@levels) and not(@level)]/collection[not(@level)]
+		use ''
+	layer[not(@levels)]/block[not(@levels) and @level]/collection[@level]
+		use '' (raise warning)
+	layer[not(@levels)]/block[not(@levels) and @level]/collection[not(@level)]
+		use '' (raise warning)
+-->
+
+<!-- any collection means on a single level -->
+<xsl:template match="collection" mode="level-range">
+	<xsl:variable name="level"><xsl:apply-templates select="." mode="level-index"/></xsl:variable>
+	<xsl:value-of select="concat($level,' ',$level)"/>
+</xsl:template>
+
+<xsl:template name="level-index">
+	<!-- this must have a @level and an ancestor with @levels -->
+	<xsl:variable name="levels"><xsl:value-of select="concat(' ',normalize-space(ancestor::*[@levels][1]/@levels),' ')"/></xsl:variable>
+	<xsl:variable name="level" select="concat(' ',@level,' ')"/>
+	<xsl:choose>
+		<xsl:when test="contains($levels,$level)">
+			<xsl:variable name="pre" select="substring-before($levels,$level)"/>
+			<xsl:value-of select="string-length($pre) - string-length(translate($pre,' ',''))"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:message>&#xa;error: invalid level name: <xsl:value-of select="@level"/> in <xsl:value-of select="name()"/> "<xsl:value-of select="@name"/>" [<xsl:value-of select="$levels"/>]</xsl:message>
+			<xsl:value-of select="string-length($levels) - string-length(translate($levels,' ','')) - 1"/>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- by default use height of all levels -->
+<xsl:template mode="level-heights" match="layer|block[@levels]">
+	<xsl:param name="range">
+		<xsl:variable name="level"><xsl:apply-templates select="." mode="n-levels"/></xsl:variable>
+		<xsl:value-of select="concat('0 ',$level - 1)"/>
+	</xsl:param>
+	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>
+	<xsl:variable name="r1" select="number(substring-after($range,' '))"/>
+	<xsl:apply-templates select="." mode="level-height">
+		<xsl:with-param name="level" select="$r0"/>
+	</xsl:apply-templates>	
+	<xsl:text> </xsl:text>
+	<xsl:if test="$r1 &gt; $r0">
+		<xsl:apply-templates select="." mode="level-heights">
+			<xsl:with-param name="range" select="concat($r0 + 1,' ' ,$r1)"/>
+		</xsl:apply-templates>			
+	</xsl:if>
+</xsl:template>
+
+<!-- the y-position for level $index -->
+<xsl:template match="layer|block[@levels]" mode="level-top"><xsl:param name="index"/>
+	<xsl:variable name="n"><xsl:apply-templates select="." mode="n-levels"/></xsl:variable>
+	<xsl:choose>
+		<xsl:when test="number($index) = number($n) - 1">0</xsl:when> <!-- it's the top level, so y = 0 -->
+		<xsl:otherwise>
+			<xsl:variable name="h">
+				<xsl:apply-templates mode="level-heights" select=".">
+					<xsl:with-param name="range" select="concat($index +  1,' ' ,$n - 1)"/>
+				</xsl:apply-templates>
+			</xsl:variable>
+			<xsl:call-template name="sum-list">
+				<xsl:with-param name="list">
+					<xsl:value-of select="$groupDy * (string-length($h)  - string-length(translate($h,' ','')))"/>
+					<xsl:value-of select="concat(' ',$h)"/>
+				</xsl:with-param>
+			</xsl:call-template>				
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+<xsl:template match="block[not(@levels)]" mode="level-top"><xsl:message>
+Error! This template should not have been called</xsl:message>
+</xsl:template>
+
+<!-- the y-coord of the top of the level. If not specified uses level of current node -->
+<xsl:template name="level-top"><xsl:param name="index"/>
+	<xsl:choose>
+		<xsl:when test="ancestor::block[@levels]">
+			<xsl:apply-templates select="ancestor::block" mode="level-top">
+				<xsl:with-param name="index" select="$index"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates select="ancestor::layer" mode="level-top">
+				<xsl:with-param name="index" select="$index"/>
+			</xsl:apply-templates>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="x-pos"><xsl:param name="levels"/><xsl:param name="range"/>
+	<!-- flush the box at the level ranges in $range against the level array -->
+	 <!--pick  largest value in range  -->
+	<xsl:variable name="right">
+		<xsl:call-template name="max-from-list">
+			<xsl:with-param name="list">
+				<xsl:call-template name="list-range">
+					<xsl:with-param name="list" select="$levels"/>
+					<xsl:with-param name="from" select="substring-before($range,' ')"/>
+					<xsl:with-param name="to" select="substring-after($range,' ')"/>
+				</xsl:call-template>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="$right=0">0</xsl:when>
+		<xsl:otherwise><xsl:value-of select=" $groupDx + $right"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>	
+
+
+<!-- ============= list handlers ============= -->
+
+<xsl:template name="sum-levels"><xsl:param name="levels"/> 
+	<xsl:param name="range"/><xsl:param name="width"/> 
+
+
+	<!-- add a box with levels indexes in range to level array -->
+	<xsl:variable name="left">
+		<xsl:call-template name="x-pos">
+			<xsl:with-param name="levels" select="$levels"/>
+			<xsl:with-param name="range" select="$range"/>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:call-template name="list-replace">
+		<xsl:with-param name="list" select="$levels"/>
+		<xsl:with-param name="from" select="substring-before($range,' ')"/>
+		<xsl:with-param name="to" select="substring-after($range,' ')"/>
+		<xsl:with-param name="value" select="$left + $width"/>
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template name="list-replace"><xsl:param name="list"/><xsl:param name="from"/><xsl:param name="to"/><xsl:param name="value"/>
+	<xsl:choose>
+		<xsl:when test="$from &lt; 1 and $to &gt;= 0"><xsl:value-of select="$value"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="substring-before($list,' ')"/></xsl:otherwise>
+	</xsl:choose>
+	<xsl:text> </xsl:text>
+	<xsl:if test="contains(substring-after($list,' '),' ')">
+		<xsl:call-template name="list-replace">
+			<xsl:with-param name="list" select="substring-after($list,' ')"/>
+			<xsl:with-param name="from" select="$from - 1"/>
+			<xsl:with-param name="to" select="$to - 1"/>
+			<xsl:with-param name="value" select="$value"/>
+		</xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+<!--  last item in space-separated list -->
+<xsl:template name="last-in-list"><xsl:param name="str"/>
+	<xsl:choose>
+		<xsl:when test="contains($str,' ')">
+			<xsl:call-template name="last-in-list">
+				<xsl:with-param name="str" select="substring-after($str,' ')"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$str"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!-- a list of n zeros -->
+<xsl:template name="zeros"><xsl:param name="n"/>
+	<xsl:text>0 </xsl:text>
+	<xsl:if test="$n &gt; 1">
+		<xsl:call-template name="zeros">
+			<xsl:with-param name="n" select="$n - 1"/>
+		</xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+
+<!-- ====== legend ============= -->
+
+<xsl:include href="legend.xsl"/>
+<!-- end legend -->
+
+
+<xsl:template match="logo" mode="width">
+	<xsl:variable name="b" select="normalize-space(@viewBox)"/>
+	<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:template>
+<xsl:template match="logo" mode="height">
+	<xsl:variable name="b" select="normalize-space(@viewBox)"/>
+	<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:template>
+
+
+<xsl:template match="logo"><xsl:param name="y" select="0"/>
+	<g class="logo" transform="translate({- $left-borders} {$y})">
+	<xsl:attribute name="transform">translate(<xsl:value-of select="concat(- $left-borders,' ',$y)"/>) <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:apply-templates select="preceding-sibling::*[1]">
+		<xsl:with-param name="y" select="$y"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/DrawSvg.pl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,43 @@
+#!perl
+# Copyright (c) 2007-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:
+#
+
+use strict;
+use warnings;
+use FindBin;
+use lib $FindBin::Bin;
+use lib $FindBin::Bin."/svg";
+
+use lib $FindBin::Bin."/../..";
+use SysModelGen;
+
+use DrawSvg;
+my %versions = &DrawSvg::SchemaVersionsFromArgs(@ARGV);
+my $drawer = new DrawSvg();
+
+
+foreach my $v (grep /^3\./,keys(%versions))
+	{ # need to downgrade anything in 3.x syntax
+	my $i=0;
+	foreach my $sys (@{$versions{$v}})
+		{
+		$i++;
+		$drawer->Downgrade($sys,"sysdef$i.xml");
+		}
+	}
+
+$drawer->Draw();
+
+exit;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/DrawSvg.pm	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,1368 @@
+# Copyright (c) 2007-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:      DrawSvg
+# Build the SVG diagram
+# 
+#
+
+package DrawSvg;
+
+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 constant KNoCoreOs					=> 0;
+use constant KCoreOsWithHal			=> 1;
+use constant KCoreOsWithHardware	=> 2;
+use constant KOldSystemModelGenerator							=> 202;
+
+my @Filters;
+
+#-------------------------------------------------------------------------------------------------
+# 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
+    
+    $self->{iScriptCode} = 999;
+    
+    # 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;
+	}
+
+
+# gets the schema versions without comsuming any of the command line arguments
+sub SchemaVersionsFromArgs
+	{ 
+	my @sysdefs;
+	my @ini;
+	my $model;
+	for(my $i=0;$i<=$#_;$i++)
+		{
+		if($_[$i] eq '-model')
+			{
+			$model=$_[++$i];
+			}
+		if($_[$i] eq '-sysdef')
+			{
+			$i++;
+			push(@sysdefs,split(/,/,$_[$i]));
+			}
+		elsif($_[$i] eq '-i')
+			{
+			push(@ini,$_[++$i]);
+			}
+		}
+	if(!scalar(@sysdefs) )
+		{
+		foreach my $in (@ini)
+			{
+			open(INI,$in);
+			my $iniDir = $in;
+			$iniDir =~ s,[^\\//]+$,,;
+			while(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/sysdef\s*=\s*(.*)/i)
+					{
+					foreach my $file (split(/,/,$1))
+						{
+						push(@sysdefs,&FullPath($iniDir,$file));
+						}
+					}
+				}
+			close INI;
+			}
+		}
+	my $dir = $model;
+	$dir=~s,[^/\\]+$,,;
+	open M,$model;
+	$/=">";
+	while(my $line=<M>)
+		{
+		if($line=~s/<sysdef.*href=("[^"]+"|'[^']+')//)
+			{
+			my $f=$1;
+			$f=~s/^.(.*).$/$1/;
+			if(! ($f=~/^(\/|[a-z]+:)/)) {$f="$dir$f"}
+			push(@sysdefs,$f);
+			}
+		}
+	close M;
+	my %res;
+	foreach my $file (@sysdefs)
+		{
+		open S,$file;
+		while(my $line = <S>)
+			{
+			if($line =~ /<SystemDefinition.*\sschema="(.*?)"/s)
+				{
+				push(@{$res{$1}},$file);
+				last;
+				}
+			}
+		close S;
+		}
+	$/="\n";
+	return %res;
+	}
+
+sub GuessReleaseNumber()
+	{
+	my $self = shift;	
+	# always use release value if defined
+	$self->{iRelease} && return $self->{iRelease} ;
+	# if not there, it's in the s12,
+	my $ver;
+	my $t = $/;
+	foreach my $s12 (@{$self->{'iS12'}})		# use version from first s12 file listed
+		{
+		if(-d $s12) {next}
+		open(FILE,$s12) || return;
+		$/='>';
+		while(<FILE>)
+			{
+			if(/<Schedule12\s.*\bOS_version=('(.*?)'|"(.*?)")/s)
+				{
+				$ver = $2 || $3;
+				last;
+				}
+			}
+		close FILE;
+		$/=$t;
+		return  $ver;
+		}
+	# not there either, 
+	if($self->{'iDepsFile'}) 
+		{
+		open(FILE,$self->{'iDepsFile'}) || return;
+		$/='>';
+		while(<FILE>)
+			{
+			if(/<SystemModelDeps\s.*\bversion=('(.*?)'|"(.*?)")/s)
+				{
+				$ver = $2 || $3;
+				last;
+				}
+			}
+		close FILE;
+		$/=$t;
+		return  $ver;
+		}
+	return "";
+	}
+
+
+# an empty value indicates its a single file. Any other value means it's a list separated by that value as a regexp
+%KFileParams = 
+	( 
+	'iSysDefFile'	=> ',',
+	'iS12'		=> ',',
+	'iExtra'		=> ',',
+	'iDepsFile'	=> '',
+	'iLocalize'		=> ',',
+	'iLevels'		=> ',',
+	'iStyle'		=> ',',
+	'iOverlay'		=> ',',
+	'iBorder'		=> ',',
+	'iColor'		=> ',',
+	'iShapes'		=> '',
+	'iLogoSrc'		=> '',
+	'iModel'		=> '',
+	'iLogFile'		=> '',
+	);
+
+sub ParseCommandLineOptions()
+	{
+	my $self = shift;
+	
+	# Possible arguments (with default values where possible):
+	my $help;
+	$self->{iSysDefFile};
+	$self->{iDepsFile};
+	$self->{iOutputCsv};
+	$self->{iCsvColumns};
+	$self->{iCsvLabels};
+	$self->{iTemporaryDirectory};
+	$self->{iLogFile};
+	$self->{iWarningLevel};
+	$self->{iClean}; # if specified, it will delete the temp directory.
+
+	# custom properties:
+	$self->{iDiagram}; # the output svg
+	$self->{iCopyright};
+	$self->{iRelease};
+	$self->{iName};
+	$self->{iLabel};
+	$self->{iModel};
+	$self->{iCoreOs};
+	$self->{iLevels};
+	$self->{iExtra};
+	$self->{iIniFile};
+	$self->{iS12};
+	$self->{iLink};
+	# Read in the user arguments:
+	GetOptions( "h"						=> \$help,
+				"i=s"					=> \$self->{iIniFile},
+				"output=s"				=> \$self->{iDiagram} ,
+				"csv_output=s"				=> \$self->{iOutputCsv} ,
+				"csv_columns=s"				=> \$self->{iCsvColumns} ,
+				"csv_labels=s"				=> \$self->{iCsvLabels} ,
+				'xml_output=s'				=> \$self->{iOutputXml} ,
+				"model=s"				=> \$self->{iModel} ,
+				"sysdef=s"				=> \@{$self->{iSysDefFile}} ,
+				"srcvar=s"				=> \@{$self->{iSourceRoot}} ,
+				"shapes=s"				=> \$self->{iShapes},
+				"link=s"				=> \$self->{iLink},
+				"system_name=s"			=> \$self->{iName} ,
+				"system_version=s"		=> \$self->{iRelease} ,
+				"model_name=s"			=> \$self->{iLabel} ,
+				"model_version=s"		=> \$self->{iRevision},
+				"model_version_type=s"	=> \$self->{iRevisionType},
+				"copyright=s"			=> \$self->{iCopyright},
+				"distribution=s"		=> \$self->{iDistribution},
+				"legend_title=s"		=> \$self->{iLgdTitle},
+				"coreos=s"				=> \$self->{iCoreOs},
+				
+				"sysinfo=s"				=> \@{$self->{iExtra}},
+				"localize=s"			=> \@{$self->{iLocalize}},
+				"levels=s"				=> \@{$self->{iLevels}},
+				
+				"color=s"				=> \@{$self->{iColor}},
+				"border-shape=s"		=> \@{$self->{iBorder}},
+				"pattern=s"				=> \@{$self->{iOverlay}},
+				"border-style=s"		=> \@{$self->{iStyle}},
+				
+				"filter=s"				=> \@{$self->{iFilter}},
+				"filter-has=s"				=> \&OrderedOption,
+				"show-attr=s"			=> \&OrderedOption,
+				"hide-attr=s"			=> \&OrderedOption,
+				"ignore=s"				=> \@{$self->{iIgnore}},
+				
+				"s12=s"				=>  \@{$self->{iS12}},
+				
+				"detail=s"				=> \$self->{iDetail},
+				"detail-type=s"				=> \$self->{iDetailType},
+				"page-width=s"			=> \$self->{iPageWidth},
+				"static"				=> \$self->{iStatic},
+				"deps=s"				=> \$self->{iDepsFile},
+				"w=s"					=> \$self->{iWarningLevel},
+				"clean"				=> \$self->{iClean},				
+				"compress"				=> \$self->{iCompress},
+				"tempdir=s"				=> \$self->{iTemporaryDirectory},
+				"dpi=s"				=> \$self->{iPrintResolution},
+				"model_font=s"				=> \$self->{iModelFont},
+				"version-list=s"			=>  \$self->{iVersions},
+				"log=s"				=> \$self->{iLogFile},
+				"logo=s"				=> \$self->{iLogoSrc},
+				"logo-height=s"				=> \$self->{iLogoHeight},
+				"logo-width=s"				=> \$self->{iLogoWidth},
+				"legend-width=s"			=> \$self->{iLegendWidth},
+				"legend-max-scale=s"			=> \$self->{iLegendMaxScale},
+				"title-scale=s"			=> \$self->{iTitleScale},
+				"xslt-param=s"			=> \%{$self->{iXsltParam}},
+				"note=s"			=> \@{$self->{iLegendNote}}
+				);
+
+	if ($help)
+	    {
+	   	warn $self->Help();
+	   	exit Logger::KErrorNone;
+	   	}
+
+	@{$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->Help();
+				&Logger::LogFatal("Invalid syntax", KOldSystemModelGenerator, 0,Logger::KIncorrectSyntax);
+				}
+			if(!(-e $ARGV[$i])) {
+				warn "file $ARGV[$i] does not exist";
+	   			exit Logger::KFileDoesNotExist;
+			}
+		}
+	
+	# Now read the ini file and override command line if necessary:
+	my @yr = gmtime();
+	my $dataroot =&SystemModelXmlDataDir();
+	my %defaults = (
+		'iCopyright' 			=> (1900+$yr[5])." Nokia Corporation",
+		'iDiagram' 			=> "sysmodel.svg",
+		'iTemporaryDirectory' 	=> "drawsvg_temp",
+		'iName' 				=> "Symbian OS"	,
+		'iLabel' 				=> "System Model",
+		'iLgdTitle' 				=> "Key",
+		'iShapes' 				=> "$dataroot/Shapes.xml" 	,
+		'iLogFile' 				=> ""  # do not set this to any default: stdout is used if log file isn't set
+	);
+	my %defaultsForMulti = (
+		'iLocalize' 			=> "$dataroot/display-names.xml" ,
+		'iExtra' 				=> "$dataroot/SystemInfo.xml"   
+	);
+
+	$self->ReadIniFile();
+
+	foreach my $type ('iSysDefFile', 'iFilter','iSourceRoot')
+		{
+		if(scalar(@{$self->{$type}})==1 && $self->{$type}->[0]=~/,/)
+			{ # treat as comma-separated for backwards compatibility (leave alone if no commas)
+			@{$self->{$type}} = split(/,/,$self->{$type}->[0]);
+			}
+		}
+	if (scalar(@{$self->{iIgnore}})) 
+		{
+		foreach my $type ('iIgnore')
+			{
+			if(scalar(@{$self->{$type}})==1)
+				{ # treat as semicolon-separated for backwards compatibility
+				@{$self->{$type}} = split(/;/,$self->{$type}->[0]);
+				}
+			}
+		}
+	else
+		{
+		push(@{$self->{iIgnore}}, "layer:Tools and Utils and SDKENG","layer:MISC","block:Techview") 
+		}
+
+	
+	my $ver = $self->GuessReleaseNumber(); # determine release from attached files.
+		
+	# Use a special levels.xml file for 9.1 (unless it's specified by the user):
+	push(@{$self->{iLevels}}, "$dataroot/Levels91.xml") if !scalar(@{$self->{iLevels}}) and $ver eq "9.1";
+	push(@{$self->{iLevels}}, "$dataroot/Levels.xml") if !scalar(@{$self->{iLevels}}) and ($ver eq "9.2" or $ver eq "9.2" );
+
+	if(!scalar(@{$self->{'iFiltering'}}) && !scalar(@{$self->{'iFilter'}}))
+		{ # filter only has a default if fitler-has is not set
+		@{$self->{'iFilter'}}= ("java","gt");
+		}
+	while (($key, $value) = each %defaults) {
+		$self->{$key} = $value if ! defined $self->{$key};
+	}
+
+	while (($key, $value) = each %defaultsForMulti) {
+		push(@{$self->{$key}}, $value) if ! scalar(@{$self->{$key}});
+	}
+
+
+
+	# if saving to .svgz, try to compress
+	$self->{iCompress} = $self->{iCompress} || ( $self->{iDiagram} =~ /\.svgz$/i );
+
+	# if there's a deps file XSLT will get revision number and type from that.
+	# if there is no deps file and neither revision nor revision type are specified, default to "DRAFT 1"
+	if(!$self->{'iDepsFile'} &&  !$self->{'iRevision'} && !$self->{'iRevisionType'})
+		{
+		$self->{'iRevisionType'} = "draft";
+		$self->{'iRevision'} = "1";
+		}
+	
+	if ($self->{iShapes} eq "$dataroot/Shapes.xml"  && !scalar(@{$self->{'iColor'}}))
+		{ # if it's got the default shapes use default colours
+		@{$self->{iColor}} = (&SystemModelColorsXmlFile());
+		}
+
+	if(defined $self->{iCoreOs})
+		{
+		if($self->{iCoreOs}=~/(on|yes|true)$/i )
+			{
+			$self->{iCoreOs} = KCoreOsWithHal;
+			}
+		elsif($self->{iCoreOs}=~/(off|no|false)$/i )
+			{
+			$self->{iCoreOs} = KNoCoreOs;
+			}
+		elsif(! ($self->{iCoreOs}=~/^[0-9]+$/ ))	# any other non-number
+			{
+			$self->{iCoreOs} = KCoreOsWithHardware;
+			}
+		}
+	else		# use version numebr to decide
+		{
+		$self->{iCoreOs} = ($self->{iRelease} eq 'Future' || $ver > 9.4) ? KCoreOsWithHardware :
+			(($ver=~/^9\.4/) ? KCoreOsWithHal : KNoCoreOs);
+	}
+
+	$self->{'iGuessVer'} = $ver;
+
+	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};
+	
+	# set all URIs
+
+	(my $dir  = cwd ) =~ s#\/#\\#g;
+	
+	
+	foreach ( keys(%KFileParams)) {
+		if($self->{$_} eq '') {next} # no value, so do nothing
+		if($KFileParams{$_} eq '') {
+			$self->{$_}  = &FullPath("$dir\\",	$self->{$_} );
+		} elsif($KFileParams{$_} eq ',') {
+			foreach my $item  (@{$self->{$_}})	{
+				if ($item eq '') {next}	# skip if explicitly set to empty
+				$item = &FileAsUrl(&FullPath("$dir\\",$item));
+			}
+			next;
+		} 
+		$self->{$_} = &FileAsUrl($self->{$_});
+	}	
+
+}
+
+
+sub OrderedOption() {
+	my $var = shift;
+	my $val = shift;
+	if($var=~/^(show|hide)-attr$/) {
+		my $f = "<filter 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 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 select="*" display="hide"/>');
+		}
+		foreach my $v (split(/,/,$val)) {
+			push(@Filters,"<filter display='show' select='filter' value='$v'/>");
+		}
+	}
+}
+
+
+
+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 ($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);
+		}
+	}
+	
+	# Return the concatenated root and filename
+	return File::Spec->catdir($root, $file);
+}
+
+
+sub ReadIniFile()
+	{
+	my $self = shift;
+	
+	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}\": $!", KOldSystemModelGenerator) if ! -e $self->{iIniFile};
+	
+	open(INI, $self->{iIniFile}) or 	
+		&Logger::LogFatal("Could not open the ini file \"$self->{iIniFile}\": $!", KOldSystemModelGenerator);
+	
+	&Logger::LogInfo("Reading ini file \"$self->{iIniFile}...", KOldSystemModelGenerator);
+	
+	%AllowMulitples = (
+		"iLocalize"		=> 1,
+		"iExtra"		=> 1,
+		'iLevels'		=> 1,
+		'iSysDefFile'		=> 1,
+		'iSourceRoot'		=> 1,
+		'iS12'		=> 1,
+		"iIgnore"		=> 1,
+		"iFilter"		=> 1,
+		"iStyle"		=> 1,
+		"iOverlay"		=> 1,
+		"iBorder"		=> 1,
+		"iColor"		=> 1,
+		"iLegendNote" => 1,
+		"iXsltParam" => 2
+	); # value of 2 means it's a hash, value of 1 is an array
+	
+	foreach my $m (keys %AllowMulitples) {
+		# if it's already set, note that we're to ignore anything in the ini file
+		if($AllowMulitples{$m}==2 ? (scalar(%{$self->{$m}})>0) : (scalar(@{$self->{$m}})>0)) {$AllowMulitples{$m}=0}
+	}
+	
+	%Ordered = (
+		"filter-has"				=> 1,	
+		"show-attr"			=> 1,
+		"hide-attr"			=> 1
+	);
+
+	%IniMap = (
+		"model"					=> 'iModel' ,
+		"sysdef"				=> 'iSysDefFile' ,
+		'srcvar'					=> 'iSourceRoot',
+		"shapes"				=> 'iShapes',
+		"system_name"			=> 'iName' ,
+		"model_name"			=> 'iLabel' ,
+		"system_version"		=> 'iRelease' ,
+		"copyright"				=> 'iCopyright',
+		"model_version"			=> 'iRevision',
+		"model_version_type"	=> 'iRevisionType',
+		"distribution"			=> 'iDistribution',
+		"legend_title"			=> 'iLgdTitle',
+		"coreos"				=> 'iCoreOs',
+		"sysinfo"				=> 'iExtra',
+		"localize"				=> 'iLocalize',
+		"levels"				=> 'iLevels',
+		"filter"				=> 'iFilter',
+		"ignore"				=> 'iIgnore',
+		"output"				=> 'iDiagram',
+		"csv_output"				=> 'iOutputCsv',
+		"csv_columns"				=> 'iCsvColumns' ,
+		"csv_labels"				=> 'iCsvLabels' ,
+		'xml_output'				=> 'iOutputXml' ,
+		"detail"				=> 'iDetail',
+		"detail-type"				=> 'iDetailType',
+		"page-width"			=> 'iPageWidth',
+		"static"				=> 'iStatic',
+		"color"					=> 'iColor',
+		"border-shape"			=> 'iBorder',
+		"pattern"				=> 'iOverlay',
+		"deps"					=> 'iDepsFile',
+		"border-style"			=> 'iStyle',
+		"w"						=> 'iWarningLevel',
+		"tempdir"				=> 'iTemporaryDirectory',
+		'dpi'					=>'iPrintResolution',
+		'model_font'					=>'iModelFont',
+		"s12"				=> 'iS12',
+		"log"					=> 'iLogFile',
+		"logo"				=> 'iLogoSrc',
+		"logo-height"			=> 'iLogoHeight',
+		"logo-width"			=> 'iLogoWidth',
+		'version-list'			 => 'iVersions',
+		"link"					=> 'iLink',
+		"clean"				=> 'iClean',
+		"compress"			=> 'iCompress',
+		"legend-width"			=>'iLegendWidth',
+		"legend-max-scale"		=> 'iLegendMaxScale',
+		"title-scale"			=> 'iTitleScale',
+		"xslt-param"			=> 'iXsltParam',
+		"note"			=> 'iLegendNote'
+	);
+	
+	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/"$//;
+
+			my $iniDir = $self->{iIniFile};
+			$iniDir =~ s,[^\\//]+$,,;
+			#$iniDir .= '\\';
+
+			if(defined $Ordered{$argType}) {
+				&OrderedOption($argType, $argValue);
+			} elsif(defined $IniMap{$argType}) {
+				my $param = $IniMap{$argType};
+				# make sure all files mentioned are taken relative to the ini file
+				if($KFileParams{$param} ne '' )
+					{# comma-separated filenames
+					my @list;
+					foreach my $item  (split(/,/,$argValue))
+						{
+						push(@list,&FullPath($iniDir,$item));
+						}
+					$argValue = join(',',@list);
+					}
+				elsif(defined $KFileParams{$param} && $argValue ne '')
+					{# single file names			
+					$argValue = &FullPath($iniDir,$argValue);
+					}
+				# do not override! Only set values that have not been set on command line already
+				if ($AllowMulitples{$param}==1)  # check so we don't add if it's set by the cmd line
+					{
+				 	push(@{$self->{$param}}, $argValue); 
+					} 
+				elsif ($AllowMulitples{$param}==2)  # check so we don't add if it's set by the cmd line
+					{
+					$argValue=~s/^([^=]+)=//;
+				 	$self->{$param}->{$1}=$argValue; 
+					} 
+				elsif (! defined $AllowMulitples{$param})
+					{
+				 	$self->{$param} = $argValue if ! $self->{$param}; 
+					}
+				}
+			}
+		}
+; 
+	@{$self->{'iFiltering'}} = @Filters if ! @{$self->{'iFiltering'}}; 
+	@Filters=();
+	}
+
+sub MakeInfo() {
+	my $self = shift;
+	my %files = @_;
+	my $res="";
+	while (my ($key,$value) = each %files) {
+		 if ($self->{$key} ne '') {
+		 	$res .= "\t\t<info href='".$self->{$key}."' type='$value'/>\n"
+		 }
+	}
+	return $res;
+}
+
+sub MakeMultiInfo() {
+	my $self = shift;
+	my %files = @_;
+	my $res="";
+	while (my ($key,$value) = each %files) {
+		 foreach my $m (@{$self->{$key}}) {
+		 	if($m ne '') { # skip if empty
+		 		$res .= "\t\t<info href='$m' type='$value'/>\n"
+		 	}
+		 }
+	}
+	return $res;
+}
+
+sub MakeAttirbutes() {
+	my $self = shift;
+	my %atts = @_;
+	my $res="";
+	while (my ($key,$value) = each %atts) {
+		 if (defined $self->{$key}) {
+		 	my $cur = $self->{$key};
+		 	if($key=~/File$/) {$cur=&FileAsUrl($cur)}	# anything that ends in File is treated as a URL
+		 	$res .= " $value=\"$cur\"";
+		 }
+	}
+	return $res;
+}
+
+sub getSchedule12Xml ()
+	{
+	my $self = shift;
+	my $ver = shift;
+	my @files = @{$self->{'iS12'}};
+	my @ret;
+	foreach my $s12 (@files)
+		{
+		if($s12 eq '') {next}
+		if($s12=~/^file:\/\/\/(.*)$/)
+			{
+			if(-d $1) 
+				{
+				# it's a directory, so append Symbian_OS_v[version]_Schedule12.xml
+				$s12=~s,[\\/]*$,/Symbian_OS_v${ver}_Schedule12.xml,;
+				}
+			}
+		push(@ret,$s12);
+		}
+	return @ret
+	}	
+
+sub getModel()
+	{
+	my $self = shift;
+	if($self->{iModel})  {return $self->{iModel}}
+	
+	my $xsltDir = $self->GetXsltDir();
+
+	my $tempDirectoryPathname = abs_path($self->{iTemporaryDirectory});
+	
+	(my $modelXml = "$tempDirectoryPathname/Model.xml") =~ s#\/#\\#g;
+	(my $modelTemplateXml = $xsltDir."/") =~ s#\/#\\#g;
+	
+	if($self->{iCoreOs} == KCoreOsWithHardware)	{ #  show 9.5+ CoreOS 
+		$modelTemplateXml .= "ModelTemplate.xml";
+	} elsif($self->{iCoreOs} == KCoreOsWithHal )  	{ 		# show 9.4 CoreOS
+		$modelTemplateXml .= "ModelTemplate.mid.xml";
+	} else {
+		$modelTemplateXml .= "ModelTemplate.older.xml";
+	}
+
+
+	# the follownig params cannot be emtpy, delete if they are
+	foreach my $item ('iCopyright' ,	'iDistribution' ,'iDepsFile',	'iLink', 'iDetailType',  'iDetail', 'iVersions')
+		{
+		if($self->{$item} eq '') {delete $self->{$item}}
+		}
+
+
+	# Step 1:
+	# Create a Model.xml based on the ModelTemplate.xml
+	open (INPUT, $modelTemplateXml) or &Logger::LogError("Xalan error ($?) occured in Step 1 of SVG building (<$modelTemplateXml)...", KOldSystemModelGenerator, 1);
+	open (OUTPUT, ">$modelXml") or &Logger::LogError("Xalan error ($?) occured in Step 1 of SVG building (>$modelXml)...", KOldSystemModelGenerator, 1);
+	my $release = $self->{iRelease};
+	
+	
+	# Since $self->{iSysDefFile} may be a comma-separated list of sysdefs, create a <sysdef> tag for each one of the files:
+	my $sysdefTagsForModelTemplate = "";	
+
+	@{$self->{'iS12'}} = $self->getSchedule12Xml($self->{'iGuessVer'});
+
+	if(scalar(@{$self->{iSourceRoot}}) == 1)
+		{
+		@{$self->{iSourceRoot}} = ($self->{iSourceRoot}->[0]) x scalar($self->{iSourceRoot}->[0]);
+		}
+	
+	for (my $index = 0; $index < scalar(@{$self->{iSysDefFile}}); ++$index)
+		{
+		$sysdefTagsForModelTemplate .= $self->CreateSysDefTagsForModelXML($self->{iSysDefFile}->[$index], $self->{iSourceRoot}->[$index]);
+		}
+	
+	my $display;
+
+	if($self->{iLink}=~/\\/)    # it's a windows dir, change to file URI
+		{
+		$self->{iLink} = &FileAsUrl($self->{iLink});
+		}
+
+	$display .= $self->MakeMultiInfo ('iLocalize' 	=> 'abbrev');
+
+	my %infoMap = (
+		'iStyle'  		=> 'style',
+		'iOverlay'		=> 'overlay',
+		 'iBorder'		=> 'border',
+		 'iColor'		=> 'color'		
+	);
+	
+	$display .=$self->MakeMultiInfo( %infoMap);
+	if($self->{'iLogoSrc'})
+		{
+		$display.="\n<logo". $self->MakeAttirbutes(
+			'iLogoSrc' 	=> 'src',
+			'iLogoWidth'  		=> 'width',
+			'iLogoHeight'  		=> 'height'
+			) ;
+		if($self->{'iLogoSrc'} =~ /\.svg$/i)
+			{
+			$display.= " embed=\"yes\"";
+			}
+		$display.= "/>";
+		}
+
+	my $filters='';
+	if(scalar @{$self->{'iFiltering'}})	# complex filtering 
+		{
+		$filters = join("\n\t",@{$self->{'iFiltering'}});
+		}		
+	elsif (@{$self->{iFilter}}) { # can't have both -filter and complex filtering
+		foreach ( @{$self->{iFilter}}) {
+			if($_ ne '') {$filters.="<filter accept='$_'/>\n\t";}
+		} 
+	}
+		
+	my $ignore='';
+
+	foreach ( @{$self->{iIgnore}}){
+		if(/^(.*):(.*)$/) {$ignore.="<ignore type='$1' name='$2'/>\n\t"}
+	}
+		
+	
+	my $optional = $self->MakeAttirbutes(
+		'iCopyright' 	=> 'copyright',
+		'iDistribution'  		=> 'distribution',
+		'iRevision'  		=> 'revision',
+		'iDepsFile'  		=> 'deps',
+		'iLink'  		=> 'link',
+		'iRevisionType'  => 'revision-type',
+		'iVersions' 	=>	'version-list'
+		);
+
+	if($self->{iRelease} ne '') {$optional .= " ver='$self->{iRelease}'"}
+	elsif($self->{iGuessVer} eq 'Future' ) {$optional .= " ver='$self->{iGuessVer}'"}
+
+
+	my $layout = $self->MakeAttirbutes(
+		'iDetail'  		=> 'detail',
+		'iDetailType'  		=> 'detail-type',
+		'iPageWidth' 	=> 'page-width',
+		'iPrintResolution' 	=> 'resolution',
+		'iModelFont' 	=> 'font'
+		);
+	if($self->{iStatic}) {$layout .= " static='true'"}
+	my $legend = '';
+	my @legendmap = (
+		'iColor',	'colors',
+		'iStyle',	'styles',
+		'iOverlay',	'patterns',
+		'iBorder',	'borders'
+		); # order is important
+	for(my $i=0; $i<$#legendmap;$i+=2){
+		my $cur='#'.$infoMap{$legendmap[$i]};
+		my $count = scalar(@{$self->{$legendmap[$i]}});
+		 if ($count==0 || ($count==1 && $self->{$legendmap[$i]}->[0] eq '' )) {$cur='@shapes'."#$legendmap[$i+1]"}
+		$legend .= "\t\t\t<legend use=\"$cur\"/>\n";
+	}
+	foreach my $note (@{$self->{iLegendNote}})
+		{
+		if(!($note=~/&#?[0-9a-z]+;/i))
+			{	# if not entity-encoded, entity encode the stuff
+			$note=~ s/([&<>\x7f-\xff])/"&#".ord($1).";"/eg;
+			}
+		$legend .= "\t\t\t<note width='auto'>$note</note>";
+		}
+	
+	my $legendOptions;
+	if($self->{iLegendWidth}) {$legendOptions .= ' width="' .$self->{iLegendWidth} .'"'}
+	if($self->{iLegendMaxScale}) {$legendOptions .= ' maxscale="' .$self->{iLegendMaxScale} .'"'}
+	if($self->{iTitleScale}) {$legendOptions .= ' title-scale="' .$self->{iTitleScale} .'"'}
+	foreach my $line (<INPUT>)
+		{
+		my $cur='';
+		$line =~ s/___SYMBIAN_OS_RELEASE___/$self->{iRelease}/g;	# not used
+		$line =~ s/___NAME___/$self->{iName}/g;
+		$line =~ s/___LABEL___/$self->{iLabel}/g;
+		$line =~ s/___REVISION_TYPE___/$self->{iRevisionType}/g;	# not used
+		$line =~ s/___LINK___/$self->{iLink}/g;	# not used
+		$line =~ s/___OPTIONAL___/$optional/g;
+		$line =~ s/___LAYOUT_OPTIONS___/$layout/g;
+		$line =~ s/___FILTERS___/$filters/g;
+		$line =~ s/___IGNORE___/$ignore/g;
+		$line =~ s/___LEGEND___/$legend/g;
+		$line =~ s/___LEGEND_TITLE___/$self->{iLgdTitle}/g;
+		$line =~ s/___LEGEND_OPTIONS___/$legendOptions/g;
+		$line =~ s/___SHAPES_XML___/$self->{iShapes}/g;
+		$line =~ s/___SYSTEM_DEFINITIONS___/$sysdefTagsForModelTemplate/; # should be only one incident of it
+		$line =~ s/___DISPLAY___/$display/g;
+		$line =~ s/\sshapes=""//g; # remove empty attribute
+		print OUTPUT $line;
+		}
+	close INPUT;
+	close OUPUT;
+
+	# Open and close the file so that it can flush itself:
+	open (OUTPUT, "$modelXml") or &Logger::LogError("Xalan error ($error) occured in Step 1 of SVG building...", KOldSystemModelGenerator, 1);
+	close OUTPUT;
+	return $modelXml;
+	}
+
+sub GetXsltDir()
+	{
+	my $self = shift;
+	my $xsltDir = $FindBin::Bin."/svg";  # calcluated w.r.t old directory
+	$xsltDir = $FindBin::Bin."/src/old/svg" if ! -d $xsltDir; # calculated w.r.t the root directory
+	$xsltDir = $FindBin::Bin  if ! -d $xsltDir; # calculated w.r.t the /svg directory
+	return $xsltDir;
+	}
+
+
+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($_, KOldSystemModelGenerator,2, 100);
+			} elsif(s/^Warning: //) {
+				&Logger::LogWarning($_,  KOldSystemModelGenerator,2, 600);
+			} elsif(s/^Error: //i) {
+				&Logger::LogError($_,  KOldSystemModelGenerator,2, 400);
+			} else {
+				print STDERR "$_\n";
+			}
+		}
+	}
+	close(EXE);
+	return $?;
+}
+
+sub ShouldCreateDepmodel()
+	{
+	my $self = shift;
+	if ($self->{iDepsFile})
+		{
+		return 1;
+		}
+	my $model = $self->getModel();
+	my $t = $/;
+	$/='>';
+	open(M,$model);
+	while(<M>)
+		{
+		if(/<model\s/){last}
+		}
+	close M;
+	$/ = $t;
+	return /\sdeps=/;
+	}
+
+sub XsltTransform()
+	{
+	my $xslt = shift;
+	my $from = shift;
+	my $to = shift;
+	my $indent = shift;
+	my %params = %{$_[0]};
+	my $xsltParams;
+
+	# windows-specific stuff follows
+
+	if(! ($xslt=~/^..+:/)) {$xslt	=~ s#\/#\\#g}			#it's not a URL
+	if(! ($from=~/^..+:/)) {$from	=~ s#\/#\\#g}			#it's not a URL
+	if(! ($to=~/^..+:/)) {$to	=~ s#\/#\\#g}			#it's not a URL
+
+	while (my($p,$v) = each(%{$_[0]}))
+		{
+		$v =~ s/"/&quot;/g;	#"		
+		$xsltParams.= " -p $p \"$v\"";
+		}
+
+	my $command = &SysModelGen::Xalan();
+	$command =~ s#\/#\\#g;
+	$command .= $xsltParams;
+	if($indent >=0) {
+		$command .= " -i $indent";
+	}
+	if($to ne '') {
+		$command .= " -o \"$to\"";
+	}
+	$command.=" \"$from\" \"$xslt\"";
+	&Logger::LogInfo("System Call: $command", 800);
+	if($to eq '') {return `$command`}
+	return &RunCmd($command);
+	}
+
+sub Draw()
+	{
+	my $self = shift;
+	my $genSvg = $self->{'iDiagram'} ne '';
+	my $genCsv = $self->{'iOutputCsv'} ne '';
+	my $genXml = $self->{'iOutputXml'} ne '';
+	
+	if(!$genSvg && !$genCsv && !$genXml)  
+		{
+        &Logger::LogFatal("Must specify at least one type of output file. Cannot continue...", KOldSystemModelGenerator, 0,Logger::KNothingToDo);		
+		}
+	
+	&Logger::LogInfo("Creating sysmodel.svg...", KOldSystemModelGenerator,0);
+	
+	# Step 0:
+	# Prepare some file names and create output directory:
+
+	# construct full path name:
+	($self->{iRootDirectory} = cwd ) =~ s#\/#\\#g;
+	chdir($self->{iTemporaryDirectory});
+	my $tempDirectoryPathname = cwd; # now gives the full path name $self->{iTemporaryDirectory}
+	chdir($self->{iRootDirectory}); # change back!
+	
+	my $xsltDir = $self->GetXsltDir();	
+	
+	my $tempStuctureFile = "$tempDirectoryPathname/system_model_svg_tmp.xml";
+	my $tempXslFile = "$tempDirectoryPathname/system_model_svg_tmp.xsl";
+	my $tempModelFile = "$tempDirectoryPathname/model_tmp.svg";
+	my $tempModelFile2 = "$tempDirectoryPathname/model_tmp2.svg";
+	my $modelXsl = $xsltDir."/Model.xsl";
+	
+	my $modelXml = $self->getModel();
+	 
+	# Step 2
+	# xalan -i 2 model.xml model.xsl > tmp.xml
+	$error = &XsltTransform($modelXsl,$modelXml,$tempStuctureFile,1,	$self->{'iXsltParam'});
+				
+	&Logger::LogError("Xalan error ($error) occured in combining sysdefs", KOldSystemModelGenerator, 1) if $error;
+
+	# Step 3 - validation
+	# xalan tmp.xml validate.xsl
+	if($self->{iWarningLevel} == LogItem::VERBOSE )
+		{
+		my $errors = &XsltTransform($xsltDir."/validate.xsl",$tempStuctureFile,'',-1);
+		&Logger::LogList(split(/\n/,$errors));
+		}
+	if($genSvg)
+		{ # only needed for model building 
+		
+		# Step 4
+		&Logger::LogInfo("Creating styling XSLT...", KOldSystemModelGenerator, 1);
+		$error = &XsltTransform("$xsltDir/Shapes.xsl",$modelXml,$tempXslFile,1,
+				{%{$self->{'iXsltParam'}},'Model-Transform' => "'".&FileAsUrl($modelXsl)."'" });
+		&Logger::LogError("Xalan error ($error) occured generating Styling transform", KOldSystemModelGenerator, 2) if $error;
+	
+		# Step 5
+		&Logger::LogInfo("Generating SVG model...", KOldSystemModelGenerator, 1);
+		$error = &XsltTransform($tempXslFile,$tempStuctureFile,$tempModelFile,1,$self->{'iXsltParam'});
+		&Logger::LogError("Xalan error ($error) occured in building SVG", KOldSystemModelGenerator, 2) if $error;
+
+		if ($self->ShouldCreateDepmodel()) {	# insert as 1st transform
+			@ARGV=( $xsltDir."/Postprocess.xsl",'-',@ARGV)
+		}
+		my $tmpsvg = $tempModelFile;
+		while(scalar(@ARGV)) {
+			my $transform = shift(@ARGV);
+			my $datafile = shift(@ARGV);
+			if($datafile eq '""' || $datafile eq "''") {$datafile=''}	# not sure if this will work, but it should fix cygwin troubles
+			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
+			# xalan  -i 2 -p Data tmp.xml 'tmp.svg' postprocess.xsl> final.svg
+			my %p; 
+			if($datafile ne '') {
+				$p{'Data'}="'$datafile'";	# optional -- only if needed for transform
+			}
+			$error = &XsltTransform($transform,$tmpsvg,$saveto,1,\%p);
+			&Logger::LogError("Xalan error ($error) occured in post-processing SVG file", KOldSystemModelGenerator, 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 = &SysModelGen::GzipCommand();
+			if($gzip)
+				{
+				my $command = "$gzip ".$self->{iDiagram};
+				&Logger::LogInfo("System Call: $command", KOldSystemModelGenerator);
+				$error = &RunCmd($command);# this should generate the sysmodel.svg in the output directory
+				&Logger::LogError("Gzip error ($error) occured when comrpessing SVG", KOldSystemModelGenerator, 1) if $error;
+				&Logger::LogInfo("Renaming output to : $zipname", KOldSystemModelGenerator);		
+				rename $self->{iDiagram}.".gz", $zipname;
+				$compressed = 1;
+				}
+			}
+		if(!$compressed && $unzipname ne $self->{iDiagram}) 
+			{
+			&Logger::LogInfo("Renaming output to : $unzipname", KOldSystemModelGenerator);		
+			rename $self->{iDiagram}, $unzipname;	
+			}
+		}
+	# create CSV if desired
+	if($genCsv)
+		{
+		&Logger::LogInfo("Generating CSV output", KOldSystemModelGenerator, 0);
+		my %p;
+		if($self->{iCsvColumns})
+			{
+			$p{'atts'}="'".$self->{iCsvColumns}."'";
+			}
+		if($self->{iCsvLabels})
+			{
+			$p{'labels'}="'".$self->{iCsvLabels}."'";
+			}
+		$error = &XsltTransform($xsltDir."/output-csv.xsl",$tempStuctureFile,$self->{iOutputCsv},-1,\%p);
+		&Logger::LogError("Xalan error ($error) occured in CSV output...", KOldSystemModelGenerator, 1) if $error;
+
+		}
+		
+	# create sysdef XML if desired
+	
+	if($genXml)
+		{
+		&Logger::LogInfo("Generating XML output", KOldSystemModelGenerator, 0);
+		$error = &XsltTransform($xsltDir."/output-sysdef.xsl",$tempStuctureFile,$self->{iOutputXml},1);
+		&Logger::LogError("Xalan error ($error) occured in Sysdef output...", KOldSystemModelGenerator, 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}...", 100);
+		$self->DeleteTempDirectory();
+		}	
+	}
+
+sub Downgrade()
+	{
+	my $self = shift;
+	my $sysdef = shift;
+	my $saveto = $self->{iTemporaryDirectory}."/".shift;
+	my $sysdefurl=&FileAsUrl($sysdef);
+	my $xsltDir = $self->GetXsltDir();	
+	foreach(@{$self->{iSysDefFile}}) 
+		{
+		if($_ eq $sysdefurl)
+			{
+			$error = &XsltTransform("$xsltDir/sysdefdowngrade.xsl",$sysdef,$saveto,1);
+			&Logger::LogError("Xalan error ($error) occured in downgrading $sysdef...", KOldSystemModelGenerator, 1) if $error;
+			$_=&FileAsUrl($saveto);
+			}
+		}
+	}
+
+
+sub SystemModelXmlDataDir()
+	{
+	my $file = $FindBin::Bin."/src/old/resources/auxiliary";
+	$file = $FindBin::Bin."/../resources/auxiliary" if ! -d $file; # calculated w.r.t the /svg directory
+	return $file;
+	}
+
+sub SystemModelColorsXmlFile()
+	{
+	my $colorsFile =  &SystemModelXmlDataDir()."/system_model_colors.xml";
+	return $colorsFile;
+	}
+
+
+
+sub CreateSysDefTagsForModelXML()
+	{
+	my $self = shift;
+	my $sysdefXml = shift;
+	my $srcvar = shift;
+
+	if($sysdefXml eq '')
+		{
+		&Logger::LogInfo("Cannot find System Definition file", 100);
+		return;
+		}
+
+	my $ret = "<sysdef href=\"".&FileAsUrl($sysdefXml)."\"";
+	if($srcvar ne '') {$ret.=" root=\"$srcvar\""}
+	$ret .=">\n" . 
+		$self->MakeMultiInfo('iExtra' 	=> 'extra', 'iLevels'  	=> 'levels'	, 'iS12' => 's12');
+	return "$ret\t</sysdef>\n";
+	}
+	
+sub DeleteTempDirectory()
+	{
+	my $self = shift;
+	# This will delete all files in the $self->{iTemporaryDirectory}
+	rmtree $self->{iTemporaryDirectory};
+	}
+
+sub Help()
+	{
+	my $self = shift;
+format OK =
+ @<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+$param,                               $text,
+                       ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
+                       $text
+.
+my @list =(
+ 'Switch',               'Explanation',
+ '------',               '-----------',
+'-h' ,           'Help on usage',
+	'-i'      ,      'An INI file listing one argument per line, with the syntax: <argument> = <value>',
+	'==== Build Control  ====',
+  '-w'          ,  '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',
+  '-tempdir',	    'Temporary directory for build files. Defaults to drawsvg_temp',
+  '-output', 		'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.',
+  '-csv_output', 		'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.',
+  '-csv_columns', 	'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. ',
+  '-csv_labels', 	'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. ',
+  '-xml_output', 		'The name of the file to save a combined system definition XML. Only items shown in the built system model will be included.',
+  '-log'	,    'File in which to store output. Defaults to stdout',
+  '-compress', 	'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.',
+  '-clean'   ,        'Caution: if set, it will delete the contents of the temporary directory.',
+  "==== Files or URIs ====\nAll of these take a file name (relative or absolute path) or URI of a data source",
+'-model', '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.',
+'-shapes', '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. ',
+'-localize', 'The location of the Localization file used to provide displayable names for the model entities. By default,  the provided  "display-names.xml" is used.',
+'-s12', '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.',
+'-levels', 'The location of the Levels XML file used to override the  stacking of collections. ',
+'-sysinfo', 'The location of extra component information used to provided additional  properies for components.  By default,  the provided "SystemInfo.xml" is used.',
+'-deps', 'The location of the Dependencies XML file used to draw the depmodel.  If not present, dependencies will not be drawn',
+'-color', 'The location of a Values XML file used to specify per-component colours. If not present, the default colours are used.',
+'-border-shape', 'The location of a Values XML file used to specify the shape (border)  of each component. If not present, the default borders are used.',
+'-pattern', '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.',
+'-border-style', 'The location of a Values XML file used to specify per-component border  styles. If not present, the default border styles are used. ',
+'-link','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.',
+"==== Labels ====\nAll of these take a plain text value which is displayed on the model",
+'-system_name', 'The name of the product described in the model. It appears at  the bottom right. Defaults to "Symbian OS"',
+'-system_version', 'The version of the product described in the model. It appears  at the bottom right after the name.',
+'-model_name', 'The label for the model. It appears at the bottom right,  under the name. Defaults to "System Model".',
+'-model_version', 'A number which appears before th model-revision-type.   If specified this overrides the build number used by depmodel.  If not building depmodel, this defaults to "1"',
+'-model_version_type', 'One of "draft", "issued", "build" 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"',
+'-copyright', 'The copyright to appear in the lower left. Set to empty string to leave out. Defaults to "[this year] Nokia Corporation"',
+'-distribution', '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.',
+'-legend_title', 'The title to appear in the leftmost part of the legend. Defautls to "Key"',
+'-note', '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;)',  
+"==== Model Control  ====",
+'-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.',
+'-coreos [on/off/new]', 'Turn on or off Core OS colouring, or use the new colouring for 9.5 and later models. Defaults to "off" for model versions before 9.4 or those with no specified version, "on" for 9.4 and "new" for 9.5 and later',
+'-filter [filter-name]', '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"',
+'-filter-has [filter-name]', '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"',
+'-ignore [item]', 'A model entity to not draw, in the  form "[item-type]:[item-name]". Any number of these can be used. Defaults to "layer:Tools and Utils and SDKENG" ,"layer:MISC", "block:Techview"',
+'-show-attr [attr[=val]]', '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',
+'-hide-attr [attr[=val]]', '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',
+'-detail [item-type]' , 'The type of the smallest System Model entity to draw. One of "layer", "block", "subblock", "collection" or "component".  Defaults to "component"',		
+'-detail-type [type]' , 'If set to "fixed", the smallest System Model entity drawn will have a fixed width (rather then sized by their invisible components). This can be used to reduce the size and complexity of the overall model.',
+'-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"',
+'-static', 'If present, the model will not have any mouseover effects (this is  overriden by builing the depmodel).',
+'-logo [file]', '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',
+'-logo-height [length]', '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',
+'-logo-width [length]', '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',
+'-legend-width [%]', '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.',
+'-legend-max-scale [scale]', '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.',
+'-title-scale [scale]', '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.',
+'-model_font [font]', 'The name of the base font to use to draw the model. This will be overriden by any custom CSS in the Shapes XML',
+'-dpi [number]', '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'
+  );
+print STDERR "Usage: DrawSvg.pl [Arguments] [Transform Data-file] ...\n\nArguments:\n";
+  my $head=2;
+while(@list) {
+	$param = shift(@list);
+	if($head<=0 and !($param=~/^-/)){print "\n$param\n";next;}
+	$text = shift(@list);
+	write OK ;
+	$head--;
+}
+	return;
+	}
+
+1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/Legend.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,842 @@
+<?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" >
+ 
+	  <xsl:key name="style-ref" match="*[starts-with(name(),'generator-')]/@ref| @*[starts-with(name(),'generator-')]" use="."/>
+
+	<xsl:variable name="cboxWidth" select="15.5"/>
+	<xsl:variable name="cboxHeight" select="3.1"/>
+
+<!-- title of the model -->
+<xsl:template mode="title" match="systemModel">
+	<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>
+
+<!-- legend stuff -->
+
+<xsl:template match="legend-layer" mode="height">
+	<xsl:variable name="h1"> <!-- height of generated legend content -->
+		<xsl:choose>
+			<!-- strip out all unused legend items if possible -->
+			<xsl:when test="function-available('exslt:node-set') and parent::systemModel">
+				 <xsl:variable name="Legend">
+					 <xsl:apply-templates select="/SystemDefinition/systemModel/legend-layer" mode="legend-copy"/>
+				 </xsl:variable>
+		 		<xsl:apply-templates select="exslt:node-set($Legend)/descendant-or-self::legend-layer" mode="content-height"/>
+			</xsl:when>
+			<xsl:otherwise><xsl:apply-templates select="." mode="content-height"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable> <!-- $h1 does not take into account scaling the legend content -->
+
+	<!-- $h2 is height of single line in legend title -->
+	<xsl:variable name="h2"><xsl:call-template name="title-line-height"/></xsl:variable>
+	<xsl:variable name="hl"><xsl:apply-templates select="../logo" mode="height"/></xsl:variable>	
+	<xsl:variable name="h3">
+		<xsl:choose>
+			<xsl:when test="$hl='' or $hl='?'">0</xsl:when>	<!-- no logo or unknown height -->
+			<xsl:otherwise><xsl:value-of select="$hl"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>	
+
+	<xsl:variable name="h"> <!-- $h is max of $h1 and 3*$h2 -->
+		<xsl:choose>
+			<xsl:when test="3 * $h2 &gt;= $h1 and 3* $h2 &gt;= $h3"><xsl:value-of select="3* $h2"/></xsl:when>
+			<xsl:when test="$h3 &gt;= $h1"><xsl:value-of select="$h3"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$h1"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>	
+	<xsl:variable name="copyheight">
+		<xsl:choose>
+		<xsl:when test="@footer"><xsl:value-of select="$legendDx * 3 + 4.233"/></xsl:when>
+		<xsl:otherwise>0</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:value-of select="$h +  $copyheight"/>
+</xsl:template>
+
+
+<xsl:template match="legend-layer" mode="content-height"> <!-- only called from mode="height" -->
+	<xsl:variable name="h">
+		<xsl:call-template name="max-from-list">
+			<xsl:with-param name="list">
+				<xsl:text>4.233 </xsl:text>
+				<xsl:for-each select="legend"><xsl:apply-templates select="." mode="min-height"/><xsl:text>  </xsl:text></xsl:for-each>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:value-of select="$h +  $legendDx"/>
+</xsl:template>
+
+
+
+<xsl:template match="legend-layer" mode="width">
+	<xsl:choose>
+		<!-- strip out all unused legend items if possible -->
+		<xsl:when test="function-available('exslt:node-set') and parent::systemModel">
+			 <xsl:variable name="Legend">
+				 <xsl:apply-templates select="/SystemDefinition/systemModel/legend-layer" mode="legend-copy"/>
+			 </xsl:variable>
+	 		<xsl:apply-templates select="exslt:node-set($Legend)/descendant-or-self::legend-layer" mode="width-detail"/>
+		</xsl:when>
+		<xsl:otherwise><xsl:apply-templates select="." mode="width-detail"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="legend-layer[not(@label) and not(*)]" mode="width">0</xsl:template> <!-- no content -->
+
+
+<xsl:template match="legend-layer" mode="width-detail">
+	<xsl:variable name="x">
+		<xsl:apply-templates select="*[last()]" mode="offset"/>
+	</xsl:variable>
+	<xsl:variable name="w">
+		<xsl:apply-templates select="*[last()]" mode="width"/>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="not(*)"><xsl:apply-templates select="@label" mode="width"/></xsl:when>
+		<xsl:when test="$w=0"><xsl:value-of select="$x"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$legendDx + $x + $w"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="legend" mode="width" priority="-2">100</xsl:template>
+<xsl:template match="legend[not(*) and not(@*)]" mode="width" priority="5">0</xsl:template> <!-- empty: ignore -->
+
+<xsl:template match="@label" mode="width"><xsl:value-of select="string-length(.) *  4"/></xsl:template>
+<xsl:template match="note" mode="width">20</xsl:template>
+<xsl:template match="note[@width]" mode="width" priority="1">
+	<xsl:value-of select="@width"/>
+</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 match="note[@width='auto']" mode="width" priority="2">
+	<xsl:variable name="len"><xsl:call-template name="multiline-width"/></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:template>
+
+
+<xsl:template match="legend|note" mode="offset">
+	<xsl:variable name="x">
+		<xsl:apply-templates select="preceding-sibling::*[1]" mode="offset"/>
+	</xsl:variable>
+	<xsl:variable name="w">
+		<xsl:apply-templates select="preceding-sibling::*[1]" mode="width"/>
+	</xsl:variable>
+
+	<xsl:choose>
+		<xsl:when test="not(preceding-sibling::*) and ../@label"><xsl:apply-templates select="../@label" mode="width"/></xsl:when>
+		<xsl:when test="not(preceding-sibling::*)">0</xsl:when>
+		<xsl:when test="$w=0"><xsl:value-of select="$x"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$legendDx + $x + $w"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="legend-layer"><xsl:param name="y" select="0"/>
+<!--
+	 <xsl:apply-templates select="/SystemDefinition/systemModel/legend-layer" mode="legend-copy"/>
+  -->	 
+	<xsl:choose>
+		<!-- strip out all unused legend items if possible -->
+		<xsl:when test="function-available('exslt:node-set')">
+			 <xsl:variable name="Legend">
+				 <xsl:apply-templates select="/SystemDefinition/systemModel/legend-layer" mode="legend-copy"/>
+			 </xsl:variable>
+			<xsl:variable name="parent" select="parent::systemModel"/>
+	 		<xsl:apply-templates select="exslt:node-set($Legend)/descendant-or-self::legend-layer" mode="legend-detail">
+				<xsl:with-param name="y" select="$y"/>
+				<xsl:with-param name="model" select="$parent"/>
+			</xsl:apply-templates>	
+		</xsl:when>
+		<xsl:otherwise>
+			<!-- go the long way -->
+			<xsl:apply-templates select="." mode="legend-detail">
+				<xsl:with-param name="y" select="$y"/>
+				<xsl:with-param name="model" select="parent::systemModel"/>
+			</xsl:apply-templates>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="title-line-height">
+	<xsl:choose>
+		<xsl:when test="number(/SystemDefinition/systemModel/legend-layer/@title-scale)">
+			<xsl:value-of select="4.3 * /SystemDefinition/systemModel/legend-layer/@title-scale"/> <!-- scale 12pt by specified factor-->
+		</xsl:when>
+		<xsl:when test="/SystemDefinition/systemModel/legend-layer[@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:template>
+
+<xsl:template match="legend-layer" mode="legend-detail"><xsl:param name="y" select="0"/>
+	<xsl:param name="model"/>
+	<xsl:variable name="h"><xsl:apply-templates select="." mode="content-height"/></xsl:variable>
+	<xsl:variable name="w"><xsl:apply-templates select="." mode="width"/></xsl:variable>
+	<xsl:variable name="titleW"><xsl:apply-templates select="$model" mode="legend-title-width"/></xsl:variable>
+	<xsl:variable name="wl"><xsl:apply-templates select="$model/logo" mode="width"/></xsl:variable>	
+	<xsl:variable name="available-width"> <!--  amount of space of legend -->
+		<xsl:choose>
+			<xsl:when test="$wl=''"><xsl:value-of select="$full-width + 12.8"/></xsl:when> <!-- no logo -->
+			<xsl:otherwise><xsl:value-of select="$full-width + 12.8 -  $wl"/></xsl:otherwise> <!--  logo -->
+		</xsl:choose>
+	</xsl:variable>	
+	<xsl:variable name="want-width">
+		<xsl:choose>
+			<xsl:when test="contains(@width,'%')"><xsl:value-of select="0.01* substring-before(@width,'%') * $available-width"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$available-width"/></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>	
+	<xsl:variable name="scale">
+		<xsl:choose>
+			<xsl:when test="@maxscale  and ($want-width &gt; ($w+$titleW) * @maxscale)"><xsl:value-of select="@maxscale"/></xsl:when> <!--  -->
+			<xsl:when test="@maxscale or @width"><xsl:value-of select="$want-width div ($w+$titleW)"/></xsl:when>
+			<xsl:otherwise>1</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<!-- legend-root is the root of all legend content, including the title -->
+	<g id="legend-root" class="legend" transform="translate({$full-width + 12.8 - $titleW - $w} {$y}) translate({$w + $titleW} {$scale*5 - 5}) scale({$scale}) translate({- $w - $titleW})">
+		<xsl:apply-templates select="$model" mode="legend-label">
+			<xsl:with-param name="x" select="$w + ($titleW * 0.5)"/>
+			<xsl:with-param name="y" select="($h - $legendDx) * 0.5"/>
+		</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 geenrated legend content (ie not the title)-->
+					<rect class="legend" rx="{$legendDx}" ry="{$legendDx}" height="{$h}" width="{$w +  $legendDx}" x="0" y="0"/>
+					<g transform="translate({concat($legendDx,' ',$legendDx * 0.5)})">
+						<xsl:apply-templates select="@label|*">
+							<xsl:with-param name="h" select="$h - $legendDx"/>
+						</xsl:apply-templates>		
+					</g>
+				</g>
+			</xsl:if>
+		</g>	
+	<xsl:variable name="copyright">
+		<xsl:apply-templates select="$model/@copyright"/>	
+	</xsl:variable>
+	<xsl:variable name="distribution">
+		<xsl:apply-templates select="$model/@distribution"/>	
+	</xsl:variable>
+	<xsl:if test="@footer">
+		<xsl:variable name="foot" select="concat(' ',@footer,' ')"/>
+		<g transform="translate({concat('0 ',$y + $h + $legendDx )})">
+			<xsl:if test="$copyright != '' and contains($foot,' copyright ')">
+				<text text-anchor="start" class="lgd" x="0" y="0" style="font-weight: normal"><xsl:value-of select="$copyright"/></text>
+			</xsl:if>
+			<xsl:if test="$distribution !='' and contains($foot,' distribution ')">
+				<text text-anchor="middle" class="lgd" x="{$view-width*0.5 - $groupDy}" y="0" style="font-weight: normal"><xsl:value-of select="$distribution"/></text>
+			</xsl:if>
+		</g>
+	</xsl:if>
+	<xsl:apply-templates select="preceding-sibling::*[1]">
+		<xsl:with-param name="y" select="$y + $h + $groupDy"/>
+	</xsl:apply-templates>
+	<g id="legend-display" class="legend" transform="translate({concat($full-width + 12.8 - $titleW - $w,' ',$y)})" opacity="0.8">
+	  	<g id="legend-owner">
+			<rect id="legend-ctrl" rx="{$legendDx}" ry="{$legendDx}" height="{$h}" width="{$w +  $legendDx}" x="0" y="0" visibility="hidden" pointer-events="all"/>
+	    </g>
+	</g>	
+</xsl:template>
+
+
+<xsl:template match="@copyright | @distribution | @revision-type">
+	<xsl:apply-templates select="." mode="as-text"/>
+</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:message>
+Warning: unknown security classification: <xsl:value-of select="."/></xsl:message></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="@label"><xsl:param name="h"/>
+	<text text-anchor="start" class="lgd" dominant-baseline="mathematical" 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="offset"/></xsl:variable>
+	<xsl:variable name="w"><xsl:apply-templates select="." mode="width"/></xsl:variable>
+
+	<xsl:variable name="newlines" select="string-length(.) - string-length(translate(.,'&#xa;',''))"/>	
+	<text text-anchor="middle"  class="label"  dominant-baseline="mathematical" x="{$off + 0.5* $w}" y="{$h div 2}">
+		<xsl:copy-of select="@style|@class"/>
+		<xsl:call-template name="multiline">
+			<xsl:with-param name="x" select="$off  + 0.5* $w"/>
+			<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 name="title-line1"> <!--  must call on systemModel element-->
+	<xsl:value-of select="@name"/>
+	<xsl:if test="@ver"><xsl:value-of select="concat(' v',@ver)"/></xsl:if>
+</xsl:template>
+
+<xsl:template name="title-line2"> <!--  must call on systemModel element-->
+	<xsl:if test="@label"><xsl:value-of select="@label"/></xsl:if>
+		<!-- type is deprecated -->
+	<xsl:if test="@type">
+		<xsl:value-of select="concat(@type,' Model')"/>
+		<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">systemModel attribute "type" is deprecated, use "label" instead</xsl:with-param></xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template name="title-line3"> <!--  must call on systemModel 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"/></xsl:variable>
+			<xsl:if test="$rt!=''">	<!--  space follows if not empty -->
+				<xsl:value-of select="concat($rt,' ')"/>							
+			</xsl:if>
+			<xsl:value-of select="@revision"/>
+		</xsl:when>
+		<xsl:when test="@revision-type">
+				<xsl:apply-templates select="@revision-type"/>
+			</xsl:when>					
+		<!-- The following are deprecated -->
+		<xsl:when test="@draft">
+			<xsl:message>Warning: deprecated syntax draft="<xsl:value-of select="@draft"/>" </xsl:message>
+			<xsl:value-of select="concat('DRAFT ',@draft)"/>
+		</xsl:when>
+		<xsl:when test="@issued">
+			<xsl:message>Warning: deprecated syntax issued="<xsl:value-of select="@issued"/>" </xsl:message>
+			<xsl:value-of select="concat('ISSUED ',@issued)"/>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="systemModel" mode="legend-title-width">
+	<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>
+	
+	<xsl:variable name="h"><xsl:call-template name="title-line-height"/></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(legend-layer/@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="systemModel" mode="legend-label">
+	<xsl:param name="x"/>
+	<xsl:param name="y"/>
+	<text  text-anchor="middle" class="title" x="{$x}" y="{$y}">
+		<xsl:call-template name="title-line1"/>
+		<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 @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"><xsl:param name="h"/>
+	<xsl:variable name="name"><xsl:call-template name="name-value"/></xsl:variable>
+	<xsl:variable name="off"><xsl:apply-templates select="." mode="offset"/></xsl:variable>
+	<xsl:if test="$name!=''">
+		<text text-anchor="middle"  class="label"  dominant-baseline="mathematical" x="{$off + 3.5}" y="{$h div 2}">
+			<xsl:attribute name="width">10</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:variable name="dx"><xsl:choose><xsl:when test="$name=''">0</xsl:when><xsl:otherwise>10</xsl:otherwise></xsl:choose></xsl:variable>
+	<g>
+		<xsl:attribute name="transform">translate(<xsl:value-of select="concat($off + $dx,' 0')"/>)</xsl:attribute>
+		<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:with-param name="spacing" select="$legendDx"/>		<!-- space between items (if necessary) -->	
+				</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:with-param name="spacing" select="$legendDx"/>		<!-- space between items (if necessary) -->	
+				</xsl:apply-templates>			
+			</xsl:otherwise>
+		</xsl:choose>
+	</g>
+</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="group[@type='border']/cmp[@value]" mode="shape">
+	<xsl:value-of select="@value"/>
+</xsl:template>
+
+<xsl:template match="group[@type='overlay']/cmp[@value]" mode="overlay-style">
+	<xsl:text>fill: url(</xsl:text>
+	<xsl:value-of select="@value"/>
+	<xsl:text>); stroke: none; stroke-width: 0;</xsl:text>
+</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>
+
+
+<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>
+
+<xsl:template match="legend[not(*) and not(@use)]" mode="width" priority="1">
+		<xsl:variable name="len">
+			<xsl:call-template name="multiline-width">
+			<xsl:with-param name="t"><xsl:call-template name="name-value"/></xsl:with-param>
+		</xsl:call-template>
+	</xsl:variable>
+
+	<!--  the width is a guess based on the half the (expected) font size of 4.233 + a border of 2.5 on each side-->
+		<xsl:value-of select="5 + $len * 0.5 * 1.94"/>
+</xsl:template>
+
+<xsl:template name="multiline"><xsl:param name="x" select="0"/><xsl:param name="n" select="1"/><xsl:param name="t" select="."/>
+<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: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>
+
+
+<!-- undocumented feature: allowing multiple lines by using newlines in label attribute. Might want to remove or make available to all labels -->
+<xsl:template match="legend[not(*) and not(@use)]" priority="1"><xsl:param name="h"/>
+	<xsl:variable name="name"><xsl:call-template name="name-value"/></xsl:variable>
+	<xsl:variable name="off"><xsl:apply-templates select="." mode="offset"/></xsl:variable>
+	<xsl:variable name="width"><xsl:apply-templates select="." mode="width"/></xsl:variable>
+	<xsl:variable name="newlines" select="string-length($name) - string-length(translate($name,'&#xa;',''))"/>
+
+	<xsl:if test="$name!=''">
+		<text text-anchor="middle"  class="label"  dominant-baseline="mathematical" x="{$off + 0.5 * $width}" y="{$h div 2}">
+		<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" select="$name"/>
+		</xsl:call-template>
+		</text>
+	</xsl:if>
+</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"/>
+
+<!--  should only be used in case exslt is not available 
+<xsl:template match="legend[@use]" mode="width" priority="7">
+	<xsl:apply-templates select="key('ldg-use',@use)" mode="width"/>
+</xsl:template>-->
+
+<xsl:template match="legend" mode="content-width" priority="-1"/>
+<xsl:template match="*[cbox]" mode="content-width"><xsl:param name="h"/><xsl:param name="dx"/>
+	<xsl:value-of select="$cboxWidth * (ceiling(   count(cbox[@label|@lookup])  div floor(($h - $legendDx) div $cboxHeight)) )+ $dx"/>
+</xsl:template>
+
+<xsl:template match="legend[cmp|legend] | group[cmp]" mode="content-width"><xsl:param name="dx"/>
+	<xsl:call-template name="sum-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="concat($dx - $legendDx,' ',   count(cmp[@label|@lookup or (parent::legend and text())]) * ($cSize + $legendDx),' ')"/>
+			<xsl:for-each select="legend">
+				<xsl:apply-templates select="." mode="width"/><xsl:value-of select="concat(' ',$legendDx,' ')"/>
+			</xsl:for-each>
+		</xsl:with-param> 
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="legend" mode="width">
+	<xsl:variable name="h"><xsl:apply-templates select="ancestor::legend-layer" mode="content-height"/></xsl:variable>
+	<xsl:variable name="name"><xsl:call-template name="name-value"/></xsl:variable>
+	<xsl:variable name="dx"><xsl:choose><xsl:when test="$name=''">0</xsl:when><xsl:otherwise>10</xsl:otherwise></xsl:choose></xsl:variable>
+	<xsl:choose> <!-- for compat with not exslt processors -->
+		<xsl:when test="@use">
+			<xsl:apply-templates select="key('ldg-use',@use)" mode="content-width">
+				<xsl:with-param name="dx" select="$dx"/>
+				<xsl:with-param name="h" select="$h"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:when test="*">
+			<xsl:apply-templates select="." mode="content-width">
+				<xsl:with-param name="dx" select="$dx"/>
+				<xsl:with-param name="h" select="$h"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise>0</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<!--  calc smallest height any legend item can use -->
+
+<xsl:template match="legend[legend]" mode="min-height">
+	<xsl:call-template name="max-from-list">
+		<xsl:with-param name="list">
+			<xsl:for-each select="legend"><xsl:apply-templates select="." mode="min-height"/><xsl:text>  </xsl:text></xsl:for-each>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="legend[@use]" mode="min-height">
+	<xsl:apply-templates select="key('ldg-use',@use)"  mode="min-height"/>
+</xsl:template>
+
+<xsl:template match="legend[cbox] | group[cbox]" mode="min-height">
+<!-- the smallest this can be is the height of a cbox
+	However, if there are so many that it's wider than 2/3 of the model (to leave some room for the title, etc), then 
+	figure out how many tall these need to be in order to fit. Can't be less than one tall.
+	The 1.01 factor is to avoid rounding errors
+	This really should be calculated more exactly
+	-->
+	<xsl:value-of select="$cboxHeight * ceiling($cboxWidth * count(cbox) div  ($full-width * 0.5)) * 1.01"/>
+</xsl:template>
+
+<xsl:template match="legend[component|cmp] | group[component|cmp]" mode="min-height"><xsl:value-of select="$cSize"/></xsl:template>
+<xsl:template match="note" mode="min-height">3.1</xsl:template>
+<xsl:template match="legend[legend]" mode="min-height">
+	<xsl:call-template name="max-from-list">
+		<xsl:with-param name="list">
+			<xsl:value-of select="concat($cSize,' ')"/>
+			<xsl:for-each select="*"><xsl:apply-templates select="." mode="min-height"/><xsl:text>  </xsl:text>	</xsl:for-each>
+		</xsl:with-param>
+	</xsl:call-template>
+
+</xsl:template>
+
+	<!-- end calc height -->
+
+
+
+
+<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="legend/cbox|group/cbox"><xsl:param name="h"/><!-- can only have one type per legend -->
+	<xsl:variable name="rows" select="floor($h div $cboxHeight)"/>
+	<xsl:variable name="total" select="count(../cbox[@label|@lookup])"/>
+	<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="$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}" dominant-baseline="mathematical">
+				<xsl:attribute name="x"><xsl:value-of select="$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>
+
+<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="legend[s:g]" mode="width"><xsl:value-of select="sum(s:g/@width)"/></xsl:template>
+<xsl:template match="legend[s:g]" mode="min-height"><xsl:value-of select="s:g/@height"/></xsl:template>
+<xsl:template match="legend/s:g">
+	<xsl:copy-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>
+
+
+
+<!-- determine if generated stuff is present or not -->
+
+<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="layer" mode="legend-copy" priority="-1">
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template match="legend-layer" mode="legend-copy">
+	<xsl:choose>
+		<xsl:when test="not(function-available('exslt:node-set'))"/>
+		<xsl:otherwise>
+			<xsl:copy><xsl:copy-of select="@*[name()!='label' and name()!='literal' and name()!='label-ref']"/>
+				<xsl:if test="@label"><xsl:apply-templates select="." mode="make-label"/></xsl:if>
+				<xsl:apply-templates  mode="legend-copy"/>
+			</xsl:copy>
+		</xsl:otherwise>
+	</xsl:choose>
+</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="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: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[@label-ref]" mode="legend-copy">
+	<xsl:copy><xsl:copy-of select="@*[name()!='label' and name()!='literal' and name()!='label-ref']"/>
+		<xsl:apply-templates select="." mode="make-label"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="*" mode="is-showable" priority="-1"/>
+<xsl:template match="layer | *[$Detail=name() or not($Static or /SystemDefinition/systemModel/@detail-type='fixed')]" priority="4" mode="is-showable">1</xsl:template>
+<xsl:template match="collection[$Detail='component' or $Detail='module']" mode="is-showable">1</xsl:template>
+<xsl:template match="subblock[$Detail='component' or $Detail='module' or $Detail='collection']" mode="is-showable">1</xsl:template>
+<xsl:template match="block[$Detail!='layer']" mode="is-showable">1</xsl:template>
+
+<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/systemModel/@detail-type='fixed' or $Static) and ((../@detail='component' and $Detail!='component') or  
+			(../@detail='collection' and ($Detail='layer' or contains($Detail, 'block'))) or 
+			(../@detail='subblock' and ($Detail='layer' or $Detail='block')) or (../@detail='block' and $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)">
+				<xsl:apply-templates select="key('style-ref',@style-id)" mode="is-showable"/>
+			</xsl:when><!-- see if it's referenced by anything -->
+			<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<!-- example: always use --></xsl:when>
+			<!-- everything else is a rule -->
+			<xsl:when test="self::cbox">
+				<xsl:apply-templates select="//component|//collection|//block|//subblock|//module|//logicalset|//logicalsubset|layer" mode="show-unused-colorsbackground">
+		<!--		<xsl:apply-templates select="//component" 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|//block|//subblock|//module|//logicalset|//logicalsubset|layer" mode="...">-->
+				<xsl:apply-templates select="//component" 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|//collection|//block|//subblock|//module|//logicalset|//logicalsubset|layer" mode="...">-->
+				<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|//block|//subblock|//module|//logicalset|//logicalsubset|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|//block|//subblock|//module|//logicalset|//logicalsubset|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|//block|//subblock|//module|//logicalset|//logicalsubset|layer" mode="show-unused-colorstext-highlight">
+					<xsl:with-param name="n" select="@style-id"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:otherwise>			<xsl:message>[
+	
+	<xsl:value-of select="."/>
+	
+	
+	]</xsl:message>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="(@label | @lookup) and $show!='' ">
+			<xsl:copy> <!-- 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="generated-{../@type}"><xsl:value-of select="@value"/></xsl:attribute>
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:copy>
+		</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: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="legend" mode="width" priority="-2">100</xsl:template>
+<xsl:template match="legend|note" mode="offset">
+<xsl:template match="legend"><xsl:param name="h"/>
+<xsl:template match="legend[legend]" mode="min-height">
+
+ -->
+</xsl:stylesheet>
+
+	
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/Model.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,1688 @@
+<?xml version="1.0"?>
+ <!DOCTYPE XSLT  [
+      <!ENTITY AZ  "ABCDEFGHIJKLMNOPQRSTUVWXYZ">
+      <!ENTITY az  "abcdefghijklmnopqrstuvwxyz">
+ ]>
+ <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"  xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date exslt"
+		xmlns:exslt="http://exslt.org/common">
+	<xsl:param name="xml-stylesheet"/><!-- set to default stylesheet-->
+	<xsl:param name="Verbose" select="0"/><!-- Verbosity level of messages. Set to 1 (or higher) to get runtime comments-->
+	<xsl:param name="Origin-attr">old_model</xsl:param>
+	<xsl:output method="xml" cdata-section-elements="script s:script" indent="yes"/>
+	  <xsl:key name="named" match="*" use="@name"/>
+
+
+<!-- ====== Computed values ============= -->
+
+<xsl:variable name="Version">
+	<xsl:choose>
+		<xsl:when test="/model/@ver"><xsl:value-of select="/model/@ver"/></xsl:when>
+		<xsl:when test="/model/@deps"><xsl:value-of select="document(/model/@deps,.)/SystemModelDeps/@version"/></xsl:when>
+		<xsl:when test="count(/model/sysdef/info[@type='s12'])=1">
+			<xsl:value-of select="document(/model/sysdef/info[@type='s12']/@href,.)/Schedule12/@OS_version"/>
+		</xsl:when>
+	</xsl:choose>
+</xsl:variable>
+
+
+<!-- for merging: -->
+
+<xsl:variable name="filter-nodes" select="//filter[not(@accept or @reject) and @select and @display]"/>
+	<!--  @value is optional, but should be set unless select=* -->
+
+<xsl:variable name="filter-in"> <!--comma-separated list of filters to accept -->
+	<xsl:text>,</xsl:text>
+	<xsl:if test="not($filter-nodes) and //filter[@accept|@reject]">
+		<xsl:value-of  select="concat($Version,',')"/> <!-- the version number -->
+	</xsl:if>
+	<xsl:for-each select="//filter[@accept]"><xsl:value-of select="@accept"/>,</xsl:for-each>
+	<xsl:for-each select="//filter[@reject]">!<xsl:value-of select="@reject"/>,</xsl:for-each>
+</xsl:variable>
+
+
+<xsl:variable name="ignore" select="//ignore"/>
+
+<xsl:variable name="abbrevs" select="document(/model/layout/info/@href,/)/display-names//abbrev"/> <!-- the abbreviations list -->
+
+<xsl:variable name="simple-filters" select="not(function-available('exslt:node-set'))"/>
+
+<!-- ====== Error checking ============= -->
+
+<!--  start error checking -->
+
+<xsl:template match="SystemDefinition/@schema" mode="check">
+	<!-- warning if schema is less than 1.4 -->
+	<xsl:if test="substring-before(.,'.') &lt; 1 or (substring-before(.,'.')=1 and substring-before(substring-after(.,'.'),'.') &lt; 4)">
+		<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">using old System Definition schema (<xsl:value-of select="."/>)</xsl:with-param></xsl:call-template>
+	</xsl:if>
+<!--	<xsl:if test="starts-with(.,'1.4.')">
+		<xsl:call-template name="Caller-Note"><xsl:with-param name="text">using backwards compatible System Definition schema (<xsl:value-of select="."/>)</xsl:with-param></xsl:call-template>
+	</xsl:if> -->
+	<xsl:if test="substring-before(.,'.') &gt; 2">
+		<xsl:call-template name="Critical-Error"><xsl:with-param name="text">using incompatible System Definition schema (<xsl:value-of select="."/>)</xsl:with-param></xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="*" mode="check"/>
+
+<xsl:template match="block[ancestor::layer/@levels]|lsubblock[ancestor::layer/@levels] | logicalset[ancestor::layer/@levels]|logicalsubset[ancestor::layer/@levels]" mode="check">
+	<xsl:variable name="levels"><xsl:text> </xsl:text><xsl:apply-templates mode="layernames" select="."/><xsl:text> </xsl:text></xsl:variable>	
+	<xsl:for-each select="module | collection">
+	<xsl:if test="not(contains($levels,concat(' ',@level,' ')))">
+		<xsl:call-template name="Caller-Error"><xsl:with-param name="text">Invalid level: <xsl:value-of select="@level"/> in <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>
+	</xsl:if>
+	</xsl:for-each>
+</xsl:template>
+
+<xsl:template name="Caller-Debug"><xsl:param name="text"/>
+	<xsl:if test="$Verbose &gt; 5"><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>
+
+<!--- ==================== merge ==================== -->
+
+<!-- merge is used this is called on a model file -->
+
+<xsl:template match="@*" mode="copyroot" priority="-1"><xsl:copy-of select="."/></xsl:template>
+<xsl:template match="@detail" mode="copyroot">
+	<xsl:choose>
+		<xsl:when test=".='module'"><xsl:attribute name="detail">collection</xsl:attribute></xsl:when>
+		<xsl:when test=".='logicalsubset'"><xsl:attribute name="detail">subblock</xsl:attribute></xsl:when>
+		<xsl:when test=".='logicalset'"><xsl:attribute name="detail">block</xsl:attribute></xsl:when>
+		<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+
+<xsl:template match="@revision[../@revision-type='date' and contains(.,'%') and function-available('date:month-abbreviation')]" mode="copyroot">
+<xsl:attribute name="revision"><xsl:call-template name="format-date"/></xsl:attribute>
+</xsl:template>
+
+<xsl:template match="/model">
+	<xsl:if test="$xml-stylesheet!='' "> <!-- start with an optional style sheet transform -->
+		<xsl:processing-instruction name="xml-stylesheet">type="text/xsl" href="<xsl:value-of select="$xml-stylesheet"/>"</xsl:processing-instruction>
+	</xsl:if>
+	<SystemDefinition>
+		<xsl:for-each select="document(sysdef/@href, .)/SystemDefinition">
+			<xsl:copy-of select="@* | namespace::*"/>
+		</xsl:for-each>
+	<xsl:copy-of select="document(layout/info[@type='abbrev']/@href,.)/*/@xml:lang"/> <!-- copy localized language value -->
+		<xsl:apply-templates select="document(@deps, .)/SystemModelDeps" mode="merge"/>
+		<styling>
+			<xsl:apply-templates select="@shapes | layout/info" mode="styling"/>
+		</styling>
+		<xsl:apply-templates select="document(sysdef/@href, .)/SystemDefinition/@schema" mode="check"/>
+		  <systemModel>
+			<!-- copy all attributes from all the system models and from the model element -->
+			<xsl:apply-templates select="document(sysdef/@href, .)/SystemDefinition/systemModel/@*|@*|layout/@*" mode="copyroot"/>
+			<xsl:if test="$Version!='' and not(@ver)">
+				<xsl:attribute name="ver">
+					<xsl:value-of select="$Version"/>
+				</xsl:attribute>
+			</xsl:if>
+			<!-- special handing of revision details -->
+			<xsl:choose><!-- get revision details from deps if not otherwise specified -->
+				<xsl:when test="@deps and (not(@revision-type) or @revision-type='build') and not(@revision)">
+					<xsl:variable name="rt" select="@revision-type"/>
+					<xsl:for-each select="document(@deps,.)/SystemModelDeps[@number]">
+						<xsl:if test="not($rt)">
+							<xsl:attribute name="revision-type">build</xsl:attribute>
+						</xsl:if>
+						<xsl:attribute name="revision"><xsl:value-of select="@number"/></xsl:attribute>
+					</xsl:for-each>
+				</xsl:when>
+				<xsl:when test="@revision-type='date' and not(@revision) and function-available('date:date-time')">
+					<xsl:attribute name="revision"><xsl:value-of select="substring-before(date:date-time(),'T')"/></xsl:attribute>
+				</xsl:when>
+			</xsl:choose>
+			<xsl:apply-templates select="layout/legend" mode="merge"/> <!-- add legend as a layer -->
+			<xsl:apply-templates select="layout/logo" mode="merge"/> <!-- copy logos to use when drawing: put first so it's drawn last-->
+			<xsl:choose>
+				<xsl:when test="not(function-available('exslt:node-set'))">
+					<!-- can't do much, don't bother filtering -->
+					<xsl:apply-templates select="sysdef" mode="merge"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:for-each select="/model"> <!-- hack for xsltproc which loses the current node -->				
+					<xsl:variable name="unfiltered">
+							<xsl:choose>
+								<xsl:when test="count(sysdef) &lt; 2"> <!-- no need to merge multi models -->
+									<xsl:apply-templates select="sysdef" mode="merge"/>
+								</xsl:when>
+								<xsl:otherwise>
+									<xsl:variable name="sysdefs">
+										<xsl:for-each select="sysdef">
+											<sysdef><xsl:apply-templates select="." mode="merge"/></sysdef>
+										</xsl:for-each>
+									</xsl:variable>
+									<xsl:apply-templates select="exslt:node-set($sysdefs)/sysdef[1]" mode="override-merge">
+										<xsl:with-param name="next" select="exslt:node-set($sysdefs)/sysdef[2]"/>
+									</xsl:apply-templates>
+								</xsl:otherwise>
+							</xsl:choose>
+						</xsl:variable>
+						<xsl:apply-templates select="exslt:node-set($unfiltered)/*" mode="filter-for-presence"/>
+					</xsl:for-each>
+				</xsl:otherwise>
+			</xsl:choose>
+			<xsl:copy-of select="layout/layer-group"/> <!-- copy layer groups to use when drawing: put last so it's drawn first-->
+		  </systemModel>
+	</SystemDefinition>
+</xsl:template>
+
+
+<!-- merge multiple models together -->
+
+<xsl:template match="sysdef" mode="override-merge"><xsl:param name="next"/>
+	<xsl:choose>
+		<xsl:when test="not($next)">
+			<xsl:copy-of select="*"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Merging with model <xsl:value-of select="1 +  count($next/preceding-sibling::sysdef)"/></xsl:with-param></xsl:call-template>			
+			<xsl:variable name="cur">
+					<sysdef>
+						<xsl:apply-templates select="*" mode="override-merge">
+							<xsl:with-param name="other" select="$next"/>
+						</xsl:apply-templates>
+						<xsl:apply-templates select="$next/*" mode="append">
+							<xsl:with-param name="main" select="."/>
+						</xsl:apply-templates>
+					</sysdef>
+			</xsl:variable>
+			<xsl:apply-templates select="exslt:node-set($cur)/sysdef" mode="override-merge">
+				<xsl:with-param name="next" select="$next/following-sibling::sysdef[1]"/>
+			</xsl:apply-templates>	
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="component/*" mode="override-merge" priority="7"><xsl:copy-of select="."/></xsl:template>
+
+<xsl:template match="*" mode="override-merge"><xsl:param name="other"/>
+	<xsl:variable name="n" select="@name"/>
+	<xsl:variable name="tag" select="name()"/>
+	<xsl:choose>
+		<xsl:when test="$other/*[@override=$n and name()=$tag]"> 
+			<!--replace this with the other one at the current location-->
+			<xsl:apply-templates select="$other/*[@override=$n and name()=$tag]" mode="safe-combine">
+				<xsl:with-param name="main-root" select="ancestor-or-self::sysdef"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:when test="$other/ancestor-or-self::sysdef/descendant::*[@override=$n and name()=$tag]">
+			<!-- it's overridden somewhere else (perhaps deleted)-->
+			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Deleting  <xsl:value-of select="$n"/></xsl:with-param></xsl:call-template>			
+		</xsl:when>
+		<xsl:when test="$other/*[@rename=$n or @move=$n and name()=$tag]"> <!-- leave as is at the current location-->
+			<xsl:if test="$other/*[@rename=$n or @move=$n and name()=$tag]/*">
+			<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">ignoring children</xsl:with-param></xsl:call-template>
+			</xsl:if>
+			<xsl:copy>
+				<xsl:copy-of select="@*"/> <!-- own attributes -->
+				<xsl:copy-of select="$other/*[@rename=$n or @move=$n and name()=$tag]/@name"/> <!-- overwrite names -->
+			<!--leave as is at the current location-->					
+				<xsl:apply-templates select="*[not(self::name)]"  mode="override-merge"> <!-- do not copy deprecated localised name form-->
+					<xsl:with-param name="other" select="$other/ancestor-or-self::sysdef"/> <!-- use root of other, to catch any moved decendants -->
+				</xsl:apply-templates>
+			</xsl:copy>
+		</xsl:when>
+		<xsl:when test="$other/ancestor-or-self::sysdef/descendant::*[@rename=$n or @move=$n and $tag=name()]">
+			<!--it's moved to elsewhere-->
+			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Relocating <xsl:value-of select="$n"/></xsl:with-param></xsl:call-template>
+		</xsl:when>
+		<xsl:when test="$other/*[@name=$n and self::component]">
+			<!--use other at the current location-->
+			<xsl:copy>
+				<xsl:copy-of select="$other/*[@name=$n and name()=$tag]/@*"/> <!--other's attributes -->
+				<!-- should put something here to merge filters,classes properly -->
+				<xsl:copy-of select="*"/> <!--current conent -->
+					<xsl:variable name="this" select="."/>
+				<xsl:apply-templates mode="copy-merge-content"  select="$other/*[@name=$n and name()=$tag]/*">
+					<xsl:with-param name="main" select="$this"/>
+				</xsl:apply-templates> <!--other's conent -->
+			</xsl:copy>
+		</xsl:when>
+		<xsl:when test="$other/*[@name=$n and name()=$tag]"> <!-- leave as is at the current location, merge children-->
+			<xsl:for-each select="$other/*[@name=$n and name()=$tag]">
+				<xsl:if test="(self::module and $tag!='module') or (not(self::module) and $tag='module')   or   (self::collection and $tag!='collection') or (not(self::collection) and $tag='collection')">
+					<xsl:call-template name="Critical-Error"><xsl:with-param name="text">Cannot merge <xsl:value-of select="name()"/> "<xsl:value-of select="@name"/>" with <xsl:value-of select="$tag"/> "<xsl:value-of select="$n"/>"</xsl:with-param></xsl:call-template>				
+				</xsl:if>
+			</xsl:for-each>
+			<xsl:copy>
+				<xsl:copy-of select="@*"/> <!-- own attributes -->
+				<xsl:copy-of select="$other/*[@name=$n and name()=$tag]/@*"/> <!-- other's attributes -->
+				<xsl:apply-templates select="*"  mode="override-merge">
+					<xsl:with-param name="other" select="$other/*[@name=$n and name()=$tag]"/> <!-- use other version of this -->
+				</xsl:apply-templates>
+			</xsl:copy>
+		</xsl:when>
+		<xsl:when test="$other/ancestor-or-self::sysdef/descendant::*[@name=$n and name()=$tag]">
+			<!-- it's moved to elsewhere -->
+			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Relocating and merging <xsl:value-of select="$n"/></xsl:with-param></xsl:call-template>
+		</xsl:when>
+		<xsl:otherwise> <!--  there is no equivalent in 2nd, just copy this and descend -->
+			<xsl:copy>
+				<xsl:copy-of select="@*"/> <!-- own attributes -->	
+				<xsl:apply-templates select="*"  mode="override-merge">
+					<xsl:with-param name="other" select="$other/ancestor-or-self::sysdef"/> <!-- use root of other, to catch any moved decendants -->
+				</xsl:apply-templates>
+			</xsl:copy>		
+		</xsl:otherwise>
+	</xsl:choose>
+	<!-- this won't work if the main model has nothing in the group, but that's invalid, so it's ok. -->
+	<xsl:if test="position()=last() and name($other)!='sysdef'">
+		<!--Check if other has stuff to append that's not already been used   -->
+		<xsl:apply-templates select="$other/*" mode="append">
+			<xsl:with-param name="main" select=".."/>
+		</xsl:apply-templates>		
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template mode="copy-merge-content" match="*">
+<xsl:copy-of select="."/>
+</xsl:template>
+
+
+<xsl:template mode="copy-merge-content" match="component/*[starts-with(name(),'generator-')]"><xsl:param name="main"/>
+	<xsl:variable name="self" select="."/>
+	<!-- only copy if does not exist in original -->
+	<xsl:if test="not($main/*[name()=name($self)])">
+		<xsl:copy-of select="$self"/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template mode="copy-merge-content" match="unit"><xsl:param name="main"/>
+	<xsl:variable name="attr"><xsl:for-each select="@*"><xsl:value-of select="concat(name(),'=',.)"></xsl:value-of></xsl:for-each></xsl:variable>
+	<xsl:variable name="exists">
+		<xsl:for-each select="$main/unit">
+			<xsl:variable name="attr2"><xsl:for-each select="@*"><xsl:value-of select="concat(name(),'=',.)"></xsl:value-of></xsl:for-each></xsl:variable>
+			<xsl:if test="$attr2=$attr">*</xsl:if>
+		</xsl:for-each>
+	</xsl:variable>
+	<!-- only copy if does not exist in original's units-->
+	<xsl:if test="$exists=''">
+		<xsl:copy-of select="."/>
+	</xsl:if>
+</xsl:template>
+
+
+
+<xsl:template match="*[@override  and *]" mode="append" priority="5"><xsl:param name="main"/>
+	<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">Append (5) <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>	
+
+	<xsl:variable name="n" select="@override"/>
+		<!-- if override is not in main, use this -->
+	<xsl:if test="@name and not($main/*[@name=$n])">
+		<!--  must have a name for renaming -->
+		<xsl:copy>
+			<xsl:copy-of select="@*[not(name()='override' or name()='rename' or name()='move')]"/>
+			<xsl:apply-templates select="*" mode="safe-combine">
+				<xsl:with-param name="main-root" select="$main/ancestor-or-self::sysdef"/>
+			</xsl:apply-templates>	
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="*" mode="safe-combine" priority="-1"><xsl:param name="main-root"/>
+	<xsl:copy>
+		<xsl:copy-of select="@*"/>
+		<xsl:apply-templates select="*"  mode="safe-combine">
+			<xsl:with-param name="main-root" select="$main-root"/>
+		</xsl:apply-templates>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="*[@rename or @move]" mode="safe-combine" priority="3"><xsl:param name="main-root"/>
+	<xsl:variable name="n" select="@rename | @move"/>
+	<xsl:variable name="newname" select="@name"/>
+	<xsl:variable name="atts" select="@*[name()!='name' and name()!='move' and name()!='rename' and name()!='override']"/> <!-- if any non-oragnisational attributes are present on the "move" item, then they should override the values in the thing being moved -->
+	<xsl:variable name="other" select="ancestor-or-self::sysdef"/>
+	<!-- can't merge a component with a container -->
+	<xsl:for-each select="$main-root/descendant::*[@name=$n and (self::layer or self::block or self::subblock or self::logicalset or self::logicalsubset)]">
+		<xsl:copy>
+			<xsl:copy-of select="@*"/>
+			<xsl:copy-of select="$newname"/>	
+			<xsl:copy-of select="$atts"/> <!-- if any of these attributes are present on the moved collection, then use that value rather than the value in the one being moved -->
+			<xsl:apply-templates select="*"  mode="override-merge"> <!-- do not copy localised name -->
+				<xsl:with-param name="other" select="$other"/>
+			</xsl:apply-templates>
+		</xsl:copy>
+	</xsl:for-each>	
+</xsl:template>
+<!-- can only merge a component or module with component or module -->
+<xsl:template match="component[@rename or @move] | collection[@rename or @move] | module[@rename or @move]" mode="safe-combine" priority="4"><xsl:param name="main-root"/>
+	<xsl:variable name="n" select="@rename | @move"/>
+	<xsl:variable name="newname" select="@name"/>
+	<xsl:variable name="atts" select="@*[name()!='name' and name()!='move' and name()!='rename' and name()!='override']"/> <!-- if any non-oragnisational attributes are present on the "move" item, then they should override the values in the thing being moved -->
+	<xsl:variable name="tag" select="name()"/>
+	<xsl:variable name="other" select="ancestor-or-self::sysdef"/>	
+	<!-- can't merge a component with a container -->
+	<xsl:for-each select="$main-root/descendant::*[@name=$n and $tag=name()]">
+		<xsl:copy>
+			<xsl:copy-of select="@*"/>
+			<xsl:copy-of select="$newname"/>	
+			<xsl:copy-of select="$atts"/> <!-- if any of these attributes are present on the moved collection, then use that value rather than the value in the one being moved -->
+			<xsl:apply-templates select="*[not(self::name)]"  mode="override-merge"> <!-- do not copy localised name -->
+				<xsl:with-param name="other" select="$other"/>
+			</xsl:apply-templates>
+		</xsl:copy>
+	</xsl:for-each>	
+</xsl:template>
+
+
+<xsl:template match="*[@name]" mode="safe-combine" priority="2"><xsl:param name="main-root"/>
+	<xsl:if test="@override and (@rename or @move)">
+		<xsl:call-template name="Critical-Error"><xsl:with-param name="text">Error invalid combinations of attributes in <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>
+	</xsl:if>
+	<xsl:copy>
+		<xsl:variable name="cur" select="."/>
+		<xsl:copy-of select="@*[not(name()='override' or name()='rename' or name()='move')]"/>
+		<!-- copy other's attributes -->
+		<xsl:copy-of select="$main-root/descendant::*[@name=$cur/@name and name($cur)=name()]/@*[not(name()='override' or name()='rename' or name()='move' or name()='name')]"/>		
+		<xsl:apply-templates select="*"  mode="safe-combine">
+			<xsl:with-param name="main-root" select="$main-root"/>
+		</xsl:apply-templates>
+		<!-- now copy anything defined here -->
+		<xsl:variable name="other" select="ancestor-or-self::sysdef"/>	
+		<xsl:for-each select="$main-root/descendant::*[@name=$cur/@name and name($cur)=name()]">
+			<xsl:apply-templates select="*[not(self::name)]"  mode="override-merge"> <!-- do not copy localised name -->
+				<xsl:with-param name="other" select="$other"/>
+			</xsl:apply-templates>
+		</xsl:for-each>	
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="component | component/*" mode="safe-combine" priority="2">
+	<!--a component is atomic: it cannot be merged. So it's always just copied.-->	
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+
+<xsl:template match="*[@override and not(@name)]" mode="safe-combine" priority="5"/> <!-- ignore component -->
+
+
+<xsl:template match="*" mode="unused-merge"><xsl:param name="other"/>
+	<xsl:variable name="self" select="."/>
+	<xsl:if test="not($other/descendant::*[@name=$self/@name and name()=name($self)  and descendant-or-self::component])">
+		<!-- not in other, so include here -->
+		<xsl:copy>
+			<xsl:copy-of select="@*"/>
+			<xsl:apply-templates select="*"  mode="unused-merge">
+				<xsl:with-param name="other" select="$other"/>
+			</xsl:apply-templates>
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="*[@name]" mode="append"><xsl:param name="main"/>
+	<!--  this handles all cases where this holds the data -->
+	<xsl:variable name="self" select="."/>
+		<!-- if $self is not in main, use this -->
+	<xsl:if test="not($main/*[@name=$self/@name])">
+		<xsl:variable name="other" select="ancestor-or-self::sysdef"/>
+		<xsl:for-each select="$main/ancestor-or-self::sysdef/descendant::*[@name=$self/@name and name()=name($self)  and descendant-or-self::component]">
+			<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">To Merge <xsl:value-of select="$self/@name"/> with these: <xsl:for-each select="*">"<xsl:value-of select="@name"/>", </xsl:for-each></xsl:with-param></xsl:call-template>	
+			<xsl:copy>
+				<xsl:copy-of select="@*"/>
+				<xsl:apply-templates select="*"  mode="override-merge">
+					<xsl:with-param name="other" select="$other"/>
+				</xsl:apply-templates>
+	<xsl:comment>was not here</xsl:comment>
+				<xsl:apply-templates select="$other/descendant::*[@name=$self/@name and name()=name($self) and descendant-or-self::component]/*"  mode="unused-merge">
+					<xsl:with-param name="other" select="$main"/>
+				</xsl:apply-templates>
+	<xsl:comment>end not here</xsl:comment>
+			</xsl:copy>
+		</xsl:for-each>
+		<!-- if it does not already exist, create it and check all children -->
+		<xsl:if test="not($main/ancestor-or-self::sysdef/descendant::*[@name=$self/@name and name()=name($self) and descendant-or-self::component])">
+			<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">Does not already exist: <xsl:value-of select="$self/@name"/> </xsl:with-param></xsl:call-template>	
+			<xsl:copy>
+				<xsl:copy-of select="@*"/>
+				<xsl:apply-templates select="*"  mode="safe-combine">
+					<xsl:with-param name="main-root" select="$main/ancestor-or-self::sysdef"/>
+				</xsl:apply-templates>
+			</xsl:copy>			
+		</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="component[@name]" mode="append" priority="1"><xsl:param name="main"/>
+	<xsl:variable name="n" select="@name"/>
+		<!-- if $n is not in main, use this -->
+	<xsl:if test="not($main/*[@name=$n])">	
+		<xsl:copy-of select="."/>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="*[@rename or @move]" mode="append" priority="4"><xsl:param name="main"/>
+	<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">Append (4) <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>	
+	<xsl:variable name="n" select="@rename | @move"/>
+		<!-- if $n is not in main, use this -->
+	<xsl:if test="not($main/*[@name=$n])">	
+		<xsl:apply-templates select="." mode="safe-combine">
+			<xsl:with-param name="main-root" select="$main/ancestor-or-self::sysdef"/>
+		</xsl:apply-templates>	
+	</xsl:if>
+</xsl:template>
+
+<!-- merging data sources  -->
+<xsl:template match="sysdef" mode="merge">
+	<xsl:apply-templates select="document(@href)/SystemDefinition/systemModel/*" mode="merge">
+		<xsl:with-param name="extra-files" select="info|../@deps|../@ts|../layout/info[@type and document(@href,.)/values]|../layout/display|@root"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+
+<xsl:template match="SystemModelDeps" mode="merge">
+	<xsl:if test="@name or @version or @number">
+		<release><xsl:copy-of select="@name | @version | @number"/></release>
+	</xsl:if>
+</xsl:template>
+
+<!-- merge model with extra -->
+
+<xsl:template match="layer" mode="merge"><xsl:param name="extra-files"/>
+	<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>	
+	<xsl:if test="$e!=''">
+		<xsl:copy><xsl:copy-of select="@*"/> 
+			<xsl:variable name="name" select="@name"/>
+			<xsl:copy-of select="$extra-files[self::display and @name=$name]/@*[name()!='name']"/>
+			<xsl:if test="$extra-files[@type='levels']"><!-- levels hack for older models -->
+				<xsl:copy-of select="document($extra-files[@type='levels']/@href,$extra-files)//layer[@name=$name]/@*[name()='levels' or name()='span']"/>
+			</xsl:if>
+			<xsl:apply-templates select="$extra-files[@type='extra']" mode="merge-attributes">
+				<xsl:with-param name="cmp" select="."/>			
+			</xsl:apply-templates>
+			<xsl:if test="@name='Programming Support' and not(@span)"><xsl:attribute name="span">2</xsl:attribute></xsl:if> <!-- hack!!!!! -->
+			<xsl:call-template name="abbrev"/>
+		 	<xsl:apply-templates select="*" mode="merge">
+				<xsl:with-param name="extra-files" select="$extra-files"/>
+			</xsl:apply-templates>
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+
+<!-- hack for old models -->
+<xsl:template match="logicalsubset[@name='J2ME']" mode="merge" priority="5"><xsl:param name="extra-files"/>
+	<xsl:apply-templates select="*" mode="merge">
+		<xsl:with-param name="extra-files" select="$extra-files"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<!-- update old model names, these could be done as a set of templates instead.
+	I've no idea which is more efficient -->
+<xsl:template match="*" mode="item-tag">
+	<xsl:choose>
+		<xsl:when test="self::module">collection</xsl:when>
+		<xsl:when test="self::logicalset">block</xsl:when>
+		<xsl:when test="self::logicalsubset">subblock</xsl:when>
+		<xsl:otherwise><xsl:value-of select="name()"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="alt-tag"> <!-- for compatability-->
+	<xsl:choose>
+		<xsl:when test="self::collection">module</xsl:when>
+		<xsl:when test="self::block">logicalset</xsl:when>
+		<xsl:when test="self::subblock">logicalsubset</xsl:when>
+		<xsl:otherwise><xsl:value-of select="name()"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="collection|block|subblock | module|logicalset|logicalsubset" mode="merge"><xsl:param name="extra-files"/>
+	<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>
+	<xsl:if test="$e!=''">	
+		<xsl:variable name="tag"><xsl:apply-templates mode="item-tag" select="."/></xsl:variable>
+		<xsl:variable name="alt-tag"><xsl:apply-templates mode="alt-tag" select="."/></xsl:variable>
+		<xsl:element name="{$tag}">
+			<xsl:copy-of select="@*"/>
+			<xsl:variable name="name" select="@name"/>
+			<xsl:copy-of select="$extra-files[self::display and @name=$name]/@*[name()!='name']"/>		
+			<xsl:if test="not(self::logicalsubset or self::subblock) and $extra-files[@type='levels']">
+				<xsl:copy-of select="document($extra-files[@type='levels']/@href,$extra-files)//*[@name=$name and (name()=$tag or name()=$alt-tag)]/@*[starts-with(name(),'level') or name()='span']"/>
+			</xsl:if>
+			<xsl:apply-templates select="$extra-files[@type='extra']" mode="merge-attributes">
+				<xsl:with-param name="cmp" select="."/>			
+			</xsl:apply-templates>			
+			<xsl:call-template name="abbrev"/>	
+			<xsl:apply-templates select="*" mode="merge">
+				<xsl:with-param name="extra-files" select="$extra-files"/>
+			</xsl:apply-templates>	  
+		</xsl:element>
+	</xsl:if>
+</xsl:template>
+
+<!-- sched 12 -->
+
+<xsl:template match="Schedule12/*[@name]" mode="merge">
+	<s12>
+		<!-- allow multiple s12 in a component so shapes can pick the right one for the supplied version-->
+		<xsl:attribute name="ver"><xsl:value-of select="/Schedule12/@OS_version"/></xsl:attribute>
+		<xsl:apply-templates select="." mode="osd"/>
+		<xsl:copy-of select="@name"/>
+	</s12>
+</xsl:template>
+
+<xsl:template match="*" mode="osd"> <!-- CR, OS, OR, CS or anything new -->
+	<xsl:attribute name="osd"><xsl:value-of select="name()"/></xsl:attribute>
+</xsl:template>
+
+<xsl:template match="REF" mode="osd">
+	<xsl:attribute name="osd">T-R</xsl:attribute>
+	<xsl:attribute name="ref">true</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="TEST|RT" mode="osd">
+	<xsl:attribute name="osd">T-R</xsl:attribute>
+</xsl:template>
+
+<!--/sched 12 -->
+
+<!-- filters -->
+
+
+
+<xsl:template name="is-present">
+	<!-- use this for filtering if we need to use simple filtering
+		only necessary if we can't use node-set filters -->
+	<xsl:choose>
+		<xsl:when test="not($simple-filters)">1</xsl:when>
+		<xsl:otherwise>
+			<xsl:variable name="show">
+				<xsl:apply-templates select="." mode="filter-value"/>
+			</xsl:variable>
+			<!-- filter accept="..." takes precedence over "rich" filters, so if the rich filter
+				says the item is present, then we still need to check to see if it should be
+				shown via the mode="present" template	-->
+			<xsl:if test="$show='' or $show='show'">
+				<xsl:apply-templates select="." mode="present"/>
+			</xsl:if>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="component" mode="present" priority="8">
+	<xsl:variable name="e"><xsl:apply-templates select="unit|package|prebuilt" mode="present"/></xsl:variable>
+	<xsl:if test="$e!='' or not(unit|package|prebuilt)">1</xsl:if>
+</xsl:template>
+
+<xsl:template match="layer|block|subblock|collection | module|logicalset|logicalsubset" mode="present" priority="9">
+	<xsl:variable name="t" select="name()"/><xsl:variable name="n" select="@name"/>
+	<xsl:variable name="alt"><xsl:apply-templates select="." mode="alt-tag"/></xsl:variable>
+	<xsl:if test="not($ignore[(@type=$t or @type=$alt) and @name=$n])"> <!-- matches either e.g. module or colelction -->
+		<xsl:apply-templates select="descendant::component" mode="present"/>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="component[@filter]" mode="present" priority="9">
+	<!-- if there's a filter then check to see if this is filtered out -->
+	<xsl:variable name="e0"><xsl:call-template name="present"/></xsl:variable>
+	<xsl:if test="$e0!=''">
+		<xsl:variable name="e1"><xsl:apply-templates select="unit|package|prebuilt" mode="present"/></xsl:variable>
+		<xsl:if test="$e1!=''  or not(unit|package|prebuilt)">1</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="*[not(@filter)]" mode="present" priority="5">1</xsl:template> <!-- if no filter, must always be valid -->
+<xsl:template match="*[@filter]" mode="present"><xsl:call-template name="present"/></xsl:template>
+
+<xsl:template match="*[contains(@filter,',')]" mode="present">	
+	<!-- if the number of comma-separated items is the same as the number of items present, then this is present (ie we're ANDing the items)-->
+	<xsl:variable name="present"><xsl:call-template name="present-list"/></xsl:variable>
+	<xsl:if test="string-length(@filter) - string-length(translate(@filter,',','')) + 1 = string-length($present)">1</xsl:if>
+</xsl:template>	
+
+<xsl:template name="present-list"><xsl:param name="filter" select="@filter"/>
+	<xsl:call-template name="present">
+		<xsl:with-param name="filter">	<xsl:choose>
+			<xsl:when test="contains($filter,',')"><xsl:value-of select="substring-before($filter,',')"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$filter"/></xsl:otherwise>
+		</xsl:choose></xsl:with-param>
+	</xsl:call-template>
+	<xsl:if test="contains($filter,',')"><xsl:call-template name="present-list">
+		<xsl:with-param name="filter" select="substring-after($filter,',')"/>
+	</xsl:call-template></xsl:if>
+</xsl:template>
+
+<xsl:template name="present"><xsl:param name="filter" select="@filter"/>
+	<xsl:choose>
+		<xsl:when test="$filter-in=',' and $filter-nodes">1</xsl:when> <!-- accept everything -->
+		<xsl:when test="contains($filter-in,concat(',',$filter,','))">1</xsl:when> <!-- accept anything explictly on accept list -->
+		<xsl:when test="starts-with($filter,'!') and contains($filter-in,concat(',',substring($filter,2),','))"/> <!--reject if expliftly to accept a something with a "not" -->
+		<xsl:when test="starts-with($filter,'!')">1</xsl:when> <!--it's not on the must-have list, so accept it -->
+		<!-- reject otherwise -->
+	</xsl:choose>
+</xsl:template>
+<!-- node-set filters -->
+
+<xsl:template mode="filter-for-presence" match="comment() | node()" priority="-1"><xsl:copy-of select="."/></xsl:template>
+
+<xsl:template mode="filter-for-presence" match="layer|block|subblock|collection | logicalset|logicalsubset|module">
+	<xsl:variable name="t" select="name()"/>
+	<xsl:variable name="alt"><xsl:apply-templates select="." mode="alt-tag"/></xsl:variable>	<!-- for bkward compat -->
+	<xsl:variable name="n" select="@name"/>
+	<xsl:if test="not($ignore[(@type=$t or @type=$alt) and @name=$n])">
+		<xsl:variable name="content">
+			<xsl:apply-templates  select="comment() | *" mode="filter-for-presence"/>
+		</xsl:variable>
+		<xsl:if test="exslt:node-set($content)/*">
+			<xsl:copy><xsl:copy-of select="@*"/>
+				<xsl:copy-of select="$content"/>
+			</xsl:copy>
+		</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="filter" mode="filter-values"><xsl:param name="c"/>
+	<xsl:variable name="att" select="@select"/>
+	<xsl:choose>
+		<xsl:when test="not($c[self::component])"/>
+		<xsl:when test="@select='*'"> <!-- always matches -->
+				<xsl:value-of select="concat(' ',@display)"/>
+		</xsl:when>
+		<xsl:when test="not($c/@*[name()=$att] or $c/*[self::unit or self::package or self::prebuilt]/@*[name()=$att])"/> <!-- this filter does not match this component-->
+		<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'">
+			<!--  @value must be in the comma-separated list of filter on this or child-->
+			<xsl:if test="contains(concat(',',$c/@filter,',',$c/*/@filter,','),concat(',',@value,','))">
+				<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($c/@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= $c/@*[name()=$att]">
+				<xsl:value-of select="concat(' ',@display)"/>
+		</xsl:when>
+		<!--  other attributes on unit children must also match exactly -->
+		<xsl:when test="@value= $c/*/@*[name()=$att]">
+				<xsl:value-of select="concat(' ',@display)"/>
+		</xsl:when>
+	</xsl:choose>	
+</xsl:template>
+
+
+<xsl:template match="*" mode="filter-value"/> <!-- no filter value unless otherwise specified -->
+<xsl:template match="component" priority="1"  mode="filter-value"> <!-- only components can have "rich" filters, though some attributes can apply to units-->
+	<xsl:variable name="this" select="."/>
+	<xsl:call-template name="last-in-list">
+		<xsl:with-param name="str">
+			<xsl:apply-templates select="$filter-nodes" mode="filter-values">
+				<xsl:with-param name="c" select="$this"/>
+			</xsl:apply-templates>
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+<!-- this will add a display="..." attribute to the item for any display value other than
+	'hide' (which does not include the item in the output) and
+	'show' (which includes the item, but the attribtue is not needed, since it should appear like any other item) -->
+<xsl:template mode="filter-for-presence" match="component|unit|package|prebuilt" priority="1">
+	<xsl:variable name="show">
+		<xsl:apply-templates select="." mode="filter-value"/>
+	</xsl:variable>
+	<xsl:if test="$show='' or $show!='hide'">	
+		<xsl:variable name="this" select="."/>
+		<xsl:if test="not($ignore[@type=name($this) and $this/@name=@name])"> 	<!-- hide component if specifically told to ignore -->
+			<xsl:variable name="e"><xsl:apply-templates select="." mode="present"/></xsl:variable>
+			<!-- show component if any CBRs survive the filters or this is a placeholder with no content -->
+			<xsl:choose>
+				<xsl:when test="$e='' "/> <!-- filtered out, don't show -->
+				<xsl:when test="self::component">
+					<xsl:variable name="content">
+						<xsl:apply-templates  select="comment() | *" mode="filter-for-presence"/>
+					</xsl:variable>
+					<xsl:if test="exslt:node-set($content)/* or not(*)"> <!-- show all empty components -->
+						<xsl:copy><xsl:copy-of select="@*"/>
+							<xsl:if test="$show!='' and $show!='show'"><xsl:attribute name="display"><xsl:value-of select="$show"/></xsl:attribute></xsl:if>
+							<xsl:copy-of select="$content"/>
+						</xsl:copy>
+					</xsl:if>
+				</xsl:when>
+				<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+<!-- /filters -->
+
+<!-- ======= rules to merge various aux data ============== -->
+<xsl:template match="*" mode="merge-attributes"/>
+<xsl:template match="*" mode="merge-content"/>
+
+
+<xsl:template match="/values" mode="merge-attributes"><xsl:param name="cmp"/><xsl:param name="base"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<xsl:if test="$base[@type!='style' and @type!='color']"> <!-- style and colour can have any number of values, so it needs to be captured in an element -->
+			<xsl:variable name="join"><xsl:if test="$base/@type!=''">-</xsl:if></xsl:variable>
+			<xsl:variable name="value" select="key('named',$cmp/@name)[self::component]/.."/>
+			<xsl:if test="$value/@value">
+				<xsl:attribute name="generator{$join}{$base/@type}">
+					<xsl:apply-templates select="$value" mode="style-id">
+						<xsl:with-param select="$base" name="base"/>
+					</xsl:apply-templates>
+				</xsl:attribute>
+			</xsl:if>
+		</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="/values" mode="merge-content"><xsl:param name="cmp"/><xsl:param name="base"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<xsl:if test="$base[@type='style' or @type='color']"> <!-- at this point, only style and color can have multiple values -->
+			<xsl:variable name="join"><xsl:if test="$base/@type!=''">-</xsl:if></xsl:variable>
+			<xsl:variable name="value" select="key('named',$cmp/@name)[self::component]/.."/>
+			<xsl:choose>
+				<xsl:when test="$value">
+					<xsl:for-each select="$value">
+						<xsl:element name="generator{$join}{$base/@type}">
+						 	<xsl:attribute name="ref">
+								<xsl:apply-templates select="." mode="style-id">
+									<xsl:with-param select="$base" name="base"/>
+								</xsl:apply-templates>
+							</xsl:attribute>
+						</xsl:element>
+					</xsl:for-each>
+				</xsl:when>
+				<xsl:when test="@default">
+					<xsl:element name="generator{$join}{$base/@type}">
+					 	<xsl:attribute name="ref">
+							<xsl:apply-templates select="$base" mode="style-id"/>
+						</xsl:attribute>
+					</xsl:element>
+				</xsl:when>
+			</xsl:choose>
+		</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+
+<!-- unsupported proprietary format -->
+<xsl:template match="/techstreams" mode="merge-attributes"><xsl:param name="cmp"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<xsl:attribute name="ts"><xsl:value-of select="key('named',$cmp/@name)[name()='component' and not(@type)]/../@name"/></xsl:attribute>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="/techstreams" mode="merge-content"><xsl:param name="cmp"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<xsl:for-each select="key('named',$cmp/@name)[name()='component']">
+			<xsl:for-each select="self::component[not(@type)]/ancestor::group">
+				<ts-group><xsl:copy-of select="@*"/></ts-group>
+			</xsl:for-each>	
+			<xsl:for-each select="owners">
+				<xsl:copy><xsl:copy-of select="@*"/>
+					<xsl:if test="@type"><xsl:attribute name="ts"><xsl:value-of select="../../@name"/></xsl:attribute></xsl:if>
+				<xsl:copy-of select="*"/>
+				</xsl:copy>
+			</xsl:for-each>	
+		</xsl:for-each>	
+	</xsl:if>
+</xsl:template>
+
+<!-- unsupported proprietary format -->
+<xsl:template match="/attributes" mode="merge-attributes"><xsl:param name="cmp"/>
+	<xsl:for-each select="key('named',$cmp/ancestor::layer/@name)[self::layer and @inherit='yes']">
+		<xsl:copy-of select="attrs/@*"/>
+	</xsl:for-each>
+	<xsl:for-each select="key('named',$cmp/ancestor::block/@name)[self::block and @inherit='yes']">
+		<xsl:copy-of select="attrs/@*"/>
+	</xsl:for-each>
+	<xsl:for-each select="key('named',$cmp/ancestor::subblock/@name)[self::subblock and @inherit='yes']">
+		<xsl:copy-of select="attrs/@*"/>
+	</xsl:for-each>
+	<xsl:for-each select="key('named',$cmp/ancestor::collection/@name)[self::coll and @inherit='yes']">
+		<xsl:copy-of select="attrs/@*"/>
+	</xsl:for-each>
+	<xsl:for-each select="key('named',$cmp/@name)[starts-with(local-name($cmp),local-name())]">
+		<xsl:if test="not(@location) or (@location=$cmp/../@name)">
+			<xsl:copy-of select="attrs/@*"/>
+		</xsl:if>
+	</xsl:for-each>
+</xsl:template>
+<xsl:template match="/attributes" mode="merge-content"/>
+
+
+
+<xsl:template match="/model" mode="merge-attributes"><xsl:param name="cmp"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<!-- only use location if there is ambiguity -->
+		<xsl:variable name="loc">
+			<xsl:variable name="name" select="$cmp/@name"/>
+			<xsl:if test="count($cmp/ancestor::systemModel//component[@name=$name])!=1">
+				<xsl:for-each select="$cmp"><xsl:call-template name="location"/></xsl:for-each>
+			</xsl:if>
+		</xsl:variable>
+	<!--	<xsl:copy-of select="key('named',$cmp/@name)[name()='c' and ($loc='' or location=$loc)]/@*"/>-->
+		<xsl:for-each select="key('named',$cmp/@name)[name()='c' and ($loc='' or location=$loc)]/@*">
+			<xsl:copy-of select="."/>
+			<xsl:if test="name()='introduced'">   <!-- keep this while still in beta -->
+				<xsl:attribute name="since"><xsl:value-of select="."/></xsl:attribute>
+			</xsl:if>
+		</xsl:for-each>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="/model" mode="merge-content"><xsl:param name="cmp"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<xsl:variable name="loc">
+			<xsl:variable name="name" select="$cmp/@name"/>
+			<xsl:if test="count($cmp/ancestor::systemModel//component[@name=$name])!=1">
+				<xsl:for-each select="$cmp"><xsl:call-template name="location"/></xsl:for-each>
+			</xsl:if>
+		</xsl:variable>
+		<xsl:for-each select="key('named',$cmp/@name)[name()='c' and ($loc='' or location=$loc)]">
+			<xsl:copy-of select="*[name()!='location' and name()!='bld' and name()!='ts']"/>
+			<xsl:apply-templates select="bld" mode="merge"/>
+		</xsl:for-each>
+	</xsl:if>
+</xsl:template>
+	
+
+<xsl:template match="/SQL" mode="merge-content"><xsl:param name="cmp"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<xsl:variable name="loc"><xsl:for-each select="$cmp"><xsl:call-template name="location"/></xsl:for-each></xsl:variable>
+		<xsl:for-each select="//ROW[translate(component,'&AZ;','&az;')=translate($cmp/name,'&AZ;','&az;')]">
+			<xsl:variable name="match">
+				<xsl:if test="layer"><xsl:value-of select="layer"/>/</xsl:if>
+				<xsl:if test="layer"><xsl:value-of select="block"/>/</xsl:if>
+				<xsl:if test="layer"><xsl:value-of select="subblock"/>/</xsl:if>
+				<xsl:if test="layer"><xsl:value-of select="collection"/>/</xsl:if>
+			</xsl:variable>
+			<xsl:if test="$match = concat($loc,'/') or 1 "><xsl:apply-templates mode="sql" select="*"/></xsl:if>
+		</xsl:for-each>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template mode="sql" match="*"><xsl:copy-of select="."/></xsl:template>
+<xsl:template mode="sql" match="layer|block|subblock|collection|component"/>
+
+
+<xsl:template match="/Schedule12" mode="merge-content"><xsl:param name="cmp"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<xsl:variable name="match">
+			<xsl:call-template name="merge-Schedule12">
+				<xsl:with-param name="cmp" select="$cmp"/>
+			</xsl:call-template>
+		</xsl:variable>
+		<xsl:if test="$match='' ">
+			<xsl:call-template name="Caller-Warning"><xsl:with-param name="text"><xsl:value-of select="$cmp/@name"/> not in Schedule 12</xsl:with-param></xsl:call-template>
+		</xsl:if>
+		<xsl:if test="$match!='' ">
+			<xsl:apply-templates select="//system_model[$match=@entry]/.." mode="merge"/>
+		</xsl:if>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template name="merge-Schedule12"><xsl:param name="path"/><xsl:param name="cmp"/>
+	<xsl:choose>
+	<!--  match this, then try matching parents -->
+		<xsl:when test="//system_model[@entry=$cmp/@name]">
+			<xsl:value-of select="$cmp/@name"/>
+		</xsl:when>
+		<xsl:when test="$cmp/parent::*[@name]">
+			<xsl:call-template name="merge-Schedule12">
+				<xsl:with-param name="cmp" select="$cmp/parent::*"/>
+			</xsl:call-template>			
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="/LicensesFile" mode="merge-content"><xsl:param name="cmp"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<xsl:for-each select="//Supplier/Contract">
+			<xsl:variable name="n" select="@name"/>
+			<xsl:variable name="s" select="../@name"/>
+			<xsl:if test="not(following-sibling::Contract[@name=$n])">
+			<xsl:for-each select="$cmp/*[@name]"> <!-- if there is somthing without a contract use Symbian_Default -->
+				<xsl:if test="(not(@contract) and $n='Symbian_Default') or @contract=$n"><supplier name="{$s}" for="{@name}"/></xsl:if>
+			</xsl:for-each>
+			</xsl:if>
+		</xsl:for-each>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="/SystemModelDeps" mode="merge-content"><xsl:param name="cmp"/>
+	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
+		<Build>
+			<xsl:variable name="name">
+				<xsl:choose>
+					<xsl:when test="starts-with(@component,'techview_')"><xsl:message/><xsl:value-of select="substring-after(@component,'techview_')"/></xsl:when>
+					<xsl:otherwise><xsl:value-of select="@component"/></xsl:otherwise>
+				</xsl:choose>
+			</xsl:variable>
+			<xsl:apply-templates select="//Executable[$cmp/@name=@component or ($cmp/*[contains(@filter,'techview')] and concat('techview_',$cmp/@name)=@component)]"/>
+		</Build>
+	</xsl:if>
+</xsl:template>
+<!-- /aux rules -->
+
+<xsl:template match="@root" mode="merge-attributes"/>
+<xsl:template match="@root" mode="merge-content"/>
+
+<xsl:template match="@*" mode="merge-attributes"><xsl:param name="cmp"/>
+	<xsl:apply-templates mode="merge-attributes" select="document(.,/)/*">
+		<xsl:with-param name="cmp" select="$cmp"/>		
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="info[@type!='symsym']" mode="merge-attributes"><xsl:param name="cmp"/> 
+	<!-- not called for symsym snice symsym only adds components -->
+	<xsl:apply-templates mode="merge-attributes" select="document(@href,/)/*">
+		<xsl:with-param name="cmp" select="$cmp"/>
+		<xsl:with-param name="base" select="."/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="@*" mode="merge-content"><xsl:param name="cmp"/>
+	<xsl:apply-templates mode="merge-content" select="document(.,/)/*">
+		<xsl:with-param name="cmp" select="$cmp"/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="info" mode="merge-content"><xsl:param name="cmp"/>
+	<xsl:apply-templates mode="merge-content" select="document(@href,/)/*">
+		<xsl:with-param name="cmp" select="$cmp"/>		
+		<xsl:with-param name="base" select="."/>
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="info[@type='symsym']" mode="merge-content"><xsl:param name="cmp"/>
+	<xsl:variable name="filter" select="@dbfilter"/>
+	<xsl:variable name="use" select="@use"/>
+	<xsl:variable name="include" select="concat(',',@include,',')"/>
+	<SQL>
+		<xsl:for-each select="document(@href)/SQL/ROW/*[name()=$filter]">
+			<xsl:variable name="name" select="translate(.,'&AZ;','&az;')"/>
+			<xsl:if test="($use='mrp' and $cmp/*[translate(@name,'&AZ;','&az;')=$name]) or ($use='component' and translate($cmp/@name,'&AZ;','&az;')=$name)">
+			 	<xsl:for-each select="..">
+					<xsl:copy>
+						<xsl:for-each select="*">
+							<xsl:if test="$include=',,' or contains($include,concat(',',name(),','))"><xsl:copy-of select="."/></xsl:if>
+						</xsl:for-each>
+					</xsl:copy>
+				</xsl:for-each>
+			</xsl:if>
+		</xsl:for-each>
+	</SQL>
+</xsl:template>
+
+<xsl:template match="component" mode="merge"><xsl:param name="extra-files"/>
+	<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>
+	<xsl:if test="$e!=''">
+		<xsl:copy><xsl:copy-of select="@*"/>
+			<xsl:if test="$Origin-attr!='' and not(@*[local-name()=$Origin-attr]) and /SystemDefinition/@name!=''">
+				<xsl:attribute name="{$Origin-attr}">	<!-- indicate which model this came from -->
+					<xsl:value-of select="/SystemDefinition/@name"/>
+				</xsl:attribute>
+			</xsl:if>
+			<xsl:apply-templates select="$extra-files" mode="merge-attributes">
+				<xsl:with-param name="cmp" select="."/>			
+			</xsl:apply-templates>
+			<xsl:call-template name="abbrev"/>	
+			<xsl:apply-templates select="$extra-files" mode="merge-content">
+				<xsl:with-param name="cmp" select="."/>
+			</xsl:apply-templates>
+			<xsl:apply-templates select="*" mode="merge">
+				<xsl:with-param name="extra-files" select="$extra-files"/>
+			</xsl:apply-templates>	 
+		</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="component/*" mode="merge"><xsl:param name="extra-files"/>
+<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>
+<xsl:if test="$e!=''">
+		<xsl:copy><xsl:copy-of select="@*"/> <!-- only put root attribute on units with a path in them - does not make sense otherwise -->
+		<xsl:if test="not(@root) and (@mrp or @bldFile)"><xsl:copy-of select="$extra-files[name()='root']"/></xsl:if>
+		<xsl:copy-of select="node()"/>
+	</xsl:copy>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template name="abbrev">
+	<xsl:variable name="n" select="@name"/>
+	<xsl:variable name="match" select="$abbrevs[@name=$n]"/>
+	<xsl:choose>
+		<xsl:when test="not($match)"/>
+		<xsl:when test="self::techstream">
+			<xsl:attribute name="label"><xsl:value-of select="$match/@abbrev"/></xsl:attribute>
+		</xsl:when>
+	<!-- 	<xsl:when test="self::component">
+			<name><xsl:copy-of select="$match/@font|$match/../@font"/><xsl:value-of select="$match/@abbrev"/></name>
+		</xsl:when>-->
+		<xsl:otherwise><xsl:copy-of select="$match/@abbrev|$match/@font|$match/../@font"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="location">
+	<xsl:if test="../../@name"><xsl:for-each select="parent::*[@name]"><xsl:call-template name="location"/>/</xsl:for-each></xsl:if>
+	<xsl:if test="../@name"><xsl:value-of select="../@name"/></xsl:if>
+</xsl:template>
+
+<xsl:template match="Executable">
+	<Bin><xsl:copy-of select="@*[name()!='component']|*"/></Bin>
+</xsl:template>
+
+<!-- /merge model with extra -->
+
+<!-- merge logo -->
+<xsl:template match="layout/logo" mode="merge">
+	<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:template>
+
+<!-- merge legend -->
+<xsl:template match="layout/legend" mode="merge">
+	<legend-layer><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>	
+	<!-- only draw footer items if they are not referenced elsewhere in a label -->
+		<xsl:variable name="footer">
+			<xsl:for-each select="/model/@copyright|/model/@distribution">
+				<xsl:variable name="a" select="concat('@',name())"/>
+				<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:attribute name="footer"><xsl:value-of select="normalize-space($footer)"/></xsl:attribute></xsl:if>
+		<xsl:apply-templates select="*" mode="merge"/>
+	</legend-layer>
+</xsl:template>
+
+<xsl:template match="legend" mode="merge">
+	<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="merge"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="legend/note|legend/s:svg" mode="merge">
+	<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="cmp" mode="merge"><xsl:param name="model"/>
+	<xsl:copy>
+		<xsl:apply-templates select="@*" mode="generated-value">
+			<xsl:with-param name="model" select="$model"/>		
+		</xsl:apply-templates>
+		<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:copy-of select="text()"/>
+	</xsl:copy>
+</xsl:template>
+
+<!--not sure if this bit is actually used anywhere -->
+<xsl:template match="@*" mode="generated-value"/>
+<xsl:template match="@overlay|@border|@style" mode="generated-value">
+	<xsl:variable name="n" select="name()"/>
+	<xsl:variable name="v" select="."/>
+	<xsl:variable name="m" select="//*[name()=$n and @label=$v]"/>
+	<xsl:if test="count($m)">
+		<xsl:attribute name="generator-{$n}">
+			<xsl:apply-templates select="$m" mode="style-id"/>
+		</xsl:attribute>
+	</xsl:if>
+</xsl:template>
+<!--not sure if this bit is actually used anywhere -->
+<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:when test="//colors[not(*) and @match='@ts']">
+			<xsl:variable name="id"><xsl:apply-templates select="//colors[not(*) and @match='@ts']" mode="style-id"/></xsl:variable>
+			<xsl:for-each select="document($model/@ts)//techstream[@name=$v]">
+				<xsl:attribute name="generator-color"><xsl:value-of select="concat($id,'-color',count(preceding::techstream))"/></xsl:attribute>
+			</xsl:for-each>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="title" mode="merge"><xsl:copy-of select="."/></xsl:template>
+<xsl:template match="ts" mode="merge"><cbox><xsl:copy-of select="@*|node()"/></cbox></xsl:template>
+
+<xsl:template match="legend[s:g]" mode="merge">
+<xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template match="legend" mode="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="merge">
+	
+	<!-- 	$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]">
+				<legend>
+					<xsl:apply-templates select="$this" mode="copy"/>
+					<xsl:apply-templates select="." mode="merge">
+						<xsl:with-param name="model" select="$model"/>
+						<xsl:with-param name="legend" select="$legend"/>
+					</xsl:apply-templates>
+				</legend>
+			</xsl:for-each>
+		</xsl:when>
+		<xsl:when test="$tag!=''">
+			<xsl:for-each select="document($file,/)/*/*[name()=$tag]">
+				<legend>
+					<xsl:apply-templates select="$this" mode="copy"/>
+					<xsl:apply-templates select="." mode="merge">
+						<xsl:with-param name="model" select="$model"/>
+						<xsl:with-param name="legend" select="$legend"/>
+					</xsl:apply-templates>
+				</legend>			
+			</xsl:for-each>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:for-each select="document($file,/)/*">
+				<legend>
+					<xsl:apply-templates select="$this" mode="copy"/>
+					<xsl:apply-templates select="." mode="merge">
+						<xsl:with-param name="model" select="$model"/>
+						<xsl:with-param name="legend" select="$legend"/>
+					</xsl:apply-templates>
+				</legend>			
+			</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="merge">
+	<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="merge"/>
+
+<!-- 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="ref" priority="1"><xsl:value-of select="@type"/></xsl:template>
+
+<!-- Borders in legend -->
+
+<xsl:template match="border" mode="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>
+
+<xsl:template match="color[../@type='highlight' or ../@type='text-highlight']" mode="ref">
+	<xsl:value-of select="concat('#',../@type,count(preceding::color[../@type]))"/>
+</xsl:template>
+
+<!-- Colours in legend -->
+
+<xsl:template match="/shapes/colors/color[not(@value|@label)]" mode="merge" 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="merge"><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="merge">
+					<xsl:sort select="@label"/>
+					<xsl:with-param name="model" select="$model"/>
+				</xsl:apply-templates>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:apply-templates mode="merge"><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="merge">
+	<xsl:variable name="tag" select="name()"/>
+
+	
+	<xsl:choose>
+		<xsl:when test="count(//*[name()=$tag]) != 1">
+			<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>
+			</legend>
+		</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="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="merge"/> <!--  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="examples/cmp" mode="merge"><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="merge"><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>
+
+<!-- /merge legend -->
+
+<!-- new experimetal 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="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="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/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}" detail="component">
+		<xsl:copy-of select="@type | @show-unused"/>
+		<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 match="/shapes/colors[not(@type) or @type='background']" mode="styling"><xsl:param name="model"/>
+	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
+	<group type="color" style-id="{$id}">
+		<xsl:copy-of select="@default"/>
+		<xsl:call-template name="lgd-group-detail"/>
+		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>			
+		<xsl:choose>
+		<xsl:when test="not(*) and @match='@ts' and $model">
+			<xsl:apply-templates select="document($model/@ts,$model)/*" mode="styling">
+				<xsl:with-param name="id" select="$id"/>
+			</xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates mode="styling"><xsl:with-param name="id" select="$id"/></xsl:apply-templates>
+		</xsl:otherwise>
+		</xsl:choose>
+	</group>
+</xsl:template>
+
+<xsl:template name="lgd-group-detail">
+	<xsl:choose>
+		<xsl:when test="self::borders or self::patterns or  not(@match)"><xsl:attribute name="detail">component</xsl:attribute></xsl:when>
+		<xsl:when test="@match='component' or @match='collection' or @match='block' or @match='subblock' or @match='layer'">
+			<xsl:attribute name="detail"><xsl:value-of select="@match"/></xsl:attribute>
+		</xsl:when>
+	</xsl:choose>
+</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="/shapes/colors[@type='highlight' or @type='text-highlight']" mode="styling"><xsl:param name="model"/>
+	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
+	<group type="{@type}" style-id="{$id}">
+		<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/borders|/shapes/patterns|/shapes/styles" 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: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,'{')">
+			<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="ref"/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:attribute>
+	</xsl:element>
+</xsl:template>
+
+<xsl:template match="/techstreams" mode="styling">
+	<xsl:param name="id"/>
+	<xsl:for-each select="//techstream">
+		<cbox value="{@color}" lookup="{@name}" style-id="{$id}-color{count(preceding::techstream)}" detail="component">
+			<xsl:variable name="n" select="@name"/>
+			<xsl:variable name="match" select="$abbrevs[@name=$n]"/>
+			<xsl:if test="$match">
+				<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:if>
+		</cbox>
+	</xsl:for-each>
+</xsl:template>
+
+<!-- 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:include href="draw.xsl"/>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/ModelTemplate.mid.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<model name="___NAME___" label="___LABEL___"
+	___OPTIONAL___
+	 shapes="___SHAPES_XML___" >
+	 ___SYSTEM_DEFINITIONS___
+	 ___FILTERS___
+	 ___IGNORE___
+<layout___LAYOUT_OPTIONS___>
+	<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>
+	___DISPLAY___
+	<legend label="Key"___LEGEND_OPTIONS___>
+	___LEGEND___
+	</legend>
+</layout>
+</model>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/ModelTemplate.older.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<model name="___NAME___" label="___LABEL___"
+	___OPTIONAL___
+	 shapes="___SHAPES_XML___" >
+	 ___SYSTEM_DEFINITIONS___
+	 ___FILTERS___
+	 ___IGNORE___
+<layout___LAYOUT_OPTIONS___>
+	<display name="UI Framework" align="right"/>
+	<display name="Application Services" align="left"/>
+	___DISPLAY___
+	<legend label="Key"___LEGEND_OPTIONS___>
+	___LEGEND___
+	</legend>
+</layout>
+</model>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/ModelTemplate.xml	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<model name="___NAME___" label="___LABEL___"
+	___OPTIONAL___
+	 shapes="___SHAPES_XML___" >
+	 ___SYSTEM_DEFINITIONS___
+	 ___FILTERS___
+	 ___IGNORE___
+<layout___LAYOUT_OPTIONS___>
+	<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>
+	___DISPLAY___
+	<legend label="Key"___LEGEND_OPTIONS___>
+	___LEGEND___
+	</legend>
+</layout>
+</model>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/Overlay.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,331 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:doc="tooldoc"  xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+	<xsl:output method="xml"/>
+	<xsl:param name="Data" doc:desc="The data to be overlayed onto the SVG mode"/>
+	<xsl:param name="Prefix" doc:desc="The prefix for the ID, in case the plain ID is already taken"><xsl:apply-templates select="/" mode="my-prefix"/></xsl:param>
+	<xsl:param name="Event" doc:desc="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:apply-templates select="/" mode="my-event"/></xsl:param>
+	 <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-prefix"/>	<!-- no 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"/>1</xsl:template> <!-- always present by default -->
+
+<xsl:template match="/" mode="my-valid-items">component collection block subblock 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]" 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='block' or @class='subblock' 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="@class='component'"><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="@class='component'"><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="@class='component'"><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/src/old/svg/Postprocess.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,321 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:doc="tooldoc"  xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+	<xsl:import href="overlay.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|subblock|block" use="translate(@name,' ','')"/>
+
+<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>
+			<xsl:when test="not(/SystemDefinition/systemModel/@detail-type='fixed')"><xsl:if test="self::component">1</xsl:if></xsl:when>  
+			<xsl:when test="name()=/SystemDefinition/systemModel/@detail">1</xsl:when>
+			<xsl:when test="/SystemDefinition/systemModel/@detail='subblock' and self::block and not(subblock)">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" dominant-baseline="mathematical" class="label" x="3" y="3" width="5">Uses</s:text>
+	<s:text text-anchor="end" dominant-baseline="mathematical" 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"/>
+ </xsl:template>
+
+<xsl:template match="*" mode="my-defs">
+	<xsl:variable name="width">
+			<xsl:choose>
+			<xsl:when test="/SystemDefinition/systemModel/@detail='layer'">4.8</xsl:when>
+			<xsl:when test="/SystemDefinition/systemModel/@detail='block'">2.4</xsl:when>
+			<xsl:when test="/SystemDefinition/systemModel/@detail='subblock'">1.2</xsl:when>
+			<xsl:when test="/SystemDefinition/systemModel/@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: <xsl:value-of select="$width"/>px;
+	}
+	path.arrowF {
+		marker-start: url(#TriangleF);
+		fill:none;stroke: blue;
+		stroke-width: <xsl:value-of select="$width"/>px;		
+	}
+</s:style>
+  </s:defs>
+</xsl:template>
+
+
+<xsl:template match="component|collection|block|subblock|layer" mode="id"><xsl:value-of select="translate(@name,' ','')"/></xsl:template>
+<xsl:template mode="owner" match="dep">
+	<xsl:for-each select="key('Using',@name)">
+		<xsl:choose>
+			<xsl:when test="/SystemDefinition/systemModel/@detail='layer'"><xsl:apply-templates select="ancestor::layer" mode="id"/></xsl:when>
+			<xsl:when test="/SystemDefinition/systemModel/@detail='block'"><xsl:apply-templates select="ancestor::block" mode="id"/></xsl:when>
+			<xsl:when test="/SystemDefinition/systemModel/@detail='subblock' and ancestor::subblock"><xsl:apply-templates select="ancestor::subblock" mode="id"/></xsl:when>
+			<xsl:when test="/SystemDefinition/systemModel/@detail='subblock'"><xsl:apply-templates select="ancestor::block" mode="id"/></xsl:when>
+			<xsl:when test="/SystemDefinition/systemModel/@detail='collection'"><xsl:apply-templates select="../../.." mode="id"/></xsl:when>
+			<xsl:otherwise><xsl:apply-templates select="../.." mode="id"/></xsl:otherwise>
+		</xsl:choose>
+	<xsl:text> </xsl:text>
+	</xsl:for-each>
+</xsl:template>
+
+ <xsl:template match="/SystemDefinition" mode="deps"><xsl:param name="id"/>
+ 	<xsl:for-each select="key('Id',$id)/descendant-or-self::component/Build/Bin/dep">
+		<xsl:apply-templates select="." mode="owner"/>
+	</xsl:for-each>
+ </xsl:template>
+ 
+ <xsl:template match="/SystemDefinition" mode="used"><xsl:param name="id"/>
+	<xsl:for-each select="key('Id',$id)/descendant-or-self::component/Build/Bin">
+		<xsl:for-each select="key('Used-by',@name)/../../..">
+			<xsl:choose>
+				<xsl:when test="/SystemDefinition/systemModel/@detail='layer'"><xsl:apply-templates select="ancestor::layer" mode="id"/></xsl:when>
+				<xsl:when test="/SystemDefinition/systemModel/@detail='block'"><xsl:apply-templates select="ancestor::block" mode="id"/></xsl:when>
+				<xsl:when test="/SystemDefinition/systemModel/@detail='subblock' and ancestor::subblock"><xsl:apply-templates select="ancestor::subblock" mode="id"/></xsl:when>
+				<xsl:when test="/SystemDefinition/systemModel/@detail='subblock'"><xsl:apply-templates select="ancestor::block" mode="id"/></xsl:when>
+				<xsl:when test="/SystemDefinition/systemModel/@detail='collection'"><xsl:apply-templates select=".." mode="id"/></xsl:when>
+				<xsl:otherwise><xsl:apply-templates select="." mode="id"/></xsl:otherwise>
+			</xsl:choose>
+			<xsl:text> </xsl:text>
+		</xsl:for-each>
+	</xsl:for-each>
+ </xsl:template>
+ 
+ 
+ 
+ <xsl:template match="s:g" mode="my-overlay"><xsl:param name="id"/>
+	<xsl:variable name="libs">	
+		<xsl:apply-templates select="document($Data,/)/*" mode="deps">
+			<xsl:with-param name="id" select="$id"/>		
+		</xsl:apply-templates>
+	</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:if test="$libs!=''">
+		<xsl:call-template name="lines">
+			<xsl:with-param name="origin" select="$pos"/>
+			<xsl:with-param name="from" select="$id"/>
+			<xsl:with-param name="height" select="$h"/>
+			<xsl:with-param name="list" select="$libs"/>
+			<xsl:with-param name="class" select="'arrow'"/>
+		</xsl:call-template>
+	</xsl:if>
+	<xsl:variable name="used">	
+		<xsl:apply-templates select="document($Data,/)/*" mode="used">
+			<xsl:with-param name="id" select="$id"/>		
+		</xsl:apply-templates>
+	</xsl:variable>		
+	<xsl:if test="$used!=''">
+		<xsl:call-template name="lines">
+			<xsl:with-param name="origin" select="$pos"/>
+			<xsl:with-param name="from" select="$id"/>
+			<xsl:with-param name="height" select="$h"/>
+			<xsl:with-param name="list" select="$used"/>
+			<xsl:with-param name="class" select="'arrowF'"/>
+		</xsl:call-template>
+	</xsl:if>
+ </xsl:template>
+ 
+<!-- drawing lines follows -->
+
+<xsl:template name="lines"><xsl:param name="list"/><xsl:param name="from"/><xsl:param name="height"/><xsl:param name="origin"/><xsl:param name="class"/>
+	<xsl:variable name="id" select="substring-before($list,' ')"/>
+	<xsl:variable name="next"><xsl:value-of select="substring-after($list,' ')"/></xsl:variable>	
+	<xsl:if test="not(contains(concat(' ',$next),concat(' ',$id,' '))) and $id!=$from and $id!=''">
+		<xsl:call-template name="draw-line">
+			<xsl:with-param name="class" select="$class"/>
+			<xsl:with-param name="h0" select="$height"/>
+			<xsl:with-param name="origin" select="$origin"/>
+			<xsl:with-param name="end"><xsl:apply-templates select="key('id',$id)" mode="item-pos"/></xsl:with-param>
+			<xsl:with-param name="h1"><xsl:apply-templates select="key('id',$id)" mode="height"/></xsl:with-param>
+		</xsl:call-template>
+	</xsl:if>
+	<xsl:if test="$next!=''"><xsl:call-template name="lines">
+		<xsl:with-param name="list" select="$next"/>
+		<xsl:with-param name="origin" select="$origin"/>
+		<xsl:with-param name="height" select="$height"/>
+		<xsl:with-param name="from" select="$from"/>		
+		<xsl:with-param name="class" select="$class"/>		
+	</xsl:call-template></xsl:if>	
+</xsl:template>
+
+ 
+ <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: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: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: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* $Size)) or ($dy &lt;= 0 and ($dx * $h0 &gt;= -$dy* $Size)))">
+							<!-- crop against E side of origin  -->
+							<xsl:variable name="y-off" select="$Size * 0.5 * $dy div $dx "/>
+							<xsl:value-of select="concat($x0 + 0.5 * $Size,',',$y0 + $y-off)"/>
+						</xsl:when>	
+						<xsl:when test="$dy &gt; 0 and (($dx &gt;= 0 and $dx * $h0 &lt; $dy * $Size) or ($dx &lt;= 0 and -$dx * $h0 &lt; $dy* $Size))"> <!-- 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* $Size) or ($dx &lt;= 0 and -$dx * $h0 &lt; -$dy* $Size))">
+							<!-- 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=" - $Size * 0.5 * $dy div $dx "/>
+							 <xsl:value-of select="concat($x0 - 0.5 * $Size,',',$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* $Size)) or ($dy &lt;= 0 and ($dx * $h1 &gt;= -$dy* $Size)))">
+							<!-- crop against W side of end  -->
+							<xsl:value-of select="concat($x1 - 0.5 * $Size,',',$y0 + ($dx - 0.5 * $Size) * $dy div $dx)"/>
+						</xsl:when>	
+						<xsl:when test="$dy &gt; 0 and (($dx &gt;= 0 and $dx * $h1 &lt; $dy * $Size) or ($dx &lt;= 0 and -$dx * $h1 &lt; $dy* $Size))"> <!-- 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* $Size) or ($dx &lt;= 0 and -$dx * $h1 &lt; -$dy* $Size))">
+							<!-- 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 * $Size,',',$y0 + ($dx + 0.5 * $Size) * $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: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 * $Size * $Size 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:value-of select="concat(($dx   -  $x-off * 2) div 3 , ', ', $peak,' ',$dx  -  $x-off * 2 ,',', 2 * $peak, ' ',$dx -  $x-off * 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: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*$Size)"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="$x0 - (0.5*$Size)"/></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 * $Size + ($sgn * $dy div 8))"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="- $sgn * (0.5 * $Size + ($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/src/old/svg/Shapes.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,834 @@
+<?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" xmlns:doc="tooldoc">
+  	<xsl:output method="xml" indent="yes"/>
+	<xsl:param name="Model-Transform" select="'model.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 match="/model"> 
+	<a:stylesheet version="1.0" exclude-result-prefixes="doc 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 -->
+				<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 -->
+			<!-- 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 -->
+				<a:template match="component[not(@generator-overlay)]|cmp[not(@generator-overlay)]" mode="shape">
+					<xsl:if test="not(starts-with(.,'#'))">#Pattern</xsl:if>
+					<xsl:value-of select="."/>
+				</a:template>
+			</xsl:for-each>
+		</xsl:if>
+
+		<xsl:if test="$color">
+			<xsl:for-each select="document($color/@href,$color)/values/@default">
+				<a:template match="component[not(@generator-color|generator-color)] | cmp[not(@generator-color|generator-color)]" mode="display-style-color">
+					<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 more default styles -->
+		</xsl:if>
+		
+		<xsl:if test="not(document(@shapes)/shapes/patterns)">
+		<a:template match="component|cmp" mode="overlay-style" priority="-1">fill: none; stroke: none; stroke-width: 0;</a:template>
+			 <!-- no rule-based patterns -->
+		</xsl:if>
+		
+	
+	<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>
+
+		 <!-- 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(/*/systemModel) and @label"><a:value-of select="@label"/></a:if>
+		<a:if test="not(/*/systemModel) 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="/*/systemModel">
+			<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')]">
+						<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-eval" match="*"><xsl:param name="abbrevs"/>
+	<a:when>
+		<xsl:attribute name="test">$id='<xsl:apply-templates select="." mode="style-id"/>'</xsl:attribute>
+		<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>
+	</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]"/>
+	<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 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:when test="self::colors[@match='@ts']">
+					<a:key name="use-{$id}" match="component" use="@ts"/>
+				</xsl:when>
+			</xsl:choose>
+		</xsl:if>
+	</xsl:for-each>
+
+	<xsl:if test="not($borders)"> <!-- borders must be defined in the shapes.xml -->
+		<xsl:apply-templates select="borders"/>
+	</xsl:if>
+
+	<xsl:choose> <!-- only background colours can be defined in $color -->
+		<xsl:when test="not($color)">
+			<xsl:apply-templates select="colors"/>
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates select="colors[@type and @type!='background']"/>
+		</xsl:otherwise>
+	</xsl:choose>
+
+	<xsl:if test="not($overlay)">
+		<xsl:apply-templates select="patterns"/>
+	</xsl:if>
+
+
+<!-- concatenate all default styles for legend items -->
+  <a:template match="cmp[not(@generated-style) and not(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"/>
+	
+	<!-- 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') 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: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>
+
+<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="replace-function"><xsl:param name="text" select="."/>
+	<xsl:param name="function" select="'VERSION'"/>
+	<xsl:param name="before">string-length(substring-before(concat(' ',$Versions,' '),(</xsl:param>
+	<xsl:param name="after">)))</xsl:param>
+	<xsl:param name="default">/SystemDefinition/systemModel/@ver</xsl:param>
+	<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" select="substring($r,1,$len)"/>
+				<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="$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: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:call-template>
+	</xsl:variable>
+	<xsl:variable name="fixed">
+		<xsl:call-template name="replace-function">
+			<xsl:with-param name="text" select="$fixed1"/>
+			<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:call-template>
+	</xsl:variable>
+	<!--  this next bit is deprecated: remove soon -->
+	<xsl:choose>
+		<xsl:when test="contains($fixed,'$variable')">
+			<xsl:value-of select="substring-before($fixed,'$variable')"/>$<xsl:apply-templates select=".." mode="varname"/>
+			<xsl:apply-templates select="."><xsl:with-param name="text" select="substring-after($fixed,'$variable')"/></xsl:apply-templates>
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$fixed"/></xsl:otherwise>
+	</xsl:choose>
+</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:param name="use" select="@use"/>
+  <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 or (not(*) and @match='@ts')">
+<!--    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>
+			<xsl:variable name="use">
+				<xsl:choose>
+					<xsl:when test="not(*) and @match='@ts'"><!-- ts hack -->
+						<xsl:value-of select="@match" />
+					</xsl:when>
+					<xsl:otherwise><xsl:value-of select="@use"/></xsl:otherwise>
+	 			</xsl:choose>
+			</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:when test="not(*) and @match='@ts'">
+                  <xsl:call-template name="color-select">
+                    <xsl:with-param name="default" select="$default-color"/>
+                    <xsl:with-param name="use" select="@match"/>
+                  </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($Static)">
+		<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-style">
+	 	<xsl:call-template name="match-syntax"/>
+		<xsl:call-template name="declare-vars"/>	
+		<a:variable name="fill">
+			<a:choose>
+				<xsl:for-each select="overlay">
+					<a:when>
+						<xsl:attribute name="test">
+							<xsl:apply-templates select="." mode="when-test"/>
+						</xsl:attribute>url(#<xsl:apply-templates mode="id" select="."/>)</a:when>
+				</xsl:for-each>
+			</a:choose>
+		</a:variable>
+
+		<a:if test="$fill !='' ">
+			<a:text>fill:</a:text>
+			<a:value-of select="$fill"/>
+			<a:text>; stroke: none; stroke-width: 0;</a:text>
+		</a:if>
+	</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) or @match='@ts'"><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'"><xsl:attribute name="match">block</xsl:attribute></xsl:when>
+			<xsl:when test="@match='logicalsubset'"><xsl:attribute name="match">subblock</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="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/src/old/svg/output-csv.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,125 @@
+<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,block,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">module,layer,block,subblock,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)">Module,Layer,Block,Sub-block,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/@* | //block/@*| //subblock/@*| //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="@name" 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" 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::*[self::block or self::subblock][1]" mode="name"/></when>
+		<when test="$a='layer'"><apply-templates select="ancestor::layer" mode="name"/></when>
+		<when test="$a='block'"><apply-templates select="ancestor::block" mode="name"/></when>
+		<when test="$a='subblock'"><apply-templates select="ancestor::subblock" 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'">"<value-of select="ancestor-or-self::*/@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::block/@levels"/>"</when>
+		<when test="$a='layer-levels'">"<value-of select="ancestor-or-self::layer/@levels"/>"</when>
+		<when test="$a='block-level'"><value-of select="ancestor-or-self::block/@level"/></when>
+		<when test="$a='long-name'"><apply-templates mode="name" select="@long-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::subblock/@*[name()=$a]"><apply-templates select="ancestor::subblock/@*[name()=$a]" mode="name"/></when>
+		<when test="ancestor::block/@*[name()=$a]"><apply-templates select="ancestor::block/@*[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/src/old/svg/output-sysdef.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,48 @@
+<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:template match="component|component/*">
+	<xsl:copy>
+		<xsl:apply-templates select="@*|node()"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="component/*/* | @*"> <!-- no rules, so just copy -->
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template match="@mrp|@bldFile">
+	<xsl:attribute name="{name()}">
+		<xsl:value-of select="translate(.,'\','/')"/>
+	</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="@schema[starts-with(.,'1.')]">
+	<xsl:attribute name="{name()}">2.0.0</xsl:attribute> <!-- upgrade syntax -->
+</xsl:template>
+
+<xsl:template match="@abbrev|@generator-border|@generator-overlay|@align"/>
+
+<xsl:template match="generator-color|generator-style|component/text()" priority="1"/>
+
+<xsl:template match="layer|block|subblock|collection">
+	<xsl:copy>
+		<xsl:apply-templates select="@*"/>
+		<xsl:apply-templates select="*"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="SystemDefinition">
+	<xsl:copy>
+		<xsl:apply-templates select="@name|@schema"/>
+		<xsl:apply-templates select="systemModel"/>
+	</xsl:copy>
+</xsl:template>
+
+<xsl:template match="systemModel">
+	<xsl:copy><xsl:apply-templates select="layer"/></xsl:copy>
+</xsl:template>
+
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/sysdefdowngrade.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,376 @@
+<?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:param name="Path">os/deviceplatformrelease/foundation_system/system_model</xsl:param>
+	<!-- $Path is the location of the root system definition XML file. Must not end in /
+		This is used to compute the absolute paths the 2.0 syntax needs-->
+	<xsl:param name="Root"/> <!-- space separated list of root variables in the form "VAR1=value1 VAR=value2" --> 
+	<xsl:variable name="root" select="concat(' ',$Root,' ')"/> <!-- sort of hack to allow absolute paths in downgraded output -->
+	<xsl:variable name="srcroot" select="substring-before(substring-after($root,' SRCROOT='),' ')"/> <!-- the default path prefix -->
+
+<xsl:template match="/*">
+	<xsl:message terminate="yes">Cannot process this document</xsl:message>
+</xsl:template>
+
+<!-- can only handle 3.0.0 to 2.0.1 transforms
+	Assumes only packages are using href
+ -->
+<xsl:template match="/SystemDefinition[@schema='3.0.0']"> 
+	<!-- process root system definition or package definition-->
+	<xsl:call-template name="DTD"/> <!-- insert 2.0.01 DTD -->
+  <SystemDefinition name="{*/@name}" schema="2.0.1">
+  	<xsl:apply-templates select="*|comment()"/>
+  </SystemDefinition>
+</xsl:template>
+
+<xsl:template match="/SystemDefinition[@schema='3.0.0' and systemModel]"> 
+	<xsl:call-template name="DTD"/> <!-- insert 2.0.01 DTD -->
+  <SystemDefinition name="{systemModel/@name}" schema="2.0.1">
+  	<xsl:apply-templates select="*|comment()"/>
+  </SystemDefinition>
+</xsl:template>
+
+<xsl:template match="/SystemDefinition/package[@href]" priority="2">
+	<xsl:message terminate="yes">Package definition cannot link another package</xsl:message>
+</xsl:template>
+
+<xsl:template match="/SystemDefinition/package" priority="1">
+	<!-- process package definition file--> 
+  <systemModel>
+  	<layer name="anonymous"> <!-- fake layer -->
+		<block>
+			<xsl:apply-templates mode="copy" select="@id|@name|@span|@level|@levels"/><!--  valid attribuites for 2.0 -->
+		  	<xsl:apply-templates select="*|comment()">
+		  		<xsl:with-param name="path" select="concat($Path,'/')"/> <!-- need to keep tack of where the current document is -->
+		  	</xsl:apply-templates>			
+		</block>  
+   	</layer>
+  </systemModel>
+</xsl:template>
+
+
+
+<xsl:template match="/"><xsl:apply-templates select="*"/></xsl:template>
+<xsl:template match="@*|comment()"><xsl:copy-of select="."/></xsl:template> 
+	<!-- comments are copied verbatim. Attribtues are copied by default -->
+
+<xsl:template match="systemModel">
+	<systemModel>
+  	<xsl:apply-templates select="*|comment()"> <!-- no attributes -->
+  		<xsl:with-param name="path" select="$Path"/> <!-- need to keep tack of where the current document is -->
+  	</xsl:apply-templates>
+	</systemModel>
+</xsl:template>
+
+<xsl:template mode="copy" match="@*">
+	<xsl:copy-of select="."/>
+</xsl:template>
+
+<xsl:template mode="copy" match="@id"> <!-- id in 3.0 is name in 2.0 -->
+	<xsl:attribute name="name"><xsl:value-of select="."/></xsl:attribute>
+</xsl:template>
+
+<xsl:template mode="copy" match="@name">  <!-- name in 3.0 is long-name in 2.0.1 -->
+	<xsl:if test=".!=../@id"> <!-- don't bother if it will be the same as name -->
+		<xsl:attribute name="long-name"><xsl:value-of select="."/></xsl:attribute>
+	</xsl:if>
+</xsl:template>
+	
+<xsl:template match="layer"><xsl:param name="path"/>
+	<layer>
+		<xsl:apply-templates mode="copy" select="@id|@name|@span|@levels"/> <!--  valid attribuites for 2.0 -->
+		<xsl:apply-templates select="*|comment()"> 
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+	</layer>
+</xsl:template>
+
+<xsl:template match="layer/package"><!-- translates to block -->
+	<xsl:param name="path"/>
+	<block>
+		<xsl:apply-templates mode="copy" select="@id|@name|@span|@level|@levels"/><!--  valid attribuites for 2.0 -->
+		<xsl:choose>
+			<xsl:when test="@href">
+				<xsl:variable name="this" select="."/>
+				<xsl:for-each select="document(@href,.)/SystemDefinition/*">
+					<xsl:variable name="my-id"><xsl:apply-templates mode="normalize-id" select="@id"/></xsl:variable>
+					<xsl:variable name="other-id"><xsl:apply-templates mode="normalize-id" select="$this/@id"/></xsl:variable>
+					<xsl:if test="$my-id != $other-id">
+						<xsl:message terminate="yes">Error: IDs do not match: <xsl:value-of select="$my-id"/> vs <xsl:value-of select="$other-id"/></xsl:message>
+					</xsl:if>
+					<xsl:if test="@name and @name!=@id and not($this/@name and $this/@name=$this/@id)">
+						<!-- set long-name only if name is different from the id and not set in child doc -->
+						<xsl:attribute name="long-name"><xsl:value-of select="@name"/></xsl:attribute>
+					</xsl:if>						
+					<xsl:for-each select="@span|@levels|@level">
+						<!-- copy only if not set in child doc -->
+						<xsl:if test="not(this/@*[name()=name(current())])">
+							<xsl:copy-of select="."/>
+						</xsl:if>
+					</xsl:for-each>
+					<xsl:apply-templates select="*|comment()">
+	  					<xsl:with-param name="path">
+	  						<xsl:call-template name="normpath">
+	  							<xsl:with-param name="path" select="concat($path,'/',$this/@href)"/>
+	  						</xsl:call-template>
+	  					</xsl:with-param> 
+	  				</xsl:apply-templates>
+				</xsl:for-each>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:apply-templates select="*|comment()">
+  					<xsl:with-param name="path" select="$path"/> 
+  				</xsl:apply-templates>
+			</xsl:otherwise>
+		</xsl:choose>
+	</block>
+</xsl:template>
+
+<xsl:template match="package/package">	<!-- translates to subblock --><xsl:param name="path"/>
+	<subblock>
+		<xsl:apply-templates mode="copy" select="@id|@name"/>
+		<xsl:apply-templates select="*|comment()">
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+	</subblock>
+</xsl:template>
+
+<xsl:template match="package/package/pacakge"> <!-- cannot nest this deep --><xsl:param name="path"/>
+	<xsl:message>Excessive nesting of packages: Ignoring <xsl:value-of select="@id"/></xsl:message>
+	<xsl:apply-templates select="*|comment()">
+		<xsl:with-param name="path" select="$path"/> 
+	</xsl:apply-templates>
+</xsl:template>
+
+
+<xsl:template match="collection"><xsl:param name="path"/>
+	<collection>
+		<xsl:apply-templates mode="copy" select="@id|@name|@level"/>
+		<xsl:apply-templates select="*|comment()">
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+	</collection>
+</xsl:template>
+
+
+<xsl:template match="component"><xsl:param name="path"/>
+	<component>
+		<xsl:apply-templates mode="copy" select="@id|@name|@deprecated|@introduced|@filter|@purpose"/>
+		<xsl:if test="contains(concat(' ',@class,' '),' plugin ')">
+			<xsl:attribute name="plugin">Y</xsl:attribute>
+		</xsl:if>
+		<xsl:call-template name="class">
+			<xsl:with-param name="remove">plugin</xsl:with-param>
+			<xsl:with-param name="add">
+				<xsl:if test="not(*) and comment()">placeholder</xsl:if>
+				<xsl:if test="@target='desktop'"> PC</xsl:if>
+			</xsl:with-param>
+		</xsl:call-template>
+	  	<xsl:apply-templates select="*|comment()">
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+	</component>
+</xsl:template>
+
+<xsl:template match="unit[@base and not(@mrp or @bldFile)]"/>
+
+<xsl:template match="unit"><xsl:param name="path"/>
+	<unit>
+		<xsl:apply-templates select="@mrp|@bldFile|@late">
+			<xsl:with-param name="path" select="$path"/> 
+		</xsl:apply-templates>
+		<xsl:copy-of select="@filter|@root[not(contains($root,concat(' ',.,'=')))]|@version|@prebuilt|@priority"/>
+	</unit>
+</xsl:template>
+
+<xsl:template match="unit/@late"> <!-- 2.0 uses Y/N, 3.0 uses yes/no -->
+	<xsl:attribute name="{name()}">
+		<xsl:choose>
+			<xsl:when test=".='yes'">Y</xsl:when>
+			<xsl:when test=".='no'">N</xsl:when>
+		</xsl:choose>
+	</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="@mrp|@bldFile"><xsl:param name="path"/>
+	<xsl:attribute name="{name()}">
+		<xsl:choose>
+			<xsl:when test="../@root">
+				<xsl:variable name="pre" select="substring-before(substring-after($root,concat(' ',../@root,'=')),' ')"/>
+				<xsl:if test="$pre!=''"><xsl:value-of select="concat($pre,'/')"/></xsl:if>
+			</xsl:when>
+			<xsl:when test="$srcroot!=''">
+				<xsl:value-of select="concat($srcroot,'/')"/>
+			</xsl:when>
+		</xsl:choose>
+		<xsl:choose>
+		<xsl:when test="starts-with(.,'/')"> <!-- keep absolute paths verbatim (barring the leading / ) -->
+			<xsl:value-of select="substring-after(.,'/')"/>
+		</xsl:when>
+		<xsl:otherwise>	
+			<xsl:call-template name="normpath">
+  				<xsl:with-param name="path">
+  					<xsl:call-template name="before">
+						<xsl:with-param name="text" select="$path"/>
+					</xsl:call-template>
+					<xsl:value-of select="."/>
+  				</xsl:with-param>
+  			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+	</xsl:attribute>
+</xsl:template>
+
+<xsl:template match="meta"/> <!-- strip all meta tags -->
+
+<xsl:template match="meta[info/@contract]"> <!-- except contract -->
+	<xsl:copy-of select="info/@contract"/>
+</xsl:template>
+
+<xsl:template match="@id" mode="normalize-id">
+	<xsl:choose>
+		<xsl:when test="contains(@id,':')"><xsl:value-of select="substring-after(@id,':')"/></xsl:when>
+		<xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="class"><xsl:param name="remove"/><xsl:param name="add"/>
+<!--  returns the value of the class attribute with the space-separated list of names in $remove taken out and those in $add added on (does not check for duplicates) -->
+	<xsl:param name="class" select="normalize-space(@class)"/>
+	<xsl:variable name="r">
+		<xsl:text> </xsl:text>
+		<xsl:choose>
+			<xsl:when test="contains($remove,' ')"><xsl:value-of select="substring-before($remove,' ')"/></xsl:when>
+			<xsl:otherwise><xsl:value-of select="$remove"/></xsl:otherwise>
+		</xsl:choose>
+		<xsl:text> </xsl:text>
+	</xsl:variable>
+	<xsl:variable name="c">
+		<xsl:choose>
+			<xsl:when test="contains(concat(' ',$class,' '),$r)">
+				<xsl:value-of select="substring-before(concat(' ',$class,' '),$r)"/>
+				<xsl:text> </xsl:text>
+				<xsl:value-of select="substring-after(concat(' ',$class,' '),$r)"/>
+			</xsl:when>
+			<xsl:otherwise><xsl:value-of select="$class"/></xsl:otherwise>
+		</xsl:choose>
+		<xsl:if test="normalize-space($add)!=''"><xsl:value-of select="concat(' ',normalize-space($add))"/></xsl:if>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="contains($remove,' ')">
+			<xsl:call-template name="class">
+				<xsl:with-param name="remove" select="substring-after($remove,' ')"/>
+				<xsl:with-param name="class" select="$c"/>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="normalize-space($c)!=''">
+			<xsl:attribute name="class">
+				<xsl:value-of select="normalize-space($c)"/>
+			</xsl:attribute>
+		</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="normpath"><xsl:param name="path"/>
+<!-- normalize out any ".." in the path in $path  -->
+<xsl:choose>
+	<xsl:when test="contains($path,'/../')">
+	<xsl:call-template name="normpath">
+		<xsl:with-param name="path">
+		<xsl:call-template name="before">
+			<xsl:with-param name="text" select="substring-before($path,'/../')"/>
+		</xsl:call-template>
+		<xsl:value-of select="substring-after($path,'/../')"/>
+		</xsl:with-param>
+		</xsl:call-template>
+	</xsl:when>
+	<xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise>
+</xsl:choose>
+</xsl:template>
+
+<!-- return all text before the last / -->
+<xsl:template name="before"><xsl:param name="text"/>
+<xsl:if test="contains($text,'/')">
+	<xsl:value-of select="substring-before($text,'/')"/>/<xsl:call-template name="before"><xsl:with-param name="text" select="substring-after($text,'/')"/></xsl:call-template>
+	</xsl:if>
+</xsl:template>
+
+<xsl:template name="DTD">
+<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE SystemDefinition [
+<!ELEMENT SystemDefinition ( systemModel )>
+<!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED
+>
+<!-- all paths are relative to the environment variable specified by the root attribute, or SOURCEROOT if not.  -->
+
+<!-- System Model Section of DTD -->
+<!ELEMENT systemModel (layer+)>
+
+<!ELEMENT layer (block* | collection*)*>
+<!-- Kernel Services, Base Services, OS Services, Etc -->
+<!ATTLIST layer
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+  levels NMTOKENS #IMPLIED
+  span CDATA #IMPLIED
+>
+
+<!ELEMENT block (subblock* | collection*)*>
+ <!-- Generic OS services, Comms Services, etc -->
+<!ATTLIST block
+  levels NMTOKENS #IMPLIED
+  span CDATA #IMPLIED
+  level NMTOKEN #IMPLIED
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+>
+
+<!ELEMENT subblock (collection)*>
+<!-- Cellular Baseband Services, Networking Services, etc -->
+<!ATTLIST subblock
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+>
+
+<!ELEMENT collection (component)*>
+<!-- Screen Driver, Content Handling, etc -->
+<!ATTLIST collection
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+  level NMTOKEN #IMPLIED
+>
+
+<!ELEMENT component (unit)*>
+<!-- contains units or is a  package or prebuilt -->
+<!ATTLIST component
+  name CDATA #REQUIRED
+  long-name CDATA #IMPLIED
+  deprecated CDATA #IMPLIED
+  introduced CDATA #IMPLIED
+  contract CDATA #IMPLIED
+  plugin (Y|N) "N"
+  filter CDATA #IMPLIED
+  class NMTOKENS #IMPLIED
+  supports CDATA #IMPLIED
+  purpose ( optional | mandatory | development ) "optional"
+>
+
+<!ELEMENT unit EMPTY >
+<!-- must be buildable (bld.inf) -->
+<!-- bldFile  may someday be removed in favour of mrp -->
+<!ATTLIST unit
+  mrp CDATA #IMPLIED
+  filter CDATA #IMPLIED
+  bldFile CDATA #IMPLIED
+  root CDATA #IMPLIED
+  version NMTOKEN #IMPLIED
+  prebuilt NMTOKEN #IMPLIED
+  late (Y|N) #IMPLIED
+  priority CDATA #IMPLIED
+>
+]>
+]]></xsl:text>
+</xsl:template>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/validate-raw.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,173 @@
+<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|block|subblock|layer" use="@name"/>
+
+<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(@name)">
+Note: missing System Definition name</if>
+<for-each select="systemModel//*[@name]">
+	<if test="count(key('name',@name)) &gt; 1">
+ERROR: duplicate name for <value-of select="name()"/> "<value-of select="@name"/>" (<value-of select="count(key('name',@name))"/>)	<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">subblock</with-param></call-template>
+<call-template name="extra-atts"><with-param name="item">block</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 | block/@level | block/@span | layer/@span| layer/@levels | block/@levels | @name |component/@filter |component/@contract |component/@deprecated |component/@class |component/@introduced |component/@plugin" mode="extra"/>
+
+
+<template match="/SystemDefinition/@schema">
+<choose>
+	<when test="starts-with(.,'2.')"/>
+	<when test="starts-with(.,'1.')">
+WARNING: 1.x syntax checking not fully supported</when>
+<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/block|block/subblock|layer/collection| block/collection| subblock/collection|collection/component">
+	<apply-templates select="@*|node()"/>
+</template>
+
+
+<template match="layer|block|subblock|collection|component" priority="-3">
+ERROR: &lt;<value-of select="name()"/> name="<value-of select="@name"/>"&gt; cannot be a child of &lt;<value-of select="name(..)"/>&gt;</template>
+
+
+
+<template match="block/@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="../@name"/>" (<value-of select="../../@levels"/>)</if>
+</template>
+
+<template match="collection/@level">
+<choose>
+	<when test="ancestor::block/@levels">
+		<if test="not(contains(concat(' ',normalize-space(ancestor::block/@levels), ' '),concat(' ',normalize-space(.), ' ')))">
+ERROR: Invalid level name "<value-of select="."/>" on <value-of select="name(..)"/> "<value-of select="../@name"/>" (<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="../@name"/>" (<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="../@name"/>"&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 |block/@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">
+	<apply-templates select="@*|node()"/>
+</template>
+
+<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(../*)">
+ERROR: multiple units must have "version" or "filter" attributes (<value-of select="../@name"/>)</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::block or self::subblock or self::collection) and @name]">[<value-of select="substring(name(),1,1)"/>] <value-of select="@name"/>
+	<if test="position()=1"> / </if>
+</for-each>
+</template>
+</stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysmodellibs/sysmodelgen/src/old/svg/validate.xsl	Wed Oct 13 14:00:36 2010 +0100
@@ -0,0 +1,19 @@
+<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/release|SystemDefinition/styling|systemModel/legend-layer|systemModel/layer-group"/> <!-- in generated file -->
+
+<template match="generator-color|generator-style"/> <!-- in generated file -->
+
+<template match="systemModel/@*"/> <!-- any attributes ok-->
+
+
+<template match="component/@* | collection/@* | block/@* | subblock/@* | layer/@*" priority="-4"/>
+
+<template match="@abbrev|@align|component/@old_model|@*[starts-with(name(),'generat')]" mode="extra"/>
+
+
+</stylesheet>
--- a/sysmodellibs/sysmodelgen/src/svg/Draw.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2303 +0,0 @@
-<?xml version="1.0"?>
- <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:doc="tooldoc"  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="doc s m exslt" >
-	  <xsl:key name="color" match="legend/cbox" use="@value"/>
-	  <xsl:key name="color-value" match="component" use="@ts"/>
-	  <xsl:key name="lgrp-bottom" match="layer-group" use="@from"/>
-	  <xsl:key name="lgrp-top" match="layer-group" use="@to"/>
-	  <xsl:key name="layer" match="layer" use="@name"/>
-	  <xsl:key name="ldg-use" match="group" use="@style-id"/>
-	  <xsl:key name="styled" match="group|group/*" use="@style-id"/>	  
-	<xsl:output method="xml" cdata-section-elements="script s:script" indent="yes"/>
-
-<xsl:param name="Use-as-name" doc:desc="The attribute to use as the item name. Falls back to 'name'" select="'long-name'"/>
-<xsl:param name="Base" doc:desc="The base URL for hyperlinks." select="/SystemDefinition/systemModel/@link"/>
-<xsl:param name="Page-width" select="/SystemDefinition/systemModel/@page-width" doc:desc="The width (specify units) of the page. This overrrides the values specified in the model. The model will automatically adjust from landspace to portrait if its dimensions are more appropriate to portrait."/>
-<xsl:param name="Detail" doc:desc="The level of detail to show in the diagram. Value is the name of the lowest element to show. If the Static parameter is set to false, mousing-over an item will show its detailed content. by default this is 'component'">
-<xsl:choose>
-	<xsl:when test="/SystemDefinition/systemModel/@detail"><xsl:value-of select="/SystemDefinition/systemModel/@detail"/></xsl:when>
-	<xsl:otherwise>component</xsl:otherwise>
-</xsl:choose>
-</xsl:param>
-<xsl:variable name="pre-Static"><xsl:choose><xsl:when test="/SystemDefinition/systemModel/@static='true'">1</xsl:when><xsl:otherwise>0</xsl:otherwise></xsl:choose></xsl:variable>
-<xsl:param name="Static" doc:desc="Set to '1' to get no mouseover or animation efffects" select="$pre-Static='1'"/>
-
-<!-- ====== Constants ============= -->
-<xsl:variable name="groupDx" select="number('2.1')"/> <!-- the horizontal distance between groups (mm) -->
-<xsl:variable name="groupDy" select="number('3.2')"/> <!-- the vertical distance between groups (mm) -->
-<xsl:variable name="cSize" select="number('9.3')"/> <!-- the width and height of a component (mm) -->
-<xsl:variable name="mSize" select="number('15.6')"/> <!-- the height and minimum width of a collection (mm) -->
-<xsl:variable name="inlineLabel" select="3 * $cSize"/> <!-- the max width of an inline label. 3 time width of a collection. I don't like this. Should compute somehow and make local variable -->
-<xsl:variable name="detail-block-space" select="6"/>
-<xsl:variable name="legendDx" select="number('5')"/><!-- the horizontal distance between items in a legend (mm) -->
-<xsl:variable name="lgrpDx" select="number('5')"/> <!-- the width of a layer group border (mm)-->
-<xsl:variable name="lgrpLabelDx" select="number('15')"/> <!-- the width of a layer group title (mm) -->
-<xsl:variable name="large-width" select="500"/> <!-- cutoff width to be considered a wide model and thus need larger title size -->
-<!-- ====== Computed values ============= -->
-
-
-	<!-- Space separated ordered list of version numbers. Not all need be valid. Used to determine if a component is deprecated or not -->
-<xsl:variable name="Versions">
-	<xsl:choose>
-		<xsl:when test="/*/systemModel/@version-list"><xsl:value-of select="/*/systemModel/@version-list"/></xsl:when>
-		<xsl:otherwise>ER5 ER5U 6.0 6.1 6.2 7.0 7.0s 8.0 8.0a 8.0b 8.1 8.1a 8.1b 9.0 9.1 9.2 9.3 9.4 9.5 9.6 Future</xsl:otherwise>
-	</xsl:choose>
-</xsl:variable>
-
-
- <!-- the full horizontal width of a layer (mm). This is computed from the width of the widest layer, and SHOULD have a min value of 388.5 -->
-<xsl:variable name="full-width"><!-- the width  of the model -->
-	<xsl:call-template name="max-from-list">
-		<xsl:with-param name="list">
-			<xsl:for-each select="//layer">
-				<xsl:variable name="span-width"> <!-- space taken up by spanning layers-->
-					<xsl:call-template name="sum-list">
-						<xsl:with-param name="list">0 <xsl:for-each select="following-sibling::layer">
-							<xsl:if test="@span and position() - @span &lt;= 0"><xsl:apply-templates select="." mode="min-width"/><xsl:value-of select="concat(' ',$groupDx,' ')"/></xsl:if></xsl:for-each>
-						</xsl:with-param> 
-					</xsl:call-template>
-				</xsl:variable>	
-				<xsl:variable name="w"><xsl:apply-templates select="." mode="min-width"/></xsl:variable><!-- the width of the content -->
-				<xsl:value-of select="concat($span-width + $w,' ')"/>
-			</xsl:for-each>
-		</xsl:with-param>
-	</xsl:call-template>
-</xsl:variable>
-
-<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="//systemModel/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="//systemModel/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:variable name="view-width" select="$full-width +  12.8 +  2 * $groupDy + $left-borders + $right-borders"/><!-- the horizontal width of the page in pixels,including empty margins -->
-
-<!-- ==================== draw ==================== -->
-
-<!-- well known patterns -->
-
-<xsl:template name="default-new-pattern">
-	<radialGradient id="Patternradial-grad"  gradientUnits="userSpaceOnUse"  cx="10" cy="10" r="14">
-		<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="15%" y1="0%" y2="15%">
-		<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="userSpaceOnUse" 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>
-
-<!-- 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"/> 
-		<!-- 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="*" mode="filter"/> <!-- filters for all items -->
-<xsl:template match="*" mode="text-filter"/> <!-- fitler for just text -->
-
-<xsl:template match="/SystemDefinition">
-<xsl:if test="systemModel/@resolution"><xsl:processing-instruction name="AdobeSVGViewer">resolution="<xsl:value-of select="systemModel/@resolution"/>"</xsl:processing-instruction></xsl:if>
-<svg  version="1.1" onload="wrapalltext()">
-	<xsl:attribute name="class">
-		<xsl:value-of select="$Detail"/>
-		<xsl:if test="/SystemDefinition/systemModel/@detail-type">-<xsl:value-of select="/SystemDefinition/systemModel/@detail-type"/></xsl:if>
-	</xsl:attribute>
-	<xsl:copy-of select="@xml:lang"/> <!-- localized language -->
-	<xsl:variable name="page-height">
-		<xsl:call-template name="sum-list">
-			<xsl:with-param name="list">
-				<xsl:value-of select="concat($groupDy,' ')"/>
-				<xsl:for-each select="systemModel/layer[not(@span)] | systemModel/legend-layer">
-					<xsl:apply-templates select="." mode="height"/>
-					<xsl:value-of select="concat(' ',$groupDy + $lgrpDx * (count(key('lgrp-top',@name)) +  count(key('lgrp-bottom',@name))),' ')"/>
-				</xsl:for-each>
-			</xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>
-		 <!-- has groupDy margin around all edges -->
-	<xsl:attribute name="viewBox"><xsl:value-of select="concat(-$groupDy - $left-borders ,' 0 ',$view-width ,' ', $page-height)"/></xsl:attribute>
-	
-	<xsl:if test="$Page-width!=''">
-		<xsl:attribute name="width"><xsl:value-of select="$Page-width"/></xsl:attribute>
-		<xsl:variable name="unit" select="translate($Page-width,'0123456789-.','')"/>
-		<xsl:attribute name="height">
-			<xsl:choose>
-				<xsl:when test="$page-height &gt; ($view-width *  297 div 210)"><xsl:value-of select="297 * number(substring-before($Page-width,$unit)) div 210"/></xsl:when>
-				<xsl:otherwise><xsl:value-of select="210 * number(substring-before($Page-width,$unit)) div 297"/></xsl:otherwise>
-			</xsl:choose>
-		<xsl:value-of select="$unit"/></xsl:attribute>
-	
-	</xsl:if>
-	<xsl:apply-templates select="systemModel" mode="title"/>
-	<defs>
-
-    <style type="text/css">
-    text.layer, text.block, text.subblock, 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.block {
-		font-size: 4.233px;  /*  12pt  */
-		font-weight: bold;
-	}
-	text.label {		
-		font-size: 1.940px;  /*  5.5pt  */
-		font-weight: bold
-	}
-	text.cbox {		
-		font-size: 1.411px;  /*  4pt  */
-		font-weight: bold
-	}
-	text.lgrp {
-		font-size: 12.699px;  /*  36pt  */
-		font-weight: normal;
-	}
-<!-- block font sizes -->
-svg.subblock text.block,
-svg.subblock-fixed text.block {
-		font-size: 7.7605px;  /*  22pt  */
-	}
-svg.block text.block,
-svg.block-fixed text.block {
-		font-size: 11.288px;  /*  32pt  */
-		font-weight: normal;
-	}
-
-svg.subblock-fixed text.block, 
-svg.block-fixed text.block {
-	}
-
-<!-- subblock font sizes -->
-	text.subblock {
-		font-size: 2.822px;  /*  8pt  */
-	}
-	
-	svg.collection text.subblock,
-	svg.collection-fixed text.subblock  {
-		font-size: 4.233px;  /*  12pt  */
-	}
-	
-	svg.subblock text.subblock,
-	svg.subblock-fixed text.subblock  {
-		font-size: 7.055px;  /*  20pt  */
-	}
-<!-- collection font sizes -->
-	text.collection {
-		font-size: 2.469px;  /*  7pt  */
-	}
-	
-	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.subblock, rect.block  {
-		stroke-width: 0.2469px;  /*  0.7pt  */
-		stroke: black
-	}
-	rect.layer {
-		fill: #e6e6e6
-	}
-	rect.block {
-		fill: #b3b3b3
-	}
-	rect.subblock {
-		fill: #e6e6e6
-	}
-	rect.collection {
-		fill: white
-	}
-	rect.legend {
-		fill: white
-	}
- </style>	
- 		<xsl:apply-templates select="." mode="shapes"/>
- 
-	</defs>
-		<!-- next line is a hack for Xalan -->
-		<xsl:comment>Drawing in static mode: <xsl:value-of select="$pre-Static=1"/></xsl:comment>	
-
-<script type="text/ecmascript"> 
-<!-- for creating / finding elements by namespace -->
-var svgns="http://www.w3.org/2000/svg";
-
-<!-- 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="$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:if test="not($Static)"><!-- show level lables -->
-<!--function resizeLabel(node) {
-	var list = node.getElementsByTagNameNS(svgns,'text');
-	if(list.length==0) return;
-	var txt = list.item(0);
-	node=node.firstChild;
-	while(node &amp;&amp; node.nodeType!=1) node=node.nextSibling;
-	if(!node || node==txt) return;
-	if(node.hasAttribute('transform')) return;
-	var scale  = (1.6+txt.getComputedTextLength()) / 20;
-	var x = Number(txt.getAttribute('x'))
-	node.setAttribute('transform', 'translate('+ x+') scale('+scale+' 1) translate('+ (-x)+') ');
-}-->
-</xsl:if>
-
-<!--  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 -->
-<![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.1');
-	if( node.getComputedTextLength() > len) 
-		node.setAttribute('letter-spacing','-0.2');
-}
-
-function whatSize(txt) { // convert a length into pixels
-	if(txt.match(/^[0-9.-]+$/)) return txt;
-	var a = document.createElementNS(svgns,'rect');
-	a.setAttribute('x',0);
-	a.setAttribute('y',0);
-	a.setAttribute('width',txt);
-	var l = a.getBBox().width;
-	delete a;
-	return l;
-}
-
-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('ref')) {
-		w = document.getElementById(cur.getAttribute('ref')).getBBox().width * 0.9;
-	} else 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');
-	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
-	var align =cur.getAttribute('dominant-baseline');
-	if(align=='' || align=='ideographic') {
-		cur.setAttribute('dy',(1-nlines)+"em");
-	 } else{
-	 	 if(align=='mathematical')
-			cur.setAttribute('dy',((1-nlines ) / 2 )+"em");
-		else if(align=='hanging') 
-			cur.setAttribute('dy',"0em")
-	 }
-}
-  ]]> </script>
-<xsl:apply-templates select="systemModel/*[last()]">
-	<xsl:with-param name="y" select="$groupDy"/>
-</xsl:apply-templates>
-	<xsl:apply-templates mode="validate"/>
-</svg>
-</xsl:template>
-
-<xsl:template match="component|collection|subblock|block|layer" mode="id"><xsl:value-of select="translate(@name,' ','')"/></xsl:template>
-
-<xsl:template name="linkable-content"><xsl:param name="show"/>
-	<xsl:choose> <!-- don't use <a> unless there is a valid link -->
-		<xsl:when test="string-length($Base)=0 or self::cmp">
-			<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 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="self::component[name]"><xsl:value-of select="name"/></xsl:when>		<!-- deprecated abbrev forms for components -->
-		<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:otherwise><xsl:value-of select="@name"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<!-- ============ Detail options============ -->
-
-<!-- don't show when not enough detail -->
-<xsl:template match="component[$Detail!='component' and ($Static or /SystemDefinition/systemModel/@detail-type='fixed')]" priority="9"/>
-<xsl:template match="collection[$Detail!='component' and $Detail!='collection' and ($Static  or /SystemDefinition/systemModel/@detail-type='fixed')]" priority="9"/>
-<xsl:template match="block[$Detail='layer'  and ($Static  or /SystemDefinition/systemModel/@detail-type='fixed') ]" priority="9"/>
-<xsl:template match="subblock[($Detail='block' or $Detail='layer') and ($Static  or /SystemDefinition/systemModel/@detail-type='fixed')]" priority="9"/>
-
-<xsl:template match="*[$Detail='component' ]" mode="detail-stuff" priority="9"/>
-<xsl:template match="*" mode="detail-stuff" priority="-5"/>
-
-<xsl:template match="*[boolean($Static)]" mode="detail-stuff" priority="7"/>
-<xsl:template match="*[/SystemDefinition/systemModel/@detail-type='fixed']" mode="detail-stuff" priority="8">
-	<xsl:param name="s" select="'content'"/>
-	<xsl:if test="$s='mouseover' and (name()=$Detail or (self::block and not(subblock) and $Detail='subblock') or  (self::layer and not(block) and ($Detail='subblock' or $Detail='block')))">
-<!-- 		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>-->
-	</xsl:if>
-</xsl:template>
-<xsl:template match="collection[$Detail!='collection'] | *[($Detail='collection') and not(self::collection)] | subblock[$Detail='block']" mode="detail-stuff" priority="5"/>
-
-<xsl:template match="collection|subblock|block[not(subblock) or $Detail='block'] | layer[$Detail=name()]" mode="detail-stuff"><xsl:param name="s" select="'content'"/>
-	<xsl:choose>
-		<xsl:when test="$s='mouseover'">
-<!-- 			<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>-->
-			<xsl:attribute name="onmouseover">on('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>');off('<xsl:value-of select="name()"/>-label-<xsl:apply-templates select="." mode="id"/>');</xsl:attribute>
-			<xsl:attribute name="onmouseout">off('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>');on('<xsl:value-of select="name()"/>-label-<xsl:apply-templates select="." mode="id"/>');</xsl:attribute>
-		</xsl:when>
-		<xsl:when test="$s='text'">
-			<xsl:attribute name="id"><xsl:value-of select="name()"/>-label-<xsl:apply-templates select="." mode="id"/></xsl:attribute>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:attribute name="id"><xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/></xsl:attribute>
-			<xsl:attribute name="visibility">hidden</xsl:attribute>
-		</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="block[$Detail='subblock' and collection and subblock] | layer[($Detail='block' or $Detail='subblock')  and collection and block]" mode="detail-stuff"><xsl:param name="s" select="'content'"/>
-	<xsl:if test="$s='mouseover'">
-		<xsl:attribute name="onmouseover"><xsl:for-each select="collection">on('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>');</xsl:for-each></xsl:attribute>
-		<xsl:attribute name="onmouseout"><xsl:for-each select="collection">off('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>');</xsl:for-each></xsl:attribute>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template priority="8" match="block[subblock and $Detail='subblock']/collection | layer[block  and ($Detail='subblock' or $Detail='block')]/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:apply-templates select="." mode="id"/></xsl:attribute>
-		<xsl:attribute name="visibility">hidden</xsl:attribute>
-	</xsl:if>
-</xsl:template>
-
-
-<xsl:template match="layer[$Detail=name() or not(block|subblock)]" mode="detail-stuff"><xsl:param name="s" select="'content'"/>
-	<xsl:choose>
-		<xsl:when test="$s='mouseover'">
-			<xsl:if test="$Detail=name()"><!-- <xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>--></xsl:if>	
-			<xsl:attribute name="onmouseover">on('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>')</xsl:attribute>
-			<xsl:attribute name="onmouseout">off('<xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/>')</xsl:attribute>
-		</xsl:when>
-		<xsl:when test="$s!='text'">
-			<xsl:attribute name="id"><xsl:value-of select="name()"/>-content-<xsl:apply-templates select="." mode="id"/></xsl:attribute>
-			<xsl:attribute name="visibility">hidden</xsl:attribute>
-		</xsl:when>
-	</xsl:choose>
-</xsl:template>
-<xsl:template match="*[$Detail='layer' and not(self::layer)]" mode="detail-stuff"/>
-
-
-<!-- ============ labelclass ============ -->
-
-<xsl:template match="*" mode="label-class">
-	<xsl:attribute name="class"><xsl:choose>
-	<xsl:when test="self::block">block</xsl:when>
-	<xsl:when test="self::subblock">subblock</xsl:when>
-	<xsl:when test="self::layer">layer</xsl:when>
-	<xsl:when test="self::component">component</xsl:when>
-	<xsl:when test="self::collection">collection</xsl:when>
-	<xsl:otherwise><xsl:message>Error</xsl:message></xsl:otherwise>
-</xsl:choose></xsl:attribute>
-</xsl:template>
-
-
-<!-- ============ hyperlinks ============ -->
-
-<xsl:template match="*" mode="link-label"/>
-<xsl:template match="*[@name]" mode="link-label">
-<xsl:attribute name="target">details</xsl:attribute>
-<xsl:attribute name="xlink:href"><xsl:value-of select="$Base"/>/<xsl:choose>
-	<xsl:when test="self::block">Blocks</xsl:when>
-	<xsl:when test="self::subblock">SubBlocks</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:message>Error</xsl:message></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="//systemModel[@font]">'<xsl:value-of select="//systemModel/@font"/>'</xsl:when>
-		<xsl:otherwise>Arial</xsl:otherwise>
-	</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($st,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="*[generator-color]">
-  <xsl:call-template name="multi-color-grad">
-   <xsl:with-param name="key" select="'styled'"/>
-   <xsl:with-param name="c" select="generator-color/@ref"/>
-   <xsl:with-param name="blur" select="0"/>
-  </xsl:call-template>
-</xsl:template>
-
-<!-- ============ 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:template name="min-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="min"><xsl:choose>
-		<xsl:when test="$next=''"><xsl:value-of select="$cur + 1"/></xsl:when>
-		<xsl:otherwise><xsl:call-template name="min-from-list">
-			<xsl:with-param name="list" select="$next"/>
-		</xsl:call-template></xsl:otherwise>
-	</xsl:choose></xsl:variable>
-	<xsl:choose>
-		<xsl:when test="$cur &lt; $min"><xsl:value-of select="$cur"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="$min"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-
-<!-- returns the first smallest value -->
-<xsl:template name="min-from-list-with-index"><xsl:param name="list"/><xsl:param name="start" select="0"/>
-	<xsl:variable name="cur" select="substring-before($list,' ')"/>
-	<xsl:variable name="next" select="substring-after($list,' ')"/>
-	<xsl:variable name="min"><xsl:choose>
-		<xsl:when test="$next=''"><xsl:value-of select="concat($cur,':',$start)"/></xsl:when>
-		<xsl:otherwise><xsl:call-template name="min-from-list-with-index">
-			<xsl:with-param name="list" select="$next"/>
-			<xsl:with-param name="start" select="$start + 1"/>
-		</xsl:call-template></xsl:otherwise>
-	</xsl:choose></xsl:variable>
-	<xsl:choose>
-		<xsl:when test="$cur &lt;= substring-before($min,':')"><xsl:value-of select="concat($cur,':',$start)"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="$min"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template name="list-range"><xsl:param name="list"/><xsl:param name="from" select="0"/><xsl:param name="to"/>
-	<xsl:if test="$from &lt; 1"><xsl:value-of select="concat(substring-before($list,' '),' ' )"/></xsl:if>
-	<xsl:if test="$to &gt; 0">
-		<xsl:call-template name="list-range">
-			<xsl:with-param name="list" select="substring-after($list,' ')"/>
-			<xsl:with-param name="from" select="$from - 1"/>
-			<xsl:with-param name="to" select="$to - 1"/>
-		</xsl:call-template>
-	</xsl:if>
-</xsl:template>
-
-<!-- modes:
-
-n-levels:	the number of levels available to children of that item
-level-range: 	the bottom and top level this item spans in its parent
--->
-
-<xsl:template mode="validate" match="node()" priority="-4"/>
-<xsl:template mode="validate" match="*" priority="-2"><xsl:apply-templates mode="validate" select="*"/></xsl:template>
-
-<!-- ====== Components ============= -->
-
-<xsl:template match="*" mode="display-style-color" priority="-2"/>
-<xsl:template match="*" mode="animate-color" priority="-2"/><!-- change back to -2 to enable -->
-
-
-<xsl:template match="*[@generator-color]" mode="animate-color" priority="4">
-	<xsl:if test="not($Static)">
-		<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="*[generator-color]" mode="animate-color" priority="4">
-	<xsl:if test="not($Static)">
-		<xsl:for-each select="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>
-
-<!-- for legend-copy generated legend items -->
-
-<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]" mode="overlay-style" priority="8">
-	<xsl:text>fill: url(</xsl:text>
-	<xsl:value-of select="@generated-overlay"/>
-	<xsl:text>); stroke: none; stroke-width: 0;</xsl:text>
-</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>
-
-<!-- end legend-copy  items -->
-
-<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>
-
-<!--  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(generator-color)=1]" mode="display-style-color" priority="8">
-	<xsl:for-each select="key('styled',generator-color/@ref)">
-		<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
-	</xsl:for-each>
-</xsl:template>
-
-<xsl:template match="*[count(generator-color) &gt; 1]" mode="display-style-color" priority="8">
-	<xsl:variable name="ref" select="key('styled',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]" mode="overlay-style" priority="8">
-	<xsl:text>fill: url(</xsl:text>
-	<xsl:for-each select="key('styled',@generator-overlay)">
-		<xsl:value-of select="@value | @default"/>	<!-- can't have both -->
-	</xsl:for-each>	
-	<xsl:text>); stroke: none; stroke-width: 0;</xsl:text>
-</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 | 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" mode="display-style-color" priority="-1">
-	<xsl:variable name="c"><xsl:value-of select="key('color',@ts)/@color"/></xsl:variable>
-	<xsl:choose>
-		<xsl:when test="$c!=''"><xsl:value-of select="$c"/></xsl:when>
-		<xsl:otherwise>grey</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-
-<xsl:template match="component" mode="overlay-style" priority="-2"> <!-- since deprecated, replaced with introduced -->
-	<xsl:if test="@introduced = //systemModel/@ver or @since = //systemModel/@ver or @ref">
-		<xsl:text>fill:</xsl:text>
-		<xsl:choose>
-			<xsl:when test="@since = //systemModel/@ver">url(#Patternradial-grad)</xsl:when> <!-- to be removed -->
-			<xsl:when test="@introduced = //systemModel/@ver">url(#Patternradial-grad)</xsl:when>
-			<xsl:when test="@ref">url(#Patternstriped-diag-up)</xsl:when>
-			<xsl:otherwise>none</xsl:otherwise>
-		</xsl:choose>
-		<xsl:text>; stroke: none; stroke-width: 0;</xsl:text>
-	</xsl:if>
-</xsl:template>
-
-
-<xsl:template match="component|cmp" mode="overlay-style" priority="-3">fill: none; stroke: none; stroke-width: 0;</xsl:template>
-
-<xsl:template match="component|cmp" mode="shape" priority="-1">#Borderbox<xsl:choose>
-      <xsl:when test="self::cmp"/>
-      <xsl:when test="s12/@osd='CS'">-clipLB</xsl:when>
-      <xsl:when test="s12/@osd='OS'">-clipLT</xsl:when>
-      <xsl:when test="s12/@osd='CR'">-clipRB</xsl:when>
-      <xsl:when test="s12/@osd='OR'">-clipRT</xsl:when>
-      <xsl:when test="s12/@osd='T-R'">-clipAll</xsl:when>
-	</xsl:choose>
-</xsl:template>
-
-
-<xsl:template match="component|cmp">
-	<xsl:param name="spacing" select="0"/>
-	<xsl:variable name="x-pos" select="($cSize + $spacing) * (position() - 1)"/>
-	<g class="component"><xsl:apply-templates select="." mode="filter"/>
-		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
-		<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="{$cSize}" height="{$cSize}" 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-style"/></xsl:variable>
-		<xsl:if test="$overlay!=''">
-			<use width="{$cSize}" height="{$cSize}" x="{$x-pos}" y="0" style="{$overlay}" xlink:href="{$ref}"/>
-		</xsl:if>
-		<xsl:call-template name="linkable-content">
-			<xsl:with-param name="show">
-				<text text-anchor="middle" dominant-baseline="mathematical"  class="component" y="4.8">
-					<xsl:attribute name="x"><xsl:value-of select="$x-pos + 0.5 * $cSize"/></xsl:attribute>
-					<xsl:apply-templates select="." mode="wrap"><xsl:with-param name="w" select="$cSize"/></xsl:apply-templates>
-					<xsl:call-template name="display-name"/>
-				</text>
-			</xsl:with-param>
-		</xsl:call-template>
-	</g>
-</xsl:template>
-
-
-<xsl:template match="component|cmp" mode="wrap"><xsl:param name="w"/>
-	<xsl:variable name="s"><xsl:call-template name="name-value"/></xsl:variable>
-	<!-- 7 is a pretty arbitrary limit. But not bad -->
-	<xsl:if test=" string-length($s) &gt; 7"><xsl:attribute name="width"><xsl:value-of select="$w"/></xsl:attribute></xsl:if>
-</xsl:template>
-
-<!-- ====== Collections ============= -->
-
-<xsl:template match="collection" mode="height"><xsl:value-of select="$mSize"/></xsl:template>
-
-<xsl:template match="collection" mode="width">
-	<xsl:variable name="num" select="count(component)"/>
-	<xsl:choose>
-		<xsl:when test="$Detail=name() and /SystemDefinition/systemModel/@detail-type='fixed'">
-			<xsl:value-of select="$mSize"/>
-		</xsl:when>
-		<xsl:when test="$num=0">0</xsl:when>	
-		<xsl:when test="$num=1"><xsl:value-of select="$mSize"/></xsl:when> <!-- cannot be thinner than square-->
-		<xsl:otherwise><xsl:value-of select="$num * $cSize"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="collection"><xsl:param name="levels"/>
-	<xsl:variable name="w" ><xsl:apply-templates mode="width"  select="."/></xsl:variable>
-	<xsl:variable name="index"><xsl:apply-templates select="." mode="level-index"/></xsl:variable>
-
-	<xsl:variable name="y">
-		<xsl:call-template name="level-top">
-			<xsl:with-param name="index" select="$index"/>
-		</xsl:call-template>
-	</xsl:variable>
-	<xsl:variable name="x">
-		<xsl:call-template name="x-pos">
-			<xsl:with-param name="levels" select="$levels"/>
-			<xsl:with-param name="range" select="concat($index,' ',$index)"/>
-		</xsl:call-template>
-	</xsl:variable>
-	
-	<g class="{name()}"><xsl:apply-templates select="." mode="filter"/>
-		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
-		<xsl:attribute name="transform">translate(<xsl:value-of select="concat($x,' ',$y)"/>)</xsl:attribute>
-		<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="{$mSize}" width="{$w}">
-			<xsl:call-template name="styles"/>
-		</rect>
-		<xsl:call-template name="linkable-content">
-			<xsl:with-param name="show">
-				<text  text-anchor="start" dominant-baseline="hanging" class="collection" y="0.4" x="1.4">
-					<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'text'"/></xsl:apply-templates>
-					<xsl:attribute name="width"><xsl:value-of select="$w - 1.4"/></xsl:attribute>
-					<xsl:if test="$Detail='collection' ">
-						<xsl:attribute name='text-anchor'>middle</xsl:attribute>
-						<xsl:attribute name='x'><xsl:value-of select="$w * 0.5"/></xsl:attribute>
-						<xsl:attribute name='dominant-baseline'>mathematical</xsl:attribute>						
-						<xsl:attribute name="y"><xsl:value-of select="$mSize * 0.5"/></xsl:attribute>
-					</xsl:if>
-					<xsl:call-template name="display-name"/>
-				</text>
-			</xsl:with-param>
-		</xsl:call-template>
-		<g transform="translate(0 {$mSize - $cSize})">
-			<xsl:apply-templates select="." mode="detail-stuff"/>
-			<xsl:apply-templates select="*"/>
-		</g>
-	</g>
-	<xsl:apply-templates select="following-sibling::*[1]">
-		<xsl:with-param name="levels">
-			<xsl:call-template name="sum-levels">
-				<xsl:with-param name="levels" select="$levels"/>
-				<xsl:with-param name="range" select="concat($index,' ',$index)"/>
-				<xsl:with-param name="width" select="$w"/>
-			</xsl:call-template>
-		</xsl:with-param>
-	</xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="collection" mode="post-levels"><xsl:param name="levels"/>
-	<xsl:variable name="index"><xsl:apply-templates select="." mode="level-index"/></xsl:variable>
-	<xsl:variable name="next">
-		<xsl:call-template name="sum-levels">
-			<xsl:with-param name="levels" select="$levels"/>
-			<xsl:with-param name="range" select="concat($index,' ',$index)"/>
-			<xsl:with-param name="width"><xsl:apply-templates mode="width"  select="."/></xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>
-	
-	<xsl:if test="not(following-sibling::*)"><xsl:value-of select="$next"/></xsl:if>
-	<xsl:apply-templates select="following-sibling::*[1]" mode="post-levels">
-		<xsl:with-param name="levels" select="$next"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-
-<!-- if no levels, it can only be at index 0 -->
-<xsl:template match="collection[not(ancestor::*[@levels])]" mode="level-index" priority="4">0</xsl:template>
-
-
-<xsl:template match="collection[not(@level) and ancestor::block[@level and not(@levels)]]" mode="level-index" priority="3">
-	<!-- this is in a block with a level (but no levels), so use that level -->
-	<xsl:for-each select="ancestor::block">
-		<xsl:call-template name="level-index"/>
-	</xsl:for-each>
-</xsl:template>
-
-<xsl:template match="collection[not(@level)]" mode="level-index" priority="2">
-	<!-- this has an ancestor with levels, so this is on the (extra) top level -->
-	<xsl:variable name="n"><xsl:apply-templates select="ancestor::*[@levels][1]" mode="n-levels"/></xsl:variable> <!-- n = number of levels this collection can see -->
-	<xsl:value-of select="$n - 1"/>
-	<!-- warning: no level -->
-</xsl:template>
-
-<xsl:template mode="validate" match="collection[not(@level) and ancestor::*[@levels] and not(ancestor::block[@level])]">
-	<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">
-		<xsl:value-of select="name()"/> with no level (<xsl:value-of select="@name"/>)</xsl:with-param></xsl:call-template>
-</xsl:template>
-
-<xsl:template mode="validate" match="collection[not(@level) and ancestor::block[@level]]">
-	<xsl:if test="$Verbose">
-		<xsl:call-template name="Caller-Note"><xsl:with-param name="text">
-			<xsl:value-of select="name()"/> with no level (<xsl:value-of select="@name"/>) given same level as parent</xsl:with-param></xsl:call-template>
-	</xsl:if>
-</xsl:template>
-
-<!--xsl:template mode="validate" match="collection[@level and not(contains(ancestor::*/@levels,'level'))]">
-	<xsl:message>&#xa;Error: invalid level on <xsl:value-of select="name()"/> (<xsl:value-of select="@name"/>)</xsl:message>
-</xsl:template-->
-
-<xsl:template match="collection" mode="level-index">
-	<!-- thiis has a level and an ancestor with levels -->
-	<xsl:call-template name="level-index"/>
-</xsl:template>
-
-<!-- ====== Sub-blocks ============= -->
-
-<xsl:template match="subblock[/SystemDefinition/systemModel/@detail-type='fixed' and $Detail=name()]" priority="5" mode="width">
-	<xsl:value-of select="$mSize * 3"/>
-</xsl:template>
-
-<xsl:template match="block[/SystemDefinition/systemModel/@detail-type='fixed' and $Detail=name()]" priority="5" mode="width">
-	<xsl:value-of select="$mSize * 5"/>
-</xsl:template>
-
-<xsl:template match="block[/SystemDefinition/systemModel/@detail-type='fixed' and not(subblock) and ($Detail='subblock')]" priority="5" mode="width">
-	<xsl:value-of select="$mSize * 3"/>
-</xsl:template>
-
-<xsl:template match="subblock|block" mode="width">
-	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select="."/></xsl:variable>
-	<xsl:variable name="levels">	
-		<xsl:apply-templates select="*[1]" mode="post-levels">
-			<xsl:with-param name="levels">
-				<xsl:call-template name="zeros">
-					<xsl:with-param name="n" select="$n"/>
-				</xsl:call-template>
-			</xsl:with-param>
-		</xsl:apply-templates>
-	</xsl:variable>
-	<xsl:variable name="w-base">
-		<xsl:call-template name="max-from-list">
-			<xsl:with-param name="list" select="$levels"/>	
-		</xsl:call-template>
-	</xsl:variable>
-
-	<xsl:variable name="range">
-		<xsl:choose>
-			<xsl:when test="@levels">0 <xsl:value-of select="$n - 1"/></xsl:when>
-			<xsl:otherwise><xsl:apply-templates select="." mode="level-range"/></xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable>
-	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
-	<xsl:variable name="min">
-		<xsl:call-template name="min-from-list-with-index">
-			<xsl:with-param name="list">
-				<xsl:call-template name="list-range">
-					<xsl:with-param name="list" select="$levels"/>
-					<xsl:with-param name="from" select="$r0"/>
-					<xsl:with-param name="to" select="substring-after($range,' ')"/>
-				</xsl:call-template>
-			</xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>
-	<xsl:variable name="min-label-width">
-		<xsl:apply-templates select="." mode="min-label-width"/>
-	</xsl:variable>
-	<xsl:variable name="min-level-width" select="substring-before($min,':')"/>
-	<xsl:choose>
-		<xsl:when test="($w-base - $min-level-width) &lt; $min-label-width"><xsl:value-of select="$min-level-width +  $min-label-width"/></xsl:when>
-		<xsl:when test="/SystemDefinition/systemModel/@detail-type='fixed' and ($Detail='collection') and $w-base &lt; 2*$mSize">
-			<xsl:value-of select="2*$mSize"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="$w-base"/></xsl:otherwise>
-	</xsl:choose>	
-</xsl:template>
-
-<xsl:template match="subblock" mode="height">
-	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
-	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>	
-	<xsl:variable name="r1" select="number(substring-after($range,' '))"/>
-	<!-- height is from number of levels -->
-	<xsl:value-of select="($r1 - $r0 + 1) * ($mSize +  $groupDy) - $groupDy"/>
-</xsl:template>
-
-<!-- ============= range of levels ============= -->
-
-<!-- spans full height of parent, so uses parent's range -->
-<xsl:template match="subblock" mode="level-range">
-	<xsl:apply-templates select=".." mode="level-range"/>
-</xsl:template>
-<xsl:template match="block[@levels]/subblock" mode="level-range" priority="1">
-	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select=".."/></xsl:variable>
-	<xsl:value-of select="concat('0 ',$n - 1)"/>
-</xsl:template>
-
-<xsl:template mode="n-levels" match="subblock">
-	<xsl:apply-templates select=".." mode="n-levels"/>
-</xsl:template>
-<!-- ============= draw ============= -->
-
-<xsl:template match="subblock"><xsl:param name="levels"/> <!-- can contain only collections -->
-	<xsl:variable name="width"><xsl:apply-templates select="." mode="width"/></xsl:variable>
-	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
-	<xsl:variable name="r1" select="number(substring-after($range,' '))"/>	
-	<xsl:variable name="x"><xsl:call-template name="x-pos">
-			<xsl:with-param name="levels" select="$levels"/>
-			<xsl:with-param name="range" select="$range"/>
-		</xsl:call-template>
-	</xsl:variable>
-	<xsl:variable name="y">
-		<xsl:call-template name="level-top">
-			<xsl:with-param name="index" select="$r1"/>
-		</xsl:call-template>
-	</xsl:variable>	
-	
-	<g class="{name()}" transform="translate({$x})"><xsl:apply-templates select="." mode="filter"/>
-		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>	
-		<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>		
-		<xsl:attribute name="transform">translate( <xsl:value-of select="$x"/>)</xsl:attribute>
-		<xsl:apply-templates select="." mode="animate-color"/>
-        <xsl:apply-templates select="." mode="multi-color"/>		
-		<xsl:variable name="height"><xsl:apply-templates select="." mode="height"/></xsl:variable> 
-		<rect class="{name()}" x="0" height="{$height}" width="{$width}" y ="{$y}">
-			<xsl:if test="$Detail=name()">
-				<!-- to make room for the block label -->
-				<xsl:attribute name="height"><xsl:value-of select="$height - $detail-block-space"/></xsl:attribute>
-			</xsl:if>
-			<xsl:call-template name="styles"/>
-		</rect>
-
-		<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="subblock" dominant-baseline="mathematical" x="{$width * 0.5}" width="{$width}" y="{$y + 0.5 * ($height - $detail-block-space)}">
-					<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'text'"/></xsl:apply-templates>
-					<xsl:apply-templates select="." mode="label">
-						<xsl:with-param name="width" select="$width"/>
-					</xsl:apply-templates>
-					<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="*[1]">
-				<xsl:with-param name="levels">
-					<xsl:call-template name="zeros"><xsl:with-param name="n" select="string-length($levels) - string-length(translate($levels,' ',''))"/></xsl:call-template>
-				</xsl:with-param>
-			</xsl:apply-templates>
-		</g>	
-	</g>	
-	<xsl:apply-templates select="following-sibling::*[1]">
-		<xsl:with-param name="levels">
-			<xsl:call-template name="sum-levels">
-				<xsl:with-param name="levels" select="$levels"/>
-				<xsl:with-param name="range" select="$range"/>
-				<xsl:with-param name="width" select="$width"/>
-			</xsl:call-template>
-		</xsl:with-param>
-	</xsl:apply-templates>	
-</xsl:template>
-
-
-<xsl:template match="subblock" mode="post-levels"><xsl:param name="levels"/>
-	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
-	<xsl:variable name="next">
-		<xsl:call-template name="sum-levels">
-			<xsl:with-param name="levels" select="$levels"/>
-			<xsl:with-param name="range" select="$range"/>
-			<xsl:with-param name="width"><xsl:apply-templates mode="width"  select="."/></xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>
-	
-	<xsl:if test="not(following-sibling::*)"><xsl:value-of select="$next"/></xsl:if>
-	<xsl:apply-templates select="following-sibling::*[1]" mode="post-levels">
-		<xsl:with-param name="levels" select="$next"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="subblock" mode="min-label-width">
-	<xsl:value-of select="$inlineLabel"/>
-</xsl:template>
-
-<xsl:template match="subblock" mode="label"><xsl:param name="width"/>
-	<xsl:call-template name="inline-label">
-		<xsl:with-param name="width" select="$width"/>
-	</xsl:call-template>
-</xsl:template>
-
-<xsl:template match="subblock[$Detail=name()]" mode="label" priority="4"/>
-
-<!-- ====== Blocks  ============= -->
-
-<!-- height determined by: (in order) 
-@levels => height of the levels
-@span => eight spanned 
-not(@levels) and not(@level) => full of parent
--->
-
-
-
-	<!-- min-height is always independent of parent -->
-<xsl:template match="block[@levels]" mode="min-height" priority="6">
-	<xsl:variable name="h"><xsl:apply-templates mode="level-heights" select="."/></xsl:variable>
-	<xsl:call-template name="sum-list">
-		<xsl:with-param name="list">
-			<xsl:value-of select="$groupDy * (string-length($h)  - string-length(translate($h,' ','')) - 1)"/> <!-- spacing between levels: needed? -->
-			<xsl:value-of select="concat(' ',$h)"/>
-		</xsl:with-param>
-	</xsl:call-template>
-</xsl:template>
-
-<xsl:template match="block" mode="min-height" priority="5">
-	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
-	<xsl:variable name="n" select="number(substring-after($range,' ')) - number(substring-before($range,' ')) + 1"/>
-	<xsl:value-of select="$n * ($mSize + $groupDy)  - $groupDy "/>
-</xsl:template>
-
-<!-- if a spanned layer contains just a single block, then increase the size to fill the entire layer -->
-<xsl:template match="layer[@span &gt; 0]/block[not(@level) and count(../*)=1]" mode="max-height" priority="4">
-	<xsl:variable name="h"><xsl:apply-templates mode="height" select=".."/></xsl:variable>
-	<xsl:variable name="padding"><xsl:apply-templates select=".." mode="padding"/></xsl:variable>
-	<xsl:value-of select="$h - substring-before($padding,' ') - substring-after($padding,' ')"/>
-</xsl:template>
-
-
-<!-- max-height is always dependent on parent -->
-<xsl:template match="block" mode="max-height">
-	<xsl:variable name="h">
-		<xsl:apply-templates mode="level-heights" select="..">
-			<xsl:with-param name="range">
-				<xsl:apply-templates select="." mode="level-range"/>
-			</xsl:with-param>
-		</xsl:apply-templates>
-	</xsl:variable>
-	<xsl:call-template name="sum-list">
-		<xsl:with-param name="list">
-			<xsl:value-of select="$groupDy * (string-length($h)  - string-length(translate($h,' ','')) - 1)"/> <!-- spacing between levels: needed? -->
-			<xsl:value-of select="concat(' ',$h)"/><!-- insert some border here-->
-		</xsl:with-param>
-	</xsl:call-template>	
-</xsl:template>
-
-
-	<!-- independent of parent -->
-<xsl:template match="layer[not(@levels)]/block[@levels]" mode="height" priority="7">
-	<xsl:call-template name="max-from-list">
-		<xsl:with-param name="list">
-			<xsl:for-each select="../block[@levels]">
-				<xsl:apply-templates mode="min-height" select="."/><xsl:text> </xsl:text>
-			</xsl:for-each>
-		</xsl:with-param>
-	</xsl:call-template>	
-</xsl:template>
-
-	<!-- NOT independent of parent -->
-<xsl:template match="block[@levels]" mode="height" priority="6">
-	<xsl:variable name="h0"><xsl:apply-templates mode="min-height" select="."/></xsl:variable>
-	<xsl:variable name="h1"><xsl:apply-templates mode="max-height" select="."/></xsl:variable>
-	<xsl:choose>
-		<xsl:when test="$h1 &gt; $h0"><xsl:value-of select="$h1"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="$h0"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-	<!-- no @levels, so height depends on number of levels spanned and size of levels in parent-->
-<xsl:template match="block" mode="height" priority="5">
-	<xsl:apply-templates mode="max-height" select="."/>
-</xsl:template>
-
-
-
-<xsl:template match="block"><xsl:param name="levels"/>
-	<xsl:variable name="w"><xsl:apply-templates select="." mode="width"/></xsl:variable>
-	<xsl:variable name="h"><xsl:apply-templates select="." mode="height"/></xsl:variable>
-	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
-	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
-	<xsl:variable name="r1" select="number(substring-after($range,' '))"/>		
-	
-	<xsl:variable name="x">
-		<xsl:call-template name="x-pos">
-			<xsl:with-param name="levels" select="$levels"/>
-			<xsl:with-param name="range" select="$range"/>
-		</xsl:call-template>
-	</xsl:variable>
-
-	<!-- if this has a level, top ends at that level, otherwise this goes all the way to top of layer -->
-	<xsl:variable name="y"> <!-- the start of the box -->
-		<xsl:apply-templates select="ancestor::layer" mode="level-top">
-			<xsl:with-param name="index" select="$r1"/>
-		</xsl:apply-templates>
-	</xsl:variable>
-
-	<xsl:variable name="translate-y">
-		<xsl:choose>
-			<xsl:when test="@levels"><xsl:value-of select="$y"/></xsl:when>
-			<xsl:otherwise>0</xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable>
-	
-	<xsl:variable name="padding"><xsl:apply-templates select=".." mode="padding"/></xsl:variable>
-	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select=".."/></xsl:variable>	
-	<xsl:variable name="padding-top">
-		<xsl:choose>
-			<xsl:when test="$r1 = number($n) - 1"><xsl:value-of select="substring-before($padding,' ')"/></xsl:when>
-			<xsl:otherwise>0</xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable> 
-	<xsl:variable name="padding-bottom">
-		<xsl:choose>
-			<xsl:when test="$r0 = 0"><xsl:value-of select="substring-after($padding,' ')"/></xsl:when>
-			<xsl:otherwise>0</xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable> 
-
-	<g class="{name()}">
-		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>
-		<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="{$w}" height="{$h +  $padding-top + $padding-bottom}" y="{$y - $translate-y - $padding-top}">
-			<xsl:call-template name="styles"/>
-		</rect>		
-		<xsl:variable name="text-off"> <!--  middle-align if not showing children -->
-			<xsl:choose>
-				<xsl:when test="($Detail=name()) and $n!=1"><xsl:value-of select="$h *0.5 + $padding-bottom div 2"/></xsl:when>
-				
-				<xsl:when test="($Detail='subblock' and not(subblock)) or $Detail='block'"><xsl:value-of select="$h *0.5 + $padding-bottom div 2"/></xsl:when>
-				<xsl:otherwise>0</xsl:otherwise>
-			</xsl:choose>
-		</xsl:variable>
-		<xsl:variable name="text-align"> <!--  middle-align if not showing children -->
-			<xsl:choose>
-				<xsl:when test="($Detail=name()) and $n!=1">mathematical</xsl:when>				
-				<xsl:when test="($Detail='subblock' and not(subblock)) or $Detail='block'">mathematical</xsl:when>
-				<xsl:otherwise>ideographic</xsl:otherwise>
-			</xsl:choose>
-		</xsl:variable>
-		<xsl:variable name="min-h"> <!-- height of this if it were the only block in the layer -->
-			<xsl:apply-templates select="." mode="min-height"/>
-		</xsl:variable>
-	<!-- label goes here -->
-		<xsl:call-template name="linkable-content">
-			<xsl:with-param name="show">
-				<text text-anchor="middle" class="block" width="{$w}" x="{$w div 2}" y="{ $y + $h - $text-off + $padding-bottom  - $translate-y - 1 }" dominant-baseline="{$text-align}">
-					<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'text'"/></xsl:apply-templates>
-					<xsl:choose>
-						<xsl:when test="$mSize  &lt;= $h - $min-h "/>  <!--  plenty of room on bottom, no need for inline label -->
-						<xsl:when test="$Detail='collection' or $Detail='component'  or $Detail='layer'  or ( ($Detail='subblock') and subblock )">
-							<xsl:apply-templates select="." mode="label">
-								<xsl:with-param name="width" select="$w"/>
-							</xsl:apply-templates>
-						</xsl:when>
-					</xsl:choose>
-					<xsl:call-template name="display-name"/>
-				</text>
-			</xsl:with-param>
-		</xsl:call-template>
-		<g><xsl:apply-templates select="." mode="detail-stuff"/>
-	<!--<xsl:if test="@levels">
-		<xsl:call-template name="levels-labels">
-		<xsl:call-template>
-		<xsl:message/>
-	</xsl:if>-->
-		
-			<xsl:apply-templates select="*[1]">
-				<xsl:with-param name="levels">
-					<xsl:call-template name="zeros">
-						<xsl:with-param name="n"><xsl:apply-templates mode="n-levels" select="."/></xsl:with-param>
-					</xsl:call-template>				
-				</xsl:with-param>
-			</xsl:apply-templates>	
-		</g>
-	</g>
-	<xsl:apply-templates select="following-sibling::*[1]">
-		<xsl:with-param name="levels">
-			<xsl:call-template name="sum-levels">
-				<xsl:with-param name="levels" select="$levels"/>
-				<xsl:with-param name="range" select="$range"/>
-				<xsl:with-param name="width" select="$w"/>
-			</xsl:call-template>
-		</xsl:with-param>
-	</xsl:apply-templates>	
-</xsl:template>
-
-
-<xsl:template match="block" mode="post-levels"><xsl:param name="levels"/>
-	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
-	<xsl:variable name="next">
-		<xsl:call-template name="sum-levels">
-			<xsl:with-param name="levels" select="$levels"/>
-			<xsl:with-param name="range" select="$range"/>
-			<xsl:with-param name="width"><xsl:apply-templates mode="width"  select="."/></xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>
-	
-	<xsl:if test="not(following-sibling::*)"><xsl:value-of select="$next"/></xsl:if>
-	<xsl:apply-templates select="following-sibling::*[1]" mode="post-levels">
-		<xsl:with-param name="levels" select="$next"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="block" mode="min-label-width">
-	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
-	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
-	<xsl:variable name="padding"><xsl:apply-templates select=".." mode="padding"/></xsl:variable>
-	
-	
-	<xsl:variable name="h"><xsl:apply-templates select="." mode="height"/></xsl:variable>
-	<xsl:variable name="mh"><xsl:apply-templates select="." mode="min-height"/></xsl:variable>
-	<xsl:choose>
-		<xsl:when test="$mSize  &lt;= $h - $mh ">0</xsl:when>  <!--  plenty of room on bottom, no need for inline label -->
-		<xsl:when test="$r0 != 0 or number(substring-after($padding,' '))=0"><xsl:value-of select="$inlineLabel"/></xsl:when>
-		<xsl:otherwise>0</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template name="inline-label"><xsl:param name="width"/>
-	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select="."/></xsl:variable>
-	<xsl:variable name="widths">
-		<xsl:apply-templates select="*[1]" mode="post-levels">
-			<xsl:with-param name="levels">
-				<xsl:call-template name="zeros">
-					<xsl:with-param name="n" select="$n"/>
-				</xsl:call-template>
-			</xsl:with-param>
-		</xsl:apply-templates>	
-	</xsl:variable>
-	<xsl:variable name="range">
-		<xsl:choose>
-			<xsl:when test="@levels">0 <xsl:value-of select="$n - 1"/></xsl:when>
-			<xsl:otherwise><xsl:apply-templates select="." mode="level-range"/></xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable>
-	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
-
-	<xsl:variable name="min">
-		<xsl:call-template name="min-from-list-with-index">
-			<xsl:with-param name="list">
-				<xsl:call-template name="list-range">
-					<xsl:with-param name="list" select="$widths"/>
-					<xsl:with-param name="from" select="$r0"/>										
-					<xsl:with-param name="to" select="substring-after($range,' ')"/>
-				</xsl:call-template>
-			</xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>
-	<xsl:variable name="w0" select="$width - substring-before($min,':')"/>
-	<xsl:variable name="level" select="$r0 +  number(substring-after($min,':'))"/>
-	<xsl:variable name="x-center" select="$width - 0.5 * $w0"/>
-	<xsl:variable name="y">
-		<xsl:for-each select="*[1]">
-			<xsl:call-template name="level-top">
-				<xsl:with-param name="index" select="$level"/>
-			</xsl:call-template>
-		</xsl:for-each>
-	</xsl:variable>
-	<xsl:variable name="h"><xsl:choose>
-		<xsl:when test="ancestor::block[@levels]">
-			<xsl:apply-templates select="ancestor::block" mode="level-height">
-				<xsl:with-param name="index" select="$level"/>
-			</xsl:apply-templates>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:apply-templates select="ancestor::layer" mode="level-height">
-				<xsl:with-param name="index" select="$level"/>
-			</xsl:apply-templates>
-		</xsl:otherwise>
-	</xsl:choose></xsl:variable>
-
-	<xsl:attribute name="dominant-baseline">mathematical</xsl:attribute>
-	<xsl:attribute name="width"><xsl:value-of select="$w0"/></xsl:attribute>
-	<xsl:attribute name="x"><xsl:value-of select="$x-center"/></xsl:attribute>
-	<xsl:attribute name="y"><xsl:value-of select="$y +  0.5 * $h"/></xsl:attribute>
-</xsl:template>
-
-
-<xsl:template match="block" mode="label"><xsl:param name="width"/>
-	<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
-	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>		
-	<xsl:variable name="padding"><xsl:apply-templates select=".." mode="padding"/></xsl:variable>
-	<xsl:if test="$r0 != 0 or number(substring-after($padding,' '))=0">
-		<!-- need to put label on a level -->
-		<xsl:call-template name="inline-label">
-			<xsl:with-param name="width" select="$width"/>
-		</xsl:call-template>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="block" mode="level-height"><xsl:param name="level"/>
-	<xsl:apply-templates select="descendant::collection[1]" mode="height"/>
-</xsl:template>
-
-<xsl:template mode="n-levels" match="block[not(@levels)]" priority="2">
-	<xsl:apply-templates select=".." mode="n-levels"/>
-</xsl:template>
-
-<xsl:template mode="n-levels" match="block">
-	<xsl:variable name="levels" select="normalize-space(@levels)"/>
-	<xsl:variable name="n" select="string-length($levels)  - string-length(translate($levels,' ','')) +1"/> <!-- number of spaces +1 -->
-	<xsl:choose>
-			<!-- if there are no levels, there is one implicit level -->
-		<xsl:when test="$levels='' ">1</xsl:when>
-			<!-- if there are any collections with no level, we add an extra on top -->
-		<xsl:when test="descendant::collection[not(@level)]"><xsl:value-of select="$n + 1"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="$n"/></xsl:otherwise>
-	</xsl:choose>		
-</xsl:template>
-
-
-<!-- ============= range of levels ============= -->
-
-<!-- no levels in parent, always spans full height (of one) -->
-<xsl:template match="layer[not(@levels)]/block" mode="level-range" priority="7">0 0</xsl:template>
-
-<!-- explictly specifies the @level and @span -->
-<!-- a block with a @level means all on a single level or spans a number of levels down-->
-<xsl:template match="block[@level]" mode="level-range" priority="5">
-	<xsl:variable name="level"><xsl:call-template name="level-index"/></xsl:variable>
-	<xsl:choose>
-		<xsl:when test="@span &gt; 0">
-			<xsl:value-of select="$level - @span + 1"/>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:value-of select="$level"/>
-		</xsl:otherwise>
-	</xsl:choose>
-	<xsl:value-of select="concat(' ',$level)"/>
-</xsl:template>
-
-<!-- no @level but @levels in parent, is full range of parent -->
-<xsl:template match="block" mode="level-range">
-	<xsl:variable name="n"><xsl:apply-templates mode="n-levels" select=".."/></xsl:variable>
-	<xsl:value-of select="concat('0 ',$n - 1)"/>
-</xsl:template>
-
-<!-- ====== Layers ============= -->
-
-<xsl:template match="layer[@span&gt;0]" mode="height">
-	<xsl:call-template name="sum-list">
-		<xsl:with-param name="list">
-			<xsl:variable name="span" select="@span"/>
-			<xsl:text>0 </xsl:text>
-	 		<xsl:for-each select="preceding-sibling::layer[position() &lt;= $span]">
-				<xsl:if test="not(@span) or @span=0">		
-					<xsl:apply-templates select="." mode="height"/>
-					<xsl:text> </xsl:text>
-					<xsl:if test="position()!=last()">
-						<xsl:value-of select="concat($lgrpDx * count(key('lgrp-top',@name)),' ')"/>
-					</xsl:if>								
-					<xsl:if test="position()!=1">
-						<xsl:value-of select="concat($groupDy + $lgrpDx * count(key('lgrp-bottom',@name)),' ')"/>
-					</xsl:if>
-				</xsl:if>
-			</xsl:for-each>
-		</xsl:with-param>
-	</xsl:call-template>
-</xsl:template>
-
-
-<xsl:template match="layer" mode="height">
-	<xsl:variable name="pre"> <!-- space on top -->
-		<xsl:value-of select="concat($groupDy,' ')"/>
-	</xsl:variable>
-	
-	<xsl:variable name="post"> <!-- space on bottom -->
-		<xsl:value-of select="concat($groupDy,' ')"/>
-	</xsl:variable>
-
-	<xsl:variable name="h"><xsl:apply-templates mode="level-heights" select="."/></xsl:variable>
-	<xsl:call-template name="sum-list">
-		<xsl:with-param name="list">
-			<xsl:value-of select="$groupDy * (string-length($h)  - string-length(translate($h,' ','')) - 1)"/> <!-- spacing between levels -->
-			<xsl:value-of select="concat(' ',$pre,$post)"/>
-			<xsl:apply-templates mode="padding" select="."/>
-			<xsl:value-of select="concat(' ',$h)"/>
-		</xsl:with-param>
-	</xsl:call-template>	
-</xsl:template>
-
-
-<xsl:template match="layer" mode="min-width">
-	<xsl:call-template name="max-from-list">
-		<xsl:with-param name="list">	
-			<xsl:apply-templates select="*[1]" mode="post-levels">
-				<xsl:with-param name="levels">
-					<xsl:call-template name="zeros">
-						<xsl:with-param name="n">
-							<xsl:apply-templates mode="n-levels" select="."/>
-						</xsl:with-param>
-					</xsl:call-template>
-				</xsl:with-param>
-			</xsl:apply-templates>
-		</xsl:with-param>
-	</xsl:call-template>
-</xsl:template>
-
-
-<xsl:template match="layer" mode="padding">0 0</xsl:template>
-<xsl:template match="layer[block and not(collection)]" mode="padding" priority="1">
-	<xsl:value-of select="concat($groupDy,' ',$groupDy + 4.23)"/>
-</xsl:template>
-
-
-
-<xsl:template match="layer"><xsl:param name="y" select="0"/>
-
-	<xsl:variable name="top-space" select="$lgrpDx * count(key('lgrp-top',@name))"/>
-	<xsl:variable name="bottom-space" select="$lgrpDx * count(key('lgrp-bottom',@name))"/>
-
-	<xsl:variable name="h"><xsl:apply-templates select="." mode="height"/></xsl:variable>
-	<xsl:variable name="w"><xsl:apply-templates select="." mode="min-width"/></xsl:variable><!-- the width of the content -->
-	<xsl:variable name="span-width"> <!-- space taken up by spanning layers-->
-		<xsl:call-template name="sum-list">
-			<xsl:with-param name="list">0 <xsl:for-each select="following-sibling::layer">
-				<xsl:if test="@span and position() - @span &lt;= 0"><xsl:apply-templates select="." mode="min-width"/><xsl:value-of select="concat(' ',$groupDx,' ')"/></xsl:if></xsl:for-each>
-			</xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>	
-	<xsl:variable name="my-width" select="$full-width - $span-width"/> <!-- the width of this layer -->
-	<g class="{name()}" transform="translate(0 {$y + $top-space})"><xsl:apply-templates select="." mode="filter"/>
-		<xsl:attribute name="id"><xsl:apply-templates select="." mode="id"/></xsl:attribute>	
-		<xsl:apply-templates select="." mode="animate-color"/>	
-        <xsl:apply-templates select="." mode="multi-color"/>		
-		<xsl:call-template name="linkable-content">
-			<xsl:with-param name="show">
-				<rect x="0.3" y="0.3" width="9.3" rx="4.65" ry="4.65" class="{name()}" height="{$h}">
-					<xsl:call-template name="styles"><xsl:with-param name="for" select="'label'"/></xsl:call-template>
-				</rect>
-				<text  text-anchor="middle" dominant-baseline="mathematical" class="layer" transform="rotate(-90)" 
-					 y="4.95" width="{$h}" x="{ -($h div 2 ) -  0.3}">
-					<xsl:call-template name="display-name"/>
-				</text>
-			</xsl:with-param>
-		</xsl:call-template>
-		<xsl:variable name="x-off">
-			<xsl:choose>
-				<xsl:when test="$my-width &lt;= $w">0</xsl:when> <!-- should never be less than -->
-				<xsl:when test="@align='left'">0</xsl:when>
-				<xsl:when test="@align='right'"><xsl:value-of select="$my-width - $w"/></xsl:when>
-				<xsl:otherwise><xsl:value-of select="0.5 * ($my-width - $w)"/></xsl:otherwise> <!-- align='center' -->
-			</xsl:choose>
-		</xsl:variable>
-
-		<xsl:variable name="padding"><xsl:apply-templates select="." mode="padding"/></xsl:variable>
-		<g class="layer-detail" transform="translate({12.8 + $x-off} {$groupDy +  substring-before($padding,' ')})">
-			<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>
-			<rect x="{-$x-off}" class="{name()}" y="{- $groupDy - substring-before($padding,' ')}" width="{$my-width}" height="{$h}">
-				<xsl:call-template name="styles"/>
-			</rect>
-			<g><xsl:apply-templates select="." mode="detail-stuff"/>
-				<xsl:apply-templates select="*[1]">
-					<xsl:with-param name="levels">
-						<xsl:call-template name="zeros">
-							<xsl:with-param name="n">
-								<xsl:apply-templates mode="n-levels" select="."/>
-							</xsl:with-param>
-						</xsl:call-template>
-					</xsl:with-param>
-				</xsl:apply-templates>
-			</g>
-		</g>			
-	</g>
-	<xsl:apply-templates select="preceding-sibling::*[1]">
-		<xsl:with-param name="y" select="$y + $h + $groupDy + $top-space + $bottom-space"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="layer[@span &gt; 0]"><xsl:param name="y" select="0"/>
-	<xsl:variable name="top-space" select="$lgrpDx * count(key('lgrp-top',preceding-sibling::layer[not(@span)][1]/@name))"/>
-	<xsl:variable name="h"><xsl:apply-templates select="." mode="height"/></xsl:variable>
-	<xsl:variable name="w"><xsl:apply-templates select="." mode="min-width"/></xsl:variable><!-- the width of the content -->
-	<xsl:variable name="span-width"> <!-- space taken up by spanning layers-->
-		<xsl:call-template name="sum-list">
-			<xsl:with-param name="list">0 <xsl:for-each select="following-sibling::layer">
-				<xsl:if test="@span and position() - @span &lt;= 0"><xsl:apply-templates select="." mode="min-width"/><xsl:value-of select="concat(' ',$groupDx,' ')"/></xsl:if></xsl:for-each>
-			</xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>		
-	<xsl:variable name="padding"><xsl:apply-templates select="." mode="padding"/></xsl:variable>
-	<xsl:variable name="x-off" select="$full-width - $w - $span-width"/>
-	<g class="{name()}" transform="translate(0 {$y + $top-space})"><xsl:apply-templates select="." mode="filter"/>
-		<g class="layer-detail">
-			<xsl:attribute name="transform">translate(<xsl:value-of select="concat(12.8 + $x-off,' ')"/>
-				<xsl:choose>
-					<xsl:when test="count(*)&gt;1 or not(block)"><xsl:value-of select="$groupDy + substring-before($padding,' ')"/></xsl:when>
-					<xsl:otherwise><xsl:value-of select="substring-before($padding,' ')"/></xsl:otherwise>
-				</xsl:choose>)</xsl:attribute>
-			<xsl:apply-templates select="." mode="detail-stuff"><xsl:with-param name="s" select="'mouseover'"/></xsl:apply-templates>
-			<rect x="0" class="{name()}" y="{-$groupDy - substring-before($padding,' ') }" width="{$w}" height="{$h}">
-				<xsl:if test="count(*)=1 and block"><xsl:attribute name="y"><xsl:value-of select=" -number(substring-before($padding,' '))"/></xsl:attribute></xsl:if>
-				<xsl:call-template name="styles"/>
-			</rect>
-				<xsl:call-template name="linkable-content">
-					<xsl:with-param name="show">
-						<text  text-anchor="middle" dominant-baseline="ideographic" class="layer" width="{$w}" x="{$w div 2}">
-							<xsl:attribute name="y"><xsl:value-of select="$h - $groupDy - 2.3"/></xsl:attribute>
-							<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="*[1]">
-					<xsl:with-param name="levels">
-						<xsl:call-template name="zeros">
-							<xsl:with-param name="n">
-								<xsl:apply-templates mode="n-levels" select="."/>
-							</xsl:with-param>
-						</xsl:call-template>
-					</xsl:with-param>
-				</xsl:apply-templates>
-			</g>
-		</g>
-	</g>
-	<xsl:apply-templates select="preceding-sibling::*[1]">
-		<xsl:with-param name="y" select="$y"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-<!-- return a list of the heights of all the levels. should only be called on a layer or block -->
-
-
-<xsl:template match="layer-group"><xsl:param name="y" select="0"/>
-	<xsl:apply-templates select="." mode="lgrp"/>
-	<xsl:apply-templates select="preceding-sibling::*[1]">
-		<xsl:with-param name="y" select="$y"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-<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>
-
-
-<xsl:template match="layer-group" mode="lgrp"><xsl:param name="left" select="- $left-borders"/><xsl:param name="right" select="$view-width - $left-borders - 2 * $groupDy"/>
-	<!-- use indexes to make life easier -->
-	<xsl:variable name="from" select="1 +  count(key('layer',@from)/preceding-sibling::layer)"/>
-	<xsl:variable name="to" select="1 +  count(key('layer',@to)/preceding-sibling::layer)"/>
-	<xsl:choose>
-		<xsl:when test="not(key('layer',@from))">
-			<xsl:message>&#xa;Error:  layer "<xsl:value-of select="@from"/>" does not exist"</xsl:message>
-		</xsl:when>
-		<xsl:when test="not(key('layer',@to))">
-			<xsl:message>&#xa;Error:  layer "<xsl:value-of select="@to"/>" does not exist"</xsl:message>
-		</xsl:when>
-		<xsl:when test="$from &gt; $to">
-			<xsl:message>&#xa;Error: "<xsl:value-of select="@from"/>" is after "<xsl:value-of select="@to"/>"</xsl:message>
-		</xsl:when>
-		<xsl:when test="key('layer',@to)[@span]">
-			<xsl:message>&#xa;Error: Layer group cannot be bounded by spanned layer "<xsl:value-of select="@to"/>"</xsl:message>
-		</xsl:when>
-		<xsl:when test="key('layer',@from)[@span]">
-			<xsl:message>&#xa;Error: Layer group cannot be bounded by spanned layer "<xsl:value-of select="@from"/>"</xsl:message>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:variable name="to-name" select="@to"/>
-			<xsl:variable name="from-name" select="@from"/>
-			<xsl:variable name="parent-to" select="count(ancestor::layer-group[@to=$to-name])"/>
-			<xsl:variable name="child-to" select="1+ count(descendant::layer-group[@to=$to-name])"/>
-			<xsl:variable name="child-from" select="1+ count(descendant::layer-group[@from=$from-name])"/>
-			<xsl:variable name="start">
-				<xsl:call-template name="sum-list">
-					<xsl:with-param name="list">
-						<xsl:value-of select="concat($groupDy + $lgrpDx *  $parent-to,' ')"/>
-						<xsl:for-each select="key('layer',@to)/following-sibling::layer[not(@span)]">
-							<xsl:apply-templates select="." mode="height"/>
-							<xsl:value-of select="concat(' ',$groupDy + $lgrpDx* (count(key('lgrp-top',@name))+ count(key('lgrp-bottom',@name))),' ')"/>
-						</xsl:for-each>
-					</xsl:with-param>
-				</xsl:call-template>
-			</xsl:variable>
-			<xsl:variable name="height">
-				<xsl:call-template name="sum-list">
-					<xsl:with-param name="list">
-						<xsl:value-of select="concat($lgrpDx *  ($child-to+ $child-from),' ')"/>					
-						<xsl:for-each select="//systemModel/layer[position() &gt;= $from and position() &lt;= $to][not(@span)]">
-							<xsl:apply-templates select="." mode="height"/>
-							<xsl:text> </xsl:text>
-							<xsl:if test="position()!=last()">
-								<xsl:value-of select="concat($lgrpDx * count(key('lgrp-top',@name)),' ')"/>
-							</xsl:if>								
-							<xsl:if test="position()!=1">
-								<xsl:value-of select="concat($groupDy + $lgrpDx * count(key('lgrp-bottom',@name)),' ')"/>
-							</xsl:if>
-						</xsl:for-each>
-					</xsl:with-param>
-				</xsl:call-template>
-			</xsl:variable>
-			<g class="{name()}">
-				<rect width="{$right - $left}" height="{$height}" x="{$left}" y="{$start }" rx="4.65"  fill="{@color}"/>
-				<xsl:if test="@label">
-					<text text-anchor="middle" dominant-baseline="mathematical" 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>
-
-<!--level should always be '0', so ignore it and just give height of layer -->
-<xsl:template mode="level-height" match="layer[not(@levels)]" priority="5">
-	<xsl:call-template name="max-from-list">
-		<xsl:with-param name="list">
-			<xsl:value-of select="concat($mSize,' ')"/> <!-- min size is one collection height -->
-		<xsl:for-each select="*[@levels]">
-			<xsl:apply-templates select="." mode="height"/>
-			<xsl:text> </xsl:text>
-		</xsl:for-each>
-		</xsl:with-param>
-	</xsl:call-template>
-</xsl:template>
-
-<!-- layer has levels -->
-<xsl:template mode="level-height" match="layer"><xsl:param name="level"/>
-<!--	 find all blocks which this contains and use a factor of their heights,
-	min is height of collection -->
-	<xsl:call-template name="max-from-list">
-		<xsl:with-param name="list">
-			<xsl:value-of select="concat($mSize, ' ')"/>
-			<xsl:for-each select="block[@levels]"> <!-- only check self-heighted stuff -->
-				<xsl:variable name="range"><xsl:apply-templates select="." mode="level-range"/></xsl:variable>
-				<xsl:variable name="r0" select="number(substring-before($range,' '))"/>
-				<xsl:variable name="r1" select="number(substring-after($range,' '))"/>		
-				<xsl:if test="($r0 &lt;=$level)  and ($r1 &gt;=$level)">
-					<xsl:variable name="h"><xsl:apply-templates select="." mode="min-height"/></xsl:variable>
-					<xsl:value-of select="concat($h div ($r1 - $r0 +1), ' ')"/>
-				</xsl:if>
-			</xsl:for-each>
-		</xsl:with-param>
-	</xsl:call-template>
-</xsl:template>
-
-
-
-
-<xsl:template mode="n-levels" match="layer"> <!-- number of levels available to children of this layer -->
-	<xsl:variable name="levels" select="normalize-space(@levels)"/>
-	<xsl:variable name="n" select="string-length($levels)  - string-length(translate($levels,' ','')) +1"/> <!-- number of spaces +1 -->
-	<xsl:choose>
-			<!-- if there are no levels, there is one implicit level -->
-		<xsl:when test="$levels='' ">1</xsl:when>
-			<!-- if there are any collections with no level, we add an extra on top -->
-		<xsl:when test="collection[not(@level)] or block[not(@levels) and not(@level)]/descendant::collection[not(@level)]"><xsl:value-of select="$n + 1"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="$n"/></xsl:otherwise>
-	</xsl:choose>		
-</xsl:template>
-
-<!-- should never be called -->
-<xsl:template match="layer" mode="level-range">0 0</xsl:template>
-
-
-<!-- ====== Levels ============= -->
-
-<!--
-options: 
-	layer[@levels]/block[@levels]/collection[@level]
-		use collection/@level in context of block/@levels
-	layer[@levels]/block[@levels]/collection[not(@level)]
-		use '' (unnamed top level, increase n-levels in block) in context of block/@levels
-	layer[@levels]/block[not(@levels) and not(@level)]/collection[@level]
-		use collection/@level in context of layer/@levels
-	layer[@levels]/block[not(@levels) and not(@level)]/collection[not(@level)]
-		use '' (unnamed top level, increase n-levels in layer) in context of layer/@levels
-	layer[@levels]/block[not(@levels) and @level]/collection[@level]
-		use collection/@level in context of layer/@levels (warning if @level is not in range of parent)
-	layer[@levels]/block[not(@levels) and @level]/collection[not(@level)]
-		use block/@level in context of layer/@levels (raise warning)
-	layer[not(@levels)]/block[not(@levels) and not(@level)]/collection[@level]
-		use '' (raise warning)
-	layer[not(@levels)]/block[not(@levels) and not(@level)]/collection[not(@level)]
-		use ''
-	layer[not(@levels)]/block[not(@levels) and @level]/collection[@level]
-		use '' (raise warning)
-	layer[not(@levels)]/block[not(@levels) and @level]/collection[not(@level)]
-		use '' (raise warning)
--->
-
-<!-- any collection means on a single level -->
-<xsl:template match="collection" mode="level-range">
-	<xsl:variable name="level"><xsl:apply-templates select="." mode="level-index"/></xsl:variable>
-	<xsl:value-of select="concat($level,' ',$level)"/>
-</xsl:template>
-
-<xsl:template name="level-index">
-	<!-- this must have a @level and an ancestor with @levels -->
-	<xsl:variable name="levels"><xsl:value-of select="concat(' ',normalize-space(ancestor::*[@levels][1]/@levels),' ')"/></xsl:variable>
-	<xsl:variable name="level" select="concat(' ',@level,' ')"/>
-	<xsl:choose>
-		<xsl:when test="contains($levels,$level)">
-			<xsl:variable name="pre" select="substring-before($levels,$level)"/>
-			<xsl:value-of select="string-length($pre) - string-length(translate($pre,' ',''))"/>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:message>&#xa;error: invalid level name: <xsl:value-of select="@level"/> in <xsl:value-of select="name()"/> "<xsl:value-of select="@name"/>" [<xsl:value-of select="$levels"/>]</xsl:message>
-			<xsl:value-of select="string-length($levels) - string-length(translate($levels,' ','')) - 1"/>
-		</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<!-- by default use height of all levels -->
-<xsl:template mode="level-heights" match="layer|block[@levels]">
-	<xsl:param name="range">
-		<xsl:variable name="level"><xsl:apply-templates select="." mode="n-levels"/></xsl:variable>
-		<xsl:value-of select="concat('0 ',$level - 1)"/>
-	</xsl:param>
-	<xsl:variable name="r0" select="number(substring-before($range,' '))"/>
-	<xsl:variable name="r1" select="number(substring-after($range,' '))"/>
-	<xsl:apply-templates select="." mode="level-height">
-		<xsl:with-param name="level" select="$r0"/>
-	</xsl:apply-templates>	
-	<xsl:text> </xsl:text>
-	<xsl:if test="$r1 &gt; $r0">
-		<xsl:apply-templates select="." mode="level-heights">
-			<xsl:with-param name="range" select="concat($r0 + 1,' ' ,$r1)"/>
-		</xsl:apply-templates>			
-	</xsl:if>
-</xsl:template>
-
-<!-- the y-position for level $index -->
-<xsl:template match="layer|block[@levels]" mode="level-top"><xsl:param name="index"/>
-	<xsl:variable name="n"><xsl:apply-templates select="." mode="n-levels"/></xsl:variable>
-	<xsl:choose>
-		<xsl:when test="number($index) = number($n) - 1">0</xsl:when> <!-- it's the top level, so y = 0 -->
-		<xsl:otherwise>
-			<xsl:variable name="h">
-				<xsl:apply-templates mode="level-heights" select=".">
-					<xsl:with-param name="range" select="concat($index +  1,' ' ,$n - 1)"/>
-				</xsl:apply-templates>
-			</xsl:variable>
-			<xsl:call-template name="sum-list">
-				<xsl:with-param name="list">
-					<xsl:value-of select="$groupDy * (string-length($h)  - string-length(translate($h,' ','')))"/>
-					<xsl:value-of select="concat(' ',$h)"/>
-				</xsl:with-param>
-			</xsl:call-template>				
-		</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-<xsl:template match="block[not(@levels)]" mode="level-top"><xsl:message>
-Error! This template should not have been called</xsl:message>
-</xsl:template>
-
-<!-- the y-coord of the top of the level. If not specified uses level of current node -->
-<xsl:template name="level-top"><xsl:param name="index"/>
-	<xsl:choose>
-		<xsl:when test="ancestor::block[@levels]">
-			<xsl:apply-templates select="ancestor::block" mode="level-top">
-				<xsl:with-param name="index" select="$index"/>
-			</xsl:apply-templates>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:apply-templates select="ancestor::layer" mode="level-top">
-				<xsl:with-param name="index" select="$index"/>
-			</xsl:apply-templates>
-		</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template name="x-pos"><xsl:param name="levels"/><xsl:param name="range"/>
-	<!-- flush the box at the level ranges in $range against the level array -->
-	 <!--pick  largest value in range  -->
-	<xsl:variable name="right">
-		<xsl:call-template name="max-from-list">
-			<xsl:with-param name="list">
-				<xsl:call-template name="list-range">
-					<xsl:with-param name="list" select="$levels"/>
-					<xsl:with-param name="from" select="substring-before($range,' ')"/>
-					<xsl:with-param name="to" select="substring-after($range,' ')"/>
-				</xsl:call-template>
-			</xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>
-	<xsl:choose>
-		<xsl:when test="$right=0">0</xsl:when>
-		<xsl:otherwise><xsl:value-of select=" $groupDx + $right"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>	
-
-
-<!-- ============= list handlers ============= -->
-
-<xsl:template name="sum-levels"><xsl:param name="levels"/> 
-	<xsl:param name="range"/><xsl:param name="width"/> 
-
-
-	<!-- add a box with levels indexes in range to level array -->
-	<xsl:variable name="left">
-		<xsl:call-template name="x-pos">
-			<xsl:with-param name="levels" select="$levels"/>
-			<xsl:with-param name="range" select="$range"/>
-		</xsl:call-template>
-	</xsl:variable>
-	<xsl:call-template name="list-replace">
-		<xsl:with-param name="list" select="$levels"/>
-		<xsl:with-param name="from" select="substring-before($range,' ')"/>
-		<xsl:with-param name="to" select="substring-after($range,' ')"/>
-		<xsl:with-param name="value" select="$left + $width"/>
-	</xsl:call-template>
-</xsl:template>
-
-<xsl:template name="list-replace"><xsl:param name="list"/><xsl:param name="from"/><xsl:param name="to"/><xsl:param name="value"/>
-	<xsl:choose>
-		<xsl:when test="$from &lt; 1 and $to &gt;= 0"><xsl:value-of select="$value"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="substring-before($list,' ')"/></xsl:otherwise>
-	</xsl:choose>
-	<xsl:text> </xsl:text>
-	<xsl:if test="contains(substring-after($list,' '),' ')">
-		<xsl:call-template name="list-replace">
-			<xsl:with-param name="list" select="substring-after($list,' ')"/>
-			<xsl:with-param name="from" select="$from - 1"/>
-			<xsl:with-param name="to" select="$to - 1"/>
-			<xsl:with-param name="value" select="$value"/>
-		</xsl:call-template>
-	</xsl:if>
-</xsl:template>
-
-<!--  last item in space-separated list -->
-<xsl:template name="last-in-list"><xsl:param name="str"/>
-	<xsl:choose>
-		<xsl:when test="contains($str,' ')">
-			<xsl:call-template name="last-in-list">
-				<xsl:with-param name="str" select="substring-after($str,' ')"/>
-			</xsl:call-template>
-		</xsl:when>
-		<xsl:otherwise><xsl:value-of select="$str"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<!-- a list of n zeros -->
-<xsl:template name="zeros"><xsl:param name="n"/>
-	<xsl:text>0 </xsl:text>
-	<xsl:if test="$n &gt; 1">
-		<xsl:call-template name="zeros">
-			<xsl:with-param name="n" select="$n - 1"/>
-		</xsl:call-template>
-	</xsl:if>
-</xsl:template>
-
-
-<!-- ====== legend ============= -->
-
-<xsl:include href="legend.xsl"/>
-<!-- end legend -->
-
-
-<xsl:template match="logo" mode="width">
-	<xsl:variable name="b" select="normalize-space(@viewBox)"/>
-	<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:template>
-<xsl:template match="logo" mode="height">
-	<xsl:variable name="b" select="normalize-space(@viewBox)"/>
-	<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:template>
-
-
-<xsl:template match="logo"><xsl:param name="y" select="0"/>
-	<g class="logo" transform="translate({- $left-borders} {$y})">
-	<xsl:attribute name="transform">translate(<xsl:value-of select="concat(- $left-borders,' ',$y)"/>) <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:apply-templates select="preceding-sibling::*[1]">
-		<xsl:with-param name="y" select="$y"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/src/svg/DrawSvg.pl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#!perl
-# Copyright (c) 2007-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:
-#
-
-use strict;
-use warnings;
-use FindBin;
-use lib $FindBin::Bin;
-use lib $FindBin::Bin."/svg";
-use lib $FindBin::Bin."/common";
-use lib $FindBin::Bin."/../common"; # needed to run from within DepToolkit
-
-use DrawSvg;
-
-my $drawer = new DrawSvg();
-$drawer->Draw();
-
-exit;
--- a/sysmodellibs/sysmodelgen/src/svg/DrawSvg.pm	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1243 +0,0 @@
-# Copyright (c) 2007-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:      DrawSvg
-# Build the SVG diagram
-# 
-#
-
-package DrawSvg;
-
-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 DepConstants;
-
-
-use constant KNoCoreOs					=> 0;
-use constant KCoreOsWithHal			=> 1;
-use constant KCoreOsWithHardware	=> 2;
-
-my @Filters;
-
-#-------------------------------------------------------------------------------------------------
-# 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
-    
-    $self->{iScriptCode} = 999;
-    
-    # basic test of command line:
-    if (scalar(@ARGV) == 0)
-    	{
-		warn $self->Help();
-        &Logger::LogFatal("Incorrect syntax. Cannot continue...", $self->{iScriptCode});
-    	}
-    
-    # process the input:
-    $self->ParseCommandLineOptions();
-    
-    $self->{iReturnCode} = DepConstants::KErrorNone;
-    return $self;
-	}
-
-
-sub GuessReleaseNumber()
-	{
-	my $self = shift;	
-	# always use release value if defined
-	$self->{iRelease} && return $self->{iRelease} ;
-	# if not there, it's in the s12,
-	my $ver;
-	my $t = $/;
-	foreach my $s12 (@{$self->{'iS12'}})		# use version from first s12 file listed
-		{
-		if(-d $s12) {next}
-		open(FILE,$s12) || return;
-		$/='>';
-		while(<FILE>)
-			{
-			if(/<Schedule12\s.*\bOS_version=('(.*?)'|"(.*?)")/s)
-				{
-				$ver = $2 || $3;
-				last;
-				}
-			}
-		close FILE;
-		$/=$t;
-		return  $ver;
-		}
-	# not there either, 
-	if($self->{'iDepsFile'}) 
-		{
-		open(FILE,$self->{'iDepsFile'}) || return;
-		$/='>';
-		while(<FILE>)
-			{
-			if(/<SystemModelDeps\s.*\bversion=('(.*?)'|"(.*?)")/s)
-				{
-				$ver = $2 || $3;
-				last;
-				}
-			}
-		close FILE;
-		$/=$t;
-		return  $ver;
-		}
-	return "";
-	}
-
-
-# an empty value indicates its a single file. Any other value means it's a list separated by that value as a regexp
-%KFileParams = 
-	( 
-	'iSysDefFile'	=> ',',
-	'iS12'		=> ',',
-	'iExtra'		=> ',',
-	'iDepsFile'	=> '',
-	'iLocalize'		=> ',',
-	'iLevels'		=> ',',
-	'iStyle'		=> ',',
-	'iOverlay'		=> ',',
-	'iBorder'		=> ',',
-	'iColor'		=> ',',
-	'iShapes'		=> '',
-	'iLogoSrc'		=> '',
-	'iModel'		=> '',
-	'iLogFile'		=> '',
-	);
-
-sub ParseCommandLineOptions()
-	{
-	my $self = shift;
-	
-	# Possible arguments (with default values where possible):
-	my $help;
-	$self->{iSysDefFile};
-	$self->{iDepsFile};
-	$self->{iOutputCsv};
-	$self->{iCsvColumns};
-	$self->{iCsvLabels};
-	$self->{iTemporaryDirectory};
-	$self->{iLogFile};
-	$self->{iWarningLevel};
-	$self->{iClean}; # if specified, it will delete the temp directory.
-
-	# custom properties:
-	$self->{iDiagram}; # the output svg
-	$self->{iCopyright};
-	$self->{iRelease};
-	$self->{iName};
-	$self->{iLabel};
-	$self->{iModel};
-	$self->{iCoreOs};
-	$self->{iLevels};
-	$self->{iExtra};
-	$self->{iIniFile};
-	$self->{iS12};
-	$self->{iLink};
-	# Read in the user arguments:
-	GetOptions( "h"						=> \$help,
-				"i=s"					=> \$self->{iIniFile},
-				"output=s"				=> \$self->{iDiagram} ,
-				"csv_output=s"				=> \$self->{iOutputCsv} ,
-				"csv_columns=s"				=> \$self->{iCsvColumns} ,
-				"csv_labels=s"				=> \$self->{iCsvLabels} ,
-				'xml_output=s'				=> \$self->{iOutputXml} ,
-				"model=s"				=> \$self->{iModel} ,
-				"sysdef=s"				=> \@{$self->{iSysDefFile}} ,
-				"srcvar=s"				=> \@{$self->{iSourceRoot}} ,
-				"shapes=s"				=> \$self->{iShapes},
-				"link=s"				=> \$self->{iLink},
-				"system_name=s"			=> \$self->{iName} ,
-				"system_version=s"		=> \$self->{iRelease} ,
-				"model_name=s"			=> \$self->{iLabel} ,
-				"model_version=s"		=> \$self->{iRevision},
-				"model_version_type=s"	=> \$self->{iRevisionType},
-				"copyright=s"			=> \$self->{iCopyright},
-				"distribution=s"		=> \$self->{iDistribution},
-				"coreos=s"				=> \$self->{iCoreOs},
-				
-				"sysinfo=s"				=> \@{$self->{iExtra}},
-				"localize=s"			=> \@{$self->{iLocalize}},
-				"levels=s"				=> \@{$self->{iLevels}},
-				
-				"color=s"				=> \@{$self->{iColor}},
-				"border-shape=s"		=> \@{$self->{iBorder}},
-				"pattern=s"				=> \@{$self->{iOverlay}},
-				"border-style=s"		=> \@{$self->{iStyle}},
-				
-				"filter=s"				=> \@{$self->{iFilter}},
-				"filter-has=s"				=> \&OrderedOption,
-				"show-attr=s"			=> \&OrderedOption,
-				"hide-attr=s"			=> \&OrderedOption,
-				"ignore=s"				=> \@{$self->{iIgnore}},
-				
-				"s12=s"				=>  \@{$self->{iS12}},
-				
-				"detail=s"				=> \$self->{iDetail},
-				"detail-type=s"				=> \$self->{iDetailType},
-				"page-width=s"			=> \$self->{iPageWidth},
-				"static"				=> \$self->{iStatic},
-				"deps=s"				=> \$self->{iDepsFile},
-				"w=s"					=> \$self->{iWarningLevel},
-				"clean"				=> \$self->{iClean},				
-				"compress"				=> \$self->{iCompress},
-				"tempdir=s"				=> \$self->{iTemporaryDirectory},
-				"dpi=s"				=> \$self->{iPrintResolution},
-				"model_font=s"				=> \$self->{iModelFont},
-				"version-list=s"			=>  \$self->{iVersions},
-				"log=s"				=> \$self->{iLogFile},
-				"logo=s"				=> \$self->{iLogoSrc},
-				"logo-height=s"				=> \$self->{iLogoHeight},
-				"logo-width=s"				=> \$self->{iLogoWidth},
-				"legend-width=s"			=> \$self->{iLegendWidth},
-				"legend-max-scale=s"			=> \$self->{iLegendMaxScale},
-				"title-scale=s"			=> \$self->{iTitleScale},
-				"xslt-param=s"			=> \%{$self->{iXsltParam}},
-				"note=s"			=> \@{$self->{iLegendNote}}
-				);
-
-	if ($help)
-	    {
-	   	warn $self->Help();
-	   	exit DepConstants::KErrorNone;
-	   	}
-
-	@{$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}
-				warn "Invalid syntax";
-				warn $self->Help();
-	   			exit DepConstants::KIncorrectSyntax
-				}
-			if(!(-e $ARGV[$i])) {
-				warn "file $ARGV[$i] does not exist";
-	   			exit DepConstants::KFileDoesNotExist;
-			}
-		}
-	
-	# Now read the ini file and override command line if necessary:
-	my @yr = gmtime();
-	my $dataroot =&DepConstants::SystemModelXmlDataDir();
-	my %defaults = (
-		'iCopyright' 			=> (1900+$yr[5])." Nokia Corporation",
-		'iDiagram' 			=> "sysmodel.svg",
-		'iTemporaryDirectory' 	=> "drawsvg_temp",
-		'iName' 				=> "Symbian OS"	,
-		'iLabel' 				=> "System Model",
-		'iShapes' 				=> "$dataroot/Shapes.xml" 	,
-		'iLogFile' 				=> ""  # do not set this to any default: stdout is used if log file isn't set
-	);
-	my %defaultsForMulti = (
-		'iLocalize' 			=> "$dataroot/display-names.xml" ,
-		'iExtra' 				=> "$dataroot/SystemInfo.xml"   
-	);
-
-	$self->ReadIniFile();
-
-	foreach my $type ('iSysDefFile', 'iFilter','iSourceRoot')
-		{
-		if(scalar(@{$self->{$type}})==1 && $self->{$type}->[0]=~/,/)
-			{ # treat as comma-separated for backwards compatibility (leave alone if no commas)
-			@{$self->{$type}} = split(/,/,$self->{$type}->[0]);
-			}
-		}
-	if (scalar(@{$self->{iIgnore}})) 
-		{
-		foreach my $type ('iIgnore')
-			{
-			if(scalar(@{$self->{$type}})==1)
-				{ # treat as semicolon-separated for backwards compatibility
-				@{$self->{$type}} = split(/;/,$self->{$type}->[0]);
-				}
-			}
-		}
-	else
-		{
-		push(@{$self->{iIgnore}}, "layer:Tools and Utils and SDKENG","layer:MISC","block:Techview") 
-		}
-
-	
-	my $ver = $self->GuessReleaseNumber(); # determine release from attached files.
-		
-	# Use a special levels.xml file for 9.1 (unless it's specified by the user):
-	push(@{$self->{iLevels}}, "$dataroot/Levels91.xml") if !scalar(@{$self->{iLevels}}) and $ver eq "9.1";
-	push(@{$self->{iLevels}}, "$dataroot/Levels.xml") if !scalar(@{$self->{iLevels}}) and ($ver eq "9.2" or $ver eq "9.2" );
-
-	if(!scalar(@{$self->{'iFiltering'}}) && !scalar(@{$self->{'iFilter'}}))
-		{ # filter only has a default if fitler-has is not set
-		@{$self->{'iFilter'}}= ("java","gt");
-		}
-	while (($key, $value) = each %defaults) {
-		$self->{$key} = $value if ! defined $self->{$key};
-	}
-
-	while (($key, $value) = each %defaultsForMulti) {
-		push(@{$self->{$key}}, $value) if ! scalar(@{$self->{$key}});
-	}
-
-
-
-	# if saving to .svgz, try to compress
-	$self->{iCompress} = $self->{iCompress} || ( $self->{iDiagram} =~ /\.svgz$/i );
-
-	# if there's a deps file XSLT will get revision number and type from that.
-	# if there is no deps file and neither revision nor revision type are specified, default to "DRAFT 1"
-	if(!$self->{'iDepsFile'} &&  !$self->{'iRevision'} && !$self->{'iRevisionType'})
-		{
-		$self->{'iRevisionType'} = "draft";
-		$self->{'iRevision'} = "1";
-		}
-	
-	if ($self->{iShapes} eq "$dataroot/Shapes.xml"  && !scalar(@{$self->{'iColor'}}))
-		{ # if it's got the default shapes use default colours
-		@{$self->{iColor}} = (&DepConstants::SystemModelColorsXmlFile());
-		}
-
-	if(defined $self->{iCoreOs})
-		{
-		if($self->{iCoreOs}=~/(on|yes|true)$/i )
-			{
-			$self->{iCoreOs} = KCoreOsWithHal;
-			}
-		elsif($self->{iCoreOs}=~/(off|no|false)$/i )
-			{
-			$self->{iCoreOs} = KNoCoreOs;
-			}
-		elsif(! ($self->{iCoreOs}=~/^[0-9]+$/ ))	# any other non-number
-			{
-			$self->{iCoreOs} = KCoreOsWithHardware;
-			}
-		}
-	else		# use version numebr to decide
-		{
-		$self->{iCoreOs} = ($self->{iRelease} eq 'Future' || $ver > 9.4) ? KCoreOsWithHardware :
-			(($ver=~/^9\.4/) ? KCoreOsWithHal : KNoCoreOs);
-	}
-
-	$self->{'iGuessVer'} = $ver;
-
-	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} = DepConstants::WARNING;
-			}
-		elsif ($self->{iWarningLevel} == 3)
-			{
-			$self->{iWarningLevel} = DepConstants::INFO;
-			}
-		else # for anything higher than set it to DepConstants::VERBOSE
-			{
-			$self->{iWarningLevel} = DepConstants::VERBOSE;
-			}
-		}
-	else
-		{
-		$self->{iWarningLevel} = DepConstants::ERROR;
-		}
-	# set the logger up:
-	$Logger::SEVERITY = $self->{iWarningLevel};
-	
-	# set all URIs
-
-	(my $dir  = cwd ) =~ s#\/#\\#g;
-	
-	
-	foreach ( keys(%KFileParams)) {
-		if($self->{$_} eq '') {next} # no value, so do nothing
-		if($KFileParams{$_} eq '') {
-			$self->{$_}  = &FullPath("$dir\\",	$self->{$_} );
-		} elsif($KFileParams{$_} eq ',') {
-			foreach my $item  (@{$self->{$_}})	{
-				if ($item eq '') {next}	# skip if explicitly set to empty
-				$item = &FileAsUrl(&FullPath("$dir\\",$item));
-			}
-			next;
-		} 
-		$self->{$_} = &FileAsUrl($self->{$_});
-	}	
-
-}
-
-
-sub OrderedOption() {
-	my $var = shift;
-	my $val = shift;
-	if($var=~/^(show|hide)-attr$/) {
-		my $f = "<filter 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 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 select="*" display="hide"/>');
-		}
-		foreach my $v (split(/,/,$val)) {
-			push(@Filters,"<filter display='show' select='filter' value='$v'/>");
-		}
-	}
-}
-
-
-
-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 ($root && !-e $root) {
-		&Logger::LogFatal("$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);
-		}
-	}
-	
-	# Return the concatenated root and filename
-	return File::Spec->catdir($root, $file);
-}
-
-
-sub ReadIniFile()
-	{
-	my $self = shift;
-	
-	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}\": $!", $self->{iScriptCode}) if ! -e $self->{iIniFile};
-	
-	open(INI, $self->{iIniFile}) or 
-		&Logger::LogFatal("Could not open the ini file \"$self->{iIniFile}\": $!", $self->{iScriptCode});
-	
-	&Logger::LogInfo("Reading ini file \"$self->{iIniFile}...", $self->{iScriptCode});
-	
-	%AllowMulitples = (
-		"iLocalize"		=> 1,
-		"iExtra"		=> 1,
-		'iLevels'		=> 1,
-		'iSysDefFile'		=> 1,
-		'iSourceRoot'		=> 1,
-		'iS12'		=> 1,
-		"iIgnore"		=> 1,
-		"iFilter"		=> 1,
-		"iStyle"		=> 1,
-		"iOverlay"		=> 1,
-		"iBorder"		=> 1,
-		"iColor"		=> 1,
-		"iLegendNote" => 1,
-		"iXsltParam" => 2
-	); # value of 2 means it's a hash, value of 1 is an array
-	
-	foreach my $m (keys %AllowMulitples) {
-		# if it's already set, note that we're to ignore anything in the ini file
-		if($AllowMulitples{$m}==2 ? (scalar(%{$self->{$m}})>0) : (scalar(@{$self->{$m}})>0)) {$AllowMulitples{$m}=0}
-	}
-	
-	%Ordered = (
-		"filter-has"				=> 1,	
-		"show-attr"			=> 1,
-		"hide-attr"			=> 1
-	);
-
-	%IniMap = (
-		"model"					=> 'iModel' ,
-		"sysdef"				=> 'iSysDefFile' ,
-		'srcvar'					=> 'iSourceRoot',
-		"shapes"				=> 'iShapes',
-		"system_name"			=> 'iName' ,
-		"model_name"			=> 'iLabel' ,
-		"system_version"		=> 'iRelease' ,
-		"copyright"				=> 'iCopyright',
-		"model_version"			=> 'iRevision',
-		"model_version_type"	=> 'iRevisionType',
-		"distribution"			=> 'iDistribution',
-		"coreos"				=> 'iCoreOs',
-		"sysinfo"				=> 'iExtra',
-		"localize"				=> 'iLocalize',
-		"levels"				=> 'iLevels',
-		"filter"				=> 'iFilter',
-		"ignore"				=> 'iIgnore',
-		"output"				=> 'iDiagram',
-		"csv_output"				=> 'iOutputCsv',
-		"csv_columns"				=> 'iCsvColumns' ,
-		"csv_labels"				=> 'iCsvLabels' ,
-		'xml_output'				=> 'iOutputXml' ,
-		"detail"				=> 'iDetail',
-		"detail-type"				=> 'iDetailType',
-		"page-width"			=> 'iPageWidth',
-		"static"				=> 'iStatic',
-		"color"					=> 'iColor',
-		"border-shape"			=> 'iBorder',
-		"pattern"				=> 'iOverlay',
-		"deps"					=> 'iDepsFile',
-		"border-style"			=> 'iStyle',
-		"w"						=> 'iWarningLevel',
-		"tempdir"				=> 'iTemporaryDirectory',
-		'dpi'					=>'iPrintResolution',
-		'model_font'					=>'iModelFont',
-		"s12"				=> 'iS12',
-		"log"					=> 'iLogFile',
-		"logo"				=> 'iLogoSrc',
-		"logo-height"			=> 'iLogoHeight',
-		"logo-width"			=> 'iLogoWidth',
-		'version-list'			 => 'iVersions',
-		"link"					=> 'iLink',
-		"clean"				=> 'iClean',
-		"compress"			=> 'iCompress',
-		"legend-width"			=>'iLegendWidth',
-		"legend-max-scale"		=> 'iLegendMaxScale',
-		"title-scale"			=> 'iTitleScale',
-		"xslt-param"			=> 'iXsltParam',
-		"note"			=> 'iLegendNote'
-	);
-	
-	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/"$//;
-
-			my $iniDir = $self->{iIniFile};
-			$iniDir =~ s,[^\\//]+$,,;
-			#$iniDir .= '\\';
-
-			if(defined $Ordered{$argType}) {
-				&OrderedOption($argType, $argValue);
-			} elsif(defined $IniMap{$argType}) {
-				my $param = $IniMap{$argType};
-				# make sure all files mentioned are taken relative to the ini file
-				if($KFileParams{$param} ne '' )
-					{# comma-separated filenames
-					my @list;
-					foreach my $item  (split(/,/,$argValue))
-						{
-						push(@list,&FullPath($iniDir,$item));
-						}
-					$argValue = join(',',@list);
-					}
-				elsif(defined $KFileParams{$param} && $argValue ne '')
-					{# single file names			
-					$argValue = &FullPath($iniDir,$argValue);
-					}
-				# do not override! Only set values that have not been set on command line already
-				if ($AllowMulitples{$param}==1)  # check so we don't add if it's set by the cmd line
-					{
-				 	push(@{$self->{$param}}, $argValue); 
-					} 
-				elsif ($AllowMulitples{$param}==2)  # check so we don't add if it's set by the cmd line
-					{
-					$argValue=~s/^([^=]+)=//;
-				 	$self->{$param}->{$1}=$argValue; 
-					} 
-				elsif (! defined $AllowMulitples{$param})
-					{
-				 	$self->{$param} = $argValue if ! $self->{$param}; 
-					}
-				}
-			}
-		}
-; 
-	@{$self->{'iFiltering'}} = @Filters if ! @{$self->{'iFiltering'}}; 
-	@Filters=();
-	}
-
-sub MakeInfo() {
-	my $self = shift;
-	my %files = @_;
-	my $res="";
-	while (my ($key,$value) = each %files) {
-		 if ($self->{$key} ne '') {
-		 	$res .= "\t\t<info href='".$self->{$key}."' type='$value'/>\n"
-		 }
-	}
-	return $res;
-}
-
-sub MakeMultiInfo() {
-	my $self = shift;
-	my %files = @_;
-	my $res="";
-	while (my ($key,$value) = each %files) {
-		 foreach my $m (@{$self->{$key}}) {
-		 	if($m ne '') { # skip if empty
-		 		$res .= "\t\t<info href='$m' type='$value'/>\n"
-		 	}
-		 }
-	}
-	return $res;
-}
-
-sub MakeAttirbutes() {
-	my $self = shift;
-	my %atts = @_;
-	my $res="";
-	while (my ($key,$value) = each %atts) {
-		 if (defined $self->{$key}) {
-		 	my $cur = $self->{$key};
-		 	if($key=~/File$/) {$cur=&FileAsUrl($cur)}	# anything that ends in File is treated as a URL
-		 	$res .= " $value=\"$cur\"";
-		 }
-	}
-	return $res;
-}
-
-sub getSchedule12Xml ()
-	{
-	my $self = shift;
-	my $ver = shift;
-	my @files = @{$self->{'iS12'}};
-	my @ret;
-	foreach my $s12 (@files)
-		{
-		if($s12 eq '') {next}
-		if($s12=~/^file:\/\/\/(.*)$/)
-			{
-			if(-d $1) 
-				{
-				# it's a directory, so append Symbian_OS_v[version]_Schedule12.xml
-				$s12=~s,[\\/]*$,/Symbian_OS_v${ver}_Schedule12.xml,;
-				}
-			}
-		push(@ret,$s12);
-		}
-	return @ret
-	}	
-
-sub getModel()
-	{
-	my $self = shift;
-	if($self->{iModel})  {return $self->{iModel}}
-	
-	my $xsltDir = $self->GetXsltDir();
-
-	my $tempDirectoryPathname = abs_path($self->{iTemporaryDirectory});
-	
-	(my $modelXml = "$tempDirectoryPathname/Model.xml") =~ s#\/#\\#g;
-	(my $modelTemplateXml = $xsltDir."/") =~ s#\/#\\#g;
-	
-	if($self->{iCoreOs} == KCoreOsWithHardware)	{ #  show 9.5+ CoreOS 
-		$modelTemplateXml .= "ModelTemplate.xml";
-	} elsif($self->{iCoreOs} == KCoreOsWithHal )  	{ 		# show 9.4 CoreOS
-		$modelTemplateXml .= "ModelTemplate.mid.xml";
-	} else {
-		$modelTemplateXml .= "ModelTemplate.older.xml";
-	}
-
-
-	# the follownig params cannot be emtpy, delete if they are
-	foreach my $item ('iCopyright' ,	'iDistribution' ,'iDepsFile',	'iLink', 'iDetailType',  'iDetail', 'iVersions')
-		{
-		if($self->{$item} eq '') {delete $self->{$item}}
-		}
-
-
-	# Step 1:
-	# Create a Model.xml based on the ModelTemplate.xml
-	open (INPUT, $modelTemplateXml) or &Logger::LogError("Xalan error ($error) occured in Step 1 of SVG building...", $self->{iScriptCode}, 1);
-	open (OUTPUT, ">$modelXml") or &Logger::LogError("Xalan error ($error) occured in Step 1 of SVG building...", $self->{iScriptCode}, 1);
-	my $release = $self->{iRelease};
-	
-	
-	
-	# Since $self->{iSysDefFile} may be a comma-separated list of sysdefs, create a <sysdef> tag for each one of the files:
-	my $sysdefTagsForModelTemplate = "";	
-
-	@{$self->{'iS12'}} = $self->getSchedule12Xml($self->{'iGuessVer'});
-
-	if(scalar(@{$self->{iSourceRoot}}) == 1)
-		{
-		@{$self->{iSourceRoot}} = ($self->{iSourceRoot}->[0]) x scalar($self->{iSourceRoot}->[0]);
-		}
-	
-	for (my $index = 0; $index < scalar(@{$self->{iSysDefFile}}); ++$index)
-		{
-		$sysdefTagsForModelTemplate .= $self->CreateSysDefTagsForModelXML($self->{iSysDefFile}->[$index], $self->{iSourceRoot}->[$index]);
-		}
-	
-	my $display;
-
-	if($self->{iLink}=~/\\/)    # it's a windows dir, change to file URI
-		{
-		$self->{iLink} = &FileAsUrl($self->{iLink});
-		}
-
-	$display .= $self->MakeMultiInfo ('iLocalize' 	=> 'abbrev');
-
-	my %infoMap = (
-		'iStyle'  		=> 'style',
-		'iOverlay'		=> 'overlay',
-		 'iBorder'		=> 'border',
-		 'iColor'		=> 'color'		
-	);
-	
-	$display .=$self->MakeMultiInfo( %infoMap);
-	if($self->{'iLogoSrc'})
-		{
-		$display.="\n<logo". $self->MakeAttirbutes(
-			'iLogoSrc' 	=> 'src',
-			'iLogoWidth'  		=> 'width',
-			'iLogoHeight'  		=> 'height'
-			) ;
-		if($self->{'iLogoSrc'} =~ /\.svg$/i)
-			{
-			$display.= " embed=\"yes\"";
-			}
-		$display.= "/>";
-		}
-
-	my $filters='';
-	if(scalar @{$self->{'iFiltering'}})	# complex filtering 
-		{
-		$filters = join("\n\t",@{$self->{'iFiltering'}});
-		}		
-	elsif (@{$self->{iFilter}}) { # can't have both -filter and complex filtering
-		foreach ( @{$self->{iFilter}}) {
-			if($_ ne '') {$filters.="<filter accept='$_'/>\n\t";}
-		} 
-	}
-		
-	my $ignore='';
-
-	foreach ( @{$self->{iIgnore}}){
-		if(/^(.*):(.*)$/) {$ignore.="<ignore type='$1' name='$2'/>\n\t"}
-	}
-		
-	
-	my $optional = $self->MakeAttirbutes(
-		'iCopyright' 	=> 'copyright',
-		'iDistribution'  		=> 'distribution',
-		'iRevision'  		=> 'revision',
-		'iDepsFile'  		=> 'deps',
-		'iLink'  		=> 'link',
-		'iRevisionType'  => 'revision-type',
-		'iVersions' 	=>	'version-list'
-		);
-
-	if($self->{iRelease} ne '') {$optional .= " ver='$self->{iRelease}'"}
-	elsif($self->{iGuessVer} eq 'Future' ) {$optional .= " ver='$self->{iGuessVer}'"}
-
-
-	my $layout = $self->MakeAttirbutes(
-		'iDetail'  		=> 'detail',
-		'iDetailType'  		=> 'detail-type',
-		'iPageWidth' 	=> 'page-width',
-		'iPrintResolution' 	=> 'resolution',
-		'iModelFont' 	=> 'font'
-		);
-	if($self->{iStatic}) {$layout .= " static='true'"}
-	my $legend = '';
-	my @legendmap = (
-		'iColor',	'colors',
-		'iStyle',	'styles',
-		'iOverlay',	'patterns',
-		'iBorder',	'borders'
-		); # order is important
-	for(my $i=0; $i<$#legendmap;$i+=2){
-		my $cur='#'.$infoMap{$legendmap[$i]};
-		my $count = scalar(@{$self->{$legendmap[$i]}});
-		 if ($count==0 || ($count==1 && $self->{$legendmap[$i]}->[0] eq '' )) {$cur='@shapes'."#$legendmap[$i+1]"}
-		$legend .= "\t\t\t<legend use=\"$cur\"/>\n";
-	}
-	foreach my $note (@{$self->{iLegendNote}})
-		{
-		if(!($note=~/&#?[0-9a-z]+;/i))
-			{	# if not entity-encoded, entity encode the stuff
-			$note=~ s/([&<>\x7f-\xff])/"&#".ord($1).";"/eg;
-			}
-		$legend .= "\t\t\t<note width='auto'>$note</note>";
-		}
-	
-	my $legendOptions;
-	if($self->{iLegendWidth}) {$legendOptions .= ' width="' .$self->{iLegendWidth} .'"'}
-	if($self->{iLegendMaxScale}) {$legendOptions .= ' maxscale="' .$self->{iLegendMaxScale} .'"'}
-	if($self->{iTitleScale}) {$legendOptions .= ' title-scale="' .$self->{iTitleScale} .'"'}
-	foreach my $line (<INPUT>)
-		{
-		my $cur='';
-		$line =~ s/___SYMBIAN_OS_RELEASE___/$self->{iRelease}/g;	# not used
-		$line =~ s/___NAME___/$self->{iName}/g;
-		$line =~ s/___LABEL___/$self->{iLabel}/g;
-		$line =~ s/___REVISION_TYPE___/$self->{iRevisionType}/g;	# not used
-		$line =~ s/___LINK___/$self->{iLink}/g;	# not used
-		$line =~ s/___OPTIONAL___/$optional/g;
-		$line =~ s/___LAYOUT_OPTIONS___/$layout/g;
-		$line =~ s/___FILTERS___/$filters/g;
-		$line =~ s/___IGNORE___/$ignore/g;
-		$line =~ s/___LEGEND___/$legend/g;
-		$line =~ s/___LEGEND_OPTIONS___/$legendOptions/g;
-		$line =~ s/___SHAPES_XML___/$self->{iShapes}/g;
-		$line =~ s/___SYSTEM_DEFINITIONS___/$sysdefTagsForModelTemplate/; # should be only one incident of it
-		$line =~ s/___DISPLAY___/$display/g;
-		$line =~ s/\sshapes=""//g; # remove empty attribute
-		print OUTPUT $line;
-		}
-	close INPUT;
-	close OUPUT;
-
-	# Open and close the file so that it can flush itself:
-	open (OUTPUT, "$modelXml") or &Logger::LogError("Xalan error ($error) occured in Step 1 of SVG building...", $self->{iScriptCode}, 1);
-	close OUTPUT;
-	return $modelXml;
-	}
-
-sub GetXsltDir()
-	{
-	my $self = shift;
-	my $xsltDir = $FindBin::Bin."/svg";  # calcluated w.r.t root of Dep directory
-	$xsltDir = $FindBin::Bin."/../svg" if ! -d $xsltDir; # calculated w.r.t the /commands directory
-	return $xsltDir;
-	}
-
-
-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($_, 100);
-			} elsif(s/^Warning: //) {
-				&Logger::LogInfo($_, 600);
-			} elsif(s/^Error: //i) {
-				&Logger::LogInfo($_, 400);
-			} else {
-				print STDERR "$_\n";
-			}
-		}
-	}
-	close(EXE);
-	return $?;
-}
-
-sub ShouldCreateDepmodel()
-	{
-	my $self = shift;
-	if ($self->{iDepsFile})
-		{
-		return 1;
-		}
-	my $model = $self->getModel();
-	my $t = $/;
-	$/='>';
-	open(M,$model);
-	while(<M>)
-		{
-		if(/<model\s/){last}
-		}
-	close M;
-	$/ = $t;
-	return /\sdeps=/;
-	}
-
-sub XsltTransform()
-	{
-	my $xslt = shift;
-	my $from = shift;
-	my $to = shift;
-	my $indent = shift;
-	my %params = %{$_[0]};
-	my $xsltParams;
-
-	# windows-specific stuff follows
-
-	if(! ($xslt=~/^..+:/)) {$xslt	=~ s#\/#\\#g}			#it's not a URL
-	if(! ($from=~/^..+:/)) {$from	=~ s#\/#\\#g}			#it's not a URL
-	if(! ($to=~/^..+:/)) {$to	=~ s#\/#\\#g}			#it's not a URL
-
-	while (my($p,$v) = each(%{$_[0]}))
-		{
-		$v =~ s/"/&quot;/g;	#"		
-		$xsltParams.= " -p $p \"$v\"";
-		}
-
-	my $command = &DepConstants::Xalan();
-	$command =~ s#\/#\\#g;
-	$command .= $xsltParams;
-	if($indent >=0) {
-		$command .= " -i $indent";
-	}
-	if($to ne '') {
-		$command .= " -o \"$to\"";
-	}
-	$command.=" \"$from\" \"$xslt\"";
-	&Logger::LogInfo("System Call: $command", 800);
-	if($to eq '') {return `$command`}
-	return &RunCmd($command);
-	}
-
-sub Draw()
-	{
-	my $self = shift;
-	my $genSvg = $self->{'iDiagram'} ne '';
-	my $genCsv = $self->{'iOutputCsv'} ne '';
-	my $genXml = $self->{'iOutputXml'} ne '';
-	
-	if(!$genSvg && !$genCsv && !$genXml)  
-		{
-        &Logger::LogFatal("Must specify at least one type of output file. Cannot continue...", $self->{iScriptCode});		
-		}
-	
-	&Logger::LogInfo("Creating sysmodel.svg...", $self->{iScriptCode});
-	
-	# Step 0:
-	# Prepare some file names and create output directory:
-
-	# construct full path name:
-	($self->{iRootDirectory} = cwd ) =~ s#\/#\\#g;
-	chdir($self->{iTemporaryDirectory});
-	my $tempDirectoryPathname = cwd; # now gives the full path name $self->{iTemporaryDirectory}
-	chdir($self->{iRootDirectory}); # change back!
-	
-	my $xsltDir = $self->GetXsltDir();	
-	
-	my $tempStuctureFile = "$tempDirectoryPathname/system_model_svg_tmp.xml";
-	my $tempXslFile = "$tempDirectoryPathname/system_model_svg_tmp.xsl";
-	my $tempModelFile = "$tempDirectoryPathname/model_tmp.svg";
-	my $tempModelFile2 = "$tempDirectoryPathname/model_tmp2.svg";
-	my $modelXsl = $xsltDir."/Model.xsl";
-	
-
-	my $modelXml = $self->getModel();
-	 
-	# Step 2
-	# xalan -i 2 model.xml model.xsl > tmp.xml
-	$error = &XsltTransform($modelXsl,$modelXml,$tempStuctureFile,1,	$self->{'iXsltParam'});
-				
-	&Logger::LogError("Xalan error ($error) occured in Step 2 of SVG building...", $self->{iScriptCode}, 1) if $error;
-
-	# Step 3 - validation
-	# xalan tmp.xml validate.xsl
-	if($self->{iWarningLevel} == DepConstants::VERBOSE )
-		{
-		my $errors = &XsltTransform($xsltDir."/validate.xsl",$tempStuctureFile,'',-1);
-		&Logger::LogList(split(/\n/,$errors));
-		}
-	if($genSvg)
-		{ # only needed for model building 
-		
-		# Step 4
-		# xalan -i 2 model.xml shapes.xsl > tmp.xsl
-		$error = &XsltTransform("$xsltDir/Shapes.xsl",$modelXml,$tempXslFile,1,
-				{%{$self->{'iXsltParam'}},'Model-Transform' => "'".&FileAsUrl($modelXsl)."'" });
-		&Logger::LogError("Xalan error ($error) occured in Step 4 of SVG building...", $self->{iScriptCode}, 1) if $error;
-	
-		# Step 5
-		# xalan -i 2  tmp.xml tmp.xsl > tmp.svg
-		$error = &XsltTransform($tempXslFile,$tempStuctureFile,$tempModelFile,1,$self->{'iXsltParam'});
-		&Logger::LogError("Xalan error ($error) occured in Step 4 of SVG building...", $self->{iScriptCode}, 1) if $error;
-
-		if ($self->ShouldCreateDepmodel()) {	# insert as 1st transform
-			@ARGV=( $xsltDir."/Postprocess.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
-			# xalan  -i 2 -p Data tmp.xml 'tmp.svg' postprocess.xsl> final.svg
-			my %p; 
-			if($datafile ne '') {
-				$p{'Data'}="'$datafile'";	# optional -- only if needed for transform
-			}
-			$error = &XsltTransform($transform,$tmpsvg,$saveto,1,\%p);
-			&Logger::LogError("Xalan error ($error) occured in Step 6 of SVG building...", $self->{iScriptCode}, 1) 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 = &DepConstants::GzipCommand();
-			if($gzip)
-				{
-				my $command = "$gzip ".$self->{iDiagram};
-				&Logger::LogInfo("System Call: $command", $self->{iScriptCode});
-				$error = &RunCmd($command);# this should generate the sysmodel.svg in the output directory
-				&Logger::LogError("Gzip error ($error) occured when comrpessing SVG", $self->{iScriptCode}, 1) if $error;
-				&Logger::LogInfo("Renaming output to : $zipname", $self->{iScriptCode});		
-				rename $self->{iDiagram}.".gz", $zipname;
-				$compressed = 1;
-				}
-			}
-		if(!$compressed && $unzipname ne $self->{iDiagram}) 
-			{
-			&Logger::LogInfo("Renaming output to : $unzipname", $self->{iScriptCode});		
-			rename $self->{iDiagram}, $unzipname;	
-			}
-		}
-	# create CSV if desired
-	if($genCsv)
-		{
-		my %p;
-		if($self->{iCsvColumns})
-			{
-			$p{'atts'}="'".$self->{iCsvColumns}."'";
-			}
-		if($self->{iCsvLabels})
-			{
-			$p{'labels'}="'".$self->{iCsvLabels}."'";
-			}
-		$error = &XsltTransform($xsltDir."/output-csv.xsl",$tempStuctureFile,$self->{iOutputCsv},-1,\%p);
-		&Logger::LogError("Xalan error ($error) occured in CSV output...", $self->{iScriptCode}, 1) if $error;
-		}
-		
-	# create sysdef XML if desired
-	
-	if($genXml)
-		{
-		$error = &XsltTransform($xsltDir."/output-sysdef.xsl",$tempStuctureFile,$self->{iOutputXml},1);
-		&Logger::LogError("Xalan error ($error) occured in Sysdef output...", $self->{iScriptCode}, 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}...", 100);
-		$self->DeleteTempDirectory();
-		}	
-	}
-
-sub CreateSysDefTagsForModelXML()
-	{
-	my $self = shift;
-	my $sysdefXml = shift;
-	my $srcvar = shift;
-
-	if($sysdefXml eq '')
-		{
-		&Logger::LogInfo("Cannot find System Definition file", 100);
-		return;
-		}
-
-	my $ret = "<sysdef href=\"".&FileAsUrl($sysdefXml)."\"";
-	if($srcvar ne '') {$ret.=" root=\"$srcvar\""}
-	$ret .=">\n" . 
-		$self->MakeMultiInfo('iExtra' 	=> 'extra', 'iLevels'  	=> 'levels'	, 'iS12' => 's12');
-	return "$ret\t</sysdef>\n";
-	}
-	
-sub DeleteTempDirectory()
-	{
-	my $self = shift;
-	# This will delete all files in the $self->{iTemporaryDirectory}
-	rmtree $self->{iTemporaryDirectory};
-	}
-
-sub Help()
-	{
-	my $self = shift;
-format STDERR =
- @<<<<<<<<<<<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-$param,                               $text,
-                       ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
-                       $text
-.
-my @list =(
- 'Switch',               'Explanation',
- '------',               '-----------',
-'-h' ,           'Help on usage',
-	'-i'      ,      'An INI file listing one argument per line, with the syntax: <argument> = <value>',
-	'==== Build Control  ====',
-  '-w'          ,  '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',
-  '-tempdir',	    'Temporary directory for build files. Defaults to drawsvg_temp',
-  '-output', 		'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.',
-  '-csv_output', 		'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.',
-  '-csv_columns', 	'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. ',
-  '-csv_labels', 	'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. ',
-  '-xml_output', 		'The name of the file to save a combined system definition XML. Only items shown in the built system model will be included.',
-  '-log'	,    'File in which to store output. Defaults to stdout',
-  '-compress', 	'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.',
-  '-clean'   ,        'Caution: if set, it will delete the contents of the temporary directory.',
-  "==== Files or URIs ====\nAll of these take a file name (relative or absolute path) or URI of a data source",
-'-model', '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.',
-'-shapes', '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. ',
-'-localize', 'The location of the Localization file used to provide displayable names for the model entities. By default,  the provided  "display-names.xml" is used.',
-'-s12', '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.',
-'-levels', 'The location of the Levels XML file used to override the  stacking of collections. ',
-'-sysinfo', 'The location of extra component information used to provided additional  properies for components.  By default,  the provided "SystemInfo.xml" is used.',
-'-deps', 'The location of the Dependencies XML file used to draw the depmodel.  If not present, dependencies will not be drawn',
-'-color', 'The location of a Values XML file used to specify per-component colours. If not present, the default colours are used.',
-'-border-shape', 'The location of a Values XML file used to specify the shape (border)  of each component. If not present, the default borders are used.',
-'-pattern', '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.',
-'-border-style', 'The location of a Values XML file used to specify per-component border  styles. If not present, the default border styles are used. ',
-'-link','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.',
-"==== Labels ====\nAll of these take a plain text value which is displayed on the model",
-'-system_name', 'The name of the product described in the model. It appears at  the bottom right. Defaults to "Symbian OS"',
-'-system_version', 'The version of the product described in the model. It appears  at the bottom right after the name.',
-'-model_name', 'The label for the model. It appears at the bottom right,  under the name. Defaults to "System Model".',
-'-model_version', 'A number which appears before th model-revision-type.   If specified this overrides the build number used by depmodel.  If not building depmodel, this defaults to "1"',
-'-model_version_type', 'One of "draft", "issued", "build" 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"',
-'-copyright', 'The copyright to appear in the lower left. Set to empty string to leave out. Defaults to "[this year] Nokia Corporation"',
-'-distribution', '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.',
-'-note', '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 otehr special characters can be entity-encoded (e.g. &#xa;)',  
-"==== Model Control  ====",
-'-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.',
-'-coreos [on/off/new]', 'Turn on or off Core OS colouring, or use the new colouring for 9.5 and later models. Defaults to "off" for model versions before 9.4 or those with no specified version, "on" for 9.4 and "new" for 9.5 and later',
-'-filter [filter-name]', '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"',
-'-filter-has [filter-name]', '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"',
-'-ignore [item]', 'A model entity to not draw, in the  form "[item-type]:[item-name]". Any number of these can be used. Defaults to "layer:Tools and Utils and SDKENG" ,"layer:MISC", "block:Techview"',
-'-show-attr [attr[=val]]', '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',
-'-hide-attr [attr[=val]]', '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',
-'-detail [item-type]' , 'The type of the smallest System Model entity to draw. One of "layer", "block", "subblock", "collection" or "component".  Defaults to "component"',		
-'-detail-type [type]' , 'If set to "fixed", the smallest System Model entity drawn will have a fixed width (rather then sized by their invisible components). This can be used to reduce the size and complexity of the overall model.',
-'-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"',
-'-static', 'If present, the model will not have any mouseover effects (this is  overriden by builing the depmodel).',
-'-logo [file]', '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',
-'-logo-height [length]', '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',
-'-logo-width [length]', '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',
-'-legend-width [%]', '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.',
-'-legend-max-scale [scale]', '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.',
-'-title-scale [scale]', '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.',
-'-model_font [font]', 'The name of the base font to use to draw the model. This will be overriden by any custom CSS in the Shapes XML',
-'-dpi [number]', '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'
-  );
-print STDERR "Usage: DrawSvg.pl [Arguments] [Transform Data-file] ...\n\nArguments:\n";
-  my $head=2;
-while(@list) {
-	$param = shift(@list);
-	if($head<=0 and !($param=~/^-/)){print "\n$param\n";next;}
-	$text = shift(@list);
-	write STDERR ;
-	$head--;
-}
-	return;
-	}
-
-1;
--- a/sysmodellibs/sysmodelgen/src/svg/Legend.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,842 +0,0 @@
-<?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" >
- 
-	  <xsl:key name="style-ref" match="*[starts-with(name(),'generator-')]/@ref| @*[starts-with(name(),'generator-')]" use="."/>
-
-	<xsl:variable name="cboxWidth" select="15.5"/>
-	<xsl:variable name="cboxHeight" select="3.1"/>
-
-<!-- title of the model -->
-<xsl:template mode="title" match="systemModel">
-	<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>
-
-<!-- legend stuff -->
-
-<xsl:template match="legend-layer" mode="height">
-	<xsl:variable name="h1"> <!-- height of generated legend content -->
-		<xsl:choose>
-			<!-- strip out all unused legend items if possible -->
-			<xsl:when test="function-available('exslt:node-set') and parent::systemModel">
-				 <xsl:variable name="Legend">
-					 <xsl:apply-templates select="/SystemDefinition/systemModel/legend-layer" mode="legend-copy"/>
-				 </xsl:variable>
-		 		<xsl:apply-templates select="exslt:node-set($Legend)/descendant-or-self::legend-layer" mode="content-height"/>
-			</xsl:when>
-			<xsl:otherwise><xsl:apply-templates select="." mode="content-height"/></xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable> <!-- $h1 does not take into account scaling the legend content -->
-
-	<!-- $h2 is height of single line in legend title -->
-	<xsl:variable name="h2"><xsl:call-template name="title-line-height"/></xsl:variable>
-	<xsl:variable name="hl"><xsl:apply-templates select="../logo" mode="height"/></xsl:variable>	
-	<xsl:variable name="h3">
-		<xsl:choose>
-			<xsl:when test="$hl='' or $hl='?'">0</xsl:when>	<!-- no logo or unknown height -->
-			<xsl:otherwise><xsl:value-of select="$hl"/></xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable>	
-
-	<xsl:variable name="h"> <!-- $h is max of $h1 and 3*$h2 -->
-		<xsl:choose>
-			<xsl:when test="3 * $h2 &gt;= $h1 and 3* $h2 &gt;= $h3"><xsl:value-of select="3* $h2"/></xsl:when>
-			<xsl:when test="$h3 &gt;= $h1"><xsl:value-of select="$h3"/></xsl:when>
-			<xsl:otherwise><xsl:value-of select="$h1"/></xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable>	
-	<xsl:variable name="copyheight">
-		<xsl:choose>
-		<xsl:when test="@footer"><xsl:value-of select="$legendDx * 3 + 4.233"/></xsl:when>
-		<xsl:otherwise>0</xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable>
-	<xsl:value-of select="$h +  $copyheight"/>
-</xsl:template>
-
-
-<xsl:template match="legend-layer" mode="content-height"> <!-- only called from mode="height" -->
-	<xsl:variable name="h">
-		<xsl:call-template name="max-from-list">
-			<xsl:with-param name="list">
-				<xsl:text>4.233 </xsl:text>
-				<xsl:for-each select="legend"><xsl:apply-templates select="." mode="min-height"/><xsl:text>  </xsl:text></xsl:for-each>
-			</xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>
-	<xsl:value-of select="$h +  $legendDx"/>
-</xsl:template>
-
-
-
-<xsl:template match="legend-layer" mode="width">
-	<xsl:choose>
-		<!-- strip out all unused legend items if possible -->
-		<xsl:when test="function-available('exslt:node-set') and parent::systemModel">
-			 <xsl:variable name="Legend">
-				 <xsl:apply-templates select="/SystemDefinition/systemModel/legend-layer" mode="legend-copy"/>
-			 </xsl:variable>
-	 		<xsl:apply-templates select="exslt:node-set($Legend)/descendant-or-self::legend-layer" mode="width-detail"/>
-		</xsl:when>
-		<xsl:otherwise><xsl:apply-templates select="." mode="width-detail"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="legend-layer[not(@label) and not(*)]" mode="width">0</xsl:template> <!-- no content -->
-
-
-<xsl:template match="legend-layer" mode="width-detail">
-	<xsl:variable name="x">
-		<xsl:apply-templates select="*[last()]" mode="offset"/>
-	</xsl:variable>
-	<xsl:variable name="w">
-		<xsl:apply-templates select="*[last()]" mode="width"/>
-	</xsl:variable>
-	<xsl:choose>
-		<xsl:when test="not(*)"><xsl:apply-templates select="@label" mode="width"/></xsl:when>
-		<xsl:when test="$w=0"><xsl:value-of select="$x"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="$legendDx + $x + $w"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="legend" mode="width" priority="-2">100</xsl:template>
-<xsl:template match="legend[not(*) and not(@*)]" mode="width" priority="5">0</xsl:template> <!-- empty: ignore -->
-
-<xsl:template match="@label" mode="width"><xsl:value-of select="string-length(.) *  4"/></xsl:template>
-<xsl:template match="note" mode="width">20</xsl:template>
-<xsl:template match="note[@width]" mode="width" priority="1">
-	<xsl:value-of select="@width"/>
-</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 match="note[@width='auto']" mode="width" priority="2">
-	<xsl:variable name="len"><xsl:call-template name="multiline-width"/></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:template>
-
-
-<xsl:template match="legend|note" mode="offset">
-	<xsl:variable name="x">
-		<xsl:apply-templates select="preceding-sibling::*[1]" mode="offset"/>
-	</xsl:variable>
-	<xsl:variable name="w">
-		<xsl:apply-templates select="preceding-sibling::*[1]" mode="width"/>
-	</xsl:variable>
-
-	<xsl:choose>
-		<xsl:when test="not(preceding-sibling::*) and ../@label"><xsl:apply-templates select="../@label" mode="width"/></xsl:when>
-		<xsl:when test="not(preceding-sibling::*)">0</xsl:when>
-		<xsl:when test="$w=0"><xsl:value-of select="$x"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="$legendDx + $x + $w"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-
-<xsl:template match="legend-layer"><xsl:param name="y" select="0"/>
-<!--
-	 <xsl:apply-templates select="/SystemDefinition/systemModel/legend-layer" mode="legend-copy"/>
-  -->	 
-	<xsl:choose>
-		<!-- strip out all unused legend items if possible -->
-		<xsl:when test="function-available('exslt:node-set')">
-			 <xsl:variable name="Legend">
-				 <xsl:apply-templates select="/SystemDefinition/systemModel/legend-layer" mode="legend-copy"/>
-			 </xsl:variable>
-			<xsl:variable name="parent" select="parent::systemModel"/>
-	 		<xsl:apply-templates select="exslt:node-set($Legend)/descendant-or-self::legend-layer" mode="legend-detail">
-				<xsl:with-param name="y" select="$y"/>
-				<xsl:with-param name="model" select="$parent"/>
-			</xsl:apply-templates>	
-		</xsl:when>
-		<xsl:otherwise>
-			<!-- go the long way -->
-			<xsl:apply-templates select="." mode="legend-detail">
-				<xsl:with-param name="y" select="$y"/>
-				<xsl:with-param name="model" select="parent::systemModel"/>
-			</xsl:apply-templates>
-		</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template name="title-line-height">
-	<xsl:choose>
-		<xsl:when test="number(/SystemDefinition/systemModel/legend-layer/@title-scale)">
-			<xsl:value-of select="4.3 * /SystemDefinition/systemModel/legend-layer/@title-scale"/> <!-- scale 12pt by specified factor-->
-		</xsl:when>
-		<xsl:when test="/SystemDefinition/systemModel/legend-layer[@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:template>
-
-<xsl:template match="legend-layer" mode="legend-detail"><xsl:param name="y" select="0"/>
-	<xsl:param name="model"/>
-	<xsl:variable name="h"><xsl:apply-templates select="." mode="content-height"/></xsl:variable>
-	<xsl:variable name="w"><xsl:apply-templates select="." mode="width"/></xsl:variable>
-	<xsl:variable name="titleW"><xsl:apply-templates select="$model" mode="legend-title-width"/></xsl:variable>
-	<xsl:variable name="wl"><xsl:apply-templates select="$model/logo" mode="width"/></xsl:variable>	
-	<xsl:variable name="available-width"> <!--  amount of space of legend -->
-		<xsl:choose>
-			<xsl:when test="$wl=''"><xsl:value-of select="$full-width + 12.8"/></xsl:when> <!-- no logo -->
-			<xsl:otherwise><xsl:value-of select="$full-width + 12.8 -  $wl"/></xsl:otherwise> <!--  logo -->
-		</xsl:choose>
-	</xsl:variable>	
-	<xsl:variable name="want-width">
-		<xsl:choose>
-			<xsl:when test="contains(@width,'%')"><xsl:value-of select="0.01* substring-before(@width,'%') * $available-width"/></xsl:when>
-			<xsl:otherwise><xsl:value-of select="$available-width"/></xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable>	
-	<xsl:variable name="scale">
-		<xsl:choose>
-			<xsl:when test="@maxscale  and ($want-width &gt; ($w+$titleW) * @maxscale)"><xsl:value-of select="@maxscale"/></xsl:when> <!--  -->
-			<xsl:when test="@maxscale or @width"><xsl:value-of select="$want-width div ($w+$titleW)"/></xsl:when>
-			<xsl:otherwise>1</xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable>
-	<!-- legend-root is the root of all legend content, including the title -->
-	<g id="legend-root" class="legend" transform="translate({$full-width + 12.8 - $titleW - $w} {$y}) translate({$w + $titleW} {$scale*5 - 5}) scale({$scale}) translate({- $w - $titleW})">
-		<xsl:apply-templates select="$model" mode="legend-label">
-			<xsl:with-param name="x" select="$w + ($titleW * 0.5)"/>
-			<xsl:with-param name="y" select="($h - $legendDx) * 0.5"/>
-		</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 geenrated legend content (ie not the title)-->
-					<rect class="legend" rx="{$legendDx}" ry="{$legendDx}" height="{$h}" width="{$w +  $legendDx}" x="0" y="0"/>
-					<g transform="translate({concat($legendDx,' ',$legendDx * 0.5)})">
-						<xsl:apply-templates select="@label|*">
-							<xsl:with-param name="h" select="$h - $legendDx"/>
-						</xsl:apply-templates>		
-					</g>
-				</g>
-			</xsl:if>
-		</g>	
-	<xsl:variable name="copyright">
-		<xsl:apply-templates select="$model/@copyright"/>	
-	</xsl:variable>
-	<xsl:variable name="distribution">
-		<xsl:apply-templates select="$model/@distribution"/>	
-	</xsl:variable>
-	<xsl:if test="@footer">
-		<xsl:variable name="foot" select="concat(' ',@footer,' ')"/>
-		<g transform="translate({concat('0 ',$y + $h + $legendDx )})">
-			<xsl:if test="$copyright != '' and contains($foot,' copyright ')">
-				<text text-anchor="start" class="lgd" x="0" y="0" style="font-weight: normal"><xsl:value-of select="$copyright"/></text>
-			</xsl:if>
-			<xsl:if test="$distribution !='' and contains($foot,' distribution ')">
-				<text text-anchor="middle" class="lgd" x="{$view-width*0.5 - $groupDy}" y="0" style="font-weight: normal"><xsl:value-of select="$distribution"/></text>
-			</xsl:if>
-		</g>
-	</xsl:if>
-	<xsl:apply-templates select="preceding-sibling::*[1]">
-		<xsl:with-param name="y" select="$y + $h + $groupDy"/>
-	</xsl:apply-templates>
-	<g id="legend-display" class="legend" transform="translate({concat($full-width + 12.8 - $titleW - $w,' ',$y)})" opacity="0.8">
-	  	<g id="legend-owner">
-			<rect id="legend-ctrl" rx="{$legendDx}" ry="{$legendDx}" height="{$h}" width="{$w +  $legendDx}" x="0" y="0" visibility="hidden" pointer-events="all"/>
-	    </g>
-	</g>	
-</xsl:template>
-
-
-<xsl:template match="@copyright | @distribution | @revision-type">
-	<xsl:apply-templates select="." mode="as-text"/>
-</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:message>
-Warning: unknown security classification: <xsl:value-of select="."/></xsl:message></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="@label"><xsl:param name="h"/>
-	<text text-anchor="start" class="lgd" dominant-baseline="mathematical" 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="offset"/></xsl:variable>
-	<xsl:variable name="w"><xsl:apply-templates select="." mode="width"/></xsl:variable>
-
-	<xsl:variable name="newlines" select="string-length(.) - string-length(translate(.,'&#xa;',''))"/>	
-	<text text-anchor="middle"  class="label"  dominant-baseline="mathematical" x="{$off + 0.5* $w}" y="{$h div 2}">
-		<xsl:copy-of select="@style|@class"/>
-		<xsl:call-template name="multiline">
-			<xsl:with-param name="x" select="$off  + 0.5* $w"/>
-			<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 name="title-line1"> <!--  must call on systemModel element-->
-	<xsl:value-of select="@name"/>
-	<xsl:if test="@ver"><xsl:value-of select="concat(' v',@ver)"/></xsl:if>
-</xsl:template>
-
-<xsl:template name="title-line2"> <!--  must call on systemModel element-->
-	<xsl:if test="@label"><xsl:value-of select="@label"/></xsl:if>
-		<!-- type is deprecated -->
-	<xsl:if test="@type">
-		<xsl:value-of select="concat(@type,' Model')"/>
-		<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">systemModel attribute "type" is deprecated, use "label" instead</xsl:with-param></xsl:call-template>
-	</xsl:if>
-</xsl:template>
-
-
-<xsl:template name="title-line3"> <!--  must call on systemModel 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"/></xsl:variable>
-			<xsl:if test="$rt!=''">	<!--  space follows if not empty -->
-				<xsl:value-of select="concat($rt,' ')"/>							
-			</xsl:if>
-			<xsl:value-of select="@revision"/>
-		</xsl:when>
-		<xsl:when test="@revision-type">
-				<xsl:apply-templates select="@revision-type"/>
-			</xsl:when>					
-		<!-- The following are deprecated -->
-		<xsl:when test="@draft">
-			<xsl:message>Warning: deprecated syntax draft="<xsl:value-of select="@draft"/>" </xsl:message>
-			<xsl:value-of select="concat('DRAFT ',@draft)"/>
-		</xsl:when>
-		<xsl:when test="@issued">
-			<xsl:message>Warning: deprecated syntax issued="<xsl:value-of select="@issued"/>" </xsl:message>
-			<xsl:value-of select="concat('ISSUED ',@issued)"/>
-		</xsl:when>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="systemModel" mode="legend-title-width">
-	<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>
-	
-	<xsl:variable name="h"><xsl:call-template name="title-line-height"/></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(legend-layer/@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="systemModel" mode="legend-label">
-	<xsl:param name="x"/>
-	<xsl:param name="y"/>
-	<text  text-anchor="middle" class="title" x="{$x}" y="{$y}">
-		<xsl:call-template name="title-line1"/>
-		<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 @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"><xsl:param name="h"/>
-	<xsl:variable name="name"><xsl:call-template name="name-value"/></xsl:variable>
-	<xsl:variable name="off"><xsl:apply-templates select="." mode="offset"/></xsl:variable>
-	<xsl:if test="$name!=''">
-		<text text-anchor="middle"  class="label"  dominant-baseline="mathematical" x="{$off + 3.5}" y="{$h div 2}">
-			<xsl:attribute name="width">10</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:variable name="dx"><xsl:choose><xsl:when test="$name=''">0</xsl:when><xsl:otherwise>10</xsl:otherwise></xsl:choose></xsl:variable>
-	<g>
-		<xsl:attribute name="transform">translate(<xsl:value-of select="concat($off + $dx,' 0')"/>)</xsl:attribute>
-		<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:with-param name="spacing" select="$legendDx"/>		<!-- space between items (if necessary) -->	
-				</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:with-param name="spacing" select="$legendDx"/>		<!-- space between items (if necessary) -->	
-				</xsl:apply-templates>			
-			</xsl:otherwise>
-		</xsl:choose>
-	</g>
-</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="group[@type='border']/cmp[@value]" mode="shape">
-	<xsl:value-of select="@value"/>
-</xsl:template>
-
-<xsl:template match="group[@type='overlay']/cmp[@value]" mode="overlay-style">
-	<xsl:text>fill: url(</xsl:text>
-	<xsl:value-of select="@value"/>
-	<xsl:text>); stroke: none; stroke-width: 0;</xsl:text>
-</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>
-
-
-<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>
-
-<xsl:template match="legend[not(*) and not(@use)]" mode="width" priority="1">
-		<xsl:variable name="len">
-			<xsl:call-template name="multiline-width">
-			<xsl:with-param name="t"><xsl:call-template name="name-value"/></xsl:with-param>
-		</xsl:call-template>
-	</xsl:variable>
-
-	<!--  the width is a guess based on the half the (expected) font size of 4.233 + a border of 2.5 on each side-->
-		<xsl:value-of select="5 + $len * 0.5 * 1.94"/>
-</xsl:template>
-
-<xsl:template name="multiline"><xsl:param name="x" select="0"/><xsl:param name="n" select="1"/><xsl:param name="t" select="."/>
-<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: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>
-
-
-<!-- undocumented feature: allowing multiple lines by using newlines in label attribute. Might want to remove or make available to all labels -->
-<xsl:template match="legend[not(*) and not(@use)]" priority="1"><xsl:param name="h"/>
-	<xsl:variable name="name"><xsl:call-template name="name-value"/></xsl:variable>
-	<xsl:variable name="off"><xsl:apply-templates select="." mode="offset"/></xsl:variable>
-	<xsl:variable name="width"><xsl:apply-templates select="." mode="width"/></xsl:variable>
-	<xsl:variable name="newlines" select="string-length($name) - string-length(translate($name,'&#xa;',''))"/>
-
-	<xsl:if test="$name!=''">
-		<text text-anchor="middle"  class="label"  dominant-baseline="mathematical" x="{$off + 0.5 * $width}" y="{$h div 2}">
-		<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" select="$name"/>
-		</xsl:call-template>
-		</text>
-	</xsl:if>
-</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"/>
-
-<!--  should only be used in case exslt is not available 
-<xsl:template match="legend[@use]" mode="width" priority="7">
-	<xsl:apply-templates select="key('ldg-use',@use)" mode="width"/>
-</xsl:template>-->
-
-<xsl:template match="legend" mode="content-width" priority="-1"/>
-<xsl:template match="*[cbox]" mode="content-width"><xsl:param name="h"/><xsl:param name="dx"/>
-	<xsl:value-of select="$cboxWidth * (ceiling(   count(cbox[@label|@lookup])  div floor(($h - $legendDx) div $cboxHeight)) )+ $dx"/>
-</xsl:template>
-
-<xsl:template match="legend[cmp|legend] | group[cmp]" mode="content-width"><xsl:param name="dx"/>
-	<xsl:call-template name="sum-list">
-		<xsl:with-param name="list">
-			<xsl:value-of select="concat($dx - $legendDx,' ',   count(cmp[@label|@lookup or (parent::legend and text())]) * ($cSize + $legendDx),' ')"/>
-			<xsl:for-each select="legend">
-				<xsl:apply-templates select="." mode="width"/><xsl:value-of select="concat(' ',$legendDx,' ')"/>
-			</xsl:for-each>
-		</xsl:with-param> 
-	</xsl:call-template>
-</xsl:template>
-
-<xsl:template match="legend" mode="width">
-	<xsl:variable name="h"><xsl:apply-templates select="ancestor::legend-layer" mode="content-height"/></xsl:variable>
-	<xsl:variable name="name"><xsl:call-template name="name-value"/></xsl:variable>
-	<xsl:variable name="dx"><xsl:choose><xsl:when test="$name=''">0</xsl:when><xsl:otherwise>10</xsl:otherwise></xsl:choose></xsl:variable>
-	<xsl:choose> <!-- for compat with not exslt processors -->
-		<xsl:when test="@use">
-			<xsl:apply-templates select="key('ldg-use',@use)" mode="content-width">
-				<xsl:with-param name="dx" select="$dx"/>
-				<xsl:with-param name="h" select="$h"/>
-			</xsl:apply-templates>
-		</xsl:when>
-		<xsl:when test="*">
-			<xsl:apply-templates select="." mode="content-width">
-				<xsl:with-param name="dx" select="$dx"/>
-				<xsl:with-param name="h" select="$h"/>
-			</xsl:apply-templates>
-		</xsl:when>
-		<xsl:otherwise>0</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<!--  calc smallest height any legend item can use -->
-
-<xsl:template match="legend[legend]" mode="min-height">
-	<xsl:call-template name="max-from-list">
-		<xsl:with-param name="list">
-			<xsl:for-each select="legend"><xsl:apply-templates select="." mode="min-height"/><xsl:text>  </xsl:text></xsl:for-each>
-		</xsl:with-param>
-	</xsl:call-template>
-</xsl:template>
-
-<xsl:template match="legend[@use]" mode="min-height">
-	<xsl:apply-templates select="key('ldg-use',@use)"  mode="min-height"/>
-</xsl:template>
-
-<xsl:template match="legend[cbox] | group[cbox]" mode="min-height">
-<!-- the smallest this can be is the height of a cbox
-	However, if there are so many that it's wider than 2/3 of the model (to leave some room for the title, etc), then 
-	figure out how many tall these need to be in order to fit. Can't be less than one tall.
-	The 1.01 factor is to avoid rounding errors
-	This really should be calculated more exactly
-	-->
-	<xsl:value-of select="$cboxHeight * ceiling($cboxWidth * count(cbox) div  ($full-width * 0.5)) * 1.01"/>
-</xsl:template>
-
-<xsl:template match="legend[component|cmp] | group[component|cmp]" mode="min-height"><xsl:value-of select="$cSize"/></xsl:template>
-<xsl:template match="note" mode="min-height">3.1</xsl:template>
-<xsl:template match="legend[legend]" mode="min-height">
-	<xsl:call-template name="max-from-list">
-		<xsl:with-param name="list">
-			<xsl:value-of select="concat($cSize,' ')"/>
-			<xsl:for-each select="*"><xsl:apply-templates select="." mode="min-height"/><xsl:text>  </xsl:text>	</xsl:for-each>
-		</xsl:with-param>
-	</xsl:call-template>
-
-</xsl:template>
-
-	<!-- end calc height -->
-
-
-
-
-<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="legend/cbox|group/cbox"><xsl:param name="h"/><!-- can only have one type per legend -->
-	<xsl:variable name="rows" select="floor($h div $cboxHeight)"/>
-	<xsl:variable name="total" select="count(../cbox[@label|@lookup])"/>
-	<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="$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}" dominant-baseline="mathematical">
-				<xsl:attribute name="x"><xsl:value-of select="$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>
-
-<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="legend[s:g]" mode="width"><xsl:value-of select="sum(s:g/@width)"/></xsl:template>
-<xsl:template match="legend[s:g]" mode="min-height"><xsl:value-of select="s:g/@height"/></xsl:template>
-<xsl:template match="legend/s:g">
-	<xsl:copy-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>
-
-
-
-<!-- determine if generated stuff is present or not -->
-
-<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="layer" mode="legend-copy" priority="-1">
-	<xsl:copy-of select="."/>
-</xsl:template>
-
-<xsl:template match="legend-layer" mode="legend-copy">
-	<xsl:choose>
-		<xsl:when test="not(function-available('exslt:node-set'))"/>
-		<xsl:otherwise>
-			<xsl:copy><xsl:copy-of select="@*[name()!='label' and name()!='literal' and name()!='label-ref']"/>
-				<xsl:if test="@label"><xsl:apply-templates select="." mode="make-label"/></xsl:if>
-				<xsl:apply-templates  mode="legend-copy"/>
-			</xsl:copy>
-		</xsl:otherwise>
-	</xsl:choose>
-</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="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: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[@label-ref]" mode="legend-copy">
-	<xsl:copy><xsl:copy-of select="@*[name()!='label' and name()!='literal' and name()!='label-ref']"/>
-		<xsl:apply-templates select="." mode="make-label"/>
-	</xsl:copy>
-</xsl:template>
-
-<xsl:template match="*" mode="is-showable" priority="-1"/>
-<xsl:template match="layer | *[$Detail=name() or not($Static or /SystemDefinition/systemModel/@detail-type='fixed')]" priority="4" mode="is-showable">1</xsl:template>
-<xsl:template match="collection[$Detail='component' or $Detail='module']" mode="is-showable">1</xsl:template>
-<xsl:template match="subblock[$Detail='component' or $Detail='module' or $Detail='collection']" mode="is-showable">1</xsl:template>
-<xsl:template match="block[$Detail!='layer']" mode="is-showable">1</xsl:template>
-
-<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/systemModel/@detail-type='fixed' or $Static) and ((../@detail='component' and $Detail!='component') or  
-			(../@detail='collection' and ($Detail='layer' or contains($Detail, 'block'))) or 
-			(../@detail='subblock' and ($Detail='layer' or $Detail='block')) or (../@detail='block' and $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)">
-				<xsl:apply-templates select="key('style-ref',@style-id)" mode="is-showable"/>
-			</xsl:when><!-- see if it's referenced by anything -->
-			<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<!-- example: always use --></xsl:when>
-			<!-- everything else is a rule -->
-			<xsl:when test="self::cbox">
-				<xsl:apply-templates select="//component|//collection|//block|//subblock|//module|//logicalset|//logicalsubset|layer" mode="show-unused-colorsbackground">
-		<!--		<xsl:apply-templates select="//component" 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|//block|//subblock|//module|//logicalset|//logicalsubset|layer" mode="...">-->
-				<xsl:apply-templates select="//component" 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|//collection|//block|//subblock|//module|//logicalset|//logicalsubset|layer" mode="...">-->
-				<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|//block|//subblock|//module|//logicalset|//logicalsubset|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|//block|//subblock|//module|//logicalset|//logicalsubset|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|//block|//subblock|//module|//logicalset|//logicalsubset|layer" mode="show-unused-colorstext-highlight">
-					<xsl:with-param name="n" select="@style-id"/>
-				</xsl:apply-templates>
-			</xsl:when>
-			<xsl:otherwise>			<xsl:message>[
-	
-	<xsl:value-of select="."/>
-	
-	
-	]</xsl:message>
-			</xsl:otherwise>
-		</xsl:choose>
-	</xsl:variable>
-	<xsl:choose>
-		<xsl:when test="(@label | @lookup) and $show!='' ">
-			<xsl:copy> <!-- 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="generated-{../@type}"><xsl:value-of select="@value"/></xsl:attribute>
-					</xsl:otherwise>
-				</xsl:choose>
-			</xsl:copy>
-		</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: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="legend" mode="width" priority="-2">100</xsl:template>
-<xsl:template match="legend|note" mode="offset">
-<xsl:template match="legend"><xsl:param name="h"/>
-<xsl:template match="legend[legend]" mode="min-height">
-
- -->
-</xsl:stylesheet>
-
-	
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/src/svg/Model.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1686 +0,0 @@
-<?xml version="1.0"?>
- <!DOCTYPE XSLT  [
-      <!ENTITY AZ  "ABCDEFGHIJKLMNOPQRSTUVWXYZ">
-      <!ENTITY az  "abcdefghijklmnopqrstuvwxyz">
- ]>
- <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"  xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date exslt"
-		xmlns:exslt="http://exslt.org/common">
-	<xsl:param name="xml-stylesheet"/><!-- set to default stylesheet-->
-	<xsl:param name="Verbose" select="0"/><!-- Verbosity level of messages. Set to 1 (or higher) to get runtime comments-->
-	<xsl:param name="Origin-attr">old_model</xsl:param>
-	<xsl:output method="xml" cdata-section-elements="script s:script" indent="yes"/>
-	  <xsl:key name="named" match="*" use="@name"/>
-
-
-<!-- ====== Computed values ============= -->
-
-<xsl:variable name="Version">
-	<xsl:choose>
-		<xsl:when test="/model/@ver"><xsl:value-of select="/model/@ver"/></xsl:when>
-		<xsl:when test="/model/@deps"><xsl:value-of select="document(/model/@deps,.)/SystemModelDeps/@version"/></xsl:when>
-		<xsl:when test="count(/model/sysdef/info[@type='s12'])=1">
-			<xsl:value-of select="document(/model/sysdef/info[@type='s12']/@href,.)/Schedule12/@OS_version"/>
-		</xsl:when>
-	</xsl:choose>
-</xsl:variable>
-
-
-<!-- for merging: -->
-
-<xsl:variable name="filter-nodes" select="//filter[not(@accept or @reject) and @select and @display]"/>
-	<!--  @value is optional, but should be set unless select=* -->
-
-<xsl:variable name="filter-in"> <!--comma-separated list of filters to accept -->
-	<xsl:text>,</xsl:text>
-	<xsl:if test="not($filter-nodes) and //filter[@accept|@reject]">
-		<xsl:value-of  select="concat($Version,',')"/> <!-- the version number -->
-	</xsl:if>
-	<xsl:for-each select="//filter[@accept]"><xsl:value-of select="@accept"/>,</xsl:for-each>
-	<xsl:for-each select="//filter[@reject]">!<xsl:value-of select="@reject"/>,</xsl:for-each>
-</xsl:variable>
-
-
-<xsl:variable name="ignore" select="//ignore"/>
-
-<xsl:variable name="abbrevs" select="document(/model/layout/info/@href,/)/display-names//abbrev"/> <!-- the abbreviations list -->
-
-<xsl:variable name="simple-filters" select="not(function-available('exslt:node-set'))"/>
-
-<!-- ====== Error checking ============= -->
-
-<!--  start error checking -->
-
-<xsl:template match="SystemDefinition/@schema" mode="check">
-	<!-- warning if schema is less than 1.4 -->
-	<xsl:if test="substring-before(.,'.') &lt; 1 or (substring-before(.,'.')=1 and substring-before(substring-after(.,'.'),'.') &lt; 4)">
-		<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">using old System Definition schema (<xsl:value-of select="."/>)</xsl:with-param></xsl:call-template>
-	</xsl:if>
-<!--	<xsl:if test="starts-with(.,'1.4.')">
-		<xsl:call-template name="Caller-Note"><xsl:with-param name="text">using backwards compatible System Definition schema (<xsl:value-of select="."/>)</xsl:with-param></xsl:call-template>
-	</xsl:if> -->
-	<xsl:if test="substring-before(.,'.') &gt; 2">
-		<xsl:call-template name="Critical-Error"><xsl:with-param name="text">using incompatible System Definition schema (<xsl:value-of select="."/>)</xsl:with-param></xsl:call-template>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="*" mode="check"/>
-
-<xsl:template match="block[ancestor::layer/@levels]|lsubblock[ancestor::layer/@levels] | logicalset[ancestor::layer/@levels]|logicalsubset[ancestor::layer/@levels]" mode="check">
-	<xsl:variable name="levels"><xsl:text> </xsl:text><xsl:apply-templates mode="layernames" select="."/><xsl:text> </xsl:text></xsl:variable>	
-	<xsl:for-each select="module | collection">
-	<xsl:if test="not(contains($levels,concat(' ',@level,' ')))">
-		<xsl:call-template name="Caller-Error"><xsl:with-param name="text">Invalid level: <xsl:value-of select="@level"/> in <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>
-	</xsl:if>
-	</xsl:for-each>
-</xsl:template>
-
-<xsl:template name="Caller-Debug"><xsl:param name="text"/>
-	<xsl:if test="$Verbose &gt; 5"><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>
-
-<!--- ==================== merge ==================== -->
-
-<!-- merge is used this is called on a model file -->
-
-<xsl:template match="@*" mode="copyroot" priority="-1"><xsl:copy-of select="."/></xsl:template>
-<xsl:template match="@detail" mode="copyroot">
-	<xsl:choose>
-		<xsl:when test=".='module'"><xsl:attribute name="detail">collection</xsl:attribute></xsl:when>
-		<xsl:when test=".='logicalsubset'"><xsl:attribute name="detail">subblock</xsl:attribute></xsl:when>
-		<xsl:when test=".='logicalset'"><xsl:attribute name="detail">block</xsl:attribute></xsl:when>
-		<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-
-<xsl:template match="@revision[../@revision-type='date' and contains(.,'%') and function-available('date:month-abbreviation')]" mode="copyroot">
-<xsl:attribute name="revision"><xsl:call-template name="format-date"/></xsl:attribute>
-</xsl:template>
-
-<xsl:template match="/model">
-	<xsl:if test="$xml-stylesheet!='' "> <!-- start with an optional style sheet transform -->
-		<xsl:processing-instruction name="xml-stylesheet">type="text/xsl" href="<xsl:value-of select="$xml-stylesheet"/>"</xsl:processing-instruction>
-	</xsl:if>
-	<SystemDefinition>
-		<xsl:copy-of select="document(sysdef/@href, .)/SystemDefinition/@*"/>
-	<xsl:copy-of select="document(layout/info[@type='abbrev']/@href,.)/*/@xml:lang"/> <!-- copy localized language value -->
-		<xsl:apply-templates select="document(@deps, .)/SystemModelDeps" mode="merge"/>
-		<styling>
-			<xsl:apply-templates select="@shapes | layout/info" mode="styling"/>
-		</styling>
-		<xsl:apply-templates select="document(sysdef/@href, .)/SystemDefinition/@schema" mode="check"/>
-		  <systemModel>
-			<!-- copy all attributes from all the system models and from the model element -->
-			<xsl:apply-templates select="document(sysdef/@href, .)/SystemDefinition/systemModel/@*|@*|layout/@*" mode="copyroot"/>
-			<xsl:if test="$Version!='' and not(@ver)">
-				<xsl:attribute name="ver">
-					<xsl:value-of select="$Version"/>
-				</xsl:attribute>
-			</xsl:if>
-			<!-- special handing of revision details -->
-			<xsl:choose><!-- get revision details from deps if not otherwise specified -->
-				<xsl:when test="@deps and (not(@revision-type) or @revision-type='build') and not(@revision)">
-					<xsl:variable name="rt" select="@revision-type"/>
-					<xsl:for-each select="document(@deps,.)/SystemModelDeps[@number]">
-						<xsl:if test="not($rt)">
-							<xsl:attribute name="revision-type">build</xsl:attribute>
-						</xsl:if>
-						<xsl:attribute name="revision"><xsl:value-of select="@number"/></xsl:attribute>
-					</xsl:for-each>
-				</xsl:when>
-				<xsl:when test="@revision-type='date' and not(@revision) and function-available('date:date-time')">
-					<xsl:attribute name="revision"><xsl:value-of select="substring-before(date:date-time(),'T')"/></xsl:attribute>
-				</xsl:when>
-			</xsl:choose>
-			<xsl:apply-templates select="layout/legend" mode="merge"/> <!-- add legend as a layer -->
-			<xsl:apply-templates select="layout/logo" mode="merge"/> <!-- copy logos to use when drawing: put first so it's drawn last-->
-			<xsl:choose>
-				<xsl:when test="not(function-available('exslt:node-set'))">
-					<!-- can't do much, don't bother filtering -->
-					<xsl:apply-templates select="sysdef" mode="merge"/>
-				</xsl:when>
-				<xsl:otherwise>
-					<xsl:for-each select="/model"> <!-- hack for xsltproc which loses the current node -->				
-					<xsl:variable name="unfiltered">
-							<xsl:choose>
-								<xsl:when test="count(sysdef) &lt; 2"> <!-- no need to merge multi models -->
-									<xsl:apply-templates select="sysdef" mode="merge"/>
-								</xsl:when>
-								<xsl:otherwise>
-									<xsl:variable name="sysdefs">
-										<xsl:for-each select="sysdef">
-											<sysdef><xsl:apply-templates select="." mode="merge"/></sysdef>
-										</xsl:for-each>
-									</xsl:variable>
-									<xsl:apply-templates select="exslt:node-set($sysdefs)/sysdef[1]" mode="override-merge">
-										<xsl:with-param name="next" select="exslt:node-set($sysdefs)/sysdef[2]"/>
-									</xsl:apply-templates>
-								</xsl:otherwise>
-							</xsl:choose>
-						</xsl:variable>
-						<xsl:apply-templates select="exslt:node-set($unfiltered)/*" mode="filter-for-presence"/>
-					</xsl:for-each>
-				</xsl:otherwise>
-			</xsl:choose>
-			<xsl:copy-of select="layout/layer-group"/> <!-- copy layer groups to use when drawing: put last so it's drawn first-->
-		  </systemModel>
-	</SystemDefinition>
-</xsl:template>
-
-
-<!-- merge multiple models together -->
-
-<xsl:template match="sysdef" mode="override-merge"><xsl:param name="next"/>
-	<xsl:choose>
-		<xsl:when test="not($next)">
-			<xsl:copy-of select="*"/>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Merging with model <xsl:value-of select="1 +  count($next/preceding-sibling::sysdef)"/></xsl:with-param></xsl:call-template>			
-			<xsl:variable name="cur">
-					<sysdef>
-						<xsl:apply-templates select="*" mode="override-merge">
-							<xsl:with-param name="other" select="$next"/>
-						</xsl:apply-templates>
-						<xsl:apply-templates select="$next/*" mode="append">
-							<xsl:with-param name="main" select="."/>
-						</xsl:apply-templates>
-					</sysdef>
-			</xsl:variable>
-			<xsl:apply-templates select="exslt:node-set($cur)/sysdef" mode="override-merge">
-				<xsl:with-param name="next" select="$next/following-sibling::sysdef[1]"/>
-			</xsl:apply-templates>	
-		</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="component/*" mode="override-merge" priority="7"><xsl:copy-of select="."/></xsl:template>
-
-<xsl:template match="*" mode="override-merge"><xsl:param name="other"/>
-	<xsl:variable name="n" select="@name"/>
-	<xsl:variable name="tag" select="name()"/>
-	<xsl:choose>
-		<xsl:when test="$other/*[@override=$n and name()=$tag]"> 
-			<!--replace this with the other one at the current location-->
-			<xsl:apply-templates select="$other/*[@override=$n and name()=$tag]" mode="safe-combine">
-				<xsl:with-param name="main-root" select="ancestor-or-self::sysdef"/>
-			</xsl:apply-templates>
-		</xsl:when>
-		<xsl:when test="$other/ancestor-or-self::sysdef/descendant::*[@override=$n and name()=$tag]">
-			<!-- it's overridden somewhere else (perhaps deleted)-->
-			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Deleting  <xsl:value-of select="$n"/></xsl:with-param></xsl:call-template>			
-		</xsl:when>
-		<xsl:when test="$other/*[@rename=$n or @move=$n and name()=$tag]"> <!-- leave as is at the current location-->
-			<xsl:if test="$other/*[@rename=$n or @move=$n and name()=$tag]/*">
-			<xsl:call-template name="Caller-Warning"><xsl:with-param name="text">ignoring children</xsl:with-param></xsl:call-template>
-			</xsl:if>
-			<xsl:copy>
-				<xsl:copy-of select="@*"/> <!-- own attributes -->
-				<xsl:copy-of select="$other/*[@rename=$n or @move=$n and name()=$tag]/@name"/> <!-- overwrite names -->
-			<!--leave as is at the current location-->					
-				<xsl:apply-templates select="*[not(self::name)]"  mode="override-merge"> <!-- do not copy deprecated localised name form-->
-					<xsl:with-param name="other" select="$other/ancestor-or-self::sysdef"/> <!-- use root of other, to catch any moved decendants -->
-				</xsl:apply-templates>
-			</xsl:copy>
-		</xsl:when>
-		<xsl:when test="$other/ancestor-or-self::sysdef/descendant::*[@rename=$n or @move=$n and $tag=name()]">
-			<!--it's moved to elsewhere-->
-			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Relocating <xsl:value-of select="$n"/></xsl:with-param></xsl:call-template>
-		</xsl:when>
-		<xsl:when test="$other/*[@name=$n and self::component]">
-			<!--use other at the current location-->
-			<xsl:copy>
-				<xsl:copy-of select="$other/*[@name=$n and name()=$tag]/@*"/> <!--other's attributes -->
-				<!-- should put something here to merge filters,classes properly -->
-				<xsl:copy-of select="*"/> <!--current conent -->
-					<xsl:variable name="this" select="."/>
-				<xsl:apply-templates mode="copy-merge-content"  select="$other/*[@name=$n and name()=$tag]/*">
-					<xsl:with-param name="main" select="$this"/>
-				</xsl:apply-templates> <!--other's conent -->
-			</xsl:copy>
-		</xsl:when>
-		<xsl:when test="$other/*[@name=$n and name()=$tag]"> <!-- leave as is at the current location, merge children-->
-			<xsl:for-each select="$other/*[@name=$n and name()=$tag]">
-				<xsl:if test="(self::module and $tag!='module') or (not(self::module) and $tag='module')   or   (self::collection and $tag!='collection') or (not(self::collection) and $tag='collection')">
-					<xsl:call-template name="Critical-Error"><xsl:with-param name="text">Cannot merge <xsl:value-of select="name()"/> "<xsl:value-of select="@name"/>" with <xsl:value-of select="$tag"/> "<xsl:value-of select="$n"/>"</xsl:with-param></xsl:call-template>				
-				</xsl:if>
-			</xsl:for-each>
-			<xsl:copy>
-				<xsl:copy-of select="@*"/> <!-- own attributes -->
-				<xsl:copy-of select="$other/*[@name=$n and name()=$tag]/@*"/> <!-- other's attributes -->
-				<xsl:apply-templates select="*"  mode="override-merge">
-					<xsl:with-param name="other" select="$other/*[@name=$n and name()=$tag]"/> <!-- use other version of this -->
-				</xsl:apply-templates>
-			</xsl:copy>
-		</xsl:when>
-		<xsl:when test="$other/ancestor-or-self::sysdef/descendant::*[@name=$n and name()=$tag]">
-			<!-- it's moved to elsewhere -->
-			<xsl:call-template name="Caller-Note"><xsl:with-param name="text">Relocating and merging <xsl:value-of select="$n"/></xsl:with-param></xsl:call-template>
-		</xsl:when>
-		<xsl:otherwise> <!--  there is no equivalent in 2nd, just copy this and descend -->
-			<xsl:copy>
-				<xsl:copy-of select="@*"/> <!-- own attributes -->	
-				<xsl:apply-templates select="*"  mode="override-merge">
-					<xsl:with-param name="other" select="$other/ancestor-or-self::sysdef"/> <!-- use root of other, to catch any moved decendants -->
-				</xsl:apply-templates>
-			</xsl:copy>		
-		</xsl:otherwise>
-	</xsl:choose>
-	<!-- this won't work if the main model has nothing in the group, but that's invalid, so it's ok. -->
-	<xsl:if test="position()=last() and name($other)!='sysdef'">
-		<!--Check if other has stuff to append that's not already been used   -->
-		<xsl:apply-templates select="$other/*" mode="append">
-			<xsl:with-param name="main" select=".."/>
-		</xsl:apply-templates>		
-	</xsl:if>
-</xsl:template>
-
-
-<xsl:template mode="copy-merge-content" match="*">
-<xsl:copy-of select="."/>
-</xsl:template>
-
-
-<xsl:template mode="copy-merge-content" match="component/*[starts-with(name(),'generator-')]"><xsl:param name="main"/>
-	<xsl:variable name="self" select="."/>
-	<!-- only copy if does not exist in original -->
-	<xsl:if test="not($main/*[name()=name($self)])">
-		<xsl:copy-of select="$self"/>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template mode="copy-merge-content" match="unit"><xsl:param name="main"/>
-	<xsl:variable name="attr"><xsl:for-each select="@*"><xsl:value-of select="concat(name(),'=',.)"></xsl:value-of></xsl:for-each></xsl:variable>
-	<xsl:variable name="exists">
-		<xsl:for-each select="$main/unit">
-			<xsl:variable name="attr2"><xsl:for-each select="@*"><xsl:value-of select="concat(name(),'=',.)"></xsl:value-of></xsl:for-each></xsl:variable>
-			<xsl:if test="$attr2=$attr">*</xsl:if>
-		</xsl:for-each>
-	</xsl:variable>
-	<!-- only copy if does not exist in original's units-->
-	<xsl:if test="$exists=''">
-		<xsl:copy-of select="."/>
-	</xsl:if>
-</xsl:template>
-
-
-
-<xsl:template match="*[@override  and *]" mode="append" priority="5"><xsl:param name="main"/>
-	<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">Append (5) <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>	
-
-	<xsl:variable name="n" select="@override"/>
-		<!-- if override is not in main, use this -->
-	<xsl:if test="@name and not($main/*[@name=$n])">
-		<!--  must have a name for renaming -->
-		<xsl:copy>
-			<xsl:copy-of select="@*[not(name()='override' or name()='rename' or name()='move')]"/>
-			<xsl:apply-templates select="*" mode="safe-combine">
-				<xsl:with-param name="main-root" select="$main/ancestor-or-self::sysdef"/>
-			</xsl:apply-templates>	
-		</xsl:copy>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="*" mode="safe-combine" priority="-1"><xsl:param name="main-root"/>
-	<xsl:copy>
-		<xsl:copy-of select="@*"/>
-		<xsl:apply-templates select="*"  mode="safe-combine">
-			<xsl:with-param name="main-root" select="$main-root"/>
-		</xsl:apply-templates>
-	</xsl:copy>
-</xsl:template>
-
-<xsl:template match="*[@rename or @move]" mode="safe-combine" priority="3"><xsl:param name="main-root"/>
-	<xsl:variable name="n" select="@rename | @move"/>
-	<xsl:variable name="newname" select="@name"/>
-	<xsl:variable name="atts" select="@*[name()!='name' and name()!='move' and name()!='rename' and name()!='override']"/> <!-- if any non-oragnisational attributes are present on the "move" item, then they should override the values in the thing being moved -->
-	<xsl:variable name="other" select="ancestor-or-self::sysdef"/>
-	<!-- can't merge a component with a container -->
-	<xsl:for-each select="$main-root/descendant::*[@name=$n and (self::layer or self::block or self::subblock or self::logicalset or self::logicalsubset)]">
-		<xsl:copy>
-			<xsl:copy-of select="@*"/>
-			<xsl:copy-of select="$newname"/>	
-			<xsl:copy-of select="$atts"/> <!-- if any of these attributes are present on the moved collection, then use that value rather than the value in the one being moved -->
-			<xsl:apply-templates select="*"  mode="override-merge"> <!-- do not copy localised name -->
-				<xsl:with-param name="other" select="$other"/>
-			</xsl:apply-templates>
-		</xsl:copy>
-	</xsl:for-each>	
-</xsl:template>
-<!-- can only merge a component or module with component or module -->
-<xsl:template match="component[@rename or @move] | collection[@rename or @move] | module[@rename or @move]" mode="safe-combine" priority="4"><xsl:param name="main-root"/>
-	<xsl:variable name="n" select="@rename | @move"/>
-	<xsl:variable name="newname" select="@name"/>
-	<xsl:variable name="atts" select="@*[name()!='name' and name()!='move' and name()!='rename' and name()!='override']"/> <!-- if any non-oragnisational attributes are present on the "move" item, then they should override the values in the thing being moved -->
-	<xsl:variable name="tag" select="name()"/>
-	<xsl:variable name="other" select="ancestor-or-self::sysdef"/>	
-	<!-- can't merge a component with a container -->
-	<xsl:for-each select="$main-root/descendant::*[@name=$n and $tag=name()]">
-		<xsl:copy>
-			<xsl:copy-of select="@*"/>
-			<xsl:copy-of select="$newname"/>	
-			<xsl:copy-of select="$atts"/> <!-- if any of these attributes are present on the moved collection, then use that value rather than the value in the one being moved -->
-			<xsl:apply-templates select="*[not(self::name)]"  mode="override-merge"> <!-- do not copy localised name -->
-				<xsl:with-param name="other" select="$other"/>
-			</xsl:apply-templates>
-		</xsl:copy>
-	</xsl:for-each>	
-</xsl:template>
-
-
-<xsl:template match="*[@name]" mode="safe-combine" priority="2"><xsl:param name="main-root"/>
-	<xsl:if test="@override and (@rename or @move)">
-		<xsl:call-template name="Critical-Error"><xsl:with-param name="text">Error invalid combinations of attributes in <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>
-	</xsl:if>
-	<xsl:copy>
-		<xsl:variable name="cur" select="."/>
-		<xsl:copy-of select="@*[not(name()='override' or name()='rename' or name()='move')]"/>
-		<!-- copy other's attributes -->
-		<xsl:copy-of select="$main-root/descendant::*[@name=$cur/@name and name($cur)=name()]/@*[not(name()='override' or name()='rename' or name()='move' or name()='name')]"/>		
-		<xsl:apply-templates select="*"  mode="safe-combine">
-			<xsl:with-param name="main-root" select="$main-root"/>
-		</xsl:apply-templates>
-		<!-- now copy anything defined here -->
-		<xsl:variable name="other" select="ancestor-or-self::sysdef"/>	
-		<xsl:for-each select="$main-root/descendant::*[@name=$cur/@name and name($cur)=name()]">
-			<xsl:apply-templates select="*[not(self::name)]"  mode="override-merge"> <!-- do not copy localised name -->
-				<xsl:with-param name="other" select="$other"/>
-			</xsl:apply-templates>
-		</xsl:for-each>	
-	</xsl:copy>
-</xsl:template>
-
-<xsl:template match="component | component/*" mode="safe-combine" priority="2">
-	<!--a component is atomic: it cannot be merged. So it's always just copied.-->	
-	<xsl:copy-of select="."/>
-</xsl:template>
-
-
-<xsl:template match="*[@override and not(@name)]" mode="safe-combine" priority="5"/> <!-- ignore component -->
-
-
-<xsl:template match="*" mode="unused-merge"><xsl:param name="other"/>
-	<xsl:variable name="self" select="."/>
-	<xsl:if test="not($other/descendant::*[@name=$self/@name and name()=name($self)  and descendant-or-self::component])">
-		<!-- not in other, so include here -->
-		<xsl:copy>
-			<xsl:copy-of select="@*"/>
-			<xsl:apply-templates select="*"  mode="unused-merge">
-				<xsl:with-param name="other" select="$other"/>
-			</xsl:apply-templates>
-		</xsl:copy>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="*[@name]" mode="append"><xsl:param name="main"/>
-	<!--  this handles all cases where this holds the data -->
-	<xsl:variable name="self" select="."/>
-		<!-- if $self is not in main, use this -->
-	<xsl:if test="not($main/*[@name=$self/@name])">
-		<xsl:variable name="other" select="ancestor-or-self::sysdef"/>
-		<xsl:for-each select="$main/ancestor-or-self::sysdef/descendant::*[@name=$self/@name and name()=name($self)  and descendant-or-self::component]">
-			<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">To Merge <xsl:value-of select="$self/@name"/> with these: <xsl:for-each select="*">"<xsl:value-of select="@name"/>", </xsl:for-each></xsl:with-param></xsl:call-template>	
-			<xsl:copy>
-				<xsl:copy-of select="@*"/>
-				<xsl:apply-templates select="*"  mode="override-merge">
-					<xsl:with-param name="other" select="$other"/>
-				</xsl:apply-templates>
-	<xsl:comment>was not here</xsl:comment>
-				<xsl:apply-templates select="$other/descendant::*[@name=$self/@name and name()=name($self) and descendant-or-self::component]/*"  mode="unused-merge">
-					<xsl:with-param name="other" select="$main"/>
-				</xsl:apply-templates>
-	<xsl:comment>end not here</xsl:comment>
-			</xsl:copy>
-		</xsl:for-each>
-		<!-- if it does not already exist, create it and check all children -->
-		<xsl:if test="not($main/ancestor-or-self::sysdef/descendant::*[@name=$self/@name and name()=name($self) and descendant-or-self::component])">
-			<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">Does not already exist: <xsl:value-of select="$self/@name"/> </xsl:with-param></xsl:call-template>	
-			<xsl:copy>
-				<xsl:copy-of select="@*"/>
-				<xsl:apply-templates select="*"  mode="safe-combine">
-					<xsl:with-param name="main-root" select="$main/ancestor-or-self::sysdef"/>
-				</xsl:apply-templates>
-			</xsl:copy>			
-		</xsl:if>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="component[@name]" mode="append" priority="1"><xsl:param name="main"/>
-	<xsl:variable name="n" select="@name"/>
-		<!-- if $n is not in main, use this -->
-	<xsl:if test="not($main/*[@name=$n])">	
-		<xsl:copy-of select="."/>
-	</xsl:if>
-</xsl:template>
-
-
-<xsl:template match="*[@rename or @move]" mode="append" priority="4"><xsl:param name="main"/>
-	<xsl:call-template name="Caller-Debug"><xsl:with-param name="text">Append (4) <xsl:value-of select="@name"/></xsl:with-param></xsl:call-template>	
-	<xsl:variable name="n" select="@rename | @move"/>
-		<!-- if $n is not in main, use this -->
-	<xsl:if test="not($main/*[@name=$n])">	
-		<xsl:apply-templates select="." mode="safe-combine">
-			<xsl:with-param name="main-root" select="$main/ancestor-or-self::sysdef"/>
-		</xsl:apply-templates>	
-	</xsl:if>
-</xsl:template>
-
-<!-- merging data sources  -->
-<xsl:template match="sysdef" mode="merge">
-	<xsl:apply-templates select="document(@href)/SystemDefinition/systemModel/*" mode="merge">
-		<xsl:with-param name="extra-files" select="info|../@deps|../@ts|../layout/info[@type and document(@href,.)/values]|../layout/display|@root"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-
-<xsl:template match="SystemModelDeps" mode="merge">
-	<xsl:if test="@name or @version or @number">
-		<release><xsl:copy-of select="@name | @version | @number"/></release>
-	</xsl:if>
-</xsl:template>
-
-<!-- merge model with extra -->
-
-<xsl:template match="layer" mode="merge"><xsl:param name="extra-files"/>
-	<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>	
-	<xsl:if test="$e!=''">
-		<xsl:copy><xsl:copy-of select="@*"/> 
-			<xsl:variable name="name" select="@name"/>
-			<xsl:copy-of select="$extra-files[self::display and @name=$name]/@*[name()!='name']"/>
-			<xsl:if test="$extra-files[@type='levels']"><!-- levels hack for older models -->
-				<xsl:copy-of select="document($extra-files[@type='levels']/@href,$extra-files)//layer[@name=$name]/@*[name()='levels' or name()='span']"/>
-			</xsl:if>
-			<xsl:apply-templates select="$extra-files[@type='extra']" mode="merge-attributes">
-				<xsl:with-param name="cmp" select="."/>			
-			</xsl:apply-templates>
-			<xsl:if test="@name='Programming Support' and not(@span)"><xsl:attribute name="span">2</xsl:attribute></xsl:if> <!-- hack!!!!! -->
-			<xsl:call-template name="abbrev"/>
-		 	<xsl:apply-templates select="*" mode="merge">
-				<xsl:with-param name="extra-files" select="$extra-files"/>
-			</xsl:apply-templates>
-		</xsl:copy>
-	</xsl:if>
-</xsl:template>
-
-
-<!-- hack for old models -->
-<xsl:template match="logicalsubset[@name='J2ME']" mode="merge" priority="5"><xsl:param name="extra-files"/>
-	<xsl:apply-templates select="*" mode="merge">
-		<xsl:with-param name="extra-files" select="$extra-files"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-<!-- update old model names, these could be done as a set of templates instead.
-	I've no idea which is more efficient -->
-<xsl:template match="*" mode="item-tag">
-	<xsl:choose>
-		<xsl:when test="self::module">collection</xsl:when>
-		<xsl:when test="self::logicalset">block</xsl:when>
-		<xsl:when test="self::logicalsubset">subblock</xsl:when>
-		<xsl:otherwise><xsl:value-of select="name()"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="*" mode="alt-tag"> <!-- for compatability-->
-	<xsl:choose>
-		<xsl:when test="self::collection">module</xsl:when>
-		<xsl:when test="self::block">logicalset</xsl:when>
-		<xsl:when test="self::subblock">logicalsubset</xsl:when>
-		<xsl:otherwise><xsl:value-of select="name()"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="collection|block|subblock | module|logicalset|logicalsubset" mode="merge"><xsl:param name="extra-files"/>
-	<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>
-	<xsl:if test="$e!=''">	
-		<xsl:variable name="tag"><xsl:apply-templates mode="item-tag" select="."/></xsl:variable>
-		<xsl:variable name="alt-tag"><xsl:apply-templates mode="alt-tag" select="."/></xsl:variable>
-		<xsl:element name="{$tag}">
-			<xsl:copy-of select="@*"/>
-			<xsl:variable name="name" select="@name"/>
-			<xsl:copy-of select="$extra-files[self::display and @name=$name]/@*[name()!='name']"/>		
-			<xsl:if test="not(self::logicalsubset or self::subblock) and $extra-files[@type='levels']">
-				<xsl:copy-of select="document($extra-files[@type='levels']/@href,$extra-files)//*[@name=$name and (name()=$tag or name()=$alt-tag)]/@*[starts-with(name(),'level') or name()='span']"/>
-			</xsl:if>
-			<xsl:apply-templates select="$extra-files[@type='extra']" mode="merge-attributes">
-				<xsl:with-param name="cmp" select="."/>			
-			</xsl:apply-templates>			
-			<xsl:call-template name="abbrev"/>	
-			<xsl:apply-templates select="*" mode="merge">
-				<xsl:with-param name="extra-files" select="$extra-files"/>
-			</xsl:apply-templates>	  
-		</xsl:element>
-	</xsl:if>
-</xsl:template>
-
-<!-- sched 12 -->
-
-<xsl:template match="Schedule12/*[@name]" mode="merge">
-	<s12>
-		<!-- allow multiple s12 in a component so shapes can pick the right one for the supplied version-->
-		<xsl:attribute name="ver"><xsl:value-of select="/Schedule12/@OS_version"/></xsl:attribute>
-		<xsl:apply-templates select="." mode="osd"/>
-		<xsl:copy-of select="@name"/>
-	</s12>
-</xsl:template>
-
-<xsl:template match="*" mode="osd"> <!-- CR, OS, OR, CS or anything new -->
-	<xsl:attribute name="osd"><xsl:value-of select="name()"/></xsl:attribute>
-</xsl:template>
-
-<xsl:template match="REF" mode="osd">
-	<xsl:attribute name="osd">T-R</xsl:attribute>
-	<xsl:attribute name="ref">true</xsl:attribute>
-</xsl:template>
-
-<xsl:template match="TEST|RT" mode="osd">
-	<xsl:attribute name="osd">T-R</xsl:attribute>
-</xsl:template>
-
-<!--/sched 12 -->
-
-<!-- filters -->
-
-
-
-<xsl:template name="is-present">
-	<!-- use this for filtering if we need to use simple filtering
-		only necessary if we can't use node-set filters -->
-	<xsl:choose>
-		<xsl:when test="not($simple-filters)">1</xsl:when>
-		<xsl:otherwise>
-			<xsl:variable name="show">
-				<xsl:apply-templates select="." mode="filter-value"/>
-			</xsl:variable>
-			<!-- filter accept="..." takes precedence over "rich" filters, so if the rich filter
-				says the item is present, then we still need to check to see if it should be
-				shown via the mode="present" template	-->
-			<xsl:if test="$show='' or $show='show'">
-				<xsl:apply-templates select="." mode="present"/>
-			</xsl:if>
-		</xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="component" mode="present" priority="8">
-	<xsl:variable name="e"><xsl:apply-templates select="unit|package|prebuilt" mode="present"/></xsl:variable>
-	<xsl:if test="$e!='' or not(unit|package|prebuilt)">1</xsl:if>
-</xsl:template>
-
-<xsl:template match="layer|block|subblock|collection | module|logicalset|logicalsubset" mode="present" priority="9">
-	<xsl:variable name="t" select="name()"/><xsl:variable name="n" select="@name"/>
-	<xsl:variable name="alt"><xsl:apply-templates select="." mode="alt-tag"/></xsl:variable>
-	<xsl:if test="not($ignore[(@type=$t or @type=$alt) and @name=$n])"> <!-- matches either e.g. module or colelction -->
-		<xsl:apply-templates select="descendant::component" mode="present"/>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="component[@filter]" mode="present" priority="9">
-	<!-- if there's a filter then check to see if this is filtered out -->
-	<xsl:variable name="e0"><xsl:call-template name="present"/></xsl:variable>
-	<xsl:if test="$e0!=''">
-		<xsl:variable name="e1"><xsl:apply-templates select="unit|package|prebuilt" mode="present"/></xsl:variable>
-		<xsl:if test="$e1!=''  or not(unit|package|prebuilt)">1</xsl:if>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="*[not(@filter)]" mode="present" priority="5">1</xsl:template> <!-- if no filter, must always be valid -->
-<xsl:template match="*[@filter]" mode="present"><xsl:call-template name="present"/></xsl:template>
-
-<xsl:template match="*[contains(@filter,',')]" mode="present">	
-	<!-- if the number of comma-separated items is the same as the number of items present, then this is present (ie we're ANDing the items)-->
-	<xsl:variable name="present"><xsl:call-template name="present-list"/></xsl:variable>
-	<xsl:if test="string-length(@filter) - string-length(translate(@filter,',','')) + 1 = string-length($present)">1</xsl:if>
-</xsl:template>	
-
-<xsl:template name="present-list"><xsl:param name="filter" select="@filter"/>
-	<xsl:call-template name="present">
-		<xsl:with-param name="filter">	<xsl:choose>
-			<xsl:when test="contains($filter,',')"><xsl:value-of select="substring-before($filter,',')"/></xsl:when>
-			<xsl:otherwise><xsl:value-of select="$filter"/></xsl:otherwise>
-		</xsl:choose></xsl:with-param>
-	</xsl:call-template>
-	<xsl:if test="contains($filter,',')"><xsl:call-template name="present-list">
-		<xsl:with-param name="filter" select="substring-after($filter,',')"/>
-	</xsl:call-template></xsl:if>
-</xsl:template>
-
-<xsl:template name="present"><xsl:param name="filter" select="@filter"/>
-	<xsl:choose>
-		<xsl:when test="$filter-in=',' and $filter-nodes">1</xsl:when> <!-- accept everything -->
-		<xsl:when test="contains($filter-in,concat(',',$filter,','))">1</xsl:when> <!-- accept anything explictly on accept list -->
-		<xsl:when test="starts-with($filter,'!') and contains($filter-in,concat(',',substring($filter,2),','))"/> <!--reject if expliftly to accept a something with a "not" -->
-		<xsl:when test="starts-with($filter,'!')">1</xsl:when> <!--it's not on the must-have list, so accept it -->
-		<!-- reject otherwise -->
-	</xsl:choose>
-</xsl:template>
-<!-- node-set filters -->
-
-<xsl:template mode="filter-for-presence" match="comment() | node()" priority="-1"><xsl:copy-of select="."/></xsl:template>
-
-<xsl:template mode="filter-for-presence" match="layer|block|subblock|collection | logicalset|logicalsubset|module">
-	<xsl:variable name="t" select="name()"/>
-	<xsl:variable name="alt"><xsl:apply-templates select="." mode="alt-tag"/></xsl:variable>	<!-- for bkward compat -->
-	<xsl:variable name="n" select="@name"/>
-	<xsl:if test="not($ignore[(@type=$t or @type=$alt) and @name=$n])">
-		<xsl:variable name="content">
-			<xsl:apply-templates  select="comment() | *" mode="filter-for-presence"/>
-		</xsl:variable>
-		<xsl:if test="exslt:node-set($content)/*">
-			<xsl:copy><xsl:copy-of select="@*"/>
-				<xsl:copy-of select="$content"/>
-			</xsl:copy>
-		</xsl:if>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="filter" mode="filter-values"><xsl:param name="c"/>
-	<xsl:variable name="att" select="@select"/>
-	<xsl:choose>
-		<xsl:when test="not($c[self::component])"/>
-		<xsl:when test="@select='*'"> <!-- always matches -->
-				<xsl:value-of select="concat(' ',@display)"/>
-		</xsl:when>
-		<xsl:when test="not($c/@*[name()=$att] or $c/*[self::unit or self::package or self::prebuilt]/@*[name()=$att])"/> <!-- this filter does not match this component-->
-		<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'">
-			<!--  @value must be in the comma-separated list of filter on this or child-->
-			<xsl:if test="contains(concat(',',$c/@filter,',',$c/*/@filter,','),concat(',',@value,','))">
-				<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($c/@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= $c/@*[name()=$att]">
-				<xsl:value-of select="concat(' ',@display)"/>
-		</xsl:when>
-		<!--  other attributes on unit children must also match exactly -->
-		<xsl:when test="@value= $c/*/@*[name()=$att]">
-				<xsl:value-of select="concat(' ',@display)"/>
-		</xsl:when>
-	</xsl:choose>	
-</xsl:template>
-
-
-<xsl:template match="*" mode="filter-value"/> <!-- no filter value unless otherwise specified -->
-<xsl:template match="component" priority="1"  mode="filter-value"> <!-- only components can have "rich" filters, though some attributes can apply to units-->
-	<xsl:variable name="this" select="."/>
-	<xsl:call-template name="last-in-list">
-		<xsl:with-param name="str">
-			<xsl:apply-templates select="$filter-nodes" mode="filter-values">
-				<xsl:with-param name="c" select="$this"/>
-			</xsl:apply-templates>
-		</xsl:with-param>
-	</xsl:call-template>
-</xsl:template>
-
-<!-- this will add a display="..." attribute to the item for any display value other than
-	'hide' (which does not include the item in the output) and
-	'show' (which includes the item, but the attribtue is not needed, since it should appear like any other item) -->
-<xsl:template mode="filter-for-presence" match="component|unit|package|prebuilt" priority="1">
-	<xsl:variable name="show">
-		<xsl:apply-templates select="." mode="filter-value"/>
-	</xsl:variable>
-	<xsl:if test="$show='' or $show!='hide'">	
-		<xsl:variable name="this" select="."/>
-		<xsl:if test="not($ignore[@type=name($this) and $this/@name=@name])"> 	<!-- hide component if specifically told to ignore -->
-			<xsl:variable name="e"><xsl:apply-templates select="." mode="present"/></xsl:variable>
-			<!-- show component if any CBRs survive the filters or this is a placeholder with no content -->
-			<xsl:choose>
-				<xsl:when test="$e='' "/> <!-- filtered out, don't show -->
-				<xsl:when test="self::component">
-					<xsl:variable name="content">
-						<xsl:apply-templates  select="comment() | *" mode="filter-for-presence"/>
-					</xsl:variable>
-					<xsl:if test="exslt:node-set($content)/* or not(*)"> <!-- show all empty components -->
-						<xsl:copy><xsl:copy-of select="@*"/>
-							<xsl:if test="$show!='' and $show!='show'"><xsl:attribute name="display"><xsl:value-of select="$show"/></xsl:attribute></xsl:if>
-							<xsl:copy-of select="$content"/>
-						</xsl:copy>
-					</xsl:if>
-				</xsl:when>
-				<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
-			</xsl:choose>
-		</xsl:if>
-	</xsl:if>
-</xsl:template>
-
-<!-- /filters -->
-
-<!-- ======= rules to merge various aux data ============== -->
-<xsl:template match="*" mode="merge-attributes"/>
-<xsl:template match="*" mode="merge-content"/>
-
-
-<xsl:template match="/values" mode="merge-attributes"><xsl:param name="cmp"/><xsl:param name="base"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<xsl:if test="$base[@type!='style' and @type!='color']"> <!-- style and colour can have any number of values, so it needs to be captured in an element -->
-			<xsl:variable name="join"><xsl:if test="$base/@type!=''">-</xsl:if></xsl:variable>
-			<xsl:variable name="value" select="key('named',$cmp/@name)[self::component]/.."/>
-			<xsl:if test="$value/@value">
-				<xsl:attribute name="generator{$join}{$base/@type}">
-					<xsl:apply-templates select="$value" mode="style-id">
-						<xsl:with-param select="$base" name="base"/>
-					</xsl:apply-templates>
-				</xsl:attribute>
-			</xsl:if>
-		</xsl:if>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="/values" mode="merge-content"><xsl:param name="cmp"/><xsl:param name="base"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<xsl:if test="$base[@type='style' or @type='color']"> <!-- at this point, only style and color can have multiple values -->
-			<xsl:variable name="join"><xsl:if test="$base/@type!=''">-</xsl:if></xsl:variable>
-			<xsl:variable name="value" select="key('named',$cmp/@name)[self::component]/.."/>
-			<xsl:choose>
-				<xsl:when test="$value">
-					<xsl:for-each select="$value">
-						<xsl:element name="generator{$join}{$base/@type}">
-						 	<xsl:attribute name="ref">
-								<xsl:apply-templates select="." mode="style-id">
-									<xsl:with-param select="$base" name="base"/>
-								</xsl:apply-templates>
-							</xsl:attribute>
-						</xsl:element>
-					</xsl:for-each>
-				</xsl:when>
-				<xsl:when test="@default">
-					<xsl:element name="generator{$join}{$base/@type}">
-					 	<xsl:attribute name="ref">
-							<xsl:apply-templates select="$base" mode="style-id"/>
-						</xsl:attribute>
-					</xsl:element>
-				</xsl:when>
-			</xsl:choose>
-		</xsl:if>
-	</xsl:if>
-</xsl:template>
-
-
-<!-- unsupported proprietary format -->
-<xsl:template match="/techstreams" mode="merge-attributes"><xsl:param name="cmp"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<xsl:attribute name="ts"><xsl:value-of select="key('named',$cmp/@name)[name()='component' and not(@type)]/../@name"/></xsl:attribute>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="/techstreams" mode="merge-content"><xsl:param name="cmp"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<xsl:for-each select="key('named',$cmp/@name)[name()='component']">
-			<xsl:for-each select="self::component[not(@type)]/ancestor::group">
-				<ts-group><xsl:copy-of select="@*"/></ts-group>
-			</xsl:for-each>	
-			<xsl:for-each select="owners">
-				<xsl:copy><xsl:copy-of select="@*"/>
-					<xsl:if test="@type"><xsl:attribute name="ts"><xsl:value-of select="../../@name"/></xsl:attribute></xsl:if>
-				<xsl:copy-of select="*"/>
-				</xsl:copy>
-			</xsl:for-each>	
-		</xsl:for-each>	
-	</xsl:if>
-</xsl:template>
-
-<!-- unsupported proprietary format -->
-<xsl:template match="/attributes" mode="merge-attributes"><xsl:param name="cmp"/>
-	<xsl:for-each select="key('named',$cmp/ancestor::layer/@name)[self::layer and @inherit='yes']">
-		<xsl:copy-of select="attrs/@*"/>
-	</xsl:for-each>
-	<xsl:for-each select="key('named',$cmp/ancestor::block/@name)[self::block and @inherit='yes']">
-		<xsl:copy-of select="attrs/@*"/>
-	</xsl:for-each>
-	<xsl:for-each select="key('named',$cmp/ancestor::subblock/@name)[self::subblock and @inherit='yes']">
-		<xsl:copy-of select="attrs/@*"/>
-	</xsl:for-each>
-	<xsl:for-each select="key('named',$cmp/ancestor::collection/@name)[self::coll and @inherit='yes']">
-		<xsl:copy-of select="attrs/@*"/>
-	</xsl:for-each>
-	<xsl:for-each select="key('named',$cmp/@name)[starts-with(local-name($cmp),local-name())]">
-		<xsl:if test="not(@location) or (@location=$cmp/../@name)">
-			<xsl:copy-of select="attrs/@*"/>
-		</xsl:if>
-	</xsl:for-each>
-</xsl:template>
-<xsl:template match="/attributes" mode="merge-content"/>
-
-
-
-<xsl:template match="/model" mode="merge-attributes"><xsl:param name="cmp"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<!-- only use location if there is ambiguity -->
-		<xsl:variable name="loc">
-			<xsl:variable name="name" select="$cmp/@name"/>
-			<xsl:if test="count($cmp/ancestor::systemModel//component[@name=$name])!=1">
-				<xsl:for-each select="$cmp"><xsl:call-template name="location"/></xsl:for-each>
-			</xsl:if>
-		</xsl:variable>
-	<!--	<xsl:copy-of select="key('named',$cmp/@name)[name()='c' and ($loc='' or location=$loc)]/@*"/>-->
-		<xsl:for-each select="key('named',$cmp/@name)[name()='c' and ($loc='' or location=$loc)]/@*">
-			<xsl:copy-of select="."/>
-			<xsl:if test="name()='introduced'">   <!-- keep this while still in beta -->
-				<xsl:attribute name="since"><xsl:value-of select="."/></xsl:attribute>
-			</xsl:if>
-		</xsl:for-each>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template match="/model" mode="merge-content"><xsl:param name="cmp"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<xsl:variable name="loc">
-			<xsl:variable name="name" select="$cmp/@name"/>
-			<xsl:if test="count($cmp/ancestor::systemModel//component[@name=$name])!=1">
-				<xsl:for-each select="$cmp"><xsl:call-template name="location"/></xsl:for-each>
-			</xsl:if>
-		</xsl:variable>
-		<xsl:for-each select="key('named',$cmp/@name)[name()='c' and ($loc='' or location=$loc)]">
-			<xsl:copy-of select="*[name()!='location' and name()!='bld' and name()!='ts']"/>
-			<xsl:apply-templates select="bld" mode="merge"/>
-		</xsl:for-each>
-	</xsl:if>
-</xsl:template>
-	
-
-<xsl:template match="/SQL" mode="merge-content"><xsl:param name="cmp"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<xsl:variable name="loc"><xsl:for-each select="$cmp"><xsl:call-template name="location"/></xsl:for-each></xsl:variable>
-		<xsl:for-each select="//ROW[translate(component,'&AZ;','&az;')=translate($cmp/name,'&AZ;','&az;')]">
-			<xsl:variable name="match">
-				<xsl:if test="layer"><xsl:value-of select="layer"/>/</xsl:if>
-				<xsl:if test="layer"><xsl:value-of select="block"/>/</xsl:if>
-				<xsl:if test="layer"><xsl:value-of select="subblock"/>/</xsl:if>
-				<xsl:if test="layer"><xsl:value-of select="collection"/>/</xsl:if>
-			</xsl:variable>
-			<xsl:if test="$match = concat($loc,'/') or 1 "><xsl:apply-templates mode="sql" select="*"/></xsl:if>
-		</xsl:for-each>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template mode="sql" match="*"><xsl:copy-of select="."/></xsl:template>
-<xsl:template mode="sql" match="layer|block|subblock|collection|component"/>
-
-
-<xsl:template match="/Schedule12" mode="merge-content"><xsl:param name="cmp"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<xsl:variable name="match">
-			<xsl:call-template name="merge-Schedule12">
-				<xsl:with-param name="cmp" select="$cmp"/>
-			</xsl:call-template>
-		</xsl:variable>
-		<xsl:if test="$match='' ">
-			<xsl:call-template name="Caller-Warning"><xsl:with-param name="text"><xsl:value-of select="$cmp/@name"/> not in Schedule 12</xsl:with-param></xsl:call-template>
-		</xsl:if>
-		<xsl:if test="$match!='' ">
-			<xsl:apply-templates select="//system_model[$match=@entry]/.." mode="merge"/>
-		</xsl:if>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template name="merge-Schedule12"><xsl:param name="path"/><xsl:param name="cmp"/>
-	<xsl:choose>
-	<!--  match this, then try matching parents -->
-		<xsl:when test="//system_model[@entry=$cmp/@name]">
-			<xsl:value-of select="$cmp/@name"/>
-		</xsl:when>
-		<xsl:when test="$cmp/parent::*[@name]">
-			<xsl:call-template name="merge-Schedule12">
-				<xsl:with-param name="cmp" select="$cmp/parent::*"/>
-			</xsl:call-template>			
-		</xsl:when>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="/LicensesFile" mode="merge-content"><xsl:param name="cmp"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<xsl:for-each select="//Supplier/Contract">
-			<xsl:variable name="n" select="@name"/>
-			<xsl:variable name="s" select="../@name"/>
-			<xsl:if test="not(following-sibling::Contract[@name=$n])">
-			<xsl:for-each select="$cmp/*[@name]"> <!-- if there is somthing without a contract use Symbian_Default -->
-				<xsl:if test="(not(@contract) and $n='Symbian_Default') or @contract=$n"><supplier name="{$s}" for="{@name}"/></xsl:if>
-			</xsl:for-each>
-			</xsl:if>
-		</xsl:for-each>
-	</xsl:if>
-</xsl:template>
-
-
-<xsl:template match="/SystemModelDeps" mode="merge-content"><xsl:param name="cmp"/>
-	<xsl:if test="$cmp[self::component]"> <!-- only valid for components -->
-		<Build>
-			<xsl:variable name="name">
-				<xsl:choose>
-					<xsl:when test="starts-with(@component,'techview_')"><xsl:message/><xsl:value-of select="substring-after(@component,'techview_')"/></xsl:when>
-					<xsl:otherwise><xsl:value-of select="@component"/></xsl:otherwise>
-				</xsl:choose>
-			</xsl:variable>
-			<xsl:apply-templates select="//Executable[$cmp/@name=@component or ($cmp/*[contains(@filter,'techview')] and concat('techview_',$cmp/@name)=@component)]"/>
-		</Build>
-	</xsl:if>
-</xsl:template>
-<!-- /aux rules -->
-
-<xsl:template match="@root" mode="merge-attributes"/>
-<xsl:template match="@root" mode="merge-content"/>
-
-<xsl:template match="@*" mode="merge-attributes"><xsl:param name="cmp"/>
-	<xsl:apply-templates mode="merge-attributes" select="document(.,/)/*">
-		<xsl:with-param name="cmp" select="$cmp"/>		
-	</xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="info[@type!='symsym']" mode="merge-attributes"><xsl:param name="cmp"/> 
-	<!-- not called for symsym snice symsym only adds components -->
-	<xsl:apply-templates mode="merge-attributes" select="document(@href,/)/*">
-		<xsl:with-param name="cmp" select="$cmp"/>
-		<xsl:with-param name="base" select="."/>
-	</xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="@*" mode="merge-content"><xsl:param name="cmp"/>
-	<xsl:apply-templates mode="merge-content" select="document(.,/)/*">
-		<xsl:with-param name="cmp" select="$cmp"/>
-	</xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="info" mode="merge-content"><xsl:param name="cmp"/>
-	<xsl:apply-templates mode="merge-content" select="document(@href,/)/*">
-		<xsl:with-param name="cmp" select="$cmp"/>		
-		<xsl:with-param name="base" select="."/>
-	</xsl:apply-templates>
-</xsl:template>
-
-<xsl:template match="info[@type='symsym']" mode="merge-content"><xsl:param name="cmp"/>
-	<xsl:variable name="filter" select="@dbfilter"/>
-	<xsl:variable name="use" select="@use"/>
-	<xsl:variable name="include" select="concat(',',@include,',')"/>
-	<SQL>
-		<xsl:for-each select="document(@href)/SQL/ROW/*[name()=$filter]">
-			<xsl:variable name="name" select="translate(.,'&AZ;','&az;')"/>
-			<xsl:if test="($use='mrp' and $cmp/*[translate(@name,'&AZ;','&az;')=$name]) or ($use='component' and translate($cmp/@name,'&AZ;','&az;')=$name)">
-			 	<xsl:for-each select="..">
-					<xsl:copy>
-						<xsl:for-each select="*">
-							<xsl:if test="$include=',,' or contains($include,concat(',',name(),','))"><xsl:copy-of select="."/></xsl:if>
-						</xsl:for-each>
-					</xsl:copy>
-				</xsl:for-each>
-			</xsl:if>
-		</xsl:for-each>
-	</SQL>
-</xsl:template>
-
-<xsl:template match="component" mode="merge"><xsl:param name="extra-files"/>
-	<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>
-	<xsl:if test="$e!=''">
-		<xsl:copy><xsl:copy-of select="@*"/>
-			<xsl:if test="$Origin-attr!='' and not(@*[local-name()=$Origin-attr]) and /SystemDefinition/@name!=''">
-				<xsl:attribute name="{$Origin-attr}">	<!-- indicate which model this came from -->
-					<xsl:value-of select="/SystemDefinition/@name"/>
-				</xsl:attribute>
-			</xsl:if>
-			<xsl:apply-templates select="$extra-files" mode="merge-attributes">
-				<xsl:with-param name="cmp" select="."/>			
-			</xsl:apply-templates>
-			<xsl:call-template name="abbrev"/>	
-			<xsl:apply-templates select="$extra-files" mode="merge-content">
-				<xsl:with-param name="cmp" select="."/>
-			</xsl:apply-templates>
-			<xsl:apply-templates select="*" mode="merge">
-				<xsl:with-param name="extra-files" select="$extra-files"/>
-			</xsl:apply-templates>	 
-		</xsl:copy>
-	</xsl:if>
-</xsl:template>
-
-
-<xsl:template match="component/*" mode="merge"><xsl:param name="extra-files"/>
-<xsl:variable name="e"><xsl:call-template name="is-present"/></xsl:variable>
-<xsl:if test="$e!=''">
-		<xsl:copy><xsl:copy-of select="@*"/> <!-- only put root attribute on units with a path in them - does not make sense otherwise -->
-		<xsl:if test="not(@root) and (@mrp or @bldFile)"><xsl:copy-of select="$extra-files[name()='root']"/></xsl:if>
-		<xsl:copy-of select="node()"/>
-	</xsl:copy>
-	</xsl:if>
-</xsl:template>
-
-<xsl:template name="abbrev">
-	<xsl:variable name="n" select="@name"/>
-	<xsl:variable name="match" select="$abbrevs[@name=$n]"/>
-	<xsl:choose>
-		<xsl:when test="not($match)"/>
-		<xsl:when test="self::techstream">
-			<xsl:attribute name="label"><xsl:value-of select="$match/@abbrev"/></xsl:attribute>
-		</xsl:when>
-	<!-- 	<xsl:when test="self::component">
-			<name><xsl:copy-of select="$match/@font|$match/../@font"/><xsl:value-of select="$match/@abbrev"/></name>
-		</xsl:when>-->
-		<xsl:otherwise><xsl:copy-of select="$match/@abbrev|$match/@font|$match/../@font"/></xsl:otherwise>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template name="location">
-	<xsl:if test="../../@name"><xsl:for-each select="parent::*[@name]"><xsl:call-template name="location"/>/</xsl:for-each></xsl:if>
-	<xsl:if test="../@name"><xsl:value-of select="../@name"/></xsl:if>
-</xsl:template>
-
-<xsl:template match="Executable">
-	<Bin><xsl:copy-of select="@*[name()!='component']|*"/></Bin>
-</xsl:template>
-
-<!-- /merge model with extra -->
-
-<!-- merge logo -->
-<xsl:template match="layout/logo" mode="merge">
-	<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:template>
-
-<!-- merge legend -->
-<xsl:template match="layout/legend" mode="merge">
-	<legend-layer><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>	
-	<!-- only draw footer items if they are not referenced elsewhere in a label -->
-		<xsl:variable name="footer">
-			<xsl:for-each select="/model/@copyright|/model/@distribution">
-				<xsl:variable name="a" select="concat('@',name())"/>
-				<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:attribute name="footer"><xsl:value-of select="normalize-space($footer)"/></xsl:attribute></xsl:if>
-		<xsl:apply-templates select="*" mode="merge"/>
-	</legend-layer>
-</xsl:template>
-
-<xsl:template match="legend" mode="merge">
-	<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="merge"/>
-	</xsl:copy>
-</xsl:template>
-
-<xsl:template match="legend/note|legend/s:svg" mode="merge">
-	<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="cmp" mode="merge"><xsl:param name="model"/>
-	<xsl:copy>
-		<xsl:apply-templates select="@*" mode="generated-value">
-			<xsl:with-param name="model" select="$model"/>		
-		</xsl:apply-templates>
-		<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:copy-of select="text()"/>
-	</xsl:copy>
-</xsl:template>
-
-<!--not sure if this bit is actually used anywhere -->
-<xsl:template match="@*" mode="generated-value"/>
-<xsl:template match="@overlay|@border|@style" mode="generated-value">
-	<xsl:variable name="n" select="name()"/>
-	<xsl:variable name="v" select="."/>
-	<xsl:variable name="m" select="//*[name()=$n and @label=$v]"/>
-	<xsl:if test="count($m)">
-		<xsl:attribute name="generator-{$n}">
-			<xsl:apply-templates select="$m" mode="style-id"/>
-		</xsl:attribute>
-	</xsl:if>
-</xsl:template>
-<!--not sure if this bit is actually used anywhere -->
-<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:when test="//colors[not(*) and @match='@ts']">
-			<xsl:variable name="id"><xsl:apply-templates select="//colors[not(*) and @match='@ts']" mode="style-id"/></xsl:variable>
-			<xsl:for-each select="document($model/@ts)//techstream[@name=$v]">
-				<xsl:attribute name="generator-color"><xsl:value-of select="concat($id,'-color',count(preceding::techstream))"/></xsl:attribute>
-			</xsl:for-each>
-		</xsl:when>
-	</xsl:choose>
-</xsl:template>
-
-<xsl:template match="title" mode="merge"><xsl:copy-of select="."/></xsl:template>
-<xsl:template match="ts" mode="merge"><cbox><xsl:copy-of select="@*|node()"/></cbox></xsl:template>
-
-<xsl:template match="legend[s:g]" mode="merge">
-<xsl:copy-of select="."/>
-</xsl:template>
-
-<xsl:template match="legend" mode="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="merge">
-	
-	<!-- 	$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]">
-				<legend>
-					<xsl:apply-templates select="$this" mode="copy"/>
-					<xsl:apply-templates select="." mode="merge">
-						<xsl:with-param name="model" select="$model"/>
-						<xsl:with-param name="legend" select="$legend"/>
-					</xsl:apply-templates>
-				</legend>
-			</xsl:for-each>
-		</xsl:when>
-		<xsl:when test="$tag!=''">
-			<xsl:for-each select="document($file,/)/*/*[name()=$tag]">
-				<legend>
-					<xsl:apply-templates select="$this" mode="copy"/>
-					<xsl:apply-templates select="." mode="merge">
-						<xsl:with-param name="model" select="$model"/>
-						<xsl:with-param name="legend" select="$legend"/>
-					</xsl:apply-templates>
-				</legend>			
-			</xsl:for-each>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:for-each select="document($file,/)/*">
-				<legend>
-					<xsl:apply-templates select="$this" mode="copy"/>
-					<xsl:apply-templates select="." mode="merge">
-						<xsl:with-param name="model" select="$model"/>
-						<xsl:with-param name="legend" select="$legend"/>
-					</xsl:apply-templates>
-				</legend>			
-			</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="merge">
-	<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="merge"/>
-
-<!-- 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="ref" priority="1"><xsl:value-of select="@type"/></xsl:template>
-
-<!-- Borders in legend -->
-
-<xsl:template match="border" mode="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>
-
-<xsl:template match="color[../@type='highlight' or ../@type='text-highlight']" mode="ref">
-	<xsl:value-of select="concat('#',../@type,count(preceding::color[../@type]))"/>
-</xsl:template>
-
-<!-- Colours in legend -->
-
-<xsl:template match="/shapes/colors/color[not(@value|@label)]" mode="merge" 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="merge"><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="merge">
-					<xsl:sort select="@label"/>
-					<xsl:with-param name="model" select="$model"/>
-				</xsl:apply-templates>
-			</xsl:when>
-			<xsl:otherwise>
-				<xsl:apply-templates mode="merge"><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="merge">
-	<xsl:variable name="tag" select="name()"/>
-
-	
-	<xsl:choose>
-		<xsl:when test="count(//*[name()=$tag]) != 1">
-			<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>
-			</legend>
-		</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="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="merge"/> <!--  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="examples/cmp" mode="merge"><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="merge"><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>
-
-<!-- /merge legend -->
-
-<!-- new experimetal 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="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="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/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}" detail="component">
-		<xsl:copy-of select="@type | @show-unused"/>
-		<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 match="/shapes/colors[not(@type) or @type='background']" mode="styling"><xsl:param name="model"/>
-	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
-	<group type="color" style-id="{$id}">
-		<xsl:copy-of select="@default"/>
-		<xsl:call-template name="lgd-group-detail"/>
-		<xsl:apply-templates select="@label"  mode="legend-abbrev"/>			
-		<xsl:choose>
-		<xsl:when test="not(*) and @match='@ts' and $model">
-			<xsl:apply-templates select="document($model/@ts,$model)/*" mode="styling">
-				<xsl:with-param name="id" select="$id"/>
-			</xsl:apply-templates>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:apply-templates mode="styling"><xsl:with-param name="id" select="$id"/></xsl:apply-templates>
-		</xsl:otherwise>
-		</xsl:choose>
-	</group>
-</xsl:template>
-
-<xsl:template name="lgd-group-detail">
-	<xsl:choose>
-		<xsl:when test="self::borders or self::patterns or  not(@match)"><xsl:attribute name="detail">component</xsl:attribute></xsl:when>
-		<xsl:when test="@match='component' or @match='collection' or @match='block' or @match='subblock' or @match='layer'">
-			<xsl:attribute name="detail"><xsl:value-of select="@match"/></xsl:attribute>
-		</xsl:when>
-	</xsl:choose>
-</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="/shapes/colors[@type='highlight' or @type='text-highlight']" mode="styling"><xsl:param name="model"/>
-	<xsl:variable name="id"><xsl:apply-templates select="." mode="style-id"/></xsl:variable>
-	<group type="{@type}" style-id="{$id}">
-		<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/borders|/shapes/patterns|/shapes/styles" 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: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,'{')">
-			<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="ref"/></xsl:otherwise>
-			</xsl:choose>
-		</xsl:attribute>
-	</xsl:element>
-</xsl:template>
-
-<xsl:template match="/techstreams" mode="styling">
-	<xsl:param name="id"/>
-	<xsl:for-each select="//techstream">
-		<cbox value="{@color}" lookup="{@name}" style-id="{$id}-color{count(preceding::techstream)}" detail="component">
-			<xsl:variable name="n" select="@name"/>
-			<xsl:variable name="match" select="$abbrevs[@name=$n]"/>
-			<xsl:if test="$match">
-				<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:if>
-		</cbox>
-	</xsl:for-each>
-</xsl:template>
-
-<!-- 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:include href="draw.xsl"/>
-</xsl:stylesheet>
--- a/sysmodellibs/sysmodelgen/src/svg/ModelTemplate.mid.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<model name="___NAME___" label="___LABEL___"
-	___OPTIONAL___
-	 shapes="___SHAPES_XML___" >
-	 ___SYSTEM_DEFINITIONS___
-	 ___FILTERS___
-	 ___IGNORE___
-<layout___LAYOUT_OPTIONS___>
-	<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>
-	___DISPLAY___
-	<legend label="Key"___LEGEND_OPTIONS___>
-	___LEGEND___
-	</legend>
-</layout>
-</model>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/src/svg/ModelTemplate.older.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<model name="___NAME___" label="___LABEL___"
-	___OPTIONAL___
-	 shapes="___SHAPES_XML___" >
-	 ___SYSTEM_DEFINITIONS___
-	 ___FILTERS___
-	 ___IGNORE___
-<layout___LAYOUT_OPTIONS___>
-	<display name="UI Framework" align="right"/>
-	<display name="Application Services" align="left"/>
-	___DISPLAY___
-	<legend label="Key"___LEGEND_OPTIONS___>
-	___LEGEND___
-	</legend>
-</layout>
-</model>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/src/svg/ModelTemplate.xml	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<model name="___NAME___" label="___LABEL___"
-	___OPTIONAL___
-	 shapes="___SHAPES_XML___" >
-	 ___SYSTEM_DEFINITIONS___
-	 ___FILTERS___
-	 ___IGNORE___
-<layout___LAYOUT_OPTIONS___>
-	<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>
-	___DISPLAY___
-	<legend label="Key"___LEGEND_OPTIONS___>
-	___LEGEND___
-	</legend>
-</layout>
-</model>
\ No newline at end of file
--- a/sysmodellibs/sysmodelgen/src/svg/Overlay.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,331 +0,0 @@
-<?xml version="1.0"?>
-
-<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:doc="tooldoc"  xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-	<xsl:output method="xml"/>
-	<xsl:param name="Data" doc:desc="The data to be overlayed onto the SVG mode"/>
-	<xsl:param name="Prefix" doc:desc="The prefix for the ID, in case the plain ID is already taken"><xsl:apply-templates select="/" mode="my-prefix"/></xsl:param>
-	<xsl:param name="Event" doc:desc="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:apply-templates select="/" mode="my-event"/></xsl:param>
-	 <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-prefix"/>	<!-- no 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"/>1</xsl:template> <!-- always present by default -->
-
-<xsl:template match="/" mode="my-valid-items">component collection block subblock 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]" 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='block' or @class='subblock' 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="@class='component'"><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="@class='component'"><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="@class='component'"><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
--- a/sysmodellibs/sysmodelgen/src/svg/Postprocess.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,321 +0,0 @@
-<?xml version="1.0"?>
-
-<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:doc="tooldoc"  xmlns:s="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-	<xsl:import href="overlay.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|subblock|block" use="translate(@name,' ','')"/>
-
-<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>
-			<xsl:when test="not(/SystemDefinition/systemModel/@detail-type='fixed')"><xsl:if test="self::component">1</xsl:if></xsl:when>  
-			<xsl:when test="name()=/SystemDefinition/systemModel/@detail">1</xsl:when>
-			<xsl:when test="/SystemDefinition/systemModel/@detail='subblock' and self::block and not(subblock)">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" dominant-baseline="mathematical" class="label" x="3" y="3" width="5">Uses</s:text>
-	<s:text text-anchor="end" dominant-baseline="mathematical" 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"/>
- </xsl:template>
-
-<xsl:template match="*" mode="my-defs">
-	<xsl:variable name="width">
-			<xsl:choose>
-			<xsl:when test="/SystemDefinition/systemModel/@detail='layer'">4.8</xsl:when>
-			<xsl:when test="/SystemDefinition/systemModel/@detail='block'">2.4</xsl:when>
-			<xsl:when test="/SystemDefinition/systemModel/@detail='subblock'">1.2</xsl:when>
-			<xsl:when test="/SystemDefinition/systemModel/@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: <xsl:value-of select="$width"/>px;
-	}
-	path.arrowF {
-		marker-start: url(#TriangleF);
-		fill:none;stroke: blue;
-		stroke-width: <xsl:value-of select="$width"/>px;		
-	}
-</s:style>
-  </s:defs>
-</xsl:template>
-
-
-<xsl:template match="component|collection|block|subblock|layer" mode="id"><xsl:value-of select="translate(@name,' ','')"/></xsl:template>
-<xsl:template mode="owner" match="dep">
-	<xsl:for-each select="key('Using',@name)">
-		<xsl:choose>
-			<xsl:when test="/SystemDefinition/systemModel/@detail='layer'"><xsl:apply-templates select="ancestor::layer" mode="id"/></xsl:when>
-			<xsl:when test="/SystemDefinition/systemModel/@detail='block'"><xsl:apply-templates select="ancestor::block" mode="id"/></xsl:when>
-			<xsl:when test="/SystemDefinition/systemModel/@detail='subblock' and ancestor::subblock"><xsl:apply-templates select="ancestor::subblock" mode="id"/></xsl:when>
-			<xsl:when test="/SystemDefinition/systemModel/@detail='subblock'"><xsl:apply-templates select="ancestor::block" mode="id"/></xsl:when>
-			<xsl:when test="/SystemDefinition/systemModel/@detail='collection'"><xsl:apply-templates select="../../.." mode="id"/></xsl:when>
-			<xsl:otherwise><xsl:apply-templates select="../.." mode="id"/></xsl:otherwise>
-		</xsl:choose>
-	<xsl:text> </xsl:text>
-	</xsl:for-each>
-</xsl:template>
-
- <xsl:template match="/SystemDefinition" mode="deps"><xsl:param name="id"/>
- 	<xsl:for-each select="key('Id',$id)/descendant-or-self::component/Build/Bin/dep">
-		<xsl:apply-templates select="." mode="owner"/>
-	</xsl:for-each>
- </xsl:template>
- 
- <xsl:template match="/SystemDefinition" mode="used"><xsl:param name="id"/>
-	<xsl:for-each select="key('Id',$id)/descendant-or-self::component/Build/Bin">
-		<xsl:for-each select="key('Used-by',@name)/../../..">
-			<xsl:choose>
-				<xsl:when test="/SystemDefinition/systemModel/@detail='layer'"><xsl:apply-templates select="ancestor::layer" mode="id"/></xsl:when>
-				<xsl:when test="/SystemDefinition/systemModel/@detail='block'"><xsl:apply-templates select="ancestor::block" mode="id"/></xsl:when>
-				<xsl:when test="/SystemDefinition/systemModel/@detail='subblock' and ancestor::subblock"><xsl:apply-templates select="ancestor::subblock" mode="id"/></xsl:when>
-				<xsl:when test="/SystemDefinition/systemModel/@detail='subblock'"><xsl:apply-templates select="ancestor::block" mode="id"/></xsl:when>
-				<xsl:when test="/SystemDefinition/systemModel/@detail='collection'"><xsl:apply-templates select=".." mode="id"/></xsl:when>
-				<xsl:otherwise><xsl:apply-templates select="." mode="id"/></xsl:otherwise>
-			</xsl:choose>
-			<xsl:text> </xsl:text>
-		</xsl:for-each>
-	</xsl:for-each>
- </xsl:template>
- 
- 
- 
- <xsl:template match="s:g" mode="my-overlay"><xsl:param name="id"/>
-	<xsl:variable name="libs">	
-		<xsl:apply-templates select="document($Data,/)/*" mode="deps">
-			<xsl:with-param name="id" select="$id"/>		
-		</xsl:apply-templates>
-	</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:if test="$libs!=''">
-		<xsl:call-template name="lines">
-			<xsl:with-param name="origin" select="$pos"/>
-			<xsl:with-param name="from" select="$id"/>
-			<xsl:with-param name="height" select="$h"/>
-			<xsl:with-param name="list" select="$libs"/>
-			<xsl:with-param name="class" select="'arrow'"/>
-		</xsl:call-template>
-	</xsl:if>
-	<xsl:variable name="used">	
-		<xsl:apply-templates select="document($Data,/)/*" mode="used">
-			<xsl:with-param name="id" select="$id"/>		
-		</xsl:apply-templates>
-	</xsl:variable>		
-	<xsl:if test="$used!=''">
-		<xsl:call-template name="lines">
-			<xsl:with-param name="origin" select="$pos"/>
-			<xsl:with-param name="from" select="$id"/>
-			<xsl:with-param name="height" select="$h"/>
-			<xsl:with-param name="list" select="$used"/>
-			<xsl:with-param name="class" select="'arrowF'"/>
-		</xsl:call-template>
-	</xsl:if>
- </xsl:template>
- 
-<!-- drawing lines follows -->
-
-<xsl:template name="lines"><xsl:param name="list"/><xsl:param name="from"/><xsl:param name="height"/><xsl:param name="origin"/><xsl:param name="class"/>
-	<xsl:variable name="id" select="substring-before($list,' ')"/>
-	<xsl:variable name="next"><xsl:value-of select="substring-after($list,' ')"/></xsl:variable>	
-	<xsl:if test="not(contains(concat(' ',$next),concat(' ',$id,' '))) and $id!=$from and $id!=''">
-		<xsl:call-template name="draw-line">
-			<xsl:with-param name="class" select="$class"/>
-			<xsl:with-param name="h0" select="$height"/>
-			<xsl:with-param name="origin" select="$origin"/>
-			<xsl:with-param name="end"><xsl:apply-templates select="key('id',$id)" mode="item-pos"/></xsl:with-param>
-			<xsl:with-param name="h1"><xsl:apply-templates select="key('id',$id)" mode="height"/></xsl:with-param>
-		</xsl:call-template>
-	</xsl:if>
-	<xsl:if test="$next!=''"><xsl:call-template name="lines">
-		<xsl:with-param name="list" select="$next"/>
-		<xsl:with-param name="origin" select="$origin"/>
-		<xsl:with-param name="height" select="$height"/>
-		<xsl:with-param name="from" select="$from"/>		
-		<xsl:with-param name="class" select="$class"/>		
-	</xsl:call-template></xsl:if>	
-</xsl:template>
-
- 
- <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: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: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: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* $Size)) or ($dy &lt;= 0 and ($dx * $h0 &gt;= -$dy* $Size)))">
-							<!-- crop against E side of origin  -->
-							<xsl:variable name="y-off" select="$Size * 0.5 * $dy div $dx "/>
-							<xsl:value-of select="concat($x0 + 0.5 * $Size,',',$y0 + $y-off)"/>
-						</xsl:when>	
-						<xsl:when test="$dy &gt; 0 and (($dx &gt;= 0 and $dx * $h0 &lt; $dy * $Size) or ($dx &lt;= 0 and -$dx * $h0 &lt; $dy* $Size))"> <!-- 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* $Size) or ($dx &lt;= 0 and -$dx * $h0 &lt; -$dy* $Size))">
-							<!-- 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=" - $Size * 0.5 * $dy div $dx "/>
-							 <xsl:value-of select="concat($x0 - 0.5 * $Size,',',$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* $Size)) or ($dy &lt;= 0 and ($dx * $h1 &gt;= -$dy* $Size)))">
-							<!-- crop against W side of end  -->
-							<xsl:value-of select="concat($x1 - 0.5 * $Size,',',$y0 + ($dx - 0.5 * $Size) * $dy div $dx)"/>
-						</xsl:when>	
-						<xsl:when test="$dy &gt; 0 and (($dx &gt;= 0 and $dx * $h1 &lt; $dy * $Size) or ($dx &lt;= 0 and -$dx * $h1 &lt; $dy* $Size))"> <!-- 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* $Size) or ($dx &lt;= 0 and -$dx * $h1 &lt; -$dy* $Size))">
-							<!-- 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 * $Size,',',$y0 + ($dx + 0.5 * $Size) * $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: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 * $Size * $Size 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:value-of select="concat(($dx   -  $x-off * 2) div 3 , ', ', $peak,' ',$dx  -  $x-off * 2 ,',', 2 * $peak, ' ',$dx -  $x-off * 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: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*$Size)"/></xsl:when>
-		<xsl:otherwise><xsl:value-of select="$x0 - (0.5*$Size)"/></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 * $Size + ($sgn * $dy div 8))"/></xsl:when>
-			<xsl:otherwise><xsl:value-of select="- $sgn * (0.5 * $Size + ($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
--- a/sysmodellibs/sysmodelgen/src/svg/Shapes.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,834 +0,0 @@
-<?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" xmlns:doc="tooldoc">
-  	<xsl:output method="xml" indent="yes"/>
-	<xsl:param name="Model-Transform" select="'model.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 match="/model"> 
-	<a:stylesheet version="1.0" exclude-result-prefixes="doc 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 -->
-				<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 -->
-			<!-- 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 -->
-				<a:template match="component[not(@generator-overlay)]|cmp[not(@generator-overlay)]" mode="shape">
-					<xsl:if test="not(starts-with(.,'#'))">#Pattern</xsl:if>
-					<xsl:value-of select="."/>
-				</a:template>
-			</xsl:for-each>
-		</xsl:if>
-
-		<xsl:if test="$color">
-			<xsl:for-each select="document($color/@href,$color)/values/@default">
-				<a:template match="component[not(@generator-color|generator-color)] | cmp[not(@generator-color|generator-color)]" mode="display-style-color">
-					<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 more default styles -->
-		</xsl:if>
-		
-		<xsl:if test="not(document(@shapes)/shapes/patterns)">
-		<a:template match="component|cmp" mode="overlay-style" priority="-1">fill: none; stroke: none; stroke-width: 0;</a:template>
-			 <!-- no rule-based patterns -->
-		</xsl:if>
-		
-	
-	<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>
-
-		 <!-- 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(/*/systemModel) and @label"><a:value-of select="@label"/></a:if>
-		<a:if test="not(/*/systemModel) 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="/*/systemModel">
-			<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')]">
-						<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-eval" match="*"><xsl:param name="abbrevs"/>
-	<a:when>
-		<xsl:attribute name="test">$id='<xsl:apply-templates select="." mode="style-id"/>'</xsl:attribute>
-		<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>
-	</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]"/>
-	<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 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:when test="self::colors[@match='@ts']">
-					<a:key name="use-{$id}" match="component" use="@ts"/>
-				</xsl:when>
-			</xsl:choose>
-		</xsl:if>
-	</xsl:for-each>
-
-	<xsl:if test="not($borders)"> <!-- borders must be defined in the shapes.xml -->
-		<xsl:apply-templates select="borders"/>
-	</xsl:if>
-
-	<xsl:choose> <!-- only background colours can be defined in $color -->
-		<xsl:when test="not($color)">
-			<xsl:apply-templates select="colors"/>
-		</xsl:when>
-		<xsl:otherwise>
-			<xsl:apply-templates select="colors[@type and @type!='background']"/>
-		</xsl:otherwise>
-	</xsl:choose>
-
-	<xsl:if test="not($overlay)">
-		<xsl:apply-templates select="patterns"/>
-	</xsl:if>
-
-
-<!-- concatenate all default styles for legend items -->
-  <a:template match="cmp[not(@generated-style) and not(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"/>
-	
-	<!-- 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') 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: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>
-
-<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="replace-function"><xsl:param name="text" select="."/>
-	<xsl:param name="function" select="'VERSION'"/>
-	<xsl:param name="before">string-length(substring-before(concat(' ',$Versions,' '),(</xsl:param>
-	<xsl:param name="after">)))</xsl:param>
-	<xsl:param name="default">/SystemDefinition/systemModel/@ver</xsl:param>
-	<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" select="substring($r,1,$len)"/>
-				<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="$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: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:call-template>
-	</xsl:variable>
-	<xsl:variable name="fixed">
-		<xsl:call-template name="replace-function">
-			<xsl:with-param name="text" select="$fixed1"/>
-			<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:call-template>
-	</xsl:variable>
-	<!--  this next bit is deprecated: remove soon -->
-	<xsl:choose>
-		<xsl:when test="contains($fixed,'$variable')">
-			<xsl:value-of select="substring-before($fixed,'$variable')"/>$<xsl:apply-templates select=".." mode="varname"/>
-			<xsl:apply-templates select="."><xsl:with-param name="text" select="substring-after($fixed,'$variable')"/></xsl:apply-templates>
-		</xsl:when>
-		<xsl:otherwise><xsl:value-of select="$fixed"/></xsl:otherwise>
-	</xsl:choose>
-</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:param name="use" select="@use"/>
-  <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 or (not(*) and @match='@ts')">
-<!--    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>
-			<xsl:variable name="use">
-				<xsl:choose>
-					<xsl:when test="not(*) and @match='@ts'"><!-- ts hack -->
-						<xsl:value-of select="@match" />
-					</xsl:when>
-					<xsl:otherwise><xsl:value-of select="@use"/></xsl:otherwise>
-	 			</xsl:choose>
-			</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:when test="not(*) and @match='@ts'">
-                  <xsl:call-template name="color-select">
-                    <xsl:with-param name="default" select="$default-color"/>
-                    <xsl:with-param name="use" select="@match"/>
-                  </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($Static)">
-		<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-style">
-	 	<xsl:call-template name="match-syntax"/>
-		<xsl:call-template name="declare-vars"/>	
-		<a:variable name="fill">
-			<a:choose>
-				<xsl:for-each select="overlay">
-					<a:when>
-						<xsl:attribute name="test">
-							<xsl:apply-templates select="." mode="when-test"/>
-						</xsl:attribute>url(#<xsl:apply-templates mode="id" select="."/>)</a:when>
-				</xsl:for-each>
-			</a:choose>
-		</a:variable>
-
-		<a:if test="$fill !='' ">
-			<a:text>fill:</a:text>
-			<a:value-of select="$fill"/>
-			<a:text>; stroke: none; stroke-width: 0;</a:text>
-		</a:if>
-	</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) or @match='@ts'"><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'"><xsl:attribute name="match">block</xsl:attribute></xsl:when>
-			<xsl:when test="@match='logicalsubset'"><xsl:attribute name="match">subblock</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="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
--- a/sysmodellibs/sysmodelgen/src/svg/output-csv.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-<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,block,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">module,layer,block,subblock,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)">Module,Layer,Block,Sub-block,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/@* | //block/@*| //subblock/@*| //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="@name" 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" 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::*[self::block or self::subblock][1]" mode="name"/></when>
-		<when test="$a='layer'"><apply-templates select="ancestor::layer" mode="name"/></when>
-		<when test="$a='block'"><apply-templates select="ancestor::block" mode="name"/></when>
-		<when test="$a='subblock'"><apply-templates select="ancestor::subblock" 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'">"<value-of select="ancestor-or-self::*/@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::block/@levels"/>"</when>
-		<when test="$a='layer-levels'">"<value-of select="ancestor-or-self::layer/@levels"/>"</when>
-		<when test="$a='block-level'"><value-of select="ancestor-or-self::block/@level"/></when>
-		<when test="$a='long-name'"><apply-templates mode="name" select="@long-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::subblock/@*[name()=$a]"><apply-templates select="ancestor::subblock/@*[name()=$a]" mode="name"/></when>
-		<when test="ancestor::block/@*[name()=$a]"><apply-templates select="ancestor::block/@*[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>
--- a/sysmodellibs/sysmodelgen/src/svg/output-sysdef.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<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:template match="component|component/*">
-	<xsl:copy>
-		<xsl:apply-templates select="@*|node()"/>
-	</xsl:copy>
-</xsl:template>
-
-<xsl:template match="component/*/* | @*"> <!-- no rules, so just copy -->
-	<xsl:copy-of select="."/>
-</xsl:template>
-
-<xsl:template match="@mrp|@bldFile">
-	<xsl:attribute name="{name()}">
-		<xsl:value-of select="translate(.,'\','/')"/>
-	</xsl:attribute>
-</xsl:template>
-
-<xsl:template match="@schema[starts-with(.,'1.')]">
-	<xsl:attribute name="{name()}">2.0.0</xsl:attribute> <!-- upgrade syntax -->
-</xsl:template>
-
-<xsl:template match="@abbrev|@generator-border|@generator-overlay|@align"/>
-
-<xsl:template match="generator-color|generator-style|component/text()" priority="1"/>
-
-<xsl:template match="layer|block|subblock|collection">
-	<xsl:copy>
-		<xsl:apply-templates select="@*"/>
-		<xsl:apply-templates select="*"/>
-	</xsl:copy>
-</xsl:template>
-
-<xsl:template match="SystemDefinition">
-	<xsl:copy>
-		<xsl:apply-templates select="@name|@schema"/>
-		<xsl:apply-templates select="systemModel"/>
-	</xsl:copy>
-</xsl:template>
-
-<xsl:template match="systemModel">
-	<xsl:copy><xsl:apply-templates select="layer"/></xsl:copy>
-</xsl:template>
-
-
-</xsl:stylesheet>
--- a/sysmodellibs/sysmodelgen/src/svg/validate-raw.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-<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|block|subblock|layer" use="@name"/>
-
-<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(@name)">
-Note: missing System Definition name</if>
-<for-each select="systemModel//*[@name]">
-	<if test="count(key('name',@name)) &gt; 1">
-ERROR: duplicate name for <value-of select="name()"/> "<value-of select="@name"/>" (<value-of select="count(key('name',@name))"/>)	<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">subblock</with-param></call-template>
-<call-template name="extra-atts"><with-param name="item">block</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 | block/@level | block/@span | layer/@span| layer/@levels | block/@levels | @name |component/@filter |component/@contract |component/@deprecated |component/@class |component/@introduced |component/@plugin" mode="extra"/>
-
-
-<template match="/SystemDefinition/@schema">
-<choose>
-	<when test="starts-with(.,'2.')"/>
-	<when test="starts-with(.,'1.')">
-WARNING: 1.x syntax checking not fully supported</when>
-<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/block|block/subblock|layer/collection| block/collection| subblock/collection|collection/component">
-	<apply-templates select="@*|node()"/>
-</template>
-
-
-<template match="layer|block|subblock|collection|component" priority="-3">
-ERROR: &lt;<value-of select="name()"/> name="<value-of select="@name"/>"&gt; cannot be a child of &lt;<value-of select="name(..)"/>&gt;</template>
-
-
-
-<template match="block/@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="../@name"/>" (<value-of select="../../@levels"/>)</if>
-</template>
-
-<template match="collection/@level">
-<choose>
-	<when test="ancestor::block/@levels">
-		<if test="not(contains(concat(' ',normalize-space(ancestor::block/@levels), ' '),concat(' ',normalize-space(.), ' ')))">
-ERROR: Invalid level name "<value-of select="."/>" on <value-of select="name(..)"/> "<value-of select="../@name"/>" (<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="../@name"/>" (<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="../@name"/>"&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 |block/@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">
-	<apply-templates select="@*|node()"/>
-</template>
-
-<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(../*)">
-ERROR: multiple units must have "version" or "filter" attributes (<value-of select="../@name"/>)</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::block or self::subblock or self::collection) and @name]">[<value-of select="substring(name(),1,1)"/>] <value-of select="@name"/>
-	<if test="position()=1"> / </if>
-</for-each>
-</template>
-</stylesheet>
--- a/sysmodellibs/sysmodelgen/src/svg/validate.xsl	Tue Aug 10 14:29:28 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-<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/release|SystemDefinition/styling|systemModel/legend-layer|systemModel/layer-group"/> <!-- in generated file -->
-
-<template match="generator-color|generator-style"/> <!-- in generated file -->
-
-<template match="systemModel/@*"/> <!-- any attributes ok-->
-
-
-<template match="component/@* | collection/@* | block/@* | subblock/@* | layer/@*" priority="-4"/>
-
-<template match="@abbrev|@align|component/@old_model|@*[starts-with(name(),'generat')]" mode="extra"/>
-
-
-</stylesheet>