metanorma-itu 2.0.8 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/itu/base_convert.rb +1 -1
- data/lib/isodoc/itu/cleanup.rb +1 -1
- data/lib/isodoc/itu/html/html_itu_titlepage.html +1 -0
- data/lib/isodoc/itu/html/word_itu_intro.html +40 -41
- data/lib/isodoc/itu/html/word_itu_titlepage.html +1 -0
- data/lib/isodoc/itu/html/word_itu_titlepage_sp.html +1 -1
- data/lib/isodoc/itu/html_convert.rb +16 -11
- data/lib/isodoc/itu/init.rb +1 -1
- data/lib/isodoc/itu/itu.implementers-guide.xsl +1500 -279
- data/lib/isodoc/itu/itu.in-force.xsl +1500 -279
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +1500 -279
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +1500 -279
- data/lib/isodoc/itu/itu.recommendation.xsl +1500 -279
- data/lib/isodoc/itu/itu.resolution.xsl +1500 -279
- data/lib/isodoc/itu/itu.service-publication.xsl +1500 -279
- data/lib/isodoc/itu/itu.technical-paper.xsl +1500 -279
- data/lib/isodoc/itu/itu.technical-report.xsl +1500 -279
- data/lib/isodoc/itu/presentation_xml_convert.rb +16 -0
- data/lib/isodoc/itu/ref.rb +20 -32
- data/lib/isodoc/itu/terms.rb +1 -1
- data/lib/isodoc/itu/word_cleanup.rb +11 -9
- data/lib/isodoc/itu/word_convert.rb +1 -1
- data/lib/isodoc/itu/xref.rb +42 -27
- data/lib/isodoc/itu/xref_section.rb +0 -15
- data/lib/metanorma/itu/biblio.rng +37 -8
- data/lib/metanorma/itu/isodoc.rng +56 -0
- data/lib/metanorma/itu/version.rb +1 -1
- data/lib/relaton/render/config.yml +3 -0
- data/lib/relaton/render/general.rb +13 -0
- data/metanorma-itu.gemspec +1 -1
- metadata +6 -4
@@ -1352,6 +1352,7 @@
|
|
1352
1352
|
<!-- PARAGRAPHS -->
|
1353
1353
|
<!-- ============================= -->
|
1354
1354
|
<xsl:template match="itu:p | itu:sections/itu:p" name="paragraph">
|
1355
|
+
<xsl:param name="split_keep-within-line"/>
|
1355
1356
|
<xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
|
1356
1357
|
<xsl:variable name="element-name">
|
1357
1358
|
<xsl:choose>
|
@@ -1404,7 +1405,9 @@
|
|
1404
1405
|
</fo:inline>
|
1405
1406
|
</xsl:if>
|
1406
1407
|
|
1407
|
-
<xsl:apply-templates
|
1408
|
+
<xsl:apply-templates>
|
1409
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
1410
|
+
</xsl:apply-templates>
|
1408
1411
|
</xsl:element>
|
1409
1412
|
<xsl:if test="$element-name = 'fo:inline'">
|
1410
1413
|
<fo:block><xsl:value-of select="$linebreak"/></fo:block>
|
@@ -2068,7 +2071,9 @@
|
|
2068
2071
|
</xsl:if>
|
2069
2072
|
</xsl:template>
|
2070
2073
|
|
2071
|
-
<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:variable name="
|
2074
|
+
<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_">
|
2075
|
+
false
|
2076
|
+
</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
|
2072
2077
|
<xsl:call-template name="getLang"/>
|
2073
2078
|
</xsl:variable><xsl:variable name="pageWidth_">
|
2074
2079
|
210
|
@@ -2083,20 +2088,7 @@
|
|
2083
2088
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
2084
2089
|
20
|
2085
2090
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
2086
|
-
|
2087
|
-
<title-edition lang="en">
|
2088
|
-
|
2089
|
-
<xsl:text>Edition </xsl:text>
|
2090
|
-
|
2091
|
-
</title-edition>
|
2092
|
-
|
2093
|
-
<title-edition lang="fr">
|
2094
|
-
<xsl:text>Édition </xsl:text>
|
2095
|
-
</title-edition>
|
2096
2091
|
|
2097
|
-
<title-edition lang="ru">
|
2098
|
-
<xsl:text>Издание </xsl:text>
|
2099
|
-
</title-edition>
|
2100
2092
|
|
2101
2093
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
2102
2094
|
<title-toc lang="en">
|
@@ -2175,7 +2167,7 @@
|
|
2175
2167
|
</xsl:variable><xsl:variable name="bibdata">
|
2176
2168
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
2177
2169
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
2178
|
-
</xsl:variable><xsl:variable name="linebreak">
</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space"></xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
|
2170
|
+
</xsl:variable><xsl:variable name="linebreak">
</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space"></xsl:variable><xsl:variable name="hair_space"> </xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
|
2179
2171
|
<xsl:param name="name"/>
|
2180
2172
|
<xsl:param name="lang"/>
|
2181
2173
|
<xsl:variable name="lang_">
|
@@ -2223,7 +2215,7 @@
|
|
2223
2215
|
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
2224
2216
|
|
2225
2217
|
<xsl:variable name="additional_fonts_">
|
2226
|
-
<xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
|
2218
|
+
<xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
|
2227
2219
|
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
2228
2220
|
</xsl:for-each>
|
2229
2221
|
</xsl:variable>
|
@@ -2301,7 +2293,6 @@
|
|
2301
2293
|
|
2302
2294
|
|
2303
2295
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
2304
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
2305
2296
|
|
2306
2297
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
2307
2298
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -2384,6 +2375,7 @@
|
|
2384
2375
|
|
2385
2376
|
|
2386
2377
|
|
2378
|
+
|
2387
2379
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
2388
2380
|
|
2389
2381
|
|
@@ -2533,6 +2525,7 @@
|
|
2533
2525
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
2534
2526
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
2535
2527
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
2528
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
2536
2529
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
2537
2530
|
|
2538
2531
|
|
@@ -2551,6 +2544,7 @@
|
|
2551
2544
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
2552
2545
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
2553
2546
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
2547
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
2554
2548
|
|
2555
2549
|
|
2556
2550
|
|
@@ -2644,7 +2638,8 @@
|
|
2644
2638
|
</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
|
2645
2639
|
|
2646
2640
|
|
2647
|
-
</xsl:attribute-set><xsl:attribute-set name="dt-style">
|
2641
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
|
2642
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
|
2648
2643
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
2649
2644
|
|
2650
2645
|
|
@@ -2656,6 +2651,8 @@
|
|
2656
2651
|
|
2657
2652
|
|
2658
2653
|
|
2654
|
+
</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
|
2655
|
+
<xsl:attribute name="padding-left">2mm</xsl:attribute>
|
2659
2656
|
</xsl:attribute-set><xsl:attribute-set name="appendix-style">
|
2660
2657
|
|
2661
2658
|
|
@@ -3454,22 +3451,32 @@
|
|
3454
3451
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3455
3452
|
<xsl:apply-templates select="."/>
|
3456
3453
|
</xsl:for-each>
|
3457
|
-
</xsl:template><xsl:variable name="
|
3458
|
-
|
3459
|
-
|
3460
|
-
|
3461
|
-
|
3462
|
-
|
3463
|
-
|
3454
|
+
</xsl:template><xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable><xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable><xsl:template match="text()" name="text">
|
3455
|
+
|
3456
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
3457
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
|
3458
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3459
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
3460
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
3461
|
+
<xsl:with-param name="text" select="$text"/>
|
3462
|
+
</xsl:call-template>
|
3463
|
+
|
3464
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
3465
|
+
<xsl:param name="tag_open"/>
|
3466
|
+
<xsl:param name="tag_close"/>
|
3464
3467
|
<xsl:param name="text"/>
|
3465
3468
|
<xsl:choose>
|
3466
3469
|
<xsl:when test="contains($text, $tag_open)">
|
3467
3470
|
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
3468
|
-
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
3471
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
3469
3472
|
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
3470
|
-
<
|
3471
|
-
|
3472
|
-
|
3473
|
+
<fo:inline keep-together.within-line="always">
|
3474
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
3475
|
+
</fo:inline>
|
3476
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
3477
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3478
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
3479
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
3473
3480
|
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
3474
3481
|
</xsl:call-template>
|
3475
3482
|
</xsl:when>
|
@@ -3477,6 +3484,39 @@
|
|
3477
3484
|
</xsl:choose>
|
3478
3485
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
3479
3486
|
<xsl:value-of select="$linebreak"/>
|
3487
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
3488
|
+
<xsl:param name="split_keep-within-line"/>
|
3489
|
+
|
3490
|
+
<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
|
3491
|
+
<xsl:choose>
|
3492
|
+
|
3493
|
+
<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
|
3494
|
+
<xsl:variable name="sep">_</xsl:variable>
|
3495
|
+
<xsl:variable name="items">
|
3496
|
+
<xsl:call-template name="split">
|
3497
|
+
<xsl:with-param name="pText" select="."/>
|
3498
|
+
<xsl:with-param name="sep" select="$sep"/>
|
3499
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
3500
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
3501
|
+
</xsl:call-template>
|
3502
|
+
</xsl:variable>
|
3503
|
+
<xsl:for-each select="xalan:nodeset($items)/item">
|
3504
|
+
<xsl:choose>
|
3505
|
+
<xsl:when test=". = $sep">
|
3506
|
+
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
|
3507
|
+
</xsl:when>
|
3508
|
+
<xsl:otherwise>
|
3509
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
3510
|
+
</xsl:otherwise>
|
3511
|
+
</xsl:choose>
|
3512
|
+
</xsl:for-each>
|
3513
|
+
</xsl:when>
|
3514
|
+
|
3515
|
+
<xsl:otherwise>
|
3516
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
3517
|
+
</xsl:otherwise>
|
3518
|
+
|
3519
|
+
</xsl:choose>
|
3480
3520
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
3481
3521
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
3482
3522
|
<xsl:apply-templates/>
|
@@ -3551,8 +3591,23 @@
|
|
3551
3591
|
</xsl:call-template>
|
3552
3592
|
|
3553
3593
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
3554
|
-
|
3555
|
-
|
3594
|
+
<xsl:choose>
|
3595
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
3596
|
+
<xsl:value-of select="."/>
|
3597
|
+
</xsl:when>
|
3598
|
+
<xsl:otherwise>
|
3599
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
3600
|
+
</xsl:otherwise>
|
3601
|
+
</xsl:choose>
|
3602
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
3603
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
3604
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
3605
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
3606
|
+
<xsl:choose>
|
3607
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
3608
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
3609
|
+
</xsl:choose>
|
3610
|
+
</xsl:for-each>
|
3556
3611
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
3557
3612
|
|
3558
3613
|
<xsl:variable name="table-preamble">
|
@@ -3566,9 +3621,14 @@
|
|
3566
3621
|
|
3567
3622
|
<xsl:variable name="table">
|
3568
3623
|
|
3569
|
-
<xsl:variable name="simple-table">
|
3570
|
-
<xsl:call-template name="getSimpleTable"
|
3624
|
+
<xsl:variable name="simple-table">
|
3625
|
+
<xsl:call-template name="getSimpleTable">
|
3626
|
+
<xsl:with-param name="id" select="@id"/>
|
3627
|
+
</xsl:call-template>
|
3571
3628
|
</xsl:variable>
|
3629
|
+
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
3630
|
+
|
3631
|
+
<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
|
3572
3632
|
|
3573
3633
|
|
3574
3634
|
<!-- Display table's name before table as standalone block -->
|
@@ -3591,7 +3651,23 @@
|
|
3591
3651
|
</xsl:call-template>
|
3592
3652
|
</xsl:if>
|
3593
3653
|
</xsl:variable>
|
3594
|
-
<!--
|
3654
|
+
<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
|
3655
|
+
|
3656
|
+
<!-- DEBUG -->
|
3657
|
+
<xsl:if test="$table_if_debug = 'true'">
|
3658
|
+
<fo:block font-size="60%">
|
3659
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
3660
|
+
</fo:block>
|
3661
|
+
</xsl:if>
|
3662
|
+
|
3663
|
+
|
3664
|
+
<!-- <xsl:copy-of select="$colwidths"/> -->
|
3665
|
+
|
3666
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
3667
|
+
DEBUG
|
3668
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
3669
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
3670
|
+
|
3595
3671
|
|
3596
3672
|
|
3597
3673
|
<xsl:variable name="margin-side">
|
@@ -3660,9 +3736,17 @@
|
|
3660
3736
|
</xsl:element>
|
3661
3737
|
</xsl:variable>
|
3662
3738
|
|
3739
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3740
|
+
<!-- to determine start of table -->
|
3741
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
3742
|
+
</xsl:if>
|
3663
3743
|
|
3664
3744
|
<fo:table id="{@id}">
|
3665
3745
|
|
3746
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3747
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
3748
|
+
</xsl:if>
|
3749
|
+
|
3666
3750
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
3667
3751
|
<xsl:attribute name="{local-name()}">
|
3668
3752
|
<xsl:value-of select="."/>
|
@@ -3676,31 +3760,47 @@
|
|
3676
3760
|
|
3677
3761
|
|
3678
3762
|
<xsl:choose>
|
3679
|
-
<xsl:when test="
|
3680
|
-
|
3681
|
-
|
3682
|
-
|
3763
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
3764
|
+
<!-- generate IF for table widths -->
|
3765
|
+
<!-- example:
|
3766
|
+
<tr>
|
3767
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
3768
|
+
<p>Symbol</p>
|
3769
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
3770
|
+
</td>
|
3771
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
3772
|
+
<p>Description</p>
|
3773
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
3774
|
+
</td>
|
3775
|
+
</tr>
|
3776
|
+
-->
|
3777
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
|
3778
|
+
|
3683
3779
|
</xsl:when>
|
3684
3780
|
<xsl:otherwise>
|
3685
|
-
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
3686
|
-
<xsl:choose>
|
3687
|
-
<xsl:when test=". = 1 or . = 0">
|
3688
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3689
|
-
</xsl:when>
|
3690
|
-
<xsl:otherwise>
|
3691
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3692
|
-
</xsl:otherwise>
|
3693
|
-
</xsl:choose>
|
3694
|
-
</xsl:for-each>
|
3695
|
-
</xsl:otherwise>
|
3696
|
-
</xsl:choose>
|
3697
3781
|
|
3698
|
-
|
3699
|
-
|
3700
|
-
|
3701
|
-
|
3702
|
-
|
3703
|
-
|
3782
|
+
<xsl:choose>
|
3783
|
+
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
|
3784
|
+
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
|
3785
|
+
<fo:table-column column-width="{@width}"/>
|
3786
|
+
</xsl:for-each>
|
3787
|
+
</xsl:when>
|
3788
|
+
<xsl:otherwise>
|
3789
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3790
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3791
|
+
</xsl:call-template>
|
3792
|
+
</xsl:otherwise>
|
3793
|
+
</xsl:choose>
|
3794
|
+
|
3795
|
+
<xsl:choose>
|
3796
|
+
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
|
3797
|
+
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
3798
|
+
</xsl:when>
|
3799
|
+
<xsl:otherwise>
|
3800
|
+
<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 -->
|
3801
|
+
</xsl:otherwise>
|
3802
|
+
</xsl:choose>
|
3803
|
+
|
3704
3804
|
</xsl:otherwise>
|
3705
3805
|
</xsl:choose>
|
3706
3806
|
|
@@ -3803,11 +3903,22 @@
|
|
3803
3903
|
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
|
3804
3904
|
<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
|
3805
3905
|
</xsl:template><xsl:template name="calculate-column-widths">
|
3906
|
+
<xsl:param name="table"/>
|
3907
|
+
<xsl:param name="cols-count"/>
|
3908
|
+
|
3909
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
3910
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
3911
|
+
<xsl:with-param name="table" select="$table"/>
|
3912
|
+
</xsl:call-template>
|
3913
|
+
|
3914
|
+
</xsl:template><xsl:template name="calculate-column-widths-proportional">
|
3806
3915
|
<xsl:param name="table"/>
|
3807
3916
|
<xsl:param name="cols-count"/>
|
3808
3917
|
<xsl:param name="curr-col" select="1"/>
|
3809
3918
|
<xsl:param name="width" select="0"/>
|
3810
3919
|
|
3920
|
+
<!-- table=<xsl:copy-of select="$table"/> -->
|
3921
|
+
|
3811
3922
|
<xsl:if test="$curr-col <= $cols-count">
|
3812
3923
|
<xsl:variable name="widths">
|
3813
3924
|
<xsl:choose>
|
@@ -3845,16 +3956,22 @@
|
|
3845
3956
|
</xsl:for-each>
|
3846
3957
|
</xsl:when>
|
3847
3958
|
<xsl:otherwise>
|
3848
|
-
<xsl:
|
3959
|
+
<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
|
3960
|
+
|
3961
|
+
<!-- <table><xsl:copy-of select="$table"/></table>
|
3962
|
+
-->
|
3963
|
+
<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
|
3849
3964
|
<xsl:variable name="td_text">
|
3850
3965
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
3851
3966
|
</xsl:variable>
|
3967
|
+
<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
|
3852
3968
|
<xsl:variable name="words">
|
3853
3969
|
<xsl:variable name="string_with_added_zerospaces">
|
3854
3970
|
<xsl:call-template name="add-zero-spaces-java">
|
3855
3971
|
<xsl:with-param name="text" select="$td_text"/>
|
3856
3972
|
</xsl:call-template>
|
3857
3973
|
</xsl:variable>
|
3974
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
3858
3975
|
<xsl:call-template name="tokenize">
|
3859
3976
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
3860
3977
|
<!-- 2009 thinspace -->
|
@@ -3862,11 +3979,13 @@
|
|
3862
3979
|
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
3863
3980
|
</xsl:call-template>
|
3864
3981
|
</xsl:variable>
|
3982
|
+
<!-- words=<xsl:copy-of select="$words"/> -->
|
3865
3983
|
<xsl:variable name="max_length">
|
3866
3984
|
<xsl:call-template name="max_length">
|
3867
3985
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
3868
3986
|
</xsl:call-template>
|
3869
3987
|
</xsl:variable>
|
3988
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
3870
3989
|
<width>
|
3871
3990
|
<xsl:variable name="divider">
|
3872
3991
|
<xsl:choose>
|
@@ -3885,6 +4004,8 @@
|
|
3885
4004
|
</xsl:choose>
|
3886
4005
|
</xsl:variable>
|
3887
4006
|
|
4007
|
+
<!-- widths=<xsl:copy-of select="$widths"/> -->
|
4008
|
+
|
3888
4009
|
<column>
|
3889
4010
|
<xsl:for-each select="xalan:nodeset($widths)//width">
|
3890
4011
|
<xsl:sort select="." data-type="number" order="descending"/>
|
@@ -3893,29 +4014,327 @@
|
|
3893
4014
|
</xsl:if>
|
3894
4015
|
</xsl:for-each>
|
3895
4016
|
</column>
|
3896
|
-
<xsl:call-template name="calculate-column-widths">
|
4017
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
3897
4018
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
3898
4019
|
<xsl:with-param name="curr-col" select="$curr-col +1"/>
|
3899
4020
|
<xsl:with-param name="table" select="$table"/>
|
3900
4021
|
</xsl:call-template>
|
3901
4022
|
</xsl:if>
|
4023
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
|
4024
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
4025
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
4026
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
4027
|
+
|
4028
|
+
<!-- if all capitals english letters or digits -->
|
4029
|
+
<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
|
4030
|
+
<xsl:call-template name="repeat">
|
4031
|
+
<xsl:with-param name="char" select="'X'"/>
|
4032
|
+
<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
|
4033
|
+
</xsl:call-template>
|
4034
|
+
</xsl:if>
|
3902
4035
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
3903
4036
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
3904
4037
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
3905
4038
|
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
|
3906
4039
|
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
|
3907
4040
|
<xsl:value-of select="@target"/>
|
3908
|
-
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
|
3909
|
-
<xsl:
|
3910
|
-
<xsl:
|
3911
|
-
<xsl:
|
3912
|
-
<xsl:
|
4041
|
+
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
|
4042
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
4043
|
+
<xsl:variable name="mathml_">
|
4044
|
+
<xsl:for-each select="*">
|
4045
|
+
<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
|
4046
|
+
<xsl:copy-of select="."/>
|
4047
|
+
</xsl:if>
|
4048
|
+
</xsl:for-each>
|
4049
|
+
</xsl:variable>
|
4050
|
+
<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
|
4051
|
+
|
4052
|
+
<xsl:variable name="math_text">
|
4053
|
+
<xsl:value-of select="normalize-space($mathml)"/>
|
4054
|
+
<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
|
4055
|
+
<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
|
4056
|
+
</xsl:variable>
|
4057
|
+
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
|
4058
|
+
</xsl:if>
|
4059
|
+
</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
|
4060
|
+
<xsl:param name="table"/>
|
4061
|
+
<xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
|
4062
|
+
|
4063
|
+
<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
|
4064
|
+
|
4065
|
+
<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
|
4066
|
+
|
4067
|
+
<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
|
4068
|
+
|
4069
|
+
<!-- get current table id -->
|
4070
|
+
<xsl:variable name="table_id" select="@id"/>
|
4071
|
+
<!-- find table by id in the file 'table_widths' -->
|
4072
|
+
<xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
|
4073
|
+
<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
|
4074
|
+
|
4075
|
+
|
4076
|
+
<!-- table='<xsl:copy-of select="$table"/>' -->
|
4077
|
+
<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
|
4078
|
+
<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
|
4079
|
+
<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
|
4080
|
+
|
4081
|
+
<xsl:variable name="table_with_cell_widths_">
|
4082
|
+
<xsl:choose>
|
4083
|
+
<xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
|
4084
|
+
|
4085
|
+
<!-- Example: <column>10</column>
|
4086
|
+
<column>11</column>
|
4087
|
+
-->
|
4088
|
+
<xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
|
4089
|
+
</xsl:when>
|
4090
|
+
<xsl:otherwise>
|
4091
|
+
<xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
|
4092
|
+
</xsl:otherwise>
|
4093
|
+
</xsl:choose>
|
4094
|
+
</xsl:variable>
|
4095
|
+
<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
|
4096
|
+
|
4097
|
+
<xsl:if test="$table_if_debug = 'true'">
|
4098
|
+
<xsl:copy-of select="$table_with_cell_widths"/>
|
4099
|
+
</xsl:if>
|
4100
|
+
|
4101
|
+
|
4102
|
+
<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
|
4103
|
+
|
4104
|
+
<xsl:variable name="column_widths_">
|
4105
|
+
<!-- iteration of columns -->
|
4106
|
+
<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
|
4107
|
+
<xsl:variable name="pos" select="position()"/>
|
4108
|
+
<column>
|
4109
|
+
<xsl:attribute name="width_max">
|
4110
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
|
4111
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
4112
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
4113
|
+
</xsl:for-each>
|
4114
|
+
</xsl:attribute>
|
4115
|
+
<xsl:attribute name="width_min">
|
4116
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
|
4117
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
4118
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
4119
|
+
</xsl:for-each>
|
4120
|
+
</xsl:attribute>
|
4121
|
+
</column>
|
4122
|
+
</xsl:for-each>
|
4123
|
+
</xsl:variable>
|
4124
|
+
<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
|
4125
|
+
|
4126
|
+
<!-- <column_widths>
|
4127
|
+
<xsl:copy-of select="$column_widths"/>
|
4128
|
+
</column_widths> -->
|
4129
|
+
|
4130
|
+
<!-- These in turn, are used to find the minimum and maximum width for the table. -->
|
4131
|
+
<xsl:variable name="table_widths_">
|
4132
|
+
<table>
|
4133
|
+
<xsl:attribute name="width_max">
|
4134
|
+
<xsl:value-of select="sum($column_widths/column/@width_max)"/>
|
4135
|
+
</xsl:attribute>
|
4136
|
+
<xsl:attribute name="width_min">
|
4137
|
+
<xsl:value-of select="sum($column_widths/column/@width_min)"/>
|
4138
|
+
</xsl:attribute>
|
4139
|
+
</table>
|
4140
|
+
</xsl:variable>
|
4141
|
+
<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
|
4142
|
+
|
4143
|
+
<xsl:variable name="page_width">
|
4144
|
+
<xsl:choose>
|
4145
|
+
<xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
|
4146
|
+
<xsl:otherwise>75</xsl:otherwise>
|
4147
|
+
</xsl:choose>
|
4148
|
+
</xsl:variable>
|
4149
|
+
|
4150
|
+
<xsl:if test="$table_if_debug = 'true'">
|
4151
|
+
<table_width>
|
4152
|
+
<xsl:copy-of select="$table_widths"/>
|
4153
|
+
</table_width>
|
4154
|
+
<!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
|
4155
|
+
<debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
|
4156
|
+
-->
|
4157
|
+
<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
|
4158
|
+
</xsl:if>
|
4159
|
+
|
4160
|
+
|
4161
|
+
<!-- There are three cases: -->
|
4162
|
+
<xsl:choose>
|
4163
|
+
<!-- 1. The minimum table width is equal to or wider than the available space -->
|
4164
|
+
<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
|
4165
|
+
<!-- call old algorithm -->
|
4166
|
+
<case1/>
|
4167
|
+
<xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
|
4168
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
4169
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
4170
|
+
<xsl:with-param name="table" select="$table"/>
|
4171
|
+
</xsl:call-template>
|
4172
|
+
</xsl:when>
|
4173
|
+
<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
|
4174
|
+
<xsl:when test="$table_widths/table/@width_max <= $page_width">
|
4175
|
+
<case2/>
|
4176
|
+
<autolayout/>
|
4177
|
+
<xsl:for-each select="$column_widths/column/@width_max">
|
4178
|
+
<column divider="100"><xsl:value-of select="."/></column>
|
4179
|
+
</xsl:for-each>
|
4180
|
+
</xsl:when>
|
4181
|
+
<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
|
4182
|
+
In this case, find the difference between the available space and the minimum table width, lets call it W.
|
4183
|
+
Lets also call D the difference between maximum and minimum width of the table.
|
4184
|
+
For each column, let d be the difference between maximum and minimum width of that column.
|
4185
|
+
Now set the column's width to the minimum width plus d times W over D.
|
4186
|
+
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
4187
|
+
<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)">
|
4188
|
+
<!-- difference between the available space and the minimum table width -->
|
4189
|
+
<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
|
4190
|
+
<W><xsl:value-of select="$W"/></W>
|
4191
|
+
<!-- difference between maximum and minimum width of the table -->
|
4192
|
+
<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
|
4193
|
+
<D><xsl:value-of select="$D"/></D>
|
4194
|
+
<case3/>
|
4195
|
+
<autolayout/>
|
4196
|
+
<xsl:if test="$table_widths/table/@width_min >= $page_width">
|
4197
|
+
<split_keep-within-line>true</split_keep-within-line>
|
3913
4198
|
</xsl:if>
|
4199
|
+
<xsl:for-each select="$column_widths/column">
|
4200
|
+
<!-- difference between maximum and minimum width of that column. -->
|
4201
|
+
<xsl:variable name="d" select="@width_max - @width_min"/>
|
4202
|
+
<d><xsl:value-of select="$d"/></d>
|
4203
|
+
<width_min><xsl:value-of select="@width_min"/></width_min>
|
4204
|
+
<e><xsl:value-of select="$d * $W div $D"/></e>
|
4205
|
+
<!-- set the column's width to the minimum width plus d times W over D. -->
|
4206
|
+
<column divider="100">
|
4207
|
+
<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
|
4208
|
+
</column>
|
4209
|
+
</xsl:for-each>
|
4210
|
+
|
4211
|
+
</xsl:when>
|
4212
|
+
<xsl:otherwise><unknown_case/></xsl:otherwise>
|
4213
|
+
</xsl:choose>
|
4214
|
+
|
4215
|
+
|
4216
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
|
4217
|
+
<xsl:copy>
|
4218
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
|
4219
|
+
</xsl:copy>
|
4220
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
|
4221
|
+
<xsl:copy>
|
4222
|
+
<xsl:copy-of select="@*"/>
|
4223
|
+
|
4224
|
+
<!-- The maximum width is given by the widest line. -->
|
4225
|
+
<xsl:variable name="widths_max">
|
4226
|
+
<xsl:for-each select=".//*[local-name() = 'p']">
|
4227
|
+
<xsl:call-template name="add_width"/>
|
4228
|
+
</xsl:for-each>
|
4229
|
+
<xsl:if test="not(*[local-name() = 'p'])">
|
4230
|
+
<xsl:call-template name="add_width"/>
|
4231
|
+
</xsl:if>
|
4232
|
+
</xsl:variable>
|
4233
|
+
<xsl:variable name="width_max">
|
4234
|
+
<xsl:for-each select="xalan:nodeset($widths_max)//width">
|
4235
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
4236
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
4237
|
+
</xsl:for-each>
|
4238
|
+
</xsl:variable>
|
4239
|
+
<xsl:attribute name="width_max">
|
4240
|
+
<xsl:value-of select="$width_max"/>
|
4241
|
+
</xsl:attribute>
|
4242
|
+
|
4243
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
4244
|
+
<!-- To do: image width -->
|
4245
|
+
<xsl:variable name="td_text">
|
4246
|
+
<xsl:apply-templates select="." mode="td_text"/>
|
4247
|
+
</xsl:variable>
|
4248
|
+
<xsl:variable name="words">
|
4249
|
+
<xsl:variable name="string_with_added_zerospaces">
|
4250
|
+
<xsl:call-template name="add-zero-spaces-java">
|
4251
|
+
<xsl:with-param name="text" select="$td_text"/>
|
4252
|
+
</xsl:call-template>
|
4253
|
+
</xsl:variable>
|
4254
|
+
<xsl:call-template name="tokenize">
|
4255
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
4256
|
+
</xsl:call-template>
|
4257
|
+
</xsl:variable>
|
4258
|
+
|
4259
|
+
<xsl:variable name="max_word_length">
|
4260
|
+
<xsl:call-template name="max_length">
|
4261
|
+
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
4262
|
+
</xsl:call-template>
|
4263
|
+
</xsl:variable>
|
4264
|
+
<xsl:variable name="width_min">
|
4265
|
+
<xsl:value-of select="$max_word_length"/>
|
4266
|
+
</xsl:variable>
|
4267
|
+
<xsl:attribute name="width_min">
|
4268
|
+
<xsl:value-of select="$width_min"/>
|
4269
|
+
</xsl:attribute>
|
4270
|
+
<!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
|
4271
|
+
<xsl:if test="$width_min > $width_max">
|
4272
|
+
<xsl:attribute name="width_max">
|
4273
|
+
<xsl:value-of select="$width_min"/>
|
4274
|
+
</xsl:attribute>
|
4275
|
+
</xsl:if>
|
4276
|
+
<xsl:if test="$width_min = 0">
|
4277
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
4278
|
+
</xsl:if>
|
4279
|
+
|
4280
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths"/>
|
4281
|
+
|
4282
|
+
</xsl:copy>
|
4283
|
+
</xsl:template><xsl:template name="add_width">
|
4284
|
+
<xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
|
4285
|
+
<xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
|
4286
|
+
|
4287
|
+
<xsl:variable name="p_text_len">
|
4288
|
+
<xsl:choose>
|
4289
|
+
<xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
|
4290
|
+
<xsl:value-of select="$p_text_len_ * 1.5"/>
|
4291
|
+
</xsl:when>
|
4292
|
+
<xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
|
4293
|
+
</xsl:choose>
|
4294
|
+
</xsl:variable>
|
4295
|
+
|
4296
|
+
<xsl:variable name="math_addon_text">
|
4297
|
+
<xsl:for-each select=".//*[local-name() = 'math']">
|
4298
|
+
<xsl:apply-templates mode="td_text"/>
|
3914
4299
|
</xsl:for-each>
|
3915
4300
|
</xsl:variable>
|
4301
|
+
<xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
|
3916
4302
|
|
3917
|
-
<xsl:
|
3918
|
-
|
4303
|
+
<width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
|
4304
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
|
4305
|
+
<xsl:copy>
|
4306
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
|
4307
|
+
</xsl:copy>
|
4308
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
|
4309
|
+
<xsl:copy>
|
4310
|
+
<xsl:copy-of select="@*"/>
|
4311
|
+
|
4312
|
+
<!-- The maximum width is given by the widest line. -->
|
4313
|
+
<xsl:attribute name="width_max">
|
4314
|
+
<xsl:for-each select="p_len">
|
4315
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
4316
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
4317
|
+
</xsl:for-each>
|
4318
|
+
</xsl:attribute>
|
4319
|
+
|
4320
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
4321
|
+
<xsl:variable name="width_min">
|
4322
|
+
<xsl:for-each select="word_len">
|
4323
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
4324
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
4325
|
+
</xsl:for-each>
|
4326
|
+
</xsl:variable>
|
4327
|
+
<xsl:attribute name="width_min">
|
4328
|
+
<xsl:value-of select="$width_min"/>
|
4329
|
+
</xsl:attribute>
|
4330
|
+
|
4331
|
+
<xsl:if test="$width_min = 0">
|
4332
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
4333
|
+
</xsl:if>
|
4334
|
+
|
4335
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
|
4336
|
+
|
4337
|
+
</xsl:copy>
|
3919
4338
|
</xsl:template><xsl:template match="*[local-name()='thead']">
|
3920
4339
|
<xsl:param name="cols-count"/>
|
3921
4340
|
<fo:table-header>
|
@@ -4006,16 +4425,10 @@
|
|
4006
4425
|
</xsl:for-each>
|
4007
4426
|
</xsl:when>
|
4008
4427
|
<xsl:otherwise>
|
4009
|
-
|
4010
|
-
|
4011
|
-
|
4012
|
-
|
4013
|
-
</xsl:when>
|
4014
|
-
<xsl:otherwise>
|
4015
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
4016
|
-
</xsl:otherwise>
|
4017
|
-
</xsl:choose>
|
4018
|
-
</xsl:for-each>
|
4428
|
+
<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
|
4429
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4430
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4431
|
+
</xsl:call-template>
|
4019
4432
|
</xsl:otherwise>
|
4020
4433
|
</xsl:choose>
|
4021
4434
|
|
@@ -4105,6 +4518,52 @@
|
|
4105
4518
|
|
4106
4519
|
</fo:table-body>
|
4107
4520
|
|
4521
|
+
</xsl:template><xsl:template match="/" mode="process_table-if">
|
4522
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
4523
|
+
<xsl:apply-templates mode="process_table-if">
|
4524
|
+
<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
|
4525
|
+
</xsl:apply-templates>
|
4526
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
|
4527
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
4528
|
+
|
4529
|
+
<fo:table-body>
|
4530
|
+
<xsl:for-each select="*[local-name() = 'tr']">
|
4531
|
+
<xsl:variable name="col_count" select="count(*)"/>
|
4532
|
+
|
4533
|
+
<!-- iteration for each tr/td -->
|
4534
|
+
|
4535
|
+
<xsl:choose>
|
4536
|
+
<xsl:when test="$table_or_dl = 'table'">
|
4537
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
|
4538
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
4539
|
+
<!-- <test_table><xsl:copy-of select="."/></test_table> -->
|
4540
|
+
<xsl:call-template name="td"/>
|
4541
|
+
</fo:table-row>
|
4542
|
+
</xsl:for-each>
|
4543
|
+
</xsl:when>
|
4544
|
+
<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
|
4545
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
|
4546
|
+
<xsl:variable name="is_dt" select="position() = 1"/>
|
4547
|
+
|
4548
|
+
<xsl:for-each select="*">
|
4549
|
+
<!-- <test><xsl:copy-of select="."/></test> -->
|
4550
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
4551
|
+
<xsl:choose>
|
4552
|
+
<xsl:when test="$is_dt">
|
4553
|
+
<xsl:call-template name="insert_dt_cell"/>
|
4554
|
+
</xsl:when>
|
4555
|
+
<xsl:otherwise>
|
4556
|
+
<xsl:call-template name="insert_dd_cell"/>
|
4557
|
+
</xsl:otherwise>
|
4558
|
+
</xsl:choose>
|
4559
|
+
</fo:table-row>
|
4560
|
+
</xsl:for-each>
|
4561
|
+
</xsl:for-each>
|
4562
|
+
</xsl:otherwise>
|
4563
|
+
</xsl:choose>
|
4564
|
+
|
4565
|
+
</xsl:for-each>
|
4566
|
+
</fo:table-body>
|
4108
4567
|
</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
4109
4568
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
4110
4569
|
|
@@ -4210,7 +4669,7 @@
|
|
4210
4669
|
</xsl:choose>
|
4211
4670
|
</xsl:attribute>
|
4212
4671
|
</xsl:if>
|
4213
|
-
</xsl:template><xsl:template match="*[local-name()='td']">
|
4672
|
+
</xsl:template><xsl:template match="*[local-name()='td']" name="td">
|
4214
4673
|
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
|
4215
4674
|
<xsl:call-template name="setTextAlignment">
|
4216
4675
|
<xsl:with-param name="default">left</xsl:with-param>
|
@@ -4252,11 +4711,24 @@
|
|
4252
4711
|
|
4253
4712
|
<xsl:call-template name="setTableCellAttributes"/>
|
4254
4713
|
|
4714
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4715
|
+
<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
|
4716
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
4717
|
+
</xsl:if>
|
4718
|
+
|
4255
4719
|
<fo:block>
|
4256
4720
|
|
4721
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4722
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
4723
|
+
</xsl:if>
|
4724
|
+
|
4725
|
+
|
4257
4726
|
|
4258
4727
|
|
4259
4728
|
<xsl:apply-templates/>
|
4729
|
+
|
4730
|
+
<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"/> -->
|
4731
|
+
|
4260
4732
|
</fo:block>
|
4261
4733
|
</fo:table-cell>
|
4262
4734
|
</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
|
@@ -4463,9 +4935,9 @@
|
|
4463
4935
|
<!-- current hierarchy is 'figure' element -->
|
4464
4936
|
<xsl:variable name="following_dl_colwidths">
|
4465
4937
|
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
4466
|
-
<xsl:variable name="
|
4467
|
-
<xsl:variable name="doc_ns">
|
4468
|
-
|
4938
|
+
<xsl:variable name="simple-table">
|
4939
|
+
<!-- <xsl:variable name="doc_ns">
|
4940
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
4469
4941
|
</xsl:variable>
|
4470
4942
|
<xsl:variable name="ns">
|
4471
4943
|
<xsl:choose>
|
@@ -4476,7 +4948,7 @@
|
|
4476
4948
|
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
4477
4949
|
</xsl:otherwise>
|
4478
4950
|
</xsl:choose>
|
4479
|
-
</xsl:variable>
|
4951
|
+
</xsl:variable> -->
|
4480
4952
|
|
4481
4953
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
4482
4954
|
<tbody>
|
@@ -4487,7 +4959,7 @@
|
|
4487
4959
|
|
4488
4960
|
<xsl:call-template name="calculate-column-widths">
|
4489
4961
|
<xsl:with-param name="cols-count" select="2"/>
|
4490
|
-
<xsl:with-param name="table" select="$
|
4962
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
4491
4963
|
</xsl:call-template>
|
4492
4964
|
|
4493
4965
|
</xsl:if>
|
@@ -4606,8 +5078,10 @@
|
|
4606
5078
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
4607
5079
|
</xsl:variable>
|
4608
5080
|
|
5081
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
5082
|
+
|
4609
5083
|
<xsl:choose>
|
4610
|
-
<xsl:when test="$
|
5084
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
4611
5085
|
|
4612
5086
|
<fo:block margin-bottom="12pt" text-align="left">
|
4613
5087
|
|
@@ -4622,7 +5096,7 @@
|
|
4622
5096
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
4623
5097
|
</fo:block>
|
4624
5098
|
|
4625
|
-
</xsl:when>
|
5099
|
+
</xsl:when> <!-- END: only one component -->
|
4626
5100
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
4627
5101
|
<fo:block margin-bottom="12pt" text-align="left">
|
4628
5102
|
|
@@ -4638,8 +5112,8 @@
|
|
4638
5112
|
</xsl:variable>
|
4639
5113
|
<xsl:value-of select="$title-where"/>:
|
4640
5114
|
</fo:block>
|
4641
|
-
</xsl:when>
|
4642
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
5115
|
+
</xsl:when> <!-- END: a few components -->
|
5116
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
4643
5117
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
4644
5118
|
|
4645
5119
|
|
@@ -4652,11 +5126,11 @@
|
|
4652
5126
|
</xsl:variable>
|
4653
5127
|
<xsl:value-of select="$title-key"/>
|
4654
5128
|
</fo:block>
|
4655
|
-
</xsl:when>
|
5129
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
4656
5130
|
</xsl:choose>
|
4657
5131
|
|
4658
5132
|
<!-- a few components -->
|
4659
|
-
<xsl:if test="
|
5133
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
4660
5134
|
<fo:block>
|
4661
5135
|
|
4662
5136
|
|
@@ -4671,7 +5145,18 @@
|
|
4671
5145
|
|
4672
5146
|
|
4673
5147
|
|
5148
|
+
|
5149
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5150
|
+
<!-- to determine start of table -->
|
5151
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
5152
|
+
</xsl:if>
|
5153
|
+
|
4674
5154
|
<fo:table width="95%" table-layout="fixed">
|
5155
|
+
|
5156
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5157
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
5158
|
+
</xsl:if>
|
5159
|
+
|
4675
5160
|
|
4676
5161
|
<xsl:choose>
|
4677
5162
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
|
@@ -4680,54 +5165,143 @@
|
|
4680
5165
|
|
4681
5166
|
</xsl:when>
|
4682
5167
|
</xsl:choose>
|
4683
|
-
|
4684
|
-
|
4685
|
-
|
5168
|
+
|
5169
|
+
|
5170
|
+
<xsl:choose>
|
5171
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
5172
|
+
<!-- generate IF for table widths -->
|
5173
|
+
<!-- example:
|
5174
|
+
<tr>
|
5175
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
5176
|
+
<p>Symbol</p>
|
5177
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
5178
|
+
</td>
|
5179
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
5180
|
+
<p>Description</p>
|
5181
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
5182
|
+
</td>
|
5183
|
+
</tr>
|
5184
|
+
-->
|
4686
5185
|
|
4687
|
-
|
4688
|
-
|
4689
|
-
|
4690
|
-
<xsl:
|
4691
|
-
<
|
4692
|
-
|
4693
|
-
|
4694
|
-
|
4695
|
-
|
4696
|
-
|
4697
|
-
|
4698
|
-
|
4699
|
-
|
4700
|
-
|
4701
|
-
|
4702
|
-
|
4703
|
-
|
4704
|
-
|
4705
|
-
|
4706
|
-
|
4707
|
-
|
4708
|
-
|
4709
|
-
|
4710
|
-
|
4711
|
-
|
4712
|
-
|
4713
|
-
|
4714
|
-
|
4715
|
-
|
4716
|
-
|
4717
|
-
|
4718
|
-
|
4719
|
-
|
4720
|
-
|
4721
|
-
|
5186
|
+
<!-- create virtual html table for dl/[dt and dd] -->
|
5187
|
+
<xsl:variable name="simple-table">
|
5188
|
+
|
5189
|
+
<xsl:variable name="dl_table">
|
5190
|
+
<tbody>
|
5191
|
+
<xsl:apply-templates mode="dl_if">
|
5192
|
+
<xsl:with-param name="id" select="@id"/>
|
5193
|
+
</xsl:apply-templates>
|
5194
|
+
</tbody>
|
5195
|
+
</xsl:variable>
|
5196
|
+
|
5197
|
+
<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
|
5198
|
+
|
5199
|
+
<!-- Step: replace <br/> to <p>...</p> -->
|
5200
|
+
<xsl:variable name="table_without_br">
|
5201
|
+
<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
|
5202
|
+
</xsl:variable>
|
5203
|
+
|
5204
|
+
<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
|
5205
|
+
|
5206
|
+
<!-- Step: add id to each cell -->
|
5207
|
+
<!-- add <word>...</word> for each word, image, math -->
|
5208
|
+
<xsl:variable name="simple-table-id">
|
5209
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
|
5210
|
+
<xsl:with-param name="id" select="@id"/>
|
5211
|
+
</xsl:apply-templates>
|
5212
|
+
</xsl:variable>
|
5213
|
+
|
5214
|
+
<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
|
5215
|
+
|
5216
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
5217
|
+
|
5218
|
+
</xsl:variable>
|
5219
|
+
|
5220
|
+
<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
|
5221
|
+
|
5222
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
|
5223
|
+
<xsl:with-param name="table_or_dl">dl</xsl:with-param>
|
5224
|
+
</xsl:apply-templates>
|
5225
|
+
|
5226
|
+
</xsl:when>
|
5227
|
+
<xsl:otherwise>
|
5228
|
+
|
5229
|
+
<xsl:variable name="simple-table">
|
5230
|
+
|
5231
|
+
<xsl:variable name="dl_table">
|
5232
|
+
<tbody>
|
5233
|
+
<xsl:apply-templates mode="dl">
|
5234
|
+
<xsl:with-param name="id" select="@id"/>
|
5235
|
+
</xsl:apply-templates>
|
5236
|
+
</tbody>
|
5237
|
+
</xsl:variable>
|
5238
|
+
|
5239
|
+
<xsl:copy-of select="$dl_table"/>
|
5240
|
+
</xsl:variable>
|
5241
|
+
|
5242
|
+
<xsl:variable name="colwidths">
|
5243
|
+
<xsl:call-template name="calculate-column-widths">
|
5244
|
+
<xsl:with-param name="cols-count" select="2"/>
|
5245
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
5246
|
+
</xsl:call-template>
|
5247
|
+
</xsl:variable>
|
5248
|
+
|
5249
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
5250
|
+
DEBUG
|
5251
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
5252
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
5253
|
+
|
5254
|
+
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
5255
|
+
|
5256
|
+
<xsl:variable name="maxlength_dt">
|
5257
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
5258
|
+
</xsl:variable>
|
5259
|
+
|
5260
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
5261
|
+
false
|
5262
|
+
</xsl:variable>
|
5263
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
5264
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
5265
|
+
|
5266
|
+
|
5267
|
+
<xsl:call-template name="setColumnWidth_dl">
|
5268
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5269
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
5270
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
5271
|
+
</xsl:call-template>
|
5272
|
+
|
5273
|
+
<fo:table-body>
|
5274
|
+
|
5275
|
+
<!-- DEBUG -->
|
5276
|
+
<xsl:if test="$table_if_debug = 'true'">
|
5277
|
+
<fo:table-row>
|
5278
|
+
<fo:table-cell number-columns-spanned="2" font-size="60%">
|
5279
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
5280
|
+
</fo:table-cell>
|
5281
|
+
</fo:table-row>
|
5282
|
+
</xsl:if>
|
5283
|
+
|
5284
|
+
<xsl:apply-templates>
|
5285
|
+
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
5286
|
+
<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
|
5287
|
+
</xsl:apply-templates>
|
5288
|
+
|
5289
|
+
</fo:table-body>
|
5290
|
+
</xsl:otherwise>
|
5291
|
+
</xsl:choose>
|
4722
5292
|
</fo:table>
|
4723
5293
|
</fo:block>
|
4724
5294
|
</fo:block>
|
4725
|
-
</xsl:if>
|
5295
|
+
</xsl:if> <!-- END: a few components -->
|
4726
5296
|
</fo:block-container>
|
4727
5297
|
</fo:block-container>
|
4728
5298
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
4729
5299
|
<xsl:param name="colwidths"/>
|
4730
5300
|
<xsl:param name="maxlength_dt"/>
|
5301
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
5302
|
+
|
5303
|
+
<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
|
5304
|
+
|
4731
5305
|
<xsl:choose>
|
4732
5306
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
4733
5307
|
<fo:table-column column-width="50%"/>
|
@@ -4735,6 +5309,16 @@
|
|
4735
5309
|
</xsl:when>
|
4736
5310
|
<xsl:otherwise>
|
4737
5311
|
<xsl:choose>
|
5312
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
5313
|
+
<xsl:call-template name="insertTableColumnWidth">
|
5314
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5315
|
+
</xsl:call-template>
|
5316
|
+
</xsl:when>
|
5317
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
5318
|
+
<xsl:call-template name="insertTableColumnWidth">
|
5319
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5320
|
+
</xsl:call-template>
|
5321
|
+
</xsl:when>
|
4738
5322
|
<!-- to set width check most wide chars like `W` -->
|
4739
5323
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
4740
5324
|
<fo:table-column column-width="7%"/>
|
@@ -4765,20 +5349,31 @@
|
|
4765
5349
|
<fo:table-column column-width="60%"/>
|
4766
5350
|
</xsl:when>
|
4767
5351
|
<xsl:otherwise>
|
4768
|
-
<xsl:
|
4769
|
-
<xsl:
|
4770
|
-
|
4771
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
4772
|
-
</xsl:when>
|
4773
|
-
<xsl:otherwise>
|
4774
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
4775
|
-
</xsl:otherwise>
|
4776
|
-
</xsl:choose>
|
4777
|
-
</xsl:for-each>
|
5352
|
+
<xsl:call-template name="insertTableColumnWidth">
|
5353
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5354
|
+
</xsl:call-template>
|
4778
5355
|
</xsl:otherwise>
|
4779
5356
|
</xsl:choose>
|
4780
5357
|
</xsl:otherwise>
|
4781
5358
|
</xsl:choose>
|
5359
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
5360
|
+
<xsl:param name="colwidths"/>
|
5361
|
+
|
5362
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
5363
|
+
<xsl:choose>
|
5364
|
+
<xsl:when test=". = 1 or . = 0">
|
5365
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
5366
|
+
</xsl:when>
|
5367
|
+
<xsl:otherwise>
|
5368
|
+
<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
|
5369
|
+
<xsl:variable name="divider">
|
5370
|
+
<xsl:value-of select="@divider"/>
|
5371
|
+
<xsl:if test="not(@divider)">1</xsl:if>
|
5372
|
+
</xsl:variable>
|
5373
|
+
<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
|
5374
|
+
</xsl:otherwise>
|
5375
|
+
</xsl:choose>
|
5376
|
+
</xsl:for-each>
|
4782
5377
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
4783
5378
|
<xsl:variable name="lengths">
|
4784
5379
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -4802,7 +5397,6 @@
|
|
4802
5397
|
<xsl:value-of select="$maxLength"/>
|
4803
5398
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
4804
5399
|
<xsl:param name="key_iso"/>
|
4805
|
-
|
4806
5400
|
<!-- <tr>
|
4807
5401
|
<td>NOTE</td>
|
4808
5402
|
<td>
|
@@ -4810,27 +5404,47 @@
|
|
4810
5404
|
</td>
|
4811
5405
|
</tr>
|
4812
5406
|
-->
|
4813
|
-
|
5407
|
+
<!-- OLD Variant -->
|
5408
|
+
<!-- <fo:table-row>
|
4814
5409
|
<fo:table-cell>
|
4815
5410
|
<fo:block margin-top="6pt">
|
4816
5411
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4817
5412
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
4818
5413
|
</xsl:if>
|
4819
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
5414
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
4820
5415
|
</fo:block>
|
4821
5416
|
</fo:table-cell>
|
4822
5417
|
<fo:table-cell>
|
4823
5418
|
<fo:block>
|
4824
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
5419
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
5420
|
+
</fo:block>
|
5421
|
+
</fo:table-cell>
|
5422
|
+
</fo:table-row> -->
|
5423
|
+
<!-- <tr>
|
5424
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
5425
|
+
</tr>
|
5426
|
+
-->
|
5427
|
+
<fo:table-row>
|
5428
|
+
<fo:table-cell number-columns-spanned="2">
|
5429
|
+
<fo:block>
|
5430
|
+
<xsl:call-template name="note"/>
|
4825
5431
|
</fo:block>
|
4826
5432
|
</fo:table-cell>
|
4827
5433
|
</fo:table-row>
|
4828
5434
|
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
|
5435
|
+
<xsl:param name="id"/>
|
5436
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
4829
5437
|
<tr>
|
4830
5438
|
<td>
|
5439
|
+
<xsl:attribute name="id">
|
5440
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
|
5441
|
+
</xsl:attribute>
|
4831
5442
|
<xsl:apply-templates/>
|
4832
5443
|
</td>
|
4833
5444
|
<td>
|
5445
|
+
<xsl:attribute name="id">
|
5446
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
|
5447
|
+
</xsl:attribute>
|
4834
5448
|
|
4835
5449
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
4836
5450
|
<xsl:with-param name="process">true</xsl:with-param>
|
@@ -4841,60 +5455,132 @@
|
|
4841
5455
|
|
4842
5456
|
</xsl:template><xsl:template match="*[local-name()='dt']">
|
4843
5457
|
<xsl:param name="key_iso"/>
|
5458
|
+
<xsl:param name="split_keep-within-line"/>
|
4844
5459
|
|
4845
5460
|
<fo:table-row xsl:use-attribute-sets="dt-row-style">
|
4846
|
-
<
|
5461
|
+
<xsl:call-template name="insert_dt_cell">
|
5462
|
+
<xsl:with-param name="key_iso" select="$key_iso"/>
|
5463
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5464
|
+
</xsl:call-template>
|
5465
|
+
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
|
5466
|
+
<xsl:call-template name="insert_dd_cell">
|
5467
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5468
|
+
</xsl:call-template>
|
5469
|
+
</xsl:for-each>
|
5470
|
+
</fo:table-row>
|
5471
|
+
</xsl:template><xsl:template name="insert_dt_cell">
|
5472
|
+
<xsl:param name="key_iso"/>
|
5473
|
+
<xsl:param name="split_keep-within-line"/>
|
5474
|
+
<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
|
5475
|
+
|
5476
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5477
|
+
<!-- border is mandatory, to calculate real width -->
|
5478
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
5479
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
5480
|
+
</xsl:if>
|
5481
|
+
|
5482
|
+
|
5483
|
+
<xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
|
5484
|
+
<xsl:attribute name="padding-right">3mm</xsl:attribute>
|
5485
|
+
</xsl:if>
|
5486
|
+
|
5487
|
+
<fo:block xsl:use-attribute-sets="dt-block-style">
|
5488
|
+
<xsl:copy-of select="@id"/>
|
4847
5489
|
|
4848
|
-
|
4849
|
-
|
4850
|
-
|
5490
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
5491
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
5492
|
+
</xsl:if>
|
4851
5493
|
|
4852
|
-
|
4853
|
-
<xsl:
|
4854
|
-
|
4855
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4856
|
-
<xsl:attribute name="margin-top">0</xsl:attribute>
|
5494
|
+
|
5495
|
+
<xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
|
5496
|
+
<xsl:attribute name="text-align">right</xsl:attribute>
|
4857
5497
|
</xsl:if>
|
4858
|
-
|
4859
|
-
|
4860
|
-
|
4861
|
-
|
4862
|
-
|
4863
|
-
|
4864
|
-
|
4865
|
-
|
4866
|
-
|
4867
|
-
|
4868
|
-
|
4869
|
-
|
4870
|
-
|
4871
|
-
|
4872
|
-
|
5498
|
+
|
5499
|
+
|
5500
|
+
<xsl:apply-templates>
|
5501
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5502
|
+
</xsl:apply-templates>
|
5503
|
+
|
5504
|
+
<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"/> -->
|
5505
|
+
|
5506
|
+
</fo:block>
|
5507
|
+
</fo:table-cell>
|
5508
|
+
</xsl:template><xsl:template name="insert_dd_cell">
|
5509
|
+
<xsl:param name="split_keep-within-line"/>
|
5510
|
+
<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
|
5511
|
+
|
5512
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5513
|
+
<!-- border is mandatory, to calculate real width -->
|
5514
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
5515
|
+
</xsl:if>
|
5516
|
+
|
5517
|
+
<fo:block>
|
5518
|
+
|
5519
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5520
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
5521
|
+
</xsl:if>
|
5522
|
+
|
5523
|
+
|
5524
|
+
<xsl:attribute name="text-align">justify</xsl:attribute>
|
5525
|
+
|
4873
5526
|
|
4874
|
-
|
4875
|
-
|
4876
|
-
|
4877
|
-
|
4878
|
-
|
4879
|
-
|
5527
|
+
<xsl:choose>
|
5528
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
5529
|
+
<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
|
5530
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
5531
|
+
</xsl:apply-templates>
|
5532
|
+
</xsl:when>
|
5533
|
+
<xsl:otherwise>
|
5534
|
+
<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
|
5535
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
5536
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5537
|
+
</xsl:apply-templates>
|
5538
|
+
</xsl:otherwise>
|
5539
|
+
|
5540
|
+
</xsl:choose>
|
5541
|
+
|
5542
|
+
<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"/> -->
|
5543
|
+
|
5544
|
+
</fo:block>
|
5545
|
+
</fo:table-cell>
|
4880
5546
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
4881
5547
|
<xsl:apply-templates/>
|
4882
5548
|
</xsl:template><xsl:template match="*[local-name()='dd']">
|
4883
5549
|
<xsl:param name="process">false</xsl:param>
|
5550
|
+
<xsl:param name="split_keep-within-line"/>
|
4884
5551
|
<xsl:if test="$process = 'true'">
|
4885
5552
|
<xsl:apply-templates select="@language"/>
|
4886
|
-
<xsl:apply-templates
|
5553
|
+
<xsl:apply-templates>
|
5554
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5555
|
+
</xsl:apply-templates>
|
4887
5556
|
</xsl:if>
|
4888
5557
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
4889
5558
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
4890
|
-
</xsl:template><xsl:template match="*[local-name()='
|
5559
|
+
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
|
5560
|
+
<xsl:param name="id"/>
|
5561
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
5562
|
+
<tr>
|
5563
|
+
<td>
|
5564
|
+
<xsl:copy-of select="node()"/>
|
5565
|
+
</td>
|
5566
|
+
<td>
|
5567
|
+
|
5568
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
|
5569
|
+
|
5570
|
+
</td>
|
5571
|
+
</tr>
|
5572
|
+
|
5573
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
|
4891
5574
|
<fo:inline font-style="italic">
|
4892
5575
|
<xsl:apply-templates/>
|
4893
5576
|
</fo:inline>
|
4894
5577
|
</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
|
5578
|
+
<xsl:param name="split_keep-within-line"/>
|
4895
5579
|
<fo:inline font-weight="bold">
|
4896
5580
|
|
4897
|
-
<xsl:apply-templates
|
5581
|
+
<xsl:apply-templates>
|
5582
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
5583
|
+
</xsl:apply-templates>
|
4898
5584
|
</fo:inline>
|
4899
5585
|
</xsl:template><xsl:template match="*[local-name()='padding']">
|
4900
5586
|
<fo:inline padding-right="{@value}"> </fo:inline>
|
@@ -4933,13 +5619,15 @@
|
|
4933
5619
|
<xsl:choose>
|
4934
5620
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
4935
5621
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
4936
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
5622
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4937
5623
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
4938
5624
|
</xsl:choose>
|
4939
5625
|
</xsl:attribute>
|
4940
5626
|
</xsl:if>
|
4941
5627
|
<xsl:apply-templates/>
|
4942
5628
|
</fo:inline>
|
5629
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
5630
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
4943
5631
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
4944
5632
|
<fo:inline text-decoration="underline">
|
4945
5633
|
<xsl:apply-templates/>
|
@@ -5087,54 +5775,120 @@
|
|
5087
5775
|
<fo:block break-after="page"/>
|
5088
5776
|
<fo:block> </fo:block>
|
5089
5777
|
<fo:block break-after="page"/>
|
5778
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
5779
|
+
<xsl:apply-templates/>
|
5090
5780
|
</xsl:template><xsl:template name="tokenize">
|
5091
5781
|
<xsl:param name="text"/>
|
5092
5782
|
<xsl:param name="separator" select="' '"/>
|
5093
5783
|
<xsl:choose>
|
5784
|
+
|
5785
|
+
<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
|
5786
|
+
<word><xsl:value-of select="normalize-space($text)"/></word>
|
5787
|
+
</xsl:when>
|
5094
5788
|
<xsl:when test="not(contains($text, $separator))">
|
5095
5789
|
<word>
|
5096
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
5097
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
5098
5790
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
5099
|
-
<xsl:variable name="len_str">
|
5100
|
-
<xsl:choose>
|
5101
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
5102
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
5103
|
-
</xsl:when>
|
5104
|
-
<xsl:otherwise>
|
5105
|
-
<xsl:value-of select="$len_str_tmp"/>
|
5106
|
-
</xsl:otherwise>
|
5107
|
-
</xsl:choose>
|
5108
|
-
</xsl:variable>
|
5109
|
-
|
5110
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
5111
|
-
<xsl:message>
|
5112
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
5113
|
-
len_str=<xsl:value-of select="$len_str"/>
|
5114
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
5115
|
-
</xsl:message>
|
5116
|
-
</xsl:if> -->
|
5117
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
5118
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
5119
5791
|
<xsl:choose>
|
5120
|
-
<xsl:when test="$
|
5121
|
-
<xsl:value-of select="$
|
5792
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
5793
|
+
<xsl:value-of select="$len_str_tmp"/>
|
5122
5794
|
</xsl:when>
|
5123
5795
|
<xsl:otherwise>
|
5124
|
-
<xsl:
|
5796
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
5797
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
5798
|
+
<xsl:variable name="len_str">
|
5799
|
+
<xsl:choose>
|
5800
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
5801
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
5802
|
+
</xsl:when>
|
5803
|
+
<xsl:otherwise>
|
5804
|
+
<xsl:value-of select="$len_str_tmp"/>
|
5805
|
+
</xsl:otherwise>
|
5806
|
+
</xsl:choose>
|
5807
|
+
</xsl:variable>
|
5808
|
+
|
5809
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
5810
|
+
<xsl:message>
|
5811
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
5812
|
+
len_str=<xsl:value-of select="$len_str"/>
|
5813
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
5814
|
+
</xsl:message>
|
5815
|
+
</xsl:if> -->
|
5816
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
5817
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
5818
|
+
<xsl:choose>
|
5819
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
5820
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
5821
|
+
</xsl:when>
|
5822
|
+
<xsl:otherwise>
|
5823
|
+
<xsl:value-of select="$len_str"/>
|
5824
|
+
</xsl:otherwise>
|
5825
|
+
</xsl:choose>
|
5125
5826
|
</xsl:otherwise>
|
5126
5827
|
</xsl:choose>
|
5127
5828
|
</word>
|
5128
5829
|
</xsl:when>
|
5129
5830
|
<xsl:otherwise>
|
5130
5831
|
<word>
|
5131
|
-
<xsl:
|
5832
|
+
<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
|
5833
|
+
<xsl:choose>
|
5834
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
5835
|
+
<xsl:value-of select="$word"/>
|
5836
|
+
</xsl:when>
|
5837
|
+
<xsl:otherwise>
|
5838
|
+
<xsl:value-of select="string-length($word)"/>
|
5839
|
+
</xsl:otherwise>
|
5840
|
+
</xsl:choose>
|
5132
5841
|
</word>
|
5133
5842
|
<xsl:call-template name="tokenize">
|
5134
5843
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
5135
5844
|
</xsl:call-template>
|
5136
5845
|
</xsl:otherwise>
|
5137
5846
|
</xsl:choose>
|
5847
|
+
</xsl:template><xsl:template name="tokenize_with_tags">
|
5848
|
+
<xsl:param name="tags"/>
|
5849
|
+
<xsl:param name="text"/>
|
5850
|
+
<xsl:param name="separator" select="' '"/>
|
5851
|
+
<xsl:choose>
|
5852
|
+
|
5853
|
+
<xsl:when test="not(contains($text, $separator))">
|
5854
|
+
<word>
|
5855
|
+
<xsl:call-template name="enclose_text_in_tags">
|
5856
|
+
<xsl:with-param name="text" select="normalize-space($text)"/>
|
5857
|
+
<xsl:with-param name="tags" select="$tags"/>
|
5858
|
+
</xsl:call-template>
|
5859
|
+
</word>
|
5860
|
+
</xsl:when>
|
5861
|
+
<xsl:otherwise>
|
5862
|
+
<word>
|
5863
|
+
<xsl:call-template name="enclose_text_in_tags">
|
5864
|
+
<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
|
5865
|
+
<xsl:with-param name="tags" select="$tags"/>
|
5866
|
+
</xsl:call-template>
|
5867
|
+
</word>
|
5868
|
+
<xsl:call-template name="tokenize_with_tags">
|
5869
|
+
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
5870
|
+
</xsl:call-template>
|
5871
|
+
</xsl:otherwise>
|
5872
|
+
</xsl:choose>
|
5873
|
+
</xsl:template><xsl:template name="enclose_text_in_tags">
|
5874
|
+
<xsl:param name="text"/>
|
5875
|
+
<xsl:param name="tags"/>
|
5876
|
+
<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
|
5877
|
+
|
5878
|
+
<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
|
5879
|
+
|
5880
|
+
<xsl:choose>
|
5881
|
+
<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
|
5882
|
+
<xsl:otherwise>
|
5883
|
+
<xsl:element name="{$tag_name}">
|
5884
|
+
<xsl:call-template name="enclose_text_in_tags">
|
5885
|
+
<xsl:with-param name="text" select="$text"/>
|
5886
|
+
<xsl:with-param name="tags" select="$tags"/>
|
5887
|
+
<xsl:with-param name="num" select="$num + 1"/>
|
5888
|
+
</xsl:call-template>
|
5889
|
+
</xsl:element>
|
5890
|
+
</xsl:otherwise>
|
5891
|
+
</xsl:choose>
|
5138
5892
|
</xsl:template><xsl:template name="max_length">
|
5139
5893
|
<xsl:param name="words"/>
|
5140
5894
|
<xsl:for-each select="$words//word">
|
@@ -5235,12 +5989,19 @@
|
|
5235
5989
|
</xsl:otherwise>
|
5236
5990
|
</xsl:choose>
|
5237
5991
|
</xsl:template><xsl:template name="getSimpleTable">
|
5992
|
+
<xsl:param name="id"/>
|
5993
|
+
|
5238
5994
|
<xsl:variable name="simple-table">
|
5239
5995
|
|
5996
|
+
<!-- Step 0. replace <br/> to <p>...</p> -->
|
5997
|
+
<xsl:variable name="table_without_br">
|
5998
|
+
<xsl:apply-templates mode="table-without-br"/>
|
5999
|
+
</xsl:variable>
|
6000
|
+
|
5240
6001
|
<!-- Step 1. colspan processing -->
|
5241
6002
|
<xsl:variable name="simple-table-colspan">
|
5242
6003
|
<tbody>
|
5243
|
-
<xsl:apply-templates mode="simple-table-colspan"/>
|
6004
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
|
5244
6005
|
</tbody>
|
5245
6006
|
</xsl:variable>
|
5246
6007
|
|
@@ -5249,10 +6010,67 @@
|
|
5249
6010
|
<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
|
5250
6011
|
</xsl:variable>
|
5251
6012
|
|
5252
|
-
|
5253
|
-
|
6013
|
+
<!-- Step 3: add id to each cell -->
|
6014
|
+
<!-- add <word>...</word> for each word, image, math -->
|
6015
|
+
<xsl:variable name="simple-table-id">
|
6016
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
|
6017
|
+
<xsl:with-param name="id" select="$id"/>
|
6018
|
+
</xsl:apply-templates>
|
6019
|
+
</xsl:variable>
|
6020
|
+
|
6021
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
6022
|
+
|
5254
6023
|
</xsl:variable>
|
5255
6024
|
<xsl:copy-of select="$simple-table"/>
|
6025
|
+
</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
|
6026
|
+
<xsl:copy>
|
6027
|
+
<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
|
6028
|
+
</xsl:copy>
|
6029
|
+
</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">
|
6030
|
+
<xsl:copy>
|
6031
|
+
<xsl:copy-of select="@*"/>
|
6032
|
+
<p>
|
6033
|
+
<xsl:copy-of select="node()"/>
|
6034
|
+
</p>
|
6035
|
+
</xsl:copy>
|
6036
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
|
6037
|
+
<xsl:copy>
|
6038
|
+
<xsl:copy-of select="@*"/>
|
6039
|
+
<xsl:for-each select="*[local-name()='br']">
|
6040
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
6041
|
+
<p>
|
6042
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
6043
|
+
<xsl:copy-of select="."/>
|
6044
|
+
</xsl:for-each>
|
6045
|
+
</p>
|
6046
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
6047
|
+
<p>
|
6048
|
+
<xsl:for-each select="following-sibling::node()">
|
6049
|
+
<xsl:copy-of select="."/>
|
6050
|
+
</xsl:for-each>
|
6051
|
+
</p>
|
6052
|
+
</xsl:if>
|
6053
|
+
</xsl:for-each>
|
6054
|
+
</xsl:copy>
|
6055
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
|
6056
|
+
<xsl:for-each select="*[local-name()='br']">
|
6057
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
6058
|
+
<p>
|
6059
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
6060
|
+
<xsl:copy-of select="."/>
|
6061
|
+
</xsl:for-each>
|
6062
|
+
</p>
|
6063
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
6064
|
+
<p>
|
6065
|
+
<xsl:for-each select="following-sibling::node()">
|
6066
|
+
<xsl:copy-of select="."/>
|
6067
|
+
</xsl:for-each>
|
6068
|
+
</p>
|
6069
|
+
</xsl:if>
|
6070
|
+
</xsl:for-each>
|
6071
|
+
</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
6072
|
+
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
6073
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
5256
6074
|
</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
|
5257
6075
|
<xsl:apply-templates mode="simple-table-colspan"/>
|
5258
6076
|
</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">
|
@@ -5342,6 +6160,126 @@
|
|
5342
6160
|
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
5343
6161
|
<xsl:with-param name="previousRow" select="$newRow"/>
|
5344
6162
|
</xsl:apply-templates>
|
6163
|
+
</xsl:template><xsl:template match="/" mode="simple-table-id">
|
6164
|
+
<xsl:param name="id"/>
|
6165
|
+
<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
|
6166
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
6167
|
+
<xsl:with-param name="id" select="$id_prefixed"/>
|
6168
|
+
</xsl:apply-templates>
|
6169
|
+
</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
|
6170
|
+
<xsl:param name="id"/>
|
6171
|
+
<xsl:copy>
|
6172
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
6173
|
+
<xsl:with-param name="id" select="$id"/>
|
6174
|
+
</xsl:apply-templates>
|
6175
|
+
</xsl:copy>
|
6176
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
|
6177
|
+
<xsl:param name="id"/>
|
6178
|
+
<xsl:copy>
|
6179
|
+
<xsl:copy-of select="@*"/>
|
6180
|
+
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
|
6181
|
+
<xsl:apply-templates select="node()" mode="simple-table-id">
|
6182
|
+
<xsl:with-param name="id" select="$id"/>
|
6183
|
+
</xsl:apply-templates>
|
6184
|
+
</xsl:copy>
|
6185
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
|
6186
|
+
<xsl:param name="id"/>
|
6187
|
+
<xsl:copy>
|
6188
|
+
<xsl:copy-of select="@*"/>
|
6189
|
+
<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
|
6190
|
+
<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
|
6191
|
+
<xsl:attribute name="id">
|
6192
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
|
6193
|
+
</xsl:attribute>
|
6194
|
+
|
6195
|
+
<xsl:for-each select="*[local-name() = 'p']">
|
6196
|
+
<xsl:copy>
|
6197
|
+
<xsl:copy-of select="@*"/>
|
6198
|
+
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
6199
|
+
<xsl:attribute name="id">
|
6200
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
|
6201
|
+
</xsl:attribute>
|
6202
|
+
|
6203
|
+
<xsl:copy-of select="node()"/>
|
6204
|
+
</xsl:copy>
|
6205
|
+
</xsl:for-each>
|
6206
|
+
|
6207
|
+
|
6208
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
|
6209
|
+
|
6210
|
+
<xsl:variable name="td_text">
|
6211
|
+
<xsl:apply-templates select="." mode="td_text_with_formatting"/>
|
6212
|
+
</xsl:variable>
|
6213
|
+
|
6214
|
+
<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
|
6215
|
+
|
6216
|
+
<xsl:variable name="words">
|
6217
|
+
<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
|
6218
|
+
<word>
|
6219
|
+
<xsl:copy-of select="."/>
|
6220
|
+
</word>
|
6221
|
+
</xsl:for-each>
|
6222
|
+
|
6223
|
+
<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
|
6224
|
+
<xsl:copy-of select="."/>
|
6225
|
+
</xsl:for-each>
|
6226
|
+
|
6227
|
+
</xsl:variable>
|
6228
|
+
|
6229
|
+
<xsl:for-each select="xalan:nodeset($words)/word">
|
6230
|
+
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
6231
|
+
<xsl:copy>
|
6232
|
+
<xsl:attribute name="id">
|
6233
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
|
6234
|
+
</xsl:attribute>
|
6235
|
+
<xsl:copy-of select="node()"/>
|
6236
|
+
</xsl:copy>
|
6237
|
+
</xsl:for-each>
|
6238
|
+
</xsl:if>
|
6239
|
+
</xsl:copy>
|
6240
|
+
|
6241
|
+
</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
|
6242
|
+
<xsl:copy>
|
6243
|
+
<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
|
6244
|
+
</xsl:copy>
|
6245
|
+
</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">
|
6246
|
+
<xsl:variable name="formatting_tags">
|
6247
|
+
<xsl:call-template name="getFormattingTags"/>
|
6248
|
+
</xsl:variable>
|
6249
|
+
<word>
|
6250
|
+
<xsl:call-template name="enclose_text_in_tags">
|
6251
|
+
<xsl:with-param name="text" select="normalize-space(.)"/>
|
6252
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
6253
|
+
</xsl:call-template>
|
6254
|
+
</word>
|
6255
|
+
</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
6256
|
+
|
6257
|
+
<xsl:variable name="td_text" select="."/>
|
6258
|
+
|
6259
|
+
<xsl:variable name="string_with_added_zerospaces">
|
6260
|
+
<xsl:call-template name="add-zero-spaces-java">
|
6261
|
+
<xsl:with-param name="text" select="$td_text"/>
|
6262
|
+
</xsl:call-template>
|
6263
|
+
</xsl:variable>
|
6264
|
+
|
6265
|
+
<xsl:variable name="formatting_tags">
|
6266
|
+
<xsl:call-template name="getFormattingTags"/>
|
6267
|
+
</xsl:variable>
|
6268
|
+
|
6269
|
+
<!-- <word>text</word> -->
|
6270
|
+
<xsl:call-template name="tokenize_with_tags">
|
6271
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
6272
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
6273
|
+
</xsl:call-template>
|
6274
|
+
</xsl:template><xsl:template name="getFormattingTags">
|
6275
|
+
<tags>
|
6276
|
+
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
6277
|
+
<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
|
6278
|
+
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
6279
|
+
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
6280
|
+
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
6281
|
+
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
6282
|
+
</tags>
|
5345
6283
|
</xsl:template><xsl:template name="getLang">
|
5346
6284
|
<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
|
5347
6285
|
<xsl:variable name="language">
|
@@ -5396,6 +6334,9 @@
|
|
5396
6334
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
5397
6335
|
|
5398
6336
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
6337
|
+
|
6338
|
+
|
6339
|
+
|
5399
6340
|
|
5400
6341
|
|
5401
6342
|
<xsl:call-template name="setTrackChangesStyles">
|
@@ -5403,48 +6344,80 @@
|
|
5403
6344
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
5404
6345
|
</xsl:call-template>
|
5405
6346
|
|
6347
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
6348
|
+
<!-- insert helper tag -->
|
6349
|
+
<!-- set unique font-size (fiction) -->
|
6350
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
6351
|
+
<fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
|
6352
|
+
</xsl:if>
|
5406
6353
|
|
5407
|
-
|
5408
|
-
|
5409
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
6354
|
+
<xsl:variable name="mathml_content">
|
6355
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
5410
6356
|
</xsl:variable>
|
5411
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
5412
6357
|
|
6358
|
+
|
6359
|
+
<xsl:call-template name="mathml_instream_object">
|
6360
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
6361
|
+
</xsl:call-template>
|
5413
6362
|
|
5414
|
-
|
5415
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
5416
|
-
<xsl:variable name="comment_text_">
|
5417
|
-
<xsl:choose>
|
5418
|
-
<xsl:when test="normalize-space($comment_text_following) != ''">
|
5419
|
-
<xsl:value-of select="$comment_text_following"/>
|
5420
|
-
</xsl:when>
|
5421
|
-
<xsl:otherwise>
|
5422
|
-
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
5423
|
-
</xsl:otherwise>
|
5424
|
-
</xsl:choose>
|
5425
|
-
</xsl:variable>
|
5426
|
-
<xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
5427
|
-
|
5428
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
5429
|
-
<!-- put Mathin Alternate Text -->
|
5430
|
-
<xsl:attribute name="fox:alt-text">
|
5431
|
-
<xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
|
5432
|
-
</xsl:attribute>
|
5433
|
-
</xsl:if>
|
5434
|
-
|
5435
|
-
<xsl:variable name="mathml_content">
|
5436
|
-
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
5437
|
-
</xsl:variable>
|
5438
|
-
<!-- put MathML in Actual Text -->
|
5439
|
-
<xsl:attribute name="fox:actual-text">
|
5440
|
-
<xsl:value-of select="$mathml_content"/>
|
5441
|
-
</xsl:attribute>
|
5442
|
-
|
5443
|
-
|
5444
|
-
|
5445
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
5446
|
-
</fo:instream-foreign-object>
|
6363
|
+
|
5447
6364
|
</fo:inline>
|
6365
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
6366
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
6367
|
+
<xsl:variable name="comment_text_">
|
6368
|
+
<xsl:choose>
|
6369
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
6370
|
+
<xsl:value-of select="$comment_text_following"/>
|
6371
|
+
</xsl:when>
|
6372
|
+
<xsl:otherwise>
|
6373
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
6374
|
+
</xsl:otherwise>
|
6375
|
+
</xsl:choose>
|
6376
|
+
</xsl:variable>
|
6377
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
6378
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
6379
|
+
<xsl:value-of select="$comment_text"/>
|
6380
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
6381
|
+
<xsl:param name="comment_text"/>
|
6382
|
+
<xsl:param name="mathml_content"/>
|
6383
|
+
|
6384
|
+
<xsl:variable name="comment_text_">
|
6385
|
+
<xsl:choose>
|
6386
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
6387
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
6388
|
+
</xsl:choose>
|
6389
|
+
</xsl:variable>
|
6390
|
+
|
6391
|
+
<xsl:variable name="mathml">
|
6392
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
6393
|
+
</xsl:variable>
|
6394
|
+
|
6395
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
6396
|
+
|
6397
|
+
|
6398
|
+
|
6399
|
+
|
6400
|
+
|
6401
|
+
|
6402
|
+
|
6403
|
+
<!-- put MathML in Actual Text -->
|
6404
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
6405
|
+
<xsl:attribute name="fox:actual-text">
|
6406
|
+
<xsl:value-of select="$mathml_content"/>
|
6407
|
+
</xsl:attribute>
|
6408
|
+
|
6409
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
6410
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
6411
|
+
<!-- put Mathin Alternate Text -->
|
6412
|
+
<xsl:attribute name="fox:alt-text">
|
6413
|
+
<xsl:value-of select="$comment_text_"/>
|
6414
|
+
</xsl:attribute>
|
6415
|
+
</xsl:if>
|
6416
|
+
<!-- </xsl:if> -->
|
6417
|
+
|
6418
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
6419
|
+
|
6420
|
+
</fo:instream-foreign-object>
|
5448
6421
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
5449
6422
|
<!-- <xsl:text>a+b</xsl:text> -->
|
5450
6423
|
<xsl:text><</xsl:text>
|
@@ -5475,7 +6448,9 @@
|
|
5475
6448
|
<!-- replace start and end spaces to non-break space -->
|
5476
6449
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
5477
6450
|
</xsl:copy>
|
5478
|
-
</xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="
|
6451
|
+
</xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="mathml:mtd/mathml:mo/text()[. = '/']" mode="mathml">
|
6452
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
6453
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
5479
6454
|
<xsl:variable name="target">
|
5480
6455
|
<xsl:choose>
|
5481
6456
|
<xsl:when test="@updatetype = 'true'">
|
@@ -6074,18 +7049,33 @@
|
|
6074
7049
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
6075
7050
|
<xsl:copy>
|
6076
7051
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
6077
|
-
<xsl:variable name="
|
7052
|
+
<xsl:variable name="viewbox_">
|
6078
7053
|
<xsl:call-template name="split">
|
6079
7054
|
<xsl:with-param name="pText" select="@viewBox"/>
|
6080
7055
|
<xsl:with-param name="sep" select="' '"/>
|
6081
7056
|
</xsl:call-template>
|
6082
7057
|
</xsl:variable>
|
7058
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
7059
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
7060
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
7061
|
+
|
6083
7062
|
<xsl:attribute name="width">
|
6084
|
-
<xsl:
|
7063
|
+
<xsl:choose>
|
7064
|
+
<xsl:when test="$width != ''">
|
7065
|
+
<xsl:value-of select="round($width)"/>
|
7066
|
+
</xsl:when>
|
7067
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
7068
|
+
</xsl:choose>
|
6085
7069
|
</xsl:attribute>
|
6086
7070
|
<xsl:attribute name="height">
|
6087
|
-
<xsl:
|
7071
|
+
<xsl:choose>
|
7072
|
+
<xsl:when test="$height != ''">
|
7073
|
+
<xsl:value-of select="round($height)"/>
|
7074
|
+
</xsl:when>
|
7075
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
7076
|
+
</xsl:choose>
|
6088
7077
|
</xsl:attribute>
|
7078
|
+
|
6089
7079
|
<xsl:apply-templates mode="svg_update"/>
|
6090
7080
|
</xsl:copy>
|
6091
7081
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -6280,7 +7270,11 @@
|
|
6280
7270
|
<xsl:apply-templates mode="bookmarks"/>
|
6281
7271
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
6282
7272
|
<xsl:apply-templates select="."/>
|
6283
|
-
</xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = '
|
7273
|
+
</xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'span']" mode="contents">
|
7274
|
+
<xsl:apply-templates mode="contents"/>
|
7275
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
7276
|
+
<xsl:apply-templates mode="bookmarks"/>
|
7277
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
6284
7278
|
<xsl:apply-templates mode="bookmarks"/>
|
6285
7279
|
</xsl:template><xsl:template name="addBookmarks">
|
6286
7280
|
<xsl:param name="contents"/>
|
@@ -6562,7 +7556,9 @@
|
|
6562
7556
|
<xsl:apply-templates/>
|
6563
7557
|
</xsl:otherwise>
|
6564
7558
|
</xsl:choose>
|
6565
|
-
</xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = '
|
7559
|
+
</xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'xref']" mode="contents">
|
7560
|
+
<xsl:value-of select="."/>
|
7561
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
6566
7562
|
<xsl:text> </xsl:text>
|
6567
7563
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
6568
7564
|
<xsl:copy>
|
@@ -6593,9 +7589,22 @@
|
|
6593
7589
|
</xsl:when>
|
6594
7590
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
6595
7591
|
</xsl:choose>
|
7592
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
7593
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
7594
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
7595
|
+
<xsl:apply-templates mode="contents_item"/>
|
6596
7596
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
6597
7597
|
|
6598
7598
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
7599
|
+
|
7600
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
7601
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
7602
|
+
</xsl:if>
|
7603
|
+
|
7604
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
7605
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
7606
|
+
</xsl:if>
|
7607
|
+
|
6599
7608
|
<xsl:copy-of select="@id"/>
|
6600
7609
|
|
6601
7610
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -6966,7 +7975,9 @@
|
|
6966
7975
|
<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
|
6967
7976
|
</xsl:if>
|
6968
7977
|
<xsl:variable name="simple-table">
|
6969
|
-
<xsl:call-template name="getSimpleTable"
|
7978
|
+
<xsl:call-template name="getSimpleTable">
|
7979
|
+
<xsl:with-param name="id" select="@id"/>
|
7980
|
+
</xsl:call-template>
|
6970
7981
|
</xsl:variable>
|
6971
7982
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
|
6972
7983
|
<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
|
@@ -7073,39 +8084,67 @@
|
|
7073
8084
|
</xsl:otherwise>
|
7074
8085
|
</xsl:choose>
|
7075
8086
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
7076
|
-
|
7077
|
-
|
8087
|
+
|
8088
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
8089
|
+
|
7078
8090
|
|
8091
|
+
|
7079
8092
|
<xsl:variable name="fo_element">
|
7080
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
8093
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
7081
8094
|
block
|
7082
8095
|
</xsl:variable>
|
7083
8096
|
|
7084
|
-
|
7085
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
7086
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7087
|
-
</xsl:apply-templates>
|
8097
|
+
<fo:block-container margin-left="0mm">
|
7088
8098
|
|
7089
|
-
|
7090
|
-
|
7091
|
-
<
|
7092
|
-
|
7093
|
-
|
8099
|
+
<xsl:choose>
|
8100
|
+
|
8101
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
8102
|
+
|
8103
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
8104
|
+
<fo:block>
|
8105
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
7094
8106
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
7095
8107
|
</xsl:apply-templates>
|
8108
|
+
</fo:block>
|
8109
|
+
|
8110
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
8111
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
8112
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
8113
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
8114
|
+
</xsl:apply-templates>
|
8115
|
+
</fo:block-container>
|
7096
8116
|
</fo:block-container>
|
7097
|
-
</
|
7098
|
-
|
7099
|
-
|
7100
|
-
|
7101
|
-
|
7102
|
-
|
7103
|
-
|
7104
|
-
|
7105
|
-
|
7106
|
-
|
7107
|
-
|
7108
|
-
|
8117
|
+
</xsl:when> <!-- end block -->
|
8118
|
+
|
8119
|
+
<xsl:otherwise> <!-- inline -->
|
8120
|
+
|
8121
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
8122
|
+
<fo:block>
|
8123
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
8124
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
8125
|
+
</xsl:apply-templates>
|
8126
|
+
<fo:inline>
|
8127
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
8128
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
8129
|
+
</xsl:apply-templates>
|
8130
|
+
</fo:inline>
|
8131
|
+
</fo:block>
|
8132
|
+
|
8133
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
8134
|
+
<!-- display further elements in blocks -->
|
8135
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
8136
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
8137
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
8138
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
8139
|
+
</xsl:apply-templates>
|
8140
|
+
</fo:block-container>
|
8141
|
+
</fo:block-container>
|
8142
|
+
</xsl:if>
|
8143
|
+
</xsl:otherwise> <!-- end inline -->
|
8144
|
+
|
8145
|
+
</xsl:choose>
|
8146
|
+
</fo:block-container>
|
8147
|
+
</fo:block-container>
|
7109
8148
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
7110
8149
|
<xsl:param name="fo_element">block</xsl:param>
|
7111
8150
|
|
@@ -7137,10 +8176,16 @@
|
|
7137
8176
|
</xsl:variable>
|
7138
8177
|
<xsl:choose>
|
7139
8178
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
7140
|
-
<fo:block
|
7141
|
-
|
7142
|
-
|
7143
|
-
|
8179
|
+
<fo:block-container>
|
8180
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
8181
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
8182
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
8183
|
+
</xsl:if>
|
8184
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
8185
|
+
|
8186
|
+
<xsl:apply-templates/>
|
8187
|
+
</fo:block>
|
8188
|
+
</fo:block-container>
|
7144
8189
|
</xsl:when>
|
7145
8190
|
<xsl:otherwise>
|
7146
8191
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -7319,7 +8364,16 @@
|
|
7319
8364
|
</fo:inline>
|
7320
8365
|
</xsl:when>
|
7321
8366
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
7322
|
-
|
8367
|
+
|
8368
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
8369
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
8370
|
+
<xsl:choose>
|
8371
|
+
<xsl:when test="$uri_src != ''">
|
8372
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
8373
|
+
</xsl:when>
|
8374
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
8375
|
+
</xsl:choose>
|
8376
|
+
|
7323
8377
|
</xsl:otherwise>
|
7324
8378
|
</xsl:choose>
|
7325
8379
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -7504,10 +8558,24 @@
|
|
7504
8558
|
|
7505
8559
|
</fo:block>
|
7506
8560
|
<xsl:apply-templates/>
|
7507
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
8561
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
7508
8562
|
<!-- comment 2019-11-29 -->
|
7509
8563
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
7510
8564
|
<xsl:apply-templates /> -->
|
8565
|
+
|
8566
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
8567
|
+
|
8568
|
+
<xsl:choose>
|
8569
|
+
<!-- if there isn't the attribute '@from', then -->
|
8570
|
+
<xsl:when test="$id_from = ''">
|
8571
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
8572
|
+
</xsl:when>
|
8573
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
8574
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
8575
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
8576
|
+
</xsl:when>
|
8577
|
+
</xsl:choose>
|
8578
|
+
|
7511
8579
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
7512
8580
|
<!-- 0xA0 to space replacement -->
|
7513
8581
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -7866,7 +8934,10 @@
|
|
7866
8934
|
<!-- to split by '_' and other chars -->
|
7867
8935
|
<xsl:call-template name="add-zero-spaces-java"/>
|
7868
8936
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
7869
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
8937
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
8938
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
8939
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
8940
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
|
7870
8941
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
7871
8942
|
<!-- <row>
|
7872
8943
|
<date>05-07-2013</date>
|
@@ -8435,6 +9506,120 @@
|
|
8435
9506
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
8436
9507
|
</xsl:for-each>
|
8437
9508
|
</xsl:copy>
|
9509
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
9510
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
9511
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
9512
|
+
<xsl:copy>
|
9513
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
9514
|
+
</xsl:copy>
|
9515
|
+
</xsl:template><xsl:variable name="express_reference_separators">_.\</xsl:variable><xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/><xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable><xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
|
9516
|
+
|
9517
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
9518
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
9519
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
9520
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
9521
|
+
<xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
|
9522
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
9523
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
9524
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
9525
|
+
<xsl:with-param name="text" select="$text_"/>
|
9526
|
+
</xsl:call-template></text></xsl:variable>
|
9527
|
+
|
9528
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
9529
|
+
|
9530
|
+
<xsl:variable name="text2">
|
9531
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
9532
|
+
<xsl:copy-of select="."/>
|
9533
|
+
</xsl:for-each></text>
|
9534
|
+
</xsl:variable>
|
9535
|
+
|
9536
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
9537
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
9538
|
+
<xsl:variable name="text3">
|
9539
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
9540
|
+
<xsl:choose>
|
9541
|
+
<xsl:when test="self::text()">
|
9542
|
+
<xsl:variable name="text_units_" select="java:replaceAll(java:java.lang.String.new(.),$regex_solidus_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
|
9543
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
9544
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
9545
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
9546
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
9547
|
+
</xsl:call-template></text></xsl:variable>
|
9548
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
9549
|
+
</xsl:when>
|
9550
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
9551
|
+
</xsl:choose>
|
9552
|
+
</xsl:for-each></text>
|
9553
|
+
</xsl:variable>
|
9554
|
+
|
9555
|
+
<xsl:choose>
|
9556
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
9557
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
9558
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
9559
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
9560
|
+
<xsl:choose>
|
9561
|
+
<xsl:when test="self::text()">
|
9562
|
+
<xsl:variable name="text_dots_" select="java:replaceAll(java:java.lang.String.new(.),$regex_dots_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
|
9563
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
9564
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
9565
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
9566
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
9567
|
+
</xsl:call-template></text></xsl:variable>
|
9568
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
9569
|
+
</xsl:when>
|
9570
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
9571
|
+
</xsl:choose>
|
9572
|
+
</xsl:for-each>
|
9573
|
+
</xsl:when>
|
9574
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
9575
|
+
</xsl:choose>
|
9576
|
+
|
9577
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
9578
|
+
<xsl:param name="tag_open"/>
|
9579
|
+
<xsl:param name="tag_close"/>
|
9580
|
+
<xsl:param name="text"/>
|
9581
|
+
<xsl:choose>
|
9582
|
+
<xsl:when test="contains($text, $tag_open)">
|
9583
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
9584
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
9585
|
+
|
9586
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
9587
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
9588
|
+
</xsl:element>
|
9589
|
+
|
9590
|
+
<xsl:call-template name="replace_text_tags">
|
9591
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
9592
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
9593
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
9594
|
+
</xsl:call-template>
|
9595
|
+
</xsl:when>
|
9596
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
9597
|
+
</xsl:choose>
|
9598
|
+
</xsl:template><xsl:template name="printEdition">
|
9599
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
9600
|
+
<xsl:text> </xsl:text>
|
9601
|
+
<xsl:choose>
|
9602
|
+
<xsl:when test="$edition_i18n != ''">
|
9603
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
9604
|
+
<xsl:call-template name="capitalize">
|
9605
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
9606
|
+
</xsl:call-template>
|
9607
|
+
</xsl:when>
|
9608
|
+
<xsl:otherwise>
|
9609
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
9610
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
9611
|
+
<xsl:call-template name="capitalize">
|
9612
|
+
<xsl:with-param name="str">
|
9613
|
+
<xsl:call-template name="getLocalizedString">
|
9614
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
9615
|
+
</xsl:call-template>
|
9616
|
+
</xsl:with-param>
|
9617
|
+
</xsl:call-template>
|
9618
|
+
<xsl:text> </xsl:text>
|
9619
|
+
<xsl:value-of select="$edition"/>
|
9620
|
+
</xsl:if>
|
9621
|
+
</xsl:otherwise>
|
9622
|
+
</xsl:choose>
|
8438
9623
|
</xsl:template><xsl:template name="convertDate">
|
8439
9624
|
<xsl:param name="date"/>
|
8440
9625
|
<xsl:param name="format" select="'short'"/>
|
@@ -9122,4 +10307,40 @@
|
|
9122
10307
|
<xsl:value-of select="$value"/>
|
9123
10308
|
</xsl:otherwise>
|
9124
10309
|
</xsl:choose>
|
10310
|
+
</xsl:template><xsl:template match="*" mode="print_as_xml">
|
10311
|
+
<xsl:param name="level">0</xsl:param>
|
10312
|
+
|
10313
|
+
<fo:block margin-left="{2*$level}mm">
|
10314
|
+
<xsl:text>
|
10315
|
+
<</xsl:text>
|
10316
|
+
<xsl:value-of select="local-name()"/>
|
10317
|
+
<xsl:for-each select="@*">
|
10318
|
+
<xsl:text> </xsl:text>
|
10319
|
+
<xsl:value-of select="local-name()"/>
|
10320
|
+
<xsl:text>="</xsl:text>
|
10321
|
+
<xsl:value-of select="."/>
|
10322
|
+
<xsl:text>"</xsl:text>
|
10323
|
+
</xsl:for-each>
|
10324
|
+
<xsl:text>></xsl:text>
|
10325
|
+
|
10326
|
+
<xsl:if test="not(*)">
|
10327
|
+
<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
|
10328
|
+
<xsl:text></</xsl:text>
|
10329
|
+
<xsl:value-of select="local-name()"/>
|
10330
|
+
<xsl:text>></xsl:text>
|
10331
|
+
</xsl:if>
|
10332
|
+
</fo:block>
|
10333
|
+
|
10334
|
+
<xsl:if test="*">
|
10335
|
+
<fo:block>
|
10336
|
+
<xsl:apply-templates mode="print_as_xml">
|
10337
|
+
<xsl:with-param name="level" select="$level + 1"/>
|
10338
|
+
</xsl:apply-templates>
|
10339
|
+
</fo:block>
|
10340
|
+
<fo:block margin-left="{2*$level}mm">
|
10341
|
+
<xsl:text></</xsl:text>
|
10342
|
+
<xsl:value-of select="local-name()"/>
|
10343
|
+
<xsl:text>></xsl:text>
|
10344
|
+
</fo:block>
|
10345
|
+
</xsl:if>
|
9125
10346
|
</xsl:template></xsl:stylesheet>
|