metanorma-ribose 2.5.5 → 2.5.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -423,32 +423,38 @@
423
423
  </fo:page-sequence>
424
424
  <!-- END Cover page -->
425
425
 
426
- <!-- ToC pages -->
427
- <fo:page-sequence master-reference="document" force-page-count="no-force"> <!-- master-reference="toc" -->
428
- <xsl:call-template name="insertHeaderFooter">
429
- <xsl:with-param name="section">toc</xsl:with-param>
430
- </xsl:call-template>
431
- <fo:flow flow-name="xsl-region-body">
432
-
433
- <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:clause[@type = 'toc']"/>
434
-
435
- <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:legal-statement"/>
436
-
437
- <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:feedback-statement"/>
438
-
439
- </fo:flow>
440
- </fo:page-sequence>
441
- <!-- ============== -->
442
- <!-- END ToC pages -->
443
- <!-- ============== -->
444
-
445
426
  <xsl:variable name="updated_xml">
446
427
  <xsl:call-template name="updateXML"/>
447
428
  <!-- <xsl:copy-of select="."/> -->
448
429
  </xsl:variable>
449
430
 
431
+ <xsl:if test="$debug = 'true'">
432
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
433
+ <xsl:copy-of select="$contents"/>
434
+ </redirect:write>
435
+ </xsl:if>
436
+
450
437
  <xsl:for-each select="xalan:nodeset($updated_xml)/*">
451
438
 
439
+ <!-- ToC pages -->
440
+ <fo:page-sequence master-reference="document" force-page-count="no-force"> <!-- master-reference="toc" -->
441
+ <xsl:call-template name="insertHeaderFooter">
442
+ <xsl:with-param name="section">toc</xsl:with-param>
443
+ </xsl:call-template>
444
+ <fo:flow flow-name="xsl-region-body">
445
+
446
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:clause[@type = 'toc']"/>
447
+
448
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:legal-statement"/>
449
+
450
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:feedback-statement"/>
451
+
452
+ </fo:flow>
453
+ </fo:page-sequence>
454
+ <!-- ============== -->
455
+ <!-- END ToC pages -->
456
+ <!-- ============== -->
457
+
452
458
  <xsl:variable name="updated_xml_with_pages">
453
459
  <xsl:call-template name="processPrefaceAndMainSectionsRibose_items"/>
454
460
  </xsl:variable>
@@ -689,10 +695,10 @@
689
695
  <!-- ============================= -->
690
696
 
691
697
  <!-- element with title -->
692
- <xsl:template match="*[ribose:title]" mode="contents">
698
+ <xsl:template match="*[ribose:title or ribose:fmt-title]" mode="contents">
693
699
  <xsl:variable name="level">
694
700
  <xsl:call-template name="getLevel">
695
- <xsl:with-param name="depth" select="ribose:title/@depth"/>
701
+ <xsl:with-param name="depth" select="ribose:fmt-title/@depth | ribose:title/@depth"/>
696
702
  </xsl:call-template>
697
703
  </xsl:variable>
698
704
 
@@ -1098,6 +1104,7 @@
1098
1104
  <fo:block-container margin-left="0mm">
1099
1105
  <fo:block>
1100
1106
  <xsl:call-template name="setId"/>
1107
+ <xsl:call-template name="addReviewHelper"/>
1101
1108
  <xsl:apply-templates/>
1102
1109
  </fo:block>
1103
1110
  </fo:block-container>
@@ -1315,7 +1322,7 @@
1315
1322
  </xsl:if>
1316
1323
  </xsl:template>
1317
1324
 
1318
- <xsl:strip-space elements="ribose:xref"/>
1325
+ <!-- <xsl:strip-space elements="ribose:xref"/> -->
1319
1326
 
1320
1327
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1321
1328
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
@@ -2344,6 +2351,10 @@
2344
2351
 
2345
2352
  <xsl:template name="refine_termnote-name-style">
2346
2353
 
2354
+ <!-- <xsl:if test="$namespace = 'ieee'">
2355
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
2356
+ </xsl:if> -->
2357
+
2347
2358
  </xsl:template>
2348
2359
 
2349
2360
  <xsl:attribute-set name="termnote-p-style">
@@ -3064,9 +3075,21 @@
3064
3075
  <xsl:template name="processTables_Contents">
3065
3076
  <tables>
3066
3077
  <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3067
- <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3068
- <xsl:copy-of select="*[local-name() = 'name']"/>
3069
- </table>
3078
+ <xsl:choose>
3079
+ <xsl:when test="*[local-name() = 'fmt-name']">
3080
+ <xsl:variable name="fmt_name">
3081
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3082
+ </xsl:variable>
3083
+ <table id="{@id}" alt-text="{normalize-space($fmt_name)}">
3084
+ <xsl:copy-of select="$fmt_name"/>
3085
+ </table>
3086
+ </xsl:when>
3087
+ <xsl:otherwise>
3088
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3089
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3090
+ </table>
3091
+ </xsl:otherwise>
3092
+ </xsl:choose>
3070
3093
  </xsl:for-each>
3071
3094
  </tables>
3072
3095
  </xsl:template>
@@ -3074,9 +3097,21 @@
3074
3097
  <xsl:template name="processFigures_Contents">
3075
3098
  <figures>
3076
3099
  <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) != '']">
3077
- <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3078
- <xsl:copy-of select="*[local-name() = 'name']"/>
3079
- </figure>
3100
+ <xsl:choose>
3101
+ <xsl:when test="*[local-name() = 'fmt-name']">
3102
+ <xsl:variable name="fmt_name">
3103
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3104
+ </xsl:variable>
3105
+ <figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
3106
+ <xsl:copy-of select="$fmt_name"/>
3107
+ </figure>
3108
+ </xsl:when>
3109
+ <xsl:otherwise>
3110
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3111
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3112
+ </figure>
3113
+ </xsl:otherwise>
3114
+ </xsl:choose>
3080
3115
  </xsl:for-each>
3081
3116
  </figures>
3082
3117
  </xsl:template>
@@ -4900,6 +4935,11 @@
4900
4935
 
4901
4936
  <xsl:value-of select="@reference"/>
4902
4937
 
4938
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4939
+ <!-- <xsl:if test="$namespace = 'itu'">
4940
+ <xsl:text>)</xsl:text>
4941
+ </xsl:if> -->
4942
+
4903
4943
  </fo:inline>
4904
4944
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4905
4945
  <xsl:copy-of select="./node()"/>
@@ -4909,7 +4949,7 @@
4909
4949
 
4910
4950
  </xsl:if>
4911
4951
  </xsl:for-each>
4912
- </xsl:template>
4952
+ </xsl:template> <!-- table_fn_display -->
4913
4953
 
4914
4954
  <xsl:template name="create_fn">
4915
4955
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -4937,8 +4977,10 @@
4937
4977
  <!-- EMD table's footnotes rendering -->
4938
4978
  <!-- ============================ -->
4939
4979
 
4980
+ <!-- ============================ -->
4940
4981
  <!-- figure's footnotes rendering -->
4941
- <xsl:template name="fn_display_figure">
4982
+ <!-- ============================ -->
4983
+ <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
4942
4984
 
4943
4985
  <!-- current figure id -->
4944
4986
  <xsl:variable name="figure_id_">
@@ -5051,9 +5093,28 @@
5051
5093
 
5052
5094
  </fo:block>
5053
5095
  </xsl:if>
5054
-
5055
5096
  </xsl:template> <!-- fn_display_figure -->
5056
5097
 
5098
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
5099
+ <!-- figure's footnote label -->
5100
+ <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">
5101
+ <xsl:variable name="key_iso">
5102
+
5103
+ </xsl:variable>
5104
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5105
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5106
+
5107
+ </xsl:if>
5108
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
5109
+ <!-- <xsl:value-of select="@reference"/> -->
5110
+ <xsl:apply-templates/>
5111
+ </fo:inline>
5112
+ </xsl:template>
5113
+
5114
+ <!-- ============================ -->
5115
+ <!-- END: figure's footnotes rendering -->
5116
+ <!-- ============================ -->
5117
+
5057
5118
  <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
5058
5119
  <xsl:template match="*[local-name()='fn']">
5059
5120
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
@@ -5069,6 +5130,10 @@
5069
5130
 
5070
5131
  <xsl:value-of select="@reference"/>
5071
5132
 
5133
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5134
+ <!-- <xsl:if test="$namespace = 'jis'">
5135
+ <fo:inline font-weight="normal">)</fo:inline>
5136
+ </xsl:if> -->
5072
5137
  </fo:basic-link>
5073
5138
  </fo:inline>
5074
5139
  </xsl:template>
@@ -5195,17 +5260,22 @@
5195
5260
  </fo:block>
5196
5261
  </xsl:when> <!-- END: a few components -->
5197
5262
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
5198
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
5263
+ <!-- Presentation XML contains 'Key' caption, https://github.com/metanorma/isodoc/issues/607 -->
5264
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'p' and @keep-with-next])"> <!-- for old Presentation XML -->
5199
5265
 
5200
- <xsl:call-template name="refine_figure_key_style"/>
5266
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
5201
5267
 
5202
- <xsl:variable name="title-key">
5203
- <xsl:call-template name="getLocalizedString">
5204
- <xsl:with-param name="key">key</xsl:with-param>
5205
- </xsl:call-template>
5206
- </xsl:variable>
5207
- <xsl:value-of select="$title-key"/>
5208
- </fo:block>
5268
+ <xsl:call-template name="refine_figure_key_style"/>
5269
+
5270
+ <xsl:variable name="title-key">
5271
+ <xsl:call-template name="getLocalizedString">
5272
+ <xsl:with-param name="key">key</xsl:with-param>
5273
+ </xsl:call-template>
5274
+ </xsl:variable>
5275
+ <xsl:value-of select="$title-key"/>
5276
+ </fo:block>
5277
+
5278
+ </xsl:if>
5209
5279
  </xsl:when> <!-- END: definition list in a figure -->
5210
5280
  </xsl:choose>
5211
5281
 
@@ -5391,6 +5461,14 @@
5391
5461
 
5392
5462
  </xsl:template> <!-- END: dl -->
5393
5463
 
5464
+ <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
5465
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
5466
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
5467
+ <xsl:call-template name="refine_figure_key_style"/>
5468
+ <xsl:apply-templates/>
5469
+ </fo:block>
5470
+ </xsl:template>
5471
+
5394
5472
  <xsl:template name="refine_dl_formula_where_style">
5395
5473
 
5396
5474
  </xsl:template> <!-- refine_dl_formula_where_style -->
@@ -7434,6 +7512,39 @@
7434
7512
  </xsl:copy>
7435
7513
  </xsl:template>
7436
7514
 
7515
+ <xsl:template match="@*|node()" mode="mathml_linebreak">
7516
+ <xsl:copy>
7517
+ <xsl:apply-templates select="@*|node()" mode="mathml_linebreak"/>
7518
+ </xsl:copy>
7519
+ </xsl:template>
7520
+
7521
+ <!-- split math into two math -->
7522
+ <xsl:template match="mathml:mo[@linebreak] | mathml:mspace[@linebreak]" mode="mathml_linebreak">
7523
+ <xsl:variable name="math_elements_tree_">
7524
+ <xsl:for-each select="ancestor::*[ancestor-or-self::mathml:math]">
7525
+ <element pos="{position()}">
7526
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
7527
+ <xsl:value-of select="name()"/>
7528
+ </element>
7529
+ </xsl:for-each>
7530
+ </xsl:variable>
7531
+
7532
+ <xsl:variable name="math_elements_tree" select="xalan:nodeset($math_elements_tree_)"/>
7533
+
7534
+ <xsl:call-template name="insertClosingElements">
7535
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
7536
+ </xsl:call-template>
7537
+
7538
+ <xsl:element name="br" namespace="{$namespace_full}"/>
7539
+
7540
+ <xsl:call-template name="insertOpeningElements">
7541
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
7542
+ <xsl:with-param name="xmlns">http://www.w3.org/1998/Math/MathML</xsl:with-param>
7543
+ <xsl:with-param name="add_continue">false</xsl:with-param>
7544
+ </xsl:call-template>
7545
+
7546
+ </xsl:template>
7547
+
7437
7548
  <!-- Examples:
7438
7549
  <stem type="AsciiMath">x = 1</stem>
7439
7550
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -7685,9 +7796,11 @@
7685
7796
  </xsl:template>
7686
7797
 
7687
7798
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
7799
+ <!-- https://github.com/metanorma/isodoc/issues/607
7688
7800
  <xsl:if test="normalize-space() != ''">
7689
- <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
7690
- </xsl:if>
7801
+ <xsl:text>(</xsl:text><xsl:apply-templates /><xsl:text>)</xsl:text>
7802
+ </xsl:if> -->
7803
+ <xsl:apply-templates/>
7691
7804
  </xsl:template>
7692
7805
 
7693
7806
  <!-- stem inside formula with name (with formula's number) -->
@@ -7758,6 +7871,8 @@
7758
7871
 
7759
7872
  <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
7760
7873
 
7874
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab"/>
7875
+
7761
7876
  <xsl:call-template name="refine_note-name-style"/>
7762
7877
 
7763
7878
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -7814,10 +7929,6 @@
7814
7929
 
7815
7930
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
7816
7931
 
7817
- <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
7818
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
7819
- </xsl:if>
7820
-
7821
7932
  <xsl:call-template name="refine_termnote-name-style"/>
7822
7933
 
7823
7934
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -7843,8 +7954,17 @@
7843
7954
  </xsl:when>
7844
7955
  <xsl:otherwise>
7845
7956
 
7957
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
7958
+ <!-- <xsl:if test="$namespace = 'ieee'">
7959
+ <xsl:text>—</xsl:text> em dash &#x2014;
7960
+ </xsl:if> -->
7961
+ <!-- <xsl:if test="$namespace = 'iho' or $namespace = 'gb' or $namespace = 'm3d' or $namespace = 'unece-rec' or $namespace = 'unece' or $namespace = 'rsd'">
7846
7962
  <xsl:text>:</xsl:text>
7963
+ </xsl:if> -->
7847
7964
 
7965
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp'">
7966
+ <xsl:text> – </xsl:text> en dash &#x2013;
7967
+ </xsl:if> -->
7848
7968
  </xsl:otherwise>
7849
7969
  </xsl:choose>
7850
7970
  </xsl:variable>
@@ -7863,8 +7983,16 @@
7863
7983
  </xsl:when>
7864
7984
  <xsl:otherwise>
7865
7985
 
7986
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
7987
+ <!-- <xsl:if test="$namespace = 'ieee'">
7988
+ <xsl:text>—</xsl:text> em dash &#x2014;
7989
+ </xsl:if> -->
7990
+ <!-- <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'">
7866
7991
  <xsl:text>:</xsl:text>
7867
-
7992
+ </xsl:if> -->
7993
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'unece-rec' or $namespace = 'unece'">
7994
+ <xsl:text> – </xsl:text> en dash &#x2013;
7995
+ </xsl:if> -->
7868
7996
  </xsl:otherwise>
7869
7997
  </xsl:choose>
7870
7998
  </xsl:variable>
@@ -7950,15 +8078,27 @@
7950
8078
  <!-- Example: Dimensions in millimeters -->
7951
8079
  <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
7952
8080
 
8081
+ <xsl:variable name="show_figure_key_in_block_container">
8082
+ true
8083
+ </xsl:variable>
8084
+
7953
8085
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
7954
8086
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
7955
8087
  </fo:block>
7956
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
7957
- <xsl:call-template name="note"/>
7958
- </xsl:for-each>
7959
- <xsl:call-template name="fn_display_figure"/>
8088
+
8089
+ <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
8090
+ <xsl:call-template name="showFigureKey"/>
8091
+ </xsl:if>
7960
8092
 
7961
8093
  </fo:block-container>
8094
+
8095
+ </xsl:template>
8096
+
8097
+ <xsl:template name="showFigureKey">
8098
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8099
+ <xsl:call-template name="note"/>
8100
+ </xsl:for-each>
8101
+ <xsl:call-template name="fn_display_figure"/>
7962
8102
  </xsl:template>
7963
8103
 
7964
8104
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -8154,6 +8294,22 @@
8154
8294
  </xsl:if>
8155
8295
  </xsl:template>
8156
8296
 
8297
+ <xsl:template name="getImageSrc">
8298
+ <xsl:choose>
8299
+ <xsl:when test="not(starts-with(@src, 'data:'))">
8300
+ <xsl:choose>
8301
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8302
+ <xsl:value-of select="@src"/>
8303
+ </xsl:when>
8304
+ <xsl:otherwise>
8305
+ <xsl:value-of select="concat($basepath, @src)"/>
8306
+ </xsl:otherwise>
8307
+ </xsl:choose>
8308
+ </xsl:when>
8309
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8310
+ </xsl:choose>
8311
+ </xsl:template>
8312
+
8157
8313
  <xsl:template name="getImageScale">
8158
8314
  <xsl:param name="indent"/>
8159
8315
  <xsl:variable name="indent_left">
@@ -8163,19 +8319,7 @@
8163
8319
  </xsl:choose>
8164
8320
  </xsl:variable>
8165
8321
  <xsl:variable name="img_src">
8166
- <xsl:choose>
8167
- <xsl:when test="not(starts-with(@src, 'data:'))">
8168
- <xsl:choose>
8169
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8170
- <xsl:value-of select="@src"/>
8171
- </xsl:when>
8172
- <xsl:otherwise>
8173
- <xsl:value-of select="concat($basepath, @src)"/>
8174
- </xsl:otherwise>
8175
- </xsl:choose>
8176
- </xsl:when>
8177
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8178
- </xsl:choose>
8322
+ <xsl:call-template name="getImageSrc"/>
8179
8323
  </xsl:variable>
8180
8324
 
8181
8325
  <xsl:variable name="image_width_effective">
@@ -8183,10 +8327,15 @@
8183
8327
  <xsl:value-of select="$width_effective - number($indent_left)"/>
8184
8328
 
8185
8329
  </xsl:variable>
8330
+ <xsl:variable name="image_height_effective" select="$height_effective - number($indent_left)"/>
8186
8331
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8187
8332
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8188
8333
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
8189
- <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8334
+ <xsl:variable name="scale">
8335
+
8336
+ <xsl:value-of select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8337
+
8338
+ </xsl:variable>
8190
8339
  <xsl:value-of select="$scale"/>
8191
8340
  </xsl:template>
8192
8341
 
@@ -8739,20 +8888,48 @@
8739
8888
  <xsl:template match="*[local-name() = 'emf']"/>
8740
8889
 
8741
8890
  <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">
8891
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
8892
+ <xsl:apply-templates mode="contents"/>
8893
+ <xsl:text> </xsl:text>
8894
+ </xsl:if>
8895
+ </xsl:template>
8896
+
8897
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="contents"/>
8898
+
8899
+ <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">
8742
8900
  <xsl:apply-templates mode="contents"/>
8743
8901
  <xsl:text> </xsl:text>
8744
8902
  </xsl:template>
8745
8903
 
8746
8904
  <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">
8905
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
8906
+ <xsl:apply-templates mode="bookmarks"/>
8907
+ <xsl:text> </xsl:text>
8908
+ </xsl:if>
8909
+ </xsl:template>
8910
+
8911
+ <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">
8747
8912
  <xsl:apply-templates mode="bookmarks"/>
8748
8913
  <xsl:text> </xsl:text>
8749
8914
  </xsl:template>
8750
8915
 
8751
8916
  <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">
8917
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
8918
+ <xsl:value-of select="."/>
8919
+ </xsl:if>
8920
+ </xsl:template>
8921
+
8922
+ <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">
8752
8923
  <xsl:value-of select="."/>
8753
8924
  </xsl:template>
8754
8925
 
8755
8926
  <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">
8927
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
8928
+ <xsl:value-of select="."/>
8929
+ </xsl:if>
8930
+ </xsl:template>
8931
+
8932
+ <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">
8756
8933
  <xsl:value-of select="."/>
8757
8934
  </xsl:template>
8758
8935
 
@@ -8773,7 +8950,7 @@
8773
8950
  </xsl:template>
8774
8951
 
8775
8952
  <!-- special case: ignore section-title if @depth different than @depth of parent clause, or @depth of parent clause = 1 -->
8776
- <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"/>
8953
+ <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"/>
8777
8954
 
8778
8955
  <xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
8779
8956
  <xsl:variable name="level">
@@ -8785,6 +8962,9 @@
8785
8962
  <xsl:variable name="section">
8786
8963
  <xsl:choose>
8787
8964
  <xsl:when test="@type = 'section-title'"/>
8965
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
8966
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
8967
+ </xsl:when>
8788
8968
  <xsl:otherwise>
8789
8969
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8790
8970
  </xsl:otherwise>
@@ -8807,6 +8987,19 @@
8807
8987
 
8808
8988
  <xsl:variable name="title">
8809
8989
  <xsl:choose>
8990
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/770 -->
8991
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
8992
+ <xsl:choose>
8993
+ <xsl:when test="@type = 'section-title'">
8994
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
8995
+ <xsl:text>: </xsl:text>
8996
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8997
+ </xsl:when>
8998
+ <xsl:otherwise>
8999
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9000
+ </xsl:otherwise>
9001
+ </xsl:choose>
9002
+ </xsl:when>
8810
9003
  <xsl:when test="*[local-name() = 'tab']">
8811
9004
  <xsl:choose>
8812
9005
  <xsl:when test="@type = 'section-title'">
@@ -8842,7 +9035,7 @@
8842
9035
  <xsl:apply-templates mode="bookmarks"/>
8843
9036
  </xsl:template>
8844
9037
 
8845
- <xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
9038
+ <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">
8846
9039
  <xsl:apply-templates select="."/>
8847
9040
  </xsl:template>
8848
9041
 
@@ -8855,6 +9048,10 @@
8855
9048
  <xsl:apply-templates mode="contents"/>
8856
9049
  </xsl:template>
8857
9050
 
9051
+ <xsl:template match="*[local-name() = 'semx']" mode="contents">
9052
+ <xsl:apply-templates mode="contents"/>
9053
+ </xsl:template>
9054
+
8858
9055
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
8859
9056
  <xsl:apply-templates mode="bookmarks"/>
8860
9057
  </xsl:template>
@@ -8864,9 +9061,14 @@
8864
9061
  <xsl:apply-templates mode="bookmarks"/>
8865
9062
  </xsl:template>
8866
9063
 
9064
+ <xsl:template match="*[local-name() = 'semx']" mode="bookmarks">
9065
+ <xsl:apply-templates mode="bookmarks"/>
9066
+ </xsl:template>
9067
+
8867
9068
  <!-- Bookmarks -->
8868
9069
  <xsl:template name="addBookmarks">
8869
9070
  <xsl:param name="contents"/>
9071
+ <xsl:param name="contents_addon"/>
8870
9072
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
8871
9073
  <xsl:if test="$contents_nodes//item">
8872
9074
  <fo:bookmark-tree>
@@ -8964,6 +9166,9 @@
8964
9166
  </xsl:otherwise>
8965
9167
  </xsl:choose>
8966
9168
 
9169
+ <!-- for $namespace = 'nist-sp' $namespace = 'ogc' $namespace = 'ogc-white-paper' -->
9170
+ <xsl:copy-of select="$contents_addon"/>
9171
+
8967
9172
  </fo:bookmark-tree>
8968
9173
  </xsl:if>
8969
9174
  </xsl:template>
@@ -9117,6 +9322,16 @@
9117
9322
  <!-- ====== -->
9118
9323
  <!-- ====== -->
9119
9324
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
9325
+ <xsl:param name="mode">bookmarks</xsl:param>
9326
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-title'])">
9327
+ <xsl:apply-templates mode="contents_item">
9328
+ <xsl:with-param name="mode" select="$mode"/>
9329
+ </xsl:apply-templates>
9330
+ <!-- <xsl:text> </xsl:text> -->
9331
+ </xsl:if>
9332
+ </xsl:template>
9333
+
9334
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="contents_item">
9120
9335
  <xsl:param name="mode">bookmarks</xsl:param>
9121
9336
  <xsl:apply-templates mode="contents_item">
9122
9337
  <xsl:with-param name="mode" select="$mode"/>
@@ -9124,12 +9339,38 @@
9124
9339
  <!-- <xsl:text> </xsl:text> -->
9125
9340
  </xsl:template>
9126
9341
 
9342
+ <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">
9343
+ <xsl:apply-templates mode="contents_item"/>
9344
+ </xsl:template>
9345
+
9346
+ <xsl:template match="*[local-name() = 'semx']" mode="contents_item">
9347
+ <xsl:apply-templates mode="contents_item"/>
9348
+ </xsl:template>
9349
+
9350
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="contents_item"/>
9351
+
9127
9352
  <xsl:template name="getSection">
9128
- <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9353
+ <xsl:choose>
9354
+ <xsl:when test="*[local-name() = 'fmt-title']">
9355
+ <xsl:variable name="fmt_title_section">
9356
+ <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')]"/>
9357
+ </xsl:variable>
9358
+ <xsl:value-of select="normalize-space($fmt_title_section)"/>
9359
+ </xsl:when>
9360
+ <xsl:otherwise>
9361
+ <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9362
+ </xsl:otherwise>
9363
+ </xsl:choose>
9129
9364
  </xsl:template>
9130
9365
 
9131
9366
  <xsl:template name="getName">
9132
9367
  <xsl:choose>
9368
+ <xsl:when test="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']]">
9369
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/following-sibling::node()"/>
9370
+ </xsl:when>
9371
+ <xsl:when test="*[local-name() = 'fmt-title']">
9372
+ <xsl:copy-of select="*[local-name() = 'fmt-title']/node()"/>
9373
+ </xsl:when>
9133
9374
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
9134
9375
  <xsl:copy-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/following-sibling::node()"/>
9135
9376
  </xsl:when>
@@ -9236,6 +9477,15 @@
9236
9477
  </xsl:template>
9237
9478
 
9238
9479
  <xsl:template match="*[local-name() = 'name']" mode="contents_item">
9480
+ <xsl:param name="mode">bookmarks</xsl:param>
9481
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
9482
+ <xsl:apply-templates mode="contents_item">
9483
+ <xsl:with-param name="mode" select="$mode"/>
9484
+ </xsl:apply-templates>
9485
+ </xsl:if>
9486
+ </xsl:template>
9487
+
9488
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="contents_item">
9239
9489
  <xsl:param name="mode">bookmarks</xsl:param>
9240
9490
  <xsl:apply-templates mode="contents_item">
9241
9491
  <xsl:with-param name="mode" select="$mode"/>
@@ -10036,7 +10286,7 @@
10036
10286
  <xsl:if test="normalize-space() != ''">
10037
10287
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
10038
10288
  <xsl:call-template name="refine_termexample-name-style"/>
10039
- <xsl:apply-templates/>:
10289
+ <xsl:apply-templates/>: <!-- commented $namespace = 'ieee', https://github.com/metanorma/isodoc/issues/614-->
10040
10290
  </fo:inline>
10041
10291
  </xsl:if>
10042
10292
  </xsl:template>
@@ -10077,107 +10327,108 @@
10077
10327
  -->
10078
10328
  <xsl:template match="*[local-name() = 'example']">
10079
10329
 
10080
- <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10081
-
10082
- <xsl:call-template name="setBlockSpanAll"/>
10330
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10083
10331
 
10084
- <xsl:call-template name="refine_example-style"/>
10332
+ <xsl:call-template name="setBlockSpanAll"/>
10085
10333
 
10086
- <xsl:variable name="fo_element">
10087
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
10088
- inline
10089
- </xsl:variable>
10334
+ <xsl:call-template name="refine_example-style"/>
10090
10335
 
10091
- <fo:block-container margin-left="0mm" role="SKIP">
10336
+ <xsl:variable name="fo_element">
10337
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
10338
+ inline
10339
+ </xsl:variable>
10092
10340
 
10093
- <xsl:choose>
10341
+ <fo:block-container margin-left="0mm" role="SKIP">
10094
10342
 
10095
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
10343
+ <xsl:choose>
10096
10344
 
10097
- <!-- display name 'EXAMPLE' in a separate block -->
10098
- <fo:block>
10099
- <xsl:apply-templates select="*[local-name()='name']">
10100
- <xsl:with-param name="fo_element" select="$fo_element"/>
10101
- </xsl:apply-templates>
10102
- </fo:block>
10345
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
10103
10346
 
10104
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10105
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10106
- <xsl:variable name="example_body">
10107
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10347
+ <!-- display name 'EXAMPLE' in a separate block -->
10348
+ <fo:block>
10349
+ <xsl:apply-templates select="*[local-name()='name']">
10108
10350
  <xsl:with-param name="fo_element" select="$fo_element"/>
10109
10351
  </xsl:apply-templates>
10352
+ </fo:block>
10353
+
10354
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10355
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10356
+ <xsl:variable name="example_body">
10357
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10358
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10359
+ </xsl:apply-templates>
10360
+ </xsl:variable>
10361
+ <xsl:choose>
10362
+ <xsl:when test="xalan:nodeset($example_body)/*">
10363
+ <xsl:copy-of select="$example_body"/>
10364
+ </xsl:when>
10365
+ <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
10366
+ </xsl:choose>
10367
+ </fo:block-container>
10368
+ </fo:block-container>
10369
+ </xsl:when> <!-- end block -->
10370
+
10371
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
10372
+
10373
+ <xsl:variable name="provisional_distance_between_starts_">
10374
+ 7
10110
10375
  </xsl:variable>
10111
- <xsl:choose>
10112
- <xsl:when test="xalan:nodeset($example_body)/*">
10113
- <xsl:copy-of select="$example_body"/>
10114
- </xsl:when>
10115
- <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
10116
- </xsl:choose>
10117
- </fo:block-container>
10118
- </fo:block-container>
10119
- </xsl:when> <!-- end block -->
10376
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10377
+ <xsl:variable name="indent_">
10378
+ 0
10379
+ </xsl:variable>
10380
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
10120
10381
 
10121
- <xsl:when test="contains(normalize-space($fo_element), 'list')">
10382
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10383
+ <fo:list-item>
10384
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
10385
+ <fo:block>
10386
+ <xsl:apply-templates select="*[local-name()='name']">
10387
+ <xsl:with-param name="fo_element">block</xsl:with-param>
10388
+ </xsl:apply-templates>
10389
+ </fo:block>
10390
+ </fo:list-item-label>
10391
+ <fo:list-item-body start-indent="body-start()">
10392
+ <fo:block>
10393
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10394
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10395
+ </xsl:apply-templates>
10396
+ </fo:block>
10397
+ </fo:list-item-body>
10398
+ </fo:list-item>
10399
+ </fo:list-block>
10400
+ </xsl:when> <!-- end list -->
10122
10401
 
10123
- <xsl:variable name="provisional_distance_between_starts_">
10124
- 7
10125
- </xsl:variable>
10126
- <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10127
- <xsl:variable name="indent_">
10128
- 0
10129
- </xsl:variable>
10130
- <xsl:variable name="indent" select="normalize-space($indent_)"/>
10402
+ <xsl:otherwise> <!-- inline -->
10131
10403
 
10132
- <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10133
- <fo:list-item>
10134
- <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
10135
- <fo:block>
10136
- <xsl:apply-templates select="*[local-name()='name']">
10137
- <xsl:with-param name="fo_element">block</xsl:with-param>
10138
- </xsl:apply-templates>
10139
- </fo:block>
10140
- </fo:list-item-label>
10141
- <fo:list-item-body start-indent="body-start()">
10142
- <fo:block>
10143
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10404
+ <!-- display 'EXAMPLE' and first element in the same line -->
10405
+ <fo:block>
10406
+ <xsl:apply-templates select="*[local-name()='name']">
10407
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10408
+ </xsl:apply-templates>
10409
+ <fo:inline>
10410
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
10144
10411
  <xsl:with-param name="fo_element" select="$fo_element"/>
10145
10412
  </xsl:apply-templates>
10146
- </fo:block>
10147
- </fo:list-item-body>
10148
- </fo:list-item>
10149
- </fo:list-block>
10150
- </xsl:when> <!-- end list -->
10151
-
10152
- <xsl:otherwise> <!-- inline -->
10413
+ </fo:inline>
10414
+ </fo:block>
10153
10415
 
10154
- <!-- display 'EXAMPLE' and first element in the same line -->
10155
- <fo:block>
10156
- <xsl:apply-templates select="*[local-name()='name']">
10157
- <xsl:with-param name="fo_element" select="$fo_element"/>
10158
- </xsl:apply-templates>
10159
- <fo:inline>
10160
- <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
10161
- <xsl:with-param name="fo_element" select="$fo_element"/>
10162
- </xsl:apply-templates>
10163
- </fo:inline>
10164
- </fo:block>
10416
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
10417
+ <!-- display further elements in blocks -->
10418
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10419
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10420
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
10421
+ <xsl:with-param name="fo_element" select="'block'"/>
10422
+ </xsl:apply-templates>
10423
+ </fo:block-container>
10424
+ </fo:block-container>
10425
+ </xsl:if>
10426
+ </xsl:otherwise> <!-- end inline -->
10165
10427
 
10166
- <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
10167
- <!-- display further elements in blocks -->
10168
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10169
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10170
- <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
10171
- <xsl:with-param name="fo_element" select="'block'"/>
10172
- </xsl:apply-templates>
10173
- </fo:block-container>
10174
- </fo:block-container>
10175
- </xsl:if>
10176
- </xsl:otherwise> <!-- end inline -->
10428
+ </xsl:choose>
10429
+ </fo:block-container>
10430
+ </fo:block-container>
10177
10431
 
10178
- </xsl:choose>
10179
- </fo:block-container>
10180
- </fo:block-container>
10181
10432
  </xsl:template>
10182
10433
 
10183
10434
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
@@ -10198,7 +10449,7 @@
10198
10449
  <xsl:otherwise>
10199
10450
  <fo:inline xsl:use-attribute-sets="example-name-style">
10200
10451
  <xsl:call-template name="refine_example-name-style"/>
10201
- <xsl:apply-templates/>:
10452
+ <xsl:apply-templates/>: <!-- $namespace = 'ieee', see https://github.com/metanorma/isodoc/issues/614 -->
10202
10453
  </fo:inline>
10203
10454
  </xsl:otherwise>
10204
10455
  </xsl:choose>
@@ -10385,15 +10636,17 @@
10385
10636
 
10386
10637
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10387
10638
  <fo:block role="BlockQuote">
10388
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
10639
+ <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 -->
10389
10640
  </fo:block>
10390
10641
  </fo:block-container>
10391
10642
  </fo:block-container>
10392
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
10643
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source'] or *[local-name() = 'attribution']">
10393
10644
  <fo:block xsl:use-attribute-sets="quote-source-style">
10394
10645
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
10395
10646
  <xsl:apply-templates select="*[local-name() = 'author']"/>
10396
10647
  <xsl:apply-templates select="*[local-name() = 'source']"/>
10648
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
10649
+ <xsl:apply-templates select="*[local-name() = 'attribution']/*[local-name() = 'p']/node()"/>
10397
10650
  </fo:block>
10398
10651
  </xsl:if>
10399
10652
 
@@ -10415,9 +10668,13 @@
10415
10668
  </xsl:template>
10416
10669
 
10417
10670
  <xsl:template match="*[local-name() = 'author']">
10418
- <xsl:text>— </xsl:text>
10671
+ <xsl:if test="local-name(..) = 'quote'"> <!-- for old Presentation XML, https://github.com/metanorma/isodoc/issues/607 -->
10672
+ <xsl:text>— </xsl:text>
10673
+ </xsl:if>
10419
10674
  <xsl:apply-templates/>
10420
10675
  </xsl:template>
10676
+
10677
+ <xsl:template match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
10421
10678
  <!-- ====== -->
10422
10679
  <!-- ====== -->
10423
10680
 
@@ -10554,6 +10811,15 @@
10554
10811
 
10555
10812
  </xsl:template> <!-- tab -->
10556
10813
 
10814
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
10815
+ <xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
10816
+
10817
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
10818
+
10819
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
10820
+
10821
+ </xsl:template>
10822
+
10557
10823
  <xsl:template name="insertNonBreakSpaces">
10558
10824
  <xsl:param name="count"/>
10559
10825
  <xsl:if test="$count &gt; 0">
@@ -10593,8 +10859,12 @@
10593
10859
  </xsl:template>
10594
10860
 
10595
10861
  <xsl:template match="*[local-name() = 'domain']">
10862
+ <!-- https://github.com/metanorma/isodoc/issues/607
10596
10863
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
10597
- <xsl:text> </xsl:text>
10864
+ <xsl:text> </xsl:text> -->
10865
+ <xsl:if test="not(@hidden = 'true')">
10866
+ <xsl:apply-templates/>
10867
+ </xsl:if>
10598
10868
  </xsl:template>
10599
10869
 
10600
10870
  <xsl:template match="*[local-name() = 'admitted']">
@@ -10642,6 +10912,29 @@
10642
10912
  <!-- END definition -->
10643
10913
  <!-- ========== -->
10644
10914
 
10915
+ <xsl:variable name="reviews_">
10916
+ <xsl:for-each select="//*[local-name() = 'review'][@from]">
10917
+ <xsl:copy>
10918
+ <xsl:copy-of select="@from"/>
10919
+ <xsl:copy-of select="@id"/>
10920
+ </xsl:copy>
10921
+ </xsl:for-each>
10922
+ </xsl:variable>
10923
+ <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
10924
+
10925
+ <xsl:template name="addReviewHelper">
10926
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10927
+ <xsl:variable name="curr_id" select="@id"/>
10928
+ <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
10929
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10930
+ <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>
10931
+ </xsl:if>
10932
+ <!-- <fo:block>
10933
+ <curr_id><xsl:value-of select="$curr_id"/></curr_id>
10934
+ <xsl:copy-of select="$reviews"/>
10935
+ </fo:block> -->
10936
+ </xsl:template>
10937
+
10645
10938
  <!-- main sections -->
10646
10939
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
10647
10940
 
@@ -10650,6 +10943,8 @@
10650
10943
 
10651
10944
  <xsl:call-template name="sections_element_style"/>
10652
10945
 
10946
+ <xsl:call-template name="addReviewHelper"/>
10947
+
10653
10948
  <xsl:apply-templates/>
10654
10949
  </fo:block>
10655
10950
 
@@ -10690,6 +10985,7 @@
10690
10985
 
10691
10986
  <fo:block>
10692
10987
  <xsl:call-template name="setId"/>
10988
+ <xsl:call-template name="addReviewHelper"/>
10693
10989
  <xsl:apply-templates/>
10694
10990
  </fo:block>
10695
10991
  </xsl:template>
@@ -10726,6 +11022,8 @@
10726
11022
 
10727
11023
  <xsl:call-template name="refine_clause_style"/>
10728
11024
 
11025
+ <xsl:call-template name="addReviewHelper"/>
11026
+
10729
11027
  <xsl:apply-templates/>
10730
11028
  </fo:block>
10731
11029
  </xsl:template>
@@ -10778,6 +11076,23 @@
10778
11076
 
10779
11077
  <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
10780
11078
 
11079
+ <xsl:if test="1 = 1">
11080
+ <xsl:choose>
11081
+ <!-- if there isn't the attribute '@from', then -->
11082
+ <xsl:when test="$id_from = ''">
11083
+ <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>
11084
+ </xsl:when>
11085
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11086
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
11087
+ <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>
11088
+ </xsl:when>
11089
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11090
+ <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>
11091
+ </xsl:when>
11092
+ </xsl:choose>
11093
+ </xsl:if>
11094
+
11095
+ <xsl:if test="1 = 2">
10781
11096
  <xsl:choose>
10782
11097
  <!-- if there isn't the attribute '@from', then -->
10783
11098
  <xsl:when test="$id_from = ''">
@@ -10791,6 +11106,7 @@
10791
11106
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10792
11107
  </xsl:when>
10793
11108
  </xsl:choose>
11109
+ </xsl:if>
10794
11110
 
10795
11111
  </xsl:template>
10796
11112
 
@@ -12039,6 +12355,10 @@
12039
12355
  <!-- - Remove semantic xml part -->
12040
12356
  <!-- - Remove image/emf (EMF vector image for Word) -->
12041
12357
  <!-- - add @id, redundant for table auto-layout algorithm -->
12358
+ <!-- - process 'passthrough' element -->
12359
+ <!-- - split math by element with @linebreak into maths -->
12360
+ <!-- - rename fmt-title to title, fmt-name to name and another changes to convert new presentation XML to -->
12361
+ <!-- - old XML without significant changes in XSLT -->
12042
12362
  <!-- =========================================================================== -->
12043
12363
  <xsl:template match="@*|node()" mode="update_xml_step1">
12044
12364
  <xsl:copy>
@@ -12046,6 +12366,12 @@
12046
12366
  </xsl:copy>
12047
12367
  </xsl:template>
12048
12368
 
12369
+ <xsl:template match="@*|node()" mode="update_xml_pres">
12370
+ <xsl:copy>
12371
+ <xsl:apply-templates select="@*|node()" mode="update_xml_pres"/>
12372
+ </xsl:copy>
12373
+ </xsl:template>
12374
+
12049
12375
  <!-- change section's order based on @displayorder value -->
12050
12376
  <xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
12051
12377
  <xsl:copy>
@@ -12122,7 +12448,7 @@
12122
12448
  </xsl:template>
12123
12449
 
12124
12450
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
12125
- <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">
12451
+ <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">
12126
12452
  <xsl:copy>
12127
12453
  <xsl:copy-of select="@*"/>
12128
12454
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12141,14 +12467,17 @@
12141
12467
 
12142
12468
  <!-- remove semantic xml -->
12143
12469
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
12470
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_pres"/>
12144
12471
 
12145
12472
  <!-- remove image/emf -->
12146
12473
  <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
12474
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_pres"/>
12147
12475
 
12148
12476
  <!-- remove preprocess-xslt -->
12149
12477
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
12478
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
12150
12479
 
12151
- <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image'] | *[local-name() = 'sourcecode'] | *[local-name() = 'bibdata'] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
12480
+ <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">
12152
12481
  <xsl:copy-of select="."/>
12153
12482
  </xsl:template>
12154
12483
 
@@ -12214,6 +12543,93 @@
12214
12543
  </xsl:choose>
12215
12544
  </xsl:template>
12216
12545
 
12546
+ <xsl:variable name="regex_passthrough">.*\bpdf\b.*</xsl:variable>
12547
+ <xsl:template match="*[local-name() = 'passthrough']" mode="update_xml_step1">
12548
+ <!-- <xsl:if test="contains(@formats, ' pdf ')"> -->
12549
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@formats), $regex_passthrough)) = 'true'">
12550
+ <xsl:apply-templates mode="update_xml_step1"/>
12551
+ </xsl:if>
12552
+ </xsl:template>
12553
+
12554
+ <!-- split math by element with @linebreak into maths -->
12555
+ <xsl:template match="mathml:math[.//mathml:mo[@linebreak] or .//mathml:mspace[@linebreak]]" mode="update_xml_step1">
12556
+ <xsl:variable name="maths">
12557
+ <xsl:apply-templates select="." mode="mathml_linebreak"/>
12558
+ </xsl:variable>
12559
+ <xsl:copy-of select="$maths"/>
12560
+ </xsl:template>
12561
+
12562
+ <!-- update new Presentation XML -->
12563
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_step1"/>
12564
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_pres"/>
12565
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_step1"/>
12566
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
12567
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
12568
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
12569
+
12570
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
12571
+ <xsl:copy>
12572
+ <xsl:apply-templates select="@*" mode="update_xml_step1"/>
12573
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
12574
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
12575
+ </xsl:copy>
12576
+ </xsl:template>
12577
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_pres">
12578
+ <xsl:copy>
12579
+ <xsl:apply-templates select="@*" mode="update_xml_pres"/>
12580
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
12581
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
12582
+ </xsl:copy>
12583
+ </xsl:template>
12584
+
12585
+ <xsl:template match="*[local-name() = 'fmt-title']"/>
12586
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
12587
+ <xsl:element name="title" namespace="{$namespace_full}">
12588
+ <xsl:copy-of select="@*"/>
12589
+ <xsl:apply-templates mode="update_xml_step1"/>
12590
+ </xsl:element>
12591
+ </xsl:template>
12592
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
12593
+ <xsl:element name="title" namespace="{$namespace_full}">
12594
+ <xsl:copy-of select="@*"/>
12595
+ <xsl:apply-templates mode="update_xml_pres"/>
12596
+ </xsl:element>
12597
+ </xsl:template>
12598
+
12599
+ <xsl:template match="*[local-name() = 'fmt-name']"/>
12600
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
12601
+ <xsl:element name="name" namespace="{$namespace_full}">
12602
+ <xsl:copy-of select="@*"/>
12603
+ <xsl:apply-templates mode="update_xml_step1"/>
12604
+ </xsl:element>
12605
+ </xsl:template>
12606
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres">
12607
+ <xsl:element name="name" namespace="{$namespace_full}">
12608
+ <xsl:copy-of select="@*"/>
12609
+ <xsl:apply-templates mode="update_xml_pres"/>
12610
+ </xsl:element>
12611
+ </xsl:template>
12612
+
12613
+ <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">
12614
+ <xsl:apply-templates mode="update_xml_step1"/>
12615
+ </xsl:template>
12616
+ <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">
12617
+ <xsl:apply-templates mode="update_xml_pres"/>
12618
+ </xsl:template>
12619
+
12620
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_step1">
12621
+ <xsl:apply-templates mode="update_xml_step1"/>
12622
+ </xsl:template>
12623
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_pres">
12624
+ <xsl:apply-templates mode="update_xml_pres"/>
12625
+ </xsl:template>
12626
+
12627
+ <xsl:template match="*[local-name() = 'fmt-xref-label']"/>
12628
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_step1"/>
12629
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_pres"/>
12630
+
12631
+ <!-- END: update new Presentation XML -->
12632
+
12217
12633
  <!-- =========================================================================== -->
12218
12634
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12219
12635
  <!-- =========================================================================== -->
@@ -12317,6 +12733,8 @@
12317
12733
 
12318
12734
  <xsl:template name="insertOpeningElements">
12319
12735
  <xsl:param name="tree"/>
12736
+ <xsl:param name="xmlns"/>
12737
+ <xsl:param name="add_continue">true</xsl:param>
12320
12738
  <xsl:for-each select="$tree//element">
12321
12739
  <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
12322
12740
  <xsl:value-of select="."/>
@@ -12327,7 +12745,8 @@
12327
12745
  <xsl:value-of select="."/>
12328
12746
  <xsl:text>"</xsl:text>
12329
12747
  </xsl:for-each>
12330
- <xsl:if test="position() = 1"> continue="true"</xsl:if>
12748
+ <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
12749
+ <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
12331
12750
  <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
12332
12751
  <xsl:if test="$debug = 'true'">
12333
12752
  <xsl:message>&lt;<xsl:value-of select="."/>&gt;</xsl:message>
@@ -12403,7 +12822,7 @@
12403
12822
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
12404
12823
  <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>
12405
12824
 
12406
- <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">
12825
+ <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">
12407
12826
 
12408
12827
  <xsl:variable name="parent" select="local-name(..)"/>
12409
12828
 
@@ -12982,6 +13401,7 @@
12982
13401
  </pdf:catalog>
12983
13402
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
12984
13403
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
13404
+ <!-- Commented after upgrade to Apache FOP 2.10
12985
13405
  <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="">
12986
13406
  <pdfaExtension:schemas>
12987
13407
  <rdf:Bag>
@@ -13014,7 +13434,7 @@
13014
13434
  </rdf:li>
13015
13435
  </rdf:Bag>
13016
13436
  </pdfaExtension:schemas>
13017
- </rdf:Description>
13437
+ </rdf:Description> -->
13018
13438
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
13019
13439
  <!-- Dublin Core properties go here -->
13020
13440
  <dc:title>
@@ -13061,7 +13481,7 @@
13061
13481
  <xsl:variable name="dc_description">
13062
13482
  <xsl:variable name="abstract">
13063
13483
 
13064
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
13484
+ <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'])]"/>
13065
13485
 
13066
13486
  </xsl:variable>
13067
13487
  <rdf:Alt>
@@ -13606,31 +14026,123 @@
13606
14026
 
13607
14027
  <!-- END: insert cover page image -->
13608
14028
 
13609
- <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
14029
+ <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
14030
+ <xsl:variable name="regex_ja_spec_">[
14031
+ <!-- Rotate 90° clockwise -->
14032
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14033
+ \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
14034
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14035
+ \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
14036
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14037
+ \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
14038
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14039
+ \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
14040
+ \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
14041
+ \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
14042
+ \u3010 <!-- U+3010 LEFT BLACK LENTICULAR BRACKET (【) -->
14043
+ \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
14044
+ \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
14045
+ \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
14046
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14047
+ \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
14048
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14049
+ \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
14050
+ \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
14051
+ \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
14052
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14053
+ \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
14054
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14055
+ \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
14056
+ \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
14057
+ \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
14058
+ \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
14059
+ \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
14060
+
14061
+ \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
14062
+ \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
14063
+ \u301C <!-- U+301C WAVE DASH (〜) -->
14064
+ \u3030 <!-- U+3030 WAVY DASH (〰 )-->
14065
+ \u30FC <!-- U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK (ー) -->
14066
+ \u2329 <!-- U+2329 LEFT-POINTING ANGLE BRACKET (〈) -->
14067
+ \u232A <!-- U+232A RIGHT-POINTING ANGLE BRACKET (〉) -->
14068
+ \u3018 <!-- U+3018 LEFT WHITE TORTOISE SHELL BRACKET (〘) -->
14069
+ \u3019 <!-- U+3019 RIGHT WHITE TORTOISE SHELL BRACKET (〙) -->
14070
+ \u30A0 <!-- U+30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN (゠) -->
14071
+ \uFE59 <!-- U+FE59 SMALL LEFT PARENTHESIS (﹙) -->
14072
+ \uFE5A <!-- U+FE5A SMALL RIGHT PARENTHESIS (﹚) -->
14073
+ \uFE5B <!-- U+FE5B SMALL LEFT CURLY BRACKET (﹛) -->
14074
+ \uFE5C <!-- U+FE5C SMALL RIGHT CURLY BRACKET (﹜) -->
14075
+ \uFE5D <!-- U+FE5D SMALL LEFT TORTOISE SHELL BRACKET (﹝) -->
14076
+ \uFE5E <!-- U+FE5E SMALL RIGHT TORTOISE SHELL BRACKET (﹞) -->
14077
+ \uFF5C <!-- U+FF5C FULLWIDTH VERTICAL LINE (|) -->
14078
+ \uFF5F <!-- U+FF5F FULLWIDTH LEFT WHITE PARENTHESIS (⦅) -->
14079
+ \uFF60 <!-- U+FF60 FULLWIDTH RIGHT WHITE PARENTHESIS (⦆) -->
14080
+ \uFFE3 <!-- U+FFE3 FULLWIDTH MACRON ( ̄) -->
14081
+ \uFF3F <!-- U+FF3F FULLWIDTH LOW LINE (_) -->
14082
+ \uFF5E <!-- U+FF5E FULLWIDTH TILDE (~) -->
14083
+ <!-- Rotate 180° -->
14084
+ \u309C <!-- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜) -->
14085
+ \u3002 <!-- U+3002 IDEOGRAPHIC FULL STOP (。) -->
14086
+ \uFE52 <!-- U+FE52 SMALL FULL STOP (﹒) -->
14087
+ \uFF0E <!-- U+FF0E FULLWIDTH FULL STOP (.) -->
14088
+ ]</xsl:variable>
14089
+ <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
13610
14090
  <xsl:template name="insertVerticalChar">
13611
14091
  <xsl:param name="str"/>
13612
14092
  <xsl:param name="writing-mode">lr-tb</xsl:param>
13613
14093
  <xsl:param name="reference-orientation">90</xsl:param>
13614
- <xsl:if test="string-length($str) &gt; 0">
13615
- <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">
13616
- <xsl:if test="normalize-space($writing-mode) != ''">
13617
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
13618
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
13619
- </xsl:if>
13620
- <xsl:variable name="char" select="substring($str,1,1)"/>
13621
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
13622
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
14094
+ <xsl:param name="add_zero_width_space">false</xsl:param>
14095
+ <xsl:choose>
14096
+ <xsl:when test="ancestor::*[local-name() = 'span'][@class = 'norotate']">
14097
+ <xsl:value-of select="$str"/>
14098
+ </xsl:when>
14099
+ <xsl:otherwise>
14100
+ <xsl:if test="string-length($str) &gt; 0">
14101
+ <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
14102
+ <xsl:variable name="char" select="substring($str,1,1)"/>
14103
+ <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">
14104
+ <xsl:if test="normalize-space($writing-mode) != ''">
14105
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14106
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14107
+ </xsl:if>
14108
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14109
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
14110
+ </xsl:if>
14111
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14112
+ <!-- Rotate 180°:
14113
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14114
+ U+3002 IDEOGRAPHIC FULL STOP (。)
14115
+ U+FE52 SMALL FULL STOP (﹒)
14116
+ U+FF0E FULLWIDTH FULL STOP (.)
14117
+ -->
14118
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14119
+ </xsl:if>
14120
+ <fo:block-container width="1em">
14121
+ <fo:block line-height="1em">
14122
+ <xsl:choose>
14123
+ <xsl:when test="$horizontal_mode = 'true'">
14124
+ <xsl:value-of select="$str"/>
14125
+ </xsl:when>
14126
+ <xsl:otherwise>
14127
+ <xsl:value-of select="$char"/>
14128
+ </xsl:otherwise>
14129
+ </xsl:choose>
14130
+ </fo:block>
14131
+ </fo:block-container>
14132
+ </fo:inline-container>
14133
+ <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>
14134
+
14135
+ <xsl:if test="$horizontal_mode = 'false'">
14136
+ <xsl:call-template name="insertVerticalChar">
14137
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14138
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
14139
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14140
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14141
+ </xsl:call-template>
14142
+ </xsl:if>
13623
14143
  </xsl:if>
13624
- <fo:block-container width="1em">
13625
- <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
13626
- </fo:block-container>
13627
- </fo:inline-container>
13628
- <xsl:call-template name="insertVerticalChar">
13629
- <xsl:with-param name="str" select="substring($str, 2)"/>
13630
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
13631
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
13632
- </xsl:call-template>
13633
- </xsl:if>
14144
+ </xsl:otherwise>
14145
+ </xsl:choose>
13634
14146
  </xsl:template>
13635
14147
 
13636
14148
  <xsl:template name="number-to-words">