| 1 | <?xml version="1.0" encoding="UTF-8" ?>
|
|---|
| 2 | <xsl:stylesheet version="1.0"
|
|---|
| 3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|---|
| 4 | xmlns:math="http://exslt.org/math"
|
|---|
| 5 | xmlns:dyn="http://exslt.org/dynamic"
|
|---|
| 6 | xmlns:str="http://exslt.org/strings"
|
|---|
| 7 | xmlns:xalan="http://xml.apache.org/xalan"
|
|---|
| 8 | xmlns:counter="counter"
|
|---|
| 9 |
|
|---|
| 10 | extension-element-prefixes="math dyn str counter">
|
|---|
| 11 |
|
|---|
| 12 | <xalan:component prefix="counter" elements="next">
|
|---|
| 13 | <xalan:script lang="javascript">
|
|---|
| 14 | var counters = {};
|
|---|
| 15 | function next(name){
|
|---|
| 16 | if(!counters[name]){
|
|---|
| 17 | counters[name] = 1;
|
|---|
| 18 | } else {
|
|---|
| 19 | counters[name]+=1;
|
|---|
| 20 | }
|
|---|
| 21 | return counters[name];
|
|---|
| 22 | }
|
|---|
| 23 | </xalan:script>
|
|---|
| 24 | </xalan:component>
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | <xsl:variable name="nl">
|
|---|
| 28 | <xsl:text>
|
|---|
| 29 | </xsl:text>
|
|---|
| 30 | </xsl:variable>
|
|---|
| 31 | <xsl:variable name="dot" select="' • '"/>
|
|---|
| 32 | <xsl:variable name="po-prefix" select="'po-'"/>
|
|---|
| 33 | <xsl:variable name="true-false-replace" select="'truefals'"/>
|
|---|
| 34 | <xsl:variable name="ellipsis" select="'⋯'"/>
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | <xsl:output encoding="UTF-8" method="text"/>
|
|---|
| 38 | <xsl:variable name="maxCountLength" select="string-length(string(count(//domain)))" />
|
|---|
| 39 | <xsl:variable name="maxNameLength" select="dyn:max(//domain, 'string-length(concat(../@id,translate(boolean(substring-after(@id,$po-prefix)),$true-false-replace,$dot),substring-after(@id,$po-prefix)))')" />
|
|---|
| 40 | <xsl:variable name="maxBranchLength" select="dyn:max(//domain, 'string-length(../@branch)')" />
|
|---|
| 41 | <xsl:variable name="maxTranslatedLength" select="string-length(dyn:sum(//domain/translated,'.'))" />
|
|---|
| 42 | <xsl:variable name="maxFuzzzyLength" select="string-length(dyn:sum(//domain/fuzzy,'.'))" />
|
|---|
| 43 | <xsl:variable name="maxUntranslatedLength" select="string-length(dyn:sum(//domain/untranslated,'.'))" />
|
|---|
| 44 | <xsl:variable name="maxAllLength" select="string-length(dyn:sum(//domain/translated,'.')+dyn:sum(//domain/fuzzy,'.')+dyn:sum(//domain/untranslated,'.'))" />
|
|---|
| 45 | <xsl:variable name="maxTodoLength" select="string-length(dyn:sum(//domain/fuzzy,'.')+dyn:sum(//domain/untranslated,'.'))" />
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 | <xsl:template match="/">
|
|---|
| 49 | <!-- DEBUG -->
|
|---|
| 50 | <!--
|
|---|
| 51 | <xsl:value-of select="$maxCountLength"/>@maxCountLength
|
|---|
| 52 | <xsl:value-of select="$maxNameLength"/>@maxNameLength
|
|---|
| 53 | <xsl:value-of select="$maxBranchLength"/>@maxBranchLength
|
|---|
| 54 | <xsl:value-of select="$maxTranslatedLength" />@maxTranslatedLength
|
|---|
| 55 | <xsl:value-of select="$maxFuzzzyLength"/>@maxFuzzzyLength
|
|---|
| 56 | <xsl:value-of select="$maxUntranslatedLength"/>@maxUntranslatedLength
|
|---|
| 57 | <xsl:value-of select="$maxAllLength"/>@maxAllLength
|
|---|
| 58 | <xsl:value-of select="$maxTodoLength"/>@maxTodoLength
|
|---|
| 59 | -->
|
|---|
| 60 | <xsl:call-template name="draw-table">
|
|---|
| 61 | <xsl:with-param name="type" select="'full'"/>
|
|---|
| 62 | </xsl:call-template>
|
|---|
| 63 | <xsl:value-of select="$nl"/>
|
|---|
| 64 | <xsl:value-of select="$nl"/>
|
|---|
| 65 | <xsl:value-of select="$nl"/>
|
|---|
| 66 | <xsl:value-of select="$nl"/>
|
|---|
| 67 | <xsl:value-of select="$nl"/>
|
|---|
| 68 | <xsl:call-template name="draw-table">
|
|---|
| 69 | <xsl:with-param name="type" select="'short'"/>
|
|---|
| 70 | </xsl:call-template>
|
|---|
| 71 | </xsl:template>
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 | <xsl:template name="draw-table">
|
|---|
| 75 | <xsl:param name="type" select="'full'"/><!-- or 'short' -->
|
|---|
| 76 | <!-- DEBUG -->
|
|---|
| 77 | <!--
|
|---|
| 78 | <xsl:value-of select="$type"/>#type
|
|---|
| 79 | -->
|
|---|
| 80 | <xsl:if test="($type != 'full') and ($type != 'short')">
|
|---|
| 81 | <xsl:message>ПРОБЛЕМ В ПОДАДЕНИЯ ПАРАМЕТЪР НА draw-table</xsl:message>
|
|---|
| 82 | </xsl:if>
|
|---|
| 83 |
|
|---|
| 84 | <xsl:variable name="minTodoShown">
|
|---|
| 85 | <xsl:choose>
|
|---|
| 86 | <xsl:when test="$type = 'full'">0</xsl:when>
|
|---|
| 87 | <xsl:otherwise>1</xsl:otherwise>
|
|---|
| 88 | </xsl:choose>
|
|---|
| 89 | </xsl:variable>
|
|---|
| 90 |
|
|---|
| 91 | <xsl:variable name="ellipsisLine">
|
|---|
| 92 | <xsl:choose>
|
|---|
| 93 | <xsl:when test="$type = 'full'"/>
|
|---|
| 94 | <xsl:otherwise>
|
|---|
| 95 | <xsl:call-template name="draw-ellipsis"/>
|
|---|
| 96 | </xsl:otherwise>
|
|---|
| 97 | </xsl:choose>
|
|---|
| 98 | </xsl:variable>
|
|---|
| 99 |
|
|---|
| 100 | <!-- DEBUG -->
|
|---|
| 101 | <!--
|
|---|
| 102 | <xsl:value-of select="$minTodoShown"/>#minTodoShown
|
|---|
| 103 | <xsl:value-of select="$ellipsisLine"/>#ellipsisLine
|
|---|
| 104 | -->
|
|---|
| 105 |
|
|---|
| 106 | <xsl:call-template name="draw-heading"/>
|
|---|
| 107 | <xsl:call-template name="draw-separator"/>
|
|---|
| 108 |
|
|---|
| 109 | <xsl:for-each select="//domain[fuzzy + untranslated >= $minTodoShown]">
|
|---|
| 110 | <xsl:sort order="descending" select="fuzzy + untranslated" data-type="number"/>
|
|---|
| 111 | <xsl:sort order="descending" select="untranslated" data-type="number"/>
|
|---|
| 112 | <xsl:sort order="descending" select="translated + fuzzy + untranslated" data-type="number"/>
|
|---|
| 113 | <xsl:sort order="ascending" select="../@id"/>
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 | <xsl:call-template name="draw-line">
|
|---|
| 117 | <xsl:with-param name="number" select="counter:next($type)"></xsl:with-param>
|
|---|
| 118 | <xsl:with-param name="numberLength" select="$maxCountLength"/>
|
|---|
| 119 | <xsl:with-param name="name" select="concat(../@id,translate(boolean(substring-after(@id,$po-prefix)),$true-false-replace,$dot),substring-after(@id,$po-prefix))"/>
|
|---|
| 120 | <xsl:with-param name="nameLength" select="$maxNameLength"/>
|
|---|
| 121 | <xsl:with-param name="branch" select="../@branch"/>
|
|---|
| 122 | <xsl:with-param name="branchLength" select="$maxBranchLength"/>
|
|---|
| 123 | <xsl:with-param name="translated" select="translated"/>
|
|---|
| 124 | <xsl:with-param name="translatedLength" select="$maxTranslatedLength"/>
|
|---|
| 125 | <xsl:with-param name="fuzzy" select="fuzzy"/>
|
|---|
| 126 | <xsl:with-param name="fuzzyLength" select="$maxFuzzzyLength"/>
|
|---|
| 127 | <xsl:with-param name="untranslated" select="untranslated"/>
|
|---|
| 128 | <xsl:with-param name="untranslatedLength" select="$maxUntranslatedLength"/>
|
|---|
| 129 | <xsl:with-param name="all" select="translated+fuzzy+untranslated"/>
|
|---|
| 130 | <xsl:with-param name="allLength" select="$maxAllLength"/>
|
|---|
| 131 | <xsl:with-param name="todo" select="fuzzy+untranslated"/>
|
|---|
| 132 | <xsl:with-param name="todoLength" select="$maxTodoLength"/>
|
|---|
| 133 | <xsl:with-param name="separator" select="'|'"/>
|
|---|
| 134 | <xsl:with-param name="pad" select="' '"/>
|
|---|
| 135 | </xsl:call-template>
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 | </xsl:for-each>
|
|---|
| 139 |
|
|---|
| 140 | <xsl:value-of select="$ellipsisLine"/>
|
|---|
| 141 |
|
|---|
| 142 | <xsl:call-template name="draw-separator"/>
|
|---|
| 143 | <xsl:call-template name="draw-footer"/>
|
|---|
| 144 | </xsl:template>
|
|---|
| 145 |
|
|---|
| 146 | <xsl:template name="draw-line">
|
|---|
| 147 | <xsl:param name="number"/>
|
|---|
| 148 | <xsl:param name="numberLength"/>
|
|---|
| 149 | <xsl:param name="name"/>
|
|---|
| 150 | <xsl:param name="nameLength"/>
|
|---|
| 151 | <xsl:param name="branch"/>
|
|---|
| 152 | <xsl:param name="branchLength"/>
|
|---|
| 153 | <xsl:param name="translated"/>
|
|---|
| 154 | <xsl:param name="translatedLength"/>
|
|---|
| 155 | <xsl:param name="fuzzy"/>
|
|---|
| 156 | <xsl:param name="fuzzyLength"/>
|
|---|
| 157 | <xsl:param name="untranslated"/>
|
|---|
| 158 | <xsl:param name="untranslatedLength"/>
|
|---|
| 159 | <xsl:param name="all"/>
|
|---|
| 160 | <xsl:param name="allLength"/>
|
|---|
| 161 | <xsl:param name="todo"/>
|
|---|
| 162 | <xsl:param name="todoLength"/>
|
|---|
| 163 | <xsl:param name="separator"/>
|
|---|
| 164 | <xsl:param name="pad"/>
|
|---|
| 165 |
|
|---|
| 166 | <!-- DEBUG -->
|
|---|
| 167 | <!--
|
|---|
| 168 | <xsl:value-of select="$number"/>#number
|
|---|
| 169 | <xsl:value-of select="$numberLength"/>#numberLength
|
|---|
| 170 | <xsl:value-of select="$name"/>#name
|
|---|
| 171 | <xsl:value-of select="$nameLength"/>#nameLength
|
|---|
| 172 | <xsl:value-of select="$branch"/>#branch
|
|---|
| 173 | <xsl:value-of select="$branchLength"/>#branchLength
|
|---|
| 174 | <xsl:value-of select="$translated"/>#translated
|
|---|
| 175 | <xsl:value-of select="$translatedLength"/>#translatedLength
|
|---|
| 176 | <xsl:value-of select="$fuzzy"/>#fuzzy
|
|---|
| 177 | <xsl:value-of select="$fuzzyLength"/>#fuzzyLength
|
|---|
| 178 | <xsl:value-of select="$untranslated"/>#untranslated
|
|---|
| 179 | <xsl:value-of select="$untranslatedLength"/>#untranslatedLength
|
|---|
| 180 | <xsl:value-of select="$all"/>#all
|
|---|
| 181 | <xsl:value-of select="$allLength"/>#allLength
|
|---|
| 182 | <xsl:value-of select="$todo"/>#todo
|
|---|
| 183 | <xsl:value-of select="$todoLength"/>#todoLength
|
|---|
| 184 | <xsl:value-of select="$separator"/>#separator
|
|---|
| 185 | <xsl:value-of select="$pad"/>#pad
|
|---|
| 186 | -->
|
|---|
| 187 |
|
|---|
| 188 | <xsl:value-of select="str:align($number,str:padding($numberLength+1,$pad),'right')"/>
|
|---|
| 189 | <xsl:value-of select="$separator"/>
|
|---|
| 190 | <xsl:value-of select="str:align($name,str:padding($nameLength+1,$pad),'left')"/>
|
|---|
| 191 | <xsl:value-of select="$separator"/>
|
|---|
| 192 | <xsl:value-of select="str:align($branch,str:padding($branchLength+1,$pad),'left')"/>
|
|---|
| 193 | <xsl:value-of select="$separator"/>
|
|---|
| 194 | <xsl:value-of select="str:align($todo,str:padding($todoLength+1,$pad),'right')"/>
|
|---|
| 195 | <xsl:value-of select="$separator"/>
|
|---|
| 196 | <xsl:value-of select="str:align($untranslated,str:padding($untranslatedLength+1,$pad),'right')"/>
|
|---|
| 197 | <xsl:value-of select="$separator"/>
|
|---|
| 198 | <xsl:value-of select="str:align($fuzzy,str:padding($fuzzyLength+1,$pad),'right')"/>
|
|---|
| 199 | <xsl:value-of select="$separator"/>
|
|---|
| 200 | <xsl:value-of select="str:align($translated,str:padding($translatedLength+1,$pad),'right')"/>
|
|---|
| 201 | <xsl:value-of select="$separator"/>
|
|---|
| 202 | <xsl:value-of select="str:align($all,str:padding($allLength+1,$pad),'right')"/>
|
|---|
| 203 | <xsl:value-of select="$nl"/>
|
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 | </xsl:template>
|
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 | <xsl:template name="draw-separator">
|
|---|
| 210 | <xsl:call-template name="draw-line">
|
|---|
| 211 | <xsl:with-param name="number" select="''"/>
|
|---|
| 212 | <xsl:with-param name="numberLength" select="$maxCountLength"/>
|
|---|
| 213 | <xsl:with-param name="name" select="''"/>
|
|---|
| 214 | <xsl:with-param name="nameLength" select="$maxNameLength"/>
|
|---|
| 215 | <xsl:with-param name="branch" select="''"/>
|
|---|
| 216 | <xsl:with-param name="branchLength" select="$maxBranchLength"/>
|
|---|
| 217 | <xsl:with-param name="translated" select="''"/>
|
|---|
| 218 | <xsl:with-param name="translatedLength" select="$maxTranslatedLength"/>
|
|---|
| 219 | <xsl:with-param name="fuzzy" select="''"/>
|
|---|
| 220 | <xsl:with-param name="fuzzyLength" select="$maxFuzzzyLength"/>
|
|---|
| 221 | <xsl:with-param name="untranslated" select="''"/>
|
|---|
| 222 | <xsl:with-param name="untranslatedLength" select="$maxUntranslatedLength"/>
|
|---|
| 223 | <xsl:with-param name="all" select="''"/>
|
|---|
| 224 | <xsl:with-param name="allLength" select="$maxAllLength"/>
|
|---|
| 225 | <xsl:with-param name="todo" select="''"/>
|
|---|
| 226 | <xsl:with-param name="todoLength" select="$maxTodoLength"/>
|
|---|
| 227 | <xsl:with-param name="separator" select="'+'"/>
|
|---|
| 228 | <xsl:with-param name="pad" select="'-'"/>
|
|---|
| 229 | </xsl:call-template>
|
|---|
| 230 | </xsl:template>
|
|---|
| 231 |
|
|---|
| 232 | <xsl:template name="draw-heading">
|
|---|
| 233 | <xsl:call-template name="draw-line">
|
|---|
| 234 | <xsl:with-param name="number" select="'Номер'"/>
|
|---|
| 235 | <xsl:with-param name="numberLength" select="$maxCountLength"/>
|
|---|
| 236 | <xsl:with-param name="name" select="'Име'"/>
|
|---|
| 237 | <xsl:with-param name="nameLength" select="$maxNameLength"/>
|
|---|
| 238 | <xsl:with-param name="branch" select="'Клон'"/>
|
|---|
| 239 | <xsl:with-param name="branchLength" select="$maxBranchLength"/>
|
|---|
| 240 | <xsl:with-param name="translated" select="'Преведени'"/>
|
|---|
| 241 | <xsl:with-param name="translatedLength" select="$maxTranslatedLength"/>
|
|---|
| 242 | <xsl:with-param name="fuzzy" select="'Мъгляви'"/>
|
|---|
| 243 | <xsl:with-param name="fuzzyLength" select="$maxFuzzzyLength"/>
|
|---|
| 244 | <xsl:with-param name="untranslated" select="'Непреведени'"/>
|
|---|
| 245 | <xsl:with-param name="untranslatedLength" select="$maxUntranslatedLength"/>
|
|---|
| 246 | <xsl:with-param name="all" select="'Всичко'"/>
|
|---|
| 247 | <xsl:with-param name="allLength" select="$maxAllLength"/>
|
|---|
| 248 | <xsl:with-param name="todo" select="'Работа'"/>
|
|---|
| 249 | <xsl:with-param name="todoLength" select="$maxTodoLength"/>
|
|---|
| 250 | <xsl:with-param name="separator" select="'|'"/>
|
|---|
| 251 | <xsl:with-param name="pad" select="' '"/>
|
|---|
| 252 | </xsl:call-template>
|
|---|
| 253 | </xsl:template>
|
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 | <xsl:template name="draw-footer">
|
|---|
| 257 | <xsl:call-template name="draw-line">
|
|---|
| 258 | <xsl:with-param name="number" select="''"/>
|
|---|
| 259 | <xsl:with-param name="numberLength" select="$maxCountLength"/>
|
|---|
| 260 | <xsl:with-param name="name" select="'Общо'"/>
|
|---|
| 261 | <xsl:with-param name="nameLength" select="$maxNameLength"/>
|
|---|
| 262 | <xsl:with-param name="branch" select="''"/>
|
|---|
| 263 | <xsl:with-param name="branchLength" select="$maxBranchLength"/>
|
|---|
| 264 | <xsl:with-param name="translated" select="dyn:sum(//domain/translated,'.')"/>
|
|---|
| 265 | <xsl:with-param name="translatedLength" select="$maxTranslatedLength"/>
|
|---|
| 266 | <xsl:with-param name="fuzzy" select="dyn:sum(//domain/fuzzy,'.')"/>
|
|---|
| 267 | <xsl:with-param name="fuzzyLength" select="$maxFuzzzyLength"/>
|
|---|
| 268 | <xsl:with-param name="untranslated" select="dyn:sum(//domain/untranslated,'.')"/>
|
|---|
| 269 | <xsl:with-param name="untranslatedLength" select="$maxUntranslatedLength"/>
|
|---|
| 270 | <xsl:with-param name="all" select="dyn:sum(//domain/translated,'.')+dyn:sum(//domain/fuzzy,'.')+dyn:sum(//domain/untranslated,'.')"/>
|
|---|
| 271 | <xsl:with-param name="allLength" select="$maxAllLength"/>
|
|---|
| 272 | <xsl:with-param name="todo" select="dyn:sum(//domain/fuzzy,'.')+dyn:sum(//domain/untranslated,'.')"/>
|
|---|
| 273 | <xsl:with-param name="todoLength" select="$maxTodoLength"/>
|
|---|
| 274 | <xsl:with-param name="separator" select="'|'"/>
|
|---|
| 275 | <xsl:with-param name="pad" select="' '"/>
|
|---|
| 276 | </xsl:call-template>
|
|---|
| 277 | </xsl:template>
|
|---|
| 278 |
|
|---|
| 279 | <xsl:template name="draw-ellipsis">
|
|---|
| 280 | <xsl:call-template name="draw-line">
|
|---|
| 281 | <xsl:with-param name="number" select="''"/>
|
|---|
| 282 | <xsl:with-param name="numberLength" select="$maxCountLength"/>
|
|---|
| 283 | <xsl:with-param name="name" select="''"/>
|
|---|
| 284 | <xsl:with-param name="nameLength" select="$maxNameLength"/>
|
|---|
| 285 | <xsl:with-param name="branch" select="''"/>
|
|---|
| 286 | <xsl:with-param name="branchLength" select="$maxBranchLength"/>
|
|---|
| 287 | <xsl:with-param name="translated" select="''"/>
|
|---|
| 288 | <xsl:with-param name="translatedLength" select="$maxTranslatedLength"/>
|
|---|
| 289 | <xsl:with-param name="fuzzy" select="''"/>
|
|---|
| 290 | <xsl:with-param name="fuzzyLength" select="$maxFuzzzyLength"/>
|
|---|
| 291 | <xsl:with-param name="untranslated" select="''"/>
|
|---|
| 292 | <xsl:with-param name="untranslatedLength" select="$maxUntranslatedLength"/>
|
|---|
| 293 | <xsl:with-param name="all" select="''"/>
|
|---|
| 294 | <xsl:with-param name="allLength" select="$maxAllLength"/>
|
|---|
| 295 | <xsl:with-param name="todo" select="''"/>
|
|---|
| 296 | <xsl:with-param name="todoLength" select="$maxTodoLength"/>
|
|---|
| 297 | <xsl:with-param name="separator" select="'|'"/>
|
|---|
| 298 | <xsl:with-param name="pad" select="$ellipsis"/>
|
|---|
| 299 | </xsl:call-template>
|
|---|
| 300 | </xsl:template>
|
|---|
| 301 |
|
|---|
| 302 | </xsl:stylesheet>
|
|---|