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