metanorma-itu 2.2.9 → 2.2.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1644,19 +1644,23 @@
1644
1644
  <xsl:variable name="bibitemid" select="../itu:termsource/itu:origin/@bibitemid"/>
1645
1645
  <xsl:variable name="origin_text" select="normalize-space(../itu:termsource/itu:origin/text())"/>
1646
1646
 
1647
- <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
1648
- <xsl:choose>
1649
- <xsl:when test="$origin_text != ''">
1650
- <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
1651
- </xsl:when>
1652
- <xsl:when test="contains($citeas, '[')">
1653
- <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1654
- </xsl:when>
1655
- <xsl:otherwise>
1656
- <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1657
- </xsl:otherwise>
1658
- </xsl:choose>
1659
- </fo:basic-link>
1647
+ <xsl:call-template name="insert_basic_link">
1648
+ <xsl:with-param name="element">
1649
+ <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
1650
+ <xsl:choose>
1651
+ <xsl:when test="$origin_text != ''">
1652
+ <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
1653
+ </xsl:when>
1654
+ <xsl:when test="contains($citeas, '[')">
1655
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
1656
+ </xsl:when>
1657
+ <xsl:otherwise>
1658
+ <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1659
+ </xsl:otherwise>
1660
+ </xsl:choose>
1661
+ </fo:basic-link>
1662
+ </xsl:with-param>
1663
+ </xsl:call-template>
1660
1664
  </xsl:if>
1661
1665
  <xsl:if test="following-sibling::itu:definition/node()">
1662
1666
  <xsl:text>: </xsl:text>
@@ -2809,6 +2813,7 @@
2809
2813
  </xsl:attribute-set>
2810
2814
 
2811
2815
  <xsl:attribute-set name="xref-style">
2816
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
2812
2817
 
2813
2818
  <xsl:attribute name="color">blue</xsl:attribute>
2814
2819
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -4860,9 +4865,13 @@
4860
4865
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4861
4866
  </xsl:if>
4862
4867
 
4863
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4864
- <xsl:value-of select="$current_fn_number_text"/>
4865
- </fo:basic-link>
4868
+ <xsl:call-template name="insert_basic_link">
4869
+ <xsl:with-param name="element">
4870
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4871
+ <xsl:value-of select="$current_fn_number_text"/>
4872
+ </fo:basic-link>
4873
+ </xsl:with-param>
4874
+ </xsl:call-template>
4866
4875
  </fo:inline>
4867
4876
  </xsl:variable>
4868
4877
 
@@ -5205,8 +5214,10 @@
5205
5214
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
5206
5215
  <xsl:text> </xsl:text>
5207
5216
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
5208
- <xsl:text/>
5209
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
5217
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
5218
+ <xsl:text> </xsl:text>
5219
+ </xsl:if>
5220
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
5210
5221
  </fo:block>
5211
5222
 
5212
5223
  </xsl:when> <!-- END: only one component -->
@@ -5709,8 +5720,18 @@
5709
5720
  </xsl:if>
5710
5721
  </xsl:template>
5711
5722
 
5712
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
5713
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5723
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
5724
+ <xsl:variable name="is_inline_element_after_where">
5725
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
5726
+ </xsl:variable>
5727
+ <xsl:choose>
5728
+ <xsl:when test="$is_inline_element_after_where = 'true'">
5729
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
5730
+ </xsl:when>
5731
+ <xsl:otherwise>
5732
+ <xsl:apply-templates select="."/>
5733
+ </xsl:otherwise>
5734
+ </xsl:choose>
5714
5735
  </xsl:template>
5715
5736
 
5716
5737
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -7138,6 +7159,79 @@
7138
7159
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
7139
7160
  </xsl:template>
7140
7161
 
7162
+ <!-- special case for:
7163
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7164
+ <mstyle displaystyle="true">
7165
+ <msup>
7166
+ <mi color="#00000000">C</mi>
7167
+ <mtext>R</mtext>
7168
+ </msup>
7169
+ <msubsup>
7170
+ <mtext>C</mtext>
7171
+ <mi>n</mi>
7172
+ <mi>k</mi>
7173
+ </msubsup>
7174
+ </mstyle>
7175
+ </math>
7176
+ -->
7177
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
7178
+ <xsl:copy>
7179
+ <xsl:copy-of select="@*"/>
7180
+ <xsl:variable name="next_mtext" select="ancestor::mathml:msup/following-sibling::*[1][self::mathml:msubsup or self::mathml:msub or self::mathml:msup]/mathml:mtext"/>
7181
+ <xsl:if test="string-length($next_mtext) != ''">
7182
+ <xsl:attribute name="color">#00000000</xsl:attribute>
7183
+ </xsl:if>
7184
+ <xsl:apply-templates/>
7185
+ <xsl:value-of select="$next_mtext"/>
7186
+ </xsl:copy>
7187
+ </xsl:template>
7188
+
7189
+ <!-- special case for:
7190
+ <msup>
7191
+ <mtext/>
7192
+ <mn>1</mn>
7193
+ </msup>
7194
+ convert to (add mspace after mtext and enclose them into mrow):
7195
+ <msup>
7196
+ <mrow>
7197
+ <mtext/>
7198
+ <mspace height="1.47ex"/>
7199
+ </mrow>
7200
+ <mn>1</mn>
7201
+ </msup>
7202
+ -->
7203
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
7204
+ <mathml:mrow>
7205
+ <xsl:copy-of select="."/>
7206
+ <mathml:mspace height="1.47ex"/>
7207
+ </mathml:mrow>
7208
+ </xsl:template>
7209
+
7210
+ <!-- add space around vertical line -->
7211
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
7212
+ <xsl:copy>
7213
+ <xsl:apply-templates select="@*" mode="mathml"/>
7214
+ <xsl:if test="not(@lspace)">
7215
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
7216
+ </xsl:if>
7217
+ <xsl:if test="not(@rspace)">
7218
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
7219
+ </xsl:if>
7220
+ <xsl:apply-templates mode="mathml"/>
7221
+ </xsl:copy>
7222
+ </xsl:template>
7223
+
7224
+ <!-- decrease fontsize for 'Circled Times' char -->
7225
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
7226
+ <xsl:copy>
7227
+ <xsl:apply-templates select="@*" mode="mathml"/>
7228
+ <xsl:if test="not(@fontsize)">
7229
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
7230
+ </xsl:if>
7231
+ <xsl:apply-templates mode="mathml"/>
7232
+ </xsl:copy>
7233
+ </xsl:template>
7234
+
7141
7235
  <!-- Examples:
7142
7236
  <stem type="AsciiMath">x = 1</stem>
7143
7237
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7195,19 +7289,23 @@
7195
7289
  <xsl:apply-templates/>
7196
7290
  </xsl:when>
7197
7291
  <xsl:otherwise>
7198
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7199
- <xsl:choose>
7200
- <xsl:when test="normalize-space(.) = ''">
7201
- <xsl:call-template name="add-zero-spaces-link-java">
7202
- <xsl:with-param name="text" select="$target_text"/>
7203
- </xsl:call-template>
7204
- </xsl:when>
7205
- <xsl:otherwise>
7206
- <!-- output text from <link>text</link> -->
7207
- <xsl:apply-templates/>
7208
- </xsl:otherwise>
7209
- </xsl:choose>
7210
- </fo:basic-link>
7292
+ <xsl:call-template name="insert_basic_link">
7293
+ <xsl:with-param name="element">
7294
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7295
+ <xsl:choose>
7296
+ <xsl:when test="normalize-space(.) = ''">
7297
+ <xsl:call-template name="add-zero-spaces-link-java">
7298
+ <xsl:with-param name="text" select="$target_text"/>
7299
+ </xsl:call-template>
7300
+ </xsl:when>
7301
+ <xsl:otherwise>
7302
+ <!-- output text from <link>text</link> -->
7303
+ <xsl:apply-templates/>
7304
+ </xsl:otherwise>
7305
+ </xsl:choose>
7306
+ </fo:basic-link>
7307
+ </xsl:with-param>
7308
+ </xsl:call-template>
7211
7309
  </xsl:otherwise>
7212
7310
  </xsl:choose>
7213
7311
  </fo:inline>
@@ -7270,12 +7368,16 @@
7270
7368
  </xsl:template>
7271
7369
 
7272
7370
  <xsl:template match="*[local-name() = 'xref']">
7273
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7274
- <xsl:if test="parent::*[local-name() = 'add']">
7275
- <xsl:call-template name="append_add-style"/>
7276
- </xsl:if>
7277
- <xsl:apply-templates/>
7278
- </fo:basic-link>
7371
+ <xsl:call-template name="insert_basic_link">
7372
+ <xsl:with-param name="element">
7373
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
7374
+ <xsl:if test="parent::*[local-name() = 'add']">
7375
+ <xsl:call-template name="append_add-style"/>
7376
+ </xsl:if>
7377
+ <xsl:apply-templates/>
7378
+ </fo:basic-link>
7379
+ </xsl:with-param>
7380
+ </xsl:call-template>
7279
7381
  </xsl:template>
7280
7382
 
7281
7383
  <!-- ====== -->
@@ -7664,7 +7766,7 @@
7664
7766
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7665
7767
  </xsl:when>
7666
7768
  <xsl:when test="not(starts-with(@src, 'data:'))">
7667
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7769
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7668
7770
  </xsl:when>
7669
7771
  <xsl:otherwise>
7670
7772
  <xsl:value-of select="@src"/>
@@ -7686,7 +7788,7 @@
7686
7788
  </xsl:when>
7687
7789
  <xsl:when test="not(starts-with(@src, 'data:'))">
7688
7790
  <xsl:variable name="src">
7689
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7791
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7690
7792
  </xsl:variable>
7691
7793
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7692
7794
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -8072,15 +8174,19 @@
8072
8174
  <xsl:param name="dest"/>
8073
8175
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
8074
8176
  <fo:block font-size="1pt">
8075
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8076
- <fo:inline-container inline-progression-dimension="100%">
8077
- <fo:block-container height="{$height - 1}px" width="100%">
8078
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
8079
- <xsl:attribute name="background-color">magenta</xsl:attribute>
8080
- </xsl:if> -->
8081
- <fo:block> </fo:block></fo:block-container>
8082
- </fo:inline-container>
8083
- </fo:basic-link>
8177
+ <xsl:call-template name="insert_basic_link">
8178
+ <xsl:with-param name="element">
8179
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
8180
+ <fo:inline-container inline-progression-dimension="100%">
8181
+ <fo:block-container height="{$height - 1}px" width="100%">
8182
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
8183
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
8184
+ </xsl:if> -->
8185
+ <fo:block> </fo:block></fo:block-container>
8186
+ </fo:inline-container>
8187
+ </fo:basic-link>
8188
+ </xsl:with-param>
8189
+ </xsl:call-template>
8084
8190
  </fo:block>
8085
8191
  </fo:block-container>
8086
8192
  </xsl:template>
@@ -9626,14 +9732,18 @@
9626
9732
  </xsl:template>
9627
9733
 
9628
9734
  <xsl:template match="*[local-name() = 'origin']">
9629
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9630
- <xsl:if test="normalize-space(@citeas) = ''">
9631
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9632
- </xsl:if>
9633
- <fo:inline xsl:use-attribute-sets="origin-style">
9634
- <xsl:apply-templates/>
9635
- </fo:inline>
9636
- </fo:basic-link>
9735
+ <xsl:call-template name="insert_basic_link">
9736
+ <xsl:with-param name="element">
9737
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9738
+ <xsl:if test="normalize-space(@citeas) = ''">
9739
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9740
+ </xsl:if>
9741
+ <fo:inline xsl:use-attribute-sets="origin-style">
9742
+ <xsl:apply-templates/>
9743
+ </fo:inline>
9744
+ </fo:basic-link>
9745
+ </xsl:with-param>
9746
+ </xsl:call-template>
9637
9747
  </xsl:template>
9638
9748
 
9639
9749
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -9707,9 +9817,13 @@
9707
9817
  <xsl:if test="../*[local-name() = 'author']">
9708
9818
  <xsl:text>, </xsl:text>
9709
9819
  </xsl:if>
9710
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9711
- <xsl:apply-templates/>
9712
- </fo:basic-link>
9820
+ <xsl:call-template name="insert_basic_link">
9821
+ <xsl:with-param name="element">
9822
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
9823
+ <xsl:apply-templates/>
9824
+ </fo:basic-link>
9825
+ </xsl:with-param>
9826
+ </xsl:call-template>
9713
9827
  </xsl:template>
9714
9828
 
9715
9829
  <xsl:template match="*[local-name() = 'author']">
@@ -9758,25 +9872,29 @@
9758
9872
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
9759
9873
  <xsl:variable name="text" select="normalize-space()"/>
9760
9874
 
9761
- <fo:basic-link fox:alt-text="{@citeas}">
9762
- <xsl:if test="normalize-space(@citeas) = ''">
9763
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9764
- </xsl:if>
9765
- <xsl:if test="@type = 'inline'">
9875
+ <xsl:call-template name="insert_basic_link">
9876
+ <xsl:with-param name="element">
9877
+ <fo:basic-link fox:alt-text="{@citeas}">
9878
+ <xsl:if test="normalize-space(@citeas) = ''">
9879
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
9880
+ </xsl:if>
9881
+ <xsl:if test="@type = 'inline'">
9766
9882
 
9767
- </xsl:if>
9883
+ </xsl:if>
9768
9884
 
9769
- <xsl:choose>
9770
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9771
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9772
- </xsl:when>
9773
- <xsl:otherwise>
9774
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9775
- </xsl:otherwise>
9776
- </xsl:choose>
9885
+ <xsl:choose>
9886
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
9887
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
9888
+ </xsl:when>
9889
+ <xsl:otherwise>
9890
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
9891
+ </xsl:otherwise>
9892
+ </xsl:choose>
9777
9893
 
9778
- <xsl:apply-templates/>
9779
- </fo:basic-link>
9894
+ <xsl:apply-templates/>
9895
+ </fo:basic-link>
9896
+ </xsl:with-param>
9897
+ </xsl:call-template>
9780
9898
 
9781
9899
  </fo:inline>
9782
9900
  </xsl:when>
@@ -10027,7 +10145,10 @@
10027
10145
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
10028
10146
 
10029
10147
  <xsl:template name="setULLabel">
10030
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10148
+ <xsl:variable name="list_level__">
10149
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
10150
+ </xsl:variable>
10151
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
10031
10152
  <xsl:variable name="list_level">
10032
10153
  <xsl:choose>
10033
10154
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -10160,9 +10281,11 @@
10160
10281
  </fo:block-container>
10161
10282
  </xsl:when>
10162
10283
  <xsl:otherwise>
10163
- <fo:block>
10164
- <xsl:apply-templates select="." mode="list"/>
10165
- </fo:block>
10284
+
10285
+ <fo:block>
10286
+ <xsl:apply-templates select="." mode="list"/>
10287
+ </fo:block>
10288
+
10166
10289
  </xsl:otherwise>
10167
10290
  </xsl:choose>
10168
10291
  </xsl:template>
@@ -10874,24 +10997,32 @@
10874
10997
  <xsl:for-each select="*[local-name() = 'tab']">
10875
10998
  <xsl:variable name="current_id" select="generate-id()"/>
10876
10999
  <fo:table-cell>
10877
- <fo:block>
10878
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10879
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
10880
- <xsl:choose>
10881
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
10882
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
10883
- </xsl:choose>
10884
- </xsl:for-each>
10885
- </fo:basic-link>
11000
+ <fo:block line-height-shift-adjustment="disregard-shifts">
11001
+ <xsl:call-template name="insert_basic_link">
11002
+ <xsl:with-param name="element">
11003
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11004
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11005
+ <xsl:choose>
11006
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11007
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11008
+ </xsl:choose>
11009
+ </xsl:for-each>
11010
+ </fo:basic-link>
11011
+ </xsl:with-param>
11012
+ </xsl:call-template>
10886
11013
  </fo:block>
10887
11014
  </fo:table-cell>
10888
11015
  </xsl:for-each>
10889
11016
  <!-- last column - for page numbers -->
10890
11017
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
10891
11018
  <fo:block>
10892
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
10893
- <fo:page-number-citation ref-id="{$target}"/>
10894
- </fo:basic-link>
11019
+ <xsl:call-template name="insert_basic_link">
11020
+ <xsl:with-param name="element">
11021
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11022
+ <fo:page-number-citation ref-id="{$target}"/>
11023
+ </fo:basic-link>
11024
+ </xsl:with-param>
11025
+ </xsl:call-template>
10895
11026
  </fo:block>
10896
11027
  </fo:table-cell>
10897
11028
  </xsl:template>
@@ -10933,6 +11064,27 @@
10933
11064
  <!-- End Table of Contents (ToC) processing -->
10934
11065
  <!-- =================== -->
10935
11066
 
11067
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
11068
+ <xsl:template name="insert_basic_link">
11069
+ <xsl:param name="element"/>
11070
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
11071
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
11072
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
11073
+ <xsl:choose>
11074
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
11075
+ <xsl:copy-of select="$element_node"/>
11076
+ </xsl:when>
11077
+ <xsl:otherwise>
11078
+ <fo:inline>
11079
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
11080
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
11081
+ </xsl:for-each>
11082
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
11083
+ </fo:inline>
11084
+ </xsl:otherwise>
11085
+ </xsl:choose>
11086
+ </xsl:template>
11087
+
10936
11088
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
10937
11089
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
10938
11090
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -195,6 +195,12 @@ module IsoDoc
195
195
  ret.gsub(/-/, "&#x2011;").gsub(/ /, "&#xa0;")
196
196
  end
197
197
 
198
+ def toc_title(docxml)
199
+ doctype = docxml.at(ns("//bibdata/ext/doctype"))
200
+ doctype&.text == "resolution" and return
201
+ super
202
+ end
203
+
198
204
  include Init
199
205
  end
200
206
  end
@@ -22,24 +22,28 @@ module IsoDoc
22
22
  end
23
23
 
24
24
  def make_body2(body, docxml)
25
- body.div **{ class: "WordSection2" } do |div2|
25
+ body.div class: "WordSection2" do |div2|
26
26
  info docxml, div2
27
27
  boilerplate docxml, div2
28
- preface_block docxml, div2
29
- abstract docxml, div2
30
- keywords docxml, div2
31
- preface docxml, div2
28
+ front docxml, div2
32
29
  div2.p { |p| p << "&#xa0;" } # placeholder
33
30
  end
34
31
  section_break(body)
35
32
  end
36
33
 
37
- def abstract(isoxml, out)
38
- f = isoxml.at(ns("//preface/abstract")) || return
39
- out.div **attr_code(id: f["id"], class: "Abstract") do |s|
40
- clause_name(f, "Summary", s, class: "AbstractTitle")
41
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
34
+ def front(isoxml, out)
35
+ if !isoxml.at(ns("//preface/abstract"))
36
+ keywords(isoxml, out)
42
37
  end
38
+ super # do keyword with abstract
39
+ end
40
+
41
+ def abstract(clause, out)
42
+ out.div **attr_code(id: clause["id"], class: "Abstract") do |s|
43
+ clause_name(clause, "Summary", s, class: "AbstractTitle")
44
+ clause.elements.each { |e| parse(e, s) unless e.name == "title" }
45
+ end
46
+ keywords(nil, out)
43
47
  end
44
48
 
45
49
  def keywords(_docxml, out)
@@ -47,7 +51,7 @@ module IsoDoc
47
51
  kw.nil? || kw.empty? and return
48
52
  out.div **attr_code(class: "Keyword") do |div|
49
53
  clause_name(nil, "Keywords", div, class: "IntroTitle")
50
- div.p kw.join(", ") + "."
54
+ div.p "#{kw.join(', ')}."
51
55
  end
52
56
  end
53
57
 
@@ -127,6 +131,24 @@ module IsoDoc
127
131
  super.merge(ret)
128
132
  end
129
133
 
134
+ def table_of_contents(clause, out)
135
+ page_break(out)
136
+ out.div **attr_code(preface_attrs(clause)) do |div|
137
+ div.p class: "zzContents" do |p|
138
+ clause.at(ns("./title"))&.children&.each do |c|
139
+ parse(c, p)
140
+ end
141
+ end
142
+ div.p style: "tab-stops:right 17.0cm" do |p|
143
+ insert_tab(p, 1)
144
+ p << "<b>#{@i18n.page}</b>"
145
+ end
146
+ clause.elements.each do |e|
147
+ parse(e, div) unless e.name == "title"
148
+ end
149
+ end
150
+ end
151
+
130
152
  include BaseConvert
131
153
  include Init
132
154
  end
@@ -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,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.org/ns/itu" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
+ <grammar ns='https://www.metanorma.org/ns/itu' 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.
@@ -101,13 +102,7 @@
101
102
  </include>
102
103
  <define name="itu">
103
104
  <element name="itu-standard">
104
- <attribute name="version"/>
105
- <attribute name="type">
106
- <choice>
107
- <value>semantic</value>
108
- <value>presentation</value>
109
- </choice>
110
- </attribute>
105
+ <ref name="Root-Attributes"/>
111
106
  <ref name="bibdata"/>
112
107
  <zeroOrMore>
113
108
  <ref name="termdocsource"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.2.9".freeze
3
+ VERSION = "2.2.10".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.9
4
+ version: 2.2.10
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: htmlentities