metanorma-bipm 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/bipm/base_convert.rb +7 -0
- data/lib/isodoc/bipm/bipm.brochure.xsl +1043 -115
- data/lib/isodoc/bipm/bipm.guide.xsl +1043 -115
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +1043 -115
- data/lib/isodoc/bipm/bipm.rapport.xsl +1043 -115
- data/lib/isodoc/bipm/jcgm.standard.xsl +1042 -114
- data/lib/isodoc/bipm/presentation_xml_convert.rb +17 -0
- data/lib/metanorma/bipm/converter.rb +38 -108
- data/lib/metanorma/bipm/front.rb +113 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- metadata +3 -2
| @@ -676,6 +676,7 @@ | |
| 676 676 |  | 
| 677 677 | 
             
            	<xsl:template match="*[local-name()='p']" name="paragraph">
         | 
| 678 678 | 
             
            		<xsl:param name="inline" select="'false'"/>
         | 
| 679 | 
            +
            		<xsl:param name="split_keep-within-line"/>
         | 
| 679 680 | 
             
            		<xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
         | 
| 680 681 | 
             
            		<xsl:variable name="element-name">
         | 
| 681 682 | 
             
            			<xsl:choose>
         | 
| @@ -701,7 +702,9 @@ | |
| 701 702 | 
             
            				<xsl:attribute name="widows">1</xsl:attribute>
         | 
| 702 703 | 
             
            				<xsl:attribute name="orphans">1</xsl:attribute>
         | 
| 703 704 | 
             
            			</xsl:if>
         | 
| 704 | 
            -
            			<xsl:apply-templates | 
| 705 | 
            +
            			<xsl:apply-templates>
         | 
| 706 | 
            +
            				<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
         | 
| 707 | 
            +
            			</xsl:apply-templates>
         | 
| 705 708 | 
             
            		</xsl:element>
         | 
| 706 709 | 
             
            		<xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
         | 
| 707 710 | 
             
            			<fo:block margin-bottom="12pt">
         | 
| @@ -1721,7 +1724,9 @@ | |
| 1721 1724 | 
             
            			</fo:block-container>
         | 
| 1722 1725 | 
             
            	</xsl:template>
         | 
| 1723 1726 |  | 
| 1724 | 
            -
            <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name=" | 
| 1727 | 
            +
            <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
         | 
| 1728 | 
            +
            		false
         | 
| 1729 | 
            +
            	</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
         | 
| 1725 1730 | 
             
            		<xsl:call-template name="getLang"/>
         | 
| 1726 1731 | 
             
            	</xsl:variable><xsl:variable name="pageWidth_">
         | 
| 1727 1732 | 
             
            		210
         | 
| @@ -2187,6 +2192,7 @@ | |
| 2187 2192 | 
             
            		<xsl:attribute name="font-weight">bold</xsl:attribute>
         | 
| 2188 2193 | 
             
            		<xsl:attribute name="border">solid black 1pt</xsl:attribute>
         | 
| 2189 2194 | 
             
            		<xsl:attribute name="padding-left">1mm</xsl:attribute>
         | 
| 2195 | 
            +
            		<xsl:attribute name="padding-right">1mm</xsl:attribute>
         | 
| 2190 2196 | 
             
            		<xsl:attribute name="display-align">center</xsl:attribute>
         | 
| 2191 2197 |  | 
| 2192 2198 |  | 
| @@ -2207,6 +2213,7 @@ | |
| 2207 2213 | 
             
            		<xsl:attribute name="display-align">center</xsl:attribute>
         | 
| 2208 2214 | 
             
            		<xsl:attribute name="border">solid black 1pt</xsl:attribute>
         | 
| 2209 2215 | 
             
            		<xsl:attribute name="padding-left">1mm</xsl:attribute>
         | 
| 2216 | 
            +
            		<xsl:attribute name="padding-right">1mm</xsl:attribute>
         | 
| 2210 2217 |  | 
| 2211 2218 |  | 
| 2212 2219 |  | 
| @@ -2301,7 +2308,8 @@ | |
| 2301 2308 | 
             
            	</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
         | 
| 2302 2309 |  | 
| 2303 2310 |  | 
| 2304 | 
            -
            	</xsl:attribute-set><xsl:attribute-set name="dt-style">
         | 
| 2311 | 
            +
            	</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
         | 
| 2312 | 
            +
            	</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
         | 
| 2305 2313 | 
             
            		<xsl:attribute name="margin-top">6pt</xsl:attribute>
         | 
| 2306 2314 |  | 
| 2307 2315 |  | 
| @@ -2315,6 +2323,8 @@ | |
| 2315 2323 |  | 
| 2316 2324 |  | 
| 2317 2325 |  | 
| 2326 | 
            +
            	</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
         | 
| 2327 | 
            +
            		<xsl:attribute name="padding-left">2mm</xsl:attribute>
         | 
| 2318 2328 | 
             
            	</xsl:attribute-set><xsl:attribute-set name="appendix-style">
         | 
| 2319 2329 |  | 
| 2320 2330 | 
             
            			<xsl:attribute name="font-size">12pt</xsl:attribute>
         | 
| @@ -3166,7 +3176,38 @@ | |
| 3166 3176 | 
             
            	</xsl:template><xsl:template match="*[local-name()='br']">
         | 
| 3167 3177 | 
             
            		<xsl:value-of select="$linebreak"/>
         | 
| 3168 3178 | 
             
            	</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
         | 
| 3169 | 
            -
            		< | 
| 3179 | 
            +
            		<xsl:param name="split_keep-within-line"/>
         | 
| 3180 | 
            +
            		
         | 
| 3181 | 
            +
            		<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
         | 
| 3182 | 
            +
            		<xsl:choose>
         | 
| 3183 | 
            +
            		
         | 
| 3184 | 
            +
            			<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
         | 
| 3185 | 
            +
            				<xsl:variable name="sep">_</xsl:variable>
         | 
| 3186 | 
            +
            				<xsl:variable name="items">
         | 
| 3187 | 
            +
            					<xsl:call-template name="split">
         | 
| 3188 | 
            +
            						<xsl:with-param name="pText" select="."/>
         | 
| 3189 | 
            +
            						<xsl:with-param name="sep" select="$sep"/>
         | 
| 3190 | 
            +
            						<xsl:with-param name="normalize-space">false</xsl:with-param>
         | 
| 3191 | 
            +
            						<xsl:with-param name="keep_sep">true</xsl:with-param>
         | 
| 3192 | 
            +
            					</xsl:call-template>
         | 
| 3193 | 
            +
            				</xsl:variable>
         | 
| 3194 | 
            +
            				<xsl:for-each select="xalan:nodeset($items)/item">
         | 
| 3195 | 
            +
            					<xsl:choose>
         | 
| 3196 | 
            +
            						<xsl:when test=". = $sep">
         | 
| 3197 | 
            +
            							<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
         | 
| 3198 | 
            +
            						</xsl:when>
         | 
| 3199 | 
            +
            						<xsl:otherwise>
         | 
| 3200 | 
            +
            							<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
         | 
| 3201 | 
            +
            						</xsl:otherwise>
         | 
| 3202 | 
            +
            					</xsl:choose>
         | 
| 3203 | 
            +
            				</xsl:for-each>
         | 
| 3204 | 
            +
            			</xsl:when>
         | 
| 3205 | 
            +
            			
         | 
| 3206 | 
            +
            			<xsl:otherwise>
         | 
| 3207 | 
            +
            				<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
         | 
| 3208 | 
            +
            			</xsl:otherwise>
         | 
| 3209 | 
            +
            			
         | 
| 3210 | 
            +
            		</xsl:choose>
         | 
| 3170 3211 | 
             
            	</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
         | 
| 3171 3212 | 
             
            		<fo:block xsl:use-attribute-sets="copyright-statement-style">
         | 
| 3172 3213 | 
             
            			<xsl:apply-templates/>
         | 
| @@ -3258,9 +3299,14 @@ | |
| 3258 3299 |  | 
| 3259 3300 | 
             
            		<xsl:variable name="table">
         | 
| 3260 3301 |  | 
| 3261 | 
            -
            			<xsl:variable name="simple-table"> | 
| 3262 | 
            -
            				<xsl:call-template name="getSimpleTable" | 
| 3302 | 
            +
            			<xsl:variable name="simple-table">
         | 
| 3303 | 
            +
            				<xsl:call-template name="getSimpleTable">
         | 
| 3304 | 
            +
            					<xsl:with-param name="id" select="@id"/>
         | 
| 3305 | 
            +
            				</xsl:call-template>
         | 
| 3263 3306 | 
             
            			</xsl:variable>
         | 
| 3307 | 
            +
            			<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
         | 
| 3308 | 
            +
            		
         | 
| 3309 | 
            +
            			<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
         | 
| 3264 3310 |  | 
| 3265 3311 |  | 
| 3266 3312 | 
             
            			<!-- Display table's name before table as standalone block -->
         | 
| @@ -3279,7 +3325,23 @@ | |
| 3279 3325 | 
             
            					</xsl:call-template>
         | 
| 3280 3326 | 
             
            				</xsl:if>
         | 
| 3281 3327 | 
             
            			</xsl:variable>
         | 
| 3282 | 
            -
            			<!--  | 
| 3328 | 
            +
            			<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
         | 
| 3329 | 
            +
            			
         | 
| 3330 | 
            +
            			<!-- DEBUG -->
         | 
| 3331 | 
            +
            			<xsl:if test="$table_if_debug = 'true'">
         | 
| 3332 | 
            +
            				<fo:block font-size="60%">
         | 
| 3333 | 
            +
            					<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
         | 
| 3334 | 
            +
            				</fo:block>
         | 
| 3335 | 
            +
            			</xsl:if>
         | 
| 3336 | 
            +
            			
         | 
| 3337 | 
            +
            			
         | 
| 3338 | 
            +
            			<!-- <xsl:copy-of select="$colwidths"/> -->
         | 
| 3339 | 
            +
            			
         | 
| 3340 | 
            +
            			<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
         | 
| 3341 | 
            +
            			DEBUG
         | 
| 3342 | 
            +
            			colwidths=<xsl:copy-of select="$colwidths"/>
         | 
| 3343 | 
            +
            		<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
         | 
| 3344 | 
            +
            			
         | 
| 3283 3345 |  | 
| 3284 3346 |  | 
| 3285 3347 | 
             
            			<xsl:variable name="margin-side">
         | 
| @@ -3344,9 +3406,17 @@ | |
| 3344 3406 | 
             
            					</xsl:element>
         | 
| 3345 3407 | 
             
            				</xsl:variable>
         | 
| 3346 3408 |  | 
| 3409 | 
            +
            				<xsl:if test="$isGenerateTableIF = 'true'">
         | 
| 3410 | 
            +
            					<!-- to determine start of table -->
         | 
| 3411 | 
            +
            					<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
         | 
| 3412 | 
            +
            				</xsl:if>
         | 
| 3347 3413 |  | 
| 3348 3414 | 
             
            				<fo:table id="{@id}">
         | 
| 3349 3415 |  | 
| 3416 | 
            +
            					<xsl:if test="$isGenerateTableIF = 'true'">
         | 
| 3417 | 
            +
            						<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
         | 
| 3418 | 
            +
            					</xsl:if>
         | 
| 3419 | 
            +
            					
         | 
| 3350 3420 | 
             
            					<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">					
         | 
| 3351 3421 | 
             
            						<xsl:attribute name="{local-name()}">
         | 
| 3352 3422 | 
             
            							<xsl:value-of select="."/>
         | 
| @@ -3360,24 +3430,47 @@ | |
| 3360 3430 |  | 
| 3361 3431 |  | 
| 3362 3432 | 
             
            					<xsl:choose>
         | 
| 3363 | 
            -
            						<xsl:when test=" | 
| 3364 | 
            -
            							 | 
| 3365 | 
            -
             | 
| 3366 | 
            -
             | 
| 3433 | 
            +
            						<xsl:when test="$isGenerateTableIF = 'true'">
         | 
| 3434 | 
            +
            							<!-- generate IF for table widths -->
         | 
| 3435 | 
            +
            							<!-- example:
         | 
| 3436 | 
            +
            								<tr>
         | 
| 3437 | 
            +
            									<td valign="top" align="left" id="tab-symdu_1_1">
         | 
| 3438 | 
            +
            										<p>Symbol</p>
         | 
| 3439 | 
            +
            										<word id="tab-symdu_1_1_word_1">Symbol</word>
         | 
| 3440 | 
            +
            									</td>
         | 
| 3441 | 
            +
            									<td valign="top" align="left" id="tab-symdu_1_2">
         | 
| 3442 | 
            +
            										<p>Description</p>
         | 
| 3443 | 
            +
            										<word id="tab-symdu_1_2_word_1">Description</word>
         | 
| 3444 | 
            +
            									</td>
         | 
| 3445 | 
            +
            								</tr>
         | 
| 3446 | 
            +
            							-->
         | 
| 3447 | 
            +
            							<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
         | 
| 3448 | 
            +
            							
         | 
| 3367 3449 | 
             
            						</xsl:when>
         | 
| 3368 3450 | 
             
            						<xsl:otherwise>
         | 
| 3369 | 
            -
            							<xsl:call-template name="insertTableColumnWidth">
         | 
| 3370 | 
            -
            								<xsl:with-param name="colwidths" select="$colwidths"/>
         | 
| 3371 | 
            -
            							</xsl:call-template>
         | 
| 3372 | 
            -
            						</xsl:otherwise>
         | 
| 3373 | 
            -
            					</xsl:choose>
         | 
| 3374 3451 |  | 
| 3375 | 
            -
             | 
| 3376 | 
            -
             | 
| 3377 | 
            -
             | 
| 3378 | 
            -
             | 
| 3379 | 
            -
             | 
| 3380 | 
            -
             | 
| 3452 | 
            +
            							<xsl:choose>
         | 
| 3453 | 
            +
            								<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
         | 
| 3454 | 
            +
            									<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
         | 
| 3455 | 
            +
            										<fo:table-column column-width="{@width}"/>
         | 
| 3456 | 
            +
            									</xsl:for-each>
         | 
| 3457 | 
            +
            								</xsl:when>
         | 
| 3458 | 
            +
            								<xsl:otherwise>
         | 
| 3459 | 
            +
            									<xsl:call-template name="insertTableColumnWidth">
         | 
| 3460 | 
            +
            										<xsl:with-param name="colwidths" select="$colwidths"/>
         | 
| 3461 | 
            +
            									</xsl:call-template>
         | 
| 3462 | 
            +
            								</xsl:otherwise>
         | 
| 3463 | 
            +
            							</xsl:choose>
         | 
| 3464 | 
            +
            							
         | 
| 3465 | 
            +
            							<xsl:choose>
         | 
| 3466 | 
            +
            								<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
         | 
| 3467 | 
            +
            									<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
         | 
| 3468 | 
            +
            								</xsl:when>
         | 
| 3469 | 
            +
            								<xsl:otherwise>
         | 
| 3470 | 
            +
            									<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note')          and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and note that renders separaterely -->
         | 
| 3471 | 
            +
            								</xsl:otherwise>
         | 
| 3472 | 
            +
            							</xsl:choose>
         | 
| 3473 | 
            +
            					
         | 
| 3381 3474 | 
             
            						</xsl:otherwise>
         | 
| 3382 3475 | 
             
            					</xsl:choose>
         | 
| 3383 3476 |  | 
| @@ -3482,11 +3575,22 @@ | |
| 3482 3575 | 
             
            		<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
         | 
| 3483 3576 | 
             
            		<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
         | 
| 3484 3577 | 
             
            	</xsl:template><xsl:template name="calculate-column-widths">
         | 
| 3578 | 
            +
            		<xsl:param name="table"/>
         | 
| 3579 | 
            +
            		<xsl:param name="cols-count"/>
         | 
| 3580 | 
            +
            		
         | 
| 3581 | 
            +
            				<xsl:call-template name="calculate-column-widths-proportional">
         | 
| 3582 | 
            +
            					<xsl:with-param name="cols-count" select="$cols-count"/>
         | 
| 3583 | 
            +
            					<xsl:with-param name="table" select="$table"/>
         | 
| 3584 | 
            +
            				</xsl:call-template>
         | 
| 3585 | 
            +
            			
         | 
| 3586 | 
            +
            	</xsl:template><xsl:template name="calculate-column-widths-proportional">
         | 
| 3485 3587 | 
             
            		<xsl:param name="table"/>
         | 
| 3486 3588 | 
             
            		<xsl:param name="cols-count"/>
         | 
| 3487 3589 | 
             
            		<xsl:param name="curr-col" select="1"/>
         | 
| 3488 3590 | 
             
            		<xsl:param name="width" select="0"/>
         | 
| 3489 3591 |  | 
| 3592 | 
            +
            		<!-- table=<xsl:copy-of select="$table"/> -->
         | 
| 3593 | 
            +
            		
         | 
| 3490 3594 | 
             
            		<xsl:if test="$curr-col <= $cols-count">
         | 
| 3491 3595 | 
             
            			<xsl:variable name="widths">
         | 
| 3492 3596 | 
             
            				<xsl:choose>
         | 
| @@ -3524,10 +3628,15 @@ | |
| 3524 3628 | 
             
            						</xsl:for-each>
         | 
| 3525 3629 | 
             
            					</xsl:when>
         | 
| 3526 3630 | 
             
            					<xsl:otherwise>
         | 
| 3527 | 
            -
            						<xsl: | 
| 3631 | 
            +
            						<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
         | 
| 3632 | 
            +
            						
         | 
| 3633 | 
            +
            						<!-- <table><xsl:copy-of select="$table"/></table>
         | 
| 3634 | 
            +
            						 -->
         | 
| 3635 | 
            +
            						<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
         | 
| 3528 3636 | 
             
            							<xsl:variable name="td_text">
         | 
| 3529 3637 | 
             
            								<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
         | 
| 3530 3638 | 
             
            							</xsl:variable>
         | 
| 3639 | 
            +
            							<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
         | 
| 3531 3640 | 
             
            							<xsl:variable name="words">
         | 
| 3532 3641 | 
             
            								<xsl:variable name="string_with_added_zerospaces">
         | 
| 3533 3642 | 
             
            									<xsl:call-template name="add-zero-spaces-java">
         | 
| @@ -3542,6 +3651,7 @@ | |
| 3542 3651 | 
             
            									<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', '  '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
         | 
| 3543 3652 | 
             
            								</xsl:call-template>
         | 
| 3544 3653 | 
             
            							</xsl:variable>
         | 
| 3654 | 
            +
            							<!-- words=<xsl:copy-of select="$words"/> -->
         | 
| 3545 3655 | 
             
            							<xsl:variable name="max_length">
         | 
| 3546 3656 | 
             
            								<xsl:call-template name="max_length">
         | 
| 3547 3657 | 
             
            									<xsl:with-param name="words" select="xalan:nodeset($words)"/>
         | 
| @@ -3566,6 +3676,8 @@ | |
| 3566 3676 | 
             
            				</xsl:choose>
         | 
| 3567 3677 | 
             
            			</xsl:variable>
         | 
| 3568 3678 |  | 
| 3679 | 
            +
            			<!-- widths=<xsl:copy-of select="$widths"/> -->
         | 
| 3680 | 
            +
            			
         | 
| 3569 3681 | 
             
            			<column>
         | 
| 3570 3682 | 
             
            				<xsl:for-each select="xalan:nodeset($widths)//width">
         | 
| 3571 3683 | 
             
            					<xsl:sort select="." data-type="number" order="descending"/>
         | 
| @@ -3574,33 +3686,327 @@ | |
| 3574 3686 | 
             
            					</xsl:if>
         | 
| 3575 3687 | 
             
            				</xsl:for-each>
         | 
| 3576 3688 | 
             
            			</column>
         | 
| 3577 | 
            -
            			<xsl:call-template name="calculate-column-widths">
         | 
| 3689 | 
            +
            			<xsl:call-template name="calculate-column-widths-proportional">
         | 
| 3578 3690 | 
             
            				<xsl:with-param name="cols-count" select="$cols-count"/>
         | 
| 3579 3691 | 
             
            				<xsl:with-param name="curr-col" select="$curr-col +1"/>
         | 
| 3580 3692 | 
             
            				<xsl:with-param name="table" select="$table"/>
         | 
| 3581 3693 | 
             
            			</xsl:call-template>
         | 
| 3582 3694 | 
             
            		</xsl:if>
         | 
| 3583 | 
            -
            	</xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
         | 
| 3695 | 
            +
            	</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
         | 
| 3584 3696 | 
             
            		<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
         | 
| 3585 3697 | 
             
            		<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
         | 
| 3586 3698 | 
             
            		<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
         | 
| 3699 | 
            +
            		
         | 
| 3700 | 
            +
            		<!-- if all capitals english letters or digits -->
         | 
| 3701 | 
            +
            		<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
         | 
| 3702 | 
            +
            			<xsl:call-template name="repeat">
         | 
| 3703 | 
            +
            				<xsl:with-param name="char" select="'X'"/>
         | 
| 3704 | 
            +
            				<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
         | 
| 3705 | 
            +
            			</xsl:call-template>
         | 
| 3706 | 
            +
            		</xsl:if>
         | 
| 3587 3707 | 
             
            	</xsl:template><xsl:template match="text()" mode="td_text">
         | 
| 3588 3708 | 
             
            		<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
         | 
| 3589 3709 | 
             
            	</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
         | 
| 3590 3710 | 
             
            		<xsl:value-of select="*[local-name()='origin']/@citeas"/>
         | 
| 3591 3711 | 
             
            	</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
         | 
| 3592 3712 | 
             
            		<xsl:value-of select="@target"/>
         | 
| 3593 | 
            -
            	</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
         | 
| 3594 | 
            -
            		<xsl: | 
| 3595 | 
            -
            			<xsl: | 
| 3596 | 
            -
            				<xsl: | 
| 3597 | 
            -
            					<xsl: | 
| 3713 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
         | 
| 3714 | 
            +
            		<xsl:if test="$isGenerateTableIF = 'false'">
         | 
| 3715 | 
            +
            			<xsl:variable name="mathml_">
         | 
| 3716 | 
            +
            				<xsl:for-each select="*">
         | 
| 3717 | 
            +
            					<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
         | 
| 3718 | 
            +
            						<xsl:copy-of select="."/>
         | 
| 3719 | 
            +
            					</xsl:if>
         | 
| 3720 | 
            +
            				</xsl:for-each>
         | 
| 3721 | 
            +
            			</xsl:variable>
         | 
| 3722 | 
            +
            			<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
         | 
| 3723 | 
            +
             | 
| 3724 | 
            +
            			<xsl:variable name="math_text">
         | 
| 3725 | 
            +
            				<xsl:value-of select="normalize-space($mathml)"/>
         | 
| 3726 | 
            +
            				<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
         | 
| 3727 | 
            +
            				<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
         | 
| 3728 | 
            +
            			</xsl:variable>
         | 
| 3729 | 
            +
            			<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
         | 
| 3730 | 
            +
            		</xsl:if>
         | 
| 3731 | 
            +
            	</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
         | 
| 3732 | 
            +
            		<xsl:param name="table"/>
         | 
| 3733 | 
            +
            		<xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
         | 
| 3734 | 
            +
             | 
| 3735 | 
            +
            		<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
         | 
| 3736 | 
            +
            	 
         | 
| 3737 | 
            +
            		<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
         | 
| 3738 | 
            +
            	 
         | 
| 3739 | 
            +
            		<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
         | 
| 3740 | 
            +
            		 
         | 
| 3741 | 
            +
            		<!-- get current table id -->
         | 
| 3742 | 
            +
            		<xsl:variable name="table_id" select="@id"/>
         | 
| 3743 | 
            +
            		<!-- find table by id in the file 'table_widths' -->
         | 
| 3744 | 
            +
            		<xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
         | 
| 3745 | 
            +
            		<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
         | 
| 3746 | 
            +
            		
         | 
| 3747 | 
            +
            		
         | 
| 3748 | 
            +
            		<!-- table='<xsl:copy-of select="$table"/>' -->
         | 
| 3749 | 
            +
            		<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
         | 
| 3750 | 
            +
            		<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
         | 
| 3751 | 
            +
            		<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
         | 
| 3752 | 
            +
            		
         | 
| 3753 | 
            +
            		<xsl:variable name="table_with_cell_widths_">
         | 
| 3754 | 
            +
            			<xsl:choose>
         | 
| 3755 | 
            +
            				<xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
         | 
| 3756 | 
            +
            				
         | 
| 3757 | 
            +
            					<!-- Example: <column>10</column>
         | 
| 3758 | 
            +
            							<column>11</column> 
         | 
| 3759 | 
            +
            					-->
         | 
| 3760 | 
            +
            					<xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
         | 
| 3761 | 
            +
            				</xsl:when>
         | 
| 3762 | 
            +
            				<xsl:otherwise>
         | 
| 3763 | 
            +
            					<xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
         | 
| 3764 | 
            +
            				</xsl:otherwise>
         | 
| 3765 | 
            +
            			</xsl:choose>
         | 
| 3766 | 
            +
            		</xsl:variable>
         | 
| 3767 | 
            +
            		<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
         | 
| 3768 | 
            +
            		
         | 
| 3769 | 
            +
            		<xsl:if test="$table_if_debug = 'true'">
         | 
| 3770 | 
            +
            			<xsl:copy-of select="$table_with_cell_widths"/>
         | 
| 3771 | 
            +
            		</xsl:if>
         | 
| 3772 | 
            +
            		
         | 
| 3773 | 
            +
            		
         | 
| 3774 | 
            +
            		<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
         | 
| 3775 | 
            +
            		
         | 
| 3776 | 
            +
            		<xsl:variable name="column_widths_">
         | 
| 3777 | 
            +
            			<!-- iteration of columns -->
         | 
| 3778 | 
            +
            			<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
         | 
| 3779 | 
            +
            				<xsl:variable name="pos" select="position()"/>
         | 
| 3780 | 
            +
            				<column>
         | 
| 3781 | 
            +
            					<xsl:attribute name="width_max">
         | 
| 3782 | 
            +
            						<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
         | 
| 3783 | 
            +
            							<xsl:sort select="." data-type="number" order="descending"/>
         | 
| 3784 | 
            +
            							<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
         | 
| 3785 | 
            +
            						</xsl:for-each>
         | 
| 3786 | 
            +
            					</xsl:attribute>
         | 
| 3787 | 
            +
            					<xsl:attribute name="width_min">
         | 
| 3788 | 
            +
            						<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
         | 
| 3789 | 
            +
            							<xsl:sort select="." data-type="number" order="descending"/>
         | 
| 3790 | 
            +
            							<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
         | 
| 3791 | 
            +
            						</xsl:for-each>
         | 
| 3792 | 
            +
            					</xsl:attribute>
         | 
| 3793 | 
            +
            				</column>
         | 
| 3794 | 
            +
            			</xsl:for-each>
         | 
| 3795 | 
            +
            		</xsl:variable>
         | 
| 3796 | 
            +
            		<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
         | 
| 3797 | 
            +
            		
         | 
| 3798 | 
            +
            		<!-- <column_widths>
         | 
| 3799 | 
            +
            			<xsl:copy-of select="$column_widths"/>
         | 
| 3800 | 
            +
            		</column_widths> -->
         | 
| 3801 | 
            +
            		
         | 
| 3802 | 
            +
            		<!-- These in turn, are used to find the minimum and maximum width for the table. -->
         | 
| 3803 | 
            +
            		<xsl:variable name="table_widths_">
         | 
| 3804 | 
            +
            			<table>
         | 
| 3805 | 
            +
            				<xsl:attribute name="width_max">
         | 
| 3806 | 
            +
            					<xsl:value-of select="sum($column_widths/column/@width_max)"/>
         | 
| 3807 | 
            +
            				</xsl:attribute>
         | 
| 3808 | 
            +
            				<xsl:attribute name="width_min">
         | 
| 3809 | 
            +
            					<xsl:value-of select="sum($column_widths/column/@width_min)"/>
         | 
| 3810 | 
            +
            				</xsl:attribute>
         | 
| 3811 | 
            +
            			</table>
         | 
| 3812 | 
            +
            		</xsl:variable>
         | 
| 3813 | 
            +
            		<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
         | 
| 3814 | 
            +
            		
         | 
| 3815 | 
            +
            		<xsl:variable name="page_width">
         | 
| 3816 | 
            +
            			<xsl:choose>
         | 
| 3817 | 
            +
            				<xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
         | 
| 3818 | 
            +
            				<xsl:otherwise>75</xsl:otherwise>
         | 
| 3819 | 
            +
            			</xsl:choose>
         | 
| 3820 | 
            +
            		</xsl:variable>
         | 
| 3821 | 
            +
            		
         | 
| 3822 | 
            +
            		<xsl:if test="$table_if_debug = 'true'">
         | 
| 3823 | 
            +
            			<table_width>
         | 
| 3824 | 
            +
            				<xsl:copy-of select="$table_widths"/>
         | 
| 3825 | 
            +
            			</table_width>
         | 
| 3826 | 
            +
            			<!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
         | 
| 3827 | 
            +
            			<debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
         | 
| 3828 | 
            +
            			 -->
         | 
| 3829 | 
            +
            			<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
         | 
| 3830 | 
            +
            		</xsl:if>
         | 
| 3831 | 
            +
            		
         | 
| 3832 | 
            +
            		
         | 
| 3833 | 
            +
            		<!-- There are three cases: -->
         | 
| 3834 | 
            +
            		<xsl:choose>
         | 
| 3835 | 
            +
            			<!-- 1. The minimum table width is equal to or wider than the available space -->
         | 
| 3836 | 
            +
            			<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
         | 
| 3837 | 
            +
            				<!-- call old algorithm -->
         | 
| 3838 | 
            +
            				<case1/>
         | 
| 3839 | 
            +
            				<xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
         | 
| 3840 | 
            +
            				<xsl:call-template name="calculate-column-widths-proportional">
         | 
| 3841 | 
            +
            					<xsl:with-param name="cols-count" select="$cols-count"/>
         | 
| 3842 | 
            +
            					<xsl:with-param name="table" select="$table"/>
         | 
| 3843 | 
            +
            				</xsl:call-template>
         | 
| 3844 | 
            +
            			</xsl:when>
         | 
| 3845 | 
            +
            			<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
         | 
| 3846 | 
            +
            			<xsl:when test="$table_widths/table/@width_max <= $page_width">
         | 
| 3847 | 
            +
            				<case2/>
         | 
| 3848 | 
            +
            				<autolayout/>
         | 
| 3849 | 
            +
            				<xsl:for-each select="$column_widths/column/@width_max">
         | 
| 3850 | 
            +
            					<column divider="100"><xsl:value-of select="."/></column>
         | 
| 3851 | 
            +
            				</xsl:for-each>
         | 
| 3852 | 
            +
            			</xsl:when>
         | 
| 3853 | 
            +
            			<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller. 
         | 
| 3854 | 
            +
            			In this case, find the difference between the available space and the minimum table width, lets call it W. 
         | 
| 3855 | 
            +
            			Lets also call D the difference between maximum and minimum width of the table. 
         | 
| 3856 | 
            +
            			For each column, let d be the difference between maximum and minimum width of that column. 
         | 
| 3857 | 
            +
            			Now set the column's width to the minimum width plus d times W over D. 
         | 
| 3858 | 
            +
            			This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
         | 
| 3859 | 
            +
            			<xsl:when test="($table_widths/table/@width_max > $page_width and $table_widths/table/@width_min < $page_width) or ($table_widths/table/@width_min >= $page_width)">
         | 
| 3860 | 
            +
            				<!-- difference between the available space and the minimum table width -->
         | 
| 3861 | 
            +
            				<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
         | 
| 3862 | 
            +
            				<W><xsl:value-of select="$W"/></W>
         | 
| 3863 | 
            +
            				<!-- difference between maximum and minimum width of the table -->
         | 
| 3864 | 
            +
            				<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
         | 
| 3865 | 
            +
            				<D><xsl:value-of select="$D"/></D>
         | 
| 3866 | 
            +
            				<case3/>
         | 
| 3867 | 
            +
            				<autolayout/>
         | 
| 3868 | 
            +
            				<xsl:if test="$table_widths/table/@width_min >= $page_width">
         | 
| 3869 | 
            +
            					<split_keep-within-line>true</split_keep-within-line>
         | 
| 3598 3870 | 
             
            				</xsl:if>
         | 
| 3871 | 
            +
            				<xsl:for-each select="$column_widths/column">
         | 
| 3872 | 
            +
            					<!-- difference between maximum and minimum width of that column.  -->
         | 
| 3873 | 
            +
            					<xsl:variable name="d" select="@width_max - @width_min"/>
         | 
| 3874 | 
            +
            					<d><xsl:value-of select="$d"/></d>
         | 
| 3875 | 
            +
            					<width_min><xsl:value-of select="@width_min"/></width_min>
         | 
| 3876 | 
            +
            					<e><xsl:value-of select="$d * $W div $D"/></e>
         | 
| 3877 | 
            +
            					<!-- set the column's width to the minimum width plus d times W over D.  -->
         | 
| 3878 | 
            +
            					<column divider="100">
         | 
| 3879 | 
            +
            						<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!--  * 10 -->
         | 
| 3880 | 
            +
            					</column>
         | 
| 3881 | 
            +
            				</xsl:for-each>
         | 
| 3882 | 
            +
            				
         | 
| 3883 | 
            +
            			</xsl:when>
         | 
| 3884 | 
            +
            			<xsl:otherwise><unknown_case/></xsl:otherwise>
         | 
| 3885 | 
            +
            		</xsl:choose>
         | 
| 3886 | 
            +
            		
         | 
| 3887 | 
            +
            		
         | 
| 3888 | 
            +
            	</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
         | 
| 3889 | 
            +
            		<xsl:copy>
         | 
| 3890 | 
            +
            				<xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
         | 
| 3891 | 
            +
            		</xsl:copy>
         | 
| 3892 | 
            +
            	</xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
         | 
| 3893 | 
            +
            		<xsl:copy>
         | 
| 3894 | 
            +
            			<xsl:copy-of select="@*"/>
         | 
| 3895 | 
            +
            			
         | 
| 3896 | 
            +
            			 <!-- The maximum width is given by the widest line.  -->
         | 
| 3897 | 
            +
            			<xsl:variable name="widths_max">
         | 
| 3898 | 
            +
            				<xsl:for-each select=".//*[local-name() = 'p']">
         | 
| 3899 | 
            +
            					<xsl:call-template name="add_width"/>
         | 
| 3900 | 
            +
            				</xsl:for-each>
         | 
| 3901 | 
            +
            				<xsl:if test="not(*[local-name() = 'p'])">
         | 
| 3902 | 
            +
            					<xsl:call-template name="add_width"/>
         | 
| 3903 | 
            +
            				</xsl:if>
         | 
| 3904 | 
            +
            			</xsl:variable>
         | 
| 3905 | 
            +
            			<xsl:variable name="width_max">
         | 
| 3906 | 
            +
            				<xsl:for-each select="xalan:nodeset($widths_max)//width">
         | 
| 3907 | 
            +
            					<xsl:sort select="." data-type="number" order="descending"/>
         | 
| 3908 | 
            +
            					<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
         | 
| 3909 | 
            +
            				</xsl:for-each>
         | 
| 3910 | 
            +
            			</xsl:variable>
         | 
| 3911 | 
            +
            			<xsl:attribute name="width_max">
         | 
| 3912 | 
            +
            				<xsl:value-of select="$width_max"/>
         | 
| 3913 | 
            +
            			</xsl:attribute>
         | 
| 3914 | 
            +
            			
         | 
| 3915 | 
            +
            			<!-- The minimum width is given by the widest text element (word, image, etc.) -->
         | 
| 3916 | 
            +
            			<!-- To do: image width -->
         | 
| 3917 | 
            +
            			<xsl:variable name="td_text">
         | 
| 3918 | 
            +
            				<xsl:apply-templates select="." mode="td_text"/>
         | 
| 3919 | 
            +
            			</xsl:variable>
         | 
| 3920 | 
            +
            			<xsl:variable name="words">
         | 
| 3921 | 
            +
            				<xsl:variable name="string_with_added_zerospaces">
         | 
| 3922 | 
            +
            					<xsl:call-template name="add-zero-spaces-java">
         | 
| 3923 | 
            +
            						<xsl:with-param name="text" select="$td_text"/>
         | 
| 3924 | 
            +
            					</xsl:call-template>
         | 
| 3925 | 
            +
            				</xsl:variable>
         | 
| 3926 | 
            +
            				<xsl:call-template name="tokenize">
         | 
| 3927 | 
            +
            					<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', '  '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
         | 
| 3928 | 
            +
            				</xsl:call-template>
         | 
| 3929 | 
            +
            			</xsl:variable>
         | 
| 3930 | 
            +
            			
         | 
| 3931 | 
            +
            			<xsl:variable name="max_word_length">
         | 
| 3932 | 
            +
            				<xsl:call-template name="max_length">
         | 
| 3933 | 
            +
            					<xsl:with-param name="words" select="xalan:nodeset($words)"/>
         | 
| 3934 | 
            +
            				</xsl:call-template>
         | 
| 3935 | 
            +
            			</xsl:variable>
         | 
| 3936 | 
            +
            			<xsl:variable name="width_min">
         | 
| 3937 | 
            +
            				<xsl:value-of select="$max_word_length"/>
         | 
| 3938 | 
            +
            			</xsl:variable>
         | 
| 3939 | 
            +
            			<xsl:attribute name="width_min">
         | 
| 3940 | 
            +
            				<xsl:value-of select="$width_min"/>
         | 
| 3941 | 
            +
            			</xsl:attribute>
         | 
| 3942 | 
            +
            			<!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
         | 
| 3943 | 
            +
            			<xsl:if test="$width_min > $width_max">
         | 
| 3944 | 
            +
            				<xsl:attribute name="width_max">
         | 
| 3945 | 
            +
            					<xsl:value-of select="$width_min"/>
         | 
| 3946 | 
            +
            				</xsl:attribute>
         | 
| 3947 | 
            +
            			</xsl:if>
         | 
| 3948 | 
            +
            			<xsl:if test="$width_min = 0">
         | 
| 3949 | 
            +
            				<xsl:attribute name="width_min">1</xsl:attribute>
         | 
| 3950 | 
            +
            			</xsl:if>
         | 
| 3951 | 
            +
            			
         | 
| 3952 | 
            +
            			<xsl:apply-templates select="node()" mode="determine_cell_widths"/>
         | 
| 3953 | 
            +
            			
         | 
| 3954 | 
            +
            		</xsl:copy>
         | 
| 3955 | 
            +
            	</xsl:template><xsl:template name="add_width">
         | 
| 3956 | 
            +
            		<xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
         | 
| 3957 | 
            +
            		<xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
         | 
| 3958 | 
            +
            		
         | 
| 3959 | 
            +
            		<xsl:variable name="p_text_len">
         | 
| 3960 | 
            +
            			<xsl:choose>
         | 
| 3961 | 
            +
            				<xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
         | 
| 3962 | 
            +
            					<xsl:value-of select="$p_text_len_ * 1.5"/>
         | 
| 3963 | 
            +
            				</xsl:when>
         | 
| 3964 | 
            +
            				<xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
         | 
| 3965 | 
            +
            			</xsl:choose>
         | 
| 3966 | 
            +
            		</xsl:variable>
         | 
| 3967 | 
            +
            		
         | 
| 3968 | 
            +
            		<xsl:variable name="math_addon_text">
         | 
| 3969 | 
            +
            			<xsl:for-each select=".//*[local-name() = 'math']">
         | 
| 3970 | 
            +
            				<xsl:apply-templates mode="td_text"/>
         | 
| 3599 3971 | 
             
            			</xsl:for-each>
         | 
| 3600 3972 | 
             
            		</xsl:variable>
         | 
| 3973 | 
            +
            		<xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
         | 
| 3601 3974 |  | 
| 3602 | 
            -
            		<xsl: | 
| 3603 | 
            -
             | 
| 3975 | 
            +
            		<width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
         | 
| 3976 | 
            +
            	</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
         | 
| 3977 | 
            +
            		<xsl:copy>
         | 
| 3978 | 
            +
            				<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
         | 
| 3979 | 
            +
            		</xsl:copy>
         | 
| 3980 | 
            +
            	</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
         | 
| 3981 | 
            +
            		<xsl:copy>
         | 
| 3982 | 
            +
            			<xsl:copy-of select="@*"/>
         | 
| 3983 | 
            +
            			
         | 
| 3984 | 
            +
            			 <!-- The maximum width is given by the widest line.  -->
         | 
| 3985 | 
            +
            			<xsl:attribute name="width_max">
         | 
| 3986 | 
            +
            				<xsl:for-each select="p_len">
         | 
| 3987 | 
            +
            					<xsl:sort select="." data-type="number" order="descending"/>
         | 
| 3988 | 
            +
            					<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
         | 
| 3989 | 
            +
            				</xsl:for-each>
         | 
| 3990 | 
            +
            			</xsl:attribute>
         | 
| 3991 | 
            +
            			
         | 
| 3992 | 
            +
            			<!-- The minimum width is given by the widest text element (word, image, etc.) -->
         | 
| 3993 | 
            +
            			<xsl:variable name="width_min">
         | 
| 3994 | 
            +
            				<xsl:for-each select="word_len">
         | 
| 3995 | 
            +
            					<xsl:sort select="." data-type="number" order="descending"/>
         | 
| 3996 | 
            +
            					<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
         | 
| 3997 | 
            +
            				</xsl:for-each>
         | 
| 3998 | 
            +
            			</xsl:variable>
         | 
| 3999 | 
            +
            			<xsl:attribute name="width_min">
         | 
| 4000 | 
            +
            				<xsl:value-of select="$width_min"/>
         | 
| 4001 | 
            +
            			</xsl:attribute>
         | 
| 4002 | 
            +
            			
         | 
| 4003 | 
            +
            			<xsl:if test="$width_min = 0">
         | 
| 4004 | 
            +
            				<xsl:attribute name="width_min">1</xsl:attribute>
         | 
| 4005 | 
            +
            			</xsl:if>
         | 
| 4006 | 
            +
            			
         | 
| 4007 | 
            +
            			<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
         | 
| 4008 | 
            +
            			
         | 
| 4009 | 
            +
            		</xsl:copy>
         | 
| 3604 4010 | 
             
            	</xsl:template><xsl:template match="*[local-name()='thead']">
         | 
| 3605 4011 | 
             
            		<xsl:param name="cols-count"/>
         | 
| 3606 4012 | 
             
            		<fo:table-header>
         | 
| @@ -3698,6 +4104,7 @@ | |
| 3698 4104 | 
             
            						</xsl:for-each>
         | 
| 3699 4105 | 
             
            					</xsl:when>
         | 
| 3700 4106 | 
             
            					<xsl:otherwise>
         | 
| 4107 | 
            +
            						<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
         | 
| 3701 4108 | 
             
            						<xsl:call-template name="insertTableColumnWidth">
         | 
| 3702 4109 | 
             
            							<xsl:with-param name="colwidths" select="$colwidths"/>
         | 
| 3703 4110 | 
             
            						</xsl:call-template>
         | 
| @@ -3822,6 +4229,52 @@ | |
| 3822 4229 |  | 
| 3823 4230 | 
             
            		</fo:table-body>
         | 
| 3824 4231 |  | 
| 4232 | 
            +
            	</xsl:template><xsl:template match="/" mode="process_table-if">
         | 
| 4233 | 
            +
            		<xsl:param name="table_or_dl">table</xsl:param>
         | 
| 4234 | 
            +
            		<xsl:apply-templates mode="process_table-if">
         | 
| 4235 | 
            +
            			<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
         | 
| 4236 | 
            +
            		</xsl:apply-templates>
         | 
| 4237 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
         | 
| 4238 | 
            +
            		<xsl:param name="table_or_dl">table</xsl:param>
         | 
| 4239 | 
            +
            		
         | 
| 4240 | 
            +
            		<fo:table-body>
         | 
| 4241 | 
            +
            			<xsl:for-each select="*[local-name() = 'tr']">
         | 
| 4242 | 
            +
            				<xsl:variable name="col_count" select="count(*)"/>
         | 
| 4243 | 
            +
             | 
| 4244 | 
            +
            				<!-- iteration for each tr/td -->
         | 
| 4245 | 
            +
            				
         | 
| 4246 | 
            +
            				<xsl:choose>
         | 
| 4247 | 
            +
            					<xsl:when test="$table_or_dl = 'table'">
         | 
| 4248 | 
            +
            						<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
         | 
| 4249 | 
            +
            							<fo:table-row number-columns-spanned="{$col_count}">
         | 
| 4250 | 
            +
            								<!-- <test_table><xsl:copy-of select="."/></test_table> -->
         | 
| 4251 | 
            +
            								<xsl:call-template name="td"/>
         | 
| 4252 | 
            +
            							</fo:table-row>
         | 
| 4253 | 
            +
            						</xsl:for-each>
         | 
| 4254 | 
            +
            					</xsl:when>
         | 
| 4255 | 
            +
            					<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
         | 
| 4256 | 
            +
            						<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
         | 
| 4257 | 
            +
            							<xsl:variable name="is_dt" select="position() = 1"/>
         | 
| 4258 | 
            +
            							
         | 
| 4259 | 
            +
            							<xsl:for-each select="*">
         | 
| 4260 | 
            +
            								<!-- <test><xsl:copy-of select="."/></test> -->
         | 
| 4261 | 
            +
            								<fo:table-row number-columns-spanned="{$col_count}">
         | 
| 4262 | 
            +
            									<xsl:choose>
         | 
| 4263 | 
            +
            										<xsl:when test="$is_dt">
         | 
| 4264 | 
            +
            											<xsl:call-template name="insert_dt_cell"/>
         | 
| 4265 | 
            +
            										</xsl:when>
         | 
| 4266 | 
            +
            										<xsl:otherwise>
         | 
| 4267 | 
            +
            											<xsl:call-template name="insert_dd_cell"/>
         | 
| 4268 | 
            +
            										</xsl:otherwise>
         | 
| 4269 | 
            +
            									</xsl:choose>
         | 
| 4270 | 
            +
            								</fo:table-row>
         | 
| 4271 | 
            +
            							</xsl:for-each>
         | 
| 4272 | 
            +
            						</xsl:for-each>
         | 
| 4273 | 
            +
            					</xsl:otherwise>
         | 
| 4274 | 
            +
            				</xsl:choose>
         | 
| 4275 | 
            +
            				
         | 
| 4276 | 
            +
            			</xsl:for-each>
         | 
| 4277 | 
            +
            		</fo:table-body>
         | 
| 3825 4278 | 
             
            	</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
         | 
| 3826 4279 | 
             
            		<fo:table-row xsl:use-attribute-sets="table-header-row-style">
         | 
| 3827 4280 |  | 
| @@ -3919,7 +4372,7 @@ | |
| 3919 4372 | 
             
            				</xsl:choose>					
         | 
| 3920 4373 | 
             
            			</xsl:attribute>
         | 
| 3921 4374 | 
             
            		</xsl:if>
         | 
| 3922 | 
            -
            	</xsl:template><xsl:template match="*[local-name()='td']">
         | 
| 4375 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='td']" name="td">
         | 
| 3923 4376 | 
             
            		<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
         | 
| 3924 4377 | 
             
            			<xsl:call-template name="setTextAlignment">
         | 
| 3925 4378 | 
             
            				<xsl:with-param name="default">left</xsl:with-param>
         | 
| @@ -3960,11 +4413,24 @@ | |
| 3960 4413 |  | 
| 3961 4414 | 
             
            			<xsl:call-template name="setTableCellAttributes"/>
         | 
| 3962 4415 |  | 
| 4416 | 
            +
            			<xsl:if test="$isGenerateTableIF = 'true'">
         | 
| 4417 | 
            +
            				<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
         | 
| 4418 | 
            +
            				<xsl:attribute name="text-align">left</xsl:attribute>
         | 
| 4419 | 
            +
            			</xsl:if>
         | 
| 4420 | 
            +
            			
         | 
| 3963 4421 | 
             
            			<fo:block>
         | 
| 3964 4422 |  | 
| 4423 | 
            +
            				<xsl:if test="$isGenerateTableIF = 'true'">
         | 
| 4424 | 
            +
            					<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
         | 
| 4425 | 
            +
            				</xsl:if>
         | 
| 4426 | 
            +
            			
         | 
| 4427 | 
            +
            			
         | 
| 3965 4428 |  | 
| 3966 4429 |  | 
| 3967 4430 | 
             
            				<xsl:apply-templates/>
         | 
| 4431 | 
            +
            				
         | 
| 4432 | 
            +
            				<xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
         | 
| 4433 | 
            +
             | 
| 3968 4434 | 
             
            			</fo:block>			
         | 
| 3969 4435 | 
             
            		</fo:table-cell>
         | 
| 3970 4436 | 
             
            	</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
         | 
| @@ -4161,9 +4627,9 @@ | |
| 4161 4627 | 
             
            			<!-- current hierarchy is 'figure' element -->
         | 
| 4162 4628 | 
             
            			<xsl:variable name="following_dl_colwidths">
         | 
| 4163 4629 | 
             
            				<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
         | 
| 4164 | 
            -
            					<xsl:variable name=" | 
| 4165 | 
            -
            						<xsl:variable name="doc_ns">
         | 
| 4166 | 
            -
            							
         | 
| 4630 | 
            +
            					<xsl:variable name="simple-table">
         | 
| 4631 | 
            +
            						<!-- <xsl:variable name="doc_ns">
         | 
| 4632 | 
            +
            							<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
         | 
| 4167 4633 | 
             
            						</xsl:variable>
         | 
| 4168 4634 | 
             
            						<xsl:variable name="ns">
         | 
| 4169 4635 | 
             
            							<xsl:choose>
         | 
| @@ -4174,7 +4640,7 @@ | |
| 4174 4640 | 
             
            									<xsl:value-of select="substring-before(name(/*), '-')"/>
         | 
| 4175 4641 | 
             
            								</xsl:otherwise>
         | 
| 4176 4642 | 
             
            							</xsl:choose>
         | 
| 4177 | 
            -
            						</xsl:variable>
         | 
| 4643 | 
            +
            						</xsl:variable> -->
         | 
| 4178 4644 |  | 
| 4179 4645 | 
             
            						<xsl:for-each select="*[local-name() = 'dl'][1]">
         | 
| 4180 4646 | 
             
            							<tbody>
         | 
| @@ -4185,7 +4651,7 @@ | |
| 4185 4651 |  | 
| 4186 4652 | 
             
            					<xsl:call-template name="calculate-column-widths">
         | 
| 4187 4653 | 
             
            						<xsl:with-param name="cols-count" select="2"/>
         | 
| 4188 | 
            -
            						<xsl:with-param name="table" select="$ | 
| 4654 | 
            +
            						<xsl:with-param name="table" select="$simple-table"/>
         | 
| 4189 4655 | 
             
            					</xsl:call-template>
         | 
| 4190 4656 |  | 
| 4191 4657 | 
             
            				</xsl:if>
         | 
| @@ -4384,7 +4850,18 @@ | |
| 4384 4850 |  | 
| 4385 4851 |  | 
| 4386 4852 |  | 
| 4853 | 
            +
            							
         | 
| 4854 | 
            +
            							<xsl:if test="$isGenerateTableIF = 'true'">
         | 
| 4855 | 
            +
            								<!-- to determine start of table -->
         | 
| 4856 | 
            +
            								<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
         | 
| 4857 | 
            +
            							</xsl:if>
         | 
| 4858 | 
            +
            							
         | 
| 4387 4859 | 
             
            							<fo:table width="95%" table-layout="fixed">
         | 
| 4860 | 
            +
            							
         | 
| 4861 | 
            +
            								<xsl:if test="$isGenerateTableIF = 'true'">
         | 
| 4862 | 
            +
            									<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
         | 
| 4863 | 
            +
            								</xsl:if>
         | 
| 4864 | 
            +
            							
         | 
| 4388 4865 |  | 
| 4389 4866 | 
             
            								<xsl:choose>
         | 
| 4390 4867 | 
             
            									<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
         | 
| @@ -4393,52 +4870,130 @@ | |
| 4393 4870 |  | 
| 4394 4871 | 
             
            									</xsl:when>
         | 
| 4395 4872 | 
             
            								</xsl:choose>
         | 
| 4396 | 
            -
            								 | 
| 4397 | 
            -
            								 | 
| 4398 | 
            -
             | 
| 4873 | 
            +
            								
         | 
| 4874 | 
            +
            								
         | 
| 4875 | 
            +
            								<xsl:choose>
         | 
| 4876 | 
            +
            									<xsl:when test="$isGenerateTableIF = 'true'">
         | 
| 4877 | 
            +
            										<!-- generate IF for table widths -->
         | 
| 4878 | 
            +
            										<!-- example:
         | 
| 4879 | 
            +
            											<tr>
         | 
| 4880 | 
            +
            												<td valign="top" align="left" id="tab-symdu_1_1">
         | 
| 4881 | 
            +
            													<p>Symbol</p>
         | 
| 4882 | 
            +
            													<word id="tab-symdu_1_1_word_1">Symbol</word>
         | 
| 4883 | 
            +
            												</td>
         | 
| 4884 | 
            +
            												<td valign="top" align="left" id="tab-symdu_1_2">
         | 
| 4885 | 
            +
            													<p>Description</p>
         | 
| 4886 | 
            +
            													<word id="tab-symdu_1_2_word_1">Description</word>
         | 
| 4887 | 
            +
            												</td>
         | 
| 4888 | 
            +
            											</tr>
         | 
| 4889 | 
            +
            										-->
         | 
| 4399 4890 |  | 
| 4400 | 
            -
             | 
| 4401 | 
            -
             | 
| 4402 | 
            -
             | 
| 4403 | 
            -
            											<xsl: | 
| 4404 | 
            -
            												< | 
| 4405 | 
            -
             | 
| 4406 | 
            -
             | 
| 4407 | 
            -
             | 
| 4408 | 
            -
             | 
| 4409 | 
            -
             | 
| 4410 | 
            -
             | 
| 4411 | 
            -
             | 
| 4412 | 
            -
             | 
| 4413 | 
            -
             | 
| 4414 | 
            -
             | 
| 4415 | 
            -
             | 
| 4416 | 
            -
             | 
| 4417 | 
            -
             | 
| 4418 | 
            -
             | 
| 4419 | 
            -
             | 
| 4420 | 
            -
             | 
| 4421 | 
            -
             | 
| 4422 | 
            -
             | 
| 4423 | 
            -
             | 
| 4424 | 
            -
             | 
| 4425 | 
            -
             | 
| 4426 | 
            -
             | 
| 4427 | 
            -
             | 
| 4428 | 
            -
             | 
| 4429 | 
            -
             | 
| 4430 | 
            -
             | 
| 4431 | 
            -
             | 
| 4432 | 
            -
             | 
| 4433 | 
            -
             | 
| 4434 | 
            -
             | 
| 4435 | 
            -
             | 
| 4891 | 
            +
            										<!-- create virtual html table for dl/[dt and dd] -->
         | 
| 4892 | 
            +
            										<xsl:variable name="simple-table">
         | 
| 4893 | 
            +
            											
         | 
| 4894 | 
            +
            											<xsl:variable name="dl_table">
         | 
| 4895 | 
            +
            												<tbody>
         | 
| 4896 | 
            +
            													<xsl:apply-templates mode="dl_if">
         | 
| 4897 | 
            +
            														<xsl:with-param name="id" select="@id"/>
         | 
| 4898 | 
            +
            													</xsl:apply-templates>
         | 
| 4899 | 
            +
            												</tbody>
         | 
| 4900 | 
            +
            											</xsl:variable>
         | 
| 4901 | 
            +
            											
         | 
| 4902 | 
            +
            											<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
         | 
| 4903 | 
            +
            											
         | 
| 4904 | 
            +
            											<!-- Step: replace <br/> to <p>...</p> -->
         | 
| 4905 | 
            +
            											<xsl:variable name="table_without_br">
         | 
| 4906 | 
            +
            												<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
         | 
| 4907 | 
            +
            											</xsl:variable>
         | 
| 4908 | 
            +
            											
         | 
| 4909 | 
            +
            											<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
         | 
| 4910 | 
            +
            											
         | 
| 4911 | 
            +
            											<!-- Step: add id to each cell -->
         | 
| 4912 | 
            +
            											<!-- add <word>...</word> for each word, image, math -->
         | 
| 4913 | 
            +
            											<xsl:variable name="simple-table-id">
         | 
| 4914 | 
            +
            												<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
         | 
| 4915 | 
            +
            													<xsl:with-param name="id" select="@id"/>
         | 
| 4916 | 
            +
            												</xsl:apply-templates>
         | 
| 4917 | 
            +
            											</xsl:variable>
         | 
| 4918 | 
            +
            											
         | 
| 4919 | 
            +
            											<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
         | 
| 4920 | 
            +
            											
         | 
| 4921 | 
            +
            											<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
         | 
| 4922 | 
            +
            											
         | 
| 4923 | 
            +
            										</xsl:variable>
         | 
| 4924 | 
            +
            										
         | 
| 4925 | 
            +
            										<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
         | 
| 4926 | 
            +
            										
         | 
| 4927 | 
            +
            										<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
         | 
| 4928 | 
            +
            											<xsl:with-param name="table_or_dl">dl</xsl:with-param>
         | 
| 4929 | 
            +
            										</xsl:apply-templates>
         | 
| 4930 | 
            +
            										
         | 
| 4931 | 
            +
            									</xsl:when>
         | 
| 4932 | 
            +
            									<xsl:otherwise>
         | 
| 4436 4933 |  | 
| 4437 | 
            -
             | 
| 4438 | 
            -
             | 
| 4439 | 
            -
             | 
| 4440 | 
            -
             | 
| 4441 | 
            -
             | 
| 4934 | 
            +
            										<xsl:variable name="simple-table">
         | 
| 4935 | 
            +
            										
         | 
| 4936 | 
            +
            											<xsl:variable name="dl_table">
         | 
| 4937 | 
            +
            												<tbody>
         | 
| 4938 | 
            +
            													<xsl:apply-templates mode="dl">
         | 
| 4939 | 
            +
            														<xsl:with-param name="id" select="@id"/>
         | 
| 4940 | 
            +
            													</xsl:apply-templates>
         | 
| 4941 | 
            +
            												</tbody>
         | 
| 4942 | 
            +
            											</xsl:variable>
         | 
| 4943 | 
            +
            											
         | 
| 4944 | 
            +
            											<xsl:copy-of select="$dl_table"/>
         | 
| 4945 | 
            +
            										</xsl:variable>
         | 
| 4946 | 
            +
            								
         | 
| 4947 | 
            +
            										<xsl:variable name="colwidths">
         | 
| 4948 | 
            +
            											<xsl:call-template name="calculate-column-widths">
         | 
| 4949 | 
            +
            												<xsl:with-param name="cols-count" select="2"/>
         | 
| 4950 | 
            +
            												<xsl:with-param name="table" select="$simple-table"/>
         | 
| 4951 | 
            +
            											</xsl:call-template>
         | 
| 4952 | 
            +
            										</xsl:variable>
         | 
| 4953 | 
            +
            										
         | 
| 4954 | 
            +
            										<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
         | 
| 4955 | 
            +
            											DEBUG
         | 
| 4956 | 
            +
            											colwidths=<xsl:copy-of select="$colwidths"/>
         | 
| 4957 | 
            +
            										<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
         | 
| 4958 | 
            +
            										
         | 
| 4959 | 
            +
            										<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
         | 
| 4960 | 
            +
            										
         | 
| 4961 | 
            +
            										<xsl:variable name="maxlength_dt">
         | 
| 4962 | 
            +
            											<xsl:call-template name="getMaxLength_dt"/>							
         | 
| 4963 | 
            +
            										</xsl:variable>
         | 
| 4964 | 
            +
            										
         | 
| 4965 | 
            +
            										<xsl:variable name="isContainsKeepTogetherTag_">
         | 
| 4966 | 
            +
            											false
         | 
| 4967 | 
            +
            										</xsl:variable>
         | 
| 4968 | 
            +
            										<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
         | 
| 4969 | 
            +
            										<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
         | 
| 4970 | 
            +
            										
         | 
| 4971 | 
            +
            										
         | 
| 4972 | 
            +
            										<xsl:call-template name="setColumnWidth_dl">
         | 
| 4973 | 
            +
            											<xsl:with-param name="colwidths" select="$colwidths"/>							
         | 
| 4974 | 
            +
            											<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
         | 
| 4975 | 
            +
            											<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
         | 
| 4976 | 
            +
            										</xsl:call-template>
         | 
| 4977 | 
            +
            										
         | 
| 4978 | 
            +
            										<fo:table-body>
         | 
| 4979 | 
            +
            											
         | 
| 4980 | 
            +
            											<!-- DEBUG -->
         | 
| 4981 | 
            +
            											<xsl:if test="$table_if_debug = 'true'">
         | 
| 4982 | 
            +
            												<fo:table-row>
         | 
| 4983 | 
            +
            													<fo:table-cell number-columns-spanned="2" font-size="60%">
         | 
| 4984 | 
            +
            														<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
         | 
| 4985 | 
            +
            													</fo:table-cell>
         | 
| 4986 | 
            +
            												</fo:table-row>
         | 
| 4987 | 
            +
            											</xsl:if>
         | 
| 4988 | 
            +
             | 
| 4989 | 
            +
            											<xsl:apply-templates>
         | 
| 4990 | 
            +
            												<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
         | 
| 4991 | 
            +
            												<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
         | 
| 4992 | 
            +
            											</xsl:apply-templates>
         | 
| 4993 | 
            +
            											
         | 
| 4994 | 
            +
            										</fo:table-body>
         | 
| 4995 | 
            +
            									</xsl:otherwise>
         | 
| 4996 | 
            +
            								</xsl:choose>
         | 
| 4442 4997 | 
             
            							</fo:table>
         | 
| 4443 4998 | 
             
            						</fo:block>
         | 
| 4444 4999 | 
             
            					</fo:block>
         | 
| @@ -4449,6 +5004,9 @@ | |
| 4449 5004 | 
             
            		<xsl:param name="colwidths"/>		
         | 
| 4450 5005 | 
             
            		<xsl:param name="maxlength_dt"/>
         | 
| 4451 5006 | 
             
            		<xsl:param name="isContainsKeepTogetherTag"/>
         | 
| 5007 | 
            +
            		
         | 
| 5008 | 
            +
            		<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
         | 
| 5009 | 
            +
            		
         | 
| 4452 5010 | 
             
            		<xsl:choose>
         | 
| 4453 5011 | 
             
            			<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
         | 
| 4454 5012 | 
             
            				<fo:table-column column-width="50%"/>
         | 
| @@ -4456,6 +5014,11 @@ | |
| 4456 5014 | 
             
            			</xsl:when>
         | 
| 4457 5015 | 
             
            			<xsl:otherwise>
         | 
| 4458 5016 | 
             
            				<xsl:choose>
         | 
| 5017 | 
            +
            					<xsl:when test="xalan:nodeset($colwidths)/autolayout">
         | 
| 5018 | 
            +
            						<xsl:call-template name="insertTableColumnWidth">
         | 
| 5019 | 
            +
            							<xsl:with-param name="colwidths" select="$colwidths"/>
         | 
| 5020 | 
            +
            						</xsl:call-template>
         | 
| 5021 | 
            +
            					</xsl:when>
         | 
| 4459 5022 | 
             
            					<xsl:when test="$isContainsKeepTogetherTag">
         | 
| 4460 5023 | 
             
            						<xsl:call-template name="insertTableColumnWidth">
         | 
| 4461 5024 | 
             
            							<xsl:with-param name="colwidths" select="$colwidths"/>
         | 
| @@ -4500,13 +5063,19 @@ | |
| 4500 5063 | 
             
            		</xsl:choose>
         | 
| 4501 5064 | 
             
            	</xsl:template><xsl:template name="insertTableColumnWidth">
         | 
| 4502 5065 | 
             
            		<xsl:param name="colwidths"/>
         | 
| 5066 | 
            +
            		
         | 
| 4503 5067 | 
             
            		<xsl:for-each select="xalan:nodeset($colwidths)//column">
         | 
| 4504 5068 | 
             
            			<xsl:choose>
         | 
| 4505 5069 | 
             
            				<xsl:when test=". = 1 or . = 0">
         | 
| 4506 5070 | 
             
            					<fo:table-column column-width="proportional-column-width(2)"/>
         | 
| 4507 5071 | 
             
            				</xsl:when>
         | 
| 4508 5072 | 
             
            				<xsl:otherwise>
         | 
| 4509 | 
            -
            					<fo:table-column column-width="proportional-column-width({.})"/>
         | 
| 5073 | 
            +
            					<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
         | 
| 5074 | 
            +
            					<xsl:variable name="divider">
         | 
| 5075 | 
            +
            						<xsl:value-of select="@divider"/>
         | 
| 5076 | 
            +
            						<xsl:if test="not(@divider)">1</xsl:if>
         | 
| 5077 | 
            +
            					</xsl:variable>
         | 
| 5078 | 
            +
            					<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
         | 
| 4510 5079 | 
             
            				</xsl:otherwise>
         | 
| 4511 5080 | 
             
            			</xsl:choose>
         | 
| 4512 5081 | 
             
            		</xsl:for-each>
         | 
| @@ -4568,11 +5137,19 @@ | |
| 4568 5137 | 
             
            			</fo:table-cell>
         | 
| 4569 5138 | 
             
            		</fo:table-row>
         | 
| 4570 5139 | 
             
            	</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
         | 
| 5140 | 
            +
            		<xsl:param name="id"/>
         | 
| 5141 | 
            +
            		<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
         | 
| 4571 5142 | 
             
            		<tr>
         | 
| 4572 5143 | 
             
            			<td>
         | 
| 5144 | 
            +
            				<xsl:attribute name="id">
         | 
| 5145 | 
            +
            					<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
         | 
| 5146 | 
            +
            				</xsl:attribute>
         | 
| 4573 5147 | 
             
            				<xsl:apply-templates/>
         | 
| 4574 5148 | 
             
            			</td>
         | 
| 4575 5149 | 
             
            			<td>
         | 
| 5150 | 
            +
            				<xsl:attribute name="id">
         | 
| 5151 | 
            +
            					<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
         | 
| 5152 | 
            +
            				</xsl:attribute>
         | 
| 4576 5153 |  | 
| 4577 5154 | 
             
            						<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
         | 
| 4578 5155 | 
             
            							<xsl:with-param name="process">true</xsl:with-param>
         | 
| @@ -4583,50 +5160,122 @@ | |
| 4583 5160 |  | 
| 4584 5161 | 
             
            	</xsl:template><xsl:template match="*[local-name()='dt']">
         | 
| 4585 5162 | 
             
            		<xsl:param name="key_iso"/>
         | 
| 5163 | 
            +
            		<xsl:param name="split_keep-within-line"/>
         | 
| 4586 5164 |  | 
| 4587 5165 | 
             
            		<fo:table-row xsl:use-attribute-sets="dt-row-style">
         | 
| 4588 | 
            -
            			< | 
| 5166 | 
            +
            			<xsl:call-template name="insert_dt_cell">
         | 
| 5167 | 
            +
            				<xsl:with-param name="key_iso" select="$key_iso"/>
         | 
| 5168 | 
            +
            				<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
         | 
| 5169 | 
            +
            			</xsl:call-template>
         | 
| 5170 | 
            +
            			<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
         | 
| 5171 | 
            +
            				<xsl:call-template name="insert_dd_cell">
         | 
| 5172 | 
            +
            					<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
         | 
| 5173 | 
            +
            				</xsl:call-template>
         | 
| 5174 | 
            +
            			</xsl:for-each>
         | 
| 5175 | 
            +
            		</fo:table-row>
         | 
| 5176 | 
            +
            	</xsl:template><xsl:template name="insert_dt_cell">
         | 
| 5177 | 
            +
            		<xsl:param name="key_iso"/>
         | 
| 5178 | 
            +
            		<xsl:param name="split_keep-within-line"/>
         | 
| 5179 | 
            +
            		<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
         | 
| 5180 | 
            +
            		
         | 
| 5181 | 
            +
            			<xsl:if test="$isGenerateTableIF = 'true'">
         | 
| 5182 | 
            +
            				<!-- border is mandatory, to calculate real width -->
         | 
| 5183 | 
            +
            				<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
         | 
| 5184 | 
            +
            				<xsl:attribute name="text-align">left</xsl:attribute>
         | 
| 5185 | 
            +
            			</xsl:if>
         | 
| 5186 | 
            +
            			
         | 
| 5187 | 
            +
            			
         | 
| 5188 | 
            +
            			<fo:block xsl:use-attribute-sets="dt-block-style">
         | 
| 5189 | 
            +
            				<xsl:copy-of select="@id"/>
         | 
| 5190 | 
            +
            				
         | 
| 5191 | 
            +
            				<xsl:if test="normalize-space($key_iso) = 'true'">
         | 
| 5192 | 
            +
            					<xsl:attribute name="margin-top">0</xsl:attribute>
         | 
| 5193 | 
            +
            				</xsl:if>
         | 
| 5194 | 
            +
            				
         | 
| 5195 | 
            +
            				
         | 
| 5196 | 
            +
            				
         | 
| 5197 | 
            +
            				<xsl:apply-templates>
         | 
| 5198 | 
            +
            					<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
         | 
| 5199 | 
            +
            				</xsl:apply-templates>
         | 
| 5200 | 
            +
            				
         | 
| 5201 | 
            +
            				<xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
         | 
| 5202 | 
            +
            				
         | 
| 5203 | 
            +
            			</fo:block>
         | 
| 5204 | 
            +
            		</fo:table-cell>
         | 
| 5205 | 
            +
            	</xsl:template><xsl:template name="insert_dd_cell">
         | 
| 5206 | 
            +
            		<xsl:param name="split_keep-within-line"/>
         | 
| 5207 | 
            +
            		<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
         | 
| 5208 | 
            +
            		
         | 
| 5209 | 
            +
            			<xsl:if test="$isGenerateTableIF = 'true'">
         | 
| 5210 | 
            +
            				<!-- border is mandatory, to calculate real width -->
         | 
| 5211 | 
            +
            				<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
         | 
| 5212 | 
            +
            			</xsl:if>
         | 
| 5213 | 
            +
            		
         | 
| 5214 | 
            +
            			<fo:block>
         | 
| 5215 | 
            +
            			
         | 
| 5216 | 
            +
            				<xsl:if test="$isGenerateTableIF = 'true'">
         | 
| 5217 | 
            +
            					<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
         | 
| 5218 | 
            +
            				</xsl:if>
         | 
| 5219 | 
            +
            			
         | 
| 4589 5220 |  | 
| 4590 | 
            -
            				<fo:block xsl:use-attribute-sets="dt-style">
         | 
| 4591 | 
            -
            					<xsl:copy-of select="@id"/>
         | 
| 4592 | 
            -
            					
         | 
| 4593 | 
            -
            					<xsl:if test="normalize-space($key_iso) = 'true'">
         | 
| 4594 | 
            -
            						<xsl:attribute name="margin-top">0</xsl:attribute>
         | 
| 4595 | 
            -
            					</xsl:if>
         | 
| 4596 | 
            -
            					
         | 
| 4597 | 
            -
            					
         | 
| 4598 | 
            -
            					
         | 
| 4599 | 
            -
            					<xsl:apply-templates/>
         | 
| 4600 | 
            -
            				</fo:block>
         | 
| 4601 | 
            -
            			</fo:table-cell>
         | 
| 4602 | 
            -
            			<fo:table-cell>
         | 
| 4603 | 
            -
            				<fo:block>
         | 
| 4604 | 
            -
            					
         | 
| 4605 5221 |  | 
| 4606 | 
            -
             | 
| 4607 | 
            -
             | 
| 4608 | 
            -
             | 
| 4609 | 
            -
             | 
| 4610 | 
            -
             | 
| 4611 | 
            -
             | 
| 5222 | 
            +
            				<xsl:choose>
         | 
| 5223 | 
            +
            					<xsl:when test="$isGenerateTableIF = 'true'">
         | 
| 5224 | 
            +
            						<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
         | 
| 5225 | 
            +
            							<xsl:with-param name="process">true</xsl:with-param>
         | 
| 5226 | 
            +
            						</xsl:apply-templates>
         | 
| 5227 | 
            +
            					</xsl:when>
         | 
| 5228 | 
            +
            					<xsl:otherwise>
         | 
| 5229 | 
            +
            						<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
         | 
| 5230 | 
            +
            							<xsl:with-param name="process">true</xsl:with-param>
         | 
| 5231 | 
            +
            							<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
         | 
| 5232 | 
            +
            						</xsl:apply-templates>
         | 
| 5233 | 
            +
            					</xsl:otherwise>
         | 
| 5234 | 
            +
            				
         | 
| 5235 | 
            +
            				</xsl:choose>
         | 
| 5236 | 
            +
            				
         | 
| 5237 | 
            +
            				<xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
         | 
| 5238 | 
            +
            				
         | 
| 5239 | 
            +
            			</fo:block>
         | 
| 5240 | 
            +
            		</fo:table-cell>
         | 
| 4612 5241 | 
             
            	</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
         | 
| 4613 5242 | 
             
            		<xsl:apply-templates/>
         | 
| 4614 5243 | 
             
            	</xsl:template><xsl:template match="*[local-name()='dd']">
         | 
| 4615 5244 | 
             
            		<xsl:param name="process">false</xsl:param>
         | 
| 5245 | 
            +
            		<xsl:param name="split_keep-within-line"/>
         | 
| 4616 5246 | 
             
            		<xsl:if test="$process = 'true'">
         | 
| 4617 5247 | 
             
            			<xsl:apply-templates select="@language"/>
         | 
| 4618 | 
            -
            			<xsl:apply-templates | 
| 5248 | 
            +
            			<xsl:apply-templates>
         | 
| 5249 | 
            +
            				<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
         | 
| 5250 | 
            +
            			</xsl:apply-templates>
         | 
| 4619 5251 | 
             
            		</xsl:if>
         | 
| 4620 5252 | 
             
            	</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
         | 
| 4621 5253 | 
             
            		<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
         | 
| 4622 | 
            -
            	</xsl:template><xsl:template match="*[local-name()=' | 
| 5254 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
         | 
| 5255 | 
            +
            		<xsl:param name="id"/>
         | 
| 5256 | 
            +
            		<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
         | 
| 5257 | 
            +
            		<tr>
         | 
| 5258 | 
            +
            			<td>
         | 
| 5259 | 
            +
            				<xsl:copy-of select="node()"/>
         | 
| 5260 | 
            +
            			</td>
         | 
| 5261 | 
            +
            			<td>
         | 
| 5262 | 
            +
            				
         | 
| 5263 | 
            +
            						<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
         | 
| 5264 | 
            +
            					
         | 
| 5265 | 
            +
            			</td>
         | 
| 5266 | 
            +
            		</tr>
         | 
| 5267 | 
            +
            		
         | 
| 5268 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
         | 
| 4623 5269 | 
             
            		<fo:inline font-style="italic">
         | 
| 4624 5270 | 
             
            			<xsl:apply-templates/>
         | 
| 4625 5271 | 
             
            		</fo:inline>
         | 
| 4626 5272 | 
             
            	</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
         | 
| 5273 | 
            +
            		<xsl:param name="split_keep-within-line"/>
         | 
| 4627 5274 | 
             
            		<fo:inline font-weight="bold">
         | 
| 4628 5275 |  | 
| 4629 | 
            -
            			<xsl:apply-templates | 
| 5276 | 
            +
            			<xsl:apply-templates>
         | 
| 5277 | 
            +
            				<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
         | 
| 5278 | 
            +
            			</xsl:apply-templates>
         | 
| 4630 5279 | 
             
            		</fo:inline>
         | 
| 4631 5280 | 
             
            	</xsl:template><xsl:template match="*[local-name()='padding']">
         | 
| 4632 5281 | 
             
            		<fo:inline padding-right="{@value}"> </fo:inline>
         | 
| @@ -4827,6 +5476,10 @@ | |
| 4827 5476 | 
             
            		<xsl:param name="text"/>
         | 
| 4828 5477 | 
             
            		<xsl:param name="separator" select="' '"/>
         | 
| 4829 5478 | 
             
            		<xsl:choose>
         | 
| 5479 | 
            +
            		
         | 
| 5480 | 
            +
            			<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
         | 
| 5481 | 
            +
            				<word><xsl:value-of select="normalize-space($text)"/></word>
         | 
| 5482 | 
            +
            			</xsl:when>
         | 
| 4830 5483 | 
             
            			<xsl:when test="not(contains($text, $separator))">
         | 
| 4831 5484 | 
             
            				<word>
         | 
| 4832 5485 | 
             
            					<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
         | 
| @@ -4871,13 +5524,66 @@ | |
| 4871 5524 | 
             
            			</xsl:when>
         | 
| 4872 5525 | 
             
            			<xsl:otherwise>
         | 
| 4873 5526 | 
             
            				<word>
         | 
| 4874 | 
            -
            					<xsl: | 
| 5527 | 
            +
            					<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
         | 
| 5528 | 
            +
            					<xsl:choose>
         | 
| 5529 | 
            +
            						<xsl:when test="$isGenerateTableIF = 'true'">
         | 
| 5530 | 
            +
            							<xsl:value-of select="$word"/>
         | 
| 5531 | 
            +
            						</xsl:when>
         | 
| 5532 | 
            +
            						<xsl:otherwise>
         | 
| 5533 | 
            +
            							<xsl:value-of select="string-length($word)"/>
         | 
| 5534 | 
            +
            						</xsl:otherwise>
         | 
| 5535 | 
            +
            					</xsl:choose>
         | 
| 4875 5536 | 
             
            				</word>
         | 
| 4876 5537 | 
             
            				<xsl:call-template name="tokenize">
         | 
| 4877 5538 | 
             
            					<xsl:with-param name="text" select="substring-after($text, $separator)"/>
         | 
| 4878 5539 | 
             
            				</xsl:call-template>
         | 
| 4879 5540 | 
             
            			</xsl:otherwise>
         | 
| 4880 5541 | 
             
            		</xsl:choose>
         | 
| 5542 | 
            +
            	</xsl:template><xsl:template name="tokenize_with_tags">
         | 
| 5543 | 
            +
            		<xsl:param name="tags"/>
         | 
| 5544 | 
            +
            		<xsl:param name="text"/>
         | 
| 5545 | 
            +
            		<xsl:param name="separator" select="' '"/>
         | 
| 5546 | 
            +
            		<xsl:choose>
         | 
| 5547 | 
            +
            		
         | 
| 5548 | 
            +
            			<xsl:when test="not(contains($text, $separator))">
         | 
| 5549 | 
            +
            				<word>
         | 
| 5550 | 
            +
            					<xsl:call-template name="enclose_text_in_tags">
         | 
| 5551 | 
            +
            						<xsl:with-param name="text" select="normalize-space($text)"/>
         | 
| 5552 | 
            +
            						<xsl:with-param name="tags" select="$tags"/>
         | 
| 5553 | 
            +
            					</xsl:call-template>
         | 
| 5554 | 
            +
            				</word>
         | 
| 5555 | 
            +
            			</xsl:when>
         | 
| 5556 | 
            +
            			<xsl:otherwise>
         | 
| 5557 | 
            +
            				<word>
         | 
| 5558 | 
            +
            					<xsl:call-template name="enclose_text_in_tags">
         | 
| 5559 | 
            +
            						<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
         | 
| 5560 | 
            +
            						<xsl:with-param name="tags" select="$tags"/>
         | 
| 5561 | 
            +
            					</xsl:call-template>
         | 
| 5562 | 
            +
            				</word>
         | 
| 5563 | 
            +
            				<xsl:call-template name="tokenize_with_tags">
         | 
| 5564 | 
            +
            					<xsl:with-param name="text" select="substring-after($text, $separator)"/>
         | 
| 5565 | 
            +
            				</xsl:call-template>
         | 
| 5566 | 
            +
            			</xsl:otherwise>
         | 
| 5567 | 
            +
            		</xsl:choose>
         | 
| 5568 | 
            +
            	</xsl:template><xsl:template name="enclose_text_in_tags">
         | 
| 5569 | 
            +
            		<xsl:param name="text"/>
         | 
| 5570 | 
            +
            		<xsl:param name="tags"/>
         | 
| 5571 | 
            +
            		<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
         | 
| 5572 | 
            +
            		
         | 
| 5573 | 
            +
            		<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
         | 
| 5574 | 
            +
            		
         | 
| 5575 | 
            +
            		<xsl:choose>
         | 
| 5576 | 
            +
            			<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
         | 
| 5577 | 
            +
            			<xsl:otherwise>
         | 
| 5578 | 
            +
            				<xsl:element name="{$tag_name}">
         | 
| 5579 | 
            +
            					<xsl:call-template name="enclose_text_in_tags">
         | 
| 5580 | 
            +
            						<xsl:with-param name="text" select="$text"/>
         | 
| 5581 | 
            +
            						<xsl:with-param name="tags" select="$tags"/>
         | 
| 5582 | 
            +
            						<xsl:with-param name="num" select="$num + 1"/>
         | 
| 5583 | 
            +
            					</xsl:call-template>
         | 
| 5584 | 
            +
            				</xsl:element>
         | 
| 5585 | 
            +
            			</xsl:otherwise>
         | 
| 5586 | 
            +
            		</xsl:choose>
         | 
| 4881 5587 | 
             
            	</xsl:template><xsl:template name="max_length">
         | 
| 4882 5588 | 
             
            		<xsl:param name="words"/>
         | 
| 4883 5589 | 
             
            		<xsl:for-each select="$words//word">
         | 
| @@ -4978,12 +5684,19 @@ | |
| 4978 5684 | 
             
            			</xsl:otherwise>
         | 
| 4979 5685 | 
             
            		</xsl:choose>
         | 
| 4980 5686 | 
             
            	</xsl:template><xsl:template name="getSimpleTable">
         | 
| 5687 | 
            +
            		<xsl:param name="id"/>
         | 
| 5688 | 
            +
            		
         | 
| 4981 5689 | 
             
            		<xsl:variable name="simple-table">
         | 
| 4982 5690 |  | 
| 5691 | 
            +
            			<!-- Step 0. replace <br/> to <p>...</p> -->
         | 
| 5692 | 
            +
            			<xsl:variable name="table_without_br">
         | 
| 5693 | 
            +
            				<xsl:apply-templates mode="table-without-br"/>
         | 
| 5694 | 
            +
            			</xsl:variable>
         | 
| 5695 | 
            +
            		
         | 
| 4983 5696 | 
             
            			<!-- Step 1. colspan processing -->
         | 
| 4984 5697 | 
             
            			<xsl:variable name="simple-table-colspan">
         | 
| 4985 5698 | 
             
            				<tbody>
         | 
| 4986 | 
            -
            					<xsl:apply-templates mode="simple-table-colspan"/>
         | 
| 5699 | 
            +
            					<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
         | 
| 4987 5700 | 
             
            				</tbody>
         | 
| 4988 5701 | 
             
            			</xsl:variable>
         | 
| 4989 5702 |  | 
| @@ -4992,10 +5705,67 @@ | |
| 4992 5705 | 
             
            				<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
         | 
| 4993 5706 | 
             
            			</xsl:variable>
         | 
| 4994 5707 |  | 
| 4995 | 
            -
            			 | 
| 4996 | 
            -
             | 
| 5708 | 
            +
            			<!-- Step 3: add id to each cell -->
         | 
| 5709 | 
            +
            			<!-- add <word>...</word> for each word, image, math -->
         | 
| 5710 | 
            +
            			<xsl:variable name="simple-table-id">
         | 
| 5711 | 
            +
            				<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
         | 
| 5712 | 
            +
            					<xsl:with-param name="id" select="$id"/>
         | 
| 5713 | 
            +
            				</xsl:apply-templates>
         | 
| 5714 | 
            +
            			</xsl:variable>
         | 
| 5715 | 
            +
            			
         | 
| 5716 | 
            +
            			<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
         | 
| 5717 | 
            +
             | 
| 4997 5718 | 
             
            		</xsl:variable>
         | 
| 4998 5719 | 
             
            		<xsl:copy-of select="$simple-table"/>
         | 
| 5720 | 
            +
            	</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
         | 
| 5721 | 
            +
            		<xsl:copy>
         | 
| 5722 | 
            +
            				<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
         | 
| 5723 | 
            +
            		</xsl:copy>
         | 
| 5724 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
         | 
| 5725 | 
            +
            		<xsl:copy>
         | 
| 5726 | 
            +
            			<xsl:copy-of select="@*"/>
         | 
| 5727 | 
            +
            			<p>
         | 
| 5728 | 
            +
            				<xsl:copy-of select="node()"/>
         | 
| 5729 | 
            +
            			</p>
         | 
| 5730 | 
            +
            		</xsl:copy>
         | 
| 5731 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
         | 
| 5732 | 
            +
            		<xsl:copy>
         | 
| 5733 | 
            +
            			<xsl:copy-of select="@*"/>
         | 
| 5734 | 
            +
            			<xsl:for-each select="*[local-name()='br']">
         | 
| 5735 | 
            +
            				<xsl:variable name="current_id" select="generate-id()"/>
         | 
| 5736 | 
            +
            				<p>
         | 
| 5737 | 
            +
            					<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
         | 
| 5738 | 
            +
            						<xsl:copy-of select="."/>
         | 
| 5739 | 
            +
            					</xsl:for-each>
         | 
| 5740 | 
            +
            				</p>
         | 
| 5741 | 
            +
            				<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
         | 
| 5742 | 
            +
            					<p>
         | 
| 5743 | 
            +
            						<xsl:for-each select="following-sibling::node()">
         | 
| 5744 | 
            +
            							<xsl:copy-of select="."/>
         | 
| 5745 | 
            +
            						</xsl:for-each>
         | 
| 5746 | 
            +
            					</p>
         | 
| 5747 | 
            +
            				</xsl:if>
         | 
| 5748 | 
            +
            			</xsl:for-each>
         | 
| 5749 | 
            +
            		</xsl:copy>
         | 
| 5750 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
         | 
| 5751 | 
            +
            		<xsl:for-each select="*[local-name()='br']">
         | 
| 5752 | 
            +
            			<xsl:variable name="current_id" select="generate-id()"/>
         | 
| 5753 | 
            +
            			<p>
         | 
| 5754 | 
            +
            				<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
         | 
| 5755 | 
            +
            					<xsl:copy-of select="."/>
         | 
| 5756 | 
            +
            				</xsl:for-each>
         | 
| 5757 | 
            +
            			</p>
         | 
| 5758 | 
            +
            			<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
         | 
| 5759 | 
            +
            				<p>
         | 
| 5760 | 
            +
            					<xsl:for-each select="following-sibling::node()">
         | 
| 5761 | 
            +
            						<xsl:copy-of select="."/>
         | 
| 5762 | 
            +
            					</xsl:for-each>
         | 
| 5763 | 
            +
            				</p>
         | 
| 5764 | 
            +
            			</xsl:if>
         | 
| 5765 | 
            +
            		</xsl:for-each>
         | 
| 5766 | 
            +
            	</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
         | 
| 5767 | 
            +
            		<xsl:variable name="text" select="translate(.,'	

','')"/>
         | 
| 5768 | 
            +
            		<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
         | 
| 4999 5769 | 
             
            	</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
         | 
| 5000 5770 | 
             
            		<xsl:apply-templates mode="simple-table-colspan"/>
         | 
| 5001 5771 | 
             
            	</xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
         | 
| @@ -5085,6 +5855,126 @@ | |
| 5085 5855 | 
             
            		<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
         | 
| 5086 5856 | 
             
            				<xsl:with-param name="previousRow" select="$newRow"/>
         | 
| 5087 5857 | 
             
            		</xsl:apply-templates>
         | 
| 5858 | 
            +
            	</xsl:template><xsl:template match="/" mode="simple-table-id">
         | 
| 5859 | 
            +
            		<xsl:param name="id"/>
         | 
| 5860 | 
            +
            		<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF  -->
         | 
| 5861 | 
            +
            		<xsl:apply-templates select="@*|node()" mode="simple-table-id">
         | 
| 5862 | 
            +
            			<xsl:with-param name="id" select="$id_prefixed"/>
         | 
| 5863 | 
            +
            		</xsl:apply-templates>
         | 
| 5864 | 
            +
            	</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
         | 
| 5865 | 
            +
            		<xsl:param name="id"/>
         | 
| 5866 | 
            +
            		<xsl:copy>
         | 
| 5867 | 
            +
            				<xsl:apply-templates select="@*|node()" mode="simple-table-id">
         | 
| 5868 | 
            +
            					<xsl:with-param name="id" select="$id"/>
         | 
| 5869 | 
            +
            				</xsl:apply-templates>
         | 
| 5870 | 
            +
            		</xsl:copy>
         | 
| 5871 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
         | 
| 5872 | 
            +
            		<xsl:param name="id"/>
         | 
| 5873 | 
            +
            		<xsl:copy>
         | 
| 5874 | 
            +
            			<xsl:copy-of select="@*"/>
         | 
| 5875 | 
            +
            			<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
         | 
| 5876 | 
            +
            			<xsl:apply-templates select="node()" mode="simple-table-id">
         | 
| 5877 | 
            +
            				<xsl:with-param name="id" select="$id"/>
         | 
| 5878 | 
            +
            			</xsl:apply-templates>
         | 
| 5879 | 
            +
            		</xsl:copy>
         | 
| 5880 | 
            +
            	</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
         | 
| 5881 | 
            +
            		<xsl:param name="id"/>
         | 
| 5882 | 
            +
            		<xsl:copy>
         | 
| 5883 | 
            +
            			<xsl:copy-of select="@*"/>
         | 
| 5884 | 
            +
            			<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
         | 
| 5885 | 
            +
            			<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
         | 
| 5886 | 
            +
            			<xsl:attribute name="id">
         | 
| 5887 | 
            +
            				<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
         | 
| 5888 | 
            +
            			</xsl:attribute>
         | 
| 5889 | 
            +
            			
         | 
| 5890 | 
            +
            			<xsl:for-each select="*[local-name() = 'p']">
         | 
| 5891 | 
            +
            				<xsl:copy>
         | 
| 5892 | 
            +
            					<xsl:copy-of select="@*"/>
         | 
| 5893 | 
            +
            					<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
         | 
| 5894 | 
            +
            					<xsl:attribute name="id">
         | 
| 5895 | 
            +
            						<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
         | 
| 5896 | 
            +
            					</xsl:attribute>
         | 
| 5897 | 
            +
            					
         | 
| 5898 | 
            +
            					<xsl:copy-of select="node()"/>
         | 
| 5899 | 
            +
            				</xsl:copy>
         | 
| 5900 | 
            +
            			</xsl:for-each>
         | 
| 5901 | 
            +
            			
         | 
| 5902 | 
            +
            			
         | 
| 5903 | 
            +
            			<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
         | 
| 5904 | 
            +
            			
         | 
| 5905 | 
            +
            				<xsl:variable name="td_text">
         | 
| 5906 | 
            +
            					<xsl:apply-templates select="." mode="td_text_with_formatting"/>
         | 
| 5907 | 
            +
            				</xsl:variable>
         | 
| 5908 | 
            +
            				
         | 
| 5909 | 
            +
            				<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
         | 
| 5910 | 
            +
            			
         | 
| 5911 | 
            +
            				<xsl:variable name="words">
         | 
| 5912 | 
            +
            					<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
         | 
| 5913 | 
            +
            						<word>
         | 
| 5914 | 
            +
            							<xsl:copy-of select="."/>
         | 
| 5915 | 
            +
            						</word>
         | 
| 5916 | 
            +
            					</xsl:for-each>
         | 
| 5917 | 
            +
            					
         | 
| 5918 | 
            +
            					<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
         | 
| 5919 | 
            +
            						<xsl:copy-of select="."/>
         | 
| 5920 | 
            +
            					</xsl:for-each>
         | 
| 5921 | 
            +
            					
         | 
| 5922 | 
            +
            				</xsl:variable>
         | 
| 5923 | 
            +
            				
         | 
| 5924 | 
            +
            				<xsl:for-each select="xalan:nodeset($words)/word">
         | 
| 5925 | 
            +
            					<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
         | 
| 5926 | 
            +
            					<xsl:copy>
         | 
| 5927 | 
            +
            						<xsl:attribute name="id">
         | 
| 5928 | 
            +
            							<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
         | 
| 5929 | 
            +
            						</xsl:attribute>
         | 
| 5930 | 
            +
            						<xsl:copy-of select="node()"/>
         | 
| 5931 | 
            +
            					</xsl:copy>
         | 
| 5932 | 
            +
            				</xsl:for-each>
         | 
| 5933 | 
            +
            			</xsl:if>
         | 
| 5934 | 
            +
            		</xsl:copy>
         | 
| 5935 | 
            +
            		
         | 
| 5936 | 
            +
            	</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
         | 
| 5937 | 
            +
            		<xsl:copy>
         | 
| 5938 | 
            +
            				<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
         | 
| 5939 | 
            +
            		</xsl:copy>
         | 
| 5940 | 
            +
            	</xsl:template><xsl:template match="*[local-name() = 'stem' or local-name() = 'image']" mode="td_text_with_formatting"/><xsl:template match="*[local-name() = 'keep-together_within-line']/text()" mode="td_text_with_formatting">
         | 
| 5941 | 
            +
            		<xsl:variable name="formatting_tags">
         | 
| 5942 | 
            +
            			<xsl:call-template name="getFormattingTags"/>
         | 
| 5943 | 
            +
            		</xsl:variable>
         | 
| 5944 | 
            +
            		<word>
         | 
| 5945 | 
            +
            			<xsl:call-template name="enclose_text_in_tags">
         | 
| 5946 | 
            +
            				<xsl:with-param name="text" select="normalize-space(.)"/>
         | 
| 5947 | 
            +
            				<xsl:with-param name="tags" select="$formatting_tags"/>
         | 
| 5948 | 
            +
            			</xsl:call-template>
         | 
| 5949 | 
            +
            		</word>
         | 
| 5950 | 
            +
            	</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
         | 
| 5951 | 
            +
            		
         | 
| 5952 | 
            +
            		<xsl:variable name="td_text" select="."/>
         | 
| 5953 | 
            +
            		
         | 
| 5954 | 
            +
            		<xsl:variable name="string_with_added_zerospaces">
         | 
| 5955 | 
            +
            			<xsl:call-template name="add-zero-spaces-java">
         | 
| 5956 | 
            +
            				<xsl:with-param name="text" select="$td_text"/>
         | 
| 5957 | 
            +
            			</xsl:call-template>
         | 
| 5958 | 
            +
            		</xsl:variable>
         | 
| 5959 | 
            +
            		
         | 
| 5960 | 
            +
            		<xsl:variable name="formatting_tags">
         | 
| 5961 | 
            +
            			<xsl:call-template name="getFormattingTags"/>
         | 
| 5962 | 
            +
            		</xsl:variable>
         | 
| 5963 | 
            +
            		
         | 
| 5964 | 
            +
            		<!-- <word>text</word> -->
         | 
| 5965 | 
            +
            		<xsl:call-template name="tokenize_with_tags">
         | 
| 5966 | 
            +
            			<xsl:with-param name="tags" select="$formatting_tags"/>
         | 
| 5967 | 
            +
            			<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', '  '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
         | 
| 5968 | 
            +
            		</xsl:call-template>
         | 
| 5969 | 
            +
            	</xsl:template><xsl:template name="getFormattingTags">
         | 
| 5970 | 
            +
            		<tags>
         | 
| 5971 | 
            +
            			<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
         | 
| 5972 | 
            +
            			<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
         | 
| 5973 | 
            +
            			<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
         | 
| 5974 | 
            +
            			<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
         | 
| 5975 | 
            +
            			<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
         | 
| 5976 | 
            +
            			<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
         | 
| 5977 | 
            +
            		</tags>
         | 
| 5088 5978 | 
             
            	</xsl:template><xsl:template name="getLang">
         | 
| 5089 5979 | 
             
            		<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
         | 
| 5090 5980 | 
             
            		<xsl:variable name="language">
         | 
| @@ -6781,7 +7671,9 @@ | |
| 6781 7671 | 
             
            						<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
         | 
| 6782 7672 | 
             
            					</xsl:if>
         | 
| 6783 7673 | 
             
            					<xsl:variable name="simple-table">	
         | 
| 6784 | 
            -
            						<xsl:call-template name="getSimpleTable" | 
| 7674 | 
            +
            						<xsl:call-template name="getSimpleTable">
         | 
| 7675 | 
            +
            							<xsl:with-param name="id" select="@id"/>
         | 
| 7676 | 
            +
            						</xsl:call-template>
         | 
| 6785 7677 | 
             
            					</xsl:variable>					
         | 
| 6786 7678 | 
             
            					<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
         | 
| 6787 7679 | 
             
            					<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
         | 
| @@ -7751,7 +8643,7 @@ | |
| 7751 8643 | 
             
            		<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
         | 
| 7752 8644 | 
             
            		<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
         | 
| 7753 8645 | 
             
            		<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
         | 
| 7754 | 
            -
            		<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
         | 
| 8646 | 
            +
            		<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
         | 
| 7755 8647 | 
             
            	</xsl:template><xsl:template match="*[local-name() = 'errata']">
         | 
| 7756 8648 | 
             
            		<!-- <row>
         | 
| 7757 8649 | 
             
            					<date>05-07-2013</date>
         | 
| @@ -9095,4 +9987,40 @@ | |
| 9095 9987 | 
             
            				<xsl:value-of select="$value"/>
         | 
| 9096 9988 | 
             
            			</xsl:otherwise>
         | 
| 9097 9989 | 
             
            		</xsl:choose>
         | 
| 9990 | 
            +
            	</xsl:template><xsl:template match="*" mode="print_as_xml">
         | 
| 9991 | 
            +
            		<xsl:param name="level">0</xsl:param>
         | 
| 9992 | 
            +
             | 
| 9993 | 
            +
            		<fo:block margin-left="{2*$level}mm">
         | 
| 9994 | 
            +
            			<xsl:text>
         | 
| 9995 | 
            +
            <</xsl:text>
         | 
| 9996 | 
            +
            			<xsl:value-of select="local-name()"/>
         | 
| 9997 | 
            +
            			<xsl:for-each select="@*">
         | 
| 9998 | 
            +
            				<xsl:text> </xsl:text>
         | 
| 9999 | 
            +
            				<xsl:value-of select="local-name()"/>
         | 
| 10000 | 
            +
            				<xsl:text>="</xsl:text>
         | 
| 10001 | 
            +
            				<xsl:value-of select="."/>
         | 
| 10002 | 
            +
            				<xsl:text>"</xsl:text>
         | 
| 10003 | 
            +
            			</xsl:for-each>
         | 
| 10004 | 
            +
            			<xsl:text>></xsl:text>
         | 
| 10005 | 
            +
            			
         | 
| 10006 | 
            +
            			<xsl:if test="not(*)">
         | 
| 10007 | 
            +
            				<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
         | 
| 10008 | 
            +
            				<xsl:text></</xsl:text>
         | 
| 10009 | 
            +
            					<xsl:value-of select="local-name()"/>
         | 
| 10010 | 
            +
            					<xsl:text>></xsl:text>
         | 
| 10011 | 
            +
            			</xsl:if>
         | 
| 10012 | 
            +
            		</fo:block>
         | 
| 10013 | 
            +
            		
         | 
| 10014 | 
            +
            		<xsl:if test="*">
         | 
| 10015 | 
            +
            			<fo:block>
         | 
| 10016 | 
            +
            				<xsl:apply-templates mode="print_as_xml">
         | 
| 10017 | 
            +
            					<xsl:with-param name="level" select="$level + 1"/>
         | 
| 10018 | 
            +
            				</xsl:apply-templates>
         | 
| 10019 | 
            +
            			</fo:block>
         | 
| 10020 | 
            +
            			<fo:block margin-left="{2*$level}mm">
         | 
| 10021 | 
            +
            				<xsl:text></</xsl:text>
         | 
| 10022 | 
            +
            				<xsl:value-of select="local-name()"/>
         | 
| 10023 | 
            +
            				<xsl:text>></xsl:text>
         | 
| 10024 | 
            +
            			</fo:block>
         | 
| 10025 | 
            +
            		</xsl:if>
         | 
| 9098 10026 | 
             
            	</xsl:template></xsl:stylesheet>
         |