thanks for quick replay :)
I need to set x position based on sequence number in group which met criteria. I cant use position() in this case
pseudo code:
if(year = acutal)
//1 element
<react x=0
//2 element
<rect x = 1
else if(year = year -1)
//1 element
<react x= 0
//2 element
<rect x = 1
//2 element
<rect x = 2
else if(year = year+1)
...
structure look like this:
<project type="Migration" name="Test">
<phase end="31.03.2018" type="Deprecated" start="31.03.2015"/>
<phase end="31.12.2013" type="Available" start="01.12.2012"/>
<phase end="30.11.2012" type="Migration" start="01.01.2012"/>
<phase end="30.11.2011" type="PoC" start="01.01.2011"/>
<phase end="31.10.2010" type="Evaluation" start="01.09.2010"/>
<phase end="31.10.2009" type="Migration" start="01.09.2009"/>
</project>
XSL look like
<xsl:template match="phase">
<xsl:choose>
<xsl:when test="$start=$end and date:year($start) = $year">
<polyline points="{$X}, {$Y} {$X+$project-font-size}, {$Y} {$X+$project-font-size * 1.5}, {$Y + $project-font-size * 0.5} {$X+$project-font-size}, {$Y + $project-font-size} {$X}, {$Y + $project-font-size} {$X}, {$Y}" class="phase {./@type}"/>
</xsl:when>
<xsl:when test="(date:year($start) < ($year - 1 )) and (date:year($end) < ($year - 1 ))">
<xsl:variable name="row_number">
//here I need for element 1 have 1, for element 2 value 2 etc - that each next element will be next to prevous
</xsl:variable>
<path class="phase {./@type}" d="m{row_number},{$Y + $project-font-size}.0,0l1.09375,-1.09375l-1.09375,-1.09375l-1.3125,0l1.03125,1.03125l-1.03125,1.15625z" />
</xsl:when>
<xsl:when test="(date:year($start) > ($year + 1 )) and (date:year($end) > ($year + 1 ))">
<path class="phase {./@type}" d="m162.5,{$Y + $project-font-size}.0,0l1.09375,-1.09375l-1.09375,-1.09375l-1.3125,0l1.03125,1.03125l-1.03125,1.15625z" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="W" select="$scale-another-year * ($dayslastyear + $daysnextyear) + $daysthisyear * $scale-this-year"/>
<rect x="{$X}" y="{$Y}" width="{$W}" height="{$project-font-size}" class="phase {./@type}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Last edited by lonas; June 20th, 2012 at 06:22 AM..
|