metanorma-itu 2.2.9 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 735608fd24b2767257388a61ff50f39bf4cd7b96fc51c068cccf49e5172cadb9
4
- data.tar.gz: 2b3219c15dd78b22c78c167fd0511ae9a0745311393000399b0aab346cf65a34
3
+ metadata.gz: 1af172c1828172865a7029d57fd81240dff5b4440bf52f932dd7f93de4f5c301
4
+ data.tar.gz: 07d819996e52440f7fc8804b3a055f092102fa708f39f452f6c8d14894901bf6
5
5
  SHA512:
6
- metadata.gz: 68028cb6db40348b7523a315f2ebefaffa62000188118e0e4c901f71e835ba185b5a11b9eb35a8b6243aa92f041ca48945dfde8b7f358316ce9d67d95f2beaf7
7
- data.tar.gz: ea549a061785f953f480fafe89511aa3a92825d84ac601dc9868908b36735717da5c42dca6850991e12d6daa06fbe3c188eac31f7d027506275fabb364db70ec
6
+ metadata.gz: f6a92e2a27586126bc38a19210844fac81e37f7c44474bab78eee01babe53499be3759552870f65adec068dc7d2dcdc596b5404fd65b6e0d76c98cc65bf3b268
7
+ data.tar.gz: e8058feafc43953d36a3c6324eb8cdb348a08c723df5614c076b0c112e1bfe51c87261526f461a189c729d40c6d7e579ec147df3245a444c4d59d27b2f2a4968
@@ -11,20 +11,28 @@ module IsoDoc
11
11
  FRONT_CLAUSE = "//*[parent::preface]" \
12
12
  "[not(local-name() = 'abstract')]".freeze
13
13
 
14
- def preface(isoxml, out)
15
- isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
16
- next unless is_clause?(c.name)
17
-
18
- title = c&.at(ns("./title"))
19
- out.div **attr_code(clause_attrs(c)) do |s|
20
- clause_name(c, title, s, class: "IntroTitle")
21
- c.elements.reject { |c1| c1.name == "title" }.each do |c1|
22
- parse(c1, s)
23
- end
14
+ def introduction(clause, out)
15
+ title = clause.at(ns("./title"))
16
+ out.div **attr_code(clause_attrs(clause)) do |s|
17
+ clause_name(clause, title, s, class: "IntroTitle")
18
+ clause.elements.reject { |c1| c1.name == "title" }.each do |c1|
19
+ parse(c1, s)
24
20
  end
25
21
  end
26
22
  end
27
23
 
24
+ def foreword(clause, out)
25
+ introduction(clause, out)
26
+ end
27
+
28
+ def acknowledgements(clause, out)
29
+ introduction(clause, out)
30
+ end
31
+
32
+ def preface_normal(clause, out)
33
+ introduction(clause, out)
34
+ end
35
+
28
36
  def clausedelim
29
37
  ""
30
38
  end
@@ -53,7 +61,7 @@ module IsoDoc
53
61
  end
54
62
 
55
63
  def annex_name(annex, name, div)
56
- #preceding_floating_titles(name, div)
64
+ # preceding_floating_titles(name, div)
57
65
  r_a = @meta.get[:doctype_original] == "recommendation-annex"
58
66
  div.h1 class: r_a ? "RecommendationAnnex" : "Annex" do |t|
59
67
  name&.children&.each { |c2| parse(c2, t) }
@@ -5,7 +5,6 @@
5
5
 
6
6
 
7
7
  <nav>
8
- <h1 id="content">{{ labels["table_of_contents"]}}</h1>
9
8
  <div id="toc"></div>
10
9
 
11
10
  </nav>
@@ -166,19 +166,4 @@ style='mso-ansi-language:EN-US'><o:p>&#xa0;</o:p></span></span></p>
166
166
  <div id="boilerplate-license-destination"/>
167
167
  <div id="boilerplate-copyright-destination"/>
168
168
 
169
- {% if doctype != "Resolution" %}
170
- <b style='mso-bidi-font-weight:normal'><span lang="EN-US" style='font-size:12.0pt;
171
- mso-bidi-font-size:10.0pt;font-family:"Times New Roman",serif;mso-fareast-font-family:
172
- "Times New Roman";mso-ansi-language:EN-US;mso-fareast-language:EN-US;
173
- mso-bidi-language:AR-SA'><br clear="all" style='page-break-before:always'/>
174
- </span></b>
175
-
176
- <p class="MsoNormal" align="center" style='text-align:center'>
177
- <b>{{ labels["table_of_contents"] }}</b></p>
178
- <p class="MsoNormal" style='tab-stops:right 17.0cm'><span style='mso-tab-count:1'/>
179
- <b>{{ labels["page"] }}</b></p>
180
-
181
- WORDTOC
182
-
183
- {% endif %}
184
169
  {% endif %}
@@ -60,9 +60,7 @@ module IsoDoc
60
60
  def make_body3(body, docxml)
61
61
  body.div **{ class: "main-section" } do |div3|
62
62
  boilerplate docxml, div3
63
- preface_block docxml, div3
64
- abstract docxml, div3
65
- preface docxml, div3
63
+ front docxml, div3
66
64
  middle docxml, div3
67
65
  footnotes div3
68
66
  comments div3
@@ -1644,19 +1644,23 @@
1644
1644
  <xsl:variable name="bibitemid" select="../itu:termsource/itu:origin/@bibitemid"/>
1645
1645
  <xsl:variable name="origin_text" select="normalize-space(../itu:termsource/itu:origin/text())"/>
1646
1646
 
1647
- <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
1648
- <xsl:choose>
1649
- <xsl:when test="$origin_text != ''">
1650
- <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
1651
- </xsl:when>
1652
- <xsl:when test="contains($citeas, '[')">
1653
- <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1654
- </xsl:when>
1655
- <xsl:otherwise>
1656
- <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1657
- </xsl:otherwise>
1658
- </xsl:choose>
1659
- </fo:basic-link>
1647
+ <xsl:call-template name="insert_basic_link">
1648
+ <xsl:with-param name="element">
1649
+ <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
1650
+ <xsl:choose>
1651
+ <xsl:when test="$origin_text != ''">
1652
+ <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
1653
+ </xsl:when>
1654
+ <xsl:when test="contains($citeas, '[')">
1655
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1656
+ </xsl:when>
1657
+ <xsl:otherwise>
1658
+ <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1659
+ </xsl:otherwise>
1660
+ </xsl:choose>
1661
+ </fo:basic-link>
1662
+ </xsl:with-param>
1663
+ </xsl:call-template>
1660
1664
  </xsl:if>
1661
1665
  <xsl:if test="following-sibling::itu:definition/node()">
1662
1666
  <xsl:text>: </xsl:text>
@@ -2809,6 +2813,7 @@
2809
2813
  </xsl:attribute-set>
2810
2814
 
2811
2815
  <xsl:attribute-set name="xref-style">
2816
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
2812
2817
 
2813
2818
  <xsl:attribute name="color">blue</xsl:attribute>
2814
2819
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -4860,9 +4865,13 @@
4860
4865
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4861
4866
  </xsl:if>
4862
4867
 
4863
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4864
- <xsl:value-of select="$current_fn_number_text"/>
4865
- </fo:basic-link>
4868
+ <xsl:call-template name="insert_basic_link">
4869
+ <xsl:with-param name="element">
4870
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4871
+ <xsl:value-of select="$current_fn_number_text"/>
4872
+ </fo:basic-link>
4873
+ </xsl:with-param>
4874
+ </xsl:call-template>
4866
4875
  </fo:inline>
4867
4876
  </xsl:variable>
4868
4877
 
@@ -5205,8 +5214,10 @@
5205
5214
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5206
5215
  <xsl:text> </xsl:text>
5207
5216
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5208
- <xsl:text/>
5209
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5217
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
5218
+ <xsl:text> </xsl:text>
5219
+ </xsl:if>
5220
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
5210
5221
  </fo:block>
5211
5222
 
5212
5223
  </xsl:when> <!-- END: only one component -->
@@ -5709,8 +5720,18 @@
5709
5720
  </xsl:if>
5710
5721
  </xsl:template>
5711
5722
 
5712
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5713
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5723
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
5724
+ <xsl:variable name="is_inline_element_after_where">
5725
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
5726
+ </xsl:variable>
5727
+ <xsl:choose>
5728
+ <xsl:when test="$is_inline_element_after_where = 'true'">
5729
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5730
+ </xsl:when>
5731
+ <xsl:otherwise>
5732
+ <xsl:apply-templates select="."/>
5733
+ </xsl:otherwise>
5734
+ </xsl:choose>
5714
5735
  </xsl:template>
5715
5736
 
5716
5737
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -7138,6 +7159,79 @@
7138
7159
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
7139
7160
  </xsl:template>
7140
7161
 
7162
+ <!-- special case for:
7163
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7164
+ <mstyle displaystyle="true">
7165
+ <msup>
7166
+ <mi color="#00000000">C</mi>
7167
+ <mtext>R</mtext>
7168
+ </msup>
7169
+ <msubsup>
7170
+ <mtext>C</mtext>
7171
+ <mi>n</mi>
7172
+ <mi>k</mi>
7173
+ </msubsup>
7174
+ </mstyle>
7175
+ </math>
7176
+ -->
7177
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7178
+ <xsl:copy>
7179
+ <xsl:copy-of select="@*"/>
7180
+ <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"/>
7181
+ <xsl:if test="string-length($next_mtext) != ''">
7182
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7183
+ </xsl:if>
7184
+ <xsl:apply-templates/>
7185
+ <xsl:value-of select="$next_mtext"/>
7186
+ </xsl:copy>
7187
+ </xsl:template>
7188
+
7189
+ <!-- special case for:
7190
+ <msup>
7191
+ <mtext/>
7192
+ <mn>1</mn>
7193
+ </msup>
7194
+ convert to (add mspace after mtext and enclose them into mrow):
7195
+ <msup>
7196
+ <mrow>
7197
+ <mtext/>
7198
+ <mspace height="1.47ex"/>
7199
+ </mrow>
7200
+ <mn>1</mn>
7201
+ </msup>
7202
+ -->
7203
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7204
+ <mathml:mrow>
7205
+ <xsl:copy-of select="."/>
7206
+ <mathml:mspace height="1.47ex"/>
7207
+ </mathml:mrow>
7208
+ </xsl:template>
7209
+
7210
+ <!-- add space around vertical line -->
7211
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7212
+ <xsl:copy>
7213
+ <xsl:apply-templates select="@*" mode="mathml"/>
7214
+ <xsl:if test="not(@lspace)">
7215
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7216
+ </xsl:if>
7217
+ <xsl:if test="not(@rspace)">
7218
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7219
+ </xsl:if>
7220
+ <xsl:apply-templates mode="mathml"/>
7221
+ </xsl:copy>
7222
+ </xsl:template>
7223
+
7224
+ <!-- decrease fontsize for 'Circled Times' char -->
7225
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7226
+ <xsl:copy>
7227
+ <xsl:apply-templates select="@*" mode="mathml"/>
7228
+ <xsl:if test="not(@fontsize)">
7229
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7230
+ </xsl:if>
7231
+ <xsl:apply-templates mode="mathml"/>
7232
+ </xsl:copy>
7233
+ </xsl:template>
7234
+
7141
7235
  <!-- Examples:
7142
7236
  <stem type="AsciiMath">x = 1</stem>
7143
7237
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7195,19 +7289,23 @@
7195
7289
  <xsl:apply-templates/>
7196
7290
  </xsl:when>
7197
7291
  <xsl:otherwise>
7198
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7199
- <xsl:choose>
7200
- <xsl:when test="normalize-space(.) = ''">
7201
- <xsl:call-template name="add-zero-spaces-link-java">
7202
- <xsl:with-param name="text" select="$target_text"/>
7203
- </xsl:call-template>
7204
- </xsl:when>
7205
- <xsl:otherwise>
7206
- <!-- output text from <link>text</link> -->
7207
- <xsl:apply-templates/>
7208
- </xsl:otherwise>
7209
- </xsl:choose>
7210
- </fo:basic-link>
7292
+ <xsl:call-template name="insert_basic_link">
7293
+ <xsl:with-param name="element">
7294
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7295
+ <xsl:choose>
7296
+ <xsl:when test="normalize-space(.) = ''">
7297
+ <xsl:call-template name="add-zero-spaces-link-java">
7298
+ <xsl:with-param name="text" select="$target_text"/>
7299
+ </xsl:call-template>
7300
+ </xsl:when>
7301
+ <xsl:otherwise>
7302
+ <!-- output text from <link>text</link> -->
7303
+ <xsl:apply-templates/>
7304
+ </xsl:otherwise>
7305
+ </xsl:choose>
7306
+ </fo:basic-link>
7307
+ </xsl:with-param>
7308
+ </xsl:call-template>
7211
7309
  </xsl:otherwise>
7212
7310
  </xsl:choose>
7213
7311
  </fo:inline>
@@ -7270,12 +7368,16 @@
7270
7368
  </xsl:template>
7271
7369
 
7272
7370
  <xsl:template match="*[local-name() = 'xref']">
7273
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7274
- <xsl:if test="parent::*[local-name() = 'add']">
7275
- <xsl:call-template name="append_add-style"/>
7276
- </xsl:if>
7277
- <xsl:apply-templates/>
7278
- </fo:basic-link>
7371
+ <xsl:call-template name="insert_basic_link">
7372
+ <xsl:with-param name="element">
7373
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7374
+ <xsl:if test="parent::*[local-name() = 'add']">
7375
+ <xsl:call-template name="append_add-style"/>
7376
+ </xsl:if>
7377
+ <xsl:apply-templates/>
7378
+ </fo:basic-link>
7379
+ </xsl:with-param>
7380
+ </xsl:call-template>
7279
7381
  </xsl:template>
7280
7382
 
7281
7383
  <!-- ====== -->
@@ -7664,7 +7766,7 @@
7664
7766
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7665
7767
  </xsl:when>
7666
7768
  <xsl:when test="not(starts-with(@src, 'data:'))">
7667
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7769
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7668
7770
  </xsl:when>
7669
7771
  <xsl:otherwise>
7670
7772
  <xsl:value-of select="@src"/>
@@ -7686,7 +7788,7 @@
7686
7788
  </xsl:when>
7687
7789
  <xsl:when test="not(starts-with(@src, 'data:'))">
7688
7790
  <xsl:variable name="src">
7689
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7791
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7690
7792
  </xsl:variable>
7691
7793
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7692
7794
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -8072,15 +8174,19 @@
8072
8174
  <xsl:param name="dest"/>
8073
8175
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
8074
8176
  <fo:block font-size="1pt">
8075
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8076
- <fo:inline-container inline-progression-dimension="100%">
8077
- <fo:block-container height="{$height - 1}px" width="100%">
8078
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
8079
- <xsl:attribute name="background-color">magenta</xsl:attribute>
8080
- </xsl:if> -->
8081
- <fo:block> </fo:block></fo:block-container>
8082
- </fo:inline-container>
8083
- </fo:basic-link>
8177
+ <xsl:call-template name="insert_basic_link">
8178
+ <xsl:with-param name="element">
8179
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8180
+ <fo:inline-container inline-progression-dimension="100%">
8181
+ <fo:block-container height="{$height - 1}px" width="100%">
8182
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8183
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8184
+ </xsl:if> -->
8185
+ <fo:block> </fo:block></fo:block-container>
8186
+ </fo:inline-container>
8187
+ </fo:basic-link>
8188
+ </xsl:with-param>
8189
+ </xsl:call-template>
8084
8190
  </fo:block>
8085
8191
  </fo:block-container>
8086
8192
  </xsl:template>
@@ -9626,14 +9732,18 @@
9626
9732
  </xsl:template>
9627
9733
 
9628
9734
  <xsl:template match="*[local-name() = 'origin']">
9629
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9630
- <xsl:if test="normalize-space(@citeas) = ''">
9631
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9632
- </xsl:if>
9633
- <fo:inline xsl:use-attribute-sets="origin-style">
9634
- <xsl:apply-templates/>
9635
- </fo:inline>
9636
- </fo:basic-link>
9735
+ <xsl:call-template name="insert_basic_link">
9736
+ <xsl:with-param name="element">
9737
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9738
+ <xsl:if test="normalize-space(@citeas) = ''">
9739
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9740
+ </xsl:if>
9741
+ <fo:inline xsl:use-attribute-sets="origin-style">
9742
+ <xsl:apply-templates/>
9743
+ </fo:inline>
9744
+ </fo:basic-link>
9745
+ </xsl:with-param>
9746
+ </xsl:call-template>
9637
9747
  </xsl:template>
9638
9748
 
9639
9749
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -9707,9 +9817,13 @@
9707
9817
  <xsl:if test="../*[local-name() = 'author']">
9708
9818
  <xsl:text>, </xsl:text>
9709
9819
  </xsl:if>
9710
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9711
- <xsl:apply-templates/>
9712
- </fo:basic-link>
9820
+ <xsl:call-template name="insert_basic_link">
9821
+ <xsl:with-param name="element">
9822
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9823
+ <xsl:apply-templates/>
9824
+ </fo:basic-link>
9825
+ </xsl:with-param>
9826
+ </xsl:call-template>
9713
9827
  </xsl:template>
9714
9828
 
9715
9829
  <xsl:template match="*[local-name() = 'author']">
@@ -9758,25 +9872,29 @@
9758
9872
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
9759
9873
  <xsl:variable name="text" select="normalize-space()"/>
9760
9874
 
9761
- <fo:basic-link fox:alt-text="{@citeas}">
9762
- <xsl:if test="normalize-space(@citeas) = ''">
9763
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9764
- </xsl:if>
9765
- <xsl:if test="@type = 'inline'">
9875
+ <xsl:call-template name="insert_basic_link">
9876
+ <xsl:with-param name="element">
9877
+ <fo:basic-link fox:alt-text="{@citeas}">
9878
+ <xsl:if test="normalize-space(@citeas) = ''">
9879
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9880
+ </xsl:if>
9881
+ <xsl:if test="@type = 'inline'">
9766
9882
 
9767
- </xsl:if>
9883
+ </xsl:if>
9768
9884
 
9769
- <xsl:choose>
9770
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9771
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9772
- </xsl:when>
9773
- <xsl:otherwise>
9774
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9775
- </xsl:otherwise>
9776
- </xsl:choose>
9885
+ <xsl:choose>
9886
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9887
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9888
+ </xsl:when>
9889
+ <xsl:otherwise>
9890
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9891
+ </xsl:otherwise>
9892
+ </xsl:choose>
9777
9893
 
9778
- <xsl:apply-templates/>
9779
- </fo:basic-link>
9894
+ <xsl:apply-templates/>
9895
+ </fo:basic-link>
9896
+ </xsl:with-param>
9897
+ </xsl:call-template>
9780
9898
 
9781
9899
  </fo:inline>
9782
9900
  </xsl:when>
@@ -10027,7 +10145,10 @@
10027
10145
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
10028
10146
 
10029
10147
  <xsl:template name="setULLabel">
10030
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10148
+ <xsl:variable name="list_level__">
10149
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10150
+ </xsl:variable>
10151
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
10031
10152
  <xsl:variable name="list_level">
10032
10153
  <xsl:choose>
10033
10154
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -10160,9 +10281,11 @@
10160
10281
  </fo:block-container>
10161
10282
  </xsl:when>
10162
10283
  <xsl:otherwise>
10163
- <fo:block>
10164
- <xsl:apply-templates select="." mode="list"/>
10165
- </fo:block>
10284
+
10285
+ <fo:block>
10286
+ <xsl:apply-templates select="." mode="list"/>
10287
+ </fo:block>
10288
+
10166
10289
  </xsl:otherwise>
10167
10290
  </xsl:choose>
10168
10291
  </xsl:template>
@@ -10874,24 +10997,32 @@
10874
10997
  <xsl:for-each select="*[local-name() = 'tab']">
10875
10998
  <xsl:variable name="current_id" select="generate-id()"/>
10876
10999
  <fo:table-cell>
10877
- <fo:block>
10878
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10879
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10880
- <xsl:choose>
10881
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10882
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10883
- </xsl:choose>
10884
- </xsl:for-each>
10885
- </fo:basic-link>
11000
+ <fo:block line-height-shift-adjustment="disregard-shifts">
11001
+ <xsl:call-template name="insert_basic_link">
11002
+ <xsl:with-param name="element">
11003
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11004
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11005
+ <xsl:choose>
11006
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11007
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11008
+ </xsl:choose>
11009
+ </xsl:for-each>
11010
+ </fo:basic-link>
11011
+ </xsl:with-param>
11012
+ </xsl:call-template>
10886
11013
  </fo:block>
10887
11014
  </fo:table-cell>
10888
11015
  </xsl:for-each>
10889
11016
  <!-- last column - for page numbers -->
10890
11017
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
10891
11018
  <fo:block>
10892
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10893
- <fo:page-number-citation ref-id="{$target}"/>
10894
- </fo:basic-link>
11019
+ <xsl:call-template name="insert_basic_link">
11020
+ <xsl:with-param name="element">
11021
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11022
+ <fo:page-number-citation ref-id="{$target}"/>
11023
+ </fo:basic-link>
11024
+ </xsl:with-param>
11025
+ </xsl:call-template>
10895
11026
  </fo:block>
10896
11027
  </fo:table-cell>
10897
11028
  </xsl:template>
@@ -10933,6 +11064,27 @@
10933
11064
  <!-- End Table of Contents (ToC) processing -->
10934
11065
  <!-- =================== -->
10935
11066
 
11067
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11068
+ <xsl:template name="insert_basic_link">
11069
+ <xsl:param name="element"/>
11070
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11071
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11072
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11073
+ <xsl:choose>
11074
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11075
+ <xsl:copy-of select="$element_node"/>
11076
+ </xsl:when>
11077
+ <xsl:otherwise>
11078
+ <fo:inline>
11079
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11080
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11081
+ </xsl:for-each>
11082
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11083
+ </fo:inline>
11084
+ </xsl:otherwise>
11085
+ </xsl:choose>
11086
+ </xsl:template>
11087
+
10936
11088
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
10937
11089
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
10938
11090
  <fo:inline padding-right="5mm"> </fo:inline>