metanorma-un 0.10.7 → 0.10.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07114d1e32b69ac6b36edb86273058d1e9e7cc66962ca18d710be70c51e8e3f8
4
- data.tar.gz: e48bfe9b62640242b24a609bb8ee7e858e01c9fbcb700647d7597565a8168c26
3
+ metadata.gz: c7c45854aea4c72619dbb87420deb144e2074c879cc7ade99cf19f2c55d3194f
4
+ data.tar.gz: c20d5555a7ed1cd05878113402842e95281f881807904bd6cdd7fc8642e5f21a
5
5
  SHA512:
6
- metadata.gz: afb9c24220d815c2bfddceeb0484768954f120465177d24d6c9abaeac1f0fd155359910c2b4de8b3a56374783f463aa2452504ff1484aebba81a8814160e46c4
7
- data.tar.gz: 31b47dd6d2c2d929eb5c9be33e54d89240ea6ce24cea1a4ac627b9aa16f3284c9971a40796282c079cf03998749837ed5bc5ab39d6a175cc567c16b260b6b1d2
6
+ metadata.gz: 4dd0dd4b0b94377c146c5994899dba8da5ea5dd1dd9247d10567c601320b38535917f63ab9cfecdaba3d3170bb568125297d36ee3714fc2f1d032150639b65b3
7
+ data.tar.gz: e232807d3106fff96e09a44bb5ed661637ccfbe180d86ee18dfa07e45fbf1d1252a27b1a50a489740389ce257d6b1642fccc49cea13756c77ff086268427854e
@@ -31,6 +31,11 @@ module IsoDoc
31
31
 
32
32
  false
33
33
  end
34
+
35
+ def convert_i18n_init1(docxml)
36
+ super
37
+ docxml.xpath(ns("//bibdata/language")).size > 1 and @lang = "en"
38
+ end
34
39
  end
35
40
  end
36
41
  end
@@ -6,7 +6,6 @@
6
6
  {% endif %}
7
7
 
8
8
  <nav>
9
- <h1 id="content">{{ labels["table_of_contents"] }}</h1>
10
9
  <div id="toc"></div>
11
10
 
12
11
  </nav>
@@ -8,8 +8,3 @@
8
8
  <div id="preface_container"/>
9
9
  {% endif %}
10
10
 
11
- {% if toc %}
12
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">{{ labels["table_of_contents"] }}</span></p>
13
-
14
- WORDTOC
15
- {% endif %}
@@ -68,12 +68,7 @@ module IsoDoc
68
68
  def make_body3(body, docxml)
69
69
  body.div class: "main-section" do |div3|
70
70
  boilerplate docxml, div3
71
- preface_block docxml, div3
72
- abstract docxml, div3
73
- foreword docxml, div3
74
- introduction docxml, div3
75
- preface docxml, div3
76
- acknowledgements docxml, div3
71
+ front docxml, div3
77
72
  middle docxml, div3
78
73
  footnotes div3
79
74
  comments div3
@@ -87,24 +82,22 @@ module IsoDoc
87
82
  bibliography isoxml, out
88
83
  end
89
84
 
90
- def introduction(isoxml, out)
91
- f = isoxml.at(ns("//introduction")) || return
85
+ def introduction(clause, out)
92
86
  page_break(out)
93
- out.div class: "Section3", id: f["id"] do |div|
94
- clause_name(f, f.at(ns("./title")), div, { class: "IntroTitle" })
95
- f.elements.each do |e|
87
+ out.div class: "Section3", id: clause["id"] do |div|
88
+ clause_name(clause, clause.at(ns("./title")), div, { class: "IntroTitle" })
89
+ clause.elements.each do |e|
96
90
  parse(e, div) unless e.name == "title"
97
91
  end
98
92
  end
99
93
  end
100
94
 
101
- def foreword(isoxml, out)
102
- f = isoxml.at(ns("//foreword")) || return
95
+ def foreword(clause, out)
103
96
  page_break(out)
104
- out.div **attr_code(id: f["id"]) do |s|
105
- clause_name(f, f.at(ns("./title")) || @i18n.foreword, s,
97
+ out.div **attr_code(id: clause["id"]) do |s|
98
+ clause_name(clause, clause.at(ns("./title")) || @i18n.foreword, s,
106
99
  class: "ForewordTitle")
107
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
100
+ clause.elements.each { |e| parse(e, s) unless e.name == "title" }
108
101
  end
109
102
  end
110
103
 
@@ -39,6 +39,11 @@ module IsoDoc
39
39
  prefix_name(elem, "<br/>", lbl, "title")
40
40
  end
41
41
 
42
+ def toc_title(docxml)
43
+ @toc or return
44
+ super
45
+ end
46
+
42
47
  include Init
43
48
  end
44
49
  end
@@ -1442,6 +1442,7 @@
1442
1442
  </xsl:attribute-set>
1443
1443
 
1444
1444
  <xsl:attribute-set name="xref-style">
1445
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1445
1446
 
1446
1447
  </xsl:attribute-set>
1447
1448
 
@@ -3425,9 +3426,13 @@
3425
3426
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3426
3427
  </xsl:if>
3427
3428
 
3428
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3429
- <xsl:value-of select="$current_fn_number_text"/>
3430
- </fo:basic-link>
3429
+ <xsl:call-template name="insert_basic_link">
3430
+ <xsl:with-param name="element">
3431
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3432
+ <xsl:value-of select="$current_fn_number_text"/>
3433
+ </fo:basic-link>
3434
+ </xsl:with-param>
3435
+ </xsl:call-template>
3431
3436
  </fo:inline>
3432
3437
  </xsl:variable>
3433
3438
 
@@ -3760,8 +3765,10 @@
3760
3765
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3761
3766
  <xsl:text> </xsl:text>
3762
3767
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3763
- <xsl:text/>
3764
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3768
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
3769
+ <xsl:text> </xsl:text>
3770
+ </xsl:if>
3771
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3765
3772
  </fo:block>
3766
3773
 
3767
3774
  </xsl:when> <!-- END: only one component -->
@@ -4248,8 +4255,18 @@
4248
4255
  </xsl:if>
4249
4256
  </xsl:template>
4250
4257
 
4251
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4252
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4258
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4259
+ <xsl:variable name="is_inline_element_after_where">
4260
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4261
+ </xsl:variable>
4262
+ <xsl:choose>
4263
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4264
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4265
+ </xsl:when>
4266
+ <xsl:otherwise>
4267
+ <xsl:apply-templates select="."/>
4268
+ </xsl:otherwise>
4269
+ </xsl:choose>
4253
4270
  </xsl:template>
4254
4271
 
4255
4272
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -5677,6 +5694,79 @@
5677
5694
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5678
5695
  </xsl:template>
5679
5696
 
5697
+ <!-- special case for:
5698
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5699
+ <mstyle displaystyle="true">
5700
+ <msup>
5701
+ <mi color="#00000000">C</mi>
5702
+ <mtext>R</mtext>
5703
+ </msup>
5704
+ <msubsup>
5705
+ <mtext>C</mtext>
5706
+ <mi>n</mi>
5707
+ <mi>k</mi>
5708
+ </msubsup>
5709
+ </mstyle>
5710
+ </math>
5711
+ -->
5712
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
5713
+ <xsl:copy>
5714
+ <xsl:copy-of select="@*"/>
5715
+ <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"/>
5716
+ <xsl:if test="string-length($next_mtext) != ''">
5717
+ <xsl:attribute name="color">#00000000</xsl:attribute>
5718
+ </xsl:if>
5719
+ <xsl:apply-templates/>
5720
+ <xsl:value-of select="$next_mtext"/>
5721
+ </xsl:copy>
5722
+ </xsl:template>
5723
+
5724
+ <!-- special case for:
5725
+ <msup>
5726
+ <mtext/>
5727
+ <mn>1</mn>
5728
+ </msup>
5729
+ convert to (add mspace after mtext and enclose them into mrow):
5730
+ <msup>
5731
+ <mrow>
5732
+ <mtext/>
5733
+ <mspace height="1.47ex"/>
5734
+ </mrow>
5735
+ <mn>1</mn>
5736
+ </msup>
5737
+ -->
5738
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
5739
+ <mathml:mrow>
5740
+ <xsl:copy-of select="."/>
5741
+ <mathml:mspace height="1.47ex"/>
5742
+ </mathml:mrow>
5743
+ </xsl:template>
5744
+
5745
+ <!-- add space around vertical line -->
5746
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
5747
+ <xsl:copy>
5748
+ <xsl:apply-templates select="@*" mode="mathml"/>
5749
+ <xsl:if test="not(@lspace)">
5750
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
5751
+ </xsl:if>
5752
+ <xsl:if test="not(@rspace)">
5753
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
5754
+ </xsl:if>
5755
+ <xsl:apply-templates mode="mathml"/>
5756
+ </xsl:copy>
5757
+ </xsl:template>
5758
+
5759
+ <!-- decrease fontsize for 'Circled Times' char -->
5760
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
5761
+ <xsl:copy>
5762
+ <xsl:apply-templates select="@*" mode="mathml"/>
5763
+ <xsl:if test="not(@fontsize)">
5764
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
5765
+ </xsl:if>
5766
+ <xsl:apply-templates mode="mathml"/>
5767
+ </xsl:copy>
5768
+ </xsl:template>
5769
+
5680
5770
  <!-- Examples:
5681
5771
  <stem type="AsciiMath">x = 1</stem>
5682
5772
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5734,19 +5824,23 @@
5734
5824
  <xsl:apply-templates/>
5735
5825
  </xsl:when>
5736
5826
  <xsl:otherwise>
5737
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5738
- <xsl:choose>
5739
- <xsl:when test="normalize-space(.) = ''">
5740
- <xsl:call-template name="add-zero-spaces-link-java">
5741
- <xsl:with-param name="text" select="$target_text"/>
5742
- </xsl:call-template>
5743
- </xsl:when>
5744
- <xsl:otherwise>
5745
- <!-- output text from <link>text</link> -->
5746
- <xsl:apply-templates/>
5747
- </xsl:otherwise>
5748
- </xsl:choose>
5749
- </fo:basic-link>
5827
+ <xsl:call-template name="insert_basic_link">
5828
+ <xsl:with-param name="element">
5829
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5830
+ <xsl:choose>
5831
+ <xsl:when test="normalize-space(.) = ''">
5832
+ <xsl:call-template name="add-zero-spaces-link-java">
5833
+ <xsl:with-param name="text" select="$target_text"/>
5834
+ </xsl:call-template>
5835
+ </xsl:when>
5836
+ <xsl:otherwise>
5837
+ <!-- output text from <link>text</link> -->
5838
+ <xsl:apply-templates/>
5839
+ </xsl:otherwise>
5840
+ </xsl:choose>
5841
+ </fo:basic-link>
5842
+ </xsl:with-param>
5843
+ </xsl:call-template>
5750
5844
  </xsl:otherwise>
5751
5845
  </xsl:choose>
5752
5846
  </fo:inline>
@@ -5809,12 +5903,16 @@
5809
5903
  </xsl:template>
5810
5904
 
5811
5905
  <xsl:template match="*[local-name() = 'xref']">
5812
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5813
- <xsl:if test="parent::*[local-name() = 'add']">
5814
- <xsl:call-template name="append_add-style"/>
5815
- </xsl:if>
5816
- <xsl:apply-templates/>
5817
- </fo:basic-link>
5906
+ <xsl:call-template name="insert_basic_link">
5907
+ <xsl:with-param name="element">
5908
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5909
+ <xsl:if test="parent::*[local-name() = 'add']">
5910
+ <xsl:call-template name="append_add-style"/>
5911
+ </xsl:if>
5912
+ <xsl:apply-templates/>
5913
+ </fo:basic-link>
5914
+ </xsl:with-param>
5915
+ </xsl:call-template>
5818
5916
  </xsl:template>
5819
5917
 
5820
5918
  <!-- ====== -->
@@ -6213,7 +6311,7 @@
6213
6311
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6214
6312
  </xsl:when>
6215
6313
  <xsl:when test="not(starts-with(@src, 'data:'))">
6216
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6314
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6217
6315
  </xsl:when>
6218
6316
  <xsl:otherwise>
6219
6317
  <xsl:value-of select="@src"/>
@@ -6235,7 +6333,7 @@
6235
6333
  </xsl:when>
6236
6334
  <xsl:when test="not(starts-with(@src, 'data:'))">
6237
6335
  <xsl:variable name="src">
6238
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6336
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6239
6337
  </xsl:variable>
6240
6338
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6241
6339
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6621,15 +6719,19 @@
6621
6719
  <xsl:param name="dest"/>
6622
6720
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6623
6721
  <fo:block font-size="1pt">
6624
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6625
- <fo:inline-container inline-progression-dimension="100%">
6626
- <fo:block-container height="{$height - 1}px" width="100%">
6627
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6628
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6629
- </xsl:if> -->
6630
- <fo:block> </fo:block></fo:block-container>
6631
- </fo:inline-container>
6632
- </fo:basic-link>
6722
+ <xsl:call-template name="insert_basic_link">
6723
+ <xsl:with-param name="element">
6724
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6725
+ <fo:inline-container inline-progression-dimension="100%">
6726
+ <fo:block-container height="{$height - 1}px" width="100%">
6727
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
6728
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
6729
+ </xsl:if> -->
6730
+ <fo:block> </fo:block></fo:block-container>
6731
+ </fo:inline-container>
6732
+ </fo:basic-link>
6733
+ </xsl:with-param>
6734
+ </xsl:call-template>
6633
6735
  </fo:block>
6634
6736
  </fo:block-container>
6635
6737
  </xsl:template>
@@ -8178,14 +8280,18 @@
8178
8280
  </xsl:template>
8179
8281
 
8180
8282
  <xsl:template match="*[local-name() = 'origin']">
8181
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8182
- <xsl:if test="normalize-space(@citeas) = ''">
8183
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8184
- </xsl:if>
8185
- <fo:inline xsl:use-attribute-sets="origin-style">
8186
- <xsl:apply-templates/>
8187
- </fo:inline>
8188
- </fo:basic-link>
8283
+ <xsl:call-template name="insert_basic_link">
8284
+ <xsl:with-param name="element">
8285
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8286
+ <xsl:if test="normalize-space(@citeas) = ''">
8287
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8288
+ </xsl:if>
8289
+ <fo:inline xsl:use-attribute-sets="origin-style">
8290
+ <xsl:apply-templates/>
8291
+ </fo:inline>
8292
+ </fo:basic-link>
8293
+ </xsl:with-param>
8294
+ </xsl:call-template>
8189
8295
  </xsl:template>
8190
8296
 
8191
8297
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8259,9 +8365,13 @@
8259
8365
  <xsl:if test="../*[local-name() = 'author']">
8260
8366
  <xsl:text>, </xsl:text>
8261
8367
  </xsl:if>
8262
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8263
- <xsl:apply-templates/>
8264
- </fo:basic-link>
8368
+ <xsl:call-template name="insert_basic_link">
8369
+ <xsl:with-param name="element">
8370
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8371
+ <xsl:apply-templates/>
8372
+ </fo:basic-link>
8373
+ </xsl:with-param>
8374
+ </xsl:call-template>
8265
8375
  </xsl:template>
8266
8376
 
8267
8377
  <xsl:template match="*[local-name() = 'author']">
@@ -8310,27 +8420,31 @@
8310
8420
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8311
8421
  <xsl:variable name="text" select="normalize-space()"/>
8312
8422
 
8313
- <fo:basic-link fox:alt-text="{@citeas}">
8314
- <xsl:if test="normalize-space(@citeas) = ''">
8315
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8316
- </xsl:if>
8317
- <xsl:if test="@type = 'inline'">
8423
+ <xsl:call-template name="insert_basic_link">
8424
+ <xsl:with-param name="element">
8425
+ <fo:basic-link fox:alt-text="{@citeas}">
8426
+ <xsl:if test="normalize-space(@citeas) = ''">
8427
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8428
+ </xsl:if>
8429
+ <xsl:if test="@type = 'inline'">
8318
8430
 
8319
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
8431
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
8320
8432
 
8321
- </xsl:if>
8433
+ </xsl:if>
8322
8434
 
8323
- <xsl:choose>
8324
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8325
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8326
- </xsl:when>
8327
- <xsl:otherwise>
8328
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8329
- </xsl:otherwise>
8330
- </xsl:choose>
8435
+ <xsl:choose>
8436
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8437
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8438
+ </xsl:when>
8439
+ <xsl:otherwise>
8440
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8441
+ </xsl:otherwise>
8442
+ </xsl:choose>
8331
8443
 
8332
- <xsl:apply-templates/>
8333
- </fo:basic-link>
8444
+ <xsl:apply-templates/>
8445
+ </fo:basic-link>
8446
+ </xsl:with-param>
8447
+ </xsl:call-template>
8334
8448
 
8335
8449
  </fo:inline>
8336
8450
  </xsl:when>
@@ -8575,7 +8689,10 @@
8575
8689
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8576
8690
 
8577
8691
  <xsl:template name="setULLabel">
8578
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8692
+ <xsl:variable name="list_level__">
8693
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8694
+ </xsl:variable>
8695
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8579
8696
  <xsl:variable name="list_level">
8580
8697
  <xsl:choose>
8581
8698
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8708,9 +8825,11 @@
8708
8825
  </fo:block-container>
8709
8826
  </xsl:when>
8710
8827
  <xsl:otherwise>
8711
- <fo:block>
8712
- <xsl:apply-templates select="." mode="list"/>
8713
- </fo:block>
8828
+
8829
+ <fo:block>
8830
+ <xsl:apply-templates select="." mode="list"/>
8831
+ </fo:block>
8832
+
8714
8833
  </xsl:otherwise>
8715
8834
  </xsl:choose>
8716
8835
  </xsl:template>
@@ -9377,24 +9496,32 @@
9377
9496
  <xsl:for-each select="*[local-name() = 'tab']">
9378
9497
  <xsl:variable name="current_id" select="generate-id()"/>
9379
9498
  <fo:table-cell>
9380
- <fo:block>
9381
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9382
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9383
- <xsl:choose>
9384
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9385
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9386
- </xsl:choose>
9387
- </xsl:for-each>
9388
- </fo:basic-link>
9499
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9500
+ <xsl:call-template name="insert_basic_link">
9501
+ <xsl:with-param name="element">
9502
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9503
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9504
+ <xsl:choose>
9505
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9506
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9507
+ </xsl:choose>
9508
+ </xsl:for-each>
9509
+ </fo:basic-link>
9510
+ </xsl:with-param>
9511
+ </xsl:call-template>
9389
9512
  </fo:block>
9390
9513
  </fo:table-cell>
9391
9514
  </xsl:for-each>
9392
9515
  <!-- last column - for page numbers -->
9393
9516
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9394
9517
  <fo:block>
9395
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9396
- <fo:page-number-citation ref-id="{$target}"/>
9397
- </fo:basic-link>
9518
+ <xsl:call-template name="insert_basic_link">
9519
+ <xsl:with-param name="element">
9520
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9521
+ <fo:page-number-citation ref-id="{$target}"/>
9522
+ </fo:basic-link>
9523
+ </xsl:with-param>
9524
+ </xsl:call-template>
9398
9525
  </fo:block>
9399
9526
  </fo:table-cell>
9400
9527
  </xsl:template>
@@ -9436,6 +9563,27 @@
9436
9563
  <!-- End Table of Contents (ToC) processing -->
9437
9564
  <!-- =================== -->
9438
9565
 
9566
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9567
+ <xsl:template name="insert_basic_link">
9568
+ <xsl:param name="element"/>
9569
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9570
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9571
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9572
+ <xsl:choose>
9573
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9574
+ <xsl:copy-of select="$element_node"/>
9575
+ </xsl:when>
9576
+ <xsl:otherwise>
9577
+ <fo:inline>
9578
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9579
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9580
+ </xsl:for-each>
9581
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9582
+ </fo:inline>
9583
+ </xsl:otherwise>
9584
+ </xsl:choose>
9585
+ </xsl:template>
9586
+
9439
9587
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9440
9588
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9441
9589
  <fo:inline padding-right="5mm"> </fo:inline>