| 1 |
<?xml version='1.0'?> |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 8 |
xmlns:fo="http://www.w3.org/1999/XSL/Format" |
| 9 |
version='1.0'> |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
<xsl:template match="*[contains(@class,' topic/simpletable ')]"> |
| 15 |
<fo:block space-before="12pt"> |
| 16 |
<fo:table xsl:use-attribute-sets="table.data frameall"> |
| 17 |
<xsl:call-template name="semtbl-colwidth"/> |
| 18 |
<fo:table-body> |
| 19 |
<xsl:call-template name="gen-dflt-data-hdr"/> |
| 20 |
<xsl:apply-templates/> |
| 21 |
</fo:table-body> |
| 22 |
</fo:table> |
| 23 |
</fo:block> |
| 24 |
</xsl:template> |
| 25 |
|
| 26 |
|
| 27 |
<xsl:template name="gen-dflt-data-hdr"> |
| 28 |
<xsl:if test="*/*[contains(@class,' topic/stentry ')]/@specentry"> |
| 29 |
<fo:table-row> |
| 30 |
<xsl:for-each select="*[contains(@class,' topic/strow ')][1]/*"> |
| 31 |
<fo:table-cell start-indent="2pt" background-color="silver" padding="2pt" text-align= |
| 32 |
"center" font-weight="bold" xsl:use-attribute-sets="frameall"> |
| 33 |
<xsl:attribute name="column-number"><xsl:number count="*"/></xsl:attribute> |
| 34 |
<fo:block> |
| 35 |
<xsl:value-of select="@specentry"/> |
| 36 |
</fo:block> |
| 37 |
</fo:table-cell> |
| 38 |
</xsl:for-each> |
| 39 |
</fo:table-row> |
| 40 |
</xsl:if> |
| 41 |
</xsl:template> |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
<xsl:template name="semtbl-colwidth"> |
| 46 |
|
| 47 |
|
| 48 |
<xsl:variable name="totalwidth"> |
| 49 |
<xsl:if test="@relcolwidth and not(@relcolwidth='')"> |
| 50 |
<xsl:call-template name="find-total-table-width"/> |
| 51 |
</xsl:if> |
| 52 |
</xsl:variable> |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
<xsl:variable name="width-multiplier"> |
| 58 |
<xsl:choose> |
| 59 |
<xsl:when test="@relcolwidth and not(@relcolwidth='')"> |
| 60 |
<xsl:value-of select="100 div $totalwidth"/> |
| 61 |
</xsl:when> |
| 62 |
<xsl:otherwise>0</xsl:otherwise> |
| 63 |
</xsl:choose> |
| 64 |
</xsl:variable> |
| 65 |
|
| 66 |
|
| 67 |
<xsl:for-each select="*[contains(@class,' topic/strow ')][1]/*"> |
| 68 |
|
| 69 |
<xsl:variable name="thiscolnum"><xsl:value-of select="position()"/></xsl:variable> |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
<fo:table-column> |
| 75 |
<xsl:if test="../../@relcolwidth and not(../../@relcolwidth='')"> |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
<xsl:attribute name="column-width">proportional-column-width(<xsl:call-template name="get-proportional-width"> |
| 87 |
<xsl:with-param name="entry-num"><xsl:value-of select="$thiscolnum"/></xsl:with-param> |
| 88 |
<xsl:with-param name="all-widths"><xsl:value-of select="../../@relcolwidth"/></xsl:with-param> |
| 89 |
</xsl:call-template>)</xsl:attribute> |
| 90 |
</xsl:if> |
| 91 |
</fo:table-column> |
| 92 |
</xsl:for-each> |
| 93 |
</xsl:template> |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
<xsl:template name="get-proportional-width"> |
| 99 |
<xsl:param name="entry-num">0</xsl:param> |
| 100 |
<xsl:param name="all-widths"><xsl:value-of select="../@relcolwidth"/></xsl:param> |
| 101 |
<xsl:choose> |
| 102 |
<xsl:when test="$entry-num <= 0"/> |
| 103 |
<xsl:when test="$entry-num=1"> |
| 104 |
<xsl:value-of select="substring-before($all-widths,'*')"/> |
| 105 |
</xsl:when> |
| 106 |
<xsl:when test="not(contains($all-widths,' '))"/> |
| 107 |
<xsl:otherwise> |
| 108 |
<xsl:call-template name="get-proportional-width"> |
| 109 |
<xsl:with-param name="entry-num"><xsl:value-of select="$entry-num - 1"/></xsl:with-param> |
| 110 |
<xsl:with-param name="all-widths"><xsl:value-of select="substring-after($all-widths,' ')"/></xsl:with-param> |
| 111 |
</xsl:call-template> |
| 112 |
</xsl:otherwise> |
| 113 |
</xsl:choose> |
| 114 |
</xsl:template> |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
<xsl:template name="find-total-table-width"> |
| 124 |
|
| 125 |
<xsl:param name="relcolwidth"><xsl:value-of select="@relcolwidth"/></xsl:param> |
| 126 |
|
| 127 |
<xsl:variable name="firstval"> |
| 128 |
<xsl:if test="contains($relcolwidth,'*')"> |
| 129 |
<xsl:value-of select="substring-before($relcolwidth,'*')"/> |
| 130 |
</xsl:if> |
| 131 |
</xsl:variable> |
| 132 |
|
| 133 |
<xsl:if test="string-length($firstval)>0"> |
| 134 |
|
| 135 |
<xsl:variable name="morevals"><xsl:value-of select="substring-after($relcolwidth,' ')"/></xsl:variable> |
| 136 |
<xsl:choose> |
| 137 |
|
| 138 |
|
| 139 |
<xsl:when test="string-length($morevals)>0"> |
| 140 |
<xsl:variable name="nextval"> |
| 141 |
<xsl:call-template name="find-total-table-width"> |
| 142 |
<xsl:with-param name="relcolwidth"><xsl:value-of select="$morevals"/></xsl:with-param> |
| 143 |
</xsl:call-template> |
| 144 |
</xsl:variable> |
| 145 |
<xsl:value-of select="number($firstval)+number($nextval)"/> |
| 146 |
</xsl:when> |
| 147 |
|
| 148 |
<xsl:otherwise><xsl:value-of select="$firstval"/></xsl:otherwise> |
| 149 |
</xsl:choose> |
| 150 |
</xsl:if> |
| 151 |
</xsl:template> |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
<xsl:template name="get-current-entry-percentage"> |
| 157 |
<xsl:param name="multiplier">1</xsl:param> |
| 158 |
<xsl:param name="entry-num"/> |
| 159 |
<xsl:param name="current-col">1</xsl:param> |
| 160 |
|
| 161 |
<xsl:param name="relcolvalues"><xsl:value-of select="parent::*/parent::*/@relcolwidth"/></xsl:param> |
| 162 |
|
| 163 |
<xsl:choose> |
| 164 |
|
| 165 |
|
| 166 |
<xsl:when test="$entry-num = $current-col"> |
| 167 |
<xsl:variable name="relcol"><xsl:value-of select="substring-before($relcolvalues,'*')"/></xsl:variable> |
| 168 |
<xsl:value-of select="$relcol * $multiplier"/> |
| 169 |
</xsl:when> |
| 170 |
|
| 171 |
|
| 172 |
<xsl:otherwise> |
| 173 |
<xsl:call-template name="get-current-entry-percentage"> |
| 174 |
<xsl:with-param name="multiplier"><xsl:value-of select="$multiplier"/></xsl:with-param> |
| 175 |
<xsl:with-param name="entry-num"><xsl:value-of select="$entry-num"/></xsl:with-param> |
| 176 |
<xsl:with-param name="current-col"><xsl:value-of select="$current-col + 1"/></xsl:with-param> |
| 177 |
<xsl:with-param name="relcolvalues"><xsl:value-of select="substring-after($relcolvalues,' ')"/></xsl:with-param> |
| 178 |
</xsl:call-template> |
| 179 |
</xsl:otherwise> |
| 180 |
</xsl:choose> |
| 181 |
</xsl:template> |
| 182 |
|
| 183 |
|
| 184 |
<xsl:template match="*[contains(@class,' topic/sthead ')]"> |
| 185 |
<fo:table-row> |
| 186 |
<xsl:apply-templates/> |
| 187 |
</fo:table-row> |
| 188 |
</xsl:template> |
| 189 |
|
| 190 |
|
| 191 |
<xsl:template match="*[contains(@class,' topic/strow ')]"> |
| 192 |
<fo:table-row> |
| 193 |
<xsl:apply-templates/> |
| 194 |
</fo:table-row> |
| 195 |
</xsl:template> |
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
<xsl:template match="*[contains(@class,' topic/sthead ')]/*[contains(@class,' topic/stentry ')]" priority="2"> |
| 203 |
<fo:table-cell start-indent="2pt" background-color="silver" padding="2pt" text-align= |
| 204 |
"center" font-weight="bold" xsl:use-attribute-sets="frameall"> |
| 205 |
<xsl:attribute name="column-number"><xsl:number count="*"/></xsl:attribute> |
| 206 |
<fo:block> |
| 207 |
<xsl:attribute name="font-size">10pt</xsl:attribute> |
| 208 |
<xsl:call-template name="get-title"/> |
| 209 |
</fo:block> |
| 210 |
</fo:table-cell> |
| 211 |
</xsl:template> |
| 212 |
|
| 213 |
|
| 214 |
<xsl:template match="*[contains(@class,' topic/stentry ')]"> |
| 215 |
<xsl:variable name="localkeycol"> |
| 216 |
<xsl:choose> |
| 217 |
<xsl:when test="ancestor::*[contains(@class,' topic/simpletable ')]/@keycol"> |
| 218 |
<xsl:value-of select="ancestor::*[contains(@class,' topic/simpletable ')]/@keycol"/> |
| 219 |
</xsl:when> |
| 220 |
<xsl:otherwise>0</xsl:otherwise> |
| 221 |
</xsl:choose> |
| 222 |
</xsl:variable> |
| 223 |
<xsl:variable name="thisnum"><xsl:number/></xsl:variable> |
| 224 |
<xsl:variable name="thisrow"><xsl:number level="single" count="strow"/></xsl:variable> |
| 225 |
|
| 226 |
<xsl:choose> |
| 227 |
<xsl:when test="$thisnum=$localkeycol"> |
| 228 |
<fo:table-cell start-indent="2pt" background-color="#fafafa" padding="2pt" xsl:use-attribute-sets="frameall"> |
| 229 |
<xsl:attribute name="column-number"><xsl:number count="*"/></xsl:attribute> |
| 230 |
<fo:block font-weight="bold"> |
| 231 |
<xsl:attribute name="font-size">9pt</xsl:attribute> |
| 232 |
<xsl:apply-templates/> |
| 233 |
</fo:block> |
| 234 |
</fo:table-cell> |
| 235 |
</xsl:when> |
| 236 |
<xsl:otherwise> |
| 237 |
<fo:table-cell start-indent="2pt" background-color="#fafafa" padding="2pt" xsl:use-attribute-sets="frameall"> |
| 238 |
<xsl:attribute name="column-number"><xsl:number count="*"/></xsl:attribute> |
| 239 |
<fo:block> |
| 240 |
<xsl:attribute name="font-size">9pt</xsl:attribute> |
| 241 |
<xsl:apply-templates/> |
| 242 |
</fo:block> |
| 243 |
</fo:table-cell> |
| 244 |
</xsl:otherwise> |
| 245 |
</xsl:choose> |
| 246 |
</xsl:template> |
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
</xsl:stylesheet> |