ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
| 2 | <xsl:stylesheet version="1.0" |
| 3 | xmlns:svg="http://www.w3.org/2000/svg" |
| 4 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 5 | xmlns:component="http://www.eclipse.org/component" |
| 6 | xmlns:func="http://exslt.org/functions" |
| 7 | extension-element-prefixes="func"> |
| 8 | |
| 9 | <xsl:template match="/"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 10 | <xsl:apply-templates select="root"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 11 | </xsl:template> |
| 12 | |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 13 | <xsl:template match="root"> |
| 14 | <xsl:variable name="xcount" select="component:max(count(summary), 10)"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 15 | <xsl:variable name="ycount" select="10"/> |
| 16 | <xsl:variable name="leftborder" select="150"/> |
| 17 | <xsl:variable name="rightborder" select="50"/> |
| 18 | <xsl:variable name="topborder" select="60"/> |
| 19 | <xsl:variable name="bottomborder" select="100"/> |
| 20 | <xsl:variable name="gridwidth" select="50"/> |
| 21 | <xsl:variable name="gridheight" select="30"/> |
| 22 | <xsl:variable name="svgwidth" select="$leftborder + $rightborder + ($xcount * $gridwidth)"/> |
| 23 | <xsl:variable name="svgheight" select="$topborder + $bottomborder + ($ycount * $gridheight)"/> |
| 24 | |
| 25 | <svg width="{$svgwidth}" height="{$svgheight}" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"> |
| 26 | <defs> |
| 27 | <pattern id="grid" width="{$gridwidth}" height="{$gridheight}" patternUnits="userSpaceOnUse"> |
| 28 | <path d="M{$gridwidth} 0 L0 0 L0 {$gridheight}" style="fill:none;stroke:rgb(128,128,128);stroke-width:1"/> |
| 29 | </pattern> |
| 30 | </defs> |
| 31 | <rect id="graph" x="{$leftborder}" y="{$topborder}" width="{$xcount * $gridwidth}" height="{$ycount * $gridheight}" style="stroke:rgb(128,128,128);stroke-width:1;fill:url(#grid)"/> |
| 32 | |
| 33 | <text x="{$svgwidth div 2}" y="{$topborder div 2}" style="text-anchor:middle"><xsl:value-of select="@name"/></text> |
| 34 | <text x="{$leftborder div 2}" y="{$topborder + ($ycount * $gridheight div 2)}" style="text-anchor:middle">% completed</text> |
| 35 | <text x="{$leftborder + ($xcount * $gridwidth div 2)}" y="{$svgheight - ($bottomborder div 2)}" style="text-anchor:middle">Date</text> |
| 36 | |
| 37 | <xsl:call-template name="printLegend"> |
| 38 | <xsl:with-param name="x" select="$rightborder div 2"/> |
| 39 | <xsl:with-param name="y" select="$svgheight - ($bottomborder div 2)"/> |
| 40 | </xsl:call-template> |
| 41 | |
| 42 | <xsl:call-template name="printyscale"> |
| 43 | <xsl:with-param name="svgheight" select="$svgheight"/> |
| 44 | <xsl:with-param name="leftborder" select="$leftborder"/> |
| 45 | <xsl:with-param name="bottomborder" select="$bottomborder"/> |
| 46 | <xsl:with-param name="gridheight" select="$gridheight"/> |
| 47 | <xsl:with-param name="y" select="0"/> |
| 48 | <xsl:with-param name="ycount" select="$ycount"/> |
| 49 | </xsl:call-template> |
| 50 | |
| 51 | <xsl:call-template name="printProgress"> |
| 52 | <xsl:with-param name="root" select="."/> |
| 53 | <xsl:with-param name="componentname" select="@name"/> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 54 | <xsl:with-param name="tscount" select="count(summary)"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 55 | <xsl:with-param name="currIndex" select="1"/> |
| 56 | <xsl:with-param name="xorigin" select="$leftborder"/> |
| 57 | <xsl:with-param name="yorigin" select="$svgheight - $bottomborder"/> |
| 58 | <xsl:with-param name="gridwidth" select="$gridwidth"/> |
| 59 | <xsl:with-param name="percentwidth" select="$ycount * $gridheight div 100"/> |
| 60 | </xsl:call-template> |
| 61 | </svg> |
| 62 | </xsl:template> |
| 63 | |
| 64 | <xsl:template name="printProgress"> |
| 65 | <xsl:param name="root"/> |
| 66 | <xsl:param name="componentname"/> |
| 67 | <xsl:param name="tscount"/> |
| 68 | <xsl:param name="currIndex"/> |
| 69 | <xsl:param name="xorigin"/> |
| 70 | <xsl:param name="yorigin"/> |
| 71 | <xsl:param name="gridwidth"/> |
| 72 | <xsl:param name="percentwidth"/> |
| 73 | <xsl:choose> |
| 74 | <xsl:when test="$tscount > $currIndex"> |
| 75 | <xsl:call-template name="printProgress2"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 76 | <xsl:with-param name="curr-api-info" select="document(concat($root/summary[$currIndex]/@timestamp, '/api-info-summary.xml'))/api-info-summary/api-info[@name=$componentname or concat('org.eclipse.', @name)=$componentname]"/> |
| 77 | <xsl:with-param name="next-api-info" select="document(concat($root/summary[$currIndex + 1]/@timestamp, '/api-info-summary.xml'))/api-info-summary/api-info[@name=$componentname or concat('org.eclipse.', @name)=$componentname]"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 78 | <xsl:with-param name="currIndex" select="$currIndex"/> |
| 79 | <xsl:with-param name="xorigin" select="$xorigin"/> |
| 80 | <xsl:with-param name="yorigin" select="$yorigin"/> |
| 81 | <xsl:with-param name="gridwidth" select="$gridwidth"/> |
| 82 | <xsl:with-param name="percentwidth" select="$percentwidth"/> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 83 | <xsl:with-param name="date" select="$root/summary[$currIndex]/@timestamp"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 84 | </xsl:call-template> |
| 85 | <xsl:call-template name="printProgress"> |
| 86 | <xsl:with-param name="root" select="$root"/> |
| 87 | <xsl:with-param name="componentname" select="$componentname"/> |
| 88 | <xsl:with-param name="tscount" select="$tscount"/> |
| 89 | <xsl:with-param name="currIndex" select="$currIndex + 1"/> |
| 90 | <xsl:with-param name="xorigin" select="$xorigin"/> |
| 91 | <xsl:with-param name="yorigin" select="$yorigin"/> |
| 92 | <xsl:with-param name="gridwidth" select="$gridwidth"/> |
| 93 | <xsl:with-param name="percentwidth" select="$percentwidth"/> |
| 94 | </xsl:call-template> |
| 95 | </xsl:when> |
| 96 | <xsl:otherwise> |
| 97 | <xsl:call-template name="printProgress2"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 98 | <xsl:with-param name="curr-api-info" select="document(concat($root/summary[$currIndex]/@timestamp, '/api-info-summary.xml'))/api-info-summary/api-info[@name=$componentname or concat('org.eclipse.', @name)=$componentname]"/> |
| 99 | <xsl:with-param name="next-api-info" select="-1"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 100 | <xsl:with-param name="currIndex" select="$currIndex"/> |
| 101 | <xsl:with-param name="xorigin" select="$xorigin"/> |
| 102 | <xsl:with-param name="yorigin" select="$yorigin"/> |
| 103 | <xsl:with-param name="gridwidth" select="$gridwidth"/> |
| 104 | <xsl:with-param name="percentwidth" select="$percentwidth"/> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 105 | <xsl:with-param name="date" select="$root/summary[$currIndex]/@timestamp"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 106 | </xsl:call-template> |
| 107 | </xsl:otherwise> |
| 108 | </xsl:choose> |
| 109 | </xsl:template> |
| 110 | |
| 111 | <xsl:template name="printProgress2"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 112 | <xsl:param name="curr-api-info"/> |
| 113 | <xsl:param name="next-api-info"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 114 | <xsl:param name="currIndex"/> |
| 115 | <xsl:param name="xorigin"/> |
| 116 | <xsl:param name="yorigin"/> |
| 117 | <xsl:param name="gridwidth"/> |
| 118 | <xsl:param name="percentwidth"/> |
| 119 | <xsl:param name="date"/> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 120 | <xsl:variable name="currapicount" select="$curr-api-info/@method-count"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 121 | <xsl:variable name="currx" select="$xorigin + ($currIndex * $gridwidth)"/> |
| 122 | <xsl:variable name="hundredpercent" select="$yorigin - (100 * $percentwidth)"/> |
| 123 | <svg:text x="{$currx}" y="{$yorigin + 15 + (($currIndex + 1) mod 2 * 15)}" style="text-anchor:middle"><xsl:value-of select="$date"/></svg:text> |
| 124 | <xsl:choose> |
| 125 | <xsl:when test="$currapicount > 0"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 126 | <xsl:variable name="currtestcount" select="$curr-api-info/@method-tested"/> |
| 127 | <xsl:variable name="currjavadoccount" select="$curr-api-info/@method-javadoced"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 128 | <xsl:variable name="currtestpercent" select="$currtestcount div $currapicount * 100"/> |
| 129 | <xsl:variable name="currjavadocpercent" select="$currjavadoccount div $currapicount * 100"/> |
| 130 | <xsl:variable name="currtesty" select="$yorigin - round($currtestpercent * $percentwidth)"/> |
| 131 | <xsl:variable name="currjavadocy" select="$yorigin - round($currjavadocpercent * $percentwidth)"/> |
| 132 | |
| 133 | <svg:circle cx="{$currx}" cy="{$currtesty}" r="3" fill="blue"/> |
| 134 | <svg:text x="{$currx}" y="{$currtesty - 23}" style="text-anchor:middle"><xsl:value-of select="$currtestcount"/>/<xsl:value-of select="$currapicount"/></svg:text> |
| 135 | <svg:text x="{$currx}" y="{$currtesty - 10}" style="text-anchor:middle">(<xsl:value-of select="round($currtestpercent)"/>%)</svg:text> |
| 136 | |
| 137 | <svg:circle cx="{$currx}" cy="{$currjavadocy}" r="3" fill="orange"/> |
| 138 | <svg:text x="{$currx}" y="{$currjavadocy - 23}" style="text-anchor:middle"><xsl:value-of select="$currjavadoccount"/>/<xsl:value-of select="$currapicount"/></svg:text> |
| 139 | <svg:text x="{$currx}" y="{$currjavadocy - 10}" style="text-anchor:middle">(<xsl:value-of select="round($currjavadocpercent)"/>%)</svg:text> |
| 140 | |
| 141 | <xsl:call-template name="printProgress3"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 142 | <xsl:with-param name="next-api-info" select="$next-api-info"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 143 | <xsl:with-param name="currIndex" select="$currIndex"/> |
| 144 | <xsl:with-param name="xorigin" select="$xorigin"/> |
| 145 | <xsl:with-param name="yorigin" select="$yorigin"/> |
| 146 | <xsl:with-param name="gridwidth" select="$gridwidth"/> |
| 147 | <xsl:with-param name="percentwidth" select="$percentwidth"/> |
| 148 | <xsl:with-param name="currx" select="$currx"/> |
| 149 | <xsl:with-param name="currtesty" select="$currtesty"/> |
| 150 | <xsl:with-param name="currjavadocy" select="$currjavadocy"/> |
| 151 | <xsl:with-param name="hundredpercent" select="$hundredpercent"/> |
| 152 | </xsl:call-template> |
| 153 | </xsl:when> |
| 154 | <xsl:otherwise> |
| 155 | <svg:circle cx="{$currx}" cy="{$hundredpercent}" r="3" fill="blue"/> |
| 156 | <svg:circle cx="{$currx}" cy="{$hundredpercent}" r="3" fill="orange"/> |
| 157 | <svg:text x="{$currx}" y="{$hundredpercent - 8}" style="text-anchor:middle">No API</svg:text> |
| 158 | <xsl:call-template name="printProgress3"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 159 | <xsl:with-param name="next-api-info" select="$next-api-info"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 160 | <xsl:with-param name="currIndex" select="$currIndex"/> |
| 161 | <xsl:with-param name="xorigin" select="$xorigin"/> |
| 162 | <xsl:with-param name="yorigin" select="$yorigin"/> |
| 163 | <xsl:with-param name="gridwidth" select="$gridwidth"/> |
| 164 | <xsl:with-param name="percentwidth" select="$percentwidth"/> |
| 165 | <xsl:with-param name="currx" select="$currx"/> |
| 166 | <xsl:with-param name="currtesty" select="$hundredpercent"/> |
| 167 | <xsl:with-param name="currjavadocy" select="$hundredpercent"/> |
| 168 | <xsl:with-param name="hundredpercent" select="$hundredpercent"/> |
| 169 | </xsl:call-template> |
| 170 | </xsl:otherwise> |
| 171 | </xsl:choose> |
| 172 | </xsl:template> |
| 173 | |
| 174 | <xsl:template name="printProgress3"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 175 | <xsl:param name="next-api-info"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 176 | <xsl:param name="currIndex"/> |
| 177 | <xsl:param name="xorigin"/> |
| 178 | <xsl:param name="yorigin"/> |
| 179 | <xsl:param name="gridwidth"/> |
| 180 | <xsl:param name="percentwidth"/> |
| 181 | <xsl:param name="currx"/> |
| 182 | <xsl:param name="currtesty"/> |
| 183 | <xsl:param name="currjavadocy"/> |
| 184 | <xsl:param name="hundredpercent"/> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 185 | <xsl:if test="$next-api-info != -1"> |
| 186 | <xsl:variable name="nextapicount" select="$next-api-info/@method-count"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 187 | <xsl:variable name="nextx" select="$xorigin + (($currIndex + 1) * $gridwidth)"/> |
| 188 | <xsl:choose> |
| 189 | <xsl:when test="$nextapicount > 0"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 190 | <xsl:variable name="nexttestcount" select="$next-api-info/@method-tested"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 191 | <xsl:variable name="nexttestpercent" select="$nexttestcount div $nextapicount * 100"/> |
| 192 | <xsl:variable name="nexttesty" select="$yorigin - round($nexttestpercent * $percentwidth)"/> |
| 193 | <svg:line x1="{$currx}" y1="{$currtesty}" x2="{$nextx}" y2="{$nexttesty}" style="stroke:blue;stroke-width:1"/> |
| 194 | </xsl:when> |
| 195 | <xsl:otherwise> |
| 196 | <svg:line x1="{$currx}" y1="{$currtesty}" x2="{$nextx}" y2="{$hundredpercent}" style="stroke:blue;stroke-width:1"/> |
| 197 | </xsl:otherwise> |
| 198 | </xsl:choose> |
| 199 | </xsl:if> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 200 | <xsl:if test="$next-api-info != -1"> |
| 201 | <xsl:variable name="nextapicount" select="$next-api-info/@method-count"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 202 | <xsl:variable name="nextx" select="$xorigin + (($currIndex + 1) * $gridwidth)"/> |
| 203 | <xsl:choose> |
| 204 | <xsl:when test="$nextapicount > 0"> |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 205 | <xsl:variable name="nextjavadoccount" select="$next-api-info/@method-javadoced"/> |
ndai | a5b2766 | 2005-07-09 19:41:27 +0000 | [diff] [blame] | 206 | <xsl:variable name="nextjavadocpercent" select="$nextjavadoccount div $nextapicount * 100"/> |
| 207 | <xsl:variable name="nextjavadocy" select="$yorigin - round($nextjavadocpercent * $percentwidth)"/> |
| 208 | <svg:line x1="{$currx}" y1="{$currjavadocy}" x2="{$nextx}" y2="{$nextjavadocy}" style="stroke:orange;stroke-width:1"/> |
| 209 | </xsl:when> |
| 210 | <xsl:otherwise> |
| 211 | <svg:line x1="{$currx}" y1="{$currjavadocy}" x2="{$nextx}" y2="{$hundredpercent}" style="stroke:orange;stroke-width:1"/> |
| 212 | </xsl:otherwise> |
| 213 | </xsl:choose> |
| 214 | </xsl:if> |
| 215 | </xsl:template> |
| 216 | |
| 217 | <func:function name="component:max"> |
| 218 | <xsl:param name="x"/> |
| 219 | <xsl:param name="y"/> |
| 220 | <xsl:choose> |
| 221 | <xsl:when test="$x > $y"> |
| 222 | <func:result select="$x"/> |
| 223 | </xsl:when> |
| 224 | <xsl:otherwise> |
| 225 | <func:result select="$y"/> |
| 226 | </xsl:otherwise> |
| 227 | </xsl:choose> |
| 228 | </func:function> |
| 229 | |
| 230 | <xsl:template name="printLegend"> |
| 231 | <xsl:param name="x"/> |
| 232 | <xsl:param name="y"/> |
| 233 | <svg:line x1="{$x}" y1="{$y}" x2="{$x + 50}" y2="{$y}" style="stroke:blue;stroke-width:1"/> |
| 234 | <svg:text x="{$x + 55}" y="{$y}" fill="blue">JUnit</svg:text> |
| 235 | <svg:line x1="{$x}" y1="{$y + 20}" x2="{$x + 50}" y2="{$y + 20}" style="stroke:orange;stroke-width:1"/> |
| 236 | <svg:text x="{$x + 55}" y="{$y + 20}" fill="orange">Javadoc</svg:text> |
| 237 | </xsl:template> |
| 238 | |
| 239 | <xsl:template name="printyscale"> |
| 240 | <xsl:param name="svgheight"/> |
| 241 | <xsl:param name="leftborder"/> |
| 242 | <xsl:param name="bottomborder"/> |
| 243 | <xsl:param name="gridheight"/> |
| 244 | <xsl:param name="y"/> |
| 245 | <xsl:param name="ycount"/> |
| 246 | <xsl:if test="$y <= $ycount"> |
| 247 | <xsl:call-template name="printyscale2"> |
| 248 | <xsl:with-param name="svgheight" select="$svgheight"/> |
| 249 | <xsl:with-param name="leftborder" select="$leftborder"/> |
| 250 | <xsl:with-param name="bottomborder" select="$bottomborder"/> |
| 251 | <xsl:with-param name="gridheight" select="$gridheight"/> |
| 252 | <xsl:with-param name="y" select="$y"/> |
| 253 | <xsl:with-param name="ycount" select="$ycount"/> |
| 254 | </xsl:call-template> |
| 255 | <xsl:call-template name="printyscale"> |
| 256 | <xsl:with-param name="svgheight" select="$svgheight"/> |
| 257 | <xsl:with-param name="leftborder" select="$leftborder"/> |
| 258 | <xsl:with-param name="bottomborder" select="$bottomborder"/> |
| 259 | <xsl:with-param name="gridheight" select="$gridheight"/> |
| 260 | <xsl:with-param name="y" select="$y + 1"/> |
| 261 | <xsl:with-param name="ycount" select="$ycount"/> |
| 262 | </xsl:call-template> |
| 263 | </xsl:if> |
| 264 | </xsl:template> |
| 265 | |
| 266 | <xsl:template name="printyscale2"> |
| 267 | <xsl:param name="svgheight"/> |
| 268 | <xsl:param name="leftborder"/> |
| 269 | <xsl:param name="bottomborder"/> |
| 270 | <xsl:param name="gridheight"/> |
| 271 | <xsl:param name="y"/> |
| 272 | <xsl:param name="ycount"/> |
| 273 | <text x="{$leftborder - 20}" y="{$svgheight - $bottomborder - ($y * $gridheight)}"><xsl:value-of select="$y * $ycount"/></text> |
| 274 | </xsl:template> |
| 275 | |
jeffliu | ff5aca0 | 2005-11-25 21:52:00 +0000 | [diff] [blame] | 276 | </xsl:stylesheet> |