sysmodellibs/sysmodelgen/extra/dependencies.xsl
changeset 7 3c36c452f013
parent 6 5b32dc297d05
equal deleted inserted replaced
6:5b32dc297d05 7:3c36c452f013
       
     1 <?xml version="1.0"?>
       
     2 <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">
       
     3 	<xsl:import href="postprocess.xsl"/>	
       
     4 	<xsl:output method="xml"/>
       
     5 	<xsl:variable name="Size">
       
     6 		<xsl:choose>
       
     7 			<xsl:when test="/s:svg[substring-after(@class,'-')='fixed' and @class!='component-fixed']">
       
     8 				<xsl:value-of select="//s:g[@class=substring-before(/s:svg/@class,'-')]/s:rect/@width"/>
       
     9 			</xsl:when>
       
    10 			<xsl:otherwise><xsl:value-of select="//s:g[@class='component']/s:use/@width"/></xsl:otherwise>
       
    11 		</xsl:choose>
       
    12 	 </xsl:variable>
       
    13 	<xsl:key name="Using" match="Bin" use="@name"/>
       
    14 	<xsl:key name="Used-by" match="dep" use="@name"/>
       
    15 	<xsl:key name="Id" match="component|collection|package" use="@id"/>
       
    16 	<xsl:variable name="Rank" select="document('')/*/*[@name='RANK']/*"/>
       
    17 
       
    18 <xsl:template name="RANK">
       
    19 <layer rank="0"/>
       
    20 <package rank="1"/>
       
    21 <collection rank="2"/>
       
    22 <component rank="3"/>
       
    23 </xsl:template>
       
    24 	
       
    25 <xsl:template match="/" mode="my-prefix">dep-</xsl:template>
       
    26 <xsl:template match="/SystemDefinition" mode="is-present"><xsl:param name="id"/>
       
    27 	<xsl:for-each select="key('Id',$id)">
       
    28 		<xsl:choose>
       
    29 				<!-- no children and higher than the normal placeholder detail -->
       
    30 			<xsl:when test="count(meta|unit)=count(*) and /SystemDefinition/@placeholder-detail and ($Rank[name()=current()/ancestor::SystemDefinition/@placeholder-detail]/@rank &gt;= $Rank[name()=name(current())]/@rank)">1</xsl:when>
       
    31 			<xsl:when test="not(/SystemDefinition/@detail-type='fixed')"><xsl:if test="self::component">1</xsl:if></xsl:when>  
       
    32 			<xsl:when test="name()=/SystemDefinition/@detail">1</xsl:when>
       
    33 		</xsl:choose>
       
    34 	</xsl:for-each>
       
    35 </xsl:template>
       
    36 
       
    37  <xsl:template match="/" mode="my-legend">
       
    38  	<!-- height="9" width="17" -->
       
    39 	<s:text text-anchor="end" dy="0.375em" class="label" x="3" y="3" width="5">Uses</s:text>
       
    40 	<s:text text-anchor="end" dy="0.375em" class="label" x="3" y="6" width="5">Used by</s:text>
       
    41 	<s:path d="M 4 3 L 14 3" class="arrow" style="stroke-width:0.3!important"/>
       
    42 	<s:path d="M 4 6 L 14 6" class="arrowF" style="stroke-width:0.3!important"/>
       
    43 	
       
    44 	<!-- add at some point:
       
    45 	<text text-anchor="end" dy="0.375em" class="label" x="24" y="1.5" >Binary</text>
       
    46 	<text text-anchor="end" dy="0.375em" class="label" x="24" y="4.5" >API</text>
       
    47 	<text text-anchor="end" dy="0.375em" class="label" x="24" y="7.5" >ECom</text>
       
    48 	<path d="M 26 1.5 L 36 1.5" class="arrow" style="stroke-width:0.3!important"/>
       
    49 	<path d="M 26 4.5 L 36 4.5" class="arrow api" style="stroke-width:0.3!important"/>
       
    50 	<path d="M 26 7.5 L 36 7.5" class="arrow ecom" style="stroke-width:0.3!important"/>
       
    51 		-->
       
    52  </xsl:template>
       
    53 
       
    54 <xsl:template match="*" mode="my-defs">
       
    55 	<xsl:variable name="width">
       
    56 			<xsl:choose>
       
    57 			<xsl:when test="/SystemDefinition/@detail='layer'">4.8</xsl:when>
       
    58 			<xsl:when test="/SystemDefinition/@detail='package'">2.4</xsl:when>
       
    59 			<xsl:when test="/SystemDefinition/@detail='subblock'">1.2</xsl:when>
       
    60 			<xsl:when test="/SystemDefinition/@detail='collection'">0.6</xsl:when>
       
    61 			<xsl:otherwise>0.3</xsl:otherwise>
       
    62 		</xsl:choose>
       
    63 	</xsl:variable>
       
    64     <s:defs>
       
    65     <s:marker id="Triangle"
       
    66       viewBox="-1 -1 7 7" refX="5" refY="2" 
       
    67       markerUnits="strokeWidth"
       
    68       markerWidth="6" markerHeight="6"
       
    69       orient="auto">
       
    70       <s:polygon style="fill:black;stroke:black;" points="0,0 5,2 0,4 0,0"/>
       
    71     </s:marker>
       
    72     <s:marker id="TriangleF"
       
    73       viewBox="-1 -1 7 7" refX="0" refY="2" 
       
    74       markerUnits="strokeWidth"
       
    75       markerWidth="6" markerHeight="6"
       
    76       orient="auto">
       
    77       <s:polygon style="fill:blue;stroke:blue;" points="5,0 5,4 0,2 5,0"/>
       
    78     </s:marker>
       
    79   <s:style type="text/css">
       
    80 	path.arrow {
       
    81 		marker-end: url(#Triangle);
       
    82 		fill:none;stroke: black;
       
    83 		stroke-width: 0.3px;
       
    84 	}
       
    85 	path.arrowF {
       
    86 		marker-start: url(#TriangleF);
       
    87 		fill:none;stroke: blue;
       
    88 		stroke-width: 0.3px;		
       
    89 	}
       
    90 	path.collection  {
       
    91 		stroke-width: 0.6px;	
       
    92 	}
       
    93 	path.package  {
       
    94 		stroke-width: 2.4px;	
       
    95 	}
       
    96 	path.layer  {
       
    97 		stroke-width: 4.8px;	
       
    98 	}
       
    99 	path.api {
       
   100 		stroke-dasharray: 2,1;
       
   101 	}
       
   102 	path.ecom {
       
   103 		stroke-dasharray: 0.1,2;
       
   104 		stroke-linecap: round;
       
   105 	}
       
   106 </s:style>
       
   107   </s:defs>
       
   108 </xsl:template>
       
   109  
       
   110 <xsl:template name="lower-rank"><xsl:param name="e1"/><xsl:param name="e2"/>
       
   111 	<xsl:variable name="rank"> 
       
   112 		<xsl:choose>
       
   113 			<xsl:when test="$Rank[name()=$e1]/@rank &gt; $Rank[name()=$e2]/@rank">
       
   114 				<xsl:value-of select="$e1"/>
       
   115 			</xsl:when>
       
   116 			<xsl:otherwise>
       
   117 				<xsl:value-of select="$e2"/>
       
   118 			</xsl:otherwise>
       
   119 		</xsl:choose>
       
   120 	</xsl:variable>
       
   121 	<xsl:if test="$rank!='component'">
       
   122 		<xsl:value-of select="concat(' ',$rank)"/>
       
   123 	</xsl:if>
       
   124 </xsl:template>
       
   125  
       
   126  <xsl:template match="s:g" mode="my-overlay"><xsl:param name="id"/>
       
   127  	<!--  this is far more hacky than I'd like. Better to use a mechanism like the $used below-->
       
   128 	<xsl:variable name="libs">	<xsl:text> </xsl:text>
       
   129  		<xsl:for-each select="document($Data,/)/*">
       
   130 			<xsl:variable name="detail" select="/SystemDefinition/@detail"/>
       
   131 			<xsl:for-each select="key('Id',$id)/meta[@rel='Dependencies' and (@type='generic' or not(@type))]/dep">
       
   132 				<xsl:variable name="d" select="."/>
       
   133 				<xsl:for-each select="key('Id',@ref)/ancestor-or-self::*[name()=$detail]">
       
   134 					<xsl:value-of select="concat(@id,'&#9;',$d/@type,'&#9;',name(),' ')"/>
       
   135 				</xsl:for-each>
       
   136 				<xsl:for-each select="key('Id',@ref)[not(ancestor-or-self::*[name()=$detail])]">
       
   137 					<xsl:value-of select="concat(@id,'&#9;',$d/@type,'&#9;',name(),' ')"/>
       
   138 				</xsl:for-each>
       
   139 			</xsl:for-each>
       
   140 		</xsl:for-each>
       
   141 	</xsl:variable>
       
   142 	<xsl:variable name="pos">
       
   143 		<xsl:apply-templates select="." mode="item-pos"/>
       
   144 	</xsl:variable>
       
   145 	<xsl:variable name="h">
       
   146 		<xsl:apply-templates select="." mode="height"/>
       
   147 	</xsl:variable>
       
   148 	<xsl:variable name="w">
       
   149 		<xsl:apply-templates select="." mode="item-width"/>
       
   150 	</xsl:variable>
       
   151 	<xsl:variable name="e"><xsl:for-each select="document($Data,/)/*">
       
   152 		<xsl:value-of select="name(key('Id',$id))"/></xsl:for-each>
       
   153 	</xsl:variable>
       
   154 	<xsl:for-each select="//s:g[contains($libs,concat(' ',@id,'&#9;')) and @id!=$id]">
       
   155 		<xsl:variable name="type" select="substring-before(substring-after($libs,concat(' ',@id,'&#9;')),'&#9;')"/>
       
   156 		<xsl:variable name="this" select="substring-before(substring-after(substring-after($libs,concat(' ',@id,'&#9;')),'&#9;'),' ')"/>
       
   157 		<xsl:call-template name="draw-line">
       
   158 			<xsl:with-param name="class">
       
   159 				<xsl:text>arrow</xsl:text>
       
   160 				<xsl:if test="$type!='' and $type!='bin'">
       
   161 					<xsl:value-of select="concat(' ',$type)"/>
       
   162 				</xsl:if>
       
   163 				<xsl:call-template name="lower-rank">
       
   164 					<xsl:with-param name="e1" select="$e"/>
       
   165 					<xsl:with-param name="e2" select="substring-before(substring-after(substring-after($libs,concat(' ',@id,'&#9;')),'&#9;'),' ')"/>
       
   166 				</xsl:call-template>
       
   167 			</xsl:with-param>
       
   168 			<xsl:with-param name="h0" select="$h"/>
       
   169 			<xsl:with-param name="w0" select="$w"/>
       
   170 			<xsl:with-param name="origin" select="$pos"/>
       
   171 			<xsl:with-param name="end"><xsl:apply-templates select="." mode="item-pos"/></xsl:with-param>
       
   172 			<xsl:with-param name="h1"><xsl:apply-templates select="." mode="height"/></xsl:with-param>
       
   173 			<xsl:with-param name="w1"><xsl:apply-templates select="." mode="item-width"/></xsl:with-param>
       
   174 		</xsl:call-template>
       
   175 	</xsl:for-each>	
       
   176 
       
   177 	<xsl:variable name="used" select="document($Data,/)//*[name()=/SystemDefinition/@detail]/meta[@rel='Dependencies' and (@type='generic' or not(@type))]/dep[@ref=$id]"/>
       
   178 	<xsl:for-each select="//s:g[@id=$used/../../@id and @id!=$id]">
       
   179 		<xsl:call-template name="draw-line">
       
   180 			<xsl:with-param name="class">
       
   181 				<xsl:text>arrowF</xsl:text>
       
   182 				<xsl:for-each select="$used[@type and @type!='bin' and ../../@id=current()/@id]">
       
   183 					<xsl:value-of select="concat(' ',@type)"/>  
       
   184 				</xsl:for-each>
       
   185 				<xsl:call-template name="lower-rank">
       
   186 					<xsl:with-param name="e1" select="$e"/>
       
   187 					<xsl:with-param name="e2" select="name($used[../../@id=current()/@id]/../..)"/>
       
   188 				</xsl:call-template>
       
   189 			</xsl:with-param>
       
   190 			<xsl:with-param name="h0" select="$h"/>
       
   191 			<xsl:with-param name="w0" select="$w"/>
       
   192 			<xsl:with-param name="origin" select="$pos"/>
       
   193 			<xsl:with-param name="end"><xsl:apply-templates select="." mode="item-pos"/></xsl:with-param>
       
   194 			<xsl:with-param name="h1"><xsl:apply-templates select="." mode="height"/></xsl:with-param>
       
   195 			<xsl:with-param name="w1"><xsl:apply-templates select="." mode="item-width"/></xsl:with-param>
       
   196 		</xsl:call-template>
       
   197 	</xsl:for-each>	
       
   198 
       
   199  </xsl:template>
       
   200  
       
   201 <!-- drawing lines follows -->
       
   202  
       
   203  <xsl:template name="draw-line"><xsl:param name="origin"/><xsl:param name="end"/><xsl:param name="class"/>
       
   204  	<xsl:param name="h0"/><xsl:param name="h1"/>
       
   205 	<xsl:param name="w0"/><xsl:param name="w1"/>
       
   206  		<xsl:variable name="x0" select="substring-before($origin,',')"/>
       
   207 		<xsl:variable name="y0" select="substring-after($origin,',')"/>
       
   208 		<xsl:variable name="x1" select="substring-before($end,',')"/>
       
   209 		<xsl:variable name="y1" select="substring-after($end,',')"/>
       
   210 		<xsl:variable name="dx" select="$x1 - $x0"/>
       
   211 		<xsl:variable name="dy" select="$y1 - $y0"/>
       
   212 		<xsl:variable name="sgnY" select="($y1 &gt; $y0) * 2 - 1"/>
       
   213 		<xsl:variable name="sgnX" select="($x1 &gt; $x0) * 2 - 1"/>
       
   214 		<xsl:if test="contains(substring-after($origin,','),',')">/<xsl:value-of select="$origin"/>/</xsl:if>
       
   215 
       
   216 		<s:path class="{$class}"><xsl:attribute name="d">
       
   217 			<xsl:choose>
       
   218 				<xsl:when test="$dy=0">
       
   219 					<xsl:call-template name="draw-curve">
       
   220 						<xsl:with-param name="origin" select="$origin"/>
       
   221 						<xsl:with-param name="end" select="$end"/>			
       
   222 						<xsl:with-param name="h0" select="$h0"/>
       
   223 						<xsl:with-param name="h1" select="$h1"/>
       
   224 						<xsl:with-param name="w0" select="$w0"/>
       
   225 						<xsl:with-param name="w1" select="$w1"/>
       
   226 					</xsl:call-template>
       
   227 				</xsl:when>	
       
   228 				<xsl:when test="$dx=0">
       
   229 					<xsl:call-template name="draw-vcurve">
       
   230 						<xsl:with-param name="origin" select="$origin"/>
       
   231 						<xsl:with-param name="end" select="$end"/>
       
   232 						<xsl:with-param name="h0" select="$h0"/>			
       
   233 						<xsl:with-param name="h1" select="$h1"/>															
       
   234 						<xsl:with-param name="w0" select="$w0"/>
       
   235 						<xsl:with-param name="w1" select="$w1"/>
       
   236 					</xsl:call-template>
       
   237 				</xsl:when>	
       
   238 				<xsl:otherwise>
       
   239 					<xsl:text>M</xsl:text>
       
   240 				<xsl:choose>
       
   241 						<xsl:when test="$dx &gt; 0 and (($dy &gt; 0 and ($dx * $h0 &gt;= $dy* $w0)) or ($dy &lt;= 0 and ($dx * $h0 &gt;= -$dy* $w0)))">
       
   242 							<!-- crop against E side of origin  -->
       
   243 							<xsl:variable name="y-off" select="$w0 * 0.5 * $dy div $dx "/>
       
   244 							<xsl:value-of select="concat($x0 + 0.5 * $w0,',',$y0 + $y-off)"/>
       
   245 						</xsl:when>	
       
   246 						<xsl:when test="$dy &gt; 0 and (($dx &gt;= 0 and $dx * $h0 &lt; $dy * $w0) or ($dx &lt;= 0 and -$dx * $h0 &lt; $dy* $w0))"> <!-- and dx < dy  -->
       
   247 							<!-- crop against S side of origin  -->
       
   248 							<xsl:variable name="x-off" select="$h0 * 0.5 * $dx div $dy"/>
       
   249 						 	<xsl:value-of select="concat($x0 +  $x-off, ',' ,$y0 + 0.5 * $h0)"/>
       
   250 						</xsl:when>	
       
   251 						<xsl:when test="$dy &lt; 0 and (($dx &gt;= 0 and $dx * $h0 &lt; -$dy* $w0) or ($dx &lt;= 0 and -$dx * $h0 &lt; -$dy* $w0))">
       
   252 							<!-- crop against N side of origin  -->
       
   253 							<xsl:variable name="x-off" select="- $h0 * 0.5 * $dx div $dy"/>
       
   254 						 	<xsl:value-of select="concat($x0 +  $x-off, ',' ,$y0 - 0.5 * $h0 )"/>
       
   255 						</xsl:when>
       
   256 						<xsl:otherwise>
       
   257 							<!-- crop against W side or origin -->
       
   258 							<xsl:variable name="y-off" select=" - $w0 * 0.5 * $dy div $dx "/>
       
   259 							 <xsl:value-of select="concat($x0 - 0.5 * $w0,',',$y0 + $y-off)"/>
       
   260 						</xsl:otherwise>
       
   261 					</xsl:choose>
       
   262 					<xsl:text>L </xsl:text>
       
   263 					<xsl:choose>
       
   264 						<xsl:when test="$dx &gt; 0 and (($dy &gt; 0 and ($dx * $h1 &gt;= $dy* $w1)) or ($dy &lt;= 0 and ($dx * $h1 &gt;= -$dy* $w1)))">
       
   265 							<!-- crop against W side of end  -->
       
   266 							<xsl:value-of select="concat($x1 - 0.5 * $w1,',',$y0 + ($dx - 0.5 * $w1) * $dy div $dx)"/>
       
   267 						</xsl:when>	
       
   268 						<xsl:when test="$dy &gt; 0 and (($dx &gt;= 0 and $dx * $h1 &lt; $dy * $w1) or ($dx &lt;= 0 and -$dx * $h1 &lt; $dy* $w1))"> <!-- and dx < dy  -->
       
   269 							<!-- crop against N side of end -->
       
   270 							<xsl:value-of select="concat($x0 + ($dy - 0.5 * $h1) * $dx div $dy , ',' , $y1 - 0.5 * $h1)"/>
       
   271 						</xsl:when>	
       
   272 						<xsl:when test="$dy &lt; 0 and (($dx &gt;= 0 and $dx * $h1 &lt; -$dy* $w1) or ($dx &lt;= 0 and -$dx * $h1 &lt; -$dy* $w1))">
       
   273 							<!-- crop against S side of end -->
       
   274 							<xsl:value-of select="concat($x0 + ($dy + 0.5 * $h1) * $dx div $dy , ',' , $y1 + 0.5 * $h1)"/>
       
   275 						</xsl:when>
       
   276 						<xsl:otherwise>
       
   277 							<!-- crop against E side of end -->
       
   278 							<xsl:value-of select="concat($x1 + 0.5 * $w1,',',$y0 + ($dx + 0.5 * $w1) * $dy div $dx)"/>
       
   279 						</xsl:otherwise>
       
   280 					</xsl:choose>
       
   281 				</xsl:otherwise>
       
   282 			</xsl:choose>
       
   283 		</xsl:attribute>
       
   284 	</s:path>
       
   285 </xsl:template>
       
   286 
       
   287  <xsl:template name="draw-curve"><xsl:param name="origin"/><xsl:param name="end"/><xsl:param name="class"/>
       
   288 	  	<xsl:param name="h0"/><xsl:param name="h1"/>
       
   289 	  	<xsl:param name="w0"/><xsl:param name="w1"/>
       
   290 	<xsl:variable name="x0" select="substring-before($origin,',')"/>
       
   291 	<xsl:variable name="y0" select="substring-after($origin,',')"/>
       
   292 	<xsl:variable name="x1" select="substring-before($end,',')"/>
       
   293 	<xsl:variable name="y1" select="substring-after($end,',')"/>
       
   294 	<xsl:variable name="dx" select="$x1 - $x0"/>
       
   295 	<xsl:variable name="up" select="floor($dx) mod 2 != 0"/> <!-- line is above or below componetns -->
       
   296 	<xsl:variable name="sgn" select="($dx &gt; 0 ) * 2  - 1"/>	
       
   297 	<!-- offset the x-coord so that if the components are next to each other the connection is from nearer the edge of the side
       
   298 		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 
       
   299 		(x-off approches zero as length goes to infiniity)-->
       
   300 	<xsl:variable name="x-off" select="0.25 * $sgn * $w0 * $w0 div ($sgn * $dx)"/>	
       
   301 	<xsl:value-of select="concat('M',$x0 +  $x-off,',')"/>
       
   302 	<xsl:choose>
       
   303 		<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>
       
   304 		<xsl:otherwise><xsl:value-of select="$y0 - (0.5*$h0)"/>c</xsl:otherwise>
       
   305 	</xsl:choose>
       
   306 	<xsl:variable name="peak">
       
   307 		<xsl:choose> <!--  don't think i need the 0.5 * h0 -->
       
   308 			<xsl:when test="$up"><xsl:value-of select="$sgn * (0.5 * $h0 + ($sgn * $dx div 8))"/></xsl:when>
       
   309 			<xsl:otherwise><xsl:value-of select="- $sgn * (0.5 * $h0 + ($sgn * $dx div 8))"/></xsl:otherwise>
       
   310 		</xsl:choose>
       
   311 	</xsl:variable>
       
   312 	<xsl:variable name="x-off2" select="0.25 * $sgn * $w1 * $w1 div ($sgn * $dx)"/>	
       
   313 	<xsl:value-of select="concat(($dx   -  $x-off * 2) div 3 , ', ', $peak,' ',$dx  -  $x-off * 2 ,',', 2 * $peak, ' ',$dx -  $x-off2 * 2,',0')"/>
       
   314 </xsl:template>
       
   315 
       
   316  <xsl:template name="draw-vcurve"><xsl:param name="origin"/><xsl:param name="end"/><xsl:param name="class"/>
       
   317 	<xsl:param name="h0"/><xsl:param name="h1"/>
       
   318 	<xsl:param name="w0"/><xsl:param name="w1"/>
       
   319 	<xsl:variable name="x0" select="substring-before($origin,',')"/>
       
   320 	<xsl:variable name="y0" select="substring-after($origin,',')"/>
       
   321 	<xsl:variable name="x1" select="substring-before($end,',')"/>
       
   322 	<xsl:variable name="y1" select="substring-after($end,',')"/>
       
   323 	<xsl:variable name="dy" select="$y1 - $y0"/>
       
   324 	<xsl:variable name="left" select="floor($dy) mod 2 != 0"/> <!-- line is above or below componetns -->
       
   325 	<xsl:variable name="sgn" select="($dy &gt; 0 ) * 2  - 1"/>	
       
   326 	<!-- offset the y-coord so that if the components are next to each other the connection is from nearer the edge of the side
       
   327 		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 
       
   328 		(y-off approches zero as length goes to infiniity)-->
       
   329 	<xsl:variable name="y-off" select="0.25 * $sgn * $h0 * ($h0 +$h1) div ($sgn * $dy)"/>	
       
   330 	
       
   331 	<xsl:text>M</xsl:text>
       
   332 	<xsl:choose>
       
   333 		<xsl:when test="($left and ($y1 &gt; $y0)) or (not($left) and ($y1 &lt; $y0)) "><xsl:value-of select="$x0 + (0.5*$w0)"/></xsl:when>
       
   334 		<xsl:otherwise><xsl:value-of select="$x0 - (0.5*$w0)"/></xsl:otherwise>
       
   335 	</xsl:choose>
       
   336 	<xsl:text>,</xsl:text>
       
   337 	<xsl:value-of select="$y0 +  $y-off"/>
       
   338 	
       
   339 	<xsl:text>c</xsl:text>
       
   340 	<xsl:variable name="y-off1" select="0.25 * $sgn * $h1 * ($h0 +$h1) div ($sgn * $dy)"/>	
       
   341 	<xsl:variable name="peak"><!--  don't think i need the 0.5 * Size -->
       
   342 		<xsl:choose>
       
   343 			<xsl:when test="$left"><xsl:value-of select="$sgn * (0.5 * $w0 + ($sgn * $dy div 8))"/></xsl:when>
       
   344 			<xsl:otherwise><xsl:value-of select="- $sgn * (0.5 * $w0 + ($sgn * $dy div 8))"/></xsl:otherwise>
       
   345 		</xsl:choose>
       
   346 	</xsl:variable>
       
   347 	<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)"/>
       
   348 </xsl:template>
       
   349 
       
   350 </xsl:stylesheet>