metanorma-bipm 2.2.8 → 2.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -176,7 +176,7 @@
176
176
  <xsl:template name="generateContents">
177
177
  <contents>
178
178
 
179
- <xsl:apply-templates select="/*/bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][position() &gt; 1]" mode="contents"/>
179
+ <xsl:apply-templates select="/*/bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition' or (local-name() = 'clause' and @type = 'toc'))][position() &gt; 1]" mode="contents"/>
180
180
 
181
181
  <xsl:apply-templates select="/*/bipm:sections/*" mode="contents"/>
182
182
  <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[@normative='true']" mode="contents"/>
@@ -535,10 +535,14 @@
535
535
  </xsl:copy>
536
536
  </xsl:template>
537
537
 
538
+ <xsl:template match="bipm:semantic__bipm-standard" mode="flatxml" priority="2"/>
539
+
538
540
  <xsl:template match="mathml:math" mode="flatxml" priority="2">
539
541
  <xsl:copy-of select="."/>
540
542
  </xsl:template>
541
543
 
544
+ <xsl:template match="bipm:preface/bipm:clause[@type = 'toc']" mode="flatxml" priority="2"/>
545
+
542
546
  <!-- enclosing starting elements annex/... in clause -->
543
547
  <xsl:template match="bipm:annex" mode="flatxml">
544
548
  <xsl:copy>
@@ -727,7 +731,7 @@
727
731
  <xsl:value-of select="concat($lang, '_footnote_', @reference, '_', $number, '_', $gen_id)"/>
728
732
  </xsl:template>
729
733
 
730
- <xsl:template match="bipm:preface/bipm:clause[position() &gt; 1]" mode="flatxml">
734
+ <xsl:template match="bipm:preface/bipm:clause[not(@type = 'toc')][position() &gt; 1]" mode="flatxml">
731
735
  <xsl:copy-of select="."/>
732
736
  </xsl:template>
733
737
 
@@ -771,20 +775,20 @@
771
775
  <!-- if current li is first -->
772
776
  <xsl:if test="not(preceding-sibling::*[local-name() = 'li'])">
773
777
 
774
- <!-- move note for list (list level note) into first 'li' -->
775
- <xsl:for-each select="following-sibling::bipm:li[last()]/following-sibling::*">
776
- <xsl:choose>
777
- <xsl:when test="local-name() = 'note'">
778
- <xsl:call-template name="change_note_kind"/>
779
- </xsl:when>
780
- <xsl:otherwise>
781
- <xsl:copy-of select="."/>
782
- </xsl:otherwise>
783
- </xsl:choose>
784
- </xsl:for-each>
785
-
786
- <!-- move note(s) after ul/ol into first 'li' -->
787
778
  <xsl:if test="not(ancestor::bipm:quote)">
779
+ <!-- move note for list (list level note) into first 'li' -->
780
+ <xsl:for-each select="following-sibling::bipm:li[last()]/following-sibling::*">
781
+ <xsl:choose>
782
+ <xsl:when test="local-name() = 'note'">
783
+ <xsl:call-template name="change_note_kind"/>
784
+ </xsl:when>
785
+ <xsl:otherwise>
786
+ <xsl:copy-of select="."/>
787
+ </xsl:otherwise>
788
+ </xsl:choose>
789
+ </xsl:for-each>
790
+
791
+ <!-- move note(s) after ul/ol into first 'li' -->
788
792
  <xsl:variable name="list_id" select="generate-id(..)"/>
789
793
  <xsl:for-each select="../following-sibling::bipm:note[generate-id(preceding-sibling::*[not(local-name()='note') and not(local-name()='quote')][1]) = $list_id]">
790
794
  <xsl:call-template name="change_note_kind"/>
@@ -816,6 +820,13 @@
816
820
  </xsl:copy>
817
821
  </xsl:template>
818
822
 
823
+ <xsl:template match="bipm:note[ancestor::bipm:quote]" mode="flatxml_list">
824
+ <xsl:copy>
825
+ <xsl:attribute name="parent-type">quote</xsl:attribute>
826
+ <xsl:apply-templates select="@*|node()" mode="flatxml_list"/>
827
+ </xsl:copy>
828
+ </xsl:template>
829
+
819
830
  <xsl:template name="fn_to_note_side">
820
831
  <xsl:element name="note_side" namespace="https://www.metanorma.org/ns/bipm">
821
832
 
@@ -847,8 +858,8 @@
847
858
  </xsl:template>
848
859
 
849
860
  <!-- remove latest elements (after li), because they moved into latest 'li' -->
850
- <xsl:template match="bipm:ul/*[not(local-name() = 'li') and not(following-sibling::*[local-name() = 'li'])]" mode="flatxml_list"/>
851
- <xsl:template match="bipm:ol/*[not(local-name() = 'li') and not(following-sibling::*[local-name() = 'li'])]" mode="flatxml_list"/>
861
+ <xsl:template match="bipm:ul/*[not(local-name() = 'li') and not(following-sibling::*[local-name() = 'li']) and not(ancestor::bipm:quote)]" mode="flatxml_list"/>
862
+ <xsl:template match="bipm:ol/*[not(local-name() = 'li') and not(following-sibling::*[local-name() = 'li']) and not(ancestor::bipm:quote)]" mode="flatxml_list"/>
852
863
 
853
864
  <xsl:template name="setListItemLabel">
854
865
  <xsl:attribute name="label">
@@ -2900,61 +2911,69 @@
2900
2911
  </xsl:template>
2901
2912
 
2902
2913
  <xsl:template match="bipm:xref" priority="2">
2903
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
2904
-
2905
- <xsl:if test="parent::*[local-name() = 'title']">
2906
- <xsl:attribute name="font-weight">normal</xsl:attribute>
2907
- </xsl:if>
2908
-
2909
- <xsl:choose>
2910
- <xsl:when test="@pagenumber='true'"><!-- ToC in Appendix, and page in references like this: « Le BIPM et la Convention du Mètre » (page 5). -->
2911
- <fo:inline>
2912
- <!-- DEBUG -->
2913
- <xsl:if test="@id">
2914
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2915
- </xsl:if>
2916
- <fo:page-number-citation ref-id="{@target}"/>
2917
- <!-- <xsl:if test="@to">&#x2013;<fo:page-number-citation ref-id="{@to}"/></xsl:if> -->
2918
- </fo:inline>
2919
- </xsl:when>
2920
- <xsl:when test="starts-with(normalize-space(following-sibling::node()[1]), ')')">
2921
- <!-- add , see p. N -->
2922
- <!-- add , voir p. N -->
2923
- <xsl:apply-templates/>
2914
+ <xsl:call-template name="insert_basic_link">
2915
+ <xsl:with-param name="element">
2916
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
2924
2917
 
2925
- <xsl:variable name="nopage" select="normalize-space(@nopage)"/>
2918
+ <xsl:if test="parent::*[local-name() = 'title']">
2919
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2920
+ </xsl:if>
2926
2921
 
2927
- <xsl:if test="$nopage != 'true'">
2928
- <xsl:text>, </xsl:text>
2929
- <xsl:variable name="nosee" select="normalize-space(@nosee)"/>
2930
- <xsl:if test="$nosee != 'true'">
2931
- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
2922
+ <xsl:choose>
2923
+ <xsl:when test="@pagenumber='true'"><!-- ToC in Appendix, and page in references like this: « Le BIPM et la Convention du Mètre » (page 5). -->
2932
2924
  <fo:inline>
2933
- <xsl:if test="ancestor::bipm:note_side">
2934
- <xsl:attribute name="font-style">italic</xsl:attribute>
2925
+ <!-- DEBUG -->
2926
+ <xsl:if test="@id">
2927
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2935
2928
  </xsl:if>
2936
- <xsl:value-of select="ancestor::bipm:bipm-standard/bipm:localized-strings/bipm:localized-string[@key='see' and @language=$curr_lang]"/>
2929
+ <fo:page-number-citation ref-id="{@target}"/>
2930
+ <!-- <xsl:if test="@to">&#x2013;<fo:page-number-citation ref-id="{@to}"/></xsl:if> -->
2937
2931
  </fo:inline>
2938
- <xsl:text> </xsl:text>
2939
- </xsl:if>
2940
- <xsl:text>p. </xsl:text>
2941
- <fo:page-number-citation ref-id="{@target}"/>
2942
- </xsl:if>
2943
- </xsl:when>
2944
- <xsl:otherwise>
2945
- <fo:inline><xsl:apply-templates/></fo:inline>
2946
- </xsl:otherwise>
2947
- </xsl:choose>
2948
- </fo:basic-link>
2932
+ </xsl:when>
2933
+ <xsl:when test="starts-with(normalize-space(following-sibling::node()[1]), ')')">
2934
+ <!-- add , see p. N -->
2935
+ <!-- add , voir p. N -->
2936
+ <xsl:apply-templates/>
2937
+
2938
+ <xsl:variable name="nopage" select="normalize-space(@nopage)"/>
2939
+
2940
+ <xsl:if test="$nopage != 'true'">
2941
+ <xsl:text>, </xsl:text>
2942
+ <xsl:variable name="nosee" select="normalize-space(@nosee)"/>
2943
+ <xsl:if test="$nosee != 'true'">
2944
+ <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
2945
+ <fo:inline>
2946
+ <xsl:if test="ancestor::bipm:note_side">
2947
+ <xsl:attribute name="font-style">italic</xsl:attribute>
2948
+ </xsl:if>
2949
+ <xsl:value-of select="ancestor::bipm:bipm-standard/bipm:localized-strings/bipm:localized-string[@key='see' and @language=$curr_lang]"/>
2950
+ </fo:inline>
2951
+ <xsl:text> </xsl:text>
2952
+ </xsl:if>
2953
+ <xsl:text>p. </xsl:text>
2954
+ <fo:page-number-citation ref-id="{@target}"/>
2955
+ </xsl:if>
2956
+ </xsl:when>
2957
+ <xsl:otherwise>
2958
+ <fo:inline><xsl:apply-templates/></fo:inline>
2959
+ </xsl:otherwise>
2960
+ </xsl:choose>
2961
+ </fo:basic-link>
2962
+ </xsl:with-param>
2963
+ </xsl:call-template>
2949
2964
  </xsl:template>
2950
2965
 
2951
2966
  <xsl:template match="bipm:eref[.//bipm:locality[@type = 'anchor']]" priority="2">
2952
2967
  <xsl:variable name="target" select=".//bipm:locality[@type = 'anchor']/bipm:referenceFrom"/>
2953
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
2954
- <xsl:if test="xalan:nodeset($ids)//id = $target">
2955
- <fo:page-number-citation ref-id="{$target}"/>
2956
- </xsl:if>
2957
- </fo:basic-link>
2968
+ <xsl:call-template name="insert_basic_link">
2969
+ <xsl:with-param name="element">
2970
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
2971
+ <xsl:if test="xalan:nodeset($ids)//id = $target">
2972
+ <fo:page-number-citation ref-id="{$target}"/>
2973
+ </xsl:if>
2974
+ </fo:basic-link>
2975
+ </xsl:with-param>
2976
+ </xsl:call-template>
2958
2977
  </xsl:template>
2959
2978
 
2960
2979
  <xsl:template match="bipm:note[not(ancestor::bipm:preface)]/bipm:name" priority="2">
@@ -3109,7 +3128,7 @@
3109
3128
 
3110
3129
  <!-- Decrease height of / and | -->
3111
3130
  <!-- Decrease space before and after / -->
3112
- <xsl:template match="mathml:mo[normalize-space(text()) = '/' or normalize-space(text()) = '|']" mode="mathml">
3131
+ <xsl:template match="mathml:mo[normalize-space(text()) = '/' or normalize-space(text()) = '|']" mode="mathml" priority="2">
3113
3132
  <xsl:copy>
3114
3133
  <xsl:apply-templates select="@*" mode="mathml"/>
3115
3134
  <xsl:if test="not(@stretchy) and not(preceding-sibling::*[1][local-name() = 'mfrac'] and following-sibling::*[1][local-name() = 'mfrac'])">
@@ -3256,6 +3275,23 @@
3256
3275
  <xsl:template match="bipm:clause[@type = 'toc']//bipm:title/text()[1][not(preceding-sibling::bipm:tab) and following-sibling::*[1][self::bipm:tab]]"/>
3257
3276
  <xsl:template match="bipm:clause[@type = 'toc']//bipm:title/bipm:tab" priority="2"/>
3258
3277
 
3278
+ <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width" priority="2">
3279
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
3280
+ <xsl:for-each select="*[local-name() = 'tab']">
3281
+ <xsl:variable name="pos" select="position()"/>
3282
+ <xsl:variable name="current_id" select="generate-id()"/>
3283
+ <td>
3284
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
3285
+ <xsl:choose>
3286
+ <xsl:when test="$pos = 1 and self::text()"><xsl:value-of select="translate(., ' ', ' ')"/></xsl:when>
3287
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
3288
+ </xsl:choose>
3289
+ </xsl:for-each>
3290
+ </td>
3291
+ </xsl:for-each>
3292
+ <td>333</td> <!-- page number, just for fill -->
3293
+ </xsl:template>
3294
+
3259
3295
  <!-- =================== -->
3260
3296
  <!-- End Table of Contents (ToC) processing -->
3261
3297
  <!-- =================== -->
@@ -4251,6 +4287,10 @@
4251
4287
 
4252
4288
  </xsl:attribute-set>
4253
4289
 
4290
+ <xsl:template name="refine_link-style">
4291
+
4292
+ </xsl:template> <!-- refine_link-style -->
4293
+
4254
4294
  <xsl:attribute-set name="sourcecode-container-style">
4255
4295
 
4256
4296
  </xsl:attribute-set>
@@ -4262,6 +4302,10 @@
4262
4302
 
4263
4303
  </xsl:attribute-set>
4264
4304
 
4305
+ <xsl:template name="refine_sourcecode-style">
4306
+
4307
+ </xsl:template> <!-- refine_sourcecode-style -->
4308
+
4265
4309
  <xsl:attribute-set name="pre-style">
4266
4310
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
4267
4311
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -4340,6 +4384,10 @@
4340
4384
 
4341
4385
  </xsl:attribute-set> <!-- example-style -->
4342
4386
 
4387
+ <xsl:template name="refine_example-style">
4388
+
4389
+ </xsl:template> <!-- refine_example-style -->
4390
+
4343
4391
  <xsl:attribute-set name="example-body-style">
4344
4392
 
4345
4393
  </xsl:attribute-set> <!-- example-body-style -->
@@ -4354,6 +4402,10 @@
4354
4402
 
4355
4403
  </xsl:attribute-set> <!-- example-p-style -->
4356
4404
 
4405
+ <xsl:template name="refine_example-p-style">
4406
+
4407
+ </xsl:template> <!-- refine_example-p-style -->
4408
+
4357
4409
  <xsl:attribute-set name="termexample-name-style">
4358
4410
 
4359
4411
  <xsl:attribute name="font-style">italic</xsl:attribute>
@@ -4382,12 +4434,38 @@
4382
4434
 
4383
4435
  </xsl:attribute-set> <!-- table-container-style -->
4384
4436
 
4437
+ <xsl:template name="refine_table-container-style">
4438
+ <xsl:param name="margin-side"/>
4439
+
4440
+ <xsl:if test="not(ancestor::*[local-name()='note_side'])">
4441
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4442
+ </xsl:if>
4443
+ <xsl:if test="ancestor-or-self::*[@parent-type = 'quote']">
4444
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
4445
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
4446
+ </xsl:if>
4447
+
4448
+ <!-- end table block-container attributes -->
4449
+ </xsl:template> <!-- refine_table-container-style -->
4450
+
4385
4451
  <xsl:attribute-set name="table-style">
4386
4452
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
4387
4453
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
4388
4454
 
4389
4455
  </xsl:attribute-set><!-- table-style -->
4390
4456
 
4457
+ <xsl:template name="refine_table-style">
4458
+ <xsl:param name="margin-side"/>
4459
+
4460
+ <xsl:if test="not(ancestor::*[local-name()='preface']) and not(ancestor::*[local-name()='note_side']) and not(ancestor::*[local-name() = 'annex'] and .//*[local-name() = 'xref'][@pagenumber]) and not(ancestor::*[local-name() = 'doccontrol'])">
4461
+ <xsl:attribute name="border-top">0.5pt solid black</xsl:attribute>
4462
+ <xsl:attribute name="border-bottom">0.5pt solid black</xsl:attribute>
4463
+ </xsl:if>
4464
+
4465
+ <xsl:call-template name="setBordersTableArray"/>
4466
+
4467
+ </xsl:template> <!-- refine_table-style -->
4468
+
4391
4469
  <xsl:attribute-set name="table-name-style">
4392
4470
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4393
4471
 
@@ -4400,6 +4478,11 @@
4400
4478
 
4401
4479
  </xsl:attribute-set> <!-- table-name-style -->
4402
4480
 
4481
+ <xsl:template name="refine_table-name-style">
4482
+ <xsl:param name="continued"/>
4483
+
4484
+ </xsl:template> <!-- refine_table-name-style -->
4485
+
4403
4486
  <xsl:attribute-set name="table-row-style">
4404
4487
  <xsl:attribute name="min-height">4mm</xsl:attribute>
4405
4488
 
@@ -4410,14 +4493,30 @@
4410
4493
 
4411
4494
  </xsl:attribute-set>
4412
4495
 
4496
+ <xsl:template name="refine_table-header-row-style">
4497
+
4498
+ <xsl:call-template name="setBordersTableArray"/>
4499
+
4500
+ </xsl:template> <!-- refine_table-header-row-style -->
4501
+
4413
4502
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
4414
4503
 
4415
4504
  </xsl:attribute-set>
4416
4505
 
4506
+ <xsl:template name="refine_table-footer-row-style">
4507
+
4508
+ </xsl:template> <!-- refine_table-footer-row-style -->
4509
+
4417
4510
  <xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
4418
4511
 
4419
4512
  </xsl:attribute-set>
4420
4513
 
4514
+ <xsl:template name="refine_table-body-row-style">
4515
+
4516
+ <xsl:call-template name="setBordersTableArray"/>
4517
+
4518
+ </xsl:template> <!-- refine_table-body-row-style -->
4519
+
4421
4520
  <xsl:attribute-set name="table-header-cell-style">
4422
4521
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4423
4522
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -4432,6 +4531,29 @@
4432
4531
 
4433
4532
  </xsl:attribute-set> <!-- table-header-cell-style -->
4434
4533
 
4534
+ <xsl:template name="refine_table-header-cell-style">
4535
+
4536
+ <xsl:if test="(ancestor::*[local-name() = 'annex'] and ancestor::*[local-name() = 'table']//*[local-name() = 'xref'][@pagenumber]) or ancestor::*[local-name() = 'doccontrol']"><!-- for Annex ToC -->
4537
+ <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
4538
+ <xsl:attribute name="border-bottom">solid black 0pt</xsl:attribute>
4539
+ </xsl:if>
4540
+ <xsl:if test="ancestor::*[local-name() = 'doccontrol']">
4541
+ <xsl:call-template name="setTextAlignment">
4542
+ <xsl:with-param name="default">left</xsl:with-param>
4543
+ </xsl:call-template>
4544
+ <xsl:attribute name="display-align">before</xsl:attribute>
4545
+ </xsl:if>
4546
+
4547
+ <xsl:call-template name="setBordersTableArray"/>
4548
+
4549
+ <xsl:if test="$lang = 'ar'">
4550
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4551
+ </xsl:if>
4552
+
4553
+ <xsl:call-template name="setTableCellAttributes"/>
4554
+
4555
+ </xsl:template> <!-- refine_table-header-cell-style -->
4556
+
4435
4557
  <xsl:attribute-set name="table-cell-style">
4436
4558
  <xsl:attribute name="display-align">center</xsl:attribute>
4437
4559
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -4441,6 +4563,29 @@
4441
4563
 
4442
4564
  </xsl:attribute-set> <!-- table-cell-style -->
4443
4565
 
4566
+ <xsl:template name="refine_table-cell-style">
4567
+
4568
+ <xsl:if test="$lang = 'ar'">
4569
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4570
+ </xsl:if>
4571
+
4572
+ <xsl:variable name="rownum"><xsl:number count="*[local-name()='tr']"/></xsl:variable>
4573
+ <xsl:if test="$rownum = 1">
4574
+ <xsl:attribute name="padding-top">3mm</xsl:attribute>
4575
+ </xsl:if>
4576
+ <xsl:if test="not(ancestor::*[local-name()='tr']/following-sibling::*[local-name()='tr'])"> <!-- last row -->
4577
+ <xsl:attribute name="padding-bottom">2mm</xsl:attribute>
4578
+ </xsl:if>
4579
+ <xsl:if test="ancestor::*[local-name() = 'doccontrol']">
4580
+ <xsl:attribute name="display-align">before</xsl:attribute>
4581
+ </xsl:if>
4582
+
4583
+ <!-- bsi -->
4584
+
4585
+ <xsl:call-template name="setBordersTableArray"/>
4586
+
4587
+ </xsl:template> <!-- refine_table-cell-style -->
4588
+
4444
4589
  <xsl:attribute-set name="table-footer-cell-style">
4445
4590
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
4446
4591
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -4451,6 +4596,10 @@
4451
4596
 
4452
4597
  </xsl:attribute-set> <!-- table-footer-cell-style -->
4453
4598
 
4599
+ <xsl:template name="refine_table-footer-cell-style">
4600
+
4601
+ </xsl:template> <!-- refine_table-footer-cell-style -->
4602
+
4454
4603
  <xsl:attribute-set name="table-note-style">
4455
4604
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4456
4605
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -4460,6 +4609,15 @@
4460
4609
 
4461
4610
  </xsl:attribute-set><!-- table-note-style -->
4462
4611
 
4612
+ <xsl:template name="refine_table-note-style">
4613
+
4614
+ <xsl:if test="ancestor::bipm:preface">
4615
+ <xsl:attribute name="margin-top">18pt</xsl:attribute>
4616
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4617
+ </xsl:if>
4618
+
4619
+ </xsl:template> <!-- refine_table-note-style -->
4620
+
4463
4621
  <xsl:attribute-set name="table-fn-style">
4464
4622
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4465
4623
 
@@ -4521,6 +4679,10 @@
4521
4679
 
4522
4680
  </xsl:attribute-set>
4523
4681
 
4682
+ <xsl:template name="refine_dt-cell-style">
4683
+
4684
+ </xsl:template> <!-- refine_dt-cell-style -->
4685
+
4524
4686
  <xsl:attribute-set name="dt-block-style">
4525
4687
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
4526
4688
 
@@ -4528,6 +4690,10 @@
4528
4690
 
4529
4691
  </xsl:attribute-set>
4530
4692
 
4693
+ <xsl:template name="refine_dt-block-style">
4694
+
4695
+ </xsl:template> <!-- refine_dt-block-style -->
4696
+
4531
4697
  <xsl:attribute-set name="dl-name-style">
4532
4698
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4533
4699
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -4541,6 +4707,10 @@
4541
4707
 
4542
4708
  </xsl:attribute-set>
4543
4709
 
4710
+ <xsl:template name="refine_dd-cell-style">
4711
+
4712
+ </xsl:template> <!-- refine_dd-cell-style -->
4713
+
4544
4714
  <!-- ========================== -->
4545
4715
  <!-- END Definition's list styles -->
4546
4716
  <!-- ========================== -->
@@ -4561,6 +4731,12 @@
4561
4731
 
4562
4732
  </xsl:attribute-set>
4563
4733
 
4734
+ <xsl:template name="refine_eref-style">
4735
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
4736
+ <xsl:variable name="text" select="normalize-space()"/>
4737
+
4738
+ </xsl:template> <!-- refine_eref-style -->
4739
+
4564
4740
  <xsl:attribute-set name="note-style">
4565
4741
 
4566
4742
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -4568,6 +4744,15 @@
4568
4744
 
4569
4745
  </xsl:attribute-set>
4570
4746
 
4747
+ <xsl:template name="refine_note-style">
4748
+
4749
+ <xsl:if test="parent::*[local-name() = 'li']">
4750
+ <xsl:attribute name="margin-top">4pt</xsl:attribute>
4751
+ <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
4752
+ </xsl:if>
4753
+
4754
+ </xsl:template>
4755
+
4571
4756
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
4572
4757
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
4573
4758
 
@@ -4575,6 +4760,10 @@
4575
4760
 
4576
4761
  </xsl:attribute-set>
4577
4762
 
4763
+ <xsl:template name="refine_note-name-style">
4764
+
4765
+ </xsl:template> <!-- refine_note-name-style -->
4766
+
4578
4767
  <xsl:attribute-set name="table-note-name-style">
4579
4768
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
4580
4769
 
@@ -4582,6 +4771,14 @@
4582
4771
 
4583
4772
  </xsl:attribute-set>
4584
4773
 
4774
+ <xsl:template name="refine_table-note-name-style">
4775
+
4776
+ <xsl:if test="ancestor::bipm:preface">
4777
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4778
+ </xsl:if>
4779
+
4780
+ </xsl:template> <!-- refine_table-note-name-style -->
4781
+
4585
4782
  <xsl:attribute-set name="note-p-style">
4586
4783
 
4587
4784
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -4595,12 +4792,20 @@
4595
4792
 
4596
4793
  </xsl:attribute-set>
4597
4794
 
4795
+ <xsl:template name="refine_termnote-style">
4796
+
4797
+ </xsl:template> <!-- refine_termnote-style -->
4798
+
4598
4799
  <xsl:attribute-set name="termnote-name-style">
4599
4800
 
4600
4801
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4601
4802
 
4602
4803
  </xsl:attribute-set>
4603
4804
 
4805
+ <xsl:template name="refine_termnote-name-style">
4806
+
4807
+ </xsl:template>
4808
+
4604
4809
  <xsl:attribute-set name="termnote-p-style">
4605
4810
 
4606
4811
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -4613,6 +4818,10 @@
4613
4818
 
4614
4819
  </xsl:attribute-set>
4615
4820
 
4821
+ <xsl:template name="refine_quote-style">
4822
+
4823
+ </xsl:template>
4824
+
4616
4825
  <xsl:attribute-set name="quote-source-style">
4617
4826
  <xsl:attribute name="text-align">right</xsl:attribute>
4618
4827
 
@@ -4622,6 +4831,10 @@
4622
4831
 
4623
4832
  </xsl:attribute-set>
4624
4833
 
4834
+ <xsl:template name="refine_termsource-style">
4835
+
4836
+ </xsl:template> <!-- refine_termsource-style -->
4837
+
4625
4838
  <xsl:attribute-set name="termsource-text-style">
4626
4839
 
4627
4840
  </xsl:attribute-set>
@@ -4658,6 +4871,10 @@
4658
4871
 
4659
4872
  </xsl:attribute-set>
4660
4873
 
4874
+ <xsl:template name="refine_figure-name-style">
4875
+
4876
+ </xsl:template> <!-- refine_figure-name-style -->
4877
+
4661
4878
  <xsl:attribute-set name="figure-source-style">
4662
4879
 
4663
4880
  </xsl:attribute-set>
@@ -4676,6 +4893,10 @@
4676
4893
 
4677
4894
  </xsl:attribute-set> <!-- formula-stem-block-style -->
4678
4895
 
4896
+ <xsl:template name="refine_formula-stem-block-style">
4897
+
4898
+ </xsl:template> <!-- refine_formula-stem-block-style -->
4899
+
4679
4900
  <xsl:attribute-set name="formula-stem-number-style">
4680
4901
  <xsl:attribute name="text-align">right</xsl:attribute>
4681
4902
 
@@ -4687,6 +4908,10 @@
4687
4908
 
4688
4909
  </xsl:attribute-set>
4689
4910
 
4911
+ <xsl:template name="refine_image-style">
4912
+
4913
+ </xsl:template>
4914
+
4690
4915
  <xsl:attribute-set name="figure-pseudocode-p-style">
4691
4916
 
4692
4917
  </xsl:attribute-set>
@@ -4773,10 +4998,22 @@
4773
4998
 
4774
4999
  </xsl:attribute-set>
4775
5000
 
5001
+ <xsl:template name="refine_mathml-style">
5002
+
5003
+ <xsl:if test="ancestor::*[local-name()='table']">
5004
+ <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
5005
+ </xsl:if>
5006
+
5007
+ </xsl:template>
5008
+
4776
5009
  <xsl:attribute-set name="list-style">
4777
5010
 
4778
5011
  </xsl:attribute-set> <!-- list-style -->
4779
5012
 
5013
+ <xsl:template name="refine_list-style">
5014
+
5015
+ </xsl:template> <!-- refine_list-style -->
5016
+
4780
5017
  <xsl:attribute-set name="list-name-style">
4781
5018
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4782
5019
 
@@ -4788,14 +5025,26 @@
4788
5025
 
4789
5026
  </xsl:attribute-set>
4790
5027
 
5028
+ <xsl:template name="refine_list-item-style">
5029
+
5030
+ </xsl:template> <!-- refine_list-item-style -->
5031
+
4791
5032
  <xsl:attribute-set name="list-item-label-style">
4792
5033
 
4793
5034
  </xsl:attribute-set>
4794
5035
 
5036
+ <xsl:template name="refine_list-item-label-style">
5037
+
5038
+ </xsl:template> <!-- refine_list-item-label-style -->
5039
+
4795
5040
  <xsl:attribute-set name="list-item-body-style">
4796
5041
 
4797
5042
  </xsl:attribute-set>
4798
5043
 
5044
+ <xsl:template name="refine_list-item-body-style">
5045
+
5046
+ </xsl:template> <!-- refine_list-item-body-style -->
5047
+
4799
5048
  <xsl:attribute-set name="toc-style">
4800
5049
  <xsl:attribute name="line-height">135%</xsl:attribute>
4801
5050
  </xsl:attribute-set>
@@ -4810,6 +5059,10 @@
4810
5059
 
4811
5060
  </xsl:attribute-set>
4812
5061
 
5062
+ <xsl:template name="refine_fn-reference-style">
5063
+
5064
+ </xsl:template> <!-- refine_fn-reference-style -->
5065
+
4813
5066
  <xsl:attribute-set name="fn-style">
4814
5067
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4815
5068
  </xsl:attribute-set>
@@ -4835,6 +5088,10 @@
4835
5088
 
4836
5089
  </xsl:attribute-set>
4837
5090
 
5091
+ <xsl:template name="refine_fn-body-style">
5092
+
5093
+ </xsl:template> <!-- refine_fn-body-style -->
5094
+
4838
5095
  <xsl:attribute-set name="fn-body-num-style">
4839
5096
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
4840
5097
 
@@ -4844,6 +5101,10 @@
4844
5101
 
4845
5102
  </xsl:attribute-set> <!-- fn-body-num-style -->
4846
5103
 
5104
+ <xsl:template name="refine_fn-body-num-style">
5105
+
5106
+ </xsl:template> <!-- refine_fn-body-num-style -->
5107
+
4847
5108
  <!-- admonition -->
4848
5109
  <xsl:attribute-set name="admonition-style">
4849
5110
 
@@ -5515,15 +5776,9 @@
5515
5776
 
5516
5777
  <fo:block-container xsl:use-attribute-sets="table-container-style">
5517
5778
 
5518
- <xsl:if test="not(ancestor::*[local-name()='note_side'])">
5519
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5520
- </xsl:if>
5521
- <xsl:if test="@parent-type = 'quote'">
5522
- <xsl:attribute name="font-family">Arial</xsl:attribute>
5523
- <xsl:attribute name="font-size">9pt</xsl:attribute>
5524
- </xsl:if>
5525
-
5526
- <!-- end table block-container attributes -->
5779
+ <xsl:call-template name="refine_table-container-style">
5780
+ <xsl:with-param name="margin-side" select="$margin-side"/>
5781
+ </xsl:call-template>
5527
5782
 
5528
5783
  <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
5529
5784
 
@@ -5550,12 +5805,9 @@
5550
5805
 
5551
5806
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
5552
5807
 
5553
- <xsl:if test="not(ancestor::*[local-name()='preface']) and not(ancestor::*[local-name()='note_side']) and not(ancestor::*[local-name() = 'annex'] and .//*[local-name() = 'xref'][@pagenumber]) and not(ancestor::*[local-name() = 'doccontrol'])">
5554
- <xsl:attribute name="border-top">0.5pt solid black</xsl:attribute>
5555
- <xsl:attribute name="border-bottom">0.5pt solid black</xsl:attribute>
5556
- </xsl:if>
5557
-
5558
- <xsl:call-template name="setBordersTableArray"/>
5808
+ <xsl:call-template name="refine_table-style">
5809
+ <xsl:with-param name="margin-side" select="$margin-side"/>
5810
+ </xsl:call-template>
5559
5811
 
5560
5812
  </xsl:element>
5561
5813
  </xsl:variable>
@@ -5621,7 +5873,7 @@
5621
5873
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
5622
5874
  </xsl:when>
5623
5875
  <xsl:otherwise>
5624
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
5876
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'p') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
5625
5877
  </xsl:otherwise>
5626
5878
  </xsl:choose>
5627
5879
 
@@ -6110,6 +6362,8 @@
6110
6362
  <fo:table-row>
6111
6363
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
6112
6364
 
6365
+ <xsl:call-template name="refine_table-header-title-style"/>
6366
+
6113
6367
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
6114
6368
  <xsl:with-param name="continued">true</xsl:with-param>
6115
6369
  </xsl:apply-templates>
@@ -6122,6 +6376,10 @@
6122
6376
  </fo:table-row>
6123
6377
  </xsl:template> <!-- table-header-title -->
6124
6378
 
6379
+ <xsl:template name="refine_table-header-title-style">
6380
+
6381
+ </xsl:template> <!-- refine_table-header-title-style -->
6382
+
6125
6383
  <xsl:template match="*[local-name()='thead']" mode="process_tbody">
6126
6384
  <fo:table-body>
6127
6385
  <xsl:apply-templates/>
@@ -6146,7 +6404,7 @@
6146
6404
  <xsl:param name="colwidths"/>
6147
6405
  <xsl:param name="colgroup"/>
6148
6406
 
6149
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
6407
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
6150
6408
 
6151
6409
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6152
6410
 
@@ -6206,6 +6464,8 @@
6206
6464
  <fo:table-row>
6207
6465
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6208
6466
 
6467
+ <xsl:call-template name="refine_table-footer-cell-style"/>
6468
+
6209
6469
  <xsl:call-template name="setBordersTableArray"/>
6210
6470
 
6211
6471
  <!-- fn will be processed inside 'note' processing -->
@@ -6224,6 +6484,7 @@
6224
6484
 
6225
6485
  <!-- except gb and bsi -->
6226
6486
 
6487
+ <xsl:apply-templates select="../*[local-name()='p']"/>
6227
6488
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6228
6489
  <xsl:apply-templates select="../*[local-name()='note']"/>
6229
6490
  <xsl:apply-templates select="../*[local-name()='source']"/>
@@ -6355,7 +6616,7 @@
6355
6616
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
6356
6617
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
6357
6618
 
6358
- <xsl:call-template name="setBordersTableArray"/>
6619
+ <xsl:call-template name="refine_table-header-row-style"/>
6359
6620
 
6360
6621
  <xsl:call-template name="setTableRowAttributes"/>
6361
6622
 
@@ -6389,6 +6650,8 @@
6389
6650
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
6390
6651
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
6391
6652
 
6653
+ <xsl:call-template name="refine_table-footer-row-style"/>
6654
+
6392
6655
  <xsl:call-template name="setTableRowAttributes"/>
6393
6656
  <xsl:apply-templates/>
6394
6657
  </fo:table-row>
@@ -6402,9 +6665,10 @@
6402
6665
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
6403
6666
  </xsl:if>
6404
6667
 
6405
- <xsl:call-template name="setBordersTableArray"/>
6668
+ <xsl:call-template name="refine_table-body-row-style"/>
6406
6669
 
6407
6670
  <xsl:call-template name="setTableRowAttributes"/>
6671
+
6408
6672
  <xsl:apply-templates/>
6409
6673
  </fo:table-row>
6410
6674
  </xsl:template>
@@ -6430,24 +6694,7 @@
6430
6694
  <xsl:with-param name="default">center</xsl:with-param>
6431
6695
  </xsl:call-template>
6432
6696
 
6433
- <xsl:if test="(ancestor::*[local-name() = 'annex'] and ancestor::*[local-name() = 'table']//*[local-name() = 'xref'][@pagenumber]) or ancestor::*[local-name() = 'doccontrol']"><!-- for Annex ToC -->
6434
- <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
6435
- <xsl:attribute name="border-bottom">solid black 0pt</xsl:attribute>
6436
- </xsl:if>
6437
- <xsl:if test="ancestor::*[local-name() = 'doccontrol']">
6438
- <xsl:call-template name="setTextAlignment">
6439
- <xsl:with-param name="default">left</xsl:with-param>
6440
- </xsl:call-template>
6441
- <xsl:attribute name="display-align">before</xsl:attribute>
6442
- </xsl:if>
6443
-
6444
- <xsl:call-template name="setBordersTableArray"/>
6445
-
6446
- <xsl:if test="$lang = 'ar'">
6447
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
6448
- </xsl:if>
6449
-
6450
- <xsl:call-template name="setTableCellAttributes"/>
6697
+ <xsl:call-template name="refine_table-header-cell-style"/>
6451
6698
 
6452
6699
  <fo:block>
6453
6700
  <xsl:apply-templates/>
@@ -6489,24 +6736,7 @@
6489
6736
  <xsl:with-param name="default">left</xsl:with-param>
6490
6737
  </xsl:call-template>
6491
6738
 
6492
- <xsl:if test="$lang = 'ar'">
6493
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
6494
- </xsl:if>
6495
-
6496
- <xsl:variable name="rownum"><xsl:number count="*[local-name()='tr']"/></xsl:variable>
6497
- <xsl:if test="$rownum = 1">
6498
- <xsl:attribute name="padding-top">3mm</xsl:attribute>
6499
- </xsl:if>
6500
- <xsl:if test="not(ancestor::*[local-name()='tr']/following-sibling::*[local-name()='tr'])"> <!-- last row -->
6501
- <xsl:attribute name="padding-bottom">2mm</xsl:attribute>
6502
- </xsl:if>
6503
- <xsl:if test="ancestor::*[local-name() = 'doccontrol']">
6504
- <xsl:attribute name="display-align">before</xsl:attribute>
6505
- </xsl:if>
6506
-
6507
- <!-- bsi -->
6508
-
6509
- <xsl:call-template name="setBordersTableArray"/>
6739
+ <xsl:call-template name="refine_table-cell-style"/>
6510
6740
 
6511
6741
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
6512
6742
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -6546,17 +6776,12 @@
6546
6776
 
6547
6777
  <fo:block xsl:use-attribute-sets="table-note-style">
6548
6778
 
6549
- <xsl:if test="ancestor::bipm:preface">
6550
- <xsl:attribute name="margin-top">18pt</xsl:attribute>
6551
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
6552
- </xsl:if>
6779
+ <xsl:call-template name="refine_table-note-style"/>
6553
6780
 
6554
6781
  <!-- Table's note name (NOTE, for example) -->
6555
6782
  <fo:inline xsl:use-attribute-sets="table-note-name-style">
6556
6783
 
6557
- <xsl:if test="ancestor::bipm:preface">
6558
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
6559
- </xsl:if>
6784
+ <xsl:call-template name="refine_table-note-name-style"/>
6560
6785
 
6561
6786
  <xsl:apply-templates select="*[local-name() = 'name']"/>
6562
6787
 
@@ -6589,6 +6814,14 @@
6589
6814
  <!-- list of footnotes to calculate actual footnotes number -->
6590
6815
  <xsl:variable name="p_fn_">
6591
6816
  <xsl:call-template name="get_fn_list"/>
6817
+ <!-- <xsl:choose>
6818
+ <xsl:when test="$namespace = 'jis'">
6819
+ <xsl:call-template name="get_fn_list_for_element"/>
6820
+ </xsl:when>
6821
+ <xsl:otherwise>
6822
+ <xsl:call-template name="get_fn_list"/>
6823
+ </xsl:otherwise>
6824
+ </xsl:choose> -->
6592
6825
  </xsl:variable>
6593
6826
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
6594
6827
 
@@ -6613,7 +6846,14 @@
6613
6846
 
6614
6847
  </xsl:variable>
6615
6848
 
6616
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
6849
+ <xsl:variable name="ref_id">
6850
+ <xsl:choose>
6851
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
6852
+ <xsl:otherwise>
6853
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
6854
+ </xsl:otherwise>
6855
+ </xsl:choose>
6856
+ </xsl:variable>
6617
6857
  <xsl:variable name="footnote_inline">
6618
6858
  <fo:inline>
6619
6859
 
@@ -6636,9 +6876,13 @@
6636
6876
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
6637
6877
  </xsl:if>
6638
6878
 
6639
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6640
- <xsl:value-of select="$current_fn_number_text"/>
6641
- </fo:basic-link>
6879
+ <xsl:call-template name="insert_basic_link">
6880
+ <xsl:with-param name="element">
6881
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6882
+ <xsl:copy-of select="$current_fn_number_text"/>
6883
+ </fo:basic-link>
6884
+ </xsl:with-param>
6885
+ </xsl:call-template>
6642
6886
  </fo:inline>
6643
6887
  </xsl:variable>
6644
6888
 
@@ -6655,8 +6899,12 @@
6655
6899
 
6656
6900
  <fo:block xsl:use-attribute-sets="fn-body-style">
6657
6901
 
6902
+ <xsl:call-template name="refine_fn-body-style"/>
6903
+
6658
6904
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
6659
6905
 
6906
+ <xsl:call-template name="refine_fn-body-num-style"/>
6907
+
6660
6908
  <xsl:value-of select="$current_fn_number_text"/>
6661
6909
  </fo:inline>
6662
6910
  <xsl:apply-templates/>
@@ -6708,6 +6956,28 @@
6708
6956
  </xsl:choose>
6709
6957
  </xsl:template>
6710
6958
 
6959
+ <xsl:template name="get_fn_list_for_element">
6960
+ <xsl:choose>
6961
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
6962
+ <fn gen_id="{generate-id(.)}">
6963
+ <xsl:copy-of select="@*"/>
6964
+ <xsl:copy-of select="node()"/>
6965
+ </fn>
6966
+ </xsl:when>
6967
+ <xsl:otherwise>
6968
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
6969
+ <xsl:variable name="element_id" select="@id"/>
6970
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
6971
+ <!-- copy unique fn -->
6972
+ <fn gen_id="{generate-id(.)}">
6973
+ <xsl:copy-of select="@*"/>
6974
+ <xsl:copy-of select="node()"/>
6975
+ </fn>
6976
+ </xsl:for-each>
6977
+ </xsl:for-each>
6978
+ </xsl:otherwise>
6979
+ </xsl:choose>
6980
+ </xsl:template>
6711
6981
  <!-- ============================ -->
6712
6982
  <!-- table's footnotes rendering -->
6713
6983
  <!-- ============================ -->
@@ -6886,6 +7156,8 @@
6886
7156
  <xsl:template match="*[local-name()='fn']">
6887
7157
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
6888
7158
 
7159
+ <xsl:call-template name="refine_fn-reference-style"/>
7160
+
6889
7161
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6890
7162
 
6891
7163
  <fo:inline font-style="normal"> (</fo:inline>
@@ -6980,14 +7252,18 @@
6980
7252
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
6981
7253
  <xsl:text> </xsl:text>
6982
7254
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
6983
- <xsl:text/>
6984
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
7255
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
7256
+ <xsl:text> </xsl:text>
7257
+ </xsl:if>
7258
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
6985
7259
  </fo:block>
6986
7260
 
6987
7261
  </xsl:when> <!-- END: only one component -->
6988
7262
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
6989
7263
  <fo:block margin-bottom="12pt" text-align="left">
6990
7264
 
7265
+ <xsl:call-template name="refine_dl_formula_where_style"/>
7266
+
6991
7267
  <!-- <xsl:variable name="title-where">
6992
7268
  <xsl:call-template name="getLocalizedString">
6993
7269
  <xsl:with-param name="key">where</xsl:with-param>
@@ -7001,6 +7277,8 @@
7001
7277
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
7002
7278
  <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
7003
7279
 
7280
+ <xsl:call-template name="refine_figure_key_style"/>
7281
+
7004
7282
  <xsl:variable name="title-key">
7005
7283
  <xsl:call-template name="getLocalizedString">
7006
7284
  <xsl:with-param name="key">key</xsl:with-param>
@@ -7015,12 +7293,16 @@
7015
7293
  <xsl:if test="$onlyOneComponent = 'false'">
7016
7294
  <fo:block>
7017
7295
 
7296
+ <xsl:call-template name="refine_multicomponent_style"/>
7297
+
7018
7298
  <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
7019
7299
  <xsl:attribute name="margin-top">0</xsl:attribute>
7020
7300
  </xsl:if>
7021
7301
 
7022
7302
  <fo:block>
7023
7303
 
7304
+ <xsl:call-template name="refine_multicomponent_block_style"/>
7305
+
7024
7306
  <xsl:apply-templates select="*[local-name() = 'name']">
7025
7307
  <xsl:with-param name="process">true</xsl:with-param>
7026
7308
  </xsl:apply-templates>
@@ -7178,6 +7460,24 @@
7178
7460
 
7179
7461
  </xsl:template> <!-- END: dl -->
7180
7462
 
7463
+ <xsl:template name="refine_dl_formula_where_style">
7464
+
7465
+ </xsl:template> <!-- refine_dl_formula_where_style -->
7466
+
7467
+ <xsl:template name="refine_figure_key_style">
7468
+
7469
+ </xsl:template> <!-- refine_figure_key_style -->
7470
+
7471
+ <xsl:template name="refine_multicomponent_style">
7472
+ <xsl:variable name="parent" select="local-name(..)"/>
7473
+
7474
+ </xsl:template> <!-- refine_multicomponent_style -->
7475
+
7476
+ <xsl:template name="refine_multicomponent_block_style">
7477
+ <xsl:variable name="parent" select="local-name(..)"/>
7478
+
7479
+ </xsl:template> <!-- refine_multicomponent_block_style -->
7480
+
7181
7481
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
7182
7482
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
7183
7483
 
@@ -7397,6 +7697,8 @@
7397
7697
 
7398
7698
  </xsl:if>
7399
7699
 
7700
+ <xsl:call-template name="refine_dt-cell-style"/>
7701
+
7400
7702
  <fo:block xsl:use-attribute-sets="dt-block-style">
7401
7703
  <xsl:copy-of select="@id"/>
7402
7704
 
@@ -7404,6 +7706,8 @@
7404
7706
  <xsl:attribute name="margin-top">0</xsl:attribute>
7405
7707
  </xsl:if>
7406
7708
 
7709
+ <xsl:call-template name="refine_dt-block-style"/>
7710
+
7407
7711
  <xsl:apply-templates>
7408
7712
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
7409
7713
  </xsl:apply-templates>
@@ -7423,6 +7727,8 @@
7423
7727
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
7424
7728
  </xsl:if>
7425
7729
 
7730
+ <xsl:call-template name="refine_dd-cell-style"/>
7731
+
7426
7732
  <fo:block>
7427
7733
 
7428
7734
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -7468,8 +7774,18 @@
7468
7774
  </xsl:if>
7469
7775
  </xsl:template>
7470
7776
 
7471
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
7472
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
7777
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
7778
+ <xsl:variable name="is_inline_element_after_where">
7779
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
7780
+ </xsl:variable>
7781
+ <xsl:choose>
7782
+ <xsl:when test="$is_inline_element_after_where = 'true'">
7783
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
7784
+ </xsl:when>
7785
+ <xsl:otherwise>
7786
+ <xsl:apply-templates select="."/>
7787
+ </xsl:otherwise>
7788
+ </xsl:choose>
7473
7789
  </xsl:template>
7474
7790
 
7475
7791
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -7563,12 +7879,18 @@
7563
7879
  <xsl:param name="split_keep-within-line"/>
7564
7880
  <fo:inline font-weight="bold">
7565
7881
 
7882
+ <xsl:call-template name="refine_strong_style"/>
7883
+
7566
7884
  <xsl:apply-templates>
7567
7885
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
7568
7886
  </xsl:apply-templates>
7569
7887
  </fo:inline>
7570
7888
  </xsl:template>
7571
7889
 
7890
+ <xsl:template name="refine_strong_style">
7891
+
7892
+ </xsl:template>
7893
+
7572
7894
  <xsl:template match="*[local-name()='padding']">
7573
7895
  <fo:inline padding-right="{@value}"> </fo:inline>
7574
7896
  </xsl:template>
@@ -8710,9 +9032,10 @@
8710
9032
 
8711
9033
  <fo:inline xsl:use-attribute-sets="mathml-style">
8712
9034
 
8713
- <xsl:if test="ancestor::*[local-name()='table']">
8714
- <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
8715
- </xsl:if>
9035
+ <!-- DEBUG -->
9036
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
9037
+
9038
+ <xsl:call-template name="refine_mathml-style"/>
8716
9039
 
8717
9040
  <xsl:if test="$isGenerateTableIF = 'true' and ancestor::*[local-name() = 'td' or local-name() = 'th' or local-name() = 'dl'] and not(following-sibling::node()[not(self::comment())][normalize-space() != ''])"> <!-- math in table cell, and math is last element -->
8718
9041
  <!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
@@ -8843,12 +9166,7 @@
8843
9166
 
8844
9167
  <fo:instream-foreign-object fox:alt-text="Math">
8845
9168
 
8846
- <xsl:if test="local-name(../..) = 'formula'">
8847
- <xsl:attribute name="width">95%</xsl:attribute>
8848
- <xsl:attribute name="content-height">100%</xsl:attribute>
8849
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8850
- <xsl:attribute name="scaling">uniform</xsl:attribute>
8851
- </xsl:if>
9169
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
8852
9170
 
8853
9171
  <!-- put MathML in Actual Text -->
8854
9172
  <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
@@ -8870,6 +9188,17 @@
8870
9188
  </fo:instream-foreign-object>
8871
9189
  </xsl:template>
8872
9190
 
9191
+ <xsl:template name="refine_mathml_insteam_object_style">
9192
+
9193
+ <xsl:if test="local-name(../..) = 'formula'">
9194
+ <xsl:attribute name="width">95%</xsl:attribute>
9195
+ <xsl:attribute name="content-height">100%</xsl:attribute>
9196
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9197
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
9198
+ </xsl:if>
9199
+
9200
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
9201
+
8873
9202
  <xsl:template match="mathml:*" mode="mathml_actual_text">
8874
9203
  <!-- <xsl:text>a+b</xsl:text> -->
8875
9204
  <xsl:text>&lt;</xsl:text>
@@ -8933,6 +9262,79 @@
8933
9262
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
8934
9263
  </xsl:template>
8935
9264
 
9265
+ <!-- special case for:
9266
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
9267
+ <mstyle displaystyle="true">
9268
+ <msup>
9269
+ <mi color="#00000000">C</mi>
9270
+ <mtext>R</mtext>
9271
+ </msup>
9272
+ <msubsup>
9273
+ <mtext>C</mtext>
9274
+ <mi>n</mi>
9275
+ <mi>k</mi>
9276
+ </msubsup>
9277
+ </mstyle>
9278
+ </math>
9279
+ -->
9280
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
9281
+ <xsl:copy>
9282
+ <xsl:copy-of select="@*"/>
9283
+ <xsl:variable name="next_mtext" select="ancestor::mathml:msup/following-sibling::*[1][self::mathml:msubsup or self::mathml:msub or self::mathml:msup]/mathml:mtext"/>
9284
+ <xsl:if test="string-length($next_mtext) != ''">
9285
+ <xsl:attribute name="color">#00000000</xsl:attribute>
9286
+ </xsl:if>
9287
+ <xsl:apply-templates/>
9288
+ <xsl:value-of select="$next_mtext"/>
9289
+ </xsl:copy>
9290
+ </xsl:template>
9291
+
9292
+ <!-- special case for:
9293
+ <msup>
9294
+ <mtext/>
9295
+ <mn>1</mn>
9296
+ </msup>
9297
+ convert to (add mspace after mtext and enclose them into mrow):
9298
+ <msup>
9299
+ <mrow>
9300
+ <mtext/>
9301
+ <mspace height="1.47ex"/>
9302
+ </mrow>
9303
+ <mn>1</mn>
9304
+ </msup>
9305
+ -->
9306
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
9307
+ <mathml:mrow>
9308
+ <xsl:copy-of select="."/>
9309
+ <mathml:mspace height="1.47ex"/>
9310
+ </mathml:mrow>
9311
+ </xsl:template>
9312
+
9313
+ <!-- add space around vertical line -->
9314
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
9315
+ <xsl:copy>
9316
+ <xsl:apply-templates select="@*" mode="mathml"/>
9317
+ <xsl:if test="not(@lspace)">
9318
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
9319
+ </xsl:if>
9320
+ <xsl:if test="not(@rspace)">
9321
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
9322
+ </xsl:if>
9323
+ <xsl:apply-templates mode="mathml"/>
9324
+ </xsl:copy>
9325
+ </xsl:template>
9326
+
9327
+ <!-- decrease fontsize for 'Circled Times' char -->
9328
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
9329
+ <xsl:copy>
9330
+ <xsl:apply-templates select="@*" mode="mathml"/>
9331
+ <xsl:if test="not(@fontsize)">
9332
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
9333
+ </xsl:if>
9334
+ <xsl:apply-templates mode="mathml"/>
9335
+ </xsl:copy>
9336
+ </xsl:template>
9337
+
8936
9338
  <!-- Examples:
8937
9339
  <stem type="AsciiMath">x = 1</stem>
8938
9340
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -8941,9 +9343,7 @@
8941
9343
  <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
8942
9344
  <fo:inline xsl:use-attribute-sets="mathml-style">
8943
9345
 
8944
- <xsl:if test="ancestor::*[local-name()='table']">
8945
- <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
8946
- </xsl:if>
9346
+ <xsl:call-template name="refine_mathml-style"/>
8947
9347
 
8948
9348
  <xsl:choose>
8949
9349
  <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
@@ -8989,24 +9389,30 @@
8989
9389
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8990
9390
  </xsl:if>
8991
9391
 
9392
+ <xsl:call-template name="refine_link-style"/>
9393
+
8992
9394
  <xsl:choose>
8993
9395
  <xsl:when test="$target_text = ''">
8994
9396
  <xsl:apply-templates/>
8995
9397
  </xsl:when>
8996
9398
  <xsl:otherwise>
8997
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8998
- <xsl:choose>
8999
- <xsl:when test="normalize-space(.) = ''">
9000
- <xsl:call-template name="add-zero-spaces-link-java">
9001
- <xsl:with-param name="text" select="$target_text"/>
9002
- </xsl:call-template>
9003
- </xsl:when>
9004
- <xsl:otherwise>
9005
- <!-- output text from <link>text</link> -->
9006
- <xsl:apply-templates/>
9007
- </xsl:otherwise>
9008
- </xsl:choose>
9009
- </fo:basic-link>
9399
+ <xsl:call-template name="insert_basic_link">
9400
+ <xsl:with-param name="element">
9401
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
9402
+ <xsl:choose>
9403
+ <xsl:when test="normalize-space(.) = ''">
9404
+ <xsl:call-template name="add-zero-spaces-link-java">
9405
+ <xsl:with-param name="text" select="$target_text"/>
9406
+ </xsl:call-template>
9407
+ </xsl:when>
9408
+ <xsl:otherwise>
9409
+ <!-- output text from <link>text</link> -->
9410
+ <xsl:apply-templates/>
9411
+ </xsl:otherwise>
9412
+ </xsl:choose>
9413
+ </fo:basic-link>
9414
+ </xsl:with-param>
9415
+ </xsl:call-template>
9010
9416
  </xsl:otherwise>
9011
9417
  </xsl:choose>
9012
9418
  </fo:inline>
@@ -9069,12 +9475,19 @@
9069
9475
  </xsl:template>
9070
9476
 
9071
9477
  <xsl:template match="*[local-name() = 'xref']">
9072
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
9073
- <xsl:if test="parent::*[local-name() = 'add']">
9074
- <xsl:call-template name="append_add-style"/>
9075
- </xsl:if>
9076
- <xsl:apply-templates/>
9077
- </fo:basic-link>
9478
+ <xsl:call-template name="insert_basic_link">
9479
+ <xsl:with-param name="element">
9480
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
9481
+ <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://'))">
9482
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
9483
+ </xsl:if>
9484
+ <xsl:if test="parent::*[local-name() = 'add']">
9485
+ <xsl:call-template name="append_add-style"/>
9486
+ </xsl:if>
9487
+ <xsl:apply-templates/>
9488
+ </fo:basic-link>
9489
+ </xsl:with-param>
9490
+ </xsl:call-template>
9078
9491
  </xsl:template>
9079
9492
 
9080
9493
  <!-- ====== -->
@@ -9129,6 +9542,8 @@
9129
9542
  <fo:table-cell display-align="center">
9130
9543
  <fo:block xsl:use-attribute-sets="formula-stem-block-style">
9131
9544
 
9545
+ <xsl:call-template name="refine_formula-stem-block-style"/>
9546
+
9132
9547
  <xsl:apply-templates/>
9133
9548
  </fo:block>
9134
9549
  </fo:table-cell>
@@ -9170,24 +9585,18 @@
9170
9585
 
9171
9586
  <xsl:call-template name="setBlockSpanAll"/>
9172
9587
 
9173
- <xsl:if test="parent::*[local-name() = 'li']">
9174
- <xsl:attribute name="margin-top">4pt</xsl:attribute>
9175
- <xsl:attribute name="margin-bottom">4pt</xsl:attribute>
9176
- </xsl:if>
9588
+ <xsl:call-template name="refine_note-style"/>
9177
9589
 
9178
9590
  <fo:block-container margin-left="0mm" margin-right="0mm">
9179
9591
 
9180
9592
  <fo:block>
9181
9593
 
9182
- <xsl:if test="@parent-type = 'quote'">
9183
- <xsl:attribute name="font-family">Arial</xsl:attribute>
9184
- <xsl:attribute name="font-size">9pt</xsl:attribute>
9185
- <xsl:attribute name="line-height">130%</xsl:attribute>
9186
- <xsl:attribute name="text-align">justify</xsl:attribute>
9187
- </xsl:if>
9594
+ <xsl:call-template name="refine_note_block_style"/>
9188
9595
 
9189
9596
  <fo:inline xsl:use-attribute-sets="note-name-style">
9190
9597
 
9598
+ <xsl:call-template name="refine_note-name-style"/>
9599
+
9191
9600
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9192
9601
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
9193
9602
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -9213,6 +9622,17 @@
9213
9622
 
9214
9623
  </xsl:template>
9215
9624
 
9625
+ <xsl:template name="refine_note_block_style">
9626
+
9627
+ <xsl:if test="@parent-type = 'quote'">
9628
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
9629
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
9630
+ <xsl:attribute name="line-height">130%</xsl:attribute>
9631
+ <xsl:attribute name="text-align">justify</xsl:attribute>
9632
+ </xsl:if>
9633
+
9634
+ </xsl:template>
9635
+
9216
9636
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
9217
9637
  <xsl:variable name="num"><xsl:number/></xsl:variable>
9218
9638
  <xsl:choose>
@@ -9234,12 +9654,16 @@
9234
9654
 
9235
9655
  <xsl:call-template name="setBlockSpanAll"/>
9236
9656
 
9657
+ <xsl:call-template name="refine_termnote-style"/>
9658
+
9237
9659
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
9238
9660
 
9239
9661
  <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
9240
9662
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
9241
9663
  </xsl:if>
9242
9664
 
9665
+ <xsl:call-template name="refine_termnote-name-style"/>
9666
+
9243
9667
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
9244
9668
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
9245
9669
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -9427,6 +9851,8 @@
9427
9851
  <xsl:otherwise>
9428
9852
  <fo:block xsl:use-attribute-sets="image-style">
9429
9853
 
9854
+ <xsl:call-template name="refine_image-style"/>
9855
+
9430
9856
  <xsl:variable name="src">
9431
9857
  <xsl:call-template name="image_src"/>
9432
9858
  </xsl:variable>
@@ -9485,7 +9911,7 @@
9485
9911
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
9486
9912
  </xsl:when>
9487
9913
  <xsl:when test="not(starts-with(@src, 'data:'))">
9488
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
9914
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9489
9915
  </xsl:when>
9490
9916
  <xsl:otherwise>
9491
9917
  <xsl:value-of select="@src"/>
@@ -9507,7 +9933,7 @@
9507
9933
  </xsl:when>
9508
9934
  <xsl:when test="not(starts-with(@src, 'data:'))">
9509
9935
  <xsl:variable name="src">
9510
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
9936
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9511
9937
  </xsl:variable>
9512
9938
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
9513
9939
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -9893,15 +10319,19 @@
9893
10319
  <xsl:param name="dest"/>
9894
10320
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
9895
10321
  <fo:block font-size="1pt">
9896
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
9897
- <fo:inline-container inline-progression-dimension="100%">
9898
- <fo:block-container height="{$height - 1}px" width="100%">
9899
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
9900
- <xsl:attribute name="background-color">magenta</xsl:attribute>
9901
- </xsl:if> -->
9902
- <fo:block> </fo:block></fo:block-container>
9903
- </fo:inline-container>
9904
- </fo:basic-link>
10322
+ <xsl:call-template name="insert_basic_link">
10323
+ <xsl:with-param name="element">
10324
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
10325
+ <fo:inline-container inline-progression-dimension="100%">
10326
+ <fo:block-container height="{$height - 1}px" width="100%">
10327
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
10328
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
10329
+ </xsl:if> -->
10330
+ <fo:block> </fo:block></fo:block-container>
10331
+ </fo:inline-container>
10332
+ </fo:basic-link>
10333
+ </xsl:with-param>
10334
+ </xsl:call-template>
9905
10335
  </fo:block>
9906
10336
  </fo:block-container>
9907
10337
  </xsl:template>
@@ -10286,6 +10716,8 @@
10286
10716
  <xsl:if test="normalize-space() != ''">
10287
10717
  <fo:block xsl:use-attribute-sets="figure-name-style">
10288
10718
 
10719
+ <xsl:call-template name="refine_figure-name-style"/>
10720
+
10289
10721
  <xsl:apply-templates/>
10290
10722
  </fo:block>
10291
10723
  </xsl:if>
@@ -10549,6 +10981,8 @@
10549
10981
  </xsl:attribute>
10550
10982
  </xsl:for-each>
10551
10983
 
10984
+ <xsl:call-template name="refine_sourcecode-style"/>
10985
+
10552
10986
  <!-- remove margin between rows in the table with sourcecode line numbers -->
10553
10987
  <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
10554
10988
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
@@ -11253,6 +11687,8 @@
11253
11687
 
11254
11688
  <xsl:call-template name="setBlockSpanAll"/>
11255
11689
 
11690
+ <xsl:call-template name="refine_example-style"/>
11691
+
11256
11692
  <xsl:variable name="fo_element">
11257
11693
  <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11258
11694
  block
@@ -11380,6 +11816,8 @@
11380
11816
  </xsl:if>
11381
11817
  <fo:block xsl:use-attribute-sets="example-p-style">
11382
11818
 
11819
+ <xsl:call-template name="refine_example-p-style"/>
11820
+
11383
11821
  <xsl:apply-templates/>
11384
11822
  </fo:block>
11385
11823
  </fo:block-container>
@@ -11396,6 +11834,7 @@
11396
11834
  </xsl:otherwise>
11397
11835
  </xsl:choose>
11398
11836
  </xsl:template> <!-- example/p -->
11837
+
11399
11838
  <!-- ====== -->
11400
11839
  <!-- ====== -->
11401
11840
 
@@ -11407,6 +11846,8 @@
11407
11846
  <xsl:template match="*[local-name() = 'termsource']" name="termsource">
11408
11847
  <fo:block xsl:use-attribute-sets="termsource-style">
11409
11848
 
11849
+ <xsl:call-template name="refine_termsource-style"/>
11850
+
11410
11851
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
11411
11852
  <xsl:variable name="termsource_text">
11412
11853
  <xsl:apply-templates/>
@@ -11459,14 +11900,18 @@
11459
11900
  </xsl:template>
11460
11901
 
11461
11902
  <xsl:template match="*[local-name() = 'origin']">
11462
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11463
- <xsl:if test="normalize-space(@citeas) = ''">
11464
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11465
- </xsl:if>
11466
- <fo:inline xsl:use-attribute-sets="origin-style">
11467
- <xsl:apply-templates/>
11468
- </fo:inline>
11469
- </fo:basic-link>
11903
+ <xsl:call-template name="insert_basic_link">
11904
+ <xsl:with-param name="element">
11905
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11906
+ <xsl:if test="normalize-space(@citeas) = ''">
11907
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11908
+ </xsl:if>
11909
+ <fo:inline xsl:use-attribute-sets="origin-style">
11910
+ <xsl:apply-templates/>
11911
+ </fo:inline>
11912
+ </fo:basic-link>
11913
+ </xsl:with-param>
11914
+ </xsl:call-template>
11470
11915
  </xsl:template>
11471
11916
 
11472
11917
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -11518,6 +11963,8 @@
11518
11963
  <fo:block-container margin-left="0mm">
11519
11964
  <fo:block-container xsl:use-attribute-sets="quote-style">
11520
11965
 
11966
+ <xsl:call-template name="refine_quote-style"/>
11967
+
11521
11968
  <fo:block-container margin-left="0mm" margin-right="0mm">
11522
11969
  <fo:block role="BlockQuote">
11523
11970
  <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
@@ -11540,9 +11987,13 @@
11540
11987
  <xsl:if test="../*[local-name() = 'author']">
11541
11988
  <xsl:text>, </xsl:text>
11542
11989
  </xsl:if>
11543
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11544
- <xsl:apply-templates/>
11545
- </fo:basic-link>
11990
+ <xsl:call-template name="insert_basic_link">
11991
+ <xsl:with-param name="element">
11992
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
11993
+ <xsl:apply-templates/>
11994
+ </fo:basic-link>
11995
+ </xsl:with-param>
11996
+ </xsl:call-template>
11546
11997
  </xsl:template>
11547
11998
 
11548
11999
  <xsl:template match="*[local-name() = 'author']">
@@ -11588,37 +12039,33 @@
11588
12039
 
11589
12040
  </xsl:if>
11590
12041
 
11591
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
11592
- <xsl:variable name="text" select="normalize-space()"/>
12042
+ <xsl:call-template name="refine_eref-style"/>
11593
12043
 
11594
- <fo:basic-link fox:alt-text="{@citeas}">
11595
- <xsl:if test="normalize-space(@citeas) = ''">
11596
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
11597
- </xsl:if>
11598
- <xsl:if test="@type = 'inline'">
12044
+ <xsl:call-template name="insert_basic_link">
12045
+ <xsl:with-param name="element">
12046
+ <fo:basic-link fox:alt-text="{@citeas}">
12047
+ <xsl:if test="normalize-space(@citeas) = ''">
12048
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
12049
+ </xsl:if>
12050
+ <xsl:if test="@type = 'inline'">
11599
12051
 
11600
- <xsl:attribute name="color">blue</xsl:attribute>
11601
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
12052
+ <xsl:call-template name="refine_basic_link_style"/>
11602
12053
 
11603
- <xsl:if test="parent::*[local-name() = 'title']">
11604
- <xsl:attribute name="color">inherit</xsl:attribute>
11605
- <xsl:attribute name="text-decoration">inherit</xsl:attribute>
11606
- <xsl:attribute name="font-weight">normal</xsl:attribute>
11607
12054
  </xsl:if>
11608
12055
 
11609
- </xsl:if>
11610
-
11611
- <xsl:choose>
11612
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
11613
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
11614
- </xsl:when>
11615
- <xsl:otherwise>
11616
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
11617
- </xsl:otherwise>
11618
- </xsl:choose>
12056
+ <xsl:choose>
12057
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
12058
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
12059
+ </xsl:when>
12060
+ <xsl:otherwise>
12061
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
12062
+ </xsl:otherwise>
12063
+ </xsl:choose>
11619
12064
 
11620
- <xsl:apply-templates/>
11621
- </fo:basic-link>
12065
+ <xsl:apply-templates/>
12066
+ </fo:basic-link>
12067
+ </xsl:with-param>
12068
+ </xsl:call-template>
11622
12069
 
11623
12070
  </fo:inline>
11624
12071
  </xsl:when>
@@ -11636,6 +12083,20 @@
11636
12083
  </xsl:otherwise>
11637
12084
  </xsl:choose>
11638
12085
  </xsl:template>
12086
+
12087
+ <xsl:template name="refine_basic_link_style">
12088
+
12089
+ <xsl:attribute name="color">blue</xsl:attribute>
12090
+ <xsl:if test="not(parent::*[local-name() = 'title'])">
12091
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
12092
+ </xsl:if>
12093
+ <xsl:if test="parent::*[local-name() = 'title']">
12094
+ <xsl:attribute name="color">inherit</xsl:attribute>
12095
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
12096
+ </xsl:if>
12097
+
12098
+ </xsl:template> <!-- refine_basic_link_style -->
12099
+
11639
12100
  <!-- ====== -->
11640
12101
  <!-- END eref -->
11641
12102
  <!-- ====== -->
@@ -11778,11 +12239,17 @@
11778
12239
  <fo:block>
11779
12240
  <xsl:call-template name="setId"/>
11780
12241
 
12242
+ <xsl:call-template name="sections_element_style"/>
12243
+
11781
12244
  <xsl:apply-templates/>
11782
12245
  </fo:block>
11783
12246
 
11784
12247
  </xsl:template>
11785
12248
 
12249
+ <xsl:template name="sections_element_style">
12250
+
12251
+ </xsl:template> <!-- sections_element_style -->
12252
+
11786
12253
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
11787
12254
  <fo:block break-after="page"/>
11788
12255
  <fo:block>
@@ -11797,12 +12264,18 @@
11797
12264
 
11798
12265
  <xsl:call-template name="setBlockSpanAll"/>
11799
12266
 
11800
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
12267
+ <xsl:call-template name="refine_clause_style"/>
11801
12268
 
11802
12269
  <xsl:apply-templates/>
11803
12270
  </fo:block>
11804
12271
  </xsl:template>
11805
12272
 
12273
+ <xsl:template name="refine_clause_style">
12274
+
12275
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
12276
+
12277
+ </xsl:template> <!-- refine_clause_style -->
12278
+
11806
12279
  <xsl:template match="*[local-name() = 'definitions']">
11807
12280
  <fo:block id="{@id}">
11808
12281
  <xsl:apply-templates/>
@@ -11815,10 +12288,16 @@
11815
12288
 
11816
12289
  <xsl:call-template name="setBlockSpanAll"/>
11817
12290
 
12291
+ <xsl:call-template name="refine_annex_style"/>
12292
+
11818
12293
  </fo:block>
11819
12294
  <xsl:apply-templates/>
11820
12295
  </xsl:template>
11821
12296
 
12297
+ <xsl:template name="refine_annex_style">
12298
+
12299
+ </xsl:template>
12300
+
11822
12301
  <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11823
12302
  <!-- comment 2019-11-29 -->
11824
12303
  <!-- <fo:block font-weight="bold">Review:</fo:block>
@@ -11857,7 +12336,10 @@
11857
12336
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
11858
12337
 
11859
12338
  <xsl:template name="setULLabel">
11860
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
12339
+ <xsl:variable name="list_level__">
12340
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
12341
+ </xsl:variable>
12342
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
11861
12343
  <xsl:variable name="list_level">
11862
12344
  <xsl:choose>
11863
12345
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -11982,7 +12464,7 @@
11982
12464
  </xsl:choose>
11983
12465
  </xsl:attribute>
11984
12466
 
11985
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
12467
+ <xsl:call-template name="refine_list_container_style"/>
11986
12468
 
11987
12469
  <fo:block-container margin-left="0mm">
11988
12470
  <fo:block>
@@ -11992,13 +12474,21 @@
11992
12474
  </fo:block-container>
11993
12475
  </xsl:when>
11994
12476
  <xsl:otherwise>
11995
- <fo:block>
11996
- <xsl:apply-templates select="." mode="list"/>
11997
- </fo:block>
12477
+
12478
+ <fo:block>
12479
+ <xsl:apply-templates select="." mode="list"/>
12480
+ </fo:block>
12481
+
11998
12482
  </xsl:otherwise>
11999
12483
  </xsl:choose>
12000
12484
  </xsl:template>
12001
12485
 
12486
+ <xsl:template name="refine_list_container_style">
12487
+
12488
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
12489
+
12490
+ </xsl:template> <!-- refine_list_container_style -->
12491
+
12002
12492
  <xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
12003
12493
 
12004
12494
  <xsl:apply-templates select="*[local-name() = 'name']">
@@ -12009,7 +12499,7 @@
12009
12499
 
12010
12500
  <xsl:variable name="provisional_distance_between_starts_">
12011
12501
  <attributes xsl:use-attribute-sets="list-style">
12012
-
12502
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
12013
12503
  </attributes>
12014
12504
  </xsl:variable>
12015
12505
  <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
@@ -12045,6 +12535,8 @@
12045
12535
  <addon><xsl:value-of select="$addon"/></addon> -->
12046
12536
  </xsl:if>
12047
12537
 
12538
+ <xsl:call-template name="refine_list-style"/>
12539
+
12048
12540
  <xsl:if test="*[local-name() = 'name']">
12049
12541
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
12050
12542
  </xsl:if>
@@ -12057,6 +12549,10 @@
12057
12549
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
12058
12550
  </xsl:template>
12059
12551
 
12552
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
12553
+
12554
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
12555
+
12060
12556
  <xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
12061
12557
  <xsl:param name="process">false</xsl:param>
12062
12558
  <xsl:if test="$process = 'true'">
@@ -12070,20 +12566,27 @@
12070
12566
  <fo:list-item xsl:use-attribute-sets="list-item-style">
12071
12567
  <xsl:copy-of select="@id"/>
12072
12568
 
12569
+ <xsl:call-template name="refine_list-item-style"/>
12570
+
12073
12571
  <fo:list-item-label end-indent="label-end()">
12074
12572
  <fo:block xsl:use-attribute-sets="list-item-label-style">
12075
12573
 
12574
+ <xsl:call-template name="refine_list-item-label-style"/>
12575
+
12076
12576
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
12077
12577
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
12078
12578
  <xsl:call-template name="append_add-style"/>
12079
12579
  </xsl:if>
12080
12580
 
12081
- <xsl:call-template name="getListItemFormat"/>
12581
+ <xsl:call-template name="getListItemFormat"/>
12582
+
12082
12583
  </fo:block>
12083
12584
  </fo:list-item-label>
12084
12585
  <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
12085
12586
  <fo:block>
12086
12587
 
12588
+ <xsl:call-template name="refine_list-item-body-style"/>
12589
+
12087
12590
  <xsl:apply-templates/>
12088
12591
 
12089
12592
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
@@ -12401,6 +12904,7 @@
12401
12904
 
12402
12905
  <fo:block id="{@id}">
12403
12906
  <xsl:apply-templates/>
12907
+
12404
12908
  </fo:block>
12405
12909
  </xsl:template>
12406
12910
 
@@ -12420,6 +12924,7 @@
12420
12924
 
12421
12925
  <fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
12422
12926
  <xsl:apply-templates/>
12927
+
12423
12928
  </fo:block>
12424
12929
 
12425
12930
  </xsl:template> <!-- references -->
@@ -12676,24 +13181,32 @@
12676
13181
  <xsl:for-each select="*[local-name() = 'tab']">
12677
13182
  <xsl:variable name="current_id" select="generate-id()"/>
12678
13183
  <fo:table-cell>
12679
- <fo:block>
12680
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12681
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12682
- <xsl:choose>
12683
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12684
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
12685
- </xsl:choose>
12686
- </xsl:for-each>
12687
- </fo:basic-link>
13184
+ <fo:block line-height-shift-adjustment="disregard-shifts">
13185
+ <xsl:call-template name="insert_basic_link">
13186
+ <xsl:with-param name="element">
13187
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
13188
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
13189
+ <xsl:choose>
13190
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13191
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
13192
+ </xsl:choose>
13193
+ </xsl:for-each>
13194
+ </fo:basic-link>
13195
+ </xsl:with-param>
13196
+ </xsl:call-template>
12688
13197
  </fo:block>
12689
13198
  </fo:table-cell>
12690
13199
  </xsl:for-each>
12691
13200
  <!-- last column - for page numbers -->
12692
13201
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
12693
13202
  <fo:block>
12694
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12695
- <fo:page-number-citation ref-id="{$target}"/>
12696
- </fo:basic-link>
13203
+ <xsl:call-template name="insert_basic_link">
13204
+ <xsl:with-param name="element">
13205
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
13206
+ <fo:page-number-citation ref-id="{$target}"/>
13207
+ </fo:basic-link>
13208
+ </xsl:with-param>
13209
+ </xsl:call-template>
12697
13210
  </fo:block>
12698
13211
  </fo:table-cell>
12699
13212
  </xsl:template>
@@ -12735,6 +13248,27 @@
12735
13248
  <!-- End Table of Contents (ToC) processing -->
12736
13249
  <!-- =================== -->
12737
13250
 
13251
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
13252
+ <xsl:template name="insert_basic_link">
13253
+ <xsl:param name="element"/>
13254
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
13255
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
13256
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
13257
+ <xsl:choose>
13258
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
13259
+ <xsl:copy-of select="$element_node"/>
13260
+ </xsl:when>
13261
+ <xsl:otherwise>
13262
+ <fo:inline>
13263
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
13264
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
13265
+ </xsl:for-each>
13266
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
13267
+ </fo:inline>
13268
+ </xsl:otherwise>
13269
+ </xsl:choose>
13270
+ </xsl:template>
13271
+
12738
13272
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
12739
13273
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
12740
13274
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -12967,6 +13501,9 @@
12967
13501
  </xsl:copy>
12968
13502
  </xsl:template>
12969
13503
 
13504
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
13505
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
13506
+
12970
13507
  <xsl:template name="add_id">
12971
13508
  <xsl:if test="not(@id)">
12972
13509
  <!-- add @id - first element with @id plus '_element_name' -->
@@ -13251,6 +13788,14 @@
13251
13788
  <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
13252
13789
  <xsl:variable name="p_fn_">
13253
13790
  <xsl:call-template name="get_fn_list"/>
13791
+ <!-- <xsl:choose>
13792
+ <xsl:when test="$namespace = 'jis'">
13793
+ <xsl:call-template name="get_fn_list_for_element"/>
13794
+ </xsl:when>
13795
+ <xsl:otherwise>
13796
+ <xsl:call-template name="get_fn_list"/>
13797
+ </xsl:otherwise>
13798
+ </xsl:choose> -->
13254
13799
  </xsl:variable>
13255
13800
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
13256
13801
  <xsl:variable name="gen_id" select="generate-id(.)"/>
@@ -13265,8 +13810,14 @@
13265
13810
  <xsl:attribute name="current_fn_number">
13266
13811
  <xsl:value-of select="$current_fn_number"/>
13267
13812
  </xsl:attribute>
13813
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
13268
13814
  <xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
13269
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
13815
+
13816
+ <xsl:value-of select="$skip_footnote_body_"/>
13817
+
13818
+ </xsl:attribute>
13819
+ <xsl:attribute name="ref_id">
13820
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
13270
13821
  </xsl:attribute>
13271
13822
  <xsl:apply-templates select="node()" mode="linear_xml"/>
13272
13823
  </xsl:copy>