metanorma-iho 0.7.8 → 0.7.9

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: 0e7cc94d7e8f9683e2b6188ea75dc4f404e762cab848878e511369a3aa741fd9
4
- data.tar.gz: baf518a1ee8054dd032220bd45425a80619c594bb50d0b79db6d043de7aad0c3
3
+ metadata.gz: 44a6c817e8c5684e39adf0452d7e86d0c93bbbfe657c09e4e2c5a2ff073deff5
4
+ data.tar.gz: 5971f98f8a04db9d19ee893d35b0044da87575924c60967db891c23d9e539dc3
5
5
  SHA512:
6
- metadata.gz: 5f0bbf1cb754794a8782e1963ef20ff1eaf435389692ff453138c48403d9947bfb21e031ea5908f0bdf19b11bebd81bb980d49406e6d8e2ed3efde627b0ae36c
7
- data.tar.gz: 58c891f65f1d4299c81c7806c80a214d24976eed99d65450e9f462effe62aca48f46468b31f6f760797cda5133a94ae71f6a06116624dce24e102b1bf7edcf70
6
+ metadata.gz: e38a5b8edef759b2523059942e5f29a99ec761faca0678ef81355c56e530171f0107e2235eb27c358797c0139c26679d441be2ccf193a9ebd4dc1a1a066939ea
7
+ data.tar.gz: '0439d5c092c8eed3a38947194849088b7ef8a330a0fe44d4cd6a50f7ef416128044b1b9c648abb984e14416487ce27fb0964000eb4533ddb956809dd005f1620'
@@ -1,5 +1,4 @@
1
1
  <nav>
2
- <h1 id="content">Contents</h1>
3
2
  <div id="toc"></div>
4
3
 
5
4
  </nav>
@@ -18,7 +18,4 @@
18
18
  </tr>
19
19
  </table>
20
20
 
21
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
22
-
23
- WORDTOC
24
21
 
@@ -12,6 +12,7 @@ module IsoDoc
12
12
  Metanorma::IHO.configuration
13
13
  end
14
14
 
15
+ =begin
15
16
  def make_body3(body, docxml)
16
17
  body.div **{ class: "main-section" } do |div3|
17
18
  boilerplate docxml, div3
@@ -26,6 +27,7 @@ module IsoDoc
26
27
  comments div3
27
28
  end
28
29
  end
30
+ =end
29
31
 
30
32
  include BaseConvert
31
33
  include Init
@@ -1566,6 +1566,7 @@
1566
1566
  </xsl:attribute-set>
1567
1567
 
1568
1568
  <xsl:attribute-set name="xref-style">
1569
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1569
1570
 
1570
1571
  <xsl:attribute name="color">blue</xsl:attribute>
1571
1572
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -3559,9 +3560,13 @@
3559
3560
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3560
3561
  </xsl:if>
3561
3562
 
3562
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3563
- <xsl:value-of select="$current_fn_number_text"/>
3564
- </fo:basic-link>
3563
+ <xsl:call-template name="insert_basic_link">
3564
+ <xsl:with-param name="element">
3565
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3566
+ <xsl:value-of select="$current_fn_number_text"/>
3567
+ </fo:basic-link>
3568
+ </xsl:with-param>
3569
+ </xsl:call-template>
3565
3570
  </fo:inline>
3566
3571
  </xsl:variable>
3567
3572
 
@@ -3894,8 +3899,10 @@
3894
3899
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3895
3900
  <xsl:text> </xsl:text>
3896
3901
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3897
- <xsl:text/>
3898
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3902
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
3903
+ <xsl:text> </xsl:text>
3904
+ </xsl:if>
3905
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3899
3906
  </fo:block>
3900
3907
 
3901
3908
  </xsl:when> <!-- END: only one component -->
@@ -4388,8 +4395,18 @@
4388
4395
  </xsl:if>
4389
4396
  </xsl:template>
4390
4397
 
4391
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4392
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4398
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4399
+ <xsl:variable name="is_inline_element_after_where">
4400
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4401
+ </xsl:variable>
4402
+ <xsl:choose>
4403
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4404
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4405
+ </xsl:when>
4406
+ <xsl:otherwise>
4407
+ <xsl:apply-templates select="."/>
4408
+ </xsl:otherwise>
4409
+ </xsl:choose>
4393
4410
  </xsl:template>
4394
4411
 
4395
4412
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -5889,6 +5906,79 @@
5889
5906
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5890
5907
  </xsl:template>
5891
5908
 
5909
+ <!-- special case for:
5910
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5911
+ <mstyle displaystyle="true">
5912
+ <msup>
5913
+ <mi color="#00000000">C</mi>
5914
+ <mtext>R</mtext>
5915
+ </msup>
5916
+ <msubsup>
5917
+ <mtext>C</mtext>
5918
+ <mi>n</mi>
5919
+ <mi>k</mi>
5920
+ </msubsup>
5921
+ </mstyle>
5922
+ </math>
5923
+ -->
5924
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
5925
+ <xsl:copy>
5926
+ <xsl:copy-of select="@*"/>
5927
+ <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"/>
5928
+ <xsl:if test="string-length($next_mtext) != ''">
5929
+ <xsl:attribute name="color">#00000000</xsl:attribute>
5930
+ </xsl:if>
5931
+ <xsl:apply-templates/>
5932
+ <xsl:value-of select="$next_mtext"/>
5933
+ </xsl:copy>
5934
+ </xsl:template>
5935
+
5936
+ <!-- special case for:
5937
+ <msup>
5938
+ <mtext/>
5939
+ <mn>1</mn>
5940
+ </msup>
5941
+ convert to (add mspace after mtext and enclose them into mrow):
5942
+ <msup>
5943
+ <mrow>
5944
+ <mtext/>
5945
+ <mspace height="1.47ex"/>
5946
+ </mrow>
5947
+ <mn>1</mn>
5948
+ </msup>
5949
+ -->
5950
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
5951
+ <mathml:mrow>
5952
+ <xsl:copy-of select="."/>
5953
+ <mathml:mspace height="1.47ex"/>
5954
+ </mathml:mrow>
5955
+ </xsl:template>
5956
+
5957
+ <!-- add space around vertical line -->
5958
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
5959
+ <xsl:copy>
5960
+ <xsl:apply-templates select="@*" mode="mathml"/>
5961
+ <xsl:if test="not(@lspace)">
5962
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
5963
+ </xsl:if>
5964
+ <xsl:if test="not(@rspace)">
5965
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
5966
+ </xsl:if>
5967
+ <xsl:apply-templates mode="mathml"/>
5968
+ </xsl:copy>
5969
+ </xsl:template>
5970
+
5971
+ <!-- decrease fontsize for 'Circled Times' char -->
5972
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
5973
+ <xsl:copy>
5974
+ <xsl:apply-templates select="@*" mode="mathml"/>
5975
+ <xsl:if test="not(@fontsize)">
5976
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
5977
+ </xsl:if>
5978
+ <xsl:apply-templates mode="mathml"/>
5979
+ </xsl:copy>
5980
+ </xsl:template>
5981
+
5892
5982
  <!-- Examples:
5893
5983
  <stem type="AsciiMath">x = 1</stem>
5894
5984
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5946,19 +6036,23 @@
5946
6036
  <xsl:apply-templates/>
5947
6037
  </xsl:when>
5948
6038
  <xsl:otherwise>
5949
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5950
- <xsl:choose>
5951
- <xsl:when test="normalize-space(.) = ''">
5952
- <xsl:call-template name="add-zero-spaces-link-java">
5953
- <xsl:with-param name="text" select="$target_text"/>
5954
- </xsl:call-template>
5955
- </xsl:when>
5956
- <xsl:otherwise>
5957
- <!-- output text from <link>text</link> -->
5958
- <xsl:apply-templates/>
5959
- </xsl:otherwise>
5960
- </xsl:choose>
5961
- </fo:basic-link>
6039
+ <xsl:call-template name="insert_basic_link">
6040
+ <xsl:with-param name="element">
6041
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6042
+ <xsl:choose>
6043
+ <xsl:when test="normalize-space(.) = ''">
6044
+ <xsl:call-template name="add-zero-spaces-link-java">
6045
+ <xsl:with-param name="text" select="$target_text"/>
6046
+ </xsl:call-template>
6047
+ </xsl:when>
6048
+ <xsl:otherwise>
6049
+ <!-- output text from <link>text</link> -->
6050
+ <xsl:apply-templates/>
6051
+ </xsl:otherwise>
6052
+ </xsl:choose>
6053
+ </fo:basic-link>
6054
+ </xsl:with-param>
6055
+ </xsl:call-template>
5962
6056
  </xsl:otherwise>
5963
6057
  </xsl:choose>
5964
6058
  </fo:inline>
@@ -6021,12 +6115,16 @@
6021
6115
  </xsl:template>
6022
6116
 
6023
6117
  <xsl:template match="*[local-name() = 'xref']">
6024
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6025
- <xsl:if test="parent::*[local-name() = 'add']">
6026
- <xsl:call-template name="append_add-style"/>
6027
- </xsl:if>
6028
- <xsl:apply-templates/>
6029
- </fo:basic-link>
6118
+ <xsl:call-template name="insert_basic_link">
6119
+ <xsl:with-param name="element">
6120
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6121
+ <xsl:if test="parent::*[local-name() = 'add']">
6122
+ <xsl:call-template name="append_add-style"/>
6123
+ </xsl:if>
6124
+ <xsl:apply-templates/>
6125
+ </fo:basic-link>
6126
+ </xsl:with-param>
6127
+ </xsl:call-template>
6030
6128
  </xsl:template>
6031
6129
 
6032
6130
  <!-- ====== -->
@@ -6409,7 +6507,7 @@
6409
6507
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6410
6508
  </xsl:when>
6411
6509
  <xsl:when test="not(starts-with(@src, 'data:'))">
6412
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6510
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6413
6511
  </xsl:when>
6414
6512
  <xsl:otherwise>
6415
6513
  <xsl:value-of select="@src"/>
@@ -6431,7 +6529,7 @@
6431
6529
  </xsl:when>
6432
6530
  <xsl:when test="not(starts-with(@src, 'data:'))">
6433
6531
  <xsl:variable name="src">
6434
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6532
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6435
6533
  </xsl:variable>
6436
6534
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6437
6535
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6817,15 +6915,19 @@
6817
6915
  <xsl:param name="dest"/>
6818
6916
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6819
6917
  <fo:block font-size="1pt">
6820
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6821
- <fo:inline-container inline-progression-dimension="100%">
6822
- <fo:block-container height="{$height - 1}px" width="100%">
6823
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6824
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6825
- </xsl:if> -->
6826
- <fo:block> </fo:block></fo:block-container>
6827
- </fo:inline-container>
6828
- </fo:basic-link>
6918
+ <xsl:call-template name="insert_basic_link">
6919
+ <xsl:with-param name="element">
6920
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6921
+ <fo:inline-container inline-progression-dimension="100%">
6922
+ <fo:block-container height="{$height - 1}px" width="100%">
6923
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
6924
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
6925
+ </xsl:if> -->
6926
+ <fo:block> </fo:block></fo:block-container>
6927
+ </fo:inline-container>
6928
+ </fo:basic-link>
6929
+ </xsl:with-param>
6930
+ </xsl:call-template>
6829
6931
  </fo:block>
6830
6932
  </fo:block-container>
6831
6933
  </xsl:template>
@@ -8370,14 +8472,18 @@
8370
8472
  </xsl:template>
8371
8473
 
8372
8474
  <xsl:template match="*[local-name() = 'origin']">
8373
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8374
- <xsl:if test="normalize-space(@citeas) = ''">
8375
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8376
- </xsl:if>
8377
- <fo:inline xsl:use-attribute-sets="origin-style">
8378
- <xsl:apply-templates/>
8379
- </fo:inline>
8380
- </fo:basic-link>
8475
+ <xsl:call-template name="insert_basic_link">
8476
+ <xsl:with-param name="element">
8477
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8478
+ <xsl:if test="normalize-space(@citeas) = ''">
8479
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8480
+ </xsl:if>
8481
+ <fo:inline xsl:use-attribute-sets="origin-style">
8482
+ <xsl:apply-templates/>
8483
+ </fo:inline>
8484
+ </fo:basic-link>
8485
+ </xsl:with-param>
8486
+ </xsl:call-template>
8381
8487
  </xsl:template>
8382
8488
 
8383
8489
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8451,9 +8557,13 @@
8451
8557
  <xsl:if test="../*[local-name() = 'author']">
8452
8558
  <xsl:text>, </xsl:text>
8453
8559
  </xsl:if>
8454
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8455
- <xsl:apply-templates/>
8456
- </fo:basic-link>
8560
+ <xsl:call-template name="insert_basic_link">
8561
+ <xsl:with-param name="element">
8562
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8563
+ <xsl:apply-templates/>
8564
+ </fo:basic-link>
8565
+ </xsl:with-param>
8566
+ </xsl:call-template>
8457
8567
  </xsl:template>
8458
8568
 
8459
8569
  <xsl:template match="*[local-name() = 'author']">
@@ -8502,28 +8612,32 @@
8502
8612
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8503
8613
  <xsl:variable name="text" select="normalize-space()"/>
8504
8614
 
8505
- <fo:basic-link fox:alt-text="{@citeas}">
8506
- <xsl:if test="normalize-space(@citeas) = ''">
8507
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8508
- </xsl:if>
8509
- <xsl:if test="@type = 'inline'">
8615
+ <xsl:call-template name="insert_basic_link">
8616
+ <xsl:with-param name="element">
8617
+ <fo:basic-link fox:alt-text="{@citeas}">
8618
+ <xsl:if test="normalize-space(@citeas) = ''">
8619
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8620
+ </xsl:if>
8621
+ <xsl:if test="@type = 'inline'">
8510
8622
 
8511
- <xsl:attribute name="color">blue</xsl:attribute>
8512
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
8623
+ <xsl:attribute name="color">blue</xsl:attribute>
8624
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
8513
8625
 
8514
- </xsl:if>
8626
+ </xsl:if>
8515
8627
 
8516
- <xsl:choose>
8517
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8518
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8519
- </xsl:when>
8520
- <xsl:otherwise>
8521
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8522
- </xsl:otherwise>
8523
- </xsl:choose>
8628
+ <xsl:choose>
8629
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8630
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8631
+ </xsl:when>
8632
+ <xsl:otherwise>
8633
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8634
+ </xsl:otherwise>
8635
+ </xsl:choose>
8524
8636
 
8525
- <xsl:apply-templates/>
8526
- </fo:basic-link>
8637
+ <xsl:apply-templates/>
8638
+ </fo:basic-link>
8639
+ </xsl:with-param>
8640
+ </xsl:call-template>
8527
8641
 
8528
8642
  </fo:inline>
8529
8643
  </xsl:when>
@@ -8762,7 +8876,10 @@
8762
8876
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8763
8877
 
8764
8878
  <xsl:template name="setULLabel">
8765
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8879
+ <xsl:variable name="list_level__">
8880
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8881
+ </xsl:variable>
8882
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8766
8883
  <xsl:variable name="list_level">
8767
8884
  <xsl:choose>
8768
8885
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8895,9 +9012,11 @@
8895
9012
  </fo:block-container>
8896
9013
  </xsl:when>
8897
9014
  <xsl:otherwise>
8898
- <fo:block>
8899
- <xsl:apply-templates select="." mode="list"/>
8900
- </fo:block>
9015
+
9016
+ <fo:block>
9017
+ <xsl:apply-templates select="." mode="list"/>
9018
+ </fo:block>
9019
+
8901
9020
  </xsl:otherwise>
8902
9021
  </xsl:choose>
8903
9022
  </xsl:template>
@@ -9587,24 +9706,32 @@
9587
9706
  <xsl:for-each select="*[local-name() = 'tab']">
9588
9707
  <xsl:variable name="current_id" select="generate-id()"/>
9589
9708
  <fo:table-cell>
9590
- <fo:block>
9591
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9592
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9593
- <xsl:choose>
9594
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9595
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9596
- </xsl:choose>
9597
- </xsl:for-each>
9598
- </fo:basic-link>
9709
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9710
+ <xsl:call-template name="insert_basic_link">
9711
+ <xsl:with-param name="element">
9712
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9713
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9714
+ <xsl:choose>
9715
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9716
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9717
+ </xsl:choose>
9718
+ </xsl:for-each>
9719
+ </fo:basic-link>
9720
+ </xsl:with-param>
9721
+ </xsl:call-template>
9599
9722
  </fo:block>
9600
9723
  </fo:table-cell>
9601
9724
  </xsl:for-each>
9602
9725
  <!-- last column - for page numbers -->
9603
9726
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9604
9727
  <fo:block>
9605
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9606
- <fo:page-number-citation ref-id="{$target}"/>
9607
- </fo:basic-link>
9728
+ <xsl:call-template name="insert_basic_link">
9729
+ <xsl:with-param name="element">
9730
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9731
+ <fo:page-number-citation ref-id="{$target}"/>
9732
+ </fo:basic-link>
9733
+ </xsl:with-param>
9734
+ </xsl:call-template>
9608
9735
  </fo:block>
9609
9736
  </fo:table-cell>
9610
9737
  </xsl:template>
@@ -9646,6 +9773,27 @@
9646
9773
  <!-- End Table of Contents (ToC) processing -->
9647
9774
  <!-- =================== -->
9648
9775
 
9776
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9777
+ <xsl:template name="insert_basic_link">
9778
+ <xsl:param name="element"/>
9779
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9780
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9781
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9782
+ <xsl:choose>
9783
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9784
+ <xsl:copy-of select="$element_node"/>
9785
+ </xsl:when>
9786
+ <xsl:otherwise>
9787
+ <fo:inline>
9788
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9789
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9790
+ </xsl:for-each>
9791
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9792
+ </fo:inline>
9793
+ </xsl:otherwise>
9794
+ </xsl:choose>
9795
+ </xsl:template>
9796
+
9649
9797
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9650
9798
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9651
9799
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -1566,6 +1566,7 @@
1566
1566
  </xsl:attribute-set>
1567
1567
 
1568
1568
  <xsl:attribute-set name="xref-style">
1569
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1569
1570
 
1570
1571
  <xsl:attribute name="color">blue</xsl:attribute>
1571
1572
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -3559,9 +3560,13 @@
3559
3560
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3560
3561
  </xsl:if>
3561
3562
 
3562
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3563
- <xsl:value-of select="$current_fn_number_text"/>
3564
- </fo:basic-link>
3563
+ <xsl:call-template name="insert_basic_link">
3564
+ <xsl:with-param name="element">
3565
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3566
+ <xsl:value-of select="$current_fn_number_text"/>
3567
+ </fo:basic-link>
3568
+ </xsl:with-param>
3569
+ </xsl:call-template>
3565
3570
  </fo:inline>
3566
3571
  </xsl:variable>
3567
3572
 
@@ -3894,8 +3899,10 @@
3894
3899
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3895
3900
  <xsl:text> </xsl:text>
3896
3901
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3897
- <xsl:text/>
3898
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3902
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
3903
+ <xsl:text> </xsl:text>
3904
+ </xsl:if>
3905
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3899
3906
  </fo:block>
3900
3907
 
3901
3908
  </xsl:when> <!-- END: only one component -->
@@ -4388,8 +4395,18 @@
4388
4395
  </xsl:if>
4389
4396
  </xsl:template>
4390
4397
 
4391
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4392
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4398
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4399
+ <xsl:variable name="is_inline_element_after_where">
4400
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4401
+ </xsl:variable>
4402
+ <xsl:choose>
4403
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4404
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4405
+ </xsl:when>
4406
+ <xsl:otherwise>
4407
+ <xsl:apply-templates select="."/>
4408
+ </xsl:otherwise>
4409
+ </xsl:choose>
4393
4410
  </xsl:template>
4394
4411
 
4395
4412
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -5889,6 +5906,79 @@
5889
5906
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5890
5907
  </xsl:template>
5891
5908
 
5909
+ <!-- special case for:
5910
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5911
+ <mstyle displaystyle="true">
5912
+ <msup>
5913
+ <mi color="#00000000">C</mi>
5914
+ <mtext>R</mtext>
5915
+ </msup>
5916
+ <msubsup>
5917
+ <mtext>C</mtext>
5918
+ <mi>n</mi>
5919
+ <mi>k</mi>
5920
+ </msubsup>
5921
+ </mstyle>
5922
+ </math>
5923
+ -->
5924
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
5925
+ <xsl:copy>
5926
+ <xsl:copy-of select="@*"/>
5927
+ <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"/>
5928
+ <xsl:if test="string-length($next_mtext) != ''">
5929
+ <xsl:attribute name="color">#00000000</xsl:attribute>
5930
+ </xsl:if>
5931
+ <xsl:apply-templates/>
5932
+ <xsl:value-of select="$next_mtext"/>
5933
+ </xsl:copy>
5934
+ </xsl:template>
5935
+
5936
+ <!-- special case for:
5937
+ <msup>
5938
+ <mtext/>
5939
+ <mn>1</mn>
5940
+ </msup>
5941
+ convert to (add mspace after mtext and enclose them into mrow):
5942
+ <msup>
5943
+ <mrow>
5944
+ <mtext/>
5945
+ <mspace height="1.47ex"/>
5946
+ </mrow>
5947
+ <mn>1</mn>
5948
+ </msup>
5949
+ -->
5950
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
5951
+ <mathml:mrow>
5952
+ <xsl:copy-of select="."/>
5953
+ <mathml:mspace height="1.47ex"/>
5954
+ </mathml:mrow>
5955
+ </xsl:template>
5956
+
5957
+ <!-- add space around vertical line -->
5958
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
5959
+ <xsl:copy>
5960
+ <xsl:apply-templates select="@*" mode="mathml"/>
5961
+ <xsl:if test="not(@lspace)">
5962
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
5963
+ </xsl:if>
5964
+ <xsl:if test="not(@rspace)">
5965
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
5966
+ </xsl:if>
5967
+ <xsl:apply-templates mode="mathml"/>
5968
+ </xsl:copy>
5969
+ </xsl:template>
5970
+
5971
+ <!-- decrease fontsize for 'Circled Times' char -->
5972
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
5973
+ <xsl:copy>
5974
+ <xsl:apply-templates select="@*" mode="mathml"/>
5975
+ <xsl:if test="not(@fontsize)">
5976
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
5977
+ </xsl:if>
5978
+ <xsl:apply-templates mode="mathml"/>
5979
+ </xsl:copy>
5980
+ </xsl:template>
5981
+
5892
5982
  <!-- Examples:
5893
5983
  <stem type="AsciiMath">x = 1</stem>
5894
5984
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5946,19 +6036,23 @@
5946
6036
  <xsl:apply-templates/>
5947
6037
  </xsl:when>
5948
6038
  <xsl:otherwise>
5949
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5950
- <xsl:choose>
5951
- <xsl:when test="normalize-space(.) = ''">
5952
- <xsl:call-template name="add-zero-spaces-link-java">
5953
- <xsl:with-param name="text" select="$target_text"/>
5954
- </xsl:call-template>
5955
- </xsl:when>
5956
- <xsl:otherwise>
5957
- <!-- output text from <link>text</link> -->
5958
- <xsl:apply-templates/>
5959
- </xsl:otherwise>
5960
- </xsl:choose>
5961
- </fo:basic-link>
6039
+ <xsl:call-template name="insert_basic_link">
6040
+ <xsl:with-param name="element">
6041
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6042
+ <xsl:choose>
6043
+ <xsl:when test="normalize-space(.) = ''">
6044
+ <xsl:call-template name="add-zero-spaces-link-java">
6045
+ <xsl:with-param name="text" select="$target_text"/>
6046
+ </xsl:call-template>
6047
+ </xsl:when>
6048
+ <xsl:otherwise>
6049
+ <!-- output text from <link>text</link> -->
6050
+ <xsl:apply-templates/>
6051
+ </xsl:otherwise>
6052
+ </xsl:choose>
6053
+ </fo:basic-link>
6054
+ </xsl:with-param>
6055
+ </xsl:call-template>
5962
6056
  </xsl:otherwise>
5963
6057
  </xsl:choose>
5964
6058
  </fo:inline>
@@ -6021,12 +6115,16 @@
6021
6115
  </xsl:template>
6022
6116
 
6023
6117
  <xsl:template match="*[local-name() = 'xref']">
6024
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6025
- <xsl:if test="parent::*[local-name() = 'add']">
6026
- <xsl:call-template name="append_add-style"/>
6027
- </xsl:if>
6028
- <xsl:apply-templates/>
6029
- </fo:basic-link>
6118
+ <xsl:call-template name="insert_basic_link">
6119
+ <xsl:with-param name="element">
6120
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6121
+ <xsl:if test="parent::*[local-name() = 'add']">
6122
+ <xsl:call-template name="append_add-style"/>
6123
+ </xsl:if>
6124
+ <xsl:apply-templates/>
6125
+ </fo:basic-link>
6126
+ </xsl:with-param>
6127
+ </xsl:call-template>
6030
6128
  </xsl:template>
6031
6129
 
6032
6130
  <!-- ====== -->
@@ -6409,7 +6507,7 @@
6409
6507
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6410
6508
  </xsl:when>
6411
6509
  <xsl:when test="not(starts-with(@src, 'data:'))">
6412
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6510
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6413
6511
  </xsl:when>
6414
6512
  <xsl:otherwise>
6415
6513
  <xsl:value-of select="@src"/>
@@ -6431,7 +6529,7 @@
6431
6529
  </xsl:when>
6432
6530
  <xsl:when test="not(starts-with(@src, 'data:'))">
6433
6531
  <xsl:variable name="src">
6434
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6532
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6435
6533
  </xsl:variable>
6436
6534
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6437
6535
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6817,15 +6915,19 @@
6817
6915
  <xsl:param name="dest"/>
6818
6916
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6819
6917
  <fo:block font-size="1pt">
6820
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6821
- <fo:inline-container inline-progression-dimension="100%">
6822
- <fo:block-container height="{$height - 1}px" width="100%">
6823
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6824
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6825
- </xsl:if> -->
6826
- <fo:block> </fo:block></fo:block-container>
6827
- </fo:inline-container>
6828
- </fo:basic-link>
6918
+ <xsl:call-template name="insert_basic_link">
6919
+ <xsl:with-param name="element">
6920
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6921
+ <fo:inline-container inline-progression-dimension="100%">
6922
+ <fo:block-container height="{$height - 1}px" width="100%">
6923
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
6924
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
6925
+ </xsl:if> -->
6926
+ <fo:block> </fo:block></fo:block-container>
6927
+ </fo:inline-container>
6928
+ </fo:basic-link>
6929
+ </xsl:with-param>
6930
+ </xsl:call-template>
6829
6931
  </fo:block>
6830
6932
  </fo:block-container>
6831
6933
  </xsl:template>
@@ -8370,14 +8472,18 @@
8370
8472
  </xsl:template>
8371
8473
 
8372
8474
  <xsl:template match="*[local-name() = 'origin']">
8373
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8374
- <xsl:if test="normalize-space(@citeas) = ''">
8375
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8376
- </xsl:if>
8377
- <fo:inline xsl:use-attribute-sets="origin-style">
8378
- <xsl:apply-templates/>
8379
- </fo:inline>
8380
- </fo:basic-link>
8475
+ <xsl:call-template name="insert_basic_link">
8476
+ <xsl:with-param name="element">
8477
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8478
+ <xsl:if test="normalize-space(@citeas) = ''">
8479
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8480
+ </xsl:if>
8481
+ <fo:inline xsl:use-attribute-sets="origin-style">
8482
+ <xsl:apply-templates/>
8483
+ </fo:inline>
8484
+ </fo:basic-link>
8485
+ </xsl:with-param>
8486
+ </xsl:call-template>
8381
8487
  </xsl:template>
8382
8488
 
8383
8489
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8451,9 +8557,13 @@
8451
8557
  <xsl:if test="../*[local-name() = 'author']">
8452
8558
  <xsl:text>, </xsl:text>
8453
8559
  </xsl:if>
8454
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8455
- <xsl:apply-templates/>
8456
- </fo:basic-link>
8560
+ <xsl:call-template name="insert_basic_link">
8561
+ <xsl:with-param name="element">
8562
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8563
+ <xsl:apply-templates/>
8564
+ </fo:basic-link>
8565
+ </xsl:with-param>
8566
+ </xsl:call-template>
8457
8567
  </xsl:template>
8458
8568
 
8459
8569
  <xsl:template match="*[local-name() = 'author']">
@@ -8502,28 +8612,32 @@
8502
8612
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8503
8613
  <xsl:variable name="text" select="normalize-space()"/>
8504
8614
 
8505
- <fo:basic-link fox:alt-text="{@citeas}">
8506
- <xsl:if test="normalize-space(@citeas) = ''">
8507
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8508
- </xsl:if>
8509
- <xsl:if test="@type = 'inline'">
8615
+ <xsl:call-template name="insert_basic_link">
8616
+ <xsl:with-param name="element">
8617
+ <fo:basic-link fox:alt-text="{@citeas}">
8618
+ <xsl:if test="normalize-space(@citeas) = ''">
8619
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8620
+ </xsl:if>
8621
+ <xsl:if test="@type = 'inline'">
8510
8622
 
8511
- <xsl:attribute name="color">blue</xsl:attribute>
8512
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
8623
+ <xsl:attribute name="color">blue</xsl:attribute>
8624
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
8513
8625
 
8514
- </xsl:if>
8626
+ </xsl:if>
8515
8627
 
8516
- <xsl:choose>
8517
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8518
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8519
- </xsl:when>
8520
- <xsl:otherwise>
8521
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8522
- </xsl:otherwise>
8523
- </xsl:choose>
8628
+ <xsl:choose>
8629
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8630
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8631
+ </xsl:when>
8632
+ <xsl:otherwise>
8633
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8634
+ </xsl:otherwise>
8635
+ </xsl:choose>
8524
8636
 
8525
- <xsl:apply-templates/>
8526
- </fo:basic-link>
8637
+ <xsl:apply-templates/>
8638
+ </fo:basic-link>
8639
+ </xsl:with-param>
8640
+ </xsl:call-template>
8527
8641
 
8528
8642
  </fo:inline>
8529
8643
  </xsl:when>
@@ -8762,7 +8876,10 @@
8762
8876
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8763
8877
 
8764
8878
  <xsl:template name="setULLabel">
8765
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8879
+ <xsl:variable name="list_level__">
8880
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8881
+ </xsl:variable>
8882
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8766
8883
  <xsl:variable name="list_level">
8767
8884
  <xsl:choose>
8768
8885
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8895,9 +9012,11 @@
8895
9012
  </fo:block-container>
8896
9013
  </xsl:when>
8897
9014
  <xsl:otherwise>
8898
- <fo:block>
8899
- <xsl:apply-templates select="." mode="list"/>
8900
- </fo:block>
9015
+
9016
+ <fo:block>
9017
+ <xsl:apply-templates select="." mode="list"/>
9018
+ </fo:block>
9019
+
8901
9020
  </xsl:otherwise>
8902
9021
  </xsl:choose>
8903
9022
  </xsl:template>
@@ -9587,24 +9706,32 @@
9587
9706
  <xsl:for-each select="*[local-name() = 'tab']">
9588
9707
  <xsl:variable name="current_id" select="generate-id()"/>
9589
9708
  <fo:table-cell>
9590
- <fo:block>
9591
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9592
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9593
- <xsl:choose>
9594
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9595
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9596
- </xsl:choose>
9597
- </xsl:for-each>
9598
- </fo:basic-link>
9709
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9710
+ <xsl:call-template name="insert_basic_link">
9711
+ <xsl:with-param name="element">
9712
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9713
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9714
+ <xsl:choose>
9715
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9716
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9717
+ </xsl:choose>
9718
+ </xsl:for-each>
9719
+ </fo:basic-link>
9720
+ </xsl:with-param>
9721
+ </xsl:call-template>
9599
9722
  </fo:block>
9600
9723
  </fo:table-cell>
9601
9724
  </xsl:for-each>
9602
9725
  <!-- last column - for page numbers -->
9603
9726
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9604
9727
  <fo:block>
9605
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9606
- <fo:page-number-citation ref-id="{$target}"/>
9607
- </fo:basic-link>
9728
+ <xsl:call-template name="insert_basic_link">
9729
+ <xsl:with-param name="element">
9730
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9731
+ <fo:page-number-citation ref-id="{$target}"/>
9732
+ </fo:basic-link>
9733
+ </xsl:with-param>
9734
+ </xsl:call-template>
9608
9735
  </fo:block>
9609
9736
  </fo:table-cell>
9610
9737
  </xsl:template>
@@ -9646,6 +9773,27 @@
9646
9773
  <!-- End Table of Contents (ToC) processing -->
9647
9774
  <!-- =================== -->
9648
9775
 
9776
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9777
+ <xsl:template name="insert_basic_link">
9778
+ <xsl:param name="element"/>
9779
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9780
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9781
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9782
+ <xsl:choose>
9783
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9784
+ <xsl:copy-of select="$element_node"/>
9785
+ </xsl:when>
9786
+ <xsl:otherwise>
9787
+ <fo:inline>
9788
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9789
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9790
+ </xsl:for-each>
9791
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9792
+ </fo:inline>
9793
+ </xsl:otherwise>
9794
+ </xsl:choose>
9795
+ </xsl:template>
9796
+
9649
9797
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9650
9798
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9651
9799
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -14,10 +14,24 @@ module IsoDoc
14
14
  "[#{ordinal}]<tab/>"
15
15
  end
16
16
 
17
- def biblio_ref_entry_code(ordinal, _idents, _ids, _standard, _datefn, _bib)
17
+ def biblio_ref_entry_code(ordinal, _idents, _ids, _standard, _datefn,
18
+ _bib)
18
19
  "[#{ordinal}]<tab/>"
19
20
  end
20
21
 
22
+ def preface_rearrange(doc)
23
+ preface_move(doc.at(ns("//preface/abstract")),
24
+ %w(foreword executivesummary introduction clause acknowledgements), doc)
25
+ preface_move(doc.at(ns("//preface/foreword")),
26
+ %w(executivesummary introduction clause acknowledgements), doc)
27
+ preface_move(doc.at(ns("//preface/executivesummary")),
28
+ %w(introduction clause acknowledgements), doc)
29
+ preface_move(doc.at(ns("//preface/introduction")),
30
+ %w(clause acknowledgements), doc)
31
+ preface_move(doc.at(ns("//preface/acknowledgements")),
32
+ %w(), doc)
33
+ end
34
+
21
35
  include Init
22
36
  end
23
37
  end
@@ -12,32 +12,32 @@ module IsoDoc
12
12
  end
13
13
 
14
14
  def make_body1(body, _docxml)
15
- body.div **{ class: "WordSection1" } do |div1|
16
- div1.p **{style: "font-size:0pt;" } do
17
- |p| p << "&nbsp;"
15
+ body.div class: "WordSection1" do |div1|
16
+ div1.p style: "font-size:0pt;" do |p|
17
+ p << "&nbsp;"
18
18
  end # placeholder
19
19
  end
20
20
  section_break(body)
21
21
  end
22
22
 
23
- def make_body2(body, docxml)
24
- body.div **{ class: "WordSection2" } do |div2|
25
- boilerplate docxml, div2
26
- preface_block docxml, div2
27
- abstract docxml, div2
28
- foreword docxml, div2
29
- introduction docxml, div2
30
- preface docxml, div2
31
- acknowledgements docxml, div2
32
- div2.p { |p| p << "&nbsp;" } # placeholder
33
- end
34
- section_break(body)
35
- end
23
+ # def make_body2(body, docxml)
24
+ # body.div **{ class: "WordSection2" } do |div2|
25
+ # boilerplate docxml, div2
26
+ # preface_block docxml, div2
27
+ # abstract docxml, div2
28
+ # foreword docxml, div2
29
+ # introduction docxml, div2
30
+ # preface docxml, div2
31
+ # acknowledgements docxml, div2
32
+ # div2.p { |p| p << "&nbsp;" } # placeholder
33
+ # end
34
+ # section_break(body)
35
+ # end
36
36
 
37
37
  def authority_cleanup(docxml)
38
38
  super
39
39
  docxml.xpath("//div[@class = 'boilerplate-feedback']/p").each do |p|
40
- p["style"] = 'font-size:8pt;font-family:Arial;text-align:right'
40
+ p["style"] = "font-size:8pt;font-family:Arial;text-align:right"
41
41
  end
42
42
  end
43
43
 
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.org/ns/iho" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
+ <grammar ns='https://www.metanorma.org/ns/iho' xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
3
  <!--
4
+ VERSION v1.2.1
4
5
  Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
6
  we cannot have a new default namespace: we will end up with a grammar with two different
6
7
  namespaces, one for isostandard and one for csand additions. And we do not want that.
@@ -63,13 +64,7 @@
63
64
  </define>
64
65
  <define name="iho-standard">
65
66
  <element name="iho-standard">
66
- <attribute name="version"/>
67
- <attribute name="type">
68
- <choice>
69
- <value>semantic</value>
70
- <value>presentation</value>
71
- </choice>
72
- </attribute>
67
+ <ref name="Root-Attributes"/>
73
68
  <ref name="bibdata"/>
74
69
  <zeroOrMore>
75
70
  <ref name="termdocsource"/>
@@ -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,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.7.8".freeze
3
+ VERSION = "0.7.9".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
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-generic