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