metanorma-ogc 2.6.5 → 2.6.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -293,6 +293,58 @@
293
293
 
294
294
  <xsl:call-template name="addBookmarks">
295
295
  <xsl:with-param name="contents" select="$contents"/>
296
+ <xsl:with-param name="contents_addon">
297
+ <xsl:if test="$contents//tables/table or $contents//figures/figure or //*[local-name() = 'table'][.//*[local-name() = 'p'][@class = 'RecommendationTitle']]">
298
+ <fo:bookmark internal-destination="empty_bookmark">
299
+ <fo:bookmark-title>—————</fo:bookmark-title>
300
+ </fo:bookmark>
301
+ </xsl:if>
302
+
303
+ <xsl:if test="$contents//tables/table">
304
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
305
+ <fo:bookmark-title>
306
+ <xsl:value-of select="$title-list-tables"/>
307
+ </fo:bookmark-title>
308
+ <xsl:for-each select="$contents//tables/table">
309
+ <fo:bookmark internal-destination="{@id}">
310
+ <xsl:variable name="title">
311
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="bookmarks"/>
312
+ </xsl:variable>
313
+ <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
314
+ </fo:bookmark>
315
+ </xsl:for-each>
316
+ </fo:bookmark>
317
+ </xsl:if>
318
+
319
+ <xsl:if test="$contents//figures/figure">
320
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
321
+ <fo:bookmark-title>
322
+ <xsl:value-of select="$title-list-figures"/>
323
+ </fo:bookmark-title>
324
+ <xsl:for-each select="$contents//figures/figure">
325
+ <fo:bookmark internal-destination="{@id}">
326
+ <xsl:variable name="title">
327
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="bookmarks"/>
328
+ </xsl:variable>
329
+ <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
330
+ </fo:bookmark>
331
+ </xsl:for-each>
332
+ </fo:bookmark>
333
+ </xsl:if>
334
+
335
+ <xsl:if test="//*[local-name() = 'table'][.//*[local-name() = 'p'][@class = 'RecommendationTitle']]">
336
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
337
+ <fo:bookmark-title>
338
+ <xsl:value-of select="$title-list-recommendations"/>
339
+ </fo:bookmark-title>
340
+ <xsl:for-each select="xalan:nodeset($toc_recommendations)/*">
341
+ <fo:bookmark internal-destination="{@id}">
342
+ <fo:bookmark-title><xsl:value-of select="bookmark"/></fo:bookmark-title>
343
+ </fo:bookmark>
344
+ </xsl:for-each>
345
+ </fo:bookmark>
346
+ </xsl:if>
347
+ </xsl:with-param>
296
348
  </xsl:call-template>
297
349
 
298
350
  <!-- Cover Page -->
@@ -523,7 +575,10 @@
523
575
  <fo:block-container margin-left="2.5mm" margin-right="1mm" padding-top="0.5mm" padding-bottom="0.5mm">
524
576
  <fo:block-container margin-left="0mm" margin-right="0mm">
525
577
  <fo:block>
526
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:legal-statement">
578
+ <xsl:variable name="legal_statement">
579
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:legal-statement" mode="update_xml_step1"/>
580
+ </xsl:variable>
581
+ <xsl:apply-templates select="xalan:nodeset($legal_statement)/*">
527
582
  <xsl:with-param name="isLegacy" select="$isLegacy"/>
528
583
  </xsl:apply-templates>
529
584
  </fo:block>
@@ -532,7 +587,10 @@
532
587
  </fo:block-container>
533
588
  </xsl:when>
534
589
  <xsl:otherwise>
535
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:legal-statement"/>
590
+ <xsl:variable name="legal_statement">
591
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:legal-statement" mode="update_xml_step1"/>
592
+ </xsl:variable>
593
+ <xsl:apply-templates select="xalan:nodeset($legal_statement)/*"/>
536
594
  </xsl:otherwise>
537
595
  </xsl:choose>
538
596
 
@@ -548,11 +606,11 @@
548
606
  <xsl:call-template name="insertHeaderFooter"/>
549
607
  <fo:flow flow-name="xsl-region-body">
550
608
 
551
- <!-- <xsl:if test="$debug = 'true'">
552
- <redirect:write file="contents_{java:getTime(java:java.util.Date.new())}.xml">
609
+ <xsl:if test="$debug = 'true'">
610
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
553
611
  <xsl:copy-of select="$contents"/>
554
612
  </redirect:write>
555
- </xsl:if> -->
613
+ </xsl:if>
556
614
 
557
615
  <!-- crossing lines -->
558
616
  <fo:block-container absolute-position="fixed" width="{$pageWidth}mm" height="{$pageHeight}mm" font-size="0">
@@ -569,11 +627,21 @@
569
627
 
570
628
  <xsl:call-template name="insertLogoPreface"/>
571
629
 
572
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:license-statement"/>
573
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:feedback-statement"/>
630
+ <xsl:variable name="license_statement">
631
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:license-statement" mode="update_xml_step1"/>
632
+ </xsl:variable>
633
+ <xsl:apply-templates select="xalan:nodeset($license_statement)/*"/>
634
+
635
+ <xsl:variable name="feedback_statement">
636
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:feedback-statement" mode="update_xml_step1"/>
637
+ </xsl:variable>
638
+ <xsl:apply-templates select="xalan:nodeset($feedback_statement)/*"/>
574
639
 
575
640
  <!-- Copyright notice -->
576
- <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:copyright-statement"/>
641
+ <xsl:variable name="copyright_statement">
642
+ <xsl:apply-templates select="/ogc:ogc-standard/ogc:boilerplate/ogc:copyright-statement" mode="update_xml_step1"/>
643
+ </xsl:variable>
644
+ <xsl:apply-templates select="xalan:nodeset($copyright_statement)/*"/>
577
645
 
578
646
  </fo:flow>
579
647
  </fo:page-sequence>
@@ -963,7 +1031,7 @@
963
1031
  </xsl:call-template>
964
1032
  </xsl:template>
965
1033
 
966
- <xsl:template match="ogc:title//text() | ogc:name//text()" priority="3" mode="contents">
1034
+ <xsl:template match="ogc:title//text() | ogc:name//text() | ogc:fmt-title//text() | ogc:fmt-name//text()" priority="3" mode="contents">
967
1035
  <xsl:call-template name="add_fo_character">
968
1036
  <xsl:with-param name="text" select="translate(., $thin_space, ' ')"/>
969
1037
  </xsl:call-template>
@@ -1130,10 +1198,10 @@
1130
1198
  <!-- ============================= -->
1131
1199
 
1132
1200
  <!-- element with title -->
1133
- <xsl:template match="*[ogc:title][not(@type = 'toc')]" mode="contents">
1201
+ <xsl:template match="*[ogc:title or ogc:fmt-title][not(@type = 'toc')]" mode="contents">
1134
1202
  <xsl:variable name="level">
1135
1203
  <xsl:call-template name="getLevel">
1136
- <xsl:with-param name="depth" select="ogc:title/@depth"/>
1204
+ <xsl:with-param name="depth" select="ogc:fmt-title/@depth | ogc:title/@depth"/>
1137
1205
  </xsl:call-template>
1138
1206
  </xsl:variable>
1139
1207
 
@@ -1241,6 +1309,7 @@
1241
1309
  <xsl:attribute name="line-height">125%</xsl:attribute>
1242
1310
  </xsl:if>
1243
1311
  <xsl:call-template name="setId"/>
1312
+ <xsl:call-template name="addReviewHelper"/>
1244
1313
  <xsl:apply-templates/>
1245
1314
  </fo:block>
1246
1315
  </xsl:template>
@@ -1905,7 +1974,7 @@
1905
1974
  </fo:static-content>
1906
1975
  </xsl:template>
1907
1976
 
1908
- <xsl:strip-space elements="ogc:xref"/>
1977
+ <!-- <xsl:strip-space elements="ogc:xref"/> -->
1909
1978
 
1910
1979
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1911
1980
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
@@ -2990,6 +3059,10 @@
2990
3059
 
2991
3060
  <xsl:template name="refine_termnote-name-style">
2992
3061
 
3062
+ <!-- <xsl:if test="$namespace = 'ieee'">
3063
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
3064
+ </xsl:if> -->
3065
+
2993
3066
  </xsl:template>
2994
3067
 
2995
3068
  <xsl:attribute-set name="termnote-p-style">
@@ -3696,9 +3769,21 @@
3696
3769
  <xsl:template name="processTables_Contents">
3697
3770
  <tables>
3698
3771
  <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3699
- <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3700
- <xsl:copy-of select="*[local-name() = 'name']"/>
3701
- </table>
3772
+ <xsl:choose>
3773
+ <xsl:when test="*[local-name() = 'fmt-name']">
3774
+ <xsl:variable name="fmt_name">
3775
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3776
+ </xsl:variable>
3777
+ <table id="{@id}" alt-text="{normalize-space($fmt_name)}">
3778
+ <xsl:copy-of select="$fmt_name"/>
3779
+ </table>
3780
+ </xsl:when>
3781
+ <xsl:otherwise>
3782
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3783
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3784
+ </table>
3785
+ </xsl:otherwise>
3786
+ </xsl:choose>
3702
3787
  </xsl:for-each>
3703
3788
  </tables>
3704
3789
  </xsl:template>
@@ -3706,9 +3791,21 @@
3706
3791
  <xsl:template name="processFigures_Contents">
3707
3792
  <figures>
3708
3793
  <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) != '']">
3709
- <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3710
- <xsl:copy-of select="*[local-name() = 'name']"/>
3711
- </figure>
3794
+ <xsl:choose>
3795
+ <xsl:when test="*[local-name() = 'fmt-name']">
3796
+ <xsl:variable name="fmt_name">
3797
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3798
+ </xsl:variable>
3799
+ <figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
3800
+ <xsl:copy-of select="$fmt_name"/>
3801
+ </figure>
3802
+ </xsl:when>
3803
+ <xsl:otherwise>
3804
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3805
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3806
+ </figure>
3807
+ </xsl:otherwise>
3808
+ </xsl:choose>
3712
3809
  </xsl:for-each>
3713
3810
  </figures>
3714
3811
  </xsl:template>
@@ -5548,6 +5645,11 @@
5548
5645
 
5549
5646
  <xsl:value-of select="@reference"/>
5550
5647
 
5648
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5649
+ <!-- <xsl:if test="$namespace = 'itu'">
5650
+ <xsl:text>)</xsl:text>
5651
+ </xsl:if> -->
5652
+
5551
5653
  </fo:inline>
5552
5654
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
5553
5655
  <xsl:copy-of select="./node()"/>
@@ -5557,7 +5659,7 @@
5557
5659
 
5558
5660
  </xsl:if>
5559
5661
  </xsl:for-each>
5560
- </xsl:template>
5662
+ </xsl:template> <!-- table_fn_display -->
5561
5663
 
5562
5664
  <xsl:template name="create_fn">
5563
5665
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -5591,8 +5693,10 @@
5591
5693
  <!-- EMD table's footnotes rendering -->
5592
5694
  <!-- ============================ -->
5593
5695
 
5696
+ <!-- ============================ -->
5594
5697
  <!-- figure's footnotes rendering -->
5595
- <xsl:template name="fn_display_figure">
5698
+ <!-- ============================ -->
5699
+ <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
5596
5700
 
5597
5701
  <!-- current figure id -->
5598
5702
  <xsl:variable name="figure_id_">
@@ -5705,9 +5809,28 @@
5705
5809
 
5706
5810
  </fo:block>
5707
5811
  </xsl:if>
5708
-
5709
5812
  </xsl:template> <!-- fn_display_figure -->
5710
5813
 
5814
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
5815
+ <!-- figure's footnote label -->
5816
+ <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">
5817
+ <xsl:variable name="key_iso">
5818
+
5819
+ </xsl:variable>
5820
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5821
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5822
+
5823
+ </xsl:if>
5824
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
5825
+ <!-- <xsl:value-of select="@reference"/> -->
5826
+ <xsl:apply-templates/>
5827
+ </fo:inline>
5828
+ </xsl:template>
5829
+
5830
+ <!-- ============================ -->
5831
+ <!-- END: figure's footnotes rendering -->
5832
+ <!-- ============================ -->
5833
+
5711
5834
  <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
5712
5835
  <xsl:template match="*[local-name()='fn']">
5713
5836
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
@@ -5728,6 +5851,10 @@
5728
5851
 
5729
5852
  <xsl:value-of select="@reference"/>
5730
5853
 
5854
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5855
+ <!-- <xsl:if test="$namespace = 'jis'">
5856
+ <fo:inline font-weight="normal">)</fo:inline>
5857
+ </xsl:if> -->
5731
5858
  </fo:basic-link>
5732
5859
  </fo:inline>
5733
5860
  </xsl:template>
@@ -5854,17 +5981,22 @@
5854
5981
  </fo:block>
5855
5982
  </xsl:when> <!-- END: a few components -->
5856
5983
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
5857
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
5984
+ <!-- Presentation XML contains 'Key' caption, https://github.com/metanorma/isodoc/issues/607 -->
5985
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'p' and @keep-with-next])"> <!-- for old Presentation XML -->
5858
5986
 
5859
- <xsl:call-template name="refine_figure_key_style"/>
5987
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
5860
5988
 
5861
- <xsl:variable name="title-key">
5862
- <xsl:call-template name="getLocalizedString">
5863
- <xsl:with-param name="key">key</xsl:with-param>
5864
- </xsl:call-template>
5865
- </xsl:variable>
5866
- <xsl:value-of select="$title-key"/>
5867
- </fo:block>
5989
+ <xsl:call-template name="refine_figure_key_style"/>
5990
+
5991
+ <xsl:variable name="title-key">
5992
+ <xsl:call-template name="getLocalizedString">
5993
+ <xsl:with-param name="key">key</xsl:with-param>
5994
+ </xsl:call-template>
5995
+ </xsl:variable>
5996
+ <xsl:value-of select="$title-key"/>
5997
+ </fo:block>
5998
+
5999
+ </xsl:if>
5868
6000
  </xsl:when> <!-- END: definition list in a figure -->
5869
6001
  </xsl:choose>
5870
6002
 
@@ -6050,6 +6182,14 @@
6050
6182
 
6051
6183
  </xsl:template> <!-- END: dl -->
6052
6184
 
6185
+ <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
6186
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
6187
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
6188
+ <xsl:call-template name="refine_figure_key_style"/>
6189
+ <xsl:apply-templates/>
6190
+ </fo:block>
6191
+ </xsl:template>
6192
+
6053
6193
  <xsl:template name="refine_dl_formula_where_style">
6054
6194
 
6055
6195
  </xsl:template> <!-- refine_dl_formula_where_style -->
@@ -8092,6 +8232,39 @@
8092
8232
  </xsl:copy>
8093
8233
  </xsl:template>
8094
8234
 
8235
+ <xsl:template match="@*|node()" mode="mathml_linebreak">
8236
+ <xsl:copy>
8237
+ <xsl:apply-templates select="@*|node()" mode="mathml_linebreak"/>
8238
+ </xsl:copy>
8239
+ </xsl:template>
8240
+
8241
+ <!-- split math into two math -->
8242
+ <xsl:template match="mathml:mo[@linebreak] | mathml:mspace[@linebreak]" mode="mathml_linebreak">
8243
+ <xsl:variable name="math_elements_tree_">
8244
+ <xsl:for-each select="ancestor::*[ancestor-or-self::mathml:math]">
8245
+ <element pos="{position()}">
8246
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
8247
+ <xsl:value-of select="name()"/>
8248
+ </element>
8249
+ </xsl:for-each>
8250
+ </xsl:variable>
8251
+
8252
+ <xsl:variable name="math_elements_tree" select="xalan:nodeset($math_elements_tree_)"/>
8253
+
8254
+ <xsl:call-template name="insertClosingElements">
8255
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
8256
+ </xsl:call-template>
8257
+
8258
+ <xsl:element name="br" namespace="{$namespace_full}"/>
8259
+
8260
+ <xsl:call-template name="insertOpeningElements">
8261
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
8262
+ <xsl:with-param name="xmlns">http://www.w3.org/1998/Math/MathML</xsl:with-param>
8263
+ <xsl:with-param name="add_continue">false</xsl:with-param>
8264
+ </xsl:call-template>
8265
+
8266
+ </xsl:template>
8267
+
8095
8268
  <!-- Examples:
8096
8269
  <stem type="AsciiMath">x = 1</stem>
8097
8270
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -8347,9 +8520,11 @@
8347
8520
  </xsl:template>
8348
8521
 
8349
8522
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
8523
+ <!-- https://github.com/metanorma/isodoc/issues/607
8350
8524
  <xsl:if test="normalize-space() != ''">
8351
- <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
8352
- </xsl:if>
8525
+ <xsl:text>(</xsl:text><xsl:apply-templates /><xsl:text>)</xsl:text>
8526
+ </xsl:if> -->
8527
+ <xsl:apply-templates/>
8353
8528
  </xsl:template>
8354
8529
 
8355
8530
  <!-- stem inside formula with name (with formula's number) -->
@@ -8420,6 +8595,8 @@
8420
8595
 
8421
8596
  <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
8422
8597
 
8598
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab"/>
8599
+
8423
8600
  <xsl:call-template name="refine_note-name-style"/>
8424
8601
 
8425
8602
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -8476,10 +8653,6 @@
8476
8653
 
8477
8654
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
8478
8655
 
8479
- <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
8480
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
8481
- </xsl:if>
8482
-
8483
8656
  <xsl:call-template name="refine_termnote-name-style"/>
8484
8657
 
8485
8658
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -8505,6 +8678,17 @@
8505
8678
  </xsl:when>
8506
8679
  <xsl:otherwise>
8507
8680
 
8681
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
8682
+ <!-- <xsl:if test="$namespace = 'ieee'">
8683
+ <xsl:text>—</xsl:text> em dash &#x2014;
8684
+ </xsl:if> -->
8685
+ <!-- <xsl:if test="$namespace = 'iho' or $namespace = 'gb' or $namespace = 'm3d' or $namespace = 'unece-rec' or $namespace = 'unece' or $namespace = 'rsd'">
8686
+ <xsl:text>:</xsl:text>
8687
+ </xsl:if> -->
8688
+
8689
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp'">
8690
+ <xsl:text> – </xsl:text> en dash &#x2013;
8691
+ </xsl:if> -->
8508
8692
  </xsl:otherwise>
8509
8693
  </xsl:choose>
8510
8694
  </xsl:variable>
@@ -8523,8 +8707,16 @@
8523
8707
  </xsl:when>
8524
8708
  <xsl:otherwise>
8525
8709
 
8710
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
8711
+ <!-- <xsl:if test="$namespace = 'ieee'">
8712
+ <xsl:text>—</xsl:text> em dash &#x2014;
8713
+ </xsl:if> -->
8714
+ <!-- <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'">
8526
8715
  <xsl:text>:</xsl:text>
8527
-
8716
+ </xsl:if> -->
8717
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'unece-rec' or $namespace = 'unece'">
8718
+ <xsl:text> – </xsl:text> en dash &#x2013;
8719
+ </xsl:if> -->
8528
8720
  </xsl:otherwise>
8529
8721
  </xsl:choose>
8530
8722
  </xsl:variable>
@@ -8609,17 +8801,29 @@
8609
8801
  <!-- Example: Dimensions in millimeters -->
8610
8802
  <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
8611
8803
 
8804
+ <xsl:variable name="show_figure_key_in_block_container">
8805
+ true
8806
+ </xsl:variable>
8807
+
8612
8808
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
8613
8809
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
8614
8810
  </fo:block>
8615
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8616
- <xsl:call-template name="note"/>
8617
- </xsl:for-each>
8618
- <xsl:call-template name="fn_display_figure"/>
8811
+
8812
+ <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
8813
+ <xsl:call-template name="showFigureKey"/>
8814
+ </xsl:if>
8619
8815
 
8620
8816
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
8621
8817
 
8622
8818
  </fo:block-container>
8819
+
8820
+ </xsl:template>
8821
+
8822
+ <xsl:template name="showFigureKey">
8823
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8824
+ <xsl:call-template name="note"/>
8825
+ </xsl:for-each>
8826
+ <xsl:call-template name="fn_display_figure"/>
8623
8827
  </xsl:template>
8624
8828
 
8625
8829
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -8815,6 +9019,22 @@
8815
9019
  </xsl:if>
8816
9020
  </xsl:template>
8817
9021
 
9022
+ <xsl:template name="getImageSrc">
9023
+ <xsl:choose>
9024
+ <xsl:when test="not(starts-with(@src, 'data:'))">
9025
+ <xsl:choose>
9026
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9027
+ <xsl:value-of select="@src"/>
9028
+ </xsl:when>
9029
+ <xsl:otherwise>
9030
+ <xsl:value-of select="concat($basepath, @src)"/>
9031
+ </xsl:otherwise>
9032
+ </xsl:choose>
9033
+ </xsl:when>
9034
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9035
+ </xsl:choose>
9036
+ </xsl:template>
9037
+
8818
9038
  <xsl:template name="getImageScale">
8819
9039
  <xsl:param name="indent"/>
8820
9040
  <xsl:variable name="indent_left">
@@ -8824,19 +9044,7 @@
8824
9044
  </xsl:choose>
8825
9045
  </xsl:variable>
8826
9046
  <xsl:variable name="img_src">
8827
- <xsl:choose>
8828
- <xsl:when test="not(starts-with(@src, 'data:'))">
8829
- <xsl:choose>
8830
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8831
- <xsl:value-of select="@src"/>
8832
- </xsl:when>
8833
- <xsl:otherwise>
8834
- <xsl:value-of select="concat($basepath, @src)"/>
8835
- </xsl:otherwise>
8836
- </xsl:choose>
8837
- </xsl:when>
8838
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8839
- </xsl:choose>
9047
+ <xsl:call-template name="getImageSrc"/>
8840
9048
  </xsl:variable>
8841
9049
 
8842
9050
  <xsl:variable name="image_width_effective">
@@ -8844,10 +9052,15 @@
8844
9052
  <xsl:value-of select="$width_effective - number($indent_left)"/>
8845
9053
 
8846
9054
  </xsl:variable>
9055
+ <xsl:variable name="image_height_effective" select="$height_effective - number($indent_left)"/>
8847
9056
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8848
9057
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8849
9058
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
8850
- <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9059
+ <xsl:variable name="scale">
9060
+
9061
+ <xsl:value-of select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9062
+
9063
+ </xsl:variable>
8851
9064
  <xsl:value-of select="$scale"/>
8852
9065
  </xsl:template>
8853
9066
 
@@ -9400,20 +9613,48 @@
9400
9613
  <xsl:template match="*[local-name() = 'emf']"/>
9401
9614
 
9402
9615
  <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">
9616
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
9617
+ <xsl:apply-templates mode="contents"/>
9618
+ <xsl:text> </xsl:text>
9619
+ </xsl:if>
9620
+ </xsl:template>
9621
+
9622
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="contents"/>
9623
+
9624
+ <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">
9403
9625
  <xsl:apply-templates mode="contents"/>
9404
9626
  <xsl:text> </xsl:text>
9405
9627
  </xsl:template>
9406
9628
 
9407
9629
  <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">
9630
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
9631
+ <xsl:apply-templates mode="bookmarks"/>
9632
+ <xsl:text> </xsl:text>
9633
+ </xsl:if>
9634
+ </xsl:template>
9635
+
9636
+ <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">
9408
9637
  <xsl:apply-templates mode="bookmarks"/>
9409
9638
  <xsl:text> </xsl:text>
9410
9639
  </xsl:template>
9411
9640
 
9412
9641
  <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">
9642
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
9643
+ <xsl:value-of select="."/>
9644
+ </xsl:if>
9645
+ </xsl:template>
9646
+
9647
+ <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">
9413
9648
  <xsl:value-of select="."/>
9414
9649
  </xsl:template>
9415
9650
 
9416
9651
  <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">
9652
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
9653
+ <xsl:value-of select="."/>
9654
+ </xsl:if>
9655
+ </xsl:template>
9656
+
9657
+ <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">
9417
9658
  <xsl:value-of select="."/>
9418
9659
  </xsl:template>
9419
9660
 
@@ -9434,7 +9675,7 @@
9434
9675
  </xsl:template>
9435
9676
 
9436
9677
  <!-- special case: ignore section-title if @depth different than @depth of parent clause, or @depth of parent clause = 1 -->
9437
- <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"/>
9678
+ <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"/>
9438
9679
 
9439
9680
  <xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
9440
9681
  <xsl:variable name="level">
@@ -9446,6 +9687,9 @@
9446
9687
  <xsl:variable name="section">
9447
9688
  <xsl:choose>
9448
9689
  <xsl:when test="@type = 'section-title'"/>
9690
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
9691
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9692
+ </xsl:when>
9449
9693
  <xsl:otherwise>
9450
9694
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9451
9695
  </xsl:otherwise>
@@ -9468,6 +9712,19 @@
9468
9712
 
9469
9713
  <xsl:variable name="title">
9470
9714
  <xsl:choose>
9715
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/770 -->
9716
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
9717
+ <xsl:choose>
9718
+ <xsl:when test="@type = 'section-title'">
9719
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9720
+ <xsl:text>: </xsl:text>
9721
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9722
+ </xsl:when>
9723
+ <xsl:otherwise>
9724
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9725
+ </xsl:otherwise>
9726
+ </xsl:choose>
9727
+ </xsl:when>
9471
9728
  <xsl:when test="*[local-name() = 'tab']">
9472
9729
  <xsl:choose>
9473
9730
  <xsl:when test="@type = 'section-title'">
@@ -9503,7 +9760,7 @@
9503
9760
  <xsl:apply-templates mode="bookmarks"/>
9504
9761
  </xsl:template>
9505
9762
 
9506
- <xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
9763
+ <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">
9507
9764
  <xsl:apply-templates select="."/>
9508
9765
  </xsl:template>
9509
9766
 
@@ -9516,6 +9773,10 @@
9516
9773
  <xsl:apply-templates mode="contents"/>
9517
9774
  </xsl:template>
9518
9775
 
9776
+ <xsl:template match="*[local-name() = 'semx']" mode="contents">
9777
+ <xsl:apply-templates mode="contents"/>
9778
+ </xsl:template>
9779
+
9519
9780
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
9520
9781
  <xsl:apply-templates mode="bookmarks"/>
9521
9782
  </xsl:template>
@@ -9525,9 +9786,14 @@
9525
9786
  <xsl:apply-templates mode="bookmarks"/>
9526
9787
  </xsl:template>
9527
9788
 
9789
+ <xsl:template match="*[local-name() = 'semx']" mode="bookmarks">
9790
+ <xsl:apply-templates mode="bookmarks"/>
9791
+ </xsl:template>
9792
+
9528
9793
  <!-- Bookmarks -->
9529
9794
  <xsl:template name="addBookmarks">
9530
9795
  <xsl:param name="contents"/>
9796
+ <xsl:param name="contents_addon"/>
9531
9797
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
9532
9798
  <xsl:if test="$contents_nodes//item">
9533
9799
  <fo:bookmark-tree>
@@ -9625,57 +9891,8 @@
9625
9891
  </xsl:otherwise>
9626
9892
  </xsl:choose>
9627
9893
 
9628
- <xsl:if test="$contents//tables/table or $contents//figures/figure or //*[local-name() = 'table'][.//*[local-name() = 'p'][@class = 'RecommendationTitle']]">
9629
- <fo:bookmark internal-destination="empty_bookmark">
9630
- <fo:bookmark-title>—————</fo:bookmark-title>
9631
- </fo:bookmark>
9632
- </xsl:if>
9633
-
9634
- <xsl:if test="$contents//tables/table">
9635
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
9636
- <fo:bookmark-title>
9637
- <xsl:value-of select="$title-list-tables"/>
9638
- </fo:bookmark-title>
9639
- <xsl:for-each select="$contents//tables/table">
9640
- <fo:bookmark internal-destination="{@id}">
9641
- <xsl:variable name="title">
9642
- <xsl:apply-templates select="*[local-name() = 'name']" mode="bookmarks"/>
9643
- </xsl:variable>
9644
- <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
9645
- </fo:bookmark>
9646
- </xsl:for-each>
9647
- </fo:bookmark>
9648
- </xsl:if>
9649
-
9650
- <xsl:if test="$contents//figures/figure">
9651
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
9652
- <fo:bookmark-title>
9653
- <xsl:value-of select="$title-list-figures"/>
9654
- </fo:bookmark-title>
9655
- <xsl:for-each select="$contents//figures/figure">
9656
- <fo:bookmark internal-destination="{@id}">
9657
- <xsl:variable name="title">
9658
- <xsl:apply-templates select="*[local-name() = 'name']" mode="bookmarks"/>
9659
- </xsl:variable>
9660
- <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
9661
- </fo:bookmark>
9662
- </xsl:for-each>
9663
- </fo:bookmark>
9664
- </xsl:if>
9665
-
9666
- <xsl:if test="//*[local-name() = 'table'][.//*[local-name() = 'p'][@class = 'RecommendationTitle']]">
9667
- <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
9668
- <fo:bookmark-title>
9669
- <xsl:value-of select="$title-list-recommendations"/>
9670
- </fo:bookmark-title>
9671
- <xsl:for-each select="xalan:nodeset($toc_recommendations)/*">
9672
- <fo:bookmark internal-destination="{@id}">
9673
- <fo:bookmark-title><xsl:value-of select="bookmark"/></fo:bookmark-title>
9674
- </fo:bookmark>
9675
- </xsl:for-each>
9676
- </fo:bookmark>
9677
- </xsl:if>
9678
- <!-- $namespace = 'ogc' -->
9894
+ <!-- for $namespace = 'nist-sp' $namespace = 'ogc' $namespace = 'ogc-white-paper' -->
9895
+ <xsl:copy-of select="$contents_addon"/>
9679
9896
 
9680
9897
  </fo:bookmark-tree>
9681
9898
  </xsl:if>
@@ -9796,6 +10013,16 @@
9796
10013
  <!-- ====== -->
9797
10014
  <!-- ====== -->
9798
10015
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
10016
+ <xsl:param name="mode">bookmarks</xsl:param>
10017
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-title'])">
10018
+ <xsl:apply-templates mode="contents_item">
10019
+ <xsl:with-param name="mode" select="$mode"/>
10020
+ </xsl:apply-templates>
10021
+ <!-- <xsl:text> </xsl:text> -->
10022
+ </xsl:if>
10023
+ </xsl:template>
10024
+
10025
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="contents_item">
9799
10026
  <xsl:param name="mode">bookmarks</xsl:param>
9800
10027
  <xsl:apply-templates mode="contents_item">
9801
10028
  <xsl:with-param name="mode" select="$mode"/>
@@ -9803,12 +10030,38 @@
9803
10030
  <!-- <xsl:text> </xsl:text> -->
9804
10031
  </xsl:template>
9805
10032
 
10033
+ <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">
10034
+ <xsl:apply-templates mode="contents_item"/>
10035
+ </xsl:template>
10036
+
10037
+ <xsl:template match="*[local-name() = 'semx']" mode="contents_item">
10038
+ <xsl:apply-templates mode="contents_item"/>
10039
+ </xsl:template>
10040
+
10041
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="contents_item"/>
10042
+
9806
10043
  <xsl:template name="getSection">
9807
- <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10044
+ <xsl:choose>
10045
+ <xsl:when test="*[local-name() = 'fmt-title']">
10046
+ <xsl:variable name="fmt_title_section">
10047
+ <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')]"/>
10048
+ </xsl:variable>
10049
+ <xsl:value-of select="normalize-space($fmt_title_section)"/>
10050
+ </xsl:when>
10051
+ <xsl:otherwise>
10052
+ <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10053
+ </xsl:otherwise>
10054
+ </xsl:choose>
9808
10055
  </xsl:template>
9809
10056
 
9810
10057
  <xsl:template name="getName">
9811
10058
  <xsl:choose>
10059
+ <xsl:when test="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']]">
10060
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/following-sibling::node()"/>
10061
+ </xsl:when>
10062
+ <xsl:when test="*[local-name() = 'fmt-title']">
10063
+ <xsl:copy-of select="*[local-name() = 'fmt-title']/node()"/>
10064
+ </xsl:when>
9812
10065
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
9813
10066
  <xsl:copy-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/following-sibling::node()"/>
9814
10067
  </xsl:when>
@@ -9915,6 +10168,15 @@
9915
10168
  </xsl:template>
9916
10169
 
9917
10170
  <xsl:template match="*[local-name() = 'name']" mode="contents_item">
10171
+ <xsl:param name="mode">bookmarks</xsl:param>
10172
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
10173
+ <xsl:apply-templates mode="contents_item">
10174
+ <xsl:with-param name="mode" select="$mode"/>
10175
+ </xsl:apply-templates>
10176
+ </xsl:if>
10177
+ </xsl:template>
10178
+
10179
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="contents_item">
9918
10180
  <xsl:param name="mode">bookmarks</xsl:param>
9919
10181
  <xsl:apply-templates mode="contents_item">
9920
10182
  <xsl:with-param name="mode" select="$mode"/>
@@ -10745,7 +11007,7 @@
10745
11007
  <xsl:if test="normalize-space() != ''">
10746
11008
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
10747
11009
  <xsl:call-template name="refine_termexample-name-style"/>
10748
- <xsl:apply-templates/>
11010
+ <xsl:apply-templates/> <!-- commented $namespace = 'ieee', https://github.com/metanorma/isodoc/issues/614-->
10749
11011
  </fo:inline>
10750
11012
  </xsl:if>
10751
11013
  </xsl:template>
@@ -10786,107 +11048,108 @@
10786
11048
  -->
10787
11049
  <xsl:template match="*[local-name() = 'example']">
10788
11050
 
10789
- <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11051
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10790
11052
 
10791
- <xsl:call-template name="setBlockSpanAll"/>
10792
-
10793
- <xsl:call-template name="refine_example-style"/>
11053
+ <xsl:call-template name="setBlockSpanAll"/>
10794
11054
 
10795
- <xsl:variable name="fo_element">
10796
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
10797
- inline
10798
- </xsl:variable>
11055
+ <xsl:call-template name="refine_example-style"/>
10799
11056
 
10800
- <fo:block-container margin-left="0mm" role="SKIP">
11057
+ <xsl:variable name="fo_element">
11058
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11059
+ inline
11060
+ </xsl:variable>
10801
11061
 
10802
- <xsl:choose>
11062
+ <fo:block-container margin-left="0mm" role="SKIP">
10803
11063
 
10804
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
11064
+ <xsl:choose>
10805
11065
 
10806
- <!-- display name 'EXAMPLE' in a separate block -->
10807
- <fo:block>
10808
- <xsl:apply-templates select="*[local-name()='name']">
10809
- <xsl:with-param name="fo_element" select="$fo_element"/>
10810
- </xsl:apply-templates>
10811
- </fo:block>
11066
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
10812
11067
 
10813
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10814
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10815
- <xsl:variable name="example_body">
10816
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11068
+ <!-- display name 'EXAMPLE' in a separate block -->
11069
+ <fo:block>
11070
+ <xsl:apply-templates select="*[local-name()='name']">
10817
11071
  <xsl:with-param name="fo_element" select="$fo_element"/>
10818
11072
  </xsl:apply-templates>
11073
+ </fo:block>
11074
+
11075
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11076
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11077
+ <xsl:variable name="example_body">
11078
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11079
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11080
+ </xsl:apply-templates>
11081
+ </xsl:variable>
11082
+ <xsl:choose>
11083
+ <xsl:when test="xalan:nodeset($example_body)/*">
11084
+ <xsl:copy-of select="$example_body"/>
11085
+ </xsl:when>
11086
+ <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
11087
+ </xsl:choose>
11088
+ </fo:block-container>
11089
+ </fo:block-container>
11090
+ </xsl:when> <!-- end block -->
11091
+
11092
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
11093
+
11094
+ <xsl:variable name="provisional_distance_between_starts_">
11095
+ 7
10819
11096
  </xsl:variable>
10820
- <xsl:choose>
10821
- <xsl:when test="xalan:nodeset($example_body)/*">
10822
- <xsl:copy-of select="$example_body"/>
10823
- </xsl:when>
10824
- <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
10825
- </xsl:choose>
10826
- </fo:block-container>
10827
- </fo:block-container>
10828
- </xsl:when> <!-- end block -->
11097
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11098
+ <xsl:variable name="indent_">
11099
+ 0
11100
+ </xsl:variable>
11101
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
10829
11102
 
10830
- <xsl:when test="contains(normalize-space($fo_element), 'list')">
11103
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11104
+ <fo:list-item>
11105
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11106
+ <fo:block>
11107
+ <xsl:apply-templates select="*[local-name()='name']">
11108
+ <xsl:with-param name="fo_element">block</xsl:with-param>
11109
+ </xsl:apply-templates>
11110
+ </fo:block>
11111
+ </fo:list-item-label>
11112
+ <fo:list-item-body start-indent="body-start()">
11113
+ <fo:block>
11114
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11115
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11116
+ </xsl:apply-templates>
11117
+ </fo:block>
11118
+ </fo:list-item-body>
11119
+ </fo:list-item>
11120
+ </fo:list-block>
11121
+ </xsl:when> <!-- end list -->
10831
11122
 
10832
- <xsl:variable name="provisional_distance_between_starts_">
10833
- 7
10834
- </xsl:variable>
10835
- <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10836
- <xsl:variable name="indent_">
10837
- 0
10838
- </xsl:variable>
10839
- <xsl:variable name="indent" select="normalize-space($indent_)"/>
11123
+ <xsl:otherwise> <!-- inline -->
10840
11124
 
10841
- <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10842
- <fo:list-item>
10843
- <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
10844
- <fo:block>
10845
- <xsl:apply-templates select="*[local-name()='name']">
10846
- <xsl:with-param name="fo_element">block</xsl:with-param>
10847
- </xsl:apply-templates>
10848
- </fo:block>
10849
- </fo:list-item-label>
10850
- <fo:list-item-body start-indent="body-start()">
10851
- <fo:block>
10852
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11125
+ <!-- display 'EXAMPLE' and first element in the same line -->
11126
+ <fo:block>
11127
+ <xsl:apply-templates select="*[local-name()='name']">
11128
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11129
+ </xsl:apply-templates>
11130
+ <fo:inline>
11131
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
10853
11132
  <xsl:with-param name="fo_element" select="$fo_element"/>
10854
11133
  </xsl:apply-templates>
10855
- </fo:block>
10856
- </fo:list-item-body>
10857
- </fo:list-item>
10858
- </fo:list-block>
10859
- </xsl:when> <!-- end list -->
10860
-
10861
- <xsl:otherwise> <!-- inline -->
11134
+ </fo:inline>
11135
+ </fo:block>
10862
11136
 
10863
- <!-- display 'EXAMPLE' and first element in the same line -->
10864
- <fo:block>
10865
- <xsl:apply-templates select="*[local-name()='name']">
10866
- <xsl:with-param name="fo_element" select="$fo_element"/>
10867
- </xsl:apply-templates>
10868
- <fo:inline>
10869
- <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
10870
- <xsl:with-param name="fo_element" select="$fo_element"/>
10871
- </xsl:apply-templates>
10872
- </fo:inline>
10873
- </fo:block>
11137
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
11138
+ <!-- display further elements in blocks -->
11139
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11140
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11141
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
11142
+ <xsl:with-param name="fo_element" select="'block'"/>
11143
+ </xsl:apply-templates>
11144
+ </fo:block-container>
11145
+ </fo:block-container>
11146
+ </xsl:if>
11147
+ </xsl:otherwise> <!-- end inline -->
10874
11148
 
10875
- <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
10876
- <!-- display further elements in blocks -->
10877
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10878
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10879
- <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
10880
- <xsl:with-param name="fo_element" select="'block'"/>
10881
- </xsl:apply-templates>
10882
- </fo:block-container>
10883
- </fo:block-container>
10884
- </xsl:if>
10885
- </xsl:otherwise> <!-- end inline -->
11149
+ </xsl:choose>
11150
+ </fo:block-container>
11151
+ </fo:block-container>
10886
11152
 
10887
- </xsl:choose>
10888
- </fo:block-container>
10889
- </fo:block-container>
10890
11153
  </xsl:template>
10891
11154
 
10892
11155
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
@@ -10907,7 +11170,7 @@
10907
11170
  <xsl:otherwise>
10908
11171
  <fo:inline xsl:use-attribute-sets="example-name-style">
10909
11172
  <xsl:call-template name="refine_example-name-style"/>
10910
- <xsl:apply-templates/>:
11173
+ <xsl:apply-templates/>: <!-- $namespace = 'ieee', see https://github.com/metanorma/isodoc/issues/614 -->
10911
11174
  </fo:inline>
10912
11175
  </xsl:otherwise>
10913
11176
  </xsl:choose>
@@ -11089,15 +11352,17 @@
11089
11352
 
11090
11353
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11091
11354
  <fo:block role="BlockQuote">
11092
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
11355
+ <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 -->
11093
11356
  </fo:block>
11094
11357
  </fo:block-container>
11095
11358
  </fo:block-container>
11096
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
11359
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source'] or *[local-name() = 'attribution']">
11097
11360
  <fo:block xsl:use-attribute-sets="quote-source-style">
11098
11361
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
11099
11362
  <xsl:apply-templates select="*[local-name() = 'author']"/>
11100
11363
  <xsl:apply-templates select="*[local-name() = 'source']"/>
11364
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
11365
+ <xsl:apply-templates select="*[local-name() = 'attribution']/*[local-name() = 'p']/node()"/>
11101
11366
  </fo:block>
11102
11367
  </xsl:if>
11103
11368
 
@@ -11119,9 +11384,13 @@
11119
11384
  </xsl:template>
11120
11385
 
11121
11386
  <xsl:template match="*[local-name() = 'author']">
11122
- <xsl:text>— </xsl:text>
11387
+ <xsl:if test="local-name(..) = 'quote'"> <!-- for old Presentation XML, https://github.com/metanorma/isodoc/issues/607 -->
11388
+ <xsl:text>— </xsl:text>
11389
+ </xsl:if>
11123
11390
  <xsl:apply-templates/>
11124
11391
  </xsl:template>
11392
+
11393
+ <xsl:template match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
11125
11394
  <!-- ====== -->
11126
11395
  <!-- ====== -->
11127
11396
 
@@ -11261,6 +11530,13 @@
11261
11530
 
11262
11531
  </xsl:template> <!-- tab -->
11263
11532
 
11533
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
11534
+ <xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
11535
+
11536
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
11537
+
11538
+ </xsl:template>
11539
+
11264
11540
  <xsl:template name="insertNonBreakSpaces">
11265
11541
  <xsl:param name="count"/>
11266
11542
  <xsl:if test="$count &gt; 0">
@@ -11300,8 +11576,12 @@
11300
11576
  </xsl:template>
11301
11577
 
11302
11578
  <xsl:template match="*[local-name() = 'domain']">
11579
+ <!-- https://github.com/metanorma/isodoc/issues/607
11303
11580
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
11304
- <xsl:text> </xsl:text>
11581
+ <xsl:text> </xsl:text> -->
11582
+ <xsl:if test="not(@hidden = 'true')">
11583
+ <xsl:apply-templates/>
11584
+ </xsl:if>
11305
11585
  </xsl:template>
11306
11586
 
11307
11587
  <xsl:template match="*[local-name() = 'admitted']">
@@ -11349,6 +11629,29 @@
11349
11629
  <!-- END definition -->
11350
11630
  <!-- ========== -->
11351
11631
 
11632
+ <xsl:variable name="reviews_">
11633
+ <xsl:for-each select="//*[local-name() = 'review'][@from]">
11634
+ <xsl:copy>
11635
+ <xsl:copy-of select="@from"/>
11636
+ <xsl:copy-of select="@id"/>
11637
+ </xsl:copy>
11638
+ </xsl:for-each>
11639
+ </xsl:variable>
11640
+ <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
11641
+
11642
+ <xsl:template name="addReviewHelper">
11643
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11644
+ <xsl:variable name="curr_id" select="@id"/>
11645
+ <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
11646
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11647
+ <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>
11648
+ </xsl:if>
11649
+ <!-- <fo:block>
11650
+ <curr_id><xsl:value-of select="$curr_id"/></curr_id>
11651
+ <xsl:copy-of select="$reviews"/>
11652
+ </fo:block> -->
11653
+ </xsl:template>
11654
+
11352
11655
  <!-- main sections -->
11353
11656
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
11354
11657
 
@@ -11357,6 +11660,8 @@
11357
11660
 
11358
11661
  <xsl:call-template name="sections_element_style"/>
11359
11662
 
11663
+ <xsl:call-template name="addReviewHelper"/>
11664
+
11360
11665
  <xsl:apply-templates/>
11361
11666
  </fo:block>
11362
11667
 
@@ -11397,6 +11702,7 @@
11397
11702
 
11398
11703
  <fo:block>
11399
11704
  <xsl:call-template name="setId"/>
11705
+ <xsl:call-template name="addReviewHelper"/>
11400
11706
  <xsl:apply-templates/>
11401
11707
  </fo:block>
11402
11708
  </xsl:template>
@@ -11433,6 +11739,8 @@
11433
11739
 
11434
11740
  <xsl:call-template name="refine_clause_style"/>
11435
11741
 
11742
+ <xsl:call-template name="addReviewHelper"/>
11743
+
11436
11744
  <xsl:apply-templates/>
11437
11745
  </fo:block>
11438
11746
  </xsl:template>
@@ -11485,6 +11793,23 @@
11485
11793
 
11486
11794
  <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
11487
11795
 
11796
+ <xsl:if test="1 = 1">
11797
+ <xsl:choose>
11798
+ <!-- if there isn't the attribute '@from', then -->
11799
+ <xsl:when test="$id_from = ''">
11800
+ <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>
11801
+ </xsl:when>
11802
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11803
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
11804
+ <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>
11805
+ </xsl:when>
11806
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11807
+ <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>
11808
+ </xsl:when>
11809
+ </xsl:choose>
11810
+ </xsl:if>
11811
+
11812
+ <xsl:if test="1 = 2">
11488
11813
  <xsl:choose>
11489
11814
  <!-- if there isn't the attribute '@from', then -->
11490
11815
  <xsl:when test="$id_from = ''">
@@ -11498,6 +11823,7 @@
11498
11823
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
11499
11824
  </xsl:when>
11500
11825
  </xsl:choose>
11826
+ </xsl:if>
11501
11827
 
11502
11828
  </xsl:template>
11503
11829
 
@@ -12754,6 +13080,10 @@
12754
13080
  <!-- - Remove semantic xml part -->
12755
13081
  <!-- - Remove image/emf (EMF vector image for Word) -->
12756
13082
  <!-- - add @id, redundant for table auto-layout algorithm -->
13083
+ <!-- - process 'passthrough' element -->
13084
+ <!-- - split math by element with @linebreak into maths -->
13085
+ <!-- - rename fmt-title to title, fmt-name to name and another changes to convert new presentation XML to -->
13086
+ <!-- - old XML without significant changes in XSLT -->
12757
13087
  <!-- =========================================================================== -->
12758
13088
  <xsl:template match="@*|node()" mode="update_xml_step1">
12759
13089
  <xsl:copy>
@@ -12761,6 +13091,12 @@
12761
13091
  </xsl:copy>
12762
13092
  </xsl:template>
12763
13093
 
13094
+ <xsl:template match="@*|node()" mode="update_xml_pres">
13095
+ <xsl:copy>
13096
+ <xsl:apply-templates select="@*|node()" mode="update_xml_pres"/>
13097
+ </xsl:copy>
13098
+ </xsl:template>
13099
+
12764
13100
  <!-- change section's order based on @displayorder value -->
12765
13101
  <xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
12766
13102
  <xsl:copy>
@@ -12837,7 +13173,7 @@
12837
13173
  </xsl:template>
12838
13174
 
12839
13175
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
12840
- <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">
13176
+ <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">
12841
13177
  <xsl:copy>
12842
13178
  <xsl:copy-of select="@*"/>
12843
13179
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12856,14 +13192,17 @@
12856
13192
 
12857
13193
  <!-- remove semantic xml -->
12858
13194
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
13195
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_pres"/>
12859
13196
 
12860
13197
  <!-- remove image/emf -->
12861
13198
  <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
13199
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_pres"/>
12862
13200
 
12863
13201
  <!-- remove preprocess-xslt -->
12864
13202
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
13203
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
12865
13204
 
12866
- <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image'] | *[local-name() = 'sourcecode'] | *[local-name() = 'bibdata'] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
13205
+ <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">
12867
13206
  <xsl:copy-of select="."/>
12868
13207
  </xsl:template>
12869
13208
 
@@ -12929,6 +13268,93 @@
12929
13268
  </xsl:choose>
12930
13269
  </xsl:template>
12931
13270
 
13271
+ <xsl:variable name="regex_passthrough">.*\bpdf\b.*</xsl:variable>
13272
+ <xsl:template match="*[local-name() = 'passthrough']" mode="update_xml_step1">
13273
+ <!-- <xsl:if test="contains(@formats, ' pdf ')"> -->
13274
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@formats), $regex_passthrough)) = 'true'">
13275
+ <xsl:apply-templates mode="update_xml_step1"/>
13276
+ </xsl:if>
13277
+ </xsl:template>
13278
+
13279
+ <!-- split math by element with @linebreak into maths -->
13280
+ <xsl:template match="mathml:math[.//mathml:mo[@linebreak] or .//mathml:mspace[@linebreak]]" mode="update_xml_step1">
13281
+ <xsl:variable name="maths">
13282
+ <xsl:apply-templates select="." mode="mathml_linebreak"/>
13283
+ </xsl:variable>
13284
+ <xsl:copy-of select="$maths"/>
13285
+ </xsl:template>
13286
+
13287
+ <!-- update new Presentation XML -->
13288
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_step1"/>
13289
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_pres"/>
13290
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_step1"/>
13291
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
13292
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
13293
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
13294
+
13295
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
13296
+ <xsl:copy>
13297
+ <xsl:apply-templates select="@*" mode="update_xml_step1"/>
13298
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
13299
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
13300
+ </xsl:copy>
13301
+ </xsl:template>
13302
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_pres">
13303
+ <xsl:copy>
13304
+ <xsl:apply-templates select="@*" mode="update_xml_pres"/>
13305
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
13306
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
13307
+ </xsl:copy>
13308
+ </xsl:template>
13309
+
13310
+ <xsl:template match="*[local-name() = 'fmt-title']"/>
13311
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
13312
+ <xsl:element name="title" namespace="{$namespace_full}">
13313
+ <xsl:copy-of select="@*"/>
13314
+ <xsl:apply-templates mode="update_xml_step1"/>
13315
+ </xsl:element>
13316
+ </xsl:template>
13317
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
13318
+ <xsl:element name="title" namespace="{$namespace_full}">
13319
+ <xsl:copy-of select="@*"/>
13320
+ <xsl:apply-templates mode="update_xml_pres"/>
13321
+ </xsl:element>
13322
+ </xsl:template>
13323
+
13324
+ <xsl:template match="*[local-name() = 'fmt-name']"/>
13325
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
13326
+ <xsl:element name="name" namespace="{$namespace_full}">
13327
+ <xsl:copy-of select="@*"/>
13328
+ <xsl:apply-templates mode="update_xml_step1"/>
13329
+ </xsl:element>
13330
+ </xsl:template>
13331
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres">
13332
+ <xsl:element name="name" namespace="{$namespace_full}">
13333
+ <xsl:copy-of select="@*"/>
13334
+ <xsl:apply-templates mode="update_xml_pres"/>
13335
+ </xsl:element>
13336
+ </xsl:template>
13337
+
13338
+ <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">
13339
+ <xsl:apply-templates mode="update_xml_step1"/>
13340
+ </xsl:template>
13341
+ <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">
13342
+ <xsl:apply-templates mode="update_xml_pres"/>
13343
+ </xsl:template>
13344
+
13345
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_step1">
13346
+ <xsl:apply-templates mode="update_xml_step1"/>
13347
+ </xsl:template>
13348
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_pres">
13349
+ <xsl:apply-templates mode="update_xml_pres"/>
13350
+ </xsl:template>
13351
+
13352
+ <xsl:template match="*[local-name() = 'fmt-xref-label']"/>
13353
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_step1"/>
13354
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_pres"/>
13355
+
13356
+ <!-- END: update new Presentation XML -->
13357
+
12932
13358
  <!-- =========================================================================== -->
12933
13359
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12934
13360
  <!-- =========================================================================== -->
@@ -13032,6 +13458,8 @@
13032
13458
 
13033
13459
  <xsl:template name="insertOpeningElements">
13034
13460
  <xsl:param name="tree"/>
13461
+ <xsl:param name="xmlns"/>
13462
+ <xsl:param name="add_continue">true</xsl:param>
13035
13463
  <xsl:for-each select="$tree//element">
13036
13464
  <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
13037
13465
  <xsl:value-of select="."/>
@@ -13042,7 +13470,8 @@
13042
13470
  <xsl:value-of select="."/>
13043
13471
  <xsl:text>"</xsl:text>
13044
13472
  </xsl:for-each>
13045
- <xsl:if test="position() = 1"> continue="true"</xsl:if>
13473
+ <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
13474
+ <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
13046
13475
  <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
13047
13476
  <xsl:if test="$debug = 'true'">
13048
13477
  <xsl:message>&lt;<xsl:value-of select="."/>&gt;</xsl:message>
@@ -13118,7 +13547,7 @@
13118
13547
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
13119
13548
  <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>
13120
13549
 
13121
- <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">
13550
+ <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">
13122
13551
 
13123
13552
  <xsl:variable name="parent" select="local-name(..)"/>
13124
13553
 
@@ -13697,6 +14126,7 @@
13697
14126
  </pdf:catalog>
13698
14127
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
13699
14128
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14129
+ <!-- Commented after upgrade to Apache FOP 2.10
13700
14130
  <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="">
13701
14131
  <pdfaExtension:schemas>
13702
14132
  <rdf:Bag>
@@ -13729,7 +14159,7 @@
13729
14159
  </rdf:li>
13730
14160
  </rdf:Bag>
13731
14161
  </pdfaExtension:schemas>
13732
- </rdf:Description>
14162
+ </rdf:Description> -->
13733
14163
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
13734
14164
  <!-- Dublin Core properties go here -->
13735
14165
  <dc:title>
@@ -13776,7 +14206,7 @@
13776
14206
  <xsl:variable name="dc_description">
13777
14207
  <xsl:variable name="abstract">
13778
14208
 
13779
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
14209
+ <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'])]"/>
13780
14210
 
13781
14211
  </xsl:variable>
13782
14212
  <rdf:Alt>
@@ -14321,31 +14751,123 @@
14321
14751
 
14322
14752
  <!-- END: insert cover page image -->
14323
14753
 
14324
- <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
14754
+ <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
14755
+ <xsl:variable name="regex_ja_spec_">[
14756
+ <!-- Rotate 90° clockwise -->
14757
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14758
+ \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
14759
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14760
+ \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
14761
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14762
+ \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
14763
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14764
+ \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
14765
+ \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
14766
+ \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
14767
+ \u3010 <!-- U+3010 LEFT BLACK LENTICULAR BRACKET (【) -->
14768
+ \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
14769
+ \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
14770
+ \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
14771
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14772
+ \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
14773
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14774
+ \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
14775
+ \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
14776
+ \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
14777
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14778
+ \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
14779
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14780
+ \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
14781
+ \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
14782
+ \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
14783
+ \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
14784
+ \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
14785
+
14786
+ \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
14787
+ \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
14788
+ \u301C <!-- U+301C WAVE DASH (〜) -->
14789
+ \u3030 <!-- U+3030 WAVY DASH (〰 )-->
14790
+ \u30FC <!-- U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK (ー) -->
14791
+ \u2329 <!-- U+2329 LEFT-POINTING ANGLE BRACKET (〈) -->
14792
+ \u232A <!-- U+232A RIGHT-POINTING ANGLE BRACKET (〉) -->
14793
+ \u3018 <!-- U+3018 LEFT WHITE TORTOISE SHELL BRACKET (〘) -->
14794
+ \u3019 <!-- U+3019 RIGHT WHITE TORTOISE SHELL BRACKET (〙) -->
14795
+ \u30A0 <!-- U+30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN (゠) -->
14796
+ \uFE59 <!-- U+FE59 SMALL LEFT PARENTHESIS (﹙) -->
14797
+ \uFE5A <!-- U+FE5A SMALL RIGHT PARENTHESIS (﹚) -->
14798
+ \uFE5B <!-- U+FE5B SMALL LEFT CURLY BRACKET (﹛) -->
14799
+ \uFE5C <!-- U+FE5C SMALL RIGHT CURLY BRACKET (﹜) -->
14800
+ \uFE5D <!-- U+FE5D SMALL LEFT TORTOISE SHELL BRACKET (﹝) -->
14801
+ \uFE5E <!-- U+FE5E SMALL RIGHT TORTOISE SHELL BRACKET (﹞) -->
14802
+ \uFF5C <!-- U+FF5C FULLWIDTH VERTICAL LINE (|) -->
14803
+ \uFF5F <!-- U+FF5F FULLWIDTH LEFT WHITE PARENTHESIS (⦅) -->
14804
+ \uFF60 <!-- U+FF60 FULLWIDTH RIGHT WHITE PARENTHESIS (⦆) -->
14805
+ \uFFE3 <!-- U+FFE3 FULLWIDTH MACRON ( ̄) -->
14806
+ \uFF3F <!-- U+FF3F FULLWIDTH LOW LINE (_) -->
14807
+ \uFF5E <!-- U+FF5E FULLWIDTH TILDE (~) -->
14808
+ <!-- Rotate 180° -->
14809
+ \u309C <!-- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜) -->
14810
+ \u3002 <!-- U+3002 IDEOGRAPHIC FULL STOP (。) -->
14811
+ \uFE52 <!-- U+FE52 SMALL FULL STOP (﹒) -->
14812
+ \uFF0E <!-- U+FF0E FULLWIDTH FULL STOP (.) -->
14813
+ ]</xsl:variable>
14814
+ <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
14325
14815
  <xsl:template name="insertVerticalChar">
14326
14816
  <xsl:param name="str"/>
14327
14817
  <xsl:param name="writing-mode">lr-tb</xsl:param>
14328
14818
  <xsl:param name="reference-orientation">90</xsl:param>
14329
- <xsl:if test="string-length($str) &gt; 0">
14330
- <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">
14331
- <xsl:if test="normalize-space($writing-mode) != ''">
14332
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14333
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
14334
- </xsl:if>
14335
- <xsl:variable name="char" select="substring($str,1,1)"/>
14336
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14337
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
14819
+ <xsl:param name="add_zero_width_space">false</xsl:param>
14820
+ <xsl:choose>
14821
+ <xsl:when test="ancestor::*[local-name() = 'span'][@class = 'norotate']">
14822
+ <xsl:value-of select="$str"/>
14823
+ </xsl:when>
14824
+ <xsl:otherwise>
14825
+ <xsl:if test="string-length($str) &gt; 0">
14826
+ <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
14827
+ <xsl:variable name="char" select="substring($str,1,1)"/>
14828
+ <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">
14829
+ <xsl:if test="normalize-space($writing-mode) != ''">
14830
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14831
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14832
+ </xsl:if>
14833
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14834
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
14835
+ </xsl:if>
14836
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14837
+ <!-- Rotate 180°:
14838
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14839
+ U+3002 IDEOGRAPHIC FULL STOP (。)
14840
+ U+FE52 SMALL FULL STOP (﹒)
14841
+ U+FF0E FULLWIDTH FULL STOP (.)
14842
+ -->
14843
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14844
+ </xsl:if>
14845
+ <fo:block-container width="1em">
14846
+ <fo:block line-height="1em">
14847
+ <xsl:choose>
14848
+ <xsl:when test="$horizontal_mode = 'true'">
14849
+ <xsl:value-of select="$str"/>
14850
+ </xsl:when>
14851
+ <xsl:otherwise>
14852
+ <xsl:value-of select="$char"/>
14853
+ </xsl:otherwise>
14854
+ </xsl:choose>
14855
+ </fo:block>
14856
+ </fo:block-container>
14857
+ </fo:inline-container>
14858
+ <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>
14859
+
14860
+ <xsl:if test="$horizontal_mode = 'false'">
14861
+ <xsl:call-template name="insertVerticalChar">
14862
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14863
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
14864
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14865
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14866
+ </xsl:call-template>
14867
+ </xsl:if>
14338
14868
  </xsl:if>
14339
- <fo:block-container width="1em">
14340
- <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
14341
- </fo:block-container>
14342
- </fo:inline-container>
14343
- <xsl:call-template name="insertVerticalChar">
14344
- <xsl:with-param name="str" select="substring($str, 2)"/>
14345
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
14346
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14347
- </xsl:call-template>
14348
- </xsl:if>
14869
+ </xsl:otherwise>
14870
+ </xsl:choose>
14349
14871
  </xsl:template>
14350
14872
 
14351
14873
  <xsl:template name="number-to-words">