metanorma-plateau 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -174,8 +174,27 @@
174
174
  <xsl:with-param name="contents" select="$contents"/>
175
175
  </xsl:call-template>
176
176
 
177
+ <!-- <xsl:if test="$debug = 'true'">
178
+ <xsl:message>start contents redirect</xsl:message>
179
+ <redirect:write file="contents.xml">
180
+ <xsl:copy-of select="$contents"/>
181
+ </redirect:write>
182
+ <xsl:message>end contents redirect</xsl:message>
183
+ </xsl:if> -->
184
+
185
+ <xsl:variable name="updated_xml_pres">
186
+ <xsl:apply-templates mode="update_xml_pres"/>
187
+ </xsl:variable>
188
+
189
+ <!-- <xsl:message>start redirect</xsl:message>
190
+ <redirect:write file="update_xml_pres.xml">
191
+ <xsl:copy-of select="$updated_xml_pres"/>
192
+ </redirect:write>
193
+ <xsl:message>end redirect</xsl:message> -->
194
+
177
195
  <xsl:variable name="updated_xml_step1">
178
- <xsl:apply-templates mode="update_xml_step1"/>
196
+ <!-- <xsl:apply-templates mode="update_xml_step1"/> -->
197
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_pres)" mode="update_xml_step1"/>
179
198
  </xsl:variable>
180
199
  <!-- DEBUG: updated_xml_step1=<xsl:copy-of select="$updated_xml_step1"/> -->
181
200
  <!-- <xsl:message>start redirect</xsl:message>
@@ -228,13 +247,6 @@
228
247
  </xsl:if>
229
248
  <xsl:call-template name="insertHeader"/>
230
249
  <fo:flow flow-name="xsl-region-body">
231
- <!-- <xsl:if test="$debug = 'true'"> -->
232
- <!-- <xsl:message>start contents redirect</xsl:message>
233
- <redirect:write file="contents.xml">
234
- <xsl:copy-of select="$contents"/>
235
- </redirect:write>
236
- <xsl:message>end contents redirect</xsl:message> -->
237
- <!-- </xsl:if> -->
238
250
 
239
251
  <!-- <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() = 'clause'][@type = 'toc']">
240
252
  <xsl:with-param name="num" select="$num"/>
@@ -791,11 +803,11 @@
791
803
  <!-- ============================= -->
792
804
 
793
805
  <!-- element with title -->
794
- <xsl:template match="*[plateau:title]" mode="contents">
806
+ <xsl:template match="*[plateau:title or plateau:fmt-title]" mode="contents">
795
807
 
796
808
  <xsl:variable name="level">
797
809
  <xsl:call-template name="getLevel">
798
- <xsl:with-param name="depth" select="plateau:title/@depth"/>
810
+ <xsl:with-param name="depth" select="plateau:fmt-title/@depth | plateau:title/@depth"/>
799
811
  </xsl:call-template>
800
812
  </xsl:variable>
801
813
 
@@ -822,9 +834,10 @@
822
834
  <xsl:choose>
823
835
  <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
824
836
  <xsl:when test="ancestor-or-self::plateau:annex and $level &gt;= 2">false</xsl:when>
825
- <xsl:when test="$type = 'bibliography' and $level &gt;= 2">false</xsl:when>
837
+ <!-- <xsl:when test="$type = 'bibliography' and $level &gt;= 2">false</xsl:when> -->
826
838
  <xsl:when test="$type = 'bibliography'">true</xsl:when>
827
- <xsl:when test="$type = 'references' and $level &gt;= 2">false</xsl:when>
839
+ <!-- <xsl:when test="$type = 'references' and $level &gt;= 2">false</xsl:when> -->
840
+ <xsl:when test="$type = 'references'">true</xsl:when>
828
841
  <xsl:when test="ancestor-or-self::plateau:colophon">true</xsl:when>
829
842
  <xsl:when test="$section = '' and $type = 'clause' and $level = 1 and ancestor::plateau:preface">true</xsl:when>
830
843
  <xsl:when test="$section = '' and $type = 'clause'">false</xsl:when>
@@ -873,6 +886,7 @@
873
886
  <xsl:template match="*[local-name() = 'preface']/*[local-name() = 'page_sequence']/*[local-name() = 'clause']" priority="3">
874
887
  <fo:block>
875
888
  <xsl:call-template name="setId"/>
889
+ <xsl:call-template name="addReviewHelper"/>
876
890
  <xsl:apply-templates/>
877
891
  </fo:block>
878
892
  </xsl:template>
@@ -1861,7 +1875,7 @@
1861
1875
  </svg>
1862
1876
  </xsl:variable>
1863
1877
 
1864
- <xsl:strip-space elements="plateau:xref"/>
1878
+ <!-- <xsl:strip-space elements="plateau:xref"/> -->
1865
1879
 
1866
1880
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1867
1881
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
@@ -2835,6 +2849,10 @@
2835
2849
 
2836
2850
  <xsl:template name="refine_termnote-name-style">
2837
2851
 
2852
+ <!-- <xsl:if test="$namespace = 'ieee'">
2853
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
2854
+ </xsl:if> -->
2855
+
2838
2856
  </xsl:template>
2839
2857
 
2840
2858
  <xsl:attribute-set name="termnote-p-style">
@@ -3495,9 +3513,21 @@
3495
3513
  <xsl:template name="processTables_Contents">
3496
3514
  <tables>
3497
3515
  <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3498
- <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3499
- <xsl:copy-of select="*[local-name() = 'name']"/>
3500
- </table>
3516
+ <xsl:choose>
3517
+ <xsl:when test="*[local-name() = 'fmt-name']">
3518
+ <xsl:variable name="fmt_name">
3519
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3520
+ </xsl:variable>
3521
+ <table id="{@id}" alt-text="{normalize-space($fmt_name)}">
3522
+ <xsl:copy-of select="$fmt_name"/>
3523
+ </table>
3524
+ </xsl:when>
3525
+ <xsl:otherwise>
3526
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3527
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3528
+ </table>
3529
+ </xsl:otherwise>
3530
+ </xsl:choose>
3501
3531
  </xsl:for-each>
3502
3532
  </tables>
3503
3533
  </xsl:template>
@@ -3505,9 +3535,21 @@
3505
3535
  <xsl:template name="processFigures_Contents">
3506
3536
  <figures>
3507
3537
  <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) != '']">
3508
- <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3509
- <xsl:copy-of select="*[local-name() = 'name']"/>
3510
- </figure>
3538
+ <xsl:choose>
3539
+ <xsl:when test="*[local-name() = 'fmt-name']">
3540
+ <xsl:variable name="fmt_name">
3541
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3542
+ </xsl:variable>
3543
+ <figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
3544
+ <xsl:copy-of select="$fmt_name"/>
3545
+ </figure>
3546
+ </xsl:when>
3547
+ <xsl:otherwise>
3548
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3549
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3550
+ </figure>
3551
+ </xsl:otherwise>
3552
+ </xsl:choose>
3511
3553
  </xsl:for-each>
3512
3554
  </figures>
3513
3555
  </xsl:template>
@@ -5330,6 +5372,11 @@
5330
5372
 
5331
5373
  <xsl:value-of select="@reference"/>
5332
5374
 
5375
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5376
+ <!-- <xsl:if test="$namespace = 'itu'">
5377
+ <xsl:text>)</xsl:text>
5378
+ </xsl:if> -->
5379
+
5333
5380
  <xsl:text>:</xsl:text>
5334
5381
 
5335
5382
  </fo:inline>
@@ -5341,7 +5388,7 @@
5341
5388
 
5342
5389
  </xsl:if>
5343
5390
  </xsl:for-each>
5344
- </xsl:template>
5391
+ </xsl:template> <!-- table_fn_display -->
5345
5392
 
5346
5393
  <xsl:template name="create_fn">
5347
5394
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -5369,8 +5416,10 @@
5369
5416
  <!-- EMD table's footnotes rendering -->
5370
5417
  <!-- ============================ -->
5371
5418
 
5419
+ <!-- ============================ -->
5372
5420
  <!-- figure's footnotes rendering -->
5373
- <xsl:template name="fn_display_figure">
5421
+ <!-- ============================ -->
5422
+ <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
5374
5423
 
5375
5424
  <!-- current figure id -->
5376
5425
  <xsl:variable name="figure_id_">
@@ -5483,9 +5532,28 @@
5483
5532
 
5484
5533
  </fo:block>
5485
5534
  </xsl:if>
5486
-
5487
5535
  </xsl:template> <!-- fn_display_figure -->
5488
5536
 
5537
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
5538
+ <!-- figure's footnote label -->
5539
+ <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">
5540
+ <xsl:variable name="key_iso">
5541
+
5542
+ </xsl:variable>
5543
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5544
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5545
+
5546
+ </xsl:if>
5547
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
5548
+ <!-- <xsl:value-of select="@reference"/> -->
5549
+ <xsl:apply-templates/>
5550
+ </fo:inline>
5551
+ </xsl:template>
5552
+
5553
+ <!-- ============================ -->
5554
+ <!-- END: figure's footnotes rendering -->
5555
+ <!-- ============================ -->
5556
+
5489
5557
  <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
5490
5558
  <xsl:template match="*[local-name()='fn']">
5491
5559
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
@@ -5503,6 +5571,10 @@
5503
5571
 
5504
5572
  <xsl:value-of select="@reference"/>
5505
5573
 
5574
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5575
+ <!-- <xsl:if test="$namespace = 'jis'">
5576
+ <fo:inline font-weight="normal">)</fo:inline>
5577
+ </xsl:if> -->
5506
5578
  </fo:basic-link>
5507
5579
  </fo:inline>
5508
5580
  </xsl:template>
@@ -5629,17 +5701,22 @@
5629
5701
  </fo:block>
5630
5702
  </xsl:when> <!-- END: a few components -->
5631
5703
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
5632
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
5704
+ <!-- Presentation XML contains 'Key' caption, https://github.com/metanorma/isodoc/issues/607 -->
5705
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'p' and @keep-with-next])"> <!-- for old Presentation XML -->
5633
5706
 
5634
- <xsl:call-template name="refine_figure_key_style"/>
5707
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
5635
5708
 
5636
- <xsl:variable name="title-key">
5637
- <xsl:call-template name="getLocalizedString">
5638
- <xsl:with-param name="key">key</xsl:with-param>
5639
- </xsl:call-template>
5640
- </xsl:variable>
5641
- <xsl:value-of select="$title-key"/>
5642
- </fo:block>
5709
+ <xsl:call-template name="refine_figure_key_style"/>
5710
+
5711
+ <xsl:variable name="title-key">
5712
+ <xsl:call-template name="getLocalizedString">
5713
+ <xsl:with-param name="key">key</xsl:with-param>
5714
+ </xsl:call-template>
5715
+ </xsl:variable>
5716
+ <xsl:value-of select="$title-key"/>
5717
+ </fo:block>
5718
+
5719
+ </xsl:if>
5643
5720
  </xsl:when> <!-- END: definition list in a figure -->
5644
5721
  </xsl:choose>
5645
5722
 
@@ -5825,6 +5902,14 @@
5825
5902
 
5826
5903
  </xsl:template> <!-- END: dl -->
5827
5904
 
5905
+ <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
5906
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
5907
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
5908
+ <xsl:call-template name="refine_figure_key_style"/>
5909
+ <xsl:apply-templates/>
5910
+ </fo:block>
5911
+ </xsl:template>
5912
+
5828
5913
  <xsl:template name="refine_dl_formula_where_style">
5829
5914
 
5830
5915
  </xsl:template> <!-- refine_dl_formula_where_style -->
@@ -7855,6 +7940,39 @@
7855
7940
  </xsl:copy>
7856
7941
  </xsl:template>
7857
7942
 
7943
+ <xsl:template match="@*|node()" mode="mathml_linebreak">
7944
+ <xsl:copy>
7945
+ <xsl:apply-templates select="@*|node()" mode="mathml_linebreak"/>
7946
+ </xsl:copy>
7947
+ </xsl:template>
7948
+
7949
+ <!-- split math into two math -->
7950
+ <xsl:template match="mathml:mo[@linebreak] | mathml:mspace[@linebreak]" mode="mathml_linebreak">
7951
+ <xsl:variable name="math_elements_tree_">
7952
+ <xsl:for-each select="ancestor::*[ancestor-or-self::mathml:math]">
7953
+ <element pos="{position()}">
7954
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
7955
+ <xsl:value-of select="name()"/>
7956
+ </element>
7957
+ </xsl:for-each>
7958
+ </xsl:variable>
7959
+
7960
+ <xsl:variable name="math_elements_tree" select="xalan:nodeset($math_elements_tree_)"/>
7961
+
7962
+ <xsl:call-template name="insertClosingElements">
7963
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
7964
+ </xsl:call-template>
7965
+
7966
+ <xsl:element name="br" namespace="{$namespace_full}"/>
7967
+
7968
+ <xsl:call-template name="insertOpeningElements">
7969
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
7970
+ <xsl:with-param name="xmlns">http://www.w3.org/1998/Math/MathML</xsl:with-param>
7971
+ <xsl:with-param name="add_continue">false</xsl:with-param>
7972
+ </xsl:call-template>
7973
+
7974
+ </xsl:template>
7975
+
7858
7976
  <!-- Examples:
7859
7977
  <stem type="AsciiMath">x = 1</stem>
7860
7978
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -8106,9 +8224,11 @@
8106
8224
  </xsl:template>
8107
8225
 
8108
8226
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
8227
+ <!-- https://github.com/metanorma/isodoc/issues/607
8109
8228
  <xsl:if test="normalize-space() != ''">
8110
- <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
8111
- </xsl:if>
8229
+ <xsl:text>(</xsl:text><xsl:apply-templates /><xsl:text>)</xsl:text>
8230
+ </xsl:if> -->
8231
+ <xsl:apply-templates/>
8112
8232
  </xsl:template>
8113
8233
 
8114
8234
  <!-- stem inside formula with name (with formula's number) -->
@@ -8179,6 +8299,8 @@
8179
8299
 
8180
8300
  <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
8181
8301
 
8302
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab"/>
8303
+
8182
8304
  <xsl:call-template name="refine_note-name-style"/>
8183
8305
 
8184
8306
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -8235,10 +8357,6 @@
8235
8357
 
8236
8358
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
8237
8359
 
8238
- <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
8239
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
8240
- </xsl:if>
8241
-
8242
8360
  <xsl:call-template name="refine_termnote-name-style"/>
8243
8361
 
8244
8362
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -8264,6 +8382,17 @@
8264
8382
  </xsl:when>
8265
8383
  <xsl:otherwise>
8266
8384
 
8385
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
8386
+ <!-- <xsl:if test="$namespace = 'ieee'">
8387
+ <xsl:text>—</xsl:text> em dash &#x2014;
8388
+ </xsl:if> -->
8389
+ <!-- <xsl:if test="$namespace = 'iho' or $namespace = 'gb' or $namespace = 'm3d' or $namespace = 'unece-rec' or $namespace = 'unece' or $namespace = 'rsd'">
8390
+ <xsl:text>:</xsl:text>
8391
+ </xsl:if> -->
8392
+
8393
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp'">
8394
+ <xsl:text> – </xsl:text> en dash &#x2013;
8395
+ </xsl:if> -->
8267
8396
  </xsl:otherwise>
8268
8397
  </xsl:choose>
8269
8398
  </xsl:variable>
@@ -8282,6 +8411,16 @@
8282
8411
  </xsl:when>
8283
8412
  <xsl:otherwise>
8284
8413
 
8414
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
8415
+ <!-- <xsl:if test="$namespace = 'ieee'">
8416
+ <xsl:text>—</xsl:text> em dash &#x2014;
8417
+ </xsl:if> -->
8418
+ <!-- <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'">
8419
+ <xsl:text>:</xsl:text>
8420
+ </xsl:if> -->
8421
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'unece-rec' or $namespace = 'unece'">
8422
+ <xsl:text> – </xsl:text> en dash &#x2013;
8423
+ </xsl:if> -->
8285
8424
  </xsl:otherwise>
8286
8425
  </xsl:choose>
8287
8426
  </xsl:variable>
@@ -8364,17 +8503,29 @@
8364
8503
  <!-- Example: Dimensions in millimeters -->
8365
8504
  <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
8366
8505
 
8506
+ <xsl:variable name="show_figure_key_in_block_container">
8507
+ true
8508
+ </xsl:variable>
8509
+
8367
8510
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
8368
8511
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
8369
8512
  </fo:block>
8370
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8371
- <xsl:call-template name="note"/>
8372
- </xsl:for-each>
8373
- <xsl:call-template name="fn_display_figure"/>
8513
+
8514
+ <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
8515
+ <xsl:call-template name="showFigureKey"/>
8516
+ </xsl:if>
8374
8517
 
8375
8518
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
8376
8519
 
8377
8520
  </fo:block-container>
8521
+
8522
+ </xsl:template>
8523
+
8524
+ <xsl:template name="showFigureKey">
8525
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8526
+ <xsl:call-template name="note"/>
8527
+ </xsl:for-each>
8528
+ <xsl:call-template name="fn_display_figure"/>
8378
8529
  </xsl:template>
8379
8530
 
8380
8531
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -8570,6 +8721,22 @@
8570
8721
  </xsl:if>
8571
8722
  </xsl:template>
8572
8723
 
8724
+ <xsl:template name="getImageSrc">
8725
+ <xsl:choose>
8726
+ <xsl:when test="not(starts-with(@src, 'data:'))">
8727
+ <xsl:choose>
8728
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8729
+ <xsl:value-of select="@src"/>
8730
+ </xsl:when>
8731
+ <xsl:otherwise>
8732
+ <xsl:value-of select="concat($basepath, @src)"/>
8733
+ </xsl:otherwise>
8734
+ </xsl:choose>
8735
+ </xsl:when>
8736
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8737
+ </xsl:choose>
8738
+ </xsl:template>
8739
+
8573
8740
  <xsl:template name="getImageScale">
8574
8741
  <xsl:param name="indent"/>
8575
8742
  <xsl:variable name="indent_left">
@@ -8579,19 +8746,7 @@
8579
8746
  </xsl:choose>
8580
8747
  </xsl:variable>
8581
8748
  <xsl:variable name="img_src">
8582
- <xsl:choose>
8583
- <xsl:when test="not(starts-with(@src, 'data:'))">
8584
- <xsl:choose>
8585
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8586
- <xsl:value-of select="@src"/>
8587
- </xsl:when>
8588
- <xsl:otherwise>
8589
- <xsl:value-of select="concat($basepath, @src)"/>
8590
- </xsl:otherwise>
8591
- </xsl:choose>
8592
- </xsl:when>
8593
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8594
- </xsl:choose>
8749
+ <xsl:call-template name="getImageSrc"/>
8595
8750
  </xsl:variable>
8596
8751
 
8597
8752
  <xsl:variable name="image_width_effective">
@@ -8599,10 +8754,15 @@
8599
8754
  <xsl:value-of select="$width_effective - number($indent_left)"/>
8600
8755
 
8601
8756
  </xsl:variable>
8757
+ <xsl:variable name="image_height_effective" select="$height_effective - number($indent_left)"/>
8602
8758
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8603
8759
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8604
8760
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
8605
- <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8761
+ <xsl:variable name="scale">
8762
+
8763
+ <xsl:value-of select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8764
+
8765
+ </xsl:variable>
8606
8766
  <xsl:value-of select="$scale"/>
8607
8767
  </xsl:template>
8608
8768
 
@@ -9155,20 +9315,48 @@
9155
9315
  <xsl:template match="*[local-name() = 'emf']"/>
9156
9316
 
9157
9317
  <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">
9318
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
9319
+ <xsl:apply-templates mode="contents"/>
9320
+ <xsl:text> </xsl:text>
9321
+ </xsl:if>
9322
+ </xsl:template>
9323
+
9324
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="contents"/>
9325
+
9326
+ <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">
9158
9327
  <xsl:apply-templates mode="contents"/>
9159
9328
  <xsl:text> </xsl:text>
9160
9329
  </xsl:template>
9161
9330
 
9162
9331
  <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">
9332
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
9333
+ <xsl:apply-templates mode="bookmarks"/>
9334
+ <xsl:text> </xsl:text>
9335
+ </xsl:if>
9336
+ </xsl:template>
9337
+
9338
+ <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">
9163
9339
  <xsl:apply-templates mode="bookmarks"/>
9164
9340
  <xsl:text> </xsl:text>
9165
9341
  </xsl:template>
9166
9342
 
9167
9343
  <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">
9344
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
9345
+ <xsl:value-of select="."/>
9346
+ </xsl:if>
9347
+ </xsl:template>
9348
+
9349
+ <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">
9168
9350
  <xsl:value-of select="."/>
9169
9351
  </xsl:template>
9170
9352
 
9171
9353
  <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">
9354
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
9355
+ <xsl:value-of select="."/>
9356
+ </xsl:if>
9357
+ </xsl:template>
9358
+
9359
+ <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">
9172
9360
  <xsl:value-of select="."/>
9173
9361
  </xsl:template>
9174
9362
 
@@ -9189,7 +9377,7 @@
9189
9377
  </xsl:template>
9190
9378
 
9191
9379
  <!-- special case: ignore section-title if @depth different than @depth of parent clause, or @depth of parent clause = 1 -->
9192
- <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"/>
9380
+ <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"/>
9193
9381
 
9194
9382
  <xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
9195
9383
  <xsl:variable name="level">
@@ -9201,6 +9389,9 @@
9201
9389
  <xsl:variable name="section">
9202
9390
  <xsl:choose>
9203
9391
  <xsl:when test="@type = 'section-title'"/>
9392
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
9393
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9394
+ </xsl:when>
9204
9395
  <xsl:otherwise>
9205
9396
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9206
9397
  </xsl:otherwise>
@@ -9223,6 +9414,19 @@
9223
9414
 
9224
9415
  <xsl:variable name="title">
9225
9416
  <xsl:choose>
9417
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/770 -->
9418
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
9419
+ <xsl:choose>
9420
+ <xsl:when test="@type = 'section-title'">
9421
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9422
+ <xsl:text>: </xsl:text>
9423
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9424
+ </xsl:when>
9425
+ <xsl:otherwise>
9426
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9427
+ </xsl:otherwise>
9428
+ </xsl:choose>
9429
+ </xsl:when>
9226
9430
  <xsl:when test="*[local-name() = 'tab']">
9227
9431
  <xsl:choose>
9228
9432
  <xsl:when test="@type = 'section-title'">
@@ -9258,7 +9462,7 @@
9258
9462
  <xsl:apply-templates mode="bookmarks"/>
9259
9463
  </xsl:template>
9260
9464
 
9261
- <xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
9465
+ <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">
9262
9466
  <xsl:apply-templates select="."/>
9263
9467
  </xsl:template>
9264
9468
 
@@ -9271,6 +9475,10 @@
9271
9475
  <xsl:apply-templates mode="contents"/>
9272
9476
  </xsl:template>
9273
9477
 
9478
+ <xsl:template match="*[local-name() = 'semx']" mode="contents">
9479
+ <xsl:apply-templates mode="contents"/>
9480
+ </xsl:template>
9481
+
9274
9482
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
9275
9483
  <xsl:apply-templates mode="bookmarks"/>
9276
9484
  </xsl:template>
@@ -9280,9 +9488,14 @@
9280
9488
  <xsl:apply-templates mode="bookmarks"/>
9281
9489
  </xsl:template>
9282
9490
 
9491
+ <xsl:template match="*[local-name() = 'semx']" mode="bookmarks">
9492
+ <xsl:apply-templates mode="bookmarks"/>
9493
+ </xsl:template>
9494
+
9283
9495
  <!-- Bookmarks -->
9284
9496
  <xsl:template name="addBookmarks">
9285
9497
  <xsl:param name="contents"/>
9498
+ <xsl:param name="contents_addon"/>
9286
9499
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
9287
9500
  <xsl:if test="$contents_nodes//item">
9288
9501
  <fo:bookmark-tree>
@@ -9380,6 +9593,9 @@
9380
9593
  </xsl:otherwise>
9381
9594
  </xsl:choose>
9382
9595
 
9596
+ <!-- for $namespace = 'nist-sp' $namespace = 'ogc' $namespace = 'ogc-white-paper' -->
9597
+ <xsl:copy-of select="$contents_addon"/>
9598
+
9383
9599
  </fo:bookmark-tree>
9384
9600
  </xsl:if>
9385
9601
  </xsl:template>
@@ -9533,6 +9749,16 @@
9533
9749
  <!-- ====== -->
9534
9750
  <!-- ====== -->
9535
9751
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
9752
+ <xsl:param name="mode">bookmarks</xsl:param>
9753
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-title'])">
9754
+ <xsl:apply-templates mode="contents_item">
9755
+ <xsl:with-param name="mode" select="$mode"/>
9756
+ </xsl:apply-templates>
9757
+ <!-- <xsl:text> </xsl:text> -->
9758
+ </xsl:if>
9759
+ </xsl:template>
9760
+
9761
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="contents_item">
9536
9762
  <xsl:param name="mode">bookmarks</xsl:param>
9537
9763
  <xsl:apply-templates mode="contents_item">
9538
9764
  <xsl:with-param name="mode" select="$mode"/>
@@ -9540,12 +9766,38 @@
9540
9766
  <!-- <xsl:text> </xsl:text> -->
9541
9767
  </xsl:template>
9542
9768
 
9769
+ <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">
9770
+ <xsl:apply-templates mode="contents_item"/>
9771
+ </xsl:template>
9772
+
9773
+ <xsl:template match="*[local-name() = 'semx']" mode="contents_item">
9774
+ <xsl:apply-templates mode="contents_item"/>
9775
+ </xsl:template>
9776
+
9777
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="contents_item"/>
9778
+
9543
9779
  <xsl:template name="getSection">
9544
- <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9780
+ <xsl:choose>
9781
+ <xsl:when test="*[local-name() = 'fmt-title']">
9782
+ <xsl:variable name="fmt_title_section">
9783
+ <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')]"/>
9784
+ </xsl:variable>
9785
+ <xsl:value-of select="normalize-space($fmt_title_section)"/>
9786
+ </xsl:when>
9787
+ <xsl:otherwise>
9788
+ <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9789
+ </xsl:otherwise>
9790
+ </xsl:choose>
9545
9791
  </xsl:template>
9546
9792
 
9547
9793
  <xsl:template name="getName">
9548
9794
  <xsl:choose>
9795
+ <xsl:when test="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']]">
9796
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/following-sibling::node()"/>
9797
+ </xsl:when>
9798
+ <xsl:when test="*[local-name() = 'fmt-title']">
9799
+ <xsl:copy-of select="*[local-name() = 'fmt-title']/node()"/>
9800
+ </xsl:when>
9549
9801
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
9550
9802
  <xsl:copy-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/following-sibling::node()"/>
9551
9803
  </xsl:when>
@@ -9652,6 +9904,15 @@
9652
9904
  </xsl:template>
9653
9905
 
9654
9906
  <xsl:template match="*[local-name() = 'name']" mode="contents_item">
9907
+ <xsl:param name="mode">bookmarks</xsl:param>
9908
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
9909
+ <xsl:apply-templates mode="contents_item">
9910
+ <xsl:with-param name="mode" select="$mode"/>
9911
+ </xsl:apply-templates>
9912
+ </xsl:if>
9913
+ </xsl:template>
9914
+
9915
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="contents_item">
9655
9916
  <xsl:param name="mode">bookmarks</xsl:param>
9656
9917
  <xsl:apply-templates mode="contents_item">
9657
9918
  <xsl:with-param name="mode" select="$mode"/>
@@ -10447,7 +10708,7 @@
10447
10708
  <xsl:if test="normalize-space() != ''">
10448
10709
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
10449
10710
  <xsl:call-template name="refine_termexample-name-style"/>
10450
- <xsl:apply-templates/>
10711
+ <xsl:apply-templates/> <!-- commented $namespace = 'ieee', https://github.com/metanorma/isodoc/issues/614-->
10451
10712
  </fo:inline>
10452
10713
  </xsl:if>
10453
10714
  </xsl:template>
@@ -10488,107 +10749,108 @@
10488
10749
  -->
10489
10750
  <xsl:template match="*[local-name() = 'example']">
10490
10751
 
10491
- <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10492
-
10493
- <xsl:call-template name="setBlockSpanAll"/>
10752
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10494
10753
 
10495
- <xsl:call-template name="refine_example-style"/>
10754
+ <xsl:call-template name="setBlockSpanAll"/>
10496
10755
 
10497
- <xsl:variable name="fo_element">
10498
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
10499
- block
10500
- </xsl:variable>
10756
+ <xsl:call-template name="refine_example-style"/>
10501
10757
 
10502
- <fo:block-container margin-left="0mm" role="SKIP">
10758
+ <xsl:variable name="fo_element">
10759
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
10760
+ block
10761
+ </xsl:variable>
10503
10762
 
10504
- <xsl:choose>
10763
+ <fo:block-container margin-left="0mm" role="SKIP">
10505
10764
 
10506
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
10765
+ <xsl:choose>
10507
10766
 
10508
- <!-- display name 'EXAMPLE' in a separate block -->
10509
- <fo:block>
10510
- <xsl:apply-templates select="*[local-name()='name']">
10511
- <xsl:with-param name="fo_element" select="$fo_element"/>
10512
- </xsl:apply-templates>
10513
- </fo:block>
10767
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
10514
10768
 
10515
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10516
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10517
- <xsl:variable name="example_body">
10518
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10769
+ <!-- display name 'EXAMPLE' in a separate block -->
10770
+ <fo:block>
10771
+ <xsl:apply-templates select="*[local-name()='name']">
10519
10772
  <xsl:with-param name="fo_element" select="$fo_element"/>
10520
10773
  </xsl:apply-templates>
10774
+ </fo:block>
10775
+
10776
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10777
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10778
+ <xsl:variable name="example_body">
10779
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10780
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10781
+ </xsl:apply-templates>
10782
+ </xsl:variable>
10783
+ <xsl:choose>
10784
+ <xsl:when test="xalan:nodeset($example_body)/*">
10785
+ <xsl:copy-of select="$example_body"/>
10786
+ </xsl:when>
10787
+ <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
10788
+ </xsl:choose>
10789
+ </fo:block-container>
10790
+ </fo:block-container>
10791
+ </xsl:when> <!-- end block -->
10792
+
10793
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
10794
+
10795
+ <xsl:variable name="provisional_distance_between_starts_">
10796
+ 7
10521
10797
  </xsl:variable>
10522
- <xsl:choose>
10523
- <xsl:when test="xalan:nodeset($example_body)/*">
10524
- <xsl:copy-of select="$example_body"/>
10525
- </xsl:when>
10526
- <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
10527
- </xsl:choose>
10528
- </fo:block-container>
10529
- </fo:block-container>
10530
- </xsl:when> <!-- end block -->
10798
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10799
+ <xsl:variable name="indent_">
10800
+ 0
10801
+ </xsl:variable>
10802
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
10531
10803
 
10532
- <xsl:when test="contains(normalize-space($fo_element), 'list')">
10804
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10805
+ <fo:list-item>
10806
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
10807
+ <fo:block>
10808
+ <xsl:apply-templates select="*[local-name()='name']">
10809
+ <xsl:with-param name="fo_element">block</xsl:with-param>
10810
+ </xsl:apply-templates>
10811
+ </fo:block>
10812
+ </fo:list-item-label>
10813
+ <fo:list-item-body start-indent="body-start()">
10814
+ <fo:block>
10815
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10816
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10817
+ </xsl:apply-templates>
10818
+ </fo:block>
10819
+ </fo:list-item-body>
10820
+ </fo:list-item>
10821
+ </fo:list-block>
10822
+ </xsl:when> <!-- end list -->
10533
10823
 
10534
- <xsl:variable name="provisional_distance_between_starts_">
10535
- 7
10536
- </xsl:variable>
10537
- <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10538
- <xsl:variable name="indent_">
10539
- 0
10540
- </xsl:variable>
10541
- <xsl:variable name="indent" select="normalize-space($indent_)"/>
10824
+ <xsl:otherwise> <!-- inline -->
10542
10825
 
10543
- <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10544
- <fo:list-item>
10545
- <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
10546
- <fo:block>
10547
- <xsl:apply-templates select="*[local-name()='name']">
10548
- <xsl:with-param name="fo_element">block</xsl:with-param>
10549
- </xsl:apply-templates>
10550
- </fo:block>
10551
- </fo:list-item-label>
10552
- <fo:list-item-body start-indent="body-start()">
10553
- <fo:block>
10554
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10826
+ <!-- display 'EXAMPLE' and first element in the same line -->
10827
+ <fo:block>
10828
+ <xsl:apply-templates select="*[local-name()='name']">
10829
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10830
+ </xsl:apply-templates>
10831
+ <fo:inline>
10832
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
10555
10833
  <xsl:with-param name="fo_element" select="$fo_element"/>
10556
10834
  </xsl:apply-templates>
10557
- </fo:block>
10558
- </fo:list-item-body>
10559
- </fo:list-item>
10560
- </fo:list-block>
10561
- </xsl:when> <!-- end list -->
10562
-
10563
- <xsl:otherwise> <!-- inline -->
10835
+ </fo:inline>
10836
+ </fo:block>
10564
10837
 
10565
- <!-- display 'EXAMPLE' and first element in the same line -->
10566
- <fo:block>
10567
- <xsl:apply-templates select="*[local-name()='name']">
10568
- <xsl:with-param name="fo_element" select="$fo_element"/>
10569
- </xsl:apply-templates>
10570
- <fo:inline>
10571
- <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
10572
- <xsl:with-param name="fo_element" select="$fo_element"/>
10573
- </xsl:apply-templates>
10574
- </fo:inline>
10575
- </fo:block>
10838
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
10839
+ <!-- display further elements in blocks -->
10840
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10841
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10842
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
10843
+ <xsl:with-param name="fo_element" select="'block'"/>
10844
+ </xsl:apply-templates>
10845
+ </fo:block-container>
10846
+ </fo:block-container>
10847
+ </xsl:if>
10848
+ </xsl:otherwise> <!-- end inline -->
10576
10849
 
10577
- <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
10578
- <!-- display further elements in blocks -->
10579
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10580
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10581
- <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
10582
- <xsl:with-param name="fo_element" select="'block'"/>
10583
- </xsl:apply-templates>
10584
- </fo:block-container>
10585
- </fo:block-container>
10586
- </xsl:if>
10587
- </xsl:otherwise> <!-- end inline -->
10850
+ </xsl:choose>
10851
+ </fo:block-container>
10852
+ </fo:block-container>
10588
10853
 
10589
- </xsl:choose>
10590
- </fo:block-container>
10591
- </fo:block-container>
10592
10854
  </xsl:template>
10593
10855
 
10594
10856
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
@@ -10609,7 +10871,7 @@
10609
10871
  <xsl:otherwise>
10610
10872
  <fo:inline xsl:use-attribute-sets="example-name-style">
10611
10873
  <xsl:call-template name="refine_example-name-style"/>
10612
- <xsl:apply-templates/>
10874
+ <xsl:apply-templates/> <!-- $namespace = 'ieee', see https://github.com/metanorma/isodoc/issues/614 -->
10613
10875
  </fo:inline>
10614
10876
  </xsl:otherwise>
10615
10877
  </xsl:choose>
@@ -10791,15 +11053,17 @@
10791
11053
 
10792
11054
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10793
11055
  <fo:block role="BlockQuote">
10794
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
11056
+ <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 -->
10795
11057
  </fo:block>
10796
11058
  </fo:block-container>
10797
11059
  </fo:block-container>
10798
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
11060
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source'] or *[local-name() = 'attribution']">
10799
11061
  <fo:block xsl:use-attribute-sets="quote-source-style">
10800
11062
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
10801
11063
  <xsl:apply-templates select="*[local-name() = 'author']"/>
10802
11064
  <xsl:apply-templates select="*[local-name() = 'source']"/>
11065
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
11066
+ <xsl:apply-templates select="*[local-name() = 'attribution']/*[local-name() = 'p']/node()"/>
10803
11067
  </fo:block>
10804
11068
  </xsl:if>
10805
11069
 
@@ -10821,9 +11085,13 @@
10821
11085
  </xsl:template>
10822
11086
 
10823
11087
  <xsl:template match="*[local-name() = 'author']">
10824
- <xsl:text>— </xsl:text>
11088
+ <xsl:if test="local-name(..) = 'quote'"> <!-- for old Presentation XML, https://github.com/metanorma/isodoc/issues/607 -->
11089
+ <xsl:text>— </xsl:text>
11090
+ </xsl:if>
10825
11091
  <xsl:apply-templates/>
10826
11092
  </xsl:template>
11093
+
11094
+ <xsl:template match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
10827
11095
  <!-- ====== -->
10828
11096
  <!-- ====== -->
10829
11097
 
@@ -10957,6 +11225,13 @@
10957
11225
 
10958
11226
  </xsl:template> <!-- tab -->
10959
11227
 
11228
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
11229
+ <xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
11230
+
11231
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
11232
+
11233
+ </xsl:template>
11234
+
10960
11235
  <xsl:template name="insertNonBreakSpaces">
10961
11236
  <xsl:param name="count"/>
10962
11237
  <xsl:if test="$count &gt; 0">
@@ -10996,8 +11271,12 @@
10996
11271
  </xsl:template>
10997
11272
 
10998
11273
  <xsl:template match="*[local-name() = 'domain']">
11274
+ <!-- https://github.com/metanorma/isodoc/issues/607
10999
11275
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
11000
- <xsl:text> </xsl:text>
11276
+ <xsl:text> </xsl:text> -->
11277
+ <xsl:if test="not(@hidden = 'true')">
11278
+ <xsl:apply-templates/>
11279
+ </xsl:if>
11001
11280
  </xsl:template>
11002
11281
 
11003
11282
  <xsl:template match="*[local-name() = 'admitted']">
@@ -11045,6 +11324,29 @@
11045
11324
  <!-- END definition -->
11046
11325
  <!-- ========== -->
11047
11326
 
11327
+ <xsl:variable name="reviews_">
11328
+ <xsl:for-each select="//*[local-name() = 'review'][@from]">
11329
+ <xsl:copy>
11330
+ <xsl:copy-of select="@from"/>
11331
+ <xsl:copy-of select="@id"/>
11332
+ </xsl:copy>
11333
+ </xsl:for-each>
11334
+ </xsl:variable>
11335
+ <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
11336
+
11337
+ <xsl:template name="addReviewHelper">
11338
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11339
+ <xsl:variable name="curr_id" select="@id"/>
11340
+ <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
11341
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11342
+ <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>
11343
+ </xsl:if>
11344
+ <!-- <fo:block>
11345
+ <curr_id><xsl:value-of select="$curr_id"/></curr_id>
11346
+ <xsl:copy-of select="$reviews"/>
11347
+ </fo:block> -->
11348
+ </xsl:template>
11349
+
11048
11350
  <!-- main sections -->
11049
11351
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
11050
11352
 
@@ -11053,6 +11355,8 @@
11053
11355
 
11054
11356
  <xsl:call-template name="sections_element_style"/>
11055
11357
 
11358
+ <xsl:call-template name="addReviewHelper"/>
11359
+
11056
11360
  <xsl:apply-templates/>
11057
11361
  </fo:block>
11058
11362
 
@@ -11088,6 +11392,7 @@
11088
11392
 
11089
11393
  <fo:block>
11090
11394
  <xsl:call-template name="setId"/>
11395
+ <xsl:call-template name="addReviewHelper"/>
11091
11396
  <xsl:apply-templates/>
11092
11397
  </fo:block>
11093
11398
  </xsl:template>
@@ -11124,6 +11429,8 @@
11124
11429
 
11125
11430
  <xsl:call-template name="refine_clause_style"/>
11126
11431
 
11432
+ <xsl:call-template name="addReviewHelper"/>
11433
+
11127
11434
  <xsl:apply-templates/>
11128
11435
  </fo:block>
11129
11436
  </xsl:template>
@@ -11176,6 +11483,23 @@
11176
11483
 
11177
11484
  <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
11178
11485
 
11486
+ <xsl:if test="1 = 1">
11487
+ <xsl:choose>
11488
+ <!-- if there isn't the attribute '@from', then -->
11489
+ <xsl:when test="$id_from = ''">
11490
+ <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>
11491
+ </xsl:when>
11492
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11493
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
11494
+ <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>
11495
+ </xsl:when>
11496
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11497
+ <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>
11498
+ </xsl:when>
11499
+ </xsl:choose>
11500
+ </xsl:if>
11501
+
11502
+ <xsl:if test="1 = 2">
11179
11503
  <xsl:choose>
11180
11504
  <!-- if there isn't the attribute '@from', then -->
11181
11505
  <xsl:when test="$id_from = ''">
@@ -11189,6 +11513,7 @@
11189
11513
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
11190
11514
  </xsl:when>
11191
11515
  </xsl:choose>
11516
+ </xsl:if>
11192
11517
 
11193
11518
  </xsl:template>
11194
11519
 
@@ -12456,6 +12781,10 @@
12456
12781
  <!-- - Remove semantic xml part -->
12457
12782
  <!-- - Remove image/emf (EMF vector image for Word) -->
12458
12783
  <!-- - add @id, redundant for table auto-layout algorithm -->
12784
+ <!-- - process 'passthrough' element -->
12785
+ <!-- - split math by element with @linebreak into maths -->
12786
+ <!-- - rename fmt-title to title, fmt-name to name and another changes to convert new presentation XML to -->
12787
+ <!-- - old XML without significant changes in XSLT -->
12459
12788
  <!-- =========================================================================== -->
12460
12789
  <xsl:template match="@*|node()" mode="update_xml_step1">
12461
12790
  <xsl:copy>
@@ -12463,6 +12792,12 @@
12463
12792
  </xsl:copy>
12464
12793
  </xsl:template>
12465
12794
 
12795
+ <xsl:template match="@*|node()" mode="update_xml_pres">
12796
+ <xsl:copy>
12797
+ <xsl:apply-templates select="@*|node()" mode="update_xml_pres"/>
12798
+ </xsl:copy>
12799
+ </xsl:template>
12800
+
12466
12801
  <!-- change section's order based on @displayorder value -->
12467
12802
  <xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
12468
12803
  <xsl:copy>
@@ -12539,7 +12874,7 @@
12539
12874
  </xsl:template>
12540
12875
 
12541
12876
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
12542
- <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">
12877
+ <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">
12543
12878
  <xsl:copy>
12544
12879
  <xsl:copy-of select="@*"/>
12545
12880
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12558,14 +12893,17 @@
12558
12893
 
12559
12894
  <!-- remove semantic xml -->
12560
12895
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
12896
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_pres"/>
12561
12897
 
12562
12898
  <!-- remove image/emf -->
12563
12899
  <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
12900
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_pres"/>
12564
12901
 
12565
12902
  <!-- remove preprocess-xslt -->
12566
12903
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
12904
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
12567
12905
 
12568
- <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image'] | *[local-name() = 'sourcecode'] | *[local-name() = 'bibdata'] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
12906
+ <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">
12569
12907
  <xsl:copy-of select="."/>
12570
12908
  </xsl:template>
12571
12909
 
@@ -12631,6 +12969,93 @@
12631
12969
  </xsl:choose>
12632
12970
  </xsl:template>
12633
12971
 
12972
+ <xsl:variable name="regex_passthrough">.*\bpdf\b.*</xsl:variable>
12973
+ <xsl:template match="*[local-name() = 'passthrough']" mode="update_xml_step1">
12974
+ <!-- <xsl:if test="contains(@formats, ' pdf ')"> -->
12975
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@formats), $regex_passthrough)) = 'true'">
12976
+ <xsl:apply-templates mode="update_xml_step1"/>
12977
+ </xsl:if>
12978
+ </xsl:template>
12979
+
12980
+ <!-- split math by element with @linebreak into maths -->
12981
+ <xsl:template match="mathml:math[.//mathml:mo[@linebreak] or .//mathml:mspace[@linebreak]]" mode="update_xml_step1">
12982
+ <xsl:variable name="maths">
12983
+ <xsl:apply-templates select="." mode="mathml_linebreak"/>
12984
+ </xsl:variable>
12985
+ <xsl:copy-of select="$maths"/>
12986
+ </xsl:template>
12987
+
12988
+ <!-- update new Presentation XML -->
12989
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_step1"/>
12990
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_pres"/>
12991
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_step1"/>
12992
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
12993
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
12994
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
12995
+
12996
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
12997
+ <xsl:copy>
12998
+ <xsl:apply-templates select="@*" mode="update_xml_step1"/>
12999
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
13000
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
13001
+ </xsl:copy>
13002
+ </xsl:template>
13003
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_pres">
13004
+ <xsl:copy>
13005
+ <xsl:apply-templates select="@*" mode="update_xml_pres"/>
13006
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
13007
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
13008
+ </xsl:copy>
13009
+ </xsl:template>
13010
+
13011
+ <xsl:template match="*[local-name() = 'fmt-title']"/>
13012
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
13013
+ <xsl:element name="title" namespace="{$namespace_full}">
13014
+ <xsl:copy-of select="@*"/>
13015
+ <xsl:apply-templates mode="update_xml_step1"/>
13016
+ </xsl:element>
13017
+ </xsl:template>
13018
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
13019
+ <xsl:element name="title" namespace="{$namespace_full}">
13020
+ <xsl:copy-of select="@*"/>
13021
+ <xsl:apply-templates mode="update_xml_pres"/>
13022
+ </xsl:element>
13023
+ </xsl:template>
13024
+
13025
+ <xsl:template match="*[local-name() = 'fmt-name']"/>
13026
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
13027
+ <xsl:element name="name" namespace="{$namespace_full}">
13028
+ <xsl:copy-of select="@*"/>
13029
+ <xsl:apply-templates mode="update_xml_step1"/>
13030
+ </xsl:element>
13031
+ </xsl:template>
13032
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres">
13033
+ <xsl:element name="name" namespace="{$namespace_full}">
13034
+ <xsl:copy-of select="@*"/>
13035
+ <xsl:apply-templates mode="update_xml_pres"/>
13036
+ </xsl:element>
13037
+ </xsl:template>
13038
+
13039
+ <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">
13040
+ <xsl:apply-templates mode="update_xml_step1"/>
13041
+ </xsl:template>
13042
+ <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">
13043
+ <xsl:apply-templates mode="update_xml_pres"/>
13044
+ </xsl:template>
13045
+
13046
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_step1">
13047
+ <xsl:apply-templates mode="update_xml_step1"/>
13048
+ </xsl:template>
13049
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_pres">
13050
+ <xsl:apply-templates mode="update_xml_pres"/>
13051
+ </xsl:template>
13052
+
13053
+ <xsl:template match="*[local-name() = 'fmt-xref-label']"/>
13054
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_step1"/>
13055
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_pres"/>
13056
+
13057
+ <!-- END: update new Presentation XML -->
13058
+
12634
13059
  <!-- =========================================================================== -->
12635
13060
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12636
13061
  <!-- =========================================================================== -->
@@ -12734,6 +13159,8 @@
12734
13159
 
12735
13160
  <xsl:template name="insertOpeningElements">
12736
13161
  <xsl:param name="tree"/>
13162
+ <xsl:param name="xmlns"/>
13163
+ <xsl:param name="add_continue">true</xsl:param>
12737
13164
  <xsl:for-each select="$tree//element">
12738
13165
  <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
12739
13166
  <xsl:value-of select="."/>
@@ -12744,7 +13171,8 @@
12744
13171
  <xsl:value-of select="."/>
12745
13172
  <xsl:text>"</xsl:text>
12746
13173
  </xsl:for-each>
12747
- <xsl:if test="position() = 1"> continue="true"</xsl:if>
13174
+ <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
13175
+ <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
12748
13176
  <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
12749
13177
  <xsl:if test="$debug = 'true'">
12750
13178
  <xsl:message>&lt;<xsl:value-of select="."/>&gt;</xsl:message>
@@ -12924,7 +13352,7 @@
12924
13352
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
12925
13353
  <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>
12926
13354
 
12927
- <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">
13355
+ <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">
12928
13356
 
12929
13357
  <xsl:variable name="parent" select="local-name(..)"/>
12930
13358
 
@@ -13506,6 +13934,7 @@
13506
13934
  </pdf:catalog>
13507
13935
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
13508
13936
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
13937
+ <!-- Commented after upgrade to Apache FOP 2.10
13509
13938
  <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="">
13510
13939
  <pdfaExtension:schemas>
13511
13940
  <rdf:Bag>
@@ -13538,7 +13967,7 @@
13538
13967
  </rdf:li>
13539
13968
  </rdf:Bag>
13540
13969
  </pdfaExtension:schemas>
13541
- </rdf:Description>
13970
+ </rdf:Description> -->
13542
13971
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
13543
13972
  <!-- Dublin Core properties go here -->
13544
13973
  <dc:title>
@@ -13585,7 +14014,7 @@
13585
14014
  <xsl:variable name="dc_description">
13586
14015
  <xsl:variable name="abstract">
13587
14016
 
13588
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
14017
+ <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'])]"/>
13589
14018
 
13590
14019
  </xsl:variable>
13591
14020
  <rdf:Alt>
@@ -14128,31 +14557,123 @@
14128
14557
 
14129
14558
  <!-- END: insert cover page image -->
14130
14559
 
14131
- <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
14560
+ <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
14561
+ <xsl:variable name="regex_ja_spec_">[
14562
+ <!-- Rotate 90° clockwise -->
14563
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14564
+ \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
14565
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14566
+ \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
14567
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14568
+ \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
14569
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14570
+ \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
14571
+ \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
14572
+ \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
14573
+ \u3010 <!-- U+3010 LEFT BLACK LENTICULAR BRACKET (【) -->
14574
+ \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
14575
+ \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
14576
+ \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
14577
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14578
+ \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
14579
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14580
+ \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
14581
+ \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
14582
+ \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
14583
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14584
+ \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
14585
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14586
+ \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
14587
+ \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
14588
+ \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
14589
+ \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
14590
+ \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
14591
+
14592
+ \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
14593
+ \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
14594
+ \u301C <!-- U+301C WAVE DASH (〜) -->
14595
+ \u3030 <!-- U+3030 WAVY DASH (〰 )-->
14596
+ \u30FC <!-- U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK (ー) -->
14597
+ \u2329 <!-- U+2329 LEFT-POINTING ANGLE BRACKET (〈) -->
14598
+ \u232A <!-- U+232A RIGHT-POINTING ANGLE BRACKET (〉) -->
14599
+ \u3018 <!-- U+3018 LEFT WHITE TORTOISE SHELL BRACKET (〘) -->
14600
+ \u3019 <!-- U+3019 RIGHT WHITE TORTOISE SHELL BRACKET (〙) -->
14601
+ \u30A0 <!-- U+30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN (゠) -->
14602
+ \uFE59 <!-- U+FE59 SMALL LEFT PARENTHESIS (﹙) -->
14603
+ \uFE5A <!-- U+FE5A SMALL RIGHT PARENTHESIS (﹚) -->
14604
+ \uFE5B <!-- U+FE5B SMALL LEFT CURLY BRACKET (﹛) -->
14605
+ \uFE5C <!-- U+FE5C SMALL RIGHT CURLY BRACKET (﹜) -->
14606
+ \uFE5D <!-- U+FE5D SMALL LEFT TORTOISE SHELL BRACKET (﹝) -->
14607
+ \uFE5E <!-- U+FE5E SMALL RIGHT TORTOISE SHELL BRACKET (﹞) -->
14608
+ \uFF5C <!-- U+FF5C FULLWIDTH VERTICAL LINE (|) -->
14609
+ \uFF5F <!-- U+FF5F FULLWIDTH LEFT WHITE PARENTHESIS (⦅) -->
14610
+ \uFF60 <!-- U+FF60 FULLWIDTH RIGHT WHITE PARENTHESIS (⦆) -->
14611
+ \uFFE3 <!-- U+FFE3 FULLWIDTH MACRON ( ̄) -->
14612
+ \uFF3F <!-- U+FF3F FULLWIDTH LOW LINE (_) -->
14613
+ \uFF5E <!-- U+FF5E FULLWIDTH TILDE (~) -->
14614
+ <!-- Rotate 180° -->
14615
+ \u309C <!-- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜) -->
14616
+ \u3002 <!-- U+3002 IDEOGRAPHIC FULL STOP (。) -->
14617
+ \uFE52 <!-- U+FE52 SMALL FULL STOP (﹒) -->
14618
+ \uFF0E <!-- U+FF0E FULLWIDTH FULL STOP (.) -->
14619
+ ]</xsl:variable>
14620
+ <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
14132
14621
  <xsl:template name="insertVerticalChar">
14133
14622
  <xsl:param name="str"/>
14134
14623
  <xsl:param name="writing-mode">lr-tb</xsl:param>
14135
14624
  <xsl:param name="reference-orientation">90</xsl:param>
14136
- <xsl:if test="string-length($str) &gt; 0">
14137
- <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">
14138
- <xsl:if test="normalize-space($writing-mode) != ''">
14139
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14140
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
14141
- </xsl:if>
14142
- <xsl:variable name="char" select="substring($str,1,1)"/>
14143
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14144
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
14625
+ <xsl:param name="add_zero_width_space">false</xsl:param>
14626
+ <xsl:choose>
14627
+ <xsl:when test="ancestor::*[local-name() = 'span'][@class = 'norotate']">
14628
+ <xsl:value-of select="$str"/>
14629
+ </xsl:when>
14630
+ <xsl:otherwise>
14631
+ <xsl:if test="string-length($str) &gt; 0">
14632
+ <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
14633
+ <xsl:variable name="char" select="substring($str,1,1)"/>
14634
+ <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">
14635
+ <xsl:if test="normalize-space($writing-mode) != ''">
14636
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14637
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14638
+ </xsl:if>
14639
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14640
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
14641
+ </xsl:if>
14642
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14643
+ <!-- Rotate 180°:
14644
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14645
+ U+3002 IDEOGRAPHIC FULL STOP (。)
14646
+ U+FE52 SMALL FULL STOP (﹒)
14647
+ U+FF0E FULLWIDTH FULL STOP (.)
14648
+ -->
14649
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14650
+ </xsl:if>
14651
+ <fo:block-container width="1em">
14652
+ <fo:block line-height="1em">
14653
+ <xsl:choose>
14654
+ <xsl:when test="$horizontal_mode = 'true'">
14655
+ <xsl:value-of select="$str"/>
14656
+ </xsl:when>
14657
+ <xsl:otherwise>
14658
+ <xsl:value-of select="$char"/>
14659
+ </xsl:otherwise>
14660
+ </xsl:choose>
14661
+ </fo:block>
14662
+ </fo:block-container>
14663
+ </fo:inline-container>
14664
+ <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>
14665
+
14666
+ <xsl:if test="$horizontal_mode = 'false'">
14667
+ <xsl:call-template name="insertVerticalChar">
14668
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14669
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
14670
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14671
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14672
+ </xsl:call-template>
14673
+ </xsl:if>
14145
14674
  </xsl:if>
14146
- <fo:block-container width="1em">
14147
- <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
14148
- </fo:block-container>
14149
- </fo:inline-container>
14150
- <xsl:call-template name="insertVerticalChar">
14151
- <xsl:with-param name="str" select="substring($str, 2)"/>
14152
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
14153
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14154
- </xsl:call-template>
14155
- </xsl:if>
14675
+ </xsl:otherwise>
14676
+ </xsl:choose>
14156
14677
  </xsl:template>
14157
14678
 
14158
14679
  <xsl:template name="number-to-words">