metanorma-iec 2.5.6 → 2.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -221,6 +221,12 @@
221
221
  <xsl:with-param name="contents" select="$contents"/>
222
222
  </xsl:call-template>
223
223
 
224
+ <xsl:if test="$debug = 'true'">
225
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
226
+ <xsl:copy-of select="$contents"/>
227
+ </redirect:write>
228
+ </xsl:if>
229
+
224
230
  <!-- For 'Published' documents insert two cover pages -->
225
231
  <xsl:if test="$stage &gt;= 60">
226
232
 
@@ -868,12 +874,6 @@
868
874
  </fo:page-sequence> <!-- END: cover-FDIS -->
869
875
  </xsl:if>
870
876
 
871
- <!-- <xsl:if test="$debug = 'true'">
872
- <redirect:write file="contents_{java:getTime(java:java.util.Date.new())}.xml">
873
- <xsl:copy-of select="$contents"/>
874
- </redirect:write>
875
- </xsl:if> -->
876
-
877
877
  <xsl:for-each select="//iec:iec-standard">
878
878
  <xsl:variable name="lang" select="*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
879
879
  <xsl:variable name="current_document">
@@ -1591,10 +1591,10 @@
1591
1591
  <!-- ============================= -->
1592
1592
 
1593
1593
  <!-- element with title -->
1594
- <xsl:template match="*[iec:title]" mode="contents">
1594
+ <xsl:template match="*[iec:title or iec:fmt-title]" mode="contents">
1595
1595
  <xsl:variable name="level">
1596
1596
  <xsl:call-template name="getLevel">
1597
- <xsl:with-param name="depth" select="iec:title/@depth"/>
1597
+ <xsl:with-param name="depth" select="iec:fmt-title/@depth | iec:title/@depth"/>
1598
1598
  </xsl:call-template>
1599
1599
  </xsl:variable>
1600
1600
 
@@ -1649,7 +1649,14 @@
1649
1649
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title))"/>
1650
1650
  </xsl:when>
1651
1651
  <xsl:when test="$type = 'appendix'">
1652
- <xsl:apply-templates select="iec:title" mode="contents_item"/>
1652
+ <xsl:choose>
1653
+ <xsl:when test="iec:fmt-title">
1654
+ <xsl:apply-templates select="iec:fmt-title" mode="contents_item"/>
1655
+ </xsl:when>
1656
+ <xsl:otherwise>
1657
+ <xsl:apply-templates select="iec:title" mode="contents_item"/>
1658
+ </xsl:otherwise>
1659
+ </xsl:choose>
1653
1660
  </xsl:when>
1654
1661
  <xsl:otherwise>
1655
1662
  <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
@@ -2163,7 +2170,7 @@
2163
2170
  </xsl:copy>
2164
2171
  </xsl:template> -->
2165
2172
 
2166
- <xsl:strip-space elements="iec:xref"/>
2173
+ <!-- <xsl:strip-space elements="iec:xref"/> -->
2167
2174
 
2168
2175
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
2169
2176
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
@@ -3183,6 +3190,10 @@
3183
3190
 
3184
3191
  <xsl:template name="refine_termnote-name-style">
3185
3192
 
3193
+ <!-- <xsl:if test="$namespace = 'ieee'">
3194
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
3195
+ </xsl:if> -->
3196
+
3186
3197
  </xsl:template>
3187
3198
 
3188
3199
  <xsl:attribute-set name="termnote-p-style">
@@ -3895,9 +3906,21 @@
3895
3906
  <xsl:template name="processTables_Contents">
3896
3907
  <tables>
3897
3908
  <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3898
- <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3899
- <xsl:copy-of select="*[local-name() = 'name']"/>
3900
- </table>
3909
+ <xsl:choose>
3910
+ <xsl:when test="*[local-name() = 'fmt-name']">
3911
+ <xsl:variable name="fmt_name">
3912
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3913
+ </xsl:variable>
3914
+ <table id="{@id}" alt-text="{normalize-space($fmt_name)}">
3915
+ <xsl:copy-of select="$fmt_name"/>
3916
+ </table>
3917
+ </xsl:when>
3918
+ <xsl:otherwise>
3919
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3920
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3921
+ </table>
3922
+ </xsl:otherwise>
3923
+ </xsl:choose>
3901
3924
  </xsl:for-each>
3902
3925
  </tables>
3903
3926
  </xsl:template>
@@ -3905,9 +3928,21 @@
3905
3928
  <xsl:template name="processFigures_Contents">
3906
3929
  <figures>
3907
3930
  <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name'] and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(*[local-name() = 'name'], 'Figure ') and normalize-space(@id) != '']">
3908
- <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3909
- <xsl:copy-of select="*[local-name() = 'name']"/>
3910
- </figure>
3931
+ <xsl:choose>
3932
+ <xsl:when test="*[local-name() = 'fmt-name']">
3933
+ <xsl:variable name="fmt_name">
3934
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3935
+ </xsl:variable>
3936
+ <figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
3937
+ <xsl:copy-of select="$fmt_name"/>
3938
+ </figure>
3939
+ </xsl:when>
3940
+ <xsl:otherwise>
3941
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3942
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3943
+ </figure>
3944
+ </xsl:otherwise>
3945
+ </xsl:choose>
3911
3946
  </xsl:for-each>
3912
3947
  </figures>
3913
3948
  </xsl:template>
@@ -5804,6 +5839,11 @@
5804
5839
 
5805
5840
  <xsl:value-of select="@reference"/>
5806
5841
 
5842
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5843
+ <!-- <xsl:if test="$namespace = 'itu'">
5844
+ <xsl:text>)</xsl:text>
5845
+ </xsl:if> -->
5846
+
5807
5847
  </fo:inline>
5808
5848
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
5809
5849
  <xsl:copy-of select="./node()"/>
@@ -5813,7 +5853,7 @@
5813
5853
 
5814
5854
  </xsl:if>
5815
5855
  </xsl:for-each>
5816
- </xsl:template>
5856
+ </xsl:template> <!-- table_fn_display -->
5817
5857
 
5818
5858
  <xsl:template name="create_fn">
5819
5859
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -5841,8 +5881,10 @@
5841
5881
  <!-- EMD table's footnotes rendering -->
5842
5882
  <!-- ============================ -->
5843
5883
 
5884
+ <!-- ============================ -->
5844
5885
  <!-- figure's footnotes rendering -->
5845
- <xsl:template name="fn_display_figure">
5886
+ <!-- ============================ -->
5887
+ <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
5846
5888
 
5847
5889
  <!-- current figure id -->
5848
5890
  <xsl:variable name="figure_id_">
@@ -5955,9 +5997,30 @@
5955
5997
 
5956
5998
  </fo:block>
5957
5999
  </xsl:if>
5958
-
5959
6000
  </xsl:template> <!-- fn_display_figure -->
5960
6001
 
6002
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
6003
+ <!-- figure's footnote label -->
6004
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'dl'][@key = 'true']/*[local-name() = 'dt']/ *[local-name() = 'p'][count(node()[normalize-space() != '']) = 1]/*[local-name() = 'sup']" priority="3">
6005
+ <xsl:variable name="key_iso">
6006
+ true
6007
+ </xsl:variable>
6008
+ <xsl:if test="normalize-space($key_iso) = 'true'">
6009
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
6010
+
6011
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
6012
+
6013
+ </xsl:if>
6014
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
6015
+ <!-- <xsl:value-of select="@reference"/> -->
6016
+ <xsl:apply-templates/>
6017
+ </fo:inline>
6018
+ </xsl:template>
6019
+
6020
+ <!-- ============================ -->
6021
+ <!-- END: figure's footnotes rendering -->
6022
+ <!-- ============================ -->
6023
+
5961
6024
  <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
5962
6025
  <xsl:template match="*[local-name()='fn']">
5963
6026
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
@@ -5973,6 +6036,10 @@
5973
6036
 
5974
6037
  <xsl:value-of select="@reference"/>
5975
6038
 
6039
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
6040
+ <!-- <xsl:if test="$namespace = 'jis'">
6041
+ <fo:inline font-weight="normal">)</fo:inline>
6042
+ </xsl:if> -->
5976
6043
  </fo:basic-link>
5977
6044
  </fo:inline>
5978
6045
  </xsl:template>
@@ -6104,17 +6171,22 @@
6104
6171
  </fo:block>
6105
6172
  </xsl:when> <!-- END: a few components -->
6106
6173
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
6107
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
6174
+ <!-- Presentation XML contains 'Key' caption, https://github.com/metanorma/isodoc/issues/607 -->
6175
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'p' and @keep-with-next])"> <!-- for old Presentation XML -->
6108
6176
 
6109
- <xsl:call-template name="refine_figure_key_style"/>
6177
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
6110
6178
 
6111
- <xsl:variable name="title-key">
6112
- <xsl:call-template name="getLocalizedString">
6113
- <xsl:with-param name="key">key</xsl:with-param>
6114
- </xsl:call-template>
6115
- </xsl:variable>
6116
- <xsl:value-of select="$title-key"/>
6117
- </fo:block>
6179
+ <xsl:call-template name="refine_figure_key_style"/>
6180
+
6181
+ <xsl:variable name="title-key">
6182
+ <xsl:call-template name="getLocalizedString">
6183
+ <xsl:with-param name="key">key</xsl:with-param>
6184
+ </xsl:call-template>
6185
+ </xsl:variable>
6186
+ <xsl:value-of select="$title-key"/>
6187
+ </fo:block>
6188
+
6189
+ </xsl:if>
6118
6190
  </xsl:when> <!-- END: definition list in a figure -->
6119
6191
  </xsl:choose>
6120
6192
 
@@ -6302,6 +6374,14 @@
6302
6374
 
6303
6375
  </xsl:template> <!-- END: dl -->
6304
6376
 
6377
+ <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
6378
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
6379
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
6380
+ <xsl:call-template name="refine_figure_key_style"/>
6381
+ <xsl:apply-templates/>
6382
+ </fo:block>
6383
+ </xsl:template>
6384
+
6305
6385
  <xsl:template name="refine_dl_formula_where_style">
6306
6386
 
6307
6387
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -8410,6 +8490,39 @@
8410
8490
  </xsl:copy>
8411
8491
  </xsl:template>
8412
8492
 
8493
+ <xsl:template match="@*|node()" mode="mathml_linebreak">
8494
+ <xsl:copy>
8495
+ <xsl:apply-templates select="@*|node()" mode="mathml_linebreak"/>
8496
+ </xsl:copy>
8497
+ </xsl:template>
8498
+
8499
+ <!-- split math into two math -->
8500
+ <xsl:template match="mathml:mo[@linebreak] | mathml:mspace[@linebreak]" mode="mathml_linebreak">
8501
+ <xsl:variable name="math_elements_tree_">
8502
+ <xsl:for-each select="ancestor::*[ancestor-or-self::mathml:math]">
8503
+ <element pos="{position()}">
8504
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
8505
+ <xsl:value-of select="name()"/>
8506
+ </element>
8507
+ </xsl:for-each>
8508
+ </xsl:variable>
8509
+
8510
+ <xsl:variable name="math_elements_tree" select="xalan:nodeset($math_elements_tree_)"/>
8511
+
8512
+ <xsl:call-template name="insertClosingElements">
8513
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
8514
+ </xsl:call-template>
8515
+
8516
+ <xsl:element name="br" namespace="{$namespace_full}"/>
8517
+
8518
+ <xsl:call-template name="insertOpeningElements">
8519
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
8520
+ <xsl:with-param name="xmlns">http://www.w3.org/1998/Math/MathML</xsl:with-param>
8521
+ <xsl:with-param name="add_continue">false</xsl:with-param>
8522
+ </xsl:call-template>
8523
+
8524
+ </xsl:template>
8525
+
8413
8526
  <!-- Examples:
8414
8527
  <stem type="AsciiMath">x = 1</stem>
8415
8528
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -8661,9 +8774,11 @@
8661
8774
  </xsl:template>
8662
8775
 
8663
8776
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
8777
+ <!-- https://github.com/metanorma/isodoc/issues/607
8664
8778
  <xsl:if test="normalize-space() != ''">
8665
- <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
8666
- </xsl:if>
8779
+ <xsl:text>(</xsl:text><xsl:apply-templates /><xsl:text>)</xsl:text>
8780
+ </xsl:if> -->
8781
+ <xsl:apply-templates/>
8667
8782
  </xsl:template>
8668
8783
 
8669
8784
  <!-- stem inside formula with name (with formula's number) -->
@@ -8734,6 +8849,8 @@
8734
8849
 
8735
8850
  <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
8736
8851
 
8852
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab"/>
8853
+
8737
8854
  <xsl:call-template name="refine_note-name-style"/>
8738
8855
 
8739
8856
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -8790,10 +8907,6 @@
8790
8907
 
8791
8908
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
8792
8909
 
8793
- <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
8794
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
8795
- </xsl:if>
8796
-
8797
8910
  <xsl:call-template name="refine_termnote-name-style"/>
8798
8911
 
8799
8912
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -8819,6 +8932,17 @@
8819
8932
  </xsl:when>
8820
8933
  <xsl:otherwise>
8821
8934
 
8935
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
8936
+ <!-- <xsl:if test="$namespace = 'ieee'">
8937
+ <xsl:text>—</xsl:text> em dash &#x2014;
8938
+ </xsl:if> -->
8939
+ <!-- <xsl:if test="$namespace = 'iho' or $namespace = 'gb' or $namespace = 'm3d' or $namespace = 'unece-rec' or $namespace = 'unece' or $namespace = 'rsd'">
8940
+ <xsl:text>:</xsl:text>
8941
+ </xsl:if> -->
8942
+
8943
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp'">
8944
+ <xsl:text> – </xsl:text> en dash &#x2013;
8945
+ </xsl:if> -->
8822
8946
  </xsl:otherwise>
8823
8947
  </xsl:choose>
8824
8948
  </xsl:variable>
@@ -8837,8 +8961,16 @@
8837
8961
  </xsl:when>
8838
8962
  <xsl:otherwise>
8839
8963
 
8964
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
8965
+ <!-- <xsl:if test="$namespace = 'ieee'">
8966
+ <xsl:text>—</xsl:text> em dash &#x2014;
8967
+ </xsl:if> -->
8968
+ <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' or $namespace = 'rsd' or $namespace = 'jcgm'">
8840
8969
  <xsl:text>:</xsl:text>
8841
-
8970
+ </xsl:if> -->
8971
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'unece-rec' or $namespace = 'unece'">
8972
+ <xsl:text> – </xsl:text> en dash &#x2013;
8973
+ </xsl:if> -->
8842
8974
  </xsl:otherwise>
8843
8975
  </xsl:choose>
8844
8976
  </xsl:variable>
@@ -8921,17 +9053,29 @@
8921
9053
  <!-- Example: Dimensions in millimeters -->
8922
9054
  <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
8923
9055
 
9056
+ <xsl:variable name="show_figure_key_in_block_container">
9057
+ true
9058
+ </xsl:variable>
9059
+
8924
9060
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
8925
9061
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
8926
9062
  </fo:block>
8927
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8928
- <xsl:call-template name="note"/>
8929
- </xsl:for-each>
8930
- <xsl:call-template name="fn_display_figure"/>
9063
+
9064
+ <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
9065
+ <xsl:call-template name="showFigureKey"/>
9066
+ </xsl:if>
8931
9067
 
8932
9068
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
8933
9069
 
8934
9070
  </fo:block-container>
9071
+
9072
+ </xsl:template>
9073
+
9074
+ <xsl:template name="showFigureKey">
9075
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9076
+ <xsl:call-template name="note"/>
9077
+ </xsl:for-each>
9078
+ <xsl:call-template name="fn_display_figure"/>
8935
9079
  </xsl:template>
8936
9080
 
8937
9081
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -9129,6 +9273,22 @@
9129
9273
  </xsl:if>
9130
9274
  </xsl:template>
9131
9275
 
9276
+ <xsl:template name="getImageSrc">
9277
+ <xsl:choose>
9278
+ <xsl:when test="not(starts-with(@src, 'data:'))">
9279
+ <xsl:choose>
9280
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9281
+ <xsl:value-of select="@src"/>
9282
+ </xsl:when>
9283
+ <xsl:otherwise>
9284
+ <xsl:value-of select="concat($basepath, @src)"/>
9285
+ </xsl:otherwise>
9286
+ </xsl:choose>
9287
+ </xsl:when>
9288
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9289
+ </xsl:choose>
9290
+ </xsl:template>
9291
+
9132
9292
  <xsl:template name="getImageScale">
9133
9293
  <xsl:param name="indent"/>
9134
9294
  <xsl:variable name="indent_left">
@@ -9138,19 +9298,7 @@
9138
9298
  </xsl:choose>
9139
9299
  </xsl:variable>
9140
9300
  <xsl:variable name="img_src">
9141
- <xsl:choose>
9142
- <xsl:when test="not(starts-with(@src, 'data:'))">
9143
- <xsl:choose>
9144
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9145
- <xsl:value-of select="@src"/>
9146
- </xsl:when>
9147
- <xsl:otherwise>
9148
- <xsl:value-of select="concat($basepath, @src)"/>
9149
- </xsl:otherwise>
9150
- </xsl:choose>
9151
- </xsl:when>
9152
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9153
- </xsl:choose>
9301
+ <xsl:call-template name="getImageSrc"/>
9154
9302
  </xsl:variable>
9155
9303
 
9156
9304
  <xsl:variable name="image_width_effective">
@@ -9158,10 +9306,15 @@
9158
9306
  <xsl:value-of select="$width_effective - number($indent_left)"/>
9159
9307
 
9160
9308
  </xsl:variable>
9309
+ <xsl:variable name="image_height_effective" select="$height_effective - number($indent_left)"/>
9161
9310
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
9162
9311
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
9163
9312
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
9164
- <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9313
+ <xsl:variable name="scale">
9314
+
9315
+ <xsl:value-of select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9316
+
9317
+ </xsl:variable>
9165
9318
  <xsl:value-of select="$scale"/>
9166
9319
  </xsl:template>
9167
9320
 
@@ -9714,20 +9867,48 @@
9714
9867
  <xsl:template match="*[local-name() = 'emf']"/>
9715
9868
 
9716
9869
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
9870
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
9871
+ <xsl:apply-templates mode="contents"/>
9872
+ <xsl:text> </xsl:text>
9873
+ </xsl:if>
9874
+ </xsl:template>
9875
+
9876
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="contents"/>
9877
+
9878
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fmt-name'] | *[local-name() = 'table']/*[local-name() = 'fmt-name'] | *[local-name() = 'permission']/*[local-name() = 'fmt-name'] | *[local-name() = 'recommendation']/*[local-name() = 'fmt-name'] | *[local-name() = 'requirement']/*[local-name() = 'fmt-name']" mode="contents">
9717
9879
  <xsl:apply-templates mode="contents"/>
9718
9880
  <xsl:text> </xsl:text>
9719
9881
  </xsl:template>
9720
9882
 
9721
9883
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name'] | *[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="bookmarks">
9884
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
9885
+ <xsl:apply-templates mode="bookmarks"/>
9886
+ <xsl:text> </xsl:text>
9887
+ </xsl:if>
9888
+ </xsl:template>
9889
+
9890
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fmt-name'] | *[local-name() = 'table']/*[local-name() = 'fmt-name'] | *[local-name() = 'permission']/*[local-name() = 'fmt-name'] | *[local-name() = 'recommendation']/*[local-name() = 'fmt-name'] | *[local-name() = 'requirement']/*[local-name() = 'fmt-name'] | *[local-name() = 'sourcecode']/*[local-name() = 'fmt-name']" mode="bookmarks">
9722
9891
  <xsl:apply-templates mode="bookmarks"/>
9723
9892
  <xsl:text> </xsl:text>
9724
9893
  </xsl:template>
9725
9894
 
9726
9895
  <xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
9896
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
9897
+ <xsl:value-of select="."/>
9898
+ </xsl:if>
9899
+ </xsl:template>
9900
+
9901
+ <xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'fmt-name']/text()" mode="contents" priority="2">
9727
9902
  <xsl:value-of select="."/>
9728
9903
  </xsl:template>
9729
9904
 
9730
9905
  <xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
9906
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
9907
+ <xsl:value-of select="."/>
9908
+ </xsl:if>
9909
+ </xsl:template>
9910
+
9911
+ <xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'fmt-name']//text()" mode="bookmarks" priority="2">
9731
9912
  <xsl:value-of select="."/>
9732
9913
  </xsl:template>
9733
9914
 
@@ -9748,7 +9929,7 @@
9748
9929
  </xsl:template>
9749
9930
 
9750
9931
  <!-- special case: ignore section-title if @depth different than @depth of parent clause, or @depth of parent clause = 1 -->
9751
- <xsl:template match="*[local-name() = 'clause']/*[local-name() = 'p'][@type = 'section-title' and (@depth != ../*[local-name() = 'title']/@depth or ../*[local-name() = 'title']/@depth = 1)]" priority="3" mode="contents"/>
9932
+ <xsl:template match="*[local-name() = 'clause']/*[local-name() = 'p'][@type = 'section-title' and (@depth != ../*[local-name() = 'title' or local-name() = 'fmt-title']/@depth or ../*[local-name() = 'title' or local-name() = 'fmt-title']/@depth = 1)]" priority="3" mode="contents"/>
9752
9933
 
9753
9934
  <xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
9754
9935
  <xsl:variable name="level">
@@ -9760,6 +9941,9 @@
9760
9941
  <xsl:variable name="section">
9761
9942
  <xsl:choose>
9762
9943
  <xsl:when test="@type = 'section-title'"/>
9944
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
9945
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9946
+ </xsl:when>
9763
9947
  <xsl:otherwise>
9764
9948
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9765
9949
  </xsl:otherwise>
@@ -9782,6 +9966,19 @@
9782
9966
 
9783
9967
  <xsl:variable name="title">
9784
9968
  <xsl:choose>
9969
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/770 -->
9970
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
9971
+ <xsl:choose>
9972
+ <xsl:when test="@type = 'section-title'">
9973
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9974
+ <xsl:text>: </xsl:text>
9975
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9976
+ </xsl:when>
9977
+ <xsl:otherwise>
9978
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9979
+ </xsl:otherwise>
9980
+ </xsl:choose>
9981
+ </xsl:when>
9785
9982
  <xsl:when test="*[local-name() = 'tab']">
9786
9983
  <xsl:choose>
9787
9984
  <xsl:when test="@type = 'section-title'">
@@ -9817,7 +10014,7 @@
9817
10014
  <xsl:apply-templates mode="bookmarks"/>
9818
10015
  </xsl:template>
9819
10016
 
9820
- <xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
10017
+ <xsl:template match="*[local-name() = 'title' or local-name() = 'name' or local-name() = 'fmt-title' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
9821
10018
  <xsl:apply-templates select="."/>
9822
10019
  </xsl:template>
9823
10020
 
@@ -9830,6 +10027,10 @@
9830
10027
  <xsl:apply-templates mode="contents"/>
9831
10028
  </xsl:template>
9832
10029
 
10030
+ <xsl:template match="*[local-name() = 'semx']" mode="contents">
10031
+ <xsl:apply-templates mode="contents"/>
10032
+ </xsl:template>
10033
+
9833
10034
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
9834
10035
  <xsl:apply-templates mode="bookmarks"/>
9835
10036
  </xsl:template>
@@ -9839,9 +10040,14 @@
9839
10040
  <xsl:apply-templates mode="bookmarks"/>
9840
10041
  </xsl:template>
9841
10042
 
10043
+ <xsl:template match="*[local-name() = 'semx']" mode="bookmarks">
10044
+ <xsl:apply-templates mode="bookmarks"/>
10045
+ </xsl:template>
10046
+
9842
10047
  <!-- Bookmarks -->
9843
10048
  <xsl:template name="addBookmarks">
9844
10049
  <xsl:param name="contents"/>
10050
+ <xsl:param name="contents_addon"/>
9845
10051
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
9846
10052
  <xsl:if test="$contents_nodes//item">
9847
10053
  <fo:bookmark-tree>
@@ -9939,6 +10145,9 @@
9939
10145
  </xsl:otherwise>
9940
10146
  </xsl:choose>
9941
10147
 
10148
+ <!-- for $namespace = 'nist-sp' $namespace = 'ogc' $namespace = 'ogc-white-paper' -->
10149
+ <xsl:copy-of select="$contents_addon"/>
10150
+
9942
10151
  </fo:bookmark-tree>
9943
10152
  </xsl:if>
9944
10153
  </xsl:template>
@@ -10103,6 +10312,16 @@
10103
10312
  <!-- ====== -->
10104
10313
  <!-- ====== -->
10105
10314
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
10315
+ <xsl:param name="mode">bookmarks</xsl:param>
10316
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-title'])">
10317
+ <xsl:apply-templates mode="contents_item">
10318
+ <xsl:with-param name="mode" select="$mode"/>
10319
+ </xsl:apply-templates>
10320
+ <!-- <xsl:text> </xsl:text> -->
10321
+ </xsl:if>
10322
+ </xsl:template>
10323
+
10324
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="contents_item">
10106
10325
  <xsl:param name="mode">bookmarks</xsl:param>
10107
10326
  <xsl:apply-templates mode="contents_item">
10108
10327
  <xsl:with-param name="mode" select="$mode"/>
@@ -10110,12 +10329,38 @@
10110
10329
  <!-- <xsl:text> </xsl:text> -->
10111
10330
  </xsl:template>
10112
10331
 
10332
+ <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim']" mode="contents_item" priority="3">
10333
+ <xsl:apply-templates mode="contents_item"/>
10334
+ </xsl:template>
10335
+
10336
+ <xsl:template match="*[local-name() = 'semx']" mode="contents_item">
10337
+ <xsl:apply-templates mode="contents_item"/>
10338
+ </xsl:template>
10339
+
10340
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="contents_item"/>
10341
+
10113
10342
  <xsl:template name="getSection">
10114
- <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10343
+ <xsl:choose>
10344
+ <xsl:when test="*[local-name() = 'fmt-title']">
10345
+ <xsl:variable name="fmt_title_section">
10346
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/preceding-sibling::node()[not(local-name() = 'review')]"/>
10347
+ </xsl:variable>
10348
+ <xsl:value-of select="normalize-space($fmt_title_section)"/>
10349
+ </xsl:when>
10350
+ <xsl:otherwise>
10351
+ <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10352
+ </xsl:otherwise>
10353
+ </xsl:choose>
10115
10354
  </xsl:template>
10116
10355
 
10117
10356
  <xsl:template name="getName">
10118
10357
  <xsl:choose>
10358
+ <xsl:when test="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']]">
10359
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/following-sibling::node()"/>
10360
+ </xsl:when>
10361
+ <xsl:when test="*[local-name() = 'fmt-title']">
10362
+ <xsl:copy-of select="*[local-name() = 'fmt-title']/node()"/>
10363
+ </xsl:when>
10119
10364
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
10120
10365
  <xsl:copy-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/following-sibling::node()"/>
10121
10366
  </xsl:when>
@@ -10222,6 +10467,15 @@
10222
10467
  </xsl:template>
10223
10468
 
10224
10469
  <xsl:template match="*[local-name() = 'name']" mode="contents_item">
10470
+ <xsl:param name="mode">bookmarks</xsl:param>
10471
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
10472
+ <xsl:apply-templates mode="contents_item">
10473
+ <xsl:with-param name="mode" select="$mode"/>
10474
+ </xsl:apply-templates>
10475
+ </xsl:if>
10476
+ </xsl:template>
10477
+
10478
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="contents_item">
10225
10479
  <xsl:param name="mode">bookmarks</xsl:param>
10226
10480
  <xsl:apply-templates mode="contents_item">
10227
10481
  <xsl:with-param name="mode" select="$mode"/>
@@ -11019,7 +11273,7 @@
11019
11273
  <xsl:if test="normalize-space() != ''">
11020
11274
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
11021
11275
  <xsl:call-template name="refine_termexample-name-style"/>
11022
- <xsl:apply-templates/>
11276
+ <xsl:apply-templates/> <!-- commented $namespace = 'ieee', https://github.com/metanorma/isodoc/issues/614-->
11023
11277
  </fo:inline>
11024
11278
  </xsl:if>
11025
11279
  </xsl:template>
@@ -11060,113 +11314,114 @@
11060
11314
  -->
11061
11315
  <xsl:template match="*[local-name() = 'example']">
11062
11316
 
11063
- <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11064
-
11065
- <xsl:call-template name="setBlockSpanAll"/>
11317
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11066
11318
 
11067
- <xsl:call-template name="refine_example-style"/>
11319
+ <xsl:call-template name="setBlockSpanAll"/>
11068
11320
 
11069
- <xsl:variable name="fo_element">
11070
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11321
+ <xsl:call-template name="refine_example-style"/>
11071
11322
 
11072
- <xsl:choose>
11073
- <!-- if example contains only one (except 'name') element (paragraph for example), then display it on the same line as EXAMPLE title -->
11074
- <xsl:when test="count(*[not(local-name() = 'name')]) = 1">inline</xsl:when>
11075
- <xsl:otherwise>block</xsl:otherwise>
11076
- </xsl:choose>
11323
+ <xsl:variable name="fo_element">
11324
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11077
11325
 
11078
- </xsl:variable>
11326
+ <xsl:choose>
11327
+ <!-- if example contains only one (except 'name') element (paragraph for example), then display it on the same line as EXAMPLE title -->
11328
+ <xsl:when test="count(*[not(local-name() = 'name')]) = 1">inline</xsl:when>
11329
+ <xsl:otherwise>block</xsl:otherwise>
11330
+ </xsl:choose>
11079
11331
 
11080
- <fo:block-container margin-left="0mm" role="SKIP">
11332
+ </xsl:variable>
11081
11333
 
11082
- <xsl:choose>
11334
+ <fo:block-container margin-left="0mm" role="SKIP">
11083
11335
 
11084
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
11336
+ <xsl:choose>
11085
11337
 
11086
- <!-- display name 'EXAMPLE' in a separate block -->
11087
- <fo:block>
11088
- <xsl:apply-templates select="*[local-name()='name']">
11089
- <xsl:with-param name="fo_element" select="$fo_element"/>
11090
- </xsl:apply-templates>
11091
- </fo:block>
11338
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
11092
11339
 
11093
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11094
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11095
- <xsl:variable name="example_body">
11096
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11340
+ <!-- display name 'EXAMPLE' in a separate block -->
11341
+ <fo:block>
11342
+ <xsl:apply-templates select="*[local-name()='name']">
11097
11343
  <xsl:with-param name="fo_element" select="$fo_element"/>
11098
11344
  </xsl:apply-templates>
11345
+ </fo:block>
11346
+
11347
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11348
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11349
+ <xsl:variable name="example_body">
11350
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11351
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11352
+ </xsl:apply-templates>
11353
+ </xsl:variable>
11354
+ <xsl:choose>
11355
+ <xsl:when test="xalan:nodeset($example_body)/*">
11356
+ <xsl:copy-of select="$example_body"/>
11357
+ </xsl:when>
11358
+ <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
11359
+ </xsl:choose>
11360
+ </fo:block-container>
11361
+ </fo:block-container>
11362
+ </xsl:when> <!-- end block -->
11363
+
11364
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
11365
+
11366
+ <xsl:variable name="provisional_distance_between_starts_">
11367
+ 7
11099
11368
  </xsl:variable>
11100
- <xsl:choose>
11101
- <xsl:when test="xalan:nodeset($example_body)/*">
11102
- <xsl:copy-of select="$example_body"/>
11103
- </xsl:when>
11104
- <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
11105
- </xsl:choose>
11106
- </fo:block-container>
11107
- </fo:block-container>
11108
- </xsl:when> <!-- end block -->
11369
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11370
+ <xsl:variable name="indent_">
11371
+ 0
11372
+ </xsl:variable>
11373
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
11109
11374
 
11110
- <xsl:when test="contains(normalize-space($fo_element), 'list')">
11375
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11376
+ <fo:list-item>
11377
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11378
+ <fo:block>
11379
+ <xsl:apply-templates select="*[local-name()='name']">
11380
+ <xsl:with-param name="fo_element">block</xsl:with-param>
11381
+ </xsl:apply-templates>
11382
+ </fo:block>
11383
+ </fo:list-item-label>
11384
+ <fo:list-item-body start-indent="body-start()">
11385
+ <fo:block>
11386
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11387
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11388
+ </xsl:apply-templates>
11389
+ </fo:block>
11390
+ </fo:list-item-body>
11391
+ </fo:list-item>
11392
+ </fo:list-block>
11393
+ </xsl:when> <!-- end list -->
11111
11394
 
11112
- <xsl:variable name="provisional_distance_between_starts_">
11113
- 7
11114
- </xsl:variable>
11115
- <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11116
- <xsl:variable name="indent_">
11117
- 0
11118
- </xsl:variable>
11119
- <xsl:variable name="indent" select="normalize-space($indent_)"/>
11395
+ <xsl:otherwise> <!-- inline -->
11120
11396
 
11121
- <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11122
- <fo:list-item>
11123
- <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11124
- <fo:block>
11125
- <xsl:apply-templates select="*[local-name()='name']">
11126
- <xsl:with-param name="fo_element">block</xsl:with-param>
11127
- </xsl:apply-templates>
11128
- </fo:block>
11129
- </fo:list-item-label>
11130
- <fo:list-item-body start-indent="body-start()">
11131
- <fo:block>
11132
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11397
+ <!-- display 'EXAMPLE' and first element in the same line -->
11398
+ <fo:block>
11399
+ <xsl:apply-templates select="*[local-name()='name']">
11400
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11401
+ </xsl:apply-templates>
11402
+ <fo:inline>
11403
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
11133
11404
  <xsl:with-param name="fo_element" select="$fo_element"/>
11134
11405
  </xsl:apply-templates>
11135
- </fo:block>
11136
- </fo:list-item-body>
11137
- </fo:list-item>
11138
- </fo:list-block>
11139
- </xsl:when> <!-- end list -->
11140
-
11141
- <xsl:otherwise> <!-- inline -->
11406
+ </fo:inline>
11407
+ </fo:block>
11142
11408
 
11143
- <!-- display 'EXAMPLE' and first element in the same line -->
11144
- <fo:block>
11145
- <xsl:apply-templates select="*[local-name()='name']">
11146
- <xsl:with-param name="fo_element" select="$fo_element"/>
11147
- </xsl:apply-templates>
11148
- <fo:inline>
11149
- <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
11150
- <xsl:with-param name="fo_element" select="$fo_element"/>
11151
- </xsl:apply-templates>
11152
- </fo:inline>
11153
- </fo:block>
11409
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
11410
+ <!-- display further elements in blocks -->
11411
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11412
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11413
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
11414
+ <xsl:with-param name="fo_element" select="'block'"/>
11415
+ </xsl:apply-templates>
11416
+ </fo:block-container>
11417
+ </fo:block-container>
11418
+ </xsl:if>
11419
+ </xsl:otherwise> <!-- end inline -->
11154
11420
 
11155
- <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
11156
- <!-- display further elements in blocks -->
11157
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11158
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11159
- <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
11160
- <xsl:with-param name="fo_element" select="'block'"/>
11161
- </xsl:apply-templates>
11162
- </fo:block-container>
11163
- </fo:block-container>
11164
- </xsl:if>
11165
- </xsl:otherwise> <!-- end inline -->
11421
+ </xsl:choose>
11422
+ </fo:block-container>
11423
+ </fo:block-container>
11166
11424
 
11167
- </xsl:choose>
11168
- </fo:block-container>
11169
- </fo:block-container>
11170
11425
  </xsl:template>
11171
11426
 
11172
11427
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
@@ -11187,7 +11442,7 @@
11187
11442
  <xsl:otherwise>
11188
11443
  <fo:inline xsl:use-attribute-sets="example-name-style">
11189
11444
  <xsl:call-template name="refine_example-name-style"/>
11190
- <xsl:apply-templates/>
11445
+ <xsl:apply-templates/> <!-- $namespace = 'ieee', see https://github.com/metanorma/isodoc/issues/614 -->
11191
11446
  </fo:inline>
11192
11447
  </xsl:otherwise>
11193
11448
  </xsl:choose>
@@ -11369,15 +11624,17 @@
11369
11624
 
11370
11625
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11371
11626
  <fo:block role="BlockQuote">
11372
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
11627
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source') and not(local-name() = 'attribution')]"/> <!-- process all nested nodes, except author and source -->
11373
11628
  </fo:block>
11374
11629
  </fo:block-container>
11375
11630
  </fo:block-container>
11376
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
11631
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source'] or *[local-name() = 'attribution']">
11377
11632
  <fo:block xsl:use-attribute-sets="quote-source-style">
11378
11633
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
11379
11634
  <xsl:apply-templates select="*[local-name() = 'author']"/>
11380
11635
  <xsl:apply-templates select="*[local-name() = 'source']"/>
11636
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
11637
+ <xsl:apply-templates select="*[local-name() = 'attribution']/*[local-name() = 'p']/node()"/>
11381
11638
  </fo:block>
11382
11639
  </xsl:if>
11383
11640
 
@@ -11399,9 +11656,13 @@
11399
11656
  </xsl:template>
11400
11657
 
11401
11658
  <xsl:template match="*[local-name() = 'author']">
11402
- <xsl:text>— </xsl:text>
11659
+ <xsl:if test="local-name(..) = 'quote'"> <!-- for old Presentation XML, https://github.com/metanorma/isodoc/issues/607 -->
11660
+ <xsl:text>— </xsl:text>
11661
+ </xsl:if>
11403
11662
  <xsl:apply-templates/>
11404
11663
  </xsl:template>
11664
+
11665
+ <xsl:template match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
11405
11666
  <!-- ====== -->
11406
11667
  <!-- ====== -->
11407
11668
 
@@ -11542,6 +11803,15 @@
11542
11803
 
11543
11804
  </xsl:template> <!-- tab -->
11544
11805
 
11806
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
11807
+ <xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
11808
+
11809
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
11810
+
11811
+ <xsl:attribute name="padding-right">6mm</xsl:attribute>
11812
+
11813
+ </xsl:template>
11814
+
11545
11815
  <xsl:template name="insertNonBreakSpaces">
11546
11816
  <xsl:param name="count"/>
11547
11817
  <xsl:if test="$count &gt; 0">
@@ -11585,8 +11855,12 @@
11585
11855
  </xsl:template>
11586
11856
 
11587
11857
  <xsl:template match="*[local-name() = 'domain']">
11858
+ <!-- https://github.com/metanorma/isodoc/issues/607
11588
11859
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
11589
- <xsl:text> </xsl:text>
11860
+ <xsl:text> </xsl:text> -->
11861
+ <xsl:if test="not(@hidden = 'true')">
11862
+ <xsl:apply-templates/>
11863
+ </xsl:if>
11590
11864
  </xsl:template>
11591
11865
 
11592
11866
  <xsl:template match="*[local-name() = 'admitted']">
@@ -11634,6 +11908,29 @@
11634
11908
  <!-- END definition -->
11635
11909
  <!-- ========== -->
11636
11910
 
11911
+ <xsl:variable name="reviews_">
11912
+ <xsl:for-each select="//*[local-name() = 'review'][@from]">
11913
+ <xsl:copy>
11914
+ <xsl:copy-of select="@from"/>
11915
+ <xsl:copy-of select="@id"/>
11916
+ </xsl:copy>
11917
+ </xsl:for-each>
11918
+ </xsl:variable>
11919
+ <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
11920
+
11921
+ <xsl:template name="addReviewHelper">
11922
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11923
+ <xsl:variable name="curr_id" select="@id"/>
11924
+ <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
11925
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11926
+ <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11927
+ </xsl:if>
11928
+ <!-- <fo:block>
11929
+ <curr_id><xsl:value-of select="$curr_id"/></curr_id>
11930
+ <xsl:copy-of select="$reviews"/>
11931
+ </fo:block> -->
11932
+ </xsl:template>
11933
+
11637
11934
  <!-- main sections -->
11638
11935
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
11639
11936
 
@@ -11642,6 +11939,8 @@
11642
11939
 
11643
11940
  <xsl:call-template name="sections_element_style"/>
11644
11941
 
11942
+ <xsl:call-template name="addReviewHelper"/>
11943
+
11645
11944
  <xsl:apply-templates/>
11646
11945
  </fo:block>
11647
11946
 
@@ -11677,6 +11976,7 @@
11677
11976
 
11678
11977
  <fo:block>
11679
11978
  <xsl:call-template name="setId"/>
11979
+ <xsl:call-template name="addReviewHelper"/>
11680
11980
  <xsl:apply-templates/>
11681
11981
  </fo:block>
11682
11982
  </xsl:template>
@@ -11713,6 +12013,8 @@
11713
12013
 
11714
12014
  <xsl:call-template name="refine_clause_style"/>
11715
12015
 
12016
+ <xsl:call-template name="addReviewHelper"/>
12017
+
11716
12018
  <xsl:apply-templates/>
11717
12019
  </fo:block>
11718
12020
  </xsl:template>
@@ -11765,6 +12067,23 @@
11765
12067
 
11766
12068
  <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
11767
12069
 
12070
+ <xsl:if test="1 = 1">
12071
+ <xsl:choose>
12072
+ <!-- if there isn't the attribute '@from', then -->
12073
+ <xsl:when test="$id_from = ''">
12074
+ <fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12075
+ </xsl:when>
12076
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
12077
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12078
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12079
+ </xsl:when>
12080
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12081
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12082
+ </xsl:when>
12083
+ </xsl:choose>
12084
+ </xsl:if>
12085
+
12086
+ <xsl:if test="1 = 2">
11768
12087
  <xsl:choose>
11769
12088
  <!-- if there isn't the attribute '@from', then -->
11770
12089
  <xsl:when test="$id_from = ''">
@@ -11778,6 +12097,7 @@
11778
12097
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
11779
12098
  </xsl:when>
11780
12099
  </xsl:choose>
12100
+ </xsl:if>
11781
12101
 
11782
12102
  </xsl:template>
11783
12103
 
@@ -13038,6 +13358,10 @@
13038
13358
  <!-- - Remove semantic xml part -->
13039
13359
  <!-- - Remove image/emf (EMF vector image for Word) -->
13040
13360
  <!-- - add @id, redundant for table auto-layout algorithm -->
13361
+ <!-- - process 'passthrough' element -->
13362
+ <!-- - split math by element with @linebreak into maths -->
13363
+ <!-- - rename fmt-title to title, fmt-name to name and another changes to convert new presentation XML to -->
13364
+ <!-- - old XML without significant changes in XSLT -->
13041
13365
  <!-- =========================================================================== -->
13042
13366
  <xsl:template match="@*|node()" mode="update_xml_step1">
13043
13367
  <xsl:copy>
@@ -13045,6 +13369,12 @@
13045
13369
  </xsl:copy>
13046
13370
  </xsl:template>
13047
13371
 
13372
+ <xsl:template match="@*|node()" mode="update_xml_pres">
13373
+ <xsl:copy>
13374
+ <xsl:apply-templates select="@*|node()" mode="update_xml_pres"/>
13375
+ </xsl:copy>
13376
+ </xsl:template>
13377
+
13048
13378
  <!-- change section's order based on @displayorder value -->
13049
13379
  <xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
13050
13380
  <xsl:copy>
@@ -13121,7 +13451,7 @@
13121
13451
  </xsl:template>
13122
13452
 
13123
13453
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
13124
- <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
13454
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear' or @class = 'horizontal' or @class = 'norotate' or @class = 'halffontsize']" mode="update_xml_step1" priority="2">
13125
13455
  <xsl:copy>
13126
13456
  <xsl:copy-of select="@*"/>
13127
13457
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -13140,14 +13470,17 @@
13140
13470
 
13141
13471
  <!-- remove semantic xml -->
13142
13472
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
13473
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_pres"/>
13143
13474
 
13144
13475
  <!-- remove image/emf -->
13145
13476
  <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
13477
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_pres"/>
13146
13478
 
13147
13479
  <!-- remove preprocess-xslt -->
13148
13480
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
13481
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
13149
13482
 
13150
- <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image'] | *[local-name() = 'sourcecode'] | *[local-name() = 'bibdata'] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
13483
+ <xsl:template match="*[local-name() = 'stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])] | *[local-name() = 'image'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'sourcecode'][not(.//*[local-name() = 'passthrough']) and not(.//*[local-name() = 'fmt-name'])] | *[local-name() = 'bibdata'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
13151
13484
  <xsl:copy-of select="."/>
13152
13485
  </xsl:template>
13153
13486
 
@@ -13213,6 +13546,93 @@
13213
13546
  </xsl:choose>
13214
13547
  </xsl:template>
13215
13548
 
13549
+ <xsl:variable name="regex_passthrough">.*\bpdf\b.*</xsl:variable>
13550
+ <xsl:template match="*[local-name() = 'passthrough']" mode="update_xml_step1">
13551
+ <!-- <xsl:if test="contains(@formats, ' pdf ')"> -->
13552
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@formats), $regex_passthrough)) = 'true'">
13553
+ <xsl:apply-templates mode="update_xml_step1"/>
13554
+ </xsl:if>
13555
+ </xsl:template>
13556
+
13557
+ <!-- split math by element with @linebreak into maths -->
13558
+ <xsl:template match="mathml:math[.//mathml:mo[@linebreak] or .//mathml:mspace[@linebreak]]" mode="update_xml_step1">
13559
+ <xsl:variable name="maths">
13560
+ <xsl:apply-templates select="." mode="mathml_linebreak"/>
13561
+ </xsl:variable>
13562
+ <xsl:copy-of select="$maths"/>
13563
+ </xsl:template>
13564
+
13565
+ <!-- update new Presentation XML -->
13566
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_step1"/>
13567
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_pres"/>
13568
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_step1"/>
13569
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
13570
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
13571
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
13572
+
13573
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
13574
+ <xsl:copy>
13575
+ <xsl:apply-templates select="@*" mode="update_xml_step1"/>
13576
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
13577
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
13578
+ </xsl:copy>
13579
+ </xsl:template>
13580
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_pres">
13581
+ <xsl:copy>
13582
+ <xsl:apply-templates select="@*" mode="update_xml_pres"/>
13583
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
13584
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
13585
+ </xsl:copy>
13586
+ </xsl:template>
13587
+
13588
+ <xsl:template match="*[local-name() = 'fmt-title']"/>
13589
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
13590
+ <xsl:element name="title" namespace="{$namespace_full}">
13591
+ <xsl:copy-of select="@*"/>
13592
+ <xsl:apply-templates mode="update_xml_step1"/>
13593
+ </xsl:element>
13594
+ </xsl:template>
13595
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
13596
+ <xsl:element name="title" namespace="{$namespace_full}">
13597
+ <xsl:copy-of select="@*"/>
13598
+ <xsl:apply-templates mode="update_xml_pres"/>
13599
+ </xsl:element>
13600
+ </xsl:template>
13601
+
13602
+ <xsl:template match="*[local-name() = 'fmt-name']"/>
13603
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
13604
+ <xsl:element name="name" namespace="{$namespace_full}">
13605
+ <xsl:copy-of select="@*"/>
13606
+ <xsl:apply-templates mode="update_xml_step1"/>
13607
+ </xsl:element>
13608
+ </xsl:template>
13609
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres">
13610
+ <xsl:element name="name" namespace="{$namespace_full}">
13611
+ <xsl:copy-of select="@*"/>
13612
+ <xsl:apply-templates mode="update_xml_pres"/>
13613
+ </xsl:element>
13614
+ </xsl:template>
13615
+
13616
+ <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
13617
+ <xsl:apply-templates mode="update_xml_step1"/>
13618
+ </xsl:template>
13619
+ <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_pres" priority="3">
13620
+ <xsl:apply-templates mode="update_xml_pres"/>
13621
+ </xsl:template>
13622
+
13623
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_step1">
13624
+ <xsl:apply-templates mode="update_xml_step1"/>
13625
+ </xsl:template>
13626
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_pres">
13627
+ <xsl:apply-templates mode="update_xml_pres"/>
13628
+ </xsl:template>
13629
+
13630
+ <xsl:template match="*[local-name() = 'fmt-xref-label']"/>
13631
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_step1"/>
13632
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_pres"/>
13633
+
13634
+ <!-- END: update new Presentation XML -->
13635
+
13216
13636
  <!-- =========================================================================== -->
13217
13637
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
13218
13638
  <!-- =========================================================================== -->
@@ -13316,6 +13736,8 @@
13316
13736
 
13317
13737
  <xsl:template name="insertOpeningElements">
13318
13738
  <xsl:param name="tree"/>
13739
+ <xsl:param name="xmlns"/>
13740
+ <xsl:param name="add_continue">true</xsl:param>
13319
13741
  <xsl:for-each select="$tree//element">
13320
13742
  <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
13321
13743
  <xsl:value-of select="."/>
@@ -13326,7 +13748,8 @@
13326
13748
  <xsl:value-of select="."/>
13327
13749
  <xsl:text>"</xsl:text>
13328
13750
  </xsl:for-each>
13329
- <xsl:if test="position() = 1"> continue="true"</xsl:if>
13751
+ <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
13752
+ <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
13330
13753
  <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
13331
13754
  <xsl:if test="$debug = 'true'">
13332
13755
  <xsl:message>&lt;<xsl:value-of select="."/>&gt;</xsl:message>
@@ -13402,7 +13825,7 @@
13402
13825
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
13403
13826
  <xsl:variable name="regex_dots_units">((\b((<xsl:value-of select="$non_white_space"/>{1,3}\.<xsl:value-of select="$non_white_space"/>+)|(<xsl:value-of select="$non_white_space"/>+\.<xsl:value-of select="$non_white_space"/>{1,3}))\b)|(\.<xsl:value-of select="$non_white_space"/>{1,3})\b)</xsl:variable>
13404
13827
 
13405
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') or normalize-space() = '' )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
13828
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or ancestor::*[local-name() = 'name'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') or normalize-space() = '' )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
13406
13829
 
13407
13830
  <xsl:variable name="parent" select="local-name(..)"/>
13408
13831
 
@@ -13981,6 +14404,7 @@
13981
14404
  </pdf:catalog>
13982
14405
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
13983
14406
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14407
+ <!-- Commented after upgrade to Apache FOP 2.10
13984
14408
  <rdf:Description xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#" xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" rdf:about="">
13985
14409
  <pdfaExtension:schemas>
13986
14410
  <rdf:Bag>
@@ -14013,7 +14437,7 @@
14013
14437
  </rdf:li>
14014
14438
  </rdf:Bag>
14015
14439
  </pdfaExtension:schemas>
14016
- </rdf:Description>
14440
+ </rdf:Description> -->
14017
14441
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
14018
14442
  <!-- Dublin Core properties go here -->
14019
14443
  <dc:title>
@@ -14060,7 +14484,7 @@
14060
14484
  <xsl:variable name="dc_description">
14061
14485
  <xsl:variable name="abstract">
14062
14486
 
14063
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
14487
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'fmt-title']) and not(ancestor::*[local-name() = 'title']) and not(ancestor::*[local-name() = 'fmt-xref-label'])]"/>
14064
14488
 
14065
14489
  </xsl:variable>
14066
14490
  <rdf:Alt>
@@ -14605,31 +15029,123 @@
14605
15029
 
14606
15030
  <!-- END: insert cover page image -->
14607
15031
 
14608
- <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
15032
+ <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
15033
+ <xsl:variable name="regex_ja_spec_">[
15034
+ <!-- Rotate 90° clockwise -->
15035
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
15036
+ \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
15037
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
15038
+ \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
15039
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
15040
+ \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
15041
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
15042
+ \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
15043
+ \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
15044
+ \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
15045
+ \u3010 <!-- U+3010 LEFT BLACK LENTICULAR BRACKET (【) -->
15046
+ \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
15047
+ \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
15048
+ \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
15049
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
15050
+ \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
15051
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
15052
+ \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
15053
+ \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
15054
+ \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
15055
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
15056
+ \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
15057
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
15058
+ \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
15059
+ \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
15060
+ \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
15061
+ \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
15062
+ \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
15063
+
15064
+ \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
15065
+ \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
15066
+ \u301C <!-- U+301C WAVE DASH (〜) -->
15067
+ \u3030 <!-- U+3030 WAVY DASH (〰 )-->
15068
+ \u30FC <!-- U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK (ー) -->
15069
+ \u2329 <!-- U+2329 LEFT-POINTING ANGLE BRACKET (〈) -->
15070
+ \u232A <!-- U+232A RIGHT-POINTING ANGLE BRACKET (〉) -->
15071
+ \u3018 <!-- U+3018 LEFT WHITE TORTOISE SHELL BRACKET (〘) -->
15072
+ \u3019 <!-- U+3019 RIGHT WHITE TORTOISE SHELL BRACKET (〙) -->
15073
+ \u30A0 <!-- U+30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN (゠) -->
15074
+ \uFE59 <!-- U+FE59 SMALL LEFT PARENTHESIS (﹙) -->
15075
+ \uFE5A <!-- U+FE5A SMALL RIGHT PARENTHESIS (﹚) -->
15076
+ \uFE5B <!-- U+FE5B SMALL LEFT CURLY BRACKET (﹛) -->
15077
+ \uFE5C <!-- U+FE5C SMALL RIGHT CURLY BRACKET (﹜) -->
15078
+ \uFE5D <!-- U+FE5D SMALL LEFT TORTOISE SHELL BRACKET (﹝) -->
15079
+ \uFE5E <!-- U+FE5E SMALL RIGHT TORTOISE SHELL BRACKET (﹞) -->
15080
+ \uFF5C <!-- U+FF5C FULLWIDTH VERTICAL LINE (|) -->
15081
+ \uFF5F <!-- U+FF5F FULLWIDTH LEFT WHITE PARENTHESIS (⦅) -->
15082
+ \uFF60 <!-- U+FF60 FULLWIDTH RIGHT WHITE PARENTHESIS (⦆) -->
15083
+ \uFFE3 <!-- U+FFE3 FULLWIDTH MACRON ( ̄) -->
15084
+ \uFF3F <!-- U+FF3F FULLWIDTH LOW LINE (_) -->
15085
+ \uFF5E <!-- U+FF5E FULLWIDTH TILDE (~) -->
15086
+ <!-- Rotate 180° -->
15087
+ \u309C <!-- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜) -->
15088
+ \u3002 <!-- U+3002 IDEOGRAPHIC FULL STOP (。) -->
15089
+ \uFE52 <!-- U+FE52 SMALL FULL STOP (﹒) -->
15090
+ \uFF0E <!-- U+FF0E FULLWIDTH FULL STOP (.) -->
15091
+ ]</xsl:variable>
15092
+ <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
14609
15093
  <xsl:template name="insertVerticalChar">
14610
15094
  <xsl:param name="str"/>
14611
15095
  <xsl:param name="writing-mode">lr-tb</xsl:param>
14612
15096
  <xsl:param name="reference-orientation">90</xsl:param>
14613
- <xsl:if test="string-length($str) &gt; 0">
14614
- <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
14615
- <xsl:if test="normalize-space($writing-mode) != ''">
14616
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14617
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
14618
- </xsl:if>
14619
- <xsl:variable name="char" select="substring($str,1,1)"/>
14620
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14621
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
15097
+ <xsl:param name="add_zero_width_space">false</xsl:param>
15098
+ <xsl:choose>
15099
+ <xsl:when test="ancestor::*[local-name() = 'span'][@class = 'norotate']">
15100
+ <xsl:value-of select="$str"/>
15101
+ </xsl:when>
15102
+ <xsl:otherwise>
15103
+ <xsl:if test="string-length($str) &gt; 0">
15104
+ <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
15105
+ <xsl:variable name="char" select="substring($str,1,1)"/>
15106
+ <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
15107
+ <xsl:if test="normalize-space($writing-mode) != ''">
15108
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
15109
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
15110
+ </xsl:if>
15111
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
15112
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
15113
+ </xsl:if>
15114
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
15115
+ <!-- Rotate 180°:
15116
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
15117
+ U+3002 IDEOGRAPHIC FULL STOP (。)
15118
+ U+FE52 SMALL FULL STOP (﹒)
15119
+ U+FF0E FULLWIDTH FULL STOP (.)
15120
+ -->
15121
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
15122
+ </xsl:if>
15123
+ <fo:block-container width="1em">
15124
+ <fo:block line-height="1em">
15125
+ <xsl:choose>
15126
+ <xsl:when test="$horizontal_mode = 'true'">
15127
+ <xsl:value-of select="$str"/>
15128
+ </xsl:when>
15129
+ <xsl:otherwise>
15130
+ <xsl:value-of select="$char"/>
15131
+ </xsl:otherwise>
15132
+ </xsl:choose>
15133
+ </fo:block>
15134
+ </fo:block-container>
15135
+ </fo:inline-container>
15136
+ <xsl:if test="$add_zero_width_space = 'true' and ($char = ',' or $char = '.' or $char = ' ' or $char = '·' or $char = ')' or $char = ']' or $char = '}')"><xsl:value-of select="$zero_width_space"/></xsl:if>
15137
+
15138
+ <xsl:if test="$horizontal_mode = 'false'">
15139
+ <xsl:call-template name="insertVerticalChar">
15140
+ <xsl:with-param name="str" select="substring($str, 2)"/>
15141
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
15142
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
15143
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
15144
+ </xsl:call-template>
15145
+ </xsl:if>
14622
15146
  </xsl:if>
14623
- <fo:block-container width="1em">
14624
- <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
14625
- </fo:block-container>
14626
- </fo:inline-container>
14627
- <xsl:call-template name="insertVerticalChar">
14628
- <xsl:with-param name="str" select="substring($str, 2)"/>
14629
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
14630
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14631
- </xsl:call-template>
14632
- </xsl:if>
15147
+ </xsl:otherwise>
15148
+ </xsl:choose>
14633
15149
  </xsl:template>
14634
15150
 
14635
15151
  <xsl:template name="number-to-words">