metanorma-iso 2.4.2 → 2.4.3

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: d8bfb0d40024d23c0e4bcf6f7e5d7a9b59066f3ac7288d16f232203a39a00b6c
4
- data.tar.gz: 13262faed4ac013f95881bc6cdac14f702f61b44d62275c88d5e1bcf1de13397
3
+ metadata.gz: 6efbdfac921fca07cbdb4d753e847a89c54f8347df0c17b6618688c40e8003d9
4
+ data.tar.gz: 1b7120befb99cc66e1a2e3daf5c80bdfb52758c3f79467ea869cb142462dccc8
5
5
  SHA512:
6
- metadata.gz: aaa40bf853a800144371bb0419a818ef26806308622fba26f79169c533fcc24e29206c20b11538e71d903c3d05a0d873b75e6ad348bf7c72bd2944bed37f55e9
7
- data.tar.gz: 5bc24e5f4fa220d136f3d71be7096e0660b1c37bcdde1a104fc3c3f9ba91c308f5921d8fa7e2a6971659800e219bb511aeea9f5ca6f0aa7464943da0d24cf8a3
6
+ metadata.gz: 022e4216384f835d28245833db63f4bb2c6c69a92117187d29649146aace5c86c7221c10b48c235d80a86928725fd04bc50ca8c81f3bafc88acfe8d97324697a
7
+ data.tar.gz: 9dd817c38bae0befa1929aeb4447850b1f030d2e9084aa6432192efdbad0bb1f8c6f8c8e820587f19faefa7da2877be91911b26957f708de651e9e95a9d6c4a7
@@ -2,7 +2,6 @@
2
2
 
3
3
  <nav>
4
4
 
5
- <h1 id="content">{{ labels["table_of_contents"] }}</h1>
6
5
  <div id="toc"></div>
7
6
 
8
7
  </nav>
@@ -3,7 +3,5 @@
3
3
 
4
4
  <div id="boilerplate-copyright-destination"/>
5
5
 
6
- <p class="zzContents"><span lang="EN-GB">{{ labels["table_of_contents"] }}</span></p>
7
6
 
8
- WORDTOC
9
7
  {% endif %}
@@ -8,7 +8,5 @@ margin-left:5.1pt;margin-right:5.1pt'>
8
8
  {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
9
9
  {% else %}
10
10
 
11
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">{{ labels["table_of_contents"] }}</span></p>
12
11
 
13
- WORDTOC
14
12
  {% endif %}
@@ -2094,7 +2094,7 @@
2094
2094
  <xsl:template match="iso:indexsect" mode="index">
2095
2095
 
2096
2096
  <fo:page-sequence master-reference="index" force-page-count="no-force">
2097
- <xsl:variable name="header-title">
2097
+ <!-- <xsl:variable name="header-title">
2098
2098
  <xsl:choose>
2099
2099
  <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2100
2100
  <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
@@ -2103,13 +2103,14 @@
2103
2103
  <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2104
2104
  </xsl:otherwise>
2105
2105
  </xsl:choose>
2106
- </xsl:variable>
2106
+ </xsl:variable> -->
2107
2107
  <xsl:call-template name="insertHeaderFooter">
2108
- <xsl:with-param name="header-title" select="$header-title"/>
2108
+ <!-- <xsl:with-param name="header-title" select="$header-title"/> -->
2109
+ <xsl:with-param name="font-weight">normal</xsl:with-param>
2109
2110
  </xsl:call-template>
2110
2111
 
2111
2112
  <fo:flow flow-name="xsl-region-body">
2112
- <fo:block id="{@id}" span="all">
2113
+ <fo:block id="{@id}" text-align="center" span="all">
2113
2114
  <xsl:apply-templates select="iso:title"/>
2114
2115
  </fo:block>
2115
2116
  <fo:block role="Index">
@@ -2120,21 +2121,25 @@
2120
2121
  </xsl:template>
2121
2122
 
2122
2123
  <xsl:template match="iso:xref" priority="2">
2123
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2124
- <xsl:choose>
2125
- <xsl:when test="@pagenumber='true'">
2126
- <fo:inline>
2127
- <xsl:if test="@id">
2128
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2129
- </xsl:if>
2130
- <fo:page-number-citation ref-id="{@target}"/>
2131
- </fo:inline>
2132
- </xsl:when>
2133
- <xsl:otherwise>
2134
- <xsl:apply-templates/>
2135
- </xsl:otherwise>
2136
- </xsl:choose>
2137
- </fo:basic-link>
2124
+ <xsl:call-template name="insert_basic_link">
2125
+ <xsl:with-param name="element">
2126
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2127
+ <xsl:choose>
2128
+ <xsl:when test="@pagenumber='true'">
2129
+ <fo:inline>
2130
+ <xsl:if test="@id">
2131
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2132
+ </xsl:if>
2133
+ <fo:page-number-citation ref-id="{@target}"/>
2134
+ </fo:inline>
2135
+ </xsl:when>
2136
+ <xsl:otherwise>
2137
+ <xsl:apply-templates/>
2138
+ </xsl:otherwise>
2139
+ </xsl:choose>
2140
+ </fo:basic-link>
2141
+ </xsl:with-param>
2142
+ </xsl:call-template>
2138
2143
  </xsl:template>
2139
2144
 
2140
2145
  <!-- =================== -->
@@ -3027,6 +3032,7 @@
3027
3032
  </xsl:attribute-set>
3028
3033
 
3029
3034
  <xsl:attribute-set name="xref-style">
3035
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3030
3036
 
3031
3037
  <xsl:attribute name="color">blue</xsl:attribute>
3032
3038
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -5129,9 +5135,13 @@
5129
5135
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
5130
5136
  </xsl:if>
5131
5137
 
5132
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5133
- <xsl:value-of select="$current_fn_number_text"/>
5134
- </fo:basic-link>
5138
+ <xsl:call-template name="insert_basic_link">
5139
+ <xsl:with-param name="element">
5140
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5141
+ <xsl:value-of select="$current_fn_number_text"/>
5142
+ </fo:basic-link>
5143
+ </xsl:with-param>
5144
+ </xsl:call-template>
5135
5145
  </fo:inline>
5136
5146
  </xsl:variable>
5137
5147
 
@@ -5473,8 +5483,10 @@
5473
5483
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5474
5484
  <xsl:text> </xsl:text>
5475
5485
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5476
- <xsl:text/>
5477
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5486
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
5487
+ <xsl:text> </xsl:text>
5488
+ </xsl:if>
5489
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
5478
5490
  </fo:block>
5479
5491
 
5480
5492
  </xsl:when> <!-- END: only one component -->
@@ -5975,8 +5987,18 @@
5975
5987
  </xsl:if>
5976
5988
  </xsl:template>
5977
5989
 
5978
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5979
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5990
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
5991
+ <xsl:variable name="is_inline_element_after_where">
5992
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
5993
+ </xsl:variable>
5994
+ <xsl:choose>
5995
+ <xsl:when test="$is_inline_element_after_where = 'true'">
5996
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5997
+ </xsl:when>
5998
+ <xsl:otherwise>
5999
+ <xsl:apply-templates select="."/>
6000
+ </xsl:otherwise>
6001
+ </xsl:choose>
5980
6002
  </xsl:template>
5981
6003
 
5982
6004
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -7482,6 +7504,79 @@
7482
7504
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
7483
7505
  </xsl:template>
7484
7506
 
7507
+ <!-- special case for:
7508
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7509
+ <mstyle displaystyle="true">
7510
+ <msup>
7511
+ <mi color="#00000000">C</mi>
7512
+ <mtext>R</mtext>
7513
+ </msup>
7514
+ <msubsup>
7515
+ <mtext>C</mtext>
7516
+ <mi>n</mi>
7517
+ <mi>k</mi>
7518
+ </msubsup>
7519
+ </mstyle>
7520
+ </math>
7521
+ -->
7522
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7523
+ <xsl:copy>
7524
+ <xsl:copy-of select="@*"/>
7525
+ <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"/>
7526
+ <xsl:if test="string-length($next_mtext) != ''">
7527
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7528
+ </xsl:if>
7529
+ <xsl:apply-templates/>
7530
+ <xsl:value-of select="$next_mtext"/>
7531
+ </xsl:copy>
7532
+ </xsl:template>
7533
+
7534
+ <!-- special case for:
7535
+ <msup>
7536
+ <mtext/>
7537
+ <mn>1</mn>
7538
+ </msup>
7539
+ convert to (add mspace after mtext and enclose them into mrow):
7540
+ <msup>
7541
+ <mrow>
7542
+ <mtext/>
7543
+ <mspace height="1.47ex"/>
7544
+ </mrow>
7545
+ <mn>1</mn>
7546
+ </msup>
7547
+ -->
7548
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7549
+ <mathml:mrow>
7550
+ <xsl:copy-of select="."/>
7551
+ <mathml:mspace height="1.47ex"/>
7552
+ </mathml:mrow>
7553
+ </xsl:template>
7554
+
7555
+ <!-- add space around vertical line -->
7556
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7557
+ <xsl:copy>
7558
+ <xsl:apply-templates select="@*" mode="mathml"/>
7559
+ <xsl:if test="not(@lspace)">
7560
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7561
+ </xsl:if>
7562
+ <xsl:if test="not(@rspace)">
7563
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7564
+ </xsl:if>
7565
+ <xsl:apply-templates mode="mathml"/>
7566
+ </xsl:copy>
7567
+ </xsl:template>
7568
+
7569
+ <!-- decrease fontsize for 'Circled Times' char -->
7570
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7571
+ <xsl:copy>
7572
+ <xsl:apply-templates select="@*" mode="mathml"/>
7573
+ <xsl:if test="not(@fontsize)">
7574
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7575
+ </xsl:if>
7576
+ <xsl:apply-templates mode="mathml"/>
7577
+ </xsl:copy>
7578
+ </xsl:template>
7579
+
7485
7580
  <!-- Examples:
7486
7581
  <stem type="AsciiMath">x = 1</stem>
7487
7582
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7539,19 +7634,23 @@
7539
7634
  <xsl:apply-templates/>
7540
7635
  </xsl:when>
7541
7636
  <xsl:otherwise>
7542
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7543
- <xsl:choose>
7544
- <xsl:when test="normalize-space(.) = ''">
7545
- <xsl:call-template name="add-zero-spaces-link-java">
7546
- <xsl:with-param name="text" select="$target_text"/>
7547
- </xsl:call-template>
7548
- </xsl:when>
7549
- <xsl:otherwise>
7550
- <!-- output text from <link>text</link> -->
7551
- <xsl:apply-templates/>
7552
- </xsl:otherwise>
7553
- </xsl:choose>
7554
- </fo:basic-link>
7637
+ <xsl:call-template name="insert_basic_link">
7638
+ <xsl:with-param name="element">
7639
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7640
+ <xsl:choose>
7641
+ <xsl:when test="normalize-space(.) = ''">
7642
+ <xsl:call-template name="add-zero-spaces-link-java">
7643
+ <xsl:with-param name="text" select="$target_text"/>
7644
+ </xsl:call-template>
7645
+ </xsl:when>
7646
+ <xsl:otherwise>
7647
+ <!-- output text from <link>text</link> -->
7648
+ <xsl:apply-templates/>
7649
+ </xsl:otherwise>
7650
+ </xsl:choose>
7651
+ </fo:basic-link>
7652
+ </xsl:with-param>
7653
+ </xsl:call-template>
7555
7654
  </xsl:otherwise>
7556
7655
  </xsl:choose>
7557
7656
  </fo:inline>
@@ -7614,12 +7713,16 @@
7614
7713
  </xsl:template>
7615
7714
 
7616
7715
  <xsl:template match="*[local-name() = 'xref']">
7617
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7618
- <xsl:if test="parent::*[local-name() = 'add']">
7619
- <xsl:call-template name="append_add-style"/>
7620
- </xsl:if>
7621
- <xsl:apply-templates/>
7622
- </fo:basic-link>
7716
+ <xsl:call-template name="insert_basic_link">
7717
+ <xsl:with-param name="element">
7718
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7719
+ <xsl:if test="parent::*[local-name() = 'add']">
7720
+ <xsl:call-template name="append_add-style"/>
7721
+ </xsl:if>
7722
+ <xsl:apply-templates/>
7723
+ </fo:basic-link>
7724
+ </xsl:with-param>
7725
+ </xsl:call-template>
7623
7726
  </xsl:template>
7624
7727
 
7625
7728
  <!-- ====== -->
@@ -8012,7 +8115,7 @@
8012
8115
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
8013
8116
  </xsl:when>
8014
8117
  <xsl:when test="not(starts-with(@src, 'data:'))">
8015
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8118
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8016
8119
  </xsl:when>
8017
8120
  <xsl:otherwise>
8018
8121
  <xsl:value-of select="@src"/>
@@ -8034,7 +8137,7 @@
8034
8137
  </xsl:when>
8035
8138
  <xsl:when test="not(starts-with(@src, 'data:'))">
8036
8139
  <xsl:variable name="src">
8037
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8140
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8038
8141
  </xsl:variable>
8039
8142
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8040
8143
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -8420,15 +8523,19 @@
8420
8523
  <xsl:param name="dest"/>
8421
8524
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
8422
8525
  <fo:block font-size="1pt">
8423
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8424
- <fo:inline-container inline-progression-dimension="100%">
8425
- <fo:block-container height="{$height - 1}px" width="100%">
8426
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
8427
- <xsl:attribute name="background-color">magenta</xsl:attribute>
8428
- </xsl:if> -->
8429
- <fo:block> </fo:block></fo:block-container>
8430
- </fo:inline-container>
8431
- </fo:basic-link>
8526
+ <xsl:call-template name="insert_basic_link">
8527
+ <xsl:with-param name="element">
8528
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8529
+ <fo:inline-container inline-progression-dimension="100%">
8530
+ <fo:block-container height="{$height - 1}px" width="100%">
8531
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8532
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8533
+ </xsl:if> -->
8534
+ <fo:block> </fo:block></fo:block-container>
8535
+ </fo:inline-container>
8536
+ </fo:basic-link>
8537
+ </xsl:with-param>
8538
+ </xsl:call-template>
8432
8539
  </fo:block>
8433
8540
  </fo:block-container>
8434
8541
  </xsl:template>
@@ -9979,14 +10086,18 @@
9979
10086
  </xsl:template>
9980
10087
 
9981
10088
  <xsl:template match="*[local-name() = 'origin']">
9982
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9983
- <xsl:if test="normalize-space(@citeas) = ''">
9984
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9985
- </xsl:if>
9986
- <fo:inline xsl:use-attribute-sets="origin-style">
9987
- <xsl:apply-templates/>
9988
- </fo:inline>
9989
- </fo:basic-link>
10089
+ <xsl:call-template name="insert_basic_link">
10090
+ <xsl:with-param name="element">
10091
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10092
+ <xsl:if test="normalize-space(@citeas) = ''">
10093
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10094
+ </xsl:if>
10095
+ <fo:inline xsl:use-attribute-sets="origin-style">
10096
+ <xsl:apply-templates/>
10097
+ </fo:inline>
10098
+ </fo:basic-link>
10099
+ </xsl:with-param>
10100
+ </xsl:call-template>
9990
10101
  </xsl:template>
9991
10102
 
9992
10103
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -10065,9 +10176,13 @@
10065
10176
  <xsl:if test="../*[local-name() = 'author']">
10066
10177
  <xsl:text>, </xsl:text>
10067
10178
  </xsl:if>
10068
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10069
- <xsl:apply-templates/>
10070
- </fo:basic-link>
10179
+ <xsl:call-template name="insert_basic_link">
10180
+ <xsl:with-param name="element">
10181
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10182
+ <xsl:apply-templates/>
10183
+ </fo:basic-link>
10184
+ </xsl:with-param>
10185
+ </xsl:call-template>
10071
10186
  </xsl:template>
10072
10187
 
10073
10188
  <xsl:template match="*[local-name() = 'author']">
@@ -10116,25 +10231,29 @@
10116
10231
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
10117
10232
  <xsl:variable name="text" select="normalize-space()"/>
10118
10233
 
10119
- <fo:basic-link fox:alt-text="{@citeas}">
10120
- <xsl:if test="normalize-space(@citeas) = ''">
10121
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10122
- </xsl:if>
10123
- <xsl:if test="@type = 'inline'">
10234
+ <xsl:call-template name="insert_basic_link">
10235
+ <xsl:with-param name="element">
10236
+ <fo:basic-link fox:alt-text="{@citeas}">
10237
+ <xsl:if test="normalize-space(@citeas) = ''">
10238
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10239
+ </xsl:if>
10240
+ <xsl:if test="@type = 'inline'">
10124
10241
 
10125
- </xsl:if>
10242
+ </xsl:if>
10126
10243
 
10127
- <xsl:choose>
10128
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10129
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10130
- </xsl:when>
10131
- <xsl:otherwise>
10132
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10133
- </xsl:otherwise>
10134
- </xsl:choose>
10244
+ <xsl:choose>
10245
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10246
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10247
+ </xsl:when>
10248
+ <xsl:otherwise>
10249
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10250
+ </xsl:otherwise>
10251
+ </xsl:choose>
10135
10252
 
10136
- <xsl:apply-templates/>
10137
- </fo:basic-link>
10253
+ <xsl:apply-templates/>
10254
+ </fo:basic-link>
10255
+ </xsl:with-param>
10256
+ </xsl:call-template>
10138
10257
 
10139
10258
  </fo:inline>
10140
10259
  </xsl:when>
@@ -10374,7 +10493,10 @@
10374
10493
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
10375
10494
 
10376
10495
  <xsl:template name="setULLabel">
10377
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10496
+ <xsl:variable name="list_level__">
10497
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10498
+ </xsl:variable>
10499
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
10378
10500
  <xsl:variable name="list_level">
10379
10501
  <xsl:choose>
10380
10502
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -10507,9 +10629,11 @@
10507
10629
  </fo:block-container>
10508
10630
  </xsl:when>
10509
10631
  <xsl:otherwise>
10510
- <fo:block>
10511
- <xsl:apply-templates select="." mode="list"/>
10512
- </fo:block>
10632
+
10633
+ <fo:block>
10634
+ <xsl:apply-templates select="." mode="list"/>
10635
+ </fo:block>
10636
+
10513
10637
  </xsl:otherwise>
10514
10638
  </xsl:choose>
10515
10639
  </xsl:template>
@@ -11197,24 +11321,32 @@
11197
11321
  <xsl:for-each select="*[local-name() = 'tab']">
11198
11322
  <xsl:variable name="current_id" select="generate-id()"/>
11199
11323
  <fo:table-cell>
11200
- <fo:block>
11201
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11202
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11203
- <xsl:choose>
11204
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11205
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11206
- </xsl:choose>
11207
- </xsl:for-each>
11208
- </fo:basic-link>
11324
+ <fo:block line-height-shift-adjustment="disregard-shifts">
11325
+ <xsl:call-template name="insert_basic_link">
11326
+ <xsl:with-param name="element">
11327
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11328
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11329
+ <xsl:choose>
11330
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11331
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11332
+ </xsl:choose>
11333
+ </xsl:for-each>
11334
+ </fo:basic-link>
11335
+ </xsl:with-param>
11336
+ </xsl:call-template>
11209
11337
  </fo:block>
11210
11338
  </fo:table-cell>
11211
11339
  </xsl:for-each>
11212
11340
  <!-- last column - for page numbers -->
11213
11341
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
11214
11342
  <fo:block>
11215
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11216
- <fo:page-number-citation ref-id="{$target}"/>
11217
- </fo:basic-link>
11343
+ <xsl:call-template name="insert_basic_link">
11344
+ <xsl:with-param name="element">
11345
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11346
+ <fo:page-number-citation ref-id="{$target}"/>
11347
+ </fo:basic-link>
11348
+ </xsl:with-param>
11349
+ </xsl:call-template>
11218
11350
  </fo:block>
11219
11351
  </fo:table-cell>
11220
11352
  </xsl:template>
@@ -11256,6 +11388,27 @@
11256
11388
  <!-- End Table of Contents (ToC) processing -->
11257
11389
  <!-- =================== -->
11258
11390
 
11391
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11392
+ <xsl:template name="insert_basic_link">
11393
+ <xsl:param name="element"/>
11394
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11395
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11396
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11397
+ <xsl:choose>
11398
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11399
+ <xsl:copy-of select="$element_node"/>
11400
+ </xsl:when>
11401
+ <xsl:otherwise>
11402
+ <fo:inline>
11403
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11404
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11405
+ </xsl:for-each>
11406
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11407
+ </fo:inline>
11408
+ </xsl:otherwise>
11409
+ </xsl:choose>
11410
+ </xsl:template>
11411
+
11259
11412
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
11260
11413
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
11261
11414
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -2094,7 +2094,7 @@
2094
2094
  <xsl:template match="iso:indexsect" mode="index">
2095
2095
 
2096
2096
  <fo:page-sequence master-reference="index" force-page-count="no-force">
2097
- <xsl:variable name="header-title">
2097
+ <!-- <xsl:variable name="header-title">
2098
2098
  <xsl:choose>
2099
2099
  <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2100
2100
  <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
@@ -2103,13 +2103,14 @@
2103
2103
  <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2104
2104
  </xsl:otherwise>
2105
2105
  </xsl:choose>
2106
- </xsl:variable>
2106
+ </xsl:variable> -->
2107
2107
  <xsl:call-template name="insertHeaderFooter">
2108
- <xsl:with-param name="header-title" select="$header-title"/>
2108
+ <!-- <xsl:with-param name="header-title" select="$header-title"/> -->
2109
+ <xsl:with-param name="font-weight">normal</xsl:with-param>
2109
2110
  </xsl:call-template>
2110
2111
 
2111
2112
  <fo:flow flow-name="xsl-region-body">
2112
- <fo:block id="{@id}" span="all">
2113
+ <fo:block id="{@id}" text-align="center" span="all">
2113
2114
  <xsl:apply-templates select="iso:title"/>
2114
2115
  </fo:block>
2115
2116
  <fo:block role="Index">
@@ -2120,21 +2121,25 @@
2120
2121
  </xsl:template>
2121
2122
 
2122
2123
  <xsl:template match="iso:xref" priority="2">
2123
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2124
- <xsl:choose>
2125
- <xsl:when test="@pagenumber='true'">
2126
- <fo:inline>
2127
- <xsl:if test="@id">
2128
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2129
- </xsl:if>
2130
- <fo:page-number-citation ref-id="{@target}"/>
2131
- </fo:inline>
2132
- </xsl:when>
2133
- <xsl:otherwise>
2134
- <xsl:apply-templates/>
2135
- </xsl:otherwise>
2136
- </xsl:choose>
2137
- </fo:basic-link>
2124
+ <xsl:call-template name="insert_basic_link">
2125
+ <xsl:with-param name="element">
2126
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2127
+ <xsl:choose>
2128
+ <xsl:when test="@pagenumber='true'">
2129
+ <fo:inline>
2130
+ <xsl:if test="@id">
2131
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2132
+ </xsl:if>
2133
+ <fo:page-number-citation ref-id="{@target}"/>
2134
+ </fo:inline>
2135
+ </xsl:when>
2136
+ <xsl:otherwise>
2137
+ <xsl:apply-templates/>
2138
+ </xsl:otherwise>
2139
+ </xsl:choose>
2140
+ </fo:basic-link>
2141
+ </xsl:with-param>
2142
+ </xsl:call-template>
2138
2143
  </xsl:template>
2139
2144
 
2140
2145
  <!-- =================== -->
@@ -3027,6 +3032,7 @@
3027
3032
  </xsl:attribute-set>
3028
3033
 
3029
3034
  <xsl:attribute-set name="xref-style">
3035
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3030
3036
 
3031
3037
  <xsl:attribute name="color">blue</xsl:attribute>
3032
3038
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -5129,9 +5135,13 @@
5129
5135
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
5130
5136
  </xsl:if>
5131
5137
 
5132
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5133
- <xsl:value-of select="$current_fn_number_text"/>
5134
- </fo:basic-link>
5138
+ <xsl:call-template name="insert_basic_link">
5139
+ <xsl:with-param name="element">
5140
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
5141
+ <xsl:value-of select="$current_fn_number_text"/>
5142
+ </fo:basic-link>
5143
+ </xsl:with-param>
5144
+ </xsl:call-template>
5135
5145
  </fo:inline>
5136
5146
  </xsl:variable>
5137
5147
 
@@ -5473,8 +5483,10 @@
5473
5483
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5474
5484
  <xsl:text> </xsl:text>
5475
5485
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5476
- <xsl:text/>
5477
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5486
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
5487
+ <xsl:text> </xsl:text>
5488
+ </xsl:if>
5489
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
5478
5490
  </fo:block>
5479
5491
 
5480
5492
  </xsl:when> <!-- END: only one component -->
@@ -5975,8 +5987,18 @@
5975
5987
  </xsl:if>
5976
5988
  </xsl:template>
5977
5989
 
5978
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5979
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5990
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
5991
+ <xsl:variable name="is_inline_element_after_where">
5992
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
5993
+ </xsl:variable>
5994
+ <xsl:choose>
5995
+ <xsl:when test="$is_inline_element_after_where = 'true'">
5996
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5997
+ </xsl:when>
5998
+ <xsl:otherwise>
5999
+ <xsl:apply-templates select="."/>
6000
+ </xsl:otherwise>
6001
+ </xsl:choose>
5980
6002
  </xsl:template>
5981
6003
 
5982
6004
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -7482,6 +7504,79 @@
7482
7504
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
7483
7505
  </xsl:template>
7484
7506
 
7507
+ <!-- special case for:
7508
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7509
+ <mstyle displaystyle="true">
7510
+ <msup>
7511
+ <mi color="#00000000">C</mi>
7512
+ <mtext>R</mtext>
7513
+ </msup>
7514
+ <msubsup>
7515
+ <mtext>C</mtext>
7516
+ <mi>n</mi>
7517
+ <mi>k</mi>
7518
+ </msubsup>
7519
+ </mstyle>
7520
+ </math>
7521
+ -->
7522
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7523
+ <xsl:copy>
7524
+ <xsl:copy-of select="@*"/>
7525
+ <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"/>
7526
+ <xsl:if test="string-length($next_mtext) != ''">
7527
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7528
+ </xsl:if>
7529
+ <xsl:apply-templates/>
7530
+ <xsl:value-of select="$next_mtext"/>
7531
+ </xsl:copy>
7532
+ </xsl:template>
7533
+
7534
+ <!-- special case for:
7535
+ <msup>
7536
+ <mtext/>
7537
+ <mn>1</mn>
7538
+ </msup>
7539
+ convert to (add mspace after mtext and enclose them into mrow):
7540
+ <msup>
7541
+ <mrow>
7542
+ <mtext/>
7543
+ <mspace height="1.47ex"/>
7544
+ </mrow>
7545
+ <mn>1</mn>
7546
+ </msup>
7547
+ -->
7548
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7549
+ <mathml:mrow>
7550
+ <xsl:copy-of select="."/>
7551
+ <mathml:mspace height="1.47ex"/>
7552
+ </mathml:mrow>
7553
+ </xsl:template>
7554
+
7555
+ <!-- add space around vertical line -->
7556
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7557
+ <xsl:copy>
7558
+ <xsl:apply-templates select="@*" mode="mathml"/>
7559
+ <xsl:if test="not(@lspace)">
7560
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7561
+ </xsl:if>
7562
+ <xsl:if test="not(@rspace)">
7563
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7564
+ </xsl:if>
7565
+ <xsl:apply-templates mode="mathml"/>
7566
+ </xsl:copy>
7567
+ </xsl:template>
7568
+
7569
+ <!-- decrease fontsize for 'Circled Times' char -->
7570
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7571
+ <xsl:copy>
7572
+ <xsl:apply-templates select="@*" mode="mathml"/>
7573
+ <xsl:if test="not(@fontsize)">
7574
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7575
+ </xsl:if>
7576
+ <xsl:apply-templates mode="mathml"/>
7577
+ </xsl:copy>
7578
+ </xsl:template>
7579
+
7485
7580
  <!-- Examples:
7486
7581
  <stem type="AsciiMath">x = 1</stem>
7487
7582
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7539,19 +7634,23 @@
7539
7634
  <xsl:apply-templates/>
7540
7635
  </xsl:when>
7541
7636
  <xsl:otherwise>
7542
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7543
- <xsl:choose>
7544
- <xsl:when test="normalize-space(.) = ''">
7545
- <xsl:call-template name="add-zero-spaces-link-java">
7546
- <xsl:with-param name="text" select="$target_text"/>
7547
- </xsl:call-template>
7548
- </xsl:when>
7549
- <xsl:otherwise>
7550
- <!-- output text from <link>text</link> -->
7551
- <xsl:apply-templates/>
7552
- </xsl:otherwise>
7553
- </xsl:choose>
7554
- </fo:basic-link>
7637
+ <xsl:call-template name="insert_basic_link">
7638
+ <xsl:with-param name="element">
7639
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7640
+ <xsl:choose>
7641
+ <xsl:when test="normalize-space(.) = ''">
7642
+ <xsl:call-template name="add-zero-spaces-link-java">
7643
+ <xsl:with-param name="text" select="$target_text"/>
7644
+ </xsl:call-template>
7645
+ </xsl:when>
7646
+ <xsl:otherwise>
7647
+ <!-- output text from <link>text</link> -->
7648
+ <xsl:apply-templates/>
7649
+ </xsl:otherwise>
7650
+ </xsl:choose>
7651
+ </fo:basic-link>
7652
+ </xsl:with-param>
7653
+ </xsl:call-template>
7555
7654
  </xsl:otherwise>
7556
7655
  </xsl:choose>
7557
7656
  </fo:inline>
@@ -7614,12 +7713,16 @@
7614
7713
  </xsl:template>
7615
7714
 
7616
7715
  <xsl:template match="*[local-name() = 'xref']">
7617
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7618
- <xsl:if test="parent::*[local-name() = 'add']">
7619
- <xsl:call-template name="append_add-style"/>
7620
- </xsl:if>
7621
- <xsl:apply-templates/>
7622
- </fo:basic-link>
7716
+ <xsl:call-template name="insert_basic_link">
7717
+ <xsl:with-param name="element">
7718
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7719
+ <xsl:if test="parent::*[local-name() = 'add']">
7720
+ <xsl:call-template name="append_add-style"/>
7721
+ </xsl:if>
7722
+ <xsl:apply-templates/>
7723
+ </fo:basic-link>
7724
+ </xsl:with-param>
7725
+ </xsl:call-template>
7623
7726
  </xsl:template>
7624
7727
 
7625
7728
  <!-- ====== -->
@@ -8012,7 +8115,7 @@
8012
8115
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
8013
8116
  </xsl:when>
8014
8117
  <xsl:when test="not(starts-with(@src, 'data:'))">
8015
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8118
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8016
8119
  </xsl:when>
8017
8120
  <xsl:otherwise>
8018
8121
  <xsl:value-of select="@src"/>
@@ -8034,7 +8137,7 @@
8034
8137
  </xsl:when>
8035
8138
  <xsl:when test="not(starts-with(@src, 'data:'))">
8036
8139
  <xsl:variable name="src">
8037
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
8140
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8038
8141
  </xsl:variable>
8039
8142
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8040
8143
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -8420,15 +8523,19 @@
8420
8523
  <xsl:param name="dest"/>
8421
8524
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
8422
8525
  <fo:block font-size="1pt">
8423
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8424
- <fo:inline-container inline-progression-dimension="100%">
8425
- <fo:block-container height="{$height - 1}px" width="100%">
8426
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
8427
- <xsl:attribute name="background-color">magenta</xsl:attribute>
8428
- </xsl:if> -->
8429
- <fo:block> </fo:block></fo:block-container>
8430
- </fo:inline-container>
8431
- </fo:basic-link>
8526
+ <xsl:call-template name="insert_basic_link">
8527
+ <xsl:with-param name="element">
8528
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8529
+ <fo:inline-container inline-progression-dimension="100%">
8530
+ <fo:block-container height="{$height - 1}px" width="100%">
8531
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8532
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8533
+ </xsl:if> -->
8534
+ <fo:block> </fo:block></fo:block-container>
8535
+ </fo:inline-container>
8536
+ </fo:basic-link>
8537
+ </xsl:with-param>
8538
+ </xsl:call-template>
8432
8539
  </fo:block>
8433
8540
  </fo:block-container>
8434
8541
  </xsl:template>
@@ -9979,14 +10086,18 @@
9979
10086
  </xsl:template>
9980
10087
 
9981
10088
  <xsl:template match="*[local-name() = 'origin']">
9982
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9983
- <xsl:if test="normalize-space(@citeas) = ''">
9984
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9985
- </xsl:if>
9986
- <fo:inline xsl:use-attribute-sets="origin-style">
9987
- <xsl:apply-templates/>
9988
- </fo:inline>
9989
- </fo:basic-link>
10089
+ <xsl:call-template name="insert_basic_link">
10090
+ <xsl:with-param name="element">
10091
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10092
+ <xsl:if test="normalize-space(@citeas) = ''">
10093
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10094
+ </xsl:if>
10095
+ <fo:inline xsl:use-attribute-sets="origin-style">
10096
+ <xsl:apply-templates/>
10097
+ </fo:inline>
10098
+ </fo:basic-link>
10099
+ </xsl:with-param>
10100
+ </xsl:call-template>
9990
10101
  </xsl:template>
9991
10102
 
9992
10103
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -10065,9 +10176,13 @@
10065
10176
  <xsl:if test="../*[local-name() = 'author']">
10066
10177
  <xsl:text>, </xsl:text>
10067
10178
  </xsl:if>
10068
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10069
- <xsl:apply-templates/>
10070
- </fo:basic-link>
10179
+ <xsl:call-template name="insert_basic_link">
10180
+ <xsl:with-param name="element">
10181
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
10182
+ <xsl:apply-templates/>
10183
+ </fo:basic-link>
10184
+ </xsl:with-param>
10185
+ </xsl:call-template>
10071
10186
  </xsl:template>
10072
10187
 
10073
10188
  <xsl:template match="*[local-name() = 'author']">
@@ -10116,25 +10231,29 @@
10116
10231
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
10117
10232
  <xsl:variable name="text" select="normalize-space()"/>
10118
10233
 
10119
- <fo:basic-link fox:alt-text="{@citeas}">
10120
- <xsl:if test="normalize-space(@citeas) = ''">
10121
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10122
- </xsl:if>
10123
- <xsl:if test="@type = 'inline'">
10234
+ <xsl:call-template name="insert_basic_link">
10235
+ <xsl:with-param name="element">
10236
+ <fo:basic-link fox:alt-text="{@citeas}">
10237
+ <xsl:if test="normalize-space(@citeas) = ''">
10238
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
10239
+ </xsl:if>
10240
+ <xsl:if test="@type = 'inline'">
10124
10241
 
10125
- </xsl:if>
10242
+ </xsl:if>
10126
10243
 
10127
- <xsl:choose>
10128
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10129
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10130
- </xsl:when>
10131
- <xsl:otherwise>
10132
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10133
- </xsl:otherwise>
10134
- </xsl:choose>
10244
+ <xsl:choose>
10245
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
10246
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
10247
+ </xsl:when>
10248
+ <xsl:otherwise>
10249
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
10250
+ </xsl:otherwise>
10251
+ </xsl:choose>
10135
10252
 
10136
- <xsl:apply-templates/>
10137
- </fo:basic-link>
10253
+ <xsl:apply-templates/>
10254
+ </fo:basic-link>
10255
+ </xsl:with-param>
10256
+ </xsl:call-template>
10138
10257
 
10139
10258
  </fo:inline>
10140
10259
  </xsl:when>
@@ -10374,7 +10493,10 @@
10374
10493
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
10375
10494
 
10376
10495
  <xsl:template name="setULLabel">
10377
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10496
+ <xsl:variable name="list_level__">
10497
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10498
+ </xsl:variable>
10499
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
10378
10500
  <xsl:variable name="list_level">
10379
10501
  <xsl:choose>
10380
10502
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -10507,9 +10629,11 @@
10507
10629
  </fo:block-container>
10508
10630
  </xsl:when>
10509
10631
  <xsl:otherwise>
10510
- <fo:block>
10511
- <xsl:apply-templates select="." mode="list"/>
10512
- </fo:block>
10632
+
10633
+ <fo:block>
10634
+ <xsl:apply-templates select="." mode="list"/>
10635
+ </fo:block>
10636
+
10513
10637
  </xsl:otherwise>
10514
10638
  </xsl:choose>
10515
10639
  </xsl:template>
@@ -11197,24 +11321,32 @@
11197
11321
  <xsl:for-each select="*[local-name() = 'tab']">
11198
11322
  <xsl:variable name="current_id" select="generate-id()"/>
11199
11323
  <fo:table-cell>
11200
- <fo:block>
11201
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11202
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11203
- <xsl:choose>
11204
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11205
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11206
- </xsl:choose>
11207
- </xsl:for-each>
11208
- </fo:basic-link>
11324
+ <fo:block line-height-shift-adjustment="disregard-shifts">
11325
+ <xsl:call-template name="insert_basic_link">
11326
+ <xsl:with-param name="element">
11327
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11328
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11329
+ <xsl:choose>
11330
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11331
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11332
+ </xsl:choose>
11333
+ </xsl:for-each>
11334
+ </fo:basic-link>
11335
+ </xsl:with-param>
11336
+ </xsl:call-template>
11209
11337
  </fo:block>
11210
11338
  </fo:table-cell>
11211
11339
  </xsl:for-each>
11212
11340
  <!-- last column - for page numbers -->
11213
11341
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
11214
11342
  <fo:block>
11215
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11216
- <fo:page-number-citation ref-id="{$target}"/>
11217
- </fo:basic-link>
11343
+ <xsl:call-template name="insert_basic_link">
11344
+ <xsl:with-param name="element">
11345
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11346
+ <fo:page-number-citation ref-id="{$target}"/>
11347
+ </fo:basic-link>
11348
+ </xsl:with-param>
11349
+ </xsl:call-template>
11218
11350
  </fo:block>
11219
11351
  </fo:table-cell>
11220
11352
  </xsl:template>
@@ -11256,6 +11388,27 @@
11256
11388
  <!-- End Table of Contents (ToC) processing -->
11257
11389
  <!-- =================== -->
11258
11390
 
11391
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11392
+ <xsl:template name="insert_basic_link">
11393
+ <xsl:param name="element"/>
11394
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11395
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11396
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11397
+ <xsl:choose>
11398
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11399
+ <xsl:copy-of select="$element_node"/>
11400
+ </xsl:when>
11401
+ <xsl:otherwise>
11402
+ <fo:inline>
11403
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11404
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11405
+ </xsl:for-each>
11406
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11407
+ </fo:inline>
11408
+ </xsl:otherwise>
11409
+ </xsl:choose>
11410
+ </xsl:template>
11411
+
11259
11412
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
11260
11413
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
11261
11414
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -237,6 +237,12 @@ module IsoDoc
237
237
  dlist.remove
238
238
  end
239
239
 
240
+ def toc_title(docxml)
241
+ doctype = docxml.at(ns("//bibdata/ext/doctype"))&.text
242
+ %w(amendment technical-corrigendum).include?(doctype) and return
243
+ super
244
+ end
245
+
240
246
  include Init
241
247
  end
242
248
  end
@@ -35,26 +35,26 @@ module IsoDoc
35
35
  amd(isoxml) and @suppressheadingnumbers = true
36
36
  end
37
37
 
38
- def introduction(isoxml, out)
39
- f = isoxml.at(ns("//introduction")) || return
38
+ =begin
39
+ def introduction(clause, out)
40
40
  title_attr = { class: "IntroTitle" }
41
41
  page_break(out)
42
- out.div class: "Section3", id: f["id"] do |div|
43
- clause_name(f, f.at(ns("./title")), div, title_attr)
44
- f.elements.each do |e|
42
+ out.div class: "Section3", id: clause["id"] do |div|
43
+ clause_name(clause, clause.at(ns("./title")), div, title_attr)
44
+ clause.elements.each do |e|
45
45
  parse(e, div) unless e.name == "title"
46
46
  end
47
47
  end
48
48
  end
49
+ =end
49
50
 
50
- def foreword(isoxml, out)
51
- f = isoxml.at(ns("//foreword")) or return
51
+ def foreword(clause, out)
52
52
  @foreword = true
53
53
  page_break(out)
54
- out.div **attr_code(id: f["id"]) do |s|
55
- clause_name(nil, f.at(ns("./title")) || @i18n.foreword, s,
54
+ out.div **attr_code(id: clause["id"]) do |s|
55
+ clause_name(nil, clause.at(ns("./title")) || @i18n.foreword, s,
56
56
  { class: "ForewordTitle" })
57
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
57
+ clause.elements.each { |e| parse(e, s) unless e.name == "title" }
58
58
  end
59
59
  @foreword = false
60
60
  end
@@ -142,6 +142,9 @@ module IsoDoc
142
142
  # supply missing annex title
143
143
  def make_WordToC(docxml, level)
144
144
  toc = ""
145
+ if source = docxml.at("//div[@class = 'TOC']")
146
+ toc = to_xml(source.children)
147
+ end
145
148
  xpath = (1..level).each.map { |i| "//h#{i}" }.join (" | ")
146
149
  docxml.xpath(xpath).each do |h|
147
150
  x = ""
@@ -17,6 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
+ <!-- VERSION v1.2.1 -->
20
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
22
  <include href="reqt.rng"/>
22
23
  <include href="basicdoc.rng">
@@ -1349,15 +1350,19 @@
1349
1350
  </choice>
1350
1351
  </element>
1351
1352
  </define>
1353
+ <define name="Root-Attributes">
1354
+ <attribute name="version"/>
1355
+ <attribute name="schema-version"/>
1356
+ <attribute name="type">
1357
+ <choice>
1358
+ <value>semantic</value>
1359
+ <value>presentation</value>
1360
+ </choice>
1361
+ </attribute>
1362
+ </define>
1352
1363
  <define name="standard-document">
1353
1364
  <element name="standard-document">
1354
- <attribute name="version"/>
1355
- <attribute name="type">
1356
- <choice>
1357
- <value>semantic</value>
1358
- <value>presentation</value>
1359
- </choice>
1360
- </attribute>
1365
+ <ref name="Root-Attributes"/>
1361
1366
  <ref name="bibdata"/>
1362
1367
  <optional>
1363
1368
  <ref name="misccontainer"/>
@@ -1,6 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar ns="https://www.metanorma.org/ns/iso" xmlns="http://relaxng.org/ns/structure/1.0">
3
- <!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
3
+ <!--
4
+ VERSION v1.2.1
5
+ default namespace isostandard = "https://www.metanorma.com/ns/iso"
6
+ -->
4
7
  <include href="relaton-iso.rng"/>
5
8
  <include href="isostandard.rng">
6
9
  <start>
@@ -32,13 +35,7 @@
32
35
  </define>
33
36
  <define name="iso-standard">
34
37
  <element name="iso-standard">
35
- <attribute name="version"/>
36
- <attribute name="type">
37
- <choice>
38
- <value>semantic</value>
39
- <value>presentation</value>
40
- </choice>
41
- </attribute>
38
+ <ref name="Root-Attributes"/>
42
39
  <ref name="bibdata"/>
43
40
  <optional>
44
41
  <ref name="misccontainer"/>
@@ -1,6 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
3
+ <!--
4
+ VERSION v1.2.1
5
+ default namespace isostandard = "https://www.metanorma.com/ns/iso"
6
+ -->
4
7
  <include href="isodoc.rng">
5
8
  <start>
6
9
  <ref name="iso-standard"/>
@@ -240,13 +243,7 @@
240
243
  -->
241
244
  <define name="iso-standard">
242
245
  <element name="iso-standard">
243
- <attribute name="version"/>
244
- <attribute name="type">
245
- <choice>
246
- <value>semantic</value>
247
- <value>presentation</value>
248
- </choice>
249
- </attribute>
246
+ <ref name="Root-Attributes"/>
250
247
  <ref name="bibdata"/>
251
248
  <zeroOrMore>
252
249
  <ref name="termdocsource"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "2.4.2".freeze
3
+ VERSION = "2.4.3".freeze
4
4
  end
5
5
  end
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
33
33
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
34
34
 
35
- spec.add_dependency "metanorma-standoc", "~> 2.4.2"
35
+ spec.add_dependency "metanorma-standoc", "~> 2.4.3"
36
36
  spec.add_dependency "mnconvert", "~> 1.14"
37
37
  spec.add_dependency "pubid-iso", "~> 0.5.0"
38
38
  spec.add_dependency "ruby-jing"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-10 00:00:00.000000000 Z
11
+ date: 2023-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.4.2
19
+ version: 2.4.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.4.2
26
+ version: 2.4.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mnconvert
29
29
  requirement: !ruby/object:Gem::Requirement