Author: hhubner Date: 2006-10-14 02:59:35 -0400 (Sat, 14 Oct 2006) New Revision: 1985
Added: branches/xml-class-rework/projects/bos/statistics/ branches/xml-class-rework/projects/bos/statistics/Makefile branches/xml-class-rework/projects/bos/statistics/buildSVGLineChart.xsl branches/xml-class-rework/projects/bos/statistics/contracts-by-week-2005.svg branches/xml-class-rework/projects/bos/statistics/contracts-by-week-2006.svg branches/xml-class-rework/projects/bos/statistics/contracts-by-week.lxsl branches/xml-class-rework/projects/bos/statistics/contracts-by-week.xml branches/xml-class-rework/projects/bos/statistics/contracts-by-week.xsl branches/xml-class-rework/projects/bos/statistics/loop-compiler.xslt Log: Generate SVG charts from statistical data.
Added: branches/xml-class-rework/projects/bos/statistics/Makefile =================================================================== --- branches/xml-class-rework/projects/bos/statistics/Makefile 2006-09-24 19:13:31 UTC (rev 1984) +++ branches/xml-class-rework/projects/bos/statistics/Makefile 2006-10-14 06:59:35 UTC (rev 1985) @@ -0,0 +1,21 @@ + +BASE_URL = http://192.168.254.132:8080/reports-xml +YEAR = 2005 +LOGIN = ?__username=hans&__password=ognep + +GRAPHICS = contracts-by-week.svg + +all: + $(MAKE) graphics YEAR=2005 + $(MAKE) graphics YEAR=2006 + +graphics: $(GRAPHICS) + +.SUFFIXES: .lxsl .xsl .svg + +.lxsl.xsl: + xsltproc -o $@ loop-compiler.xslt $*.lxsl + +.xsl.svg: + xsltproc -o $*.xml $*.xsl '$(BASE_URL)/$*/$(YEAR)$(LOGIN)' + xsltproc -o $*-$(YEAR).svg buildSVGLineChart.xsl $*.xml \ No newline at end of file
Property changes on: branches/xml-class-rework/projects/bos/statistics/Makefile ___________________________________________________________________ Name: svn:executable + * Name: svn:eol-style + native
Added: branches/xml-class-rework/projects/bos/statistics/buildSVGLineChart.xsl =================================================================== --- branches/xml-class-rework/projects/bos/statistics/buildSVGLineChart.xsl 2006-09-24 19:13:31 UTC (rev 1984) +++ branches/xml-class-rework/projects/bos/statistics/buildSVGLineChart.xsl 2006-10-14 06:59:35 UTC (rev 1985) @@ -0,0 +1,827 @@ +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xlink="http://www.w3.org/2000/xlink/namespace/" + version="1.0"> + <xsl:output omit-xml-declaration="yes"/> + <xsl:template match="/graphData"> + <xsl:variable name="max"> + <xsl:value-of select="maxy"/> + </xsl:variable> + <xsl:variable name="min"> + <xsl:value-of select="miny"/> + </xsl:variable> + <xsl:variable name="maxy2"> + <xsl:value-of select="maxy2"/> + </xsl:variable> + <xsl:variable name="miny2"> + <xsl:value-of select="miny2"/> + </xsl:variable> + <xsl:variable name="maxx"> + <xsl:value-of select="maxx"/> + </xsl:variable> + <xsl:variable name="minx"> + <xsl:value-of select="minx"/> + </xsl:variable> + <svg width="1200" height="1200" onload="getSVGDoc(evt)" onzoom="ZoomControl()"> + <defs> + <g id="star" transform="scale(0.21)"> + <polyline points="48,16,16,96,96,48,0,48,80,96"> + </polyline> + </g> + <g id="triangle" transform="scale(0.7)"> + <path id="Triangle" d="M 0 25 L 10 15 L 20 25 z" style="stroke:none"/> + </g> + <g id="square" transform="scale(1)"> + <rect width="18" height="18"> + </rect> + </g> + <g id="rectangle" transform="scale(1)"> + <rect width="7" height="22"> + </rect> + </g> + <script type="text/javascript"> + <![CDATA[ + /* this code was largely reused from the excellent website SVG - Learning by Coding (http://svglbc.datenverdrahten.de/) */ + var svgdoc,svgroot; + function getSVGDoc(load_evt) + { + svgdoc=load_evt.target.ownerDocument; + svgroot=svgdoc.documentElement; + + texte=svgdoc.getElementById("tooltip").getElementsByTagName("text"); + } + function ShowTooltip(mousemove_event,txt) + { + var ttrelem,tttelem,posx,posy,curtrans,ctx,cty,txt; + var sollbreite,maxbreite,ges,anz,tmp,txl,neu,i,k,l + ttrelem=svgdoc.getElementById("ttr"); + tttelem=svgdoc.getElementById("ttt"); + posx=mousemove_event.clientX; + posy=mousemove_event.clientY; + for(i=1;i<=5;i++)texte.item(i).firstChild.data=""; + sollbreite=150; + tttelem.childNodes.item(0).data=txt; + ges=tttelem.getComputedTextLength(); + tttelem.childNodes.item(0).data=""; + anz=Math.ceil(ges/sollbreite); + tmp=txt.split(" "); + txl=new Array(tmp.length); + neu=new Array(anz); + for(i=0;i<tmp.length;i++) + { + tttelem.childNodes.item(0).data=tmp[i]; + txl[i]=tttelem.getComputedTextLength(); + } + k=0; + maxbreite=0; + for(i=0;i<anz;i++) + { + l=0,neu[i]=""; + while(l+txl[k]<1.1*sollbreite && k<tmp.length) + { + l+=txl[k]; + neu[i]+=tmp[k]+" "; + k++; + if(maxbreite<l)maxbreite=l; + } + } + curtrans=svgroot.currentTranslate; + ctx=curtrans.x; + cty=curtrans.y; + ttrelem.setAttribute("x",posx-ctx+10); + ttrelem.setAttribute("y",posy-cty-20+10); + ttrelem.setAttribute("width",maxbreite+2*(maxbreite-sollbreite)+40); + ttrelem.setAttribute("height",anz*15+3); + ttrelem.setAttribute("style","fill: #FFC; stroke: #000; stroke-width: 0.5px"); + for(i=1;i<=anz;i++) + { + texte.item(i).firstChild.data=neu[i-1]; + texte.item(i).setAttribute("x",posx-ctx+15); + texte.item(i).setAttribute("y",parseInt(i-1)*15+posy-cty+3); + texte.item(i).setAttribute("style","fill: #00C; font-size: 11px"); + } + svgdoc.getElementById("tooltip").style.setProperty("visibility","visible"); + } + function HideTooltip() + { + svgdoc.getElementById("tooltip").style.setProperty("visibility","hidden"); + } + function ZoomControl() + { + var curzoom; + curzoom=svgroot.currentScale; + svgdoc.getElementById("tooltip").setAttribute("transform","scale("+1/curzoom+")"); + } + ]]> + </script> + </defs> + <g transform="translate(150,50) scale(0.5)"> + <!--Heading--> + <text x="5" y="-40" text-anchor="left" font-weight="bolder" + font-size="40" fill="maroon" text-decoration="underline"> + <xsl:value-of select="title"/> + </text> + <!--Caption (Vertical)--> + <g transform="translate(-220, 80) rotate(270, 0, 0)"> + <text x="0" y="0" text-anchor="middle" font-weight="bolder" + font-size="36" fill="black"> + <xsl:value-of select="ytitle"/> + </text> + </g> + <g transform="translate(1220, 80) rotate(90, 0, 0)"> + <text x="0" y="0" text-anchor="middle" font-weight="bolder" + font-size="36" fill="black"> + <xsl:value-of select="y2title"/> + </text> + </g> + <!--Caption (Horizontal)--> + <text x="1070" y="1000" font-size="36" font-weight="bolder" fill="black"> + <xsl:value-of select="xtitle"/> + </text> + <!-- Now Draw the main X and Y axis --> + <g style="stroke-width:5; stroke:black"> + <!-- X Axis --> + <path d="M 0 1000 L 1000 1000 Z"/> + <!-- Y Axis --> + <path d="M 0 0 L 0 1000 Z"/> + <xsl:if test="y2axis='true'"> + <!-- Y2 Axis --> + <path d="M 1000 0 L 1000 1000 Z"/> + </xsl:if> + </g> + <xsl:for-each select="sets/set"> + <!-- display the x-axis labels --> + <g style="stroke:red; stroke-width: 3; fill:black; stroke:none ;font-size:24; text-anchor:middle"> + <xsl:for-each select="measure[xlabel]"> + <!-- for all measures with an xlabel --> + <xsl:call-template name="xlabel"> + <xsl:with-param name="xvalue" select="xvalue"/> + <xsl:with-param name="xlabel" select="xlabel"/> + <xsl:with-param name="minx" select="$minx"/> + <xsl:with-param name="maxx" select="$maxx"/> + </xsl:call-template> + </xsl:for-each> + <xsl:for-each select="../../xvalues/xvalue"> + <!-- for all (explicit) xvalues --> + <xsl:call-template name="xlabel"> + <xsl:with-param name="xvalue" select="value"/> + <xsl:with-param name="xlabel" select="label"/> + <xsl:with-param name="minx" select="$minx"/> + <xsl:with-param name="maxx" select="$maxx"/> + <xsl:with-param name="gridline" select="gridline"/> + </xsl:call-template> + </xsl:for-each> + </g> + <xsl:for-each select="../../xvalues/xmarkers"> + <!-- draw y-markers on the vertical axis --> + <xsl:call-template name="xmarker"> + <xsl:with-param name="start" select="minvalue"/> + <xsl:with-param name="n" select="steps"/> + <xsl:with-param name="stepsize" + select="(maxvalue - minvalue) div steps"/> + <xsl:with-param name="min" select="$minx"/> + <xsl:with-param name="max" select="$maxx"/> + <xsl:with-param name="gridline" select="gridline"/> + </xsl:call-template> + </xsl:for-each> + <!-- end of x-axis markers, labels and vertical grid-lines --> + <!-- create the y-axis markers --> + <xsl:for-each select="measure[ylabel]"> + <!-- for all measures with an ylabel --> + <xsl:call-template name="ylabel"> + <xsl:with-param name="yvalue" select="yvalue"/> + <xsl:with-param name="ylabel" select="ylabel"/> + <xsl:with-param name="min" select="$min"/> + <xsl:with-param name="max" select="$max"/> + </xsl:call-template> + </xsl:for-each> + <xsl:for-each select="../../yvalues/yvalue"> + <!-- for all (explicit) yvalues --> + <xsl:call-template name="ylabel"> + <xsl:with-param name="yvalue" select="value"/> + <xsl:with-param name="ylabel" select="label"/> + <xsl:with-param name="min" select="$min"/> + <xsl:with-param name="max" select="$max"/> + <xsl:with-param name="gridline" select="gridline"/> + </xsl:call-template> + </xsl:for-each> + <xsl:for-each select="../../yvalues/ymarkers"> + <!-- draw y-markers on the vertical axis --> + <xsl:call-template name="ymarker"> + <xsl:with-param name="start" select="minvalue"/> + <xsl:with-param name="n" select="steps"/> + <xsl:with-param name="stepsize" + select="(maxvalue - minvalue) div steps"/> + <xsl:with-param name="min" select="$min"/> + <xsl:with-param name="max" select="$max"/> + <xsl:with-param name="gridline" select="gridline"/> + </xsl:call-template> + </xsl:for-each> + <!-- end of y-axis markers, labels and horizontal grid-lines --> + <!-- create the y2-axis markers --> + <xsl:for-each select="measure[y2label]"> + <!-- for all measures with an ylabel --> + <xsl:call-template name="ylabel"> + <xsl:with-param name="yvalue" select="y2value"/> + <xsl:with-param name="ylabel" select="y2label"/> + <xsl:with-param name="min" select="$miny2"/> + <xsl:with-param name="max" select="$maxy2"/> + <xsl:with-param name="axis" select="2"/> + </xsl:call-template> + </xsl:for-each> + <xsl:for-each select="../../y2values/y2value"> + <!-- for all (explicit) yvalues --> + <xsl:call-template name="ylabel"> + <xsl:with-param name="yvalue" select="value"/> + <xsl:with-param name="ylabel" select="label"/> + <xsl:with-param name="min" select="$miny2"/> + <xsl:with-param name="max" select="$maxy2"/> + <xsl:with-param name="gridline" select="gridline"/> + <xsl:with-param name="axis" select="2"/> + </xsl:call-template> + </xsl:for-each> + <xsl:for-each select="../../y2values/y2markers"> + <!-- draw y-markers on the vertical axis --> + <xsl:call-template name="ymarker"> + <xsl:with-param name="start" select="minvalue"/> + <xsl:with-param name="n" select="steps"/> + <xsl:with-param name="stepsize" + select="(maxvalue - minvalue) div steps"/> + <xsl:with-param name="min" select="$miny2"/> + <xsl:with-param name="max" select="$maxy2"/> + <xsl:with-param name="gridline" select="gridline"/> + <xsl:with-param name="axis" select="2"/> + </xsl:call-template> + </xsl:for-each> + <!-- end of y2-axis markers, labels and horizontal grid-lines --> + + <!-- go and draw the line of the chart itself --> + <g stylet="stroke:red; stroke-width: 3; fill : none;"> + <xsl:attribute name="style"> + stroke:<xsl:value-of select="@color"/>;stroke-width: 3; fill : none; + </xsl:attribute> + <!-- instead of a polyline, make a line from the previous to each new point --> + <xsl:for-each select="measure"> + <xsl:variable name="x"> + <xsl:value-of select=" 1000* ((xvalue - ($minx)) div ($maxx - $minx))"/> + </xsl:variable> + <xsl:variable name="y"> + xsl:choose + <xsl:when test="yvalue"> + <xsl:value-of select="1000 - 1000* ((yvalue - ($min)) div ($max - $min))"/> + </xsl:when> + xsl:otherwise + <xsl:value-of select="1000 - 1000* ((y2value - ($miny2)) div ($maxy2 - $miny2))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="not(../@showline='false')"> + <xsl:if test="(position() > 1)"> + <line> + <xsl:attribute name="x1"> + <xsl:value-of select=" 1000* ((preceding-sibling::measure[position()=1]/xvalue - ($minx)) div ($maxx - $minx))"/> + </xsl:attribute> + <xsl:attribute name="y1"> + xsl:choose + <xsl:when test="yvalue"> + <xsl:value-of select="1000 - 1000* ((preceding-sibling::measure[position()=1]/yvalue - ($min)) div ($max - $min))"/> + </xsl:when> + xsl:otherwise + <xsl:value-of select="1000 - 1000* ((preceding-sibling::measure[position()=1]/y2value - ($miny2)) div ($maxy2 - $miny2))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="x2"> + <xsl:value-of select="$x"/> + </xsl:attribute> + <xsl:attribute name="y2"> + <xsl:value-of select="$y"/> + </xsl:attribute> + </line> + </xsl:if> + </xsl:if> + <xsl:if test="xgrid = 'true'"> + <xsl:call-template name="gridline"> + <xsl:with-param name="x1" select="$x"/> + <xsl:with-param name="y1" select="$y"/> + <xsl:with-param name="type">vertical</xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="ygrid = 'true'"> + <xsl:call-template name="gridline"> + <xsl:with-param name="x1" select="$x"/> + <xsl:with-param name="y1" select="$y"/> + <xsl:with-param name="type">horizontal</xsl:with-param> + <xsl:with-param name="yaxis"> + xsl:choose + <xsl:when test="yvalue">1</xsl:when> + xsl:otherwise2</xsl:otherwise> + </xsl:choose> + </xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:for-each> <!-- measure --> + </g> + </xsl:for-each> <!-- sets --> + <!-- now again traverse all measures to place markers and create annotations; + by doing this in a second go, we ensure (according to the 'painters algoritm' + (see: http://wiki.svg.org/index.php/ChangingDrawingOrder)) that the annotations + and markers are on top of everything else. + --> + <xsl:for-each select="sets/set"> + <xsl:for-each select="measure"> + <xsl:variable name="x"> + <xsl:value-of select=" 1000* ((xvalue - ($minx)) div ($maxx - $minx))"/> + </xsl:variable> + <xsl:variable name="y"> + xsl:choose + <xsl:when test="yvalue"> + <xsl:value-of select="1000 - 1000* ((yvalue - ($min)) div ($max - $min))"/> + </xsl:when> + xsl:otherwise + <xsl:value-of select="1000 - 1000* ((y2value - ($miny2)) div ($maxy2 - $miny2))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <g > + <xsl:attribute name="style">stroke:<xsl:value-of select="../@color"/> stroke-width: 3; fill : none;</xsl:attribute> + <!-- draw a marker --> + <xsl:call-template name="marker"> + <xsl:with-param name="x" select="$x"/> + <xsl:with-param name="y" select="$y"/> + <xsl:with-param name="label" select="label"/> + <xsl:with-param name="marker" select="../@marker-type"/> + <xsl:with-param name="color" select="../@color"/> + </xsl:call-template> + <xsl:if test="annotation"> + <!-- currently the annotation is written before the line ; that means that the line will cover the annotation --> + <xsl:call-template name="annotation"> + <xsl:with-param name="x" select="$x"/> + <xsl:with-param name="y" select="$y"/> + <xsl:with-param name="annotation" select="annotation"/> + </xsl:call-template> + </xsl:if> + </g> + </xsl:for-each> <!-- measures in set --> + </xsl:for-each> <!-- sets --> + <!-- legend per set --> + <g id="legend" style="fill:lavenderblush;stroke-width:2;stroke:black" transform="translate(1080,500)"> + <!-- Tooltip - Beginn (ttr=Tooltip-Rechteck, ttt=Tooltip-Text) --> + <rect id="legend" x="0" y="0" rx="5" ry="5" width="200" > + <xsl:attribute name="height"><xsl:value-of select="29+ 20* count(sets/set)"/></xsl:attribute> + </rect> + <text x="10" y="15" style="text-decoration:underline;stroke-width:1;stroke:black;fill:black">Legend:</text> + <xsl:for-each select="sets/set"> + <xsl:call-template name="marker"> + <xsl:with-param name="x">15</xsl:with-param> + <xsl:with-param name="y" select="7+20*(position())"/> + <xsl:with-param name="label" select="title"/> + <xsl:with-param name="marker" select="@marker-type"/> + <xsl:with-param name="color" select="@color"/> + </xsl:call-template> + <text x="27"> + <xsl:attribute name="y"><xsl:value-of select="15+20*(position())"/></xsl:attribute> + <xsl:attribute name="style">stroke-width:1;stroke:<xsl:value-of select="@color" />;fill:<xsl:value-of select="@color" /></xsl:attribute> + <xsl:value-of select="@title"/> + </text> + </xsl:for-each> + </g> + + </g> + <g id="tooltip" style="visibility: hidden"> + <!-- Tooltip - Beginn (ttr=Tooltip-Rechteck, ttt=Tooltip-Text) --> + <rect id="ttr" x="0" y="0" rx="5" ry="5" width="100" height="16"/> + <text id="ttt" x="0" y="0" style="visibility: hidden">dyn. Text</text> + <text x="-10" y="-10">dyn. Text</text> + <text x="-10" y="-10">dyn. Text</text> + <text x="-10" y="-10">dyn. Text</text> + <text x="-10" y="-10">dyn. Text</text> + <text x="-10" y="-10">dyn. Text</text> + </g> + <!-- Tooltip - Ende --> + </svg> + </xsl:template> + <xsl:template name="xlabel"> + <xsl:param name="xvalue"/> + <xsl:param name="maxx"/> + <xsl:param name="minx"/> + <xsl:param name="xlabel"/> + <xsl:param name="gridline"/> + <g> + <xsl:attribute name="transform">rotate(315, + + + <xsl:value-of select="1000* (($xvalue - ($minx)) div ($maxx - $minx))"/> + + +,1014)</xsl:attribute> + <text y="1014" style="text-anchor:end"> + <xsl:attribute name="x"> + <xsl:value-of select="1000* (($xvalue - ($minx)) div ($maxx - $minx))"/> + </xsl:attribute> + <xsl:value-of select="$xlabel"/> + </text> + </g> + <xsl:if test="$gridline = 'true'"> + <xsl:call-template name="gridline"> + <xsl:with-param name="x1"> + <xsl:value-of select="1000* (($xvalue - ($minx)) div ($maxx - $minx))"/> + </xsl:with-param> + <xsl:with-param name="y1">0</xsl:with-param> + <xsl:with-param name="type">vertical</xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!-- xlabel --> + <xsl:template name="ylabel"> + <xsl:param name="yvalue"/> + <xsl:param name="max"/> + <xsl:param name="min"/> + <xsl:param name="ylabel"/> + <xsl:param name="gridline"/> + <xsl:param name="axis">1</xsl:param> + <g id="ylabel"> + <xsl:attribute name="transform">rotate(<xsl:value-of select="325 + ($axis - 1) * -300 "/>, <xsl:value-of select="-10 + ($axis - 1) * 1020 "/>, + + + <xsl:value-of select="1000-1000* (($yvalue - ($min)) div ($max - $min))"/> + + )</xsl:attribute> + <text x="-10" > + <xsl:attribute name="style">text-anchor: + xsl:choose + <xsl:when test="$axis=1">end</xsl:when> + xsl:otherwisestart</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="x"> + <xsl:value-of select="-10 + ($axis - 1) * 1020 "/> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="1000 - 1000* (($yvalue - ($min)) div ($max - $min))"/> + </xsl:attribute> + <xsl:value-of select="$ylabel"/> + </text> + </g> + <xsl:if test="$gridline = 'true'"> + <xsl:call-template name="gridline"> + <xsl:with-param name="y1"> + <xsl:value-of select="1000 - 1000* (($yvalue - ($min)) div ($max - $min))"/> + </xsl:with-param> + <xsl:with-param name="x1"><xsl:value-of select="1000- 1000*($axis -1 )" /></xsl:with-param> + <xsl:with-param name="type">horizontal</xsl:with-param> + <xsl:with-param name="yaxis"><xsl:value-of select="$axis" /></xsl:with-param> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!-- ylabel --> + <xsl:template name="annotation"> + <xsl:param name="x"/> + <xsl:param name="y"/> + <xsl:param name="annotation"/> + <!-- display an annotation --> + <g style="stroke-width:1;stroke:blue"> + <xsl:variable name="height"> + <xsl:value-of select="8+16*round(string-length($annotation) div 25)"/> + </xsl:variable> + <xsl:variable name="y_anno"> + xsl:choose + <xsl:when test="$y < 300">-150</xsl:when> + xsl:otherwise150</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="line_y"> + xsl:choose + <xsl:when test="$y < 300"><xsl:value-of select="-40+ $y - $y_anno + 0.35* $height" /></xsl:when> + xsl:otherwise<xsl:value-of select="-40+ $y - $y_anno + 0.65* $height"/></xsl:otherwise> + </xsl:choose> + </xsl:variable> + <line> + <!-- vertical line either upwards (default) or downwards (for the over the 70% of max values --> + <xsl:attribute name="x1"> + <xsl:value-of select="$x"/> + </xsl:attribute> + <xsl:attribute name="y1"> + <xsl:value-of select="$y"/> + </xsl:attribute> + <xsl:attribute name="x2"> + <xsl:value-of select="$x"/> + </xsl:attribute> + <xsl:attribute name="y2"> + <xsl:value-of select="$line_y "/> + </xsl:attribute> + </line> + <line> + <!-- horizontal line to right (default) or left (for the over 80% of max x values --> + <xsl:attribute name="x1"> + <xsl:value-of select="$x"/> + </xsl:attribute> + <xsl:attribute name="y1"> + <xsl:value-of select="$line_y "/> + </xsl:attribute> + <xsl:attribute name="x2"> + xsl:choose + <xsl:when test="$x > 750"><xsl:value-of select="-7+$x"/></xsl:when> + xsl:otherwise<xsl:value-of select="7+$x"/></xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="y2"> + <xsl:value-of select="$line_y"/> + </xsl:attribute> + </line> + <rect width="210" style="fill:lightyellow" > + <!-- box to hold the annotation; starts at the horizontal line and extends to the right (default) or left (for over 80% of max x value --> + <xsl:attribute name="height"> + <xsl:value-of select="$height"/> + </xsl:attribute> + <xsl:attribute name="x"> + xsl:choose + <xsl:when test="$x > 750"><xsl:value-of select="-7+$x -210"/></xsl:when> + xsl:otherwise<xsl:value-of select="7+$x"/></xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="-40+$y - $y_anno"/> + </xsl:attribute> + </rect> + <!-- we may need to split the text in multiple lines; our annotation textbox has a width of 40 which means around 17 characters??--> + <xsl:call-template name="annotationLine"> + <xsl:with-param name="x" select="$x"/> + <xsl:with-param name="y" select="$y - $y_anno"/> + <xsl:with-param name="annotation" select="$annotation"/> + <xsl:with-param name="line">1</xsl:with-param> + </xsl:call-template> + </g> + </xsl:template> + <xsl:template name="marker"> + <xsl:param name="x"/> + <xsl:param name="y"/> + <xsl:param name="label"/> + <xsl:param name="marker">circle</xsl:param> + <xsl:param name="color">red</xsl:param> + <g onmouseout="HideTooltip(evt)" transform="scale(1)"> + <xsl:attribute name="style"> + stroke:<xsl:value-of select="$color"/>;fill:<xsl:value-of select="$color"/> + </xsl:attribute> + <xsl:attribute name="onmouseover"> + ShowTooltip(evt,'<xsl:value-of select="$label"/>') + </xsl:attribute> + xsl:choose + <xsl:when test="$marker='square'"> + <use xlink:href="#square"> + <xsl:attribute name="x"> + <xsl:value-of select="$x -9"/> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="$y -9"/> + </xsl:attribute> + </use> + </xsl:when> + <xsl:when test="$marker='triangle'"> + <use xlink:href="#triangle"> + <xsl:attribute name="x"> + <xsl:value-of select="$x -9"/> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="$y -9"/> + </xsl:attribute> + </use> + </xsl:when> + <xsl:when test="$marker='rectangle'"> + <use xlink:href="#rectangle"> + <xsl:attribute name="x"> + <xsl:value-of select="$x -4"/> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="$y -4"/> + </xsl:attribute> + </use> + </xsl:when> + <xsl:when test="$marker='star'"> + <use xlink:href="#star"> + <xsl:attribute name="x"> + <xsl:value-of select="$x -9"/> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="$y -9"/> + </xsl:attribute> + </use> + </xsl:when> + <xsl:when test="$marker='diamond'"> + <!-- diamond is just a square rotated about its own center for 45 degrees --> + <use xlink:href="#square"> + <xsl:attribute name="x"> + <xsl:value-of select="$x -9"/> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="$y -9"/> + </xsl:attribute> + <xsl:attribute name="transform"> + rotate(45,<xsl:value-of select="$x"/>,<xsl:value-of select="$y "/>) + </xsl:attribute> + </use> + </xsl:when> + <xsl:when test="$marker='circle'"> + <circle r="9"> + <xsl:attribute name="cx"> + <xsl:value-of select="$x"/> + </xsl:attribute> + <xsl:attribute name="cy"> + <xsl:value-of select="$y"/> + </xsl:attribute> + </circle> + </xsl:when> + <xsl:when test="$marker='smallcircle'"> + <circle r="4"> + <xsl:attribute name="cx"> + <xsl:value-of select="$x"/> + </xsl:attribute> + <xsl:attribute name="cy"> + <xsl:value-of select="$y"/> + </xsl:attribute> + </circle> + </xsl:when> + xsl:otherwise + </xsl:otherwise> + </xsl:choose> + </g> + </xsl:template> + <xsl:template name="xmarker"> + <xsl:param name="n"/> + <xsl:param name="i">0</xsl:param> + <xsl:param name="stepsize"/> + <xsl:param name="min"/> + <xsl:param name="max"/> + <xsl:param name="gridline">false</xsl:param> + <xsl:param name="start"> + <xsl:value-of select="$min"/> + </xsl:param> + <xsl:variable name="x"> + <xsl:value-of select="1000* (($start + $i* $stepsize - $min) div ($max - $min))"/> + </xsl:variable> + <line y1="1000" y2="985"> + <xsl:attribute name="x1"> + <xsl:value-of select="$x"/> + </xsl:attribute> + <xsl:attribute name="x2"> + <xsl:value-of select="$x"/> + </xsl:attribute> + </line> + <xsl:call-template name="xlabel"> + <xsl:with-param name="xvalue" select="$start + $i* $stepsize"/> + <xsl:with-param name="xlabel"> + <xsl:value-of select="round($i * $stepsize +$start)"/> +"</xsl:with-param> + <xsl:with-param name="minx" select="$min"/> + <xsl:with-param name="maxx" select="$max"/> + </xsl:call-template> + <xsl:if test="$gridline = 'true'"> + <xsl:call-template name="gridline"> + <xsl:with-param name="y1">0</xsl:with-param> + <xsl:with-param name="x1" select="$x"/> + <xsl:with-param name="type">vertical</xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="$i < $n"> + <xsl:call-template name="xmarker"> + <xsl:with-param name="i" select="$i+1"/> + <xsl:with-param name="n" select="$n"/> + <xsl:with-param name="stepsize" select="$stepsize"/> + <xsl:with-param name="min" select="$min"/> + <xsl:with-param name="max" select="$max"/> + <xsl:with-param name="start" select="$start"/> + <xsl:with-param name="gridline" select="$gridline"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!-- end of xmarker --> + <xsl:template name="ymarker"> + <xsl:param name="n"/> + <xsl:param name="i">0</xsl:param> + <xsl:param name="stepsize"/> + <xsl:param name="min"/> + <xsl:param name="max"/> + <xsl:param name="gridline">false</xsl:param> + <xsl:param name="start"> + <xsl:value-of select="$min"/> + </xsl:param> + <xsl:param name="axis">1</xsl:param> + <xsl:variable name="y"> + <xsl:value-of select="1000 - 1000* (($start + $i* $stepsize - $min) div ($max - $min))"/> + </xsl:variable> + <xsl:value-of select="$i"/> + <line x1="0" x2="18"> + <xsl:attribute name="y1"> + <xsl:value-of select="$y"/> + </xsl:attribute> + <xsl:attribute name="y2"> + <xsl:value-of select="$y"/> + </xsl:attribute> + </line> + <text x="-20"> + <xsl:attribute name="x"> + <xsl:value-of select="-20 + 1030*($axis -1)"/> + </xsl:attribute> + <xsl:attribute name="style">text-anchor: + xsl:choose + <xsl:when test="$axis=1">end</xsl:when> + xsl:otherwisestart</xsl:otherwise> + </xsl:choose> + ;font-size: + xsl:choose + <xsl:when test="$i=$n">40</xsl:when> + <xsl:when test="$i=0">40</xsl:when> + xsl:otherwise20</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="$y +5"/> + </xsl:attribute> + <xsl:value-of select="round($i * $stepsize +$start)"/> + </text> + <xsl:if test="$gridline = 'true'"> + <xsl:call-template name="gridline"> + <xsl:with-param name="x1"><xsl:value-of select="1000 - 1000*( $axis -1)"/></xsl:with-param> + <xsl:with-param name="y1" select="$y"/> + <xsl:with-param name="type">horizontal</xsl:with-param> + <xsl:with-param name="yaxis"><xsl:value-of select="$axis"/></xsl:with-param> + </xsl:call-template> + </xsl:if> + <xsl:if test="$i < $n"> + <xsl:call-template name="ymarker"> + <xsl:with-param name="i" select="$i+1"/> + <xsl:with-param name="n" select="$n"/> + <xsl:with-param name="stepsize" select="$stepsize"/> + <xsl:with-param name="min" select="$min"/> + <xsl:with-param name="max" select="$max"/> + <xsl:with-param name="start" select="$start"/> + <xsl:with-param name="gridline" select="$gridline"/> + <xsl:with-param name="axis" select="$axis"/> + </xsl:call-template> + </xsl:if> + </xsl:template> + <!-- ymarker --> + <xsl:template name="gridline"> + <xsl:param name="x1"/> + <xsl:param name="y1"/> + <xsl:param name="type"/> + <xsl:param name="yaxis">1</xsl:param> + <line style="fill:none; stroke:#B0B0B0; stroke-width:2; stroke-dasharray:2 4"> + <xsl:attribute name="x1"> + <xsl:value-of select="$x1"/> + </xsl:attribute> + xsl:choose + <xsl:when test="$type='horizontal'"> + <xsl:attribute name="x2"><xsl:value-of select="($yaxis -1)* 1000 "/></xsl:attribute> + <xsl:attribute name="y2"> + <xsl:value-of select="$y1"/> + </xsl:attribute> + </xsl:when> + xsl:otherwise + <xsl:attribute name="y2">1000</xsl:attribute> + <xsl:attribute name="x2"> + <xsl:value-of select="$x1"/> + </xsl:attribute> + </xsl:otherwise> + </xsl:choose> + <xsl:attribute name="y1"> + <xsl:value-of select="$y1"/> + </xsl:attribute> + </line> + </xsl:template> + <!-- gridline --> + + <!-- write line in annotation box --> + <xsl:template name="annotationLine" > + <xsl:param name="x"/> + <xsl:param name="y"/> + <xsl:param name="annotation"/> + <xsl:param name="line">1</xsl:param> + <text font-size="16" fill="black"> + <xsl:attribute name="text-anchor"> + xsl:choose + <xsl:when test="$x > 750">end</xsl:when> + xsl:otherwisestart</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="x"> + xsl:choose + <xsl:when test="$x > 750"><xsl:value-of select="-10+$x"/></xsl:when> + xsl:otherwise<xsl:value-of select="10+$x"/></xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="y"> + <xsl:value-of select="-25+$y +16*($line -1)"/> + </xsl:attribute> + <xsl:value-of select="substring($annotation,1,25)"/> + </text> + <xsl:if test="string-length($annotation) > 25"> + <xsl:call-template name="annotationLine"> + <xsl:with-param name="x" select="$x"/> + <xsl:with-param name="y" select="$y"/> + <xsl:with-param name="annotation" select="substring($annotation,26)"/> + <xsl:with-param name="line" select="$line+1"/> + </xsl:call-template> + </xsl:if> +</xsl:template> + +</xsl:stylesheet>
Property changes on: branches/xml-class-rework/projects/bos/statistics/buildSVGLineChart.xsl ___________________________________________________________________ Name: svn:executable + *
Added: branches/xml-class-rework/projects/bos/statistics/contracts-by-week-2005.svg =================================================================== --- branches/xml-class-rework/projects/bos/statistics/contracts-by-week-2005.svg 2006-09-24 19:13:31 UTC (rev 1984) +++ branches/xml-class-rework/projects/bos/statistics/contracts-by-week-2005.svg 2006-10-14 06:59:35 UTC (rev 1985) @@ -0,0 +1,75 @@ +<svg xmlns:xlink="http://www.w3.org/2000/xlink/namespace/" width="1200" height="1200" onload="getSVGDoc(evt)" onzoom="ZoomControl()"><defs><g id="star" transform="scale(0.21)"><polyline points="48,16,16,96,96,48,0,48,80,96"/></g><g id="triangle" transform="scale(0.7)"><path id="Triangle" d="M 0 25 L 10 15 L 20 25 z" style="stroke:none"/></g><g id="square" transform="scale(1)"><rect width="18" height="18"/></g><g id="rectangle" transform="scale(1)"><rect width="7" height="22"/></g><script type="text/javascript"> + + /* this code was largely reused from the excellent website SVG - Learning by Coding (http://svglbc.datenverdrahten.de/) */ + var svgdoc,svgroot; + function getSVGDoc(load_evt) + { + svgdoc=load_evt.target.ownerDocument; + svgroot=svgdoc.documentElement; + + texte=svgdoc.getElementById("tooltip").getElementsByTagName("text"); + } + function ShowTooltip(mousemove_event,txt) + { + var ttrelem,tttelem,posx,posy,curtrans,ctx,cty,txt; + var sollbreite,maxbreite,ges,anz,tmp,txl,neu,i,k,l + ttrelem=svgdoc.getElementById("ttr"); + tttelem=svgdoc.getElementById("ttt"); + posx=mousemove_event.clientX; + posy=mousemove_event.clientY; + for(i=1;i<=5;i++)texte.item(i).firstChild.data=""; + sollbreite=150; + tttelem.childNodes.item(0).data=txt; + ges=tttelem.getComputedTextLength(); + tttelem.childNodes.item(0).data=""; + anz=Math.ceil(ges/sollbreite); + tmp=txt.split(" "); + txl=new Array(tmp.length); + neu=new Array(anz); + for(i=0;i<tmp.length;i++) + { + tttelem.childNodes.item(0).data=tmp[i]; + txl[i]=tttelem.getComputedTextLength(); + } + k=0; + maxbreite=0; + for(i=0;i<anz;i++) + { + l=0,neu[i]=""; + while(l+txl[k]<1.1*sollbreite && k<tmp.length) + { + l+=txl[k]; + neu[i]+=tmp[k]+" "; + k++; + if(maxbreite<l)maxbreite=l; + } + } + curtrans=svgroot.currentTranslate; + ctx=curtrans.x; + cty=curtrans.y; + ttrelem.setAttribute("x",posx-ctx+10); + ttrelem.setAttribute("y",posy-cty-20+10); + ttrelem.setAttribute("width",maxbreite+2*(maxbreite-sollbreite)+40); + ttrelem.setAttribute("height",anz*15+3); + ttrelem.setAttribute("style","fill: #FFC; stroke: #000; stroke-width: 0.5px"); + for(i=1;i<=anz;i++) + { + texte.item(i).firstChild.data=neu[i-1]; + texte.item(i).setAttribute("x",posx-ctx+15); + texte.item(i).setAttribute("y",parseInt(i-1)*15+posy-cty+3); + texte.item(i).setAttribute("style","fill: #00C; font-size: 11px"); + } + svgdoc.getElementById("tooltip").style.setProperty("visibility","visible"); + } + function HideTooltip() + { + svgdoc.getElementById("tooltip").style.setProperty("visibility","hidden"); + } + function ZoomControl() + { + var curzoom; + curzoom=svgroot.currentScale; + svgdoc.getElementById("tooltip").setAttribute("transform","scale("+1/curzoom+")"); + } + + </script></defs><g transform="translate(150,50) scale(0.5)"><text x="5" y="-40" text-anchor="left" font-weight="bolder" font-size="40" fill="maroon" text-decoration="underline">Contracts by week for year 2005</text><g transform="translate(-220, 80) rotate(270, 0, 0)"><text x="0" y="0" text-anchor="middle" font-weight="bolder" font-size="36" fill="black"></text></g><g transform="translate(1220, 80) rotate(90, 0, 0)"><text x="0" y="0" text-anchor="middle" font-weight="bolder" font-size="36" fill="black"></text></g><text x="1070" y="1000" font-size="36" font-weight="bolder" fill="black"></text><g style="stroke-width:5; stroke:black"><path d="M 0 1000 L 1000 1000 Z"/><path d="M 0 0 L 0 1000 Z"/></g><g style="stroke:red; stroke-width: 3; fill:black; stroke:none ;font-size:24; text-anchor:middle"/><g id="ylabel" transform="rotate(325, -10, 692.307692307692 )"><text x="-10" style="text-anchor: end" y="692.307692307692">20</text></g><line style="fill:none; stroke:#B0B0B0; stroke-width:2; stroke-dasharray:2 4" x1="1000" x2="0" y2="692.307692307692" y1="692.307692307692"/><g id="ylabel" transform="rotate(325, -10, 384.615384615385 )"><text x="-10" style="text-anchor: end" y="384.615384615385">40</text></g><line style="fill:none; stroke:#B0B0B0; stroke-width:2; stroke-dasharray:2 4" x1="1000" x2="0" y2="384.615384615385" y1="384.615384615385"/><g id="ylabel" transform="rotate(325, -10, 76.9230769230769 )"><text x="-10" style="text-anchor: end" y="76.9230769230769">60</text></g><line style="fill:none; stroke:#B0B0B0; stroke-width:2; stroke-dasharray:2 4" x1="1000" x2="0" y2="76.9230769230769" y1="76.9230769230769"/><g stylet="stroke:red; stroke-width: 3; fill : none;" style=" stroke:green;stroke-width: 3; fill : none; "><line x1="117.647058823529" y1="892.307692307692" x2="137.254901960784" y2="938.461538461538"/><line x1="137.254901960784" y1="938.461538461538" x2="156.862745098039" y2="184.615384615385"/><line x1="156.862745098039" y1="184.615384615385" x2="176.470588235294" y2="861.538461538462"/><line x1="176.470588235294" y1="861.538461538462" x2="196.078431372549" y2="923.076923076923"/><line x1="196.078431372549" y1="923.076923076923" x2="215.686274509804" y2="923.076923076923"/><line x1="215.686274509804" y1="923.076923076923" x2="235.294117647059" y2="876.923076923077"/><line x1="235.294117647059" y1="876.923076923077" x2="254.901960784314" y2="907.692307692308"/><line x1="254.901960784314" y1="907.692307692308" x2="274.509803921569" y2="938.461538461538"/><line x1="274.509803921569" y1="938.461538461538" x2="294.117647058824" y2="984.615384615385"/><line x1="294.117647058824" y1="984.615384615385" x2="313.725490196078" y2="876.923076923077"/><line x1="313.725490196078" y1="876.923076923077" x2="333.333333333333" y2="876.923076923077"/><line x1="333.333333333333" y1="876.923076923077" x2="352.941176470588" y2="876.923076923077"/><line x1="352.941176470588" y1="876.923076923077" x2="372.549019607843" y2="938.461538461538"/><line x1="372.549019607843" y1="938.461538461538" x2="392.156862745098" y2="784.615384615385"/><line x1="392.156862745098" y1="784.615384615385" x2="411.764705882353" y2="876.923076923077"/><line x1="411.764705882353" y1="876.923076923077" x2="431.372549019608" y2="923.076923076923"/><line x1="431.372549019608" y1="923.076923076923" x2="450.980392156863" y2="892.307692307692"/><line x1="450.980392156863" y1="892.307692307692" x2="470.588235294118" y2="938.461538461538"/><line x1="470.588235294118" y1="938.461538461538" x2="490.196078431373" y2="984.615384615385"/><line x1="490.196078431373" y1="984.615384615385" x2="509.803921568627" y2="923.076923076923"/><line x1="509.803921568627" y1="923.076923076923" x2="529.411764705882" y2="938.461538461538"/><line x1="529.411764705882" y1="938.461538461538" x2="568.627450980392" y2="984.615384615385"/><line x1="568.627450980392" y1="984.615384615385" x2="588.235294117647" y2="876.923076923077"/><line x1="588.235294117647" y1="876.923076923077" x2="607.843137254902" y2="892.307692307692"/><line x1="607.843137254902" y1="892.307692307692" x2="627.450980392157" y2="461.538461538462"/><line x1="627.450980392157" y1="461.538461538462" x2="647.058823529412" y2="707.692307692308"/><line x1="647.058823529412" y1="707.692307692308" x2="666.666666666667" y2="815.384615384615"/><line x1="666.666666666667" y1="815.384615384615" x2="686.274509803922" y2="923.076923076923"/><line x1="686.274509803922" y1="923.076923076923" x2="705.882352941176" y2="876.923076923077"/><line x1="705.882352941176" y1="876.923076923077" x2="725.490196078431" y2="953.846153846154"/><line x1="725.490196078431" y1="953.846153846154" x2="745.098039215686" y2="907.692307692308"/><line x1="745.098039215686" y1="907.692307692308" x2="764.705882352941" y2="876.923076923077"/><line x1="764.705882352941" y1="876.923076923077" x2="784.313725490196" y2="615.384615384615"/><line x1="784.313725490196" y1="615.384615384615" x2="803.921568627451" y2="784.615384615385"/><line x1="803.921568627451" y1="784.615384615385" x2="823.529411764706" y2="846.153846153846"/><line x1="823.529411764706" y1="846.153846153846" x2="843.137254901961" y2="861.538461538462"/><line x1="843.137254901961" y1="861.538461538462" x2="862.745098039216" y2="923.076923076923"/><line x1="862.745098039216" y1="923.076923076923" x2="882.352941176471" y2="830.769230769231"/><line x1="882.352941176471" y1="830.769230769231" x2="901.960784313726" y2="646.153846153846"/><line x1="901.960784313726" y1="646.153846153846" x2="921.56862745098" y2="630.769230769231"/><line x1="921.56862745098" y1="630.769230769231" x2="941.176470588235" y2="415.384615384615"/><line x1="941.176470588235" y1="415.384615384615" x2="960.78431372549" y2="246.153846153846"/><line x1="960.78431372549" y1="246.153846153846" x2="980.392156862745" y2="0"/><line x1="980.392156862745" y1="0" x2="1000" y2="876.923076923077"/></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="108.647058823529" y="883.307692307692"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="128.254901960784" y="929.461538461538"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="147.862745098039" y="175.615384615385"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="167.470588235294" y="852.538461538462"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="187.078431372549" y="914.076923076923"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="206.686274509804" y="914.076923076923"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="226.294117647059" y="867.923076923077"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="245.901960784314" y="898.692307692308"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="265.509803921569" y="929.461538461538"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="285.117647058824" y="975.615384615385"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="304.725490196078" y="867.923076923077"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="324.333333333333" y="867.923076923077"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="343.941176470588" y="867.923076923077"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="363.549019607843" y="929.461538461538"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="383.156862745098" y="775.615384615385"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="402.764705882353" y="867.923076923077"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="422.372549019608" y="914.076923076923"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="441.980392156863" y="883.307692307692"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="461.588235294118" y="929.461538461538"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="481.196078431373" y="975.615384615385"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="500.803921568627" y="914.076923076923"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="520.411764705882" y="929.461538461538"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="559.627450980392" y="975.615384615385"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="579.235294117647" y="867.923076923077"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="598.843137254902" y="883.307692307692"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="618.450980392157" y="452.538461538462"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="638.058823529412" y="698.692307692308"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="657.666666666667" y="806.384615384615"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="677.274509803922" y="914.076923076923"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="696.882352941176" y="867.923076923077"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="716.490196078431" y="944.846153846154"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="736.098039215686" y="898.692307692308"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="755.705882352941" y="867.923076923077"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="775.313725490196" y="606.384615384615"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="794.921568627451" y="775.615384615385"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="814.529411764706" y="837.153846153846"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="834.137254901961" y="852.538461538462"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="853.745098039216" y="914.076923076923"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="873.352941176471" y="821.769230769231"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="892.960784313726" y="637.153846153846"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="912.56862745098" y="621.769230769231"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="932.176470588235" y="406.384615384615"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="951.78431372549" y="237.153846153846"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="971.392156862745" y="-9"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="991" y="867.923076923077"/></g></g><g id="legend" style="fill:lavenderblush;stroke-width:2;stroke:black" transform="translate(1080,500)"><rect id="legend" x="0" y="0" rx="5" ry="5" width="200" height="49"/><text x="10" y="15" style="text-decoration:underline;stroke-width:1;stroke:black;fill:black">Legend:</text><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="6" y="18"/></g><text x="27" y="35" style="stroke-width:1;stroke:green;fill:green">Contracts</text></g></g><g id="tooltip" style="visibility: hidden"><rect id="ttr" x="0" y="0" rx="5" ry="5" width="100" height="16"/><text id="ttt" x="0" y="0" style="visibility: hidden">dyn. Text</text><text x="-10" y="-10">dyn. Text</text><text x="-10" y="-10">dyn. Text</text><text x="-10" y="-10">dyn. Text</text><text x="-10" y="-10">dyn. Text</text><text x="-10" y="-10">dyn. Text</text></g></svg>
Added: branches/xml-class-rework/projects/bos/statistics/contracts-by-week-2006.svg =================================================================== --- branches/xml-class-rework/projects/bos/statistics/contracts-by-week-2006.svg 2006-09-24 19:13:31 UTC (rev 1984) +++ branches/xml-class-rework/projects/bos/statistics/contracts-by-week-2006.svg 2006-10-14 06:59:35 UTC (rev 1985) @@ -0,0 +1,75 @@ +<svg xmlns:xlink="http://www.w3.org/2000/xlink/namespace/" width="1200" height="1200" onload="getSVGDoc(evt)" onzoom="ZoomControl()"><defs><g id="star" transform="scale(0.21)"><polyline points="48,16,16,96,96,48,0,48,80,96"/></g><g id="triangle" transform="scale(0.7)"><path id="Triangle" d="M 0 25 L 10 15 L 20 25 z" style="stroke:none"/></g><g id="square" transform="scale(1)"><rect width="18" height="18"/></g><g id="rectangle" transform="scale(1)"><rect width="7" height="22"/></g><script type="text/javascript"> + + /* this code was largely reused from the excellent website SVG - Learning by Coding (http://svglbc.datenverdrahten.de/) */ + var svgdoc,svgroot; + function getSVGDoc(load_evt) + { + svgdoc=load_evt.target.ownerDocument; + svgroot=svgdoc.documentElement; + + texte=svgdoc.getElementById("tooltip").getElementsByTagName("text"); + } + function ShowTooltip(mousemove_event,txt) + { + var ttrelem,tttelem,posx,posy,curtrans,ctx,cty,txt; + var sollbreite,maxbreite,ges,anz,tmp,txl,neu,i,k,l + ttrelem=svgdoc.getElementById("ttr"); + tttelem=svgdoc.getElementById("ttt"); + posx=mousemove_event.clientX; + posy=mousemove_event.clientY; + for(i=1;i<=5;i++)texte.item(i).firstChild.data=""; + sollbreite=150; + tttelem.childNodes.item(0).data=txt; + ges=tttelem.getComputedTextLength(); + tttelem.childNodes.item(0).data=""; + anz=Math.ceil(ges/sollbreite); + tmp=txt.split(" "); + txl=new Array(tmp.length); + neu=new Array(anz); + for(i=0;i<tmp.length;i++) + { + tttelem.childNodes.item(0).data=tmp[i]; + txl[i]=tttelem.getComputedTextLength(); + } + k=0; + maxbreite=0; + for(i=0;i<anz;i++) + { + l=0,neu[i]=""; + while(l+txl[k]<1.1*sollbreite && k<tmp.length) + { + l+=txl[k]; + neu[i]+=tmp[k]+" "; + k++; + if(maxbreite<l)maxbreite=l; + } + } + curtrans=svgroot.currentTranslate; + ctx=curtrans.x; + cty=curtrans.y; + ttrelem.setAttribute("x",posx-ctx+10); + ttrelem.setAttribute("y",posy-cty-20+10); + ttrelem.setAttribute("width",maxbreite+2*(maxbreite-sollbreite)+40); + ttrelem.setAttribute("height",anz*15+3); + ttrelem.setAttribute("style","fill: #FFC; stroke: #000; stroke-width: 0.5px"); + for(i=1;i<=anz;i++) + { + texte.item(i).firstChild.data=neu[i-1]; + texte.item(i).setAttribute("x",posx-ctx+15); + texte.item(i).setAttribute("y",parseInt(i-1)*15+posy-cty+3); + texte.item(i).setAttribute("style","fill: #00C; font-size: 11px"); + } + svgdoc.getElementById("tooltip").style.setProperty("visibility","visible"); + } + function HideTooltip() + { + svgdoc.getElementById("tooltip").style.setProperty("visibility","hidden"); + } + function ZoomControl() + { + var curzoom; + curzoom=svgroot.currentScale; + svgdoc.getElementById("tooltip").setAttribute("transform","scale("+1/curzoom+")"); + } + + </script></defs><g transform="translate(150,50) scale(0.5)"><text x="5" y="-40" text-anchor="left" font-weight="bolder" font-size="40" fill="maroon" text-decoration="underline">Contracts by week for year 2006</text><g transform="translate(-220, 80) rotate(270, 0, 0)"><text x="0" y="0" text-anchor="middle" font-weight="bolder" font-size="36" fill="black"></text></g><g transform="translate(1220, 80) rotate(90, 0, 0)"><text x="0" y="0" text-anchor="middle" font-weight="bolder" font-size="36" fill="black"></text></g><text x="1070" y="1000" font-size="36" font-weight="bolder" fill="black"></text><g style="stroke-width:5; stroke:black"><path d="M 0 1000 L 1000 1000 Z"/><path d="M 0 0 L 0 1000 Z"/></g><g style="stroke:red; stroke-width: 3; fill:black; stroke:none ;font-size:24; text-anchor:middle"/><g id="ylabel" transform="rotate(325, -10, 696.969696969697 )"><text x="-10" style="text-anchor: end" y="696.969696969697">20</text></g><line style="fill:none; stroke:#B0B0B0; stroke-width:2; stroke-dasharray:2 4" x1="1000" x2="0" y2="696.969696969697" y1="696.969696969697"/><g id="ylabel" transform="rotate(325, -10, 393.939393939394 )"><text x="-10" style="text-anchor: end" y="393.939393939394">40</text></g><line style="fill:none; stroke:#B0B0B0; stroke-width:2; stroke-dasharray:2 4" x1="1000" x2="0" y2="393.939393939394" y1="393.939393939394"/><g id="ylabel" transform="rotate(325, -10, 90.909090909091 )"><text x="-10" style="text-anchor: end" y="90.909090909091">60</text></g><line style="fill:none; stroke:#B0B0B0; stroke-width:2; stroke-dasharray:2 4" x1="1000" x2="0" y2="90.909090909091" y1="90.909090909091"/><g stylet="stroke:red; stroke-width: 3; fill : none;" style=" stroke:green;stroke-width: 3; fill : none; "><line x1="0" y1="787.878787878788" x2="19.6078431372549" y2="712.121212121212"/><line x1="19.6078431372549" y1="712.121212121212" x2="39.2156862745098" y2="60.6060606060605"/><line x1="39.2156862745098" y1="60.6060606060605" x2="58.8235294117647" y2="712.121212121212"/><line x1="58.8235294117647" y1="712.121212121212" x2="78.4313725490196" y2="848.484848484848"/><line x1="78.4313725490196" y1="848.484848484848" x2="98.0392156862745" y2="939.393939393939"/><line x1="98.0392156862745" y1="939.393939393939" x2="117.647058823529" y2="954.545454545455"/><line x1="117.647058823529" y1="954.545454545455" x2="137.254901960784" y2="939.393939393939"/><line x1="137.254901960784" y1="939.393939393939" x2="156.862745098039" y2="863.636363636364"/><line x1="156.862745098039" y1="863.636363636364" x2="176.470588235294" y2="696.969696969697"/><line x1="176.470588235294" y1="696.969696969697" x2="196.078431372549" y2="560.606060606061"/><line x1="196.078431372549" y1="560.606060606061" x2="215.686274509804" y2="787.878787878788"/><line x1="215.686274509804" y1="787.878787878788" x2="235.294117647059" y2="803.030303030303"/><line x1="235.294117647059" y1="803.030303030303" x2="254.901960784314" y2="742.424242424242"/><line x1="254.901960784314" y1="742.424242424242" x2="274.509803921569" y2="772.727272727273"/><line x1="274.509803921569" y1="772.727272727273" x2="294.117647058824" y2="954.545454545455"/><line x1="294.117647058824" y1="954.545454545455" x2="313.725490196078" y2="878.787878787879"/><line x1="313.725490196078" y1="878.787878787879" x2="333.333333333333" y2="893.939393939394"/><line x1="333.333333333333" y1="893.939393939394" x2="352.941176470588" y2="848.484848484848"/><line x1="352.941176470588" y1="848.484848484848" x2="372.549019607843" y2="772.727272727273"/><line x1="372.549019607843" y1="772.727272727273" x2="392.156862745098" y2="863.636363636364"/><line x1="392.156862745098" y1="863.636363636364" x2="411.764705882353" y2="575.757575757576"/><line x1="411.764705882353" y1="575.757575757576" x2="431.372549019608" y2="818.181818181818"/><line x1="431.372549019608" y1="818.181818181818" x2="450.980392156863" y2="878.787878787879"/><line x1="450.980392156863" y1="878.787878787879" x2="470.588235294118" y2="712.121212121212"/><line x1="470.588235294118" y1="712.121212121212" x2="490.196078431373" y2="772.727272727273"/><line x1="490.196078431373" y1="772.727272727273" x2="509.803921568627" y2="439.393939393939"/><line x1="509.803921568627" y1="439.393939393939" x2="529.411764705882" y2="757.575757575758"/><line x1="529.411764705882" y1="757.575757575758" x2="549.019607843137" y2="833.333333333333"/><line x1="549.019607843137" y1="833.333333333333" x2="568.627450980392" y2="909.090909090909"/><line x1="568.627450980392" y1="909.090909090909" x2="588.235294117647" y2="833.333333333333"/><line x1="588.235294117647" y1="833.333333333333" x2="607.843137254902" y2="818.181818181818"/><line x1="607.843137254902" y1="818.181818181818" x2="627.450980392157" y2="893.939393939394"/><line x1="627.450980392157" y1="893.939393939394" x2="647.058823529412" y2="848.484848484848"/><line x1="647.058823529412" y1="848.484848484848" x2="666.666666666667" y2="0"/><line x1="666.666666666667" y1="0" x2="686.274509803922" y2="878.787878787879"/><line x1="686.274509803922" y1="878.787878787879" x2="705.882352941176" y2="515.151515151515"/><line x1="705.882352941176" y1="515.151515151515" x2="725.490196078431" y2="803.030303030303"/><line x1="725.490196078431" y1="803.030303030303" x2="745.098039215686" y2="772.727272727273"/><line x1="745.098039215686" y1="772.727272727273" x2="764.705882352941" y2="757.575757575758"/><line x1="764.705882352941" y1="757.575757575758" x2="784.313725490196" y2="969.69696969697"/></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="-9" y="778.878787878788"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="10.6078431372549" y="703.121212121212"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="30.2156862745098" y="51.6060606060605"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="49.8235294117647" y="703.121212121212"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="69.4313725490196" y="839.484848484848"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="89.0392156862745" y="930.393939393939"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="108.647058823529" y="945.545454545455"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="128.254901960784" y="930.393939393939"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="147.862745098039" y="854.636363636364"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="167.470588235294" y="687.969696969697"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="187.078431372549" y="551.606060606061"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="206.686274509804" y="778.878787878788"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="226.294117647059" y="794.030303030303"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="245.901960784314" y="733.424242424242"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="265.509803921569" y="763.727272727273"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="285.117647058824" y="945.545454545455"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="304.725490196078" y="869.787878787879"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="324.333333333333" y="884.939393939394"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="343.941176470588" y="839.484848484848"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="363.549019607843" y="763.727272727273"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="383.156862745098" y="854.636363636364"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="402.764705882353" y="566.757575757576"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="422.372549019608" y="809.181818181818"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="441.980392156863" y="869.787878787879"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="461.588235294118" y="703.121212121212"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="481.196078431373" y="763.727272727273"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="500.803921568627" y="430.393939393939"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="520.411764705882" y="748.575757575758"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="540.019607843137" y="824.333333333333"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="559.627450980392" y="900.090909090909"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="579.235294117647" y="824.333333333333"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="598.843137254902" y="809.181818181818"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="618.450980392157" y="884.939393939394"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="638.058823529412" y="839.484848484848"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="657.666666666667" y="-9"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="677.274509803922" y="869.787878787879"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="696.882352941176" y="506.151515151515"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="716.490196078431" y="794.030303030303"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="736.098039215686" y="763.727272727273"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="755.705882352941" y="748.575757575758"/></g></g><g style="stroke:green stroke-width: 3; fill : none;"><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="775.313725490196" y="960.69696969697"/></g></g><g id="legend" style="fill:lavenderblush;stroke-width:2;stroke:black" transform="translate(1080,500)"><rect id="legend" x="0" y="0" rx="5" ry="5" width="200" height="49"/><text x="10" y="15" style="text-decoration:underline;stroke-width:1;stroke:black;fill:black">Legend:</text><g onmouseout="HideTooltip(evt)" transform="scale(1)" style=" stroke:green;fill:green" onmouseover=" ShowTooltip(evt,'') "><use xlink:href="#triangle" x="6" y="18"/></g><text x="27" y="35" style="stroke-width:1;stroke:green;fill:green">Contracts</text></g></g><g id="tooltip" style="visibility: hidden"><rect id="ttr" x="0" y="0" rx="5" ry="5" width="100" height="16"/><text id="ttt" x="0" y="0" style="visibility: hidden">dyn. Text</text><text x="-10" y="-10">dyn. Text</text><text x="-10" y="-10">dyn. Text</text><text x="-10" y="-10">dyn. Text</text><text x="-10" y="-10">dyn. Text</text><text x="-10" y="-10">dyn. Text</text></g></svg>
Added: branches/xml-class-rework/projects/bos/statistics/contracts-by-week.lxsl =================================================================== --- branches/xml-class-rework/projects/bos/statistics/contracts-by-week.lxsl 2006-09-24 19:13:31 UTC (rev 1984) +++ branches/xml-class-rework/projects/bos/statistics/contracts-by-week.lxsl 2006-10-14 06:59:35 UTC (rev 1985) @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:loop="http://informatik.hu-berlin.de/loop%22%3E + <xsl:output method="xml"/> + + <xsl:template match="/response"> + <xsl:variable name="year"> + <xsl:value-of select="substring(/response/week[1]/@key, 1, 4)"/> + </xsl:variable> + <xsl:variable name="max_contracts"> + <xsl:for-each select="week"> + <xsl:sort select="@contracts" data-type="number" order="descending"/> + <xsl:if test="position()=1"><xsl:value-of select="@contracts"/></xsl:if> + </xsl:for-each> + </xsl:variable> + <graphData> + <sets> + <set title="Contracts" marker-type="triangle" color="green"> + <xsl:for-each select="week"> + <measure> + <xvalue><xsl:value-of select="substring(@key, 6)"/></xvalue> + <yvalue><xsl:value-of select="@contracts"/></yvalue> + </measure> + </xsl:for-each> + </set> + </sets> + <minx>1</minx> + <maxx>52</maxx> + <miny>0</miny> + <maxy><xsl:value-of select="$max_contracts"/></maxy> + <title>Contracts by week for year <xsl:value-of select="$year"/></title> + <yvalues> + <loop:for name="i" from="20" to="$max_contracts" step="20"> + <yvalue> + <value><xsl:value-of select="$i"/></value> + <label><xsl:value-of select="$i"/></label> + <gridline>true</gridline> + </yvalue> + </loop:for> + </yvalues> + </graphData> + </xsl:template> +</xsl:stylesheet>
Property changes on: branches/xml-class-rework/projects/bos/statistics/contracts-by-week.lxsl ___________________________________________________________________ Name: svn:executable + *
Added: branches/xml-class-rework/projects/bos/statistics/contracts-by-week.xml =================================================================== --- branches/xml-class-rework/projects/bos/statistics/contracts-by-week.xml 2006-09-24 19:13:31 UTC (rev 1984) +++ branches/xml-class-rework/projects/bos/statistics/contracts-by-week.xml 2006-10-14 06:59:35 UTC (rev 1985) @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<graphData xmlns:loop="http://informatik.hu-berlin.de/loop"><sets><set title="Contracts" marker-type="triangle" color="green"><measure><xvalue>1</xvalue><yvalue>14</yvalue></measure><measure><xvalue>2</xvalue><yvalue>19</yvalue></measure><measure><xvalue>3</xvalue><yvalue>62</yvalue></measure><measure><xvalue>4</xvalue><yvalue>19</yvalue></measure><measure><xvalue>5</xvalue><yvalue>10</yvalue></measure><measure><xvalue>6</xvalue><yvalue>4</yvalue></measure><measure><xvalue>7</xvalue><yvalue>3</yvalue></measure><measure><xvalue>8</xvalue><yvalue>4</yvalue></measure><measure><xvalue>9</xvalue><yvalue>9</yvalue></measure><measure><xvalue>10</xvalue><yvalue>20</yvalue></measure><measure><xvalue>11</xvalue><yvalue>29</yvalue></measure><measure><xvalue>12</xvalue><yvalue>14</yvalue></measure><measure><xvalue>13</xvalue><yvalue>13</yvalue></measure><measure><xvalue>14</xvalue><yvalue>17</yvalue></measure><measure><xvalue>15</xvalue><yvalue>15</yvalue></measure><measure><xvalue>16</xvalue><yvalue>3</yvalue></measure><measure><xvalue>17</xvalue><yvalue>8</yvalue></measure><measure><xvalue>18</xvalue><yvalue>7</yvalue></measure><measure><xvalue>19</xvalue><yvalue>10</yvalue></measure><measure><xvalue>20</xvalue><yvalue>15</yvalue></measure><measure><xvalue>21</xvalue><yvalue>9</yvalue></measure><measure><xvalue>22</xvalue><yvalue>28</yvalue></measure><measure><xvalue>23</xvalue><yvalue>12</yvalue></measure><measure><xvalue>24</xvalue><yvalue>8</yvalue></measure><measure><xvalue>25</xvalue><yvalue>19</yvalue></measure><measure><xvalue>26</xvalue><yvalue>15</yvalue></measure><measure><xvalue>27</xvalue><yvalue>37</yvalue></measure><measure><xvalue>28</xvalue><yvalue>16</yvalue></measure><measure><xvalue>29</xvalue><yvalue>11</yvalue></measure><measure><xvalue>30</xvalue><yvalue>6</yvalue></measure><measure><xvalue>31</xvalue><yvalue>11</yvalue></measure><measure><xvalue>32</xvalue><yvalue>12</yvalue></measure><measure><xvalue>33</xvalue><yvalue>7</yvalue></measure><measure><xvalue>34</xvalue><yvalue>10</yvalue></measure><measure><xvalue>35</xvalue><yvalue>66</yvalue></measure><measure><xvalue>36</xvalue><yvalue>8</yvalue></measure><measure><xvalue>37</xvalue><yvalue>32</yvalue></measure><measure><xvalue>38</xvalue><yvalue>13</yvalue></measure><measure><xvalue>39</xvalue><yvalue>15</yvalue></measure><measure><xvalue>40</xvalue><yvalue>16</yvalue></measure><measure><xvalue>41</xvalue><yvalue>2</yvalue></measure></set></sets><minx>1</minx><maxx>52</maxx><miny>0</miny><maxy>66</maxy><title>Contracts by week for year 2006</title><yvalues><yvalue><value>20</value><label>20</label><gridline>true</gridline></yvalue><yvalue><value>40</value><label>40</label><gridline>true</gridline></yvalue><yvalue><value>60</value><label>60</label><gridline>true</gridline></yvalue></yvalues></graphData>
Added: branches/xml-class-rework/projects/bos/statistics/contracts-by-week.xsl =================================================================== --- branches/xml-class-rework/projects/bos/statistics/contracts-by-week.xsl 2006-09-24 19:13:31 UTC (rev 1984) +++ branches/xml-class-rework/projects/bos/statistics/contracts-by-week.xsl 2006-10-14 06:59:35 UTC (rev 1985) @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- + + File generated by translating loops into recursive template calls. + XSLT Loop Compiler, Version 1.0 + GPL (c) O. Becker + + --> +<xsl:stylesheet xmlns:loop="http://informatik.hu-berlin.de/loop" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="xml"/> + + <xsl:template match="/response"> + <xsl:variable name="year"> + <xsl:value-of select="substring(/response/week[1]/@key, 1, 4)"/> + </xsl:variable> + <xsl:variable name="max_contracts"> + <xsl:for-each select="week"> + <xsl:sort select="@contracts" data-type="number" order="descending"/> + <xsl:if test="position()=1"><xsl:value-of select="@contracts"/></xsl:if> + </xsl:for-each> + </xsl:variable> + <graphData> + <sets> + <set title="Contracts" marker-type="triangle" color="green"> + <xsl:for-each select="week"> + <measure> + <xvalue><xsl:value-of select="substring(@key, 6)"/></xvalue> + <yvalue><xsl:value-of select="@contracts"/></yvalue> + </measure> + </xsl:for-each> + </set> + </sets> + <minx>1</minx> + <maxx>52</maxx> + <miny>0</miny> + <maxy><xsl:value-of select="$max_contracts"/></maxy> + <title>Contracts by week for year <xsl:value-of select="$year"/></title> + <yvalues> + <xsl:call-template name="for-loop-id4477040"><xsl:with-param name="i" select="20"/><xsl:with-param name="toid4477040" select="$max_contracts"/><xsl:with-param name="stepid4477040" select="20"/><xsl:with-param name="year" select="$year"/><xsl:with-param name="max_contracts" select="$max_contracts"/></xsl:call-template> + </yvalues> + </graphData> + </xsl:template> +<xsl:template name="for-loop-id4477040"><xsl:param name="i"/><xsl:param name="toid4477040"/><xsl:param name="stepid4477040"/><xsl:param name="year"/><xsl:param name="max_contracts"/> + <yvalue> + <value><xsl:value-of select="$i"/></value> + <label><xsl:value-of select="$i"/></label> + <gridline>true</gridline> + </yvalue> + <xsl:if test="$i+$stepid4477040 <= $toid4477040"><xsl:call-template name="for-loop-id4477040"><xsl:with-param name="i" select="$i + $stepid4477040"/><xsl:with-param name="toid4477040" select="$toid4477040"/><xsl:with-param name="stepid4477040" select="$stepid4477040"/><xsl:with-param name="year" select="$year"/><xsl:with-param name="max_contracts" select="$max_contracts"/></xsl:call-template></xsl:if></xsl:template></xsl:stylesheet>
Property changes on: branches/xml-class-rework/projects/bos/statistics/contracts-by-week.xsl ___________________________________________________________________ Name: svn:executable + *
Added: branches/xml-class-rework/projects/bos/statistics/loop-compiler.xslt =================================================================== --- branches/xml-class-rework/projects/bos/statistics/loop-compiler.xslt 2006-09-24 19:13:31 UTC (rev 1984) +++ branches/xml-class-rework/projects/bos/statistics/loop-compiler.xslt 2006-10-14 06:59:35 UTC (rev 1985) @@ -0,0 +1,504 @@ +<?xml version="1.0"?> + +<!-- + XSLT Loop Compiler, + translates iteration (for and while) into recursion + Version 1.0 + GPL (c) Oliver Becker, 2000-07-06 + obecker@informatik.hu-berlin.de +--> + +<xslt:transform version="1.0" + xmlns:xslt="http://www.w3.org/1999/XSL/Transform" + xmlns:axslt="http://www.w3.org/1999/XSL/Transform/Alias" + xmlns:loop="http://informatik.hu-berlin.de/loop" + exclude-result-prefixes="loop"> + +<xslt:namespace-alias stylesheet-prefix="axslt" result-prefix="xslt" /> + +<xslt:output method="xml" indent="no" encoding="iso-8859-1" /> + + +<xslt:template match="/"> + <!-- first validate ... --> + <xslt:variable name="errors"> + <xslt:apply-templates mode="validate-loops" /> + </xslt:variable> + <xslt:if test="string-length($errors)!=0"> + <xslt:message terminate="yes"> + <xslt:value-of select="string-length($errors)"/> + xslt:text error(s) detected</xslt:text> + </xslt:message> + </xslt:if> + + <!-- ... then generate code --> + xslt:comment + + File generated by translating loops into recursive template calls. + XSLT Loop Compiler, Version 1.0 + GPL (c) O. Becker + + </xslt:comment> + <xslt:apply-templates /> +</xslt:template> + + +<!-- ====================== Validation code ======================= --> + +<xslt:template match="loop:for" mode="validate-loops"> + <xslt:if test="not(@name!='')"> + xslt:message + xslt:textMissing required attribute 'name' of '</xslt:text> + <xslt:value-of select="name()" />' <xslt:text /> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + <xslt:if test="not(@from!='')"> + xslt:message + xslt:textMissing required attribute 'from' of '</xslt:text> + <xslt:value-of select="name()" />' <xslt:text /> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + <xslt:if test="not(@to!='')"> + xslt:message + xslt:textMissing required attribute 'to' of '</xslt:text> + <xslt:value-of select="name()" />' <xslt:text /> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + <xslt:for-each select="@*"> + <xslt:if test="name()!='name' and name()!='from' and + name()!='to' and name()!='step'"> + xslt:message + xslt:textUnknown attribute '</xslt:text> + <xslt:value-of select="name()" /> + xslt:text' of '</xslt:text> + <xslt:value-of select="name(..)" />' <xslt:text /> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + </xslt:for-each> + <xslt:apply-templates mode="validate-loops" /> +</xslt:template> + +<xslt:template match="loop:while" mode="validate-loops"> + <xslt:if test="not(@test!='')"> + xslt:message + xslt:textMissing required attribute 'test' of '</xslt:text> + <xslt:value-of select="name()" />' <xslt:text /> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + <xslt:for-each select="@*"> + <xslt:if test="name()!='test'"> + xslt:message + xslt:textUnknown attribute '</xslt:text> + <xslt:value-of select="name()" /> + xslt:text' of '</xslt:text> + <xslt:value-of select="name(..)" />' <xslt:text /> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + </xslt:for-each> + <xslt:for-each select="*|text()"> + <xslt:if test="not(self::xslt:variable or self::loop:do or + self::loop:last or self::loop:update or + (self::text() and normalize-space(.)=''))" > + xslt:message + xslt:textForbidden </xslt:text> + xslt:choose + <xslt:when test="self::text()"> + xslt:texttext '</xslt:text> + <xslt:value-of select="normalize-space(.)" /> + </xslt:when> + xslt:otherwise + xslt:textelement '</xslt:text> + <xslt:value-of select="name()" /> + </xslt:otherwise> + </xslt:choose> + xslt:text' - expected '</xslt:text> + <xslt:value-of + select="substring-before(name(//xslt:*),':')" /> + xslt:text:variable', '</xslt:text> + <xslt:value-of select="substring-before(name(..),':')" /> + xslt:text:do', '</xslt:text> + <xslt:value-of select="substring-before(name(..),':')" /> + xslt:text:last' or '</xslt:text> + <xslt:value-of select="substring-before(name(..),':')" /> + xslt:text:update'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + </xslt:for-each> + <xslt:if test="not(loop:update)"> + xslt:message + <xslt:text />Warning: '<xslt:value-of select="name()" /> + xslt:text' contains no '</xslt:text> + <xslt:value-of select="substring-before(name(..),':')" /> + xslt:text:update' - infinite loop!</xslt:text> + </xslt:message> + </xslt:if> + <xslt:apply-templates mode="validate-loops" /> +</xslt:template> + +<xslt:template match="loop:while/xslt:variable" mode="validate-loops"> + xslt:choose + <xslt:when test="preceding-sibling::loop:do"> + xslt:message + <xslt:text />'<xslt:value-of select="name()" /> + xslt:text' must not follow a preceding '</xslt:text> + <xslt:value-of select="substring-before(name(..),':')" /> + xslt:text:do'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:when> + <xslt:when test="preceding-sibling::loop:last"> + xslt:message + <xslt:text />'<xslt:value-of select="name()" /> + xslt:text' must not follow a preceding '</xslt:text> + <xslt:value-of select="substring-before(name(..),':')" /> + xslt:text:last'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:when> + <xslt:when test="preceding-sibling::loop:update"> + xslt:message + <xslt:text />'<xslt:value-of select="name()" /> + xslt:text' must not follow a preceding '</xslt:text> + <xslt:value-of select="substring-before(name(..),':')" /> + xslt:text:update'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:when> + </xslt:choose> +</xslt:template> + +<xslt:template match="loop:do | loop:last" mode="validate-loops"> + <xslt:if test="not(parent::loop:while)"> + xslt:message + <xslt:text />'<xslt:value-of select="name()" /> + xslt:text' must be an immediate child of '</xslt:text> + <xslt:value-of select="substring-before(name(),':')" /> + xslt:text:while'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + <xslt:for-each select="@*"> + xslt:message + xslt:textUnknown attribute '</xslt:text> + <xslt:value-of select="name()" /> + xslt:text' of '</xslt:text> + <xslt:value-of select="name(..)" />' <xslt:text /> + </xslt:message> + xslt:text.</xslt:text> + </xslt:for-each> + xslt:choose + <xslt:when test="self::loop:do and preceding-sibling::loop:do"> + xslt:message + <xslt:text />'<xslt:value-of select="name()" /> + xslt:text' must not follow a preceding '</xslt:text> + <xslt:value-of select="substring-before(name(),':')" /> + xslt:text:do'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:when> + <xslt:when test="preceding-sibling::loop:last"> + xslt:message + <xslt:text />'<xslt:value-of select="name()" /> + xslt:text' must not follow a preceding '</xslt:text> + <xslt:value-of select="substring-before(name(),':')" /> + xslt:text:last'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:when> + <xslt:when test="preceding-sibling::loop:update"> + xslt:message + <xslt:text />'<xslt:value-of select="name()" /> + xslt:text' must not follow a preceding '</xslt:text> + <xslt:value-of select="substring-before(name(),':')" /> + xslt:text:update'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:when> + </xslt:choose> + <xslt:apply-templates mode="validate-loops" /> +</xslt:template> + +<xslt:template match="loop:update" mode="validate-loops"> + <xslt:if test="not(parent::loop:for) and not(parent::loop:while)"> + xslt:message + <xslt:text />'<xslt:value-of select="name()" /> + xslt:text' must be an immediate child of '</xslt:text> + <xslt:value-of select="substring-before(name(),':')" /> + xslt:text:for' or '</xslt:text> + <xslt:value-of select="substring-before(name(),':')" /> + xslt:text:while'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + <xslt:if test="not(@name!='')"> + xslt:message + xslt:textMissing required attribute 'name' of '</xslt:text> + <xslt:value-of select="name()" />'xslt:text/ + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + <xslt:for-each select="@*"> + <xslt:if test="name()!='name' and name()!='select'"> + xslt:message + xslt:textUnknown attribute '</xslt:text> + <xslt:value-of select="name()" /> + xslt:text' of '</xslt:text> + <xslt:value-of select="name(..)" />' <xslt:text /> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + </xslt:for-each> + <xslt:if test="preceding-sibling::loop:update + [@name=current()/@name]"> + xslt:message + <xslt:text />'<xslt:value-of select="name()" /> + xslt:text' for variable '</xslt:text> + <xslt:value-of select="@name" /> + xslt:text' already defined</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + <xslt:call-template name="var-wrapper"> + <xslt:with-param name="action" select="'validate-update'" /> + <xslt:with-param name="loop-node" select=".." /> + </xslt:call-template> + <xslt:apply-templates mode="validate-loops" /> +</xslt:template> + +<xslt:template match="loop:*" mode="validate-loops"> + xslt:message + <xslt:text />Unknown element '<xslt:value-of select="name()" /> + xslt:text'</xslt:text> + </xslt:message> + xslt:text.</xslt:text> + <xslt:apply-templates mode="validate-loops" /> +</xslt:template> + +<xslt:template match="text()" mode="validate-loops" /> + +<!-- =================== End of validation ======================== --> + + + +<!-- ================= General template rules ===================== --> + +<xslt:template match="xslt:stylesheet | xslt:transform"> + xslt:copy + <xslt:copy-of select="@*" /> + <xslt:apply-templates /> + <xslt:apply-templates mode="create-templates" /> + </xslt:copy> +</xslt:template> + +<xslt:template match="text()" mode="create-templates" /> + +<xslt:template match="*"> + xslt:copy + <xslt:copy-of select="@*" /> + <xslt:apply-templates /> + </xslt:copy> +</xslt:template> + +<xslt:template match="comment()|processing-instruction()"> + <xslt:copy /> +</xslt:template> + + + +<!-- ========================= for-loop =========================== --> + +<xslt:template match="loop:for"> + <xslt:variable name="step"> + xslt:choose + <xslt:when test="not(@step)">1</xslt:when> + xslt:otherwise + <xslt:value-of select="@step" /> + </xslt:otherwise> + </xslt:choose> + </xslt:variable> + <xslt:variable name="id" select="generate-id()" /> + <axslt:call-template name="for-loop-{$id}"> + <axslt:with-param name="{@name}" select="{@from}" /> + <axslt:with-param name="to{$id}" select="{@to}" /> + <axslt:with-param name="step{$id}" select="{$step}" /> + <xslt:call-template name="var-wrapper"> + <xslt:with-param name="action" + select="'create-call-with-params'" /> + </xslt:call-template> + </axslt:call-template> +</xslt:template> + + +<xslt:template match="loop:for" mode="create-templates"> + <xslt:variable name="id" select="generate-id()" /> + + <axslt:template name="for-loop-{$id}"> + <axslt:param name="{@name}" /> + <axslt:param name="to{$id}" /> + <axslt:param name="step{$id}" /> + <xslt:call-template name="var-wrapper"> + <xslt:with-param name="action" select="'create-loop-params'" /> + </xslt:call-template> + + <xslt:apply-templates /> + + <xslt:variable name="comp-op"> + xslt:choose + <xslt:when test="@step < 0">>=</xslt:when> + xslt:otherwise<=</xslt:otherwise> + </xslt:choose> + </xslt:variable> + + <axslt:if test="${@name}+$step{$id} {$comp-op} $to{$id}"> + <axslt:call-template name="for-loop-{$id}"> + <axslt:with-param name="{@name}" + select="${@name} + $step{$id}" /> + <axslt:with-param name="to{$id}" select="$to{$id}" /> + <axslt:with-param name="step{$id}" select="$step{$id}" /> + <xslt:call-template name="var-wrapper"> + <xslt:with-param name="action" + select="'create-loop-with-params'" /> + </xslt:call-template> + </axslt:call-template> + </axslt:if> + </axslt:template> + + <xslt:apply-templates mode="create-templates" /> +</xslt:template> + +<!-- ============================================================== --> + + + +<!-- ====================== while-loop ============================ --> + +<xslt:template match="loop:while"> + <axslt:call-template name="while-loop-{generate-id()}"> + <xslt:call-template name="var-wrapper"> + <xslt:with-param name="action" + select="'create-call-with-params'" /> + </xslt:call-template> + </axslt:call-template> +</xslt:template> + + +<xslt:template match="loop:while" mode="create-templates"> + <xslt:variable name="id" select="generate-id()" /> + + <axslt:template name="while-loop-{$id}"> + <xslt:call-template name="var-wrapper"> + <xslt:with-param name="action" select="'create-loop-params'" /> + </xslt:call-template> + + <xslt:copy-of select="xslt:variable" /> + axslt:choose + <axslt:when test="{@test}"> + <xslt:apply-templates select="loop:do" /> + <axslt:call-template name="while-loop-{$id}"> + <xslt:call-template name="var-wrapper"> + <xslt:with-param name="action" + select="'create-loop-with-params'" /> + </xslt:call-template> + </axslt:call-template> + </axslt:when> + <xslt:if test="loop:last"> + axslt:otherwise + <xslt:apply-templates select="loop:last" /> + </axslt:otherwise> + </xslt:if> + </axslt:choose> + </axslt:template> + + <xslt:apply-templates mode="create-templates" /> +</xslt:template> + + +<xslt:template match="loop:do | loop:last"> + <xslt:apply-templates /> +</xslt:template> + + +<xslt:template match="loop:update" /> + +<!-- ============================================================== --> + + + +<!-- =================== variable wrapper ========================= --> +<!-- separated because the expression for $vars was a little bit + difficult to determine --> + +<xslt:template name="var-wrapper"> + <xslt:param name="action" /> + <xslt:param name="loop-node" select="." /> + <xslt:variable name="vars" select= + "$loop-node/ancestor-or-self::*/preceding-sibling::xslt:variable + [ancestor::xslt:template] | + $loop-node/ancestor-or-self::*/preceding-sibling::xslt:param + [ancestor::xslt:template] | + $loop-node/ancestor::loop:for" /> + xslt:choose + <xslt:when test="$action='create-call-with-params'"> + <xslt:for-each select="$vars"> + <axslt:with-param name="{@name}" select="${@name}" /> + </xslt:for-each> + </xslt:when> + <xslt:when test="$action='create-loop-params'"> + <xslt:for-each select="$vars"> + <axslt:param name="{@name}" /> + </xslt:for-each> + </xslt:when> + <xslt:when test="$action='create-loop-with-params'"> + <xslt:for-each select="$vars"> + <xslt:variable name="update" + select="$loop-node/loop:update + [@name=current()/@name]" /> + xslt:choose + <xslt:when test="$update"> + <axslt:with-param name="{@name}"> + <xslt:if test="$update/@select"> + <xslt:attribute name="select"> + <xslt:value-of select="$update/@select" /> + </xslt:attribute> + </xslt:if> + <xslt:apply-templates select="$update" + mode="process-update" /> + </axslt:with-param> + </xslt:when> + xslt:otherwise + <axslt:with-param name="{@name}" select="${@name}" /> + </xslt:otherwise> + </xslt:choose> + </xslt:for-each> + </xslt:when> + + <!-- the following is validation code --> + <xslt:when test="$action='validate-update'"> + <xslt:if test="@name and not($vars[@name=current()/@name])"> + xslt:message + xslt:textCannot update variable '</xslt:text> + <xslt:value-of select="@name" /> + xslt:text' - not locally visible at parent node '</xslt:text> + <xslt:value-of select="name(..)" />' <xslt:text /> + </xslt:message> + xslt:text.</xslt:text> + </xslt:if> + </xslt:when> + + </xslt:choose> +</xslt:template> + + +<xslt:template match="loop:update" mode="process-update"> + <xslt:apply-templates /> +</xslt:template> + + +</xslt:transform>
Property changes on: branches/xml-class-rework/projects/bos/statistics/loop-compiler.xslt ___________________________________________________________________ Name: svn:executable + *