metanorma-itu 2.5.6 → 2.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/itu/base_convert.rb +12 -30
  3. data/lib/isodoc/itu/cleanup.rb +1 -1
  4. data/lib/isodoc/itu/i18n-ar.yaml +2 -2
  5. data/lib/isodoc/itu/i18n-de.yaml +2 -2
  6. data/lib/isodoc/itu/i18n-en.yaml +2 -2
  7. data/lib/isodoc/itu/i18n-es.yaml +2 -2
  8. data/lib/isodoc/itu/i18n-fr.yaml +2 -2
  9. data/lib/isodoc/itu/i18n-ru.yaml +2 -2
  10. data/lib/isodoc/itu/i18n-zh-Hans.yaml +2 -2
  11. data/lib/isodoc/itu/init.rb +2 -2
  12. data/lib/isodoc/itu/itu.implementers-guide.xsl +727 -196
  13. data/lib/isodoc/itu/itu.in-force.xsl +727 -196
  14. data/lib/isodoc/itu/itu.recommendation-annex.xsl +727 -196
  15. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +727 -196
  16. data/lib/isodoc/itu/itu.recommendation.xsl +727 -196
  17. data/lib/isodoc/itu/itu.resolution.xsl +727 -196
  18. data/lib/isodoc/itu/itu.service-publication.xsl +727 -196
  19. data/lib/isodoc/itu/itu.technical-paper.xsl +727 -196
  20. data/lib/isodoc/itu/itu.technical-report.xsl +727 -196
  21. data/lib/isodoc/itu/presentation_contribution.rb +1 -0
  22. data/lib/isodoc/itu/presentation_preface.rb +2 -1
  23. data/lib/isodoc/itu/presentation_ref.rb +29 -2
  24. data/lib/isodoc/itu/presentation_xml_convert.rb +85 -25
  25. data/lib/isodoc/itu/ref.rb +5 -33
  26. data/lib/isodoc/itu/terms.rb +4 -17
  27. data/lib/isodoc/itu/word_cleanup.rb +2 -2
  28. data/lib/isodoc/itu/word_convert.rb +5 -5
  29. data/lib/isodoc/itu/xref.rb +47 -17
  30. data/lib/isodoc/itu/xref_section.rb +42 -20
  31. data/lib/metanorma/itu/biblio.rng +13 -1
  32. data/lib/metanorma/itu/isodoc.rng +6 -6
  33. data/lib/metanorma/itu/version.rb +1 -1
  34. data/lib/nokogiri/xml.rb +10 -0
  35. data/metanorma-itu.gemspec +1 -1
  36. metadata +5 -4
@@ -1477,11 +1477,11 @@
1477
1477
  <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:copyright-statement"/>
1478
1478
  </fo:block>
1479
1479
 
1480
- <!-- <xsl:if test="$debug = 'true'">
1481
- <redirect:write file="contents_{java:getTime(java:java.util.Date.new())}.xml">
1480
+ <xsl:if test="$debug = 'true'">
1481
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
1482
1482
  <xsl:copy-of select="$contents"/>
1483
1483
  </redirect:write>
1484
- </xsl:if> -->
1484
+ </xsl:if>
1485
1485
 
1486
1486
  <xsl:apply-templates select="/*/*[local-name()='preface']//*[local-name() = 'clause'][@type = 'toc']">
1487
1487
  <xsl:with-param name="process">true</xsl:with-param>
@@ -1850,18 +1850,18 @@
1850
1850
  <!-- ============================= -->
1851
1851
 
1852
1852
  <!-- element with title -->
1853
- <xsl:template match="*[itu:title]" mode="contents">
1853
+ <xsl:template match="*[itu:title or itu:fmt-title]" mode="contents">
1854
1854
  <xsl:variable name="level">
1855
1855
  <xsl:call-template name="getLevel">
1856
- <xsl:with-param name="depth" select="itu:title/@depth"/>
1856
+ <xsl:with-param name="depth" select="itu:fmt-title/@depth | itu:title/@depth"/>
1857
1857
  </xsl:call-template>
1858
1858
  </xsl:variable>
1859
1859
 
1860
1860
  <xsl:variable name="section">
1861
- <!-- <xsl:call-template name="getSection"/> -->
1862
- <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
1861
+ <xsl:call-template name="getSection"/>
1862
+ <!-- <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
1863
1863
  <xsl:value-of select="."/>
1864
- </xsl:for-each>
1864
+ </xsl:for-each> -->
1865
1865
  </xsl:variable>
1866
1866
 
1867
1867
  <xsl:variable name="type">
@@ -1881,7 +1881,7 @@
1881
1881
  <xsl:when test="@type = 'toc'">true</xsl:when>
1882
1882
  <xsl:when test="ancestor-or-self::itu:bibitem">true</xsl:when>
1883
1883
  <xsl:when test="ancestor-or-self::itu:term">true</xsl:when>
1884
- <xsl:when test="@inline-header = 'true' and not(*[local-name() = 'title']/*[local-name() = 'tab'])">true</xsl:when>
1884
+ <xsl:when test="@inline-header = 'true' and not(*[local-name() = 'fmt-title']/*[local-name() = 'tab']) and not(*[local-name() = 'title']/*[local-name() = 'tab'])">true</xsl:when>
1885
1885
  <xsl:otherwise>false</xsl:otherwise>
1886
1886
  </xsl:choose>
1887
1887
  </xsl:variable>
@@ -1938,6 +1938,7 @@
1938
1938
  </xsl:choose>
1939
1939
  <fo:block>
1940
1940
  <xsl:call-template name="setId"/>
1941
+ <xsl:call-template name="addReviewHelper"/>
1941
1942
  <xsl:apply-templates/>
1942
1943
  </fo:block>
1943
1944
  </xsl:template>
@@ -2073,19 +2074,25 @@
2073
2074
  </fo:block>
2074
2075
  <xsl:if test="$doctype != 'resolution'">
2075
2076
  <fo:block font-size="12pt" font-weight="normal" margin-top="6pt">
2076
- <xsl:choose>
2077
+ <!-- <xsl:choose>
2077
2078
  <xsl:when test="parent::*[@obligation = 'informative']">
2078
2079
  <xsl:text>(This appendix does not form an integral part of this Recommendation.)</xsl:text>
2079
2080
  </xsl:when>
2080
2081
  <xsl:otherwise>
2081
2082
  <xsl:text>(This annex forms an integral part of this Recommendation.)</xsl:text>
2082
2083
  </xsl:otherwise>
2083
- </xsl:choose>
2084
+ </xsl:choose> -->
2085
+ <!-- Added for https://github.com/metanorma/isodoc/issues/614 -->
2086
+ <xsl:apply-templates select="following-sibling::itu:p[not(preceding-sibling::itu:clause)][starts-with(normalize-space(), '(')]/node()"/>
2084
2087
  </fo:block>
2085
2088
  </xsl:if>
2086
2089
  </fo:block>
2087
2090
  </xsl:template>
2088
2091
 
2092
+ <!-- Added for https://github.com/metanorma/isodoc/issues/614 -->
2093
+ <!-- renders in the annex/title template -->
2094
+ <xsl:template match="itu:annex/itu:p[preceding-sibling::*[1][self::itu:title or self::itu:variant-title]][starts-with(normalize-space(), '(')]" priority="3"/>
2095
+
2089
2096
  <!-- Bibliography -->
2090
2097
  <xsl:template match="itu:references[not(@normative='true')]/itu:title">
2091
2098
  <fo:block font-size="14pt" font-weight="bold" text-align="center" margin-bottom="18pt" role="H1">
@@ -2225,32 +2232,50 @@
2225
2232
  <xsl:call-template name="setStyle_preferred"/>
2226
2233
  <xsl:apply-templates/>
2227
2234
  </fo:inline>
2228
- <xsl:if test="../itu:termsource/itu:origin">
2229
- <xsl:text>: </xsl:text>
2235
+ <xsl:if test="../itu:termsource">
2236
+ <!-- https://github.com/metanorma/isodoc/issues/614 -->
2237
+ <!-- <xsl:text>: </xsl:text> -->
2238
+ <xsl:text> </xsl:text>
2230
2239
  <xsl:variable name="citeas" select="../itu:termsource/itu:origin/@citeas"/>
2231
2240
  <xsl:variable name="bibitemid" select="../itu:termsource/itu:origin/@bibitemid"/>
2232
2241
  <xsl:variable name="origin_text" select="normalize-space(../itu:termsource/itu:origin/text())"/>
2233
2242
 
2234
- <xsl:call-template name="insert_basic_link">
2235
- <xsl:with-param name="element">
2236
- <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
2237
- <xsl:choose>
2238
- <xsl:when test="$origin_text != ''">
2239
- <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
2240
- </xsl:when>
2241
- <xsl:when test="contains($citeas, '[')">
2242
- <xsl:text> </xsl:text><xsl:value-of select="$citeas"/> <!-- disable-output-escaping="yes" -->
2243
- </xsl:when>
2244
- <xsl:otherwise>
2245
- <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
2246
- </xsl:otherwise>
2247
- </xsl:choose>
2248
- </fo:basic-link>
2249
- </xsl:with-param>
2250
- </xsl:call-template>
2243
+ <xsl:choose>
2244
+ <xsl:when test="$origin_text != '' or $citeas != ''">
2245
+ <xsl:call-template name="insert_basic_link">
2246
+ <xsl:with-param name="element">
2247
+ <fo:basic-link internal-destination="{$bibitemid}" fox:alt-text="{$citeas}">
2248
+ <xsl:choose>
2249
+ <xsl:when test="$origin_text != ''">
2250
+ <xsl:text> </xsl:text><xsl:apply-templates select="../itu:termsource/itu:origin/node()"/>
2251
+ </xsl:when>
2252
+ <!-- https://github.com/metanorma/isodoc/issues/614 -->
2253
+ <!-- <xsl:when test="contains($citeas, '[')">
2254
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/>disable-output-escaping="yes"
2255
+ </xsl:when>
2256
+ <xsl:otherwise>
2257
+ <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
2258
+ </xsl:otherwise> -->
2259
+ <xsl:otherwise>
2260
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas"/>
2261
+ </xsl:otherwise>
2262
+ </xsl:choose>
2263
+ </fo:basic-link>
2264
+ </xsl:with-param>
2265
+ </xsl:call-template>
2266
+ </xsl:when>
2267
+ <xsl:otherwise>
2268
+ <xsl:apply-templates select="../itu:termsource">
2269
+ <xsl:with-param name="process">true</xsl:with-param>
2270
+ </xsl:apply-templates>
2271
+ </xsl:otherwise>
2272
+ </xsl:choose>
2251
2273
  </xsl:if>
2252
2274
  <xsl:if test="following-sibling::itu:definition/node()">
2253
- <xsl:text>: </xsl:text>
2275
+ <xsl:if test="../itu:termsource">
2276
+ <xsl:text>:</xsl:text>
2277
+ </xsl:if>
2278
+ <xsl:text> </xsl:text>
2254
2279
  <!-- <xsl:apply-templates select="following-sibling::itu:definition/node()" mode="process"/> -->
2255
2280
  <xsl:apply-templates select="following-sibling::itu:definition">
2256
2281
  <xsl:with-param name="process">true</xsl:with-param>
@@ -2262,7 +2287,12 @@
2262
2287
  </xsl:if> -->
2263
2288
  </xsl:template> <!-- preferred -->
2264
2289
 
2265
- <xsl:template match="itu:term[itu:preferred]/itu:termsource" priority="2"/>
2290
+ <xsl:template match="itu:term[itu:preferred]/itu:termsource" priority="2">
2291
+ <xsl:param name="process">false</xsl:param>
2292
+ <xsl:if test="$process = 'true'">
2293
+ <xsl:apply-templates/>
2294
+ </xsl:if>
2295
+ </xsl:template>
2266
2296
 
2267
2297
  <xsl:template match="itu:term[itu:preferred]/itu:definition" priority="2">
2268
2298
  <xsl:param name="process">false</xsl:param>
@@ -2748,7 +2778,7 @@
2748
2778
  </xsl:if>
2749
2779
  </xsl:template>
2750
2780
 
2751
- <xsl:strip-space elements="itu:xref"/>
2781
+ <!-- <xsl:strip-space elements="itu:xref"/> -->
2752
2782
 
2753
2783
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
2754
2784
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
@@ -3750,6 +3780,10 @@
3750
3780
 
3751
3781
  <xsl:template name="refine_termnote-name-style">
3752
3782
 
3783
+ <!-- <xsl:if test="$namespace = 'ieee'">
3784
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
3785
+ </xsl:if> -->
3786
+
3753
3787
  </xsl:template>
3754
3788
 
3755
3789
  <xsl:attribute-set name="termnote-p-style">
@@ -4436,9 +4470,21 @@
4436
4470
  <xsl:template name="processTables_Contents">
4437
4471
  <tables>
4438
4472
  <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
4439
- <table id="{@id}" alt-text="{*[local-name() = 'name']}">
4440
- <xsl:copy-of select="*[local-name() = 'name']"/>
4441
- </table>
4473
+ <xsl:choose>
4474
+ <xsl:when test="*[local-name() = 'fmt-name']">
4475
+ <xsl:variable name="fmt_name">
4476
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
4477
+ </xsl:variable>
4478
+ <table id="{@id}" alt-text="{normalize-space($fmt_name)}">
4479
+ <xsl:copy-of select="$fmt_name"/>
4480
+ </table>
4481
+ </xsl:when>
4482
+ <xsl:otherwise>
4483
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
4484
+ <xsl:copy-of select="*[local-name() = 'name']"/>
4485
+ </table>
4486
+ </xsl:otherwise>
4487
+ </xsl:choose>
4442
4488
  </xsl:for-each>
4443
4489
  </tables>
4444
4490
  </xsl:template>
@@ -4446,9 +4492,21 @@
4446
4492
  <xsl:template name="processFigures_Contents">
4447
4493
  <figures>
4448
4494
  <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) != '']">
4449
- <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
4450
- <xsl:copy-of select="*[local-name() = 'name']"/>
4451
- </figure>
4495
+ <xsl:choose>
4496
+ <xsl:when test="*[local-name() = 'fmt-name']">
4497
+ <xsl:variable name="fmt_name">
4498
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
4499
+ </xsl:variable>
4500
+ <figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
4501
+ <xsl:copy-of select="$fmt_name"/>
4502
+ </figure>
4503
+ </xsl:when>
4504
+ <xsl:otherwise>
4505
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
4506
+ <xsl:copy-of select="*[local-name() = 'name']"/>
4507
+ </figure>
4508
+ </xsl:otherwise>
4509
+ </xsl:choose>
4452
4510
  </xsl:for-each>
4453
4511
  </figures>
4454
4512
  </xsl:template>
@@ -6296,7 +6354,10 @@
6296
6354
 
6297
6355
  <xsl:value-of select="@reference"/>
6298
6356
 
6357
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
6358
+ <!-- <xsl:if test="$namespace = 'itu'">
6299
6359
  <xsl:text>)</xsl:text>
6360
+ </xsl:if> -->
6300
6361
 
6301
6362
  </fo:inline>
6302
6363
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
@@ -6307,7 +6368,7 @@
6307
6368
 
6308
6369
  </xsl:if>
6309
6370
  </xsl:for-each>
6310
- </xsl:template>
6371
+ </xsl:template> <!-- table_fn_display -->
6311
6372
 
6312
6373
  <xsl:template name="create_fn">
6313
6374
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -6339,8 +6400,10 @@
6339
6400
  <!-- EMD table's footnotes rendering -->
6340
6401
  <!-- ============================ -->
6341
6402
 
6403
+ <!-- ============================ -->
6342
6404
  <!-- figure's footnotes rendering -->
6343
- <xsl:template name="fn_display_figure">
6405
+ <!-- ============================ -->
6406
+ <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
6344
6407
 
6345
6408
  <!-- current figure id -->
6346
6409
  <xsl:variable name="figure_id_">
@@ -6453,9 +6516,28 @@
6453
6516
 
6454
6517
  </fo:block>
6455
6518
  </xsl:if>
6456
-
6457
6519
  </xsl:template> <!-- fn_display_figure -->
6458
6520
 
6521
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
6522
+ <!-- figure's footnote label -->
6523
+ <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">
6524
+ <xsl:variable name="key_iso">
6525
+
6526
+ </xsl:variable>
6527
+ <xsl:if test="normalize-space($key_iso) = 'true'">
6528
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
6529
+
6530
+ </xsl:if>
6531
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
6532
+ <!-- <xsl:value-of select="@reference"/> -->
6533
+ <xsl:apply-templates/>
6534
+ </fo:inline>
6535
+ </xsl:template>
6536
+
6537
+ <!-- ============================ -->
6538
+ <!-- END: figure's footnotes rendering -->
6539
+ <!-- ============================ -->
6540
+
6459
6541
  <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
6460
6542
  <xsl:template match="*[local-name()='fn']">
6461
6543
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
@@ -6471,6 +6553,10 @@
6471
6553
 
6472
6554
  <xsl:value-of select="@reference"/>
6473
6555
 
6556
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
6557
+ <!-- <xsl:if test="$namespace = 'jis'">
6558
+ <fo:inline font-weight="normal">)</fo:inline>
6559
+ </xsl:if> -->
6474
6560
  </fo:basic-link>
6475
6561
  </fo:inline>
6476
6562
  </xsl:template>
@@ -6631,17 +6717,22 @@
6631
6717
  </fo:block>
6632
6718
  </xsl:when> <!-- END: a few components -->
6633
6719
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
6634
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
6720
+ <!-- Presentation XML contains 'Key' caption, https://github.com/metanorma/isodoc/issues/607 -->
6721
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'p' and @keep-with-next])"> <!-- for old Presentation XML -->
6635
6722
 
6636
- <xsl:call-template name="refine_figure_key_style"/>
6723
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
6637
6724
 
6638
- <xsl:variable name="title-key">
6639
- <xsl:call-template name="getLocalizedString">
6640
- <xsl:with-param name="key">key</xsl:with-param>
6641
- </xsl:call-template>
6642
- </xsl:variable>
6643
- <xsl:value-of select="$title-key"/>
6644
- </fo:block>
6725
+ <xsl:call-template name="refine_figure_key_style"/>
6726
+
6727
+ <xsl:variable name="title-key">
6728
+ <xsl:call-template name="getLocalizedString">
6729
+ <xsl:with-param name="key">key</xsl:with-param>
6730
+ </xsl:call-template>
6731
+ </xsl:variable>
6732
+ <xsl:value-of select="$title-key"/>
6733
+ </fo:block>
6734
+
6735
+ </xsl:if>
6645
6736
  </xsl:when> <!-- END: definition list in a figure -->
6646
6737
  </xsl:choose>
6647
6738
 
@@ -6827,6 +6918,14 @@
6827
6918
 
6828
6919
  </xsl:template> <!-- END: dl -->
6829
6920
 
6921
+ <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
6922
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
6923
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
6924
+ <xsl:call-template name="refine_figure_key_style"/>
6925
+ <xsl:apply-templates/>
6926
+ </fo:block>
6927
+ </xsl:template>
6928
+
6830
6929
  <xsl:template name="refine_dl_formula_where_style">
6831
6930
 
6832
6931
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -8869,6 +8968,39 @@
8869
8968
  </xsl:copy>
8870
8969
  </xsl:template>
8871
8970
 
8971
+ <xsl:template match="@*|node()" mode="mathml_linebreak">
8972
+ <xsl:copy>
8973
+ <xsl:apply-templates select="@*|node()" mode="mathml_linebreak"/>
8974
+ </xsl:copy>
8975
+ </xsl:template>
8976
+
8977
+ <!-- split math into two math -->
8978
+ <xsl:template match="mathml:mo[@linebreak] | mathml:mspace[@linebreak]" mode="mathml_linebreak">
8979
+ <xsl:variable name="math_elements_tree_">
8980
+ <xsl:for-each select="ancestor::*[ancestor-or-self::mathml:math]">
8981
+ <element pos="{position()}">
8982
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
8983
+ <xsl:value-of select="name()"/>
8984
+ </element>
8985
+ </xsl:for-each>
8986
+ </xsl:variable>
8987
+
8988
+ <xsl:variable name="math_elements_tree" select="xalan:nodeset($math_elements_tree_)"/>
8989
+
8990
+ <xsl:call-template name="insertClosingElements">
8991
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
8992
+ </xsl:call-template>
8993
+
8994
+ <xsl:element name="br" namespace="{$namespace_full}"/>
8995
+
8996
+ <xsl:call-template name="insertOpeningElements">
8997
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
8998
+ <xsl:with-param name="xmlns">http://www.w3.org/1998/Math/MathML</xsl:with-param>
8999
+ <xsl:with-param name="add_continue">false</xsl:with-param>
9000
+ </xsl:call-template>
9001
+
9002
+ </xsl:template>
9003
+
8872
9004
  <!-- Examples:
8873
9005
  <stem type="AsciiMath">x = 1</stem>
8874
9006
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -9120,9 +9252,11 @@
9120
9252
  </xsl:template>
9121
9253
 
9122
9254
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
9255
+ <!-- https://github.com/metanorma/isodoc/issues/607
9123
9256
  <xsl:if test="normalize-space() != ''">
9124
- <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
9125
- </xsl:if>
9257
+ <xsl:text>(</xsl:text><xsl:apply-templates /><xsl:text>)</xsl:text>
9258
+ </xsl:if> -->
9259
+ <xsl:apply-templates/>
9126
9260
  </xsl:template>
9127
9261
 
9128
9262
  <!-- stem inside formula with name (with formula's number) -->
@@ -9193,6 +9327,8 @@
9193
9327
 
9194
9328
  <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
9195
9329
 
9330
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab"/>
9331
+
9196
9332
  <xsl:call-template name="refine_note-name-style"/>
9197
9333
 
9198
9334
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -9253,10 +9389,6 @@
9253
9389
 
9254
9390
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
9255
9391
 
9256
- <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
9257
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
9258
- </xsl:if>
9259
-
9260
9392
  <xsl:call-template name="refine_termnote-name-style"/>
9261
9393
 
9262
9394
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -9282,8 +9414,17 @@
9282
9414
  </xsl:when>
9283
9415
  <xsl:otherwise>
9284
9416
 
9285
- <xsl:text> </xsl:text>
9417
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
9418
+ <!-- <xsl:if test="$namespace = 'ieee'">
9419
+ <xsl:text>—</xsl:text> em dash &#x2014;
9420
+ </xsl:if> -->
9421
+ <!-- <xsl:if test="$namespace = 'iho' or $namespace = 'gb' or $namespace = 'm3d' or $namespace = 'unece-rec' or $namespace = 'unece' or $namespace = 'rsd'">
9422
+ <xsl:text>:</xsl:text>
9423
+ </xsl:if> -->
9286
9424
 
9425
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp'">
9426
+ <xsl:text> – </xsl:text> en dash &#x2013;
9427
+ </xsl:if> -->
9287
9428
  </xsl:otherwise>
9288
9429
  </xsl:choose>
9289
9430
  </xsl:variable>
@@ -9302,8 +9443,16 @@
9302
9443
  </xsl:when>
9303
9444
  <xsl:otherwise>
9304
9445
 
9305
- <xsl:text> </xsl:text>
9306
-
9446
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
9447
+ <!-- <xsl:if test="$namespace = 'ieee'">
9448
+ <xsl:text>—</xsl:text> em dash &#x2014;
9449
+ </xsl:if> -->
9450
+ <!-- <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'">
9451
+ <xsl:text>:</xsl:text>
9452
+ </xsl:if> -->
9453
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'unece-rec' or $namespace = 'unece'">
9454
+ <xsl:text> – </xsl:text> en dash &#x2013;
9455
+ </xsl:if> -->
9307
9456
  </xsl:otherwise>
9308
9457
  </xsl:choose>
9309
9458
  </xsl:variable>
@@ -9386,17 +9535,29 @@
9386
9535
  <!-- Example: Dimensions in millimeters -->
9387
9536
  <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
9388
9537
 
9538
+ <xsl:variable name="show_figure_key_in_block_container">
9539
+ true
9540
+ </xsl:variable>
9541
+
9389
9542
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
9390
9543
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
9391
9544
  </fo:block>
9392
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9393
- <xsl:call-template name="note"/>
9394
- </xsl:for-each>
9395
- <xsl:call-template name="fn_display_figure"/>
9545
+
9546
+ <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
9547
+ <xsl:call-template name="showFigureKey"/>
9548
+ </xsl:if>
9396
9549
 
9397
9550
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
9398
9551
 
9399
9552
  </fo:block-container>
9553
+
9554
+ </xsl:template>
9555
+
9556
+ <xsl:template name="showFigureKey">
9557
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9558
+ <xsl:call-template name="note"/>
9559
+ </xsl:for-each>
9560
+ <xsl:call-template name="fn_display_figure"/>
9400
9561
  </xsl:template>
9401
9562
 
9402
9563
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -9592,6 +9753,22 @@
9592
9753
  </xsl:if>
9593
9754
  </xsl:template>
9594
9755
 
9756
+ <xsl:template name="getImageSrc">
9757
+ <xsl:choose>
9758
+ <xsl:when test="not(starts-with(@src, 'data:'))">
9759
+ <xsl:choose>
9760
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9761
+ <xsl:value-of select="@src"/>
9762
+ </xsl:when>
9763
+ <xsl:otherwise>
9764
+ <xsl:value-of select="concat($basepath, @src)"/>
9765
+ </xsl:otherwise>
9766
+ </xsl:choose>
9767
+ </xsl:when>
9768
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9769
+ </xsl:choose>
9770
+ </xsl:template>
9771
+
9595
9772
  <xsl:template name="getImageScale">
9596
9773
  <xsl:param name="indent"/>
9597
9774
  <xsl:variable name="indent_left">
@@ -9601,19 +9778,7 @@
9601
9778
  </xsl:choose>
9602
9779
  </xsl:variable>
9603
9780
  <xsl:variable name="img_src">
9604
- <xsl:choose>
9605
- <xsl:when test="not(starts-with(@src, 'data:'))">
9606
- <xsl:choose>
9607
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9608
- <xsl:value-of select="@src"/>
9609
- </xsl:when>
9610
- <xsl:otherwise>
9611
- <xsl:value-of select="concat($basepath, @src)"/>
9612
- </xsl:otherwise>
9613
- </xsl:choose>
9614
- </xsl:when>
9615
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9616
- </xsl:choose>
9781
+ <xsl:call-template name="getImageSrc"/>
9617
9782
  </xsl:variable>
9618
9783
 
9619
9784
  <xsl:variable name="image_width_effective">
@@ -9621,10 +9786,15 @@
9621
9786
  <xsl:value-of select="$width_effective - number($indent_left)"/>
9622
9787
 
9623
9788
  </xsl:variable>
9789
+ <xsl:variable name="image_height_effective" select="$height_effective - number($indent_left)"/>
9624
9790
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
9625
9791
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
9626
9792
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
9627
- <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9793
+ <xsl:variable name="scale">
9794
+
9795
+ <xsl:value-of select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9796
+
9797
+ </xsl:variable>
9628
9798
  <xsl:value-of select="$scale"/>
9629
9799
  </xsl:template>
9630
9800
 
@@ -10177,20 +10347,48 @@
10177
10347
  <xsl:template match="*[local-name() = 'emf']"/>
10178
10348
 
10179
10349
  <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">
10350
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
10351
+ <xsl:apply-templates mode="contents"/>
10352
+ <xsl:text> </xsl:text>
10353
+ </xsl:if>
10354
+ </xsl:template>
10355
+
10356
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="contents"/>
10357
+
10358
+ <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">
10180
10359
  <xsl:apply-templates mode="contents"/>
10181
10360
  <xsl:text> </xsl:text>
10182
10361
  </xsl:template>
10183
10362
 
10184
10363
  <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">
10364
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
10365
+ <xsl:apply-templates mode="bookmarks"/>
10366
+ <xsl:text> </xsl:text>
10367
+ </xsl:if>
10368
+ </xsl:template>
10369
+
10370
+ <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">
10185
10371
  <xsl:apply-templates mode="bookmarks"/>
10186
10372
  <xsl:text> </xsl:text>
10187
10373
  </xsl:template>
10188
10374
 
10189
10375
  <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">
10376
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
10377
+ <xsl:value-of select="."/>
10378
+ </xsl:if>
10379
+ </xsl:template>
10380
+
10381
+ <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">
10190
10382
  <xsl:value-of select="."/>
10191
10383
  </xsl:template>
10192
10384
 
10193
10385
  <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">
10386
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
10387
+ <xsl:value-of select="."/>
10388
+ </xsl:if>
10389
+ </xsl:template>
10390
+
10391
+ <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">
10194
10392
  <xsl:value-of select="."/>
10195
10393
  </xsl:template>
10196
10394
 
@@ -10211,7 +10409,7 @@
10211
10409
  </xsl:template>
10212
10410
 
10213
10411
  <!-- special case: ignore section-title if @depth different than @depth of parent clause, or @depth of parent clause = 1 -->
10214
- <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"/>
10412
+ <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"/>
10215
10413
 
10216
10414
  <xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
10217
10415
  <xsl:variable name="level">
@@ -10223,6 +10421,9 @@
10223
10421
  <xsl:variable name="section">
10224
10422
  <xsl:choose>
10225
10423
  <xsl:when test="@type = 'section-title'"/>
10424
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
10425
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
10426
+ </xsl:when>
10226
10427
  <xsl:otherwise>
10227
10428
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10228
10429
  </xsl:otherwise>
@@ -10245,6 +10446,19 @@
10245
10446
 
10246
10447
  <xsl:variable name="title">
10247
10448
  <xsl:choose>
10449
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/770 -->
10450
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
10451
+ <xsl:choose>
10452
+ <xsl:when test="@type = 'section-title'">
10453
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
10454
+ <xsl:text>: </xsl:text>
10455
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
10456
+ </xsl:when>
10457
+ <xsl:otherwise>
10458
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
10459
+ </xsl:otherwise>
10460
+ </xsl:choose>
10461
+ </xsl:when>
10248
10462
  <xsl:when test="*[local-name() = 'tab']">
10249
10463
  <xsl:choose>
10250
10464
  <xsl:when test="@type = 'section-title'">
@@ -10280,7 +10494,7 @@
10280
10494
  <xsl:apply-templates mode="bookmarks"/>
10281
10495
  </xsl:template>
10282
10496
 
10283
- <xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
10497
+ <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">
10284
10498
  <xsl:apply-templates select="."/>
10285
10499
  </xsl:template>
10286
10500
 
@@ -10293,6 +10507,10 @@
10293
10507
  <xsl:apply-templates mode="contents"/>
10294
10508
  </xsl:template>
10295
10509
 
10510
+ <xsl:template match="*[local-name() = 'semx']" mode="contents">
10511
+ <xsl:apply-templates mode="contents"/>
10512
+ </xsl:template>
10513
+
10296
10514
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
10297
10515
  <xsl:apply-templates mode="bookmarks"/>
10298
10516
  </xsl:template>
@@ -10302,9 +10520,14 @@
10302
10520
  <xsl:apply-templates mode="bookmarks"/>
10303
10521
  </xsl:template>
10304
10522
 
10523
+ <xsl:template match="*[local-name() = 'semx']" mode="bookmarks">
10524
+ <xsl:apply-templates mode="bookmarks"/>
10525
+ </xsl:template>
10526
+
10305
10527
  <!-- Bookmarks -->
10306
10528
  <xsl:template name="addBookmarks">
10307
10529
  <xsl:param name="contents"/>
10530
+ <xsl:param name="contents_addon"/>
10308
10531
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
10309
10532
  <xsl:if test="$contents_nodes//item">
10310
10533
  <fo:bookmark-tree>
@@ -10402,6 +10625,9 @@
10402
10625
  </xsl:otherwise>
10403
10626
  </xsl:choose>
10404
10627
 
10628
+ <!-- for $namespace = 'nist-sp' $namespace = 'ogc' $namespace = 'ogc-white-paper' -->
10629
+ <xsl:copy-of select="$contents_addon"/>
10630
+
10405
10631
  </fo:bookmark-tree>
10406
10632
  </xsl:if>
10407
10633
  </xsl:template>
@@ -10555,6 +10781,16 @@
10555
10781
  <!-- ====== -->
10556
10782
  <!-- ====== -->
10557
10783
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
10784
+ <xsl:param name="mode">bookmarks</xsl:param>
10785
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-title'])">
10786
+ <xsl:apply-templates mode="contents_item">
10787
+ <xsl:with-param name="mode" select="$mode"/>
10788
+ </xsl:apply-templates>
10789
+ <!-- <xsl:text> </xsl:text> -->
10790
+ </xsl:if>
10791
+ </xsl:template>
10792
+
10793
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="contents_item">
10558
10794
  <xsl:param name="mode">bookmarks</xsl:param>
10559
10795
  <xsl:apply-templates mode="contents_item">
10560
10796
  <xsl:with-param name="mode" select="$mode"/>
@@ -10562,12 +10798,38 @@
10562
10798
  <!-- <xsl:text> </xsl:text> -->
10563
10799
  </xsl:template>
10564
10800
 
10801
+ <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">
10802
+ <xsl:apply-templates mode="contents_item"/>
10803
+ </xsl:template>
10804
+
10805
+ <xsl:template match="*[local-name() = 'semx']" mode="contents_item">
10806
+ <xsl:apply-templates mode="contents_item"/>
10807
+ </xsl:template>
10808
+
10809
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="contents_item"/>
10810
+
10565
10811
  <xsl:template name="getSection">
10566
- <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10812
+ <xsl:choose>
10813
+ <xsl:when test="*[local-name() = 'fmt-title']">
10814
+ <xsl:variable name="fmt_title_section">
10815
+ <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')]"/>
10816
+ </xsl:variable>
10817
+ <xsl:value-of select="normalize-space($fmt_title_section)"/>
10818
+ </xsl:when>
10819
+ <xsl:otherwise>
10820
+ <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10821
+ </xsl:otherwise>
10822
+ </xsl:choose>
10567
10823
  </xsl:template>
10568
10824
 
10569
10825
  <xsl:template name="getName">
10570
10826
  <xsl:choose>
10827
+ <xsl:when test="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']]">
10828
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/following-sibling::node()"/>
10829
+ </xsl:when>
10830
+ <xsl:when test="*[local-name() = 'fmt-title']">
10831
+ <xsl:copy-of select="*[local-name() = 'fmt-title']/node()"/>
10832
+ </xsl:when>
10571
10833
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
10572
10834
  <xsl:copy-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/following-sibling::node()"/>
10573
10835
  </xsl:when>
@@ -10674,6 +10936,15 @@
10674
10936
  </xsl:template>
10675
10937
 
10676
10938
  <xsl:template match="*[local-name() = 'name']" mode="contents_item">
10939
+ <xsl:param name="mode">bookmarks</xsl:param>
10940
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
10941
+ <xsl:apply-templates mode="contents_item">
10942
+ <xsl:with-param name="mode" select="$mode"/>
10943
+ </xsl:apply-templates>
10944
+ </xsl:if>
10945
+ </xsl:template>
10946
+
10947
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="contents_item">
10677
10948
  <xsl:param name="mode">bookmarks</xsl:param>
10678
10949
  <xsl:apply-templates mode="contents_item">
10679
10950
  <xsl:with-param name="mode" select="$mode"/>
@@ -11471,7 +11742,7 @@
11471
11742
  <xsl:if test="normalize-space() != ''">
11472
11743
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
11473
11744
  <xsl:call-template name="refine_termexample-name-style"/>
11474
- <xsl:apply-templates/>
11745
+ <xsl:apply-templates/> <!-- commented $namespace = 'ieee', https://github.com/metanorma/isodoc/issues/614-->
11475
11746
  </fo:inline>
11476
11747
  </xsl:if>
11477
11748
  </xsl:template>
@@ -11512,107 +11783,108 @@
11512
11783
  -->
11513
11784
  <xsl:template match="*[local-name() = 'example']">
11514
11785
 
11515
- <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11786
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11516
11787
 
11517
- <xsl:call-template name="setBlockSpanAll"/>
11788
+ <xsl:call-template name="setBlockSpanAll"/>
11518
11789
 
11519
- <xsl:call-template name="refine_example-style"/>
11790
+ <xsl:call-template name="refine_example-style"/>
11520
11791
 
11521
- <xsl:variable name="fo_element">
11522
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11523
- block
11524
- </xsl:variable>
11792
+ <xsl:variable name="fo_element">
11793
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11794
+ block
11795
+ </xsl:variable>
11525
11796
 
11526
- <fo:block-container margin-left="0mm" role="SKIP">
11797
+ <fo:block-container margin-left="0mm" role="SKIP">
11527
11798
 
11528
- <xsl:choose>
11799
+ <xsl:choose>
11529
11800
 
11530
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
11801
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
11531
11802
 
11532
- <!-- display name 'EXAMPLE' in a separate block -->
11533
- <fo:block>
11534
- <xsl:apply-templates select="*[local-name()='name']">
11535
- <xsl:with-param name="fo_element" select="$fo_element"/>
11536
- </xsl:apply-templates>
11537
- </fo:block>
11538
-
11539
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11540
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11541
- <xsl:variable name="example_body">
11542
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11803
+ <!-- display name 'EXAMPLE' in a separate block -->
11804
+ <fo:block>
11805
+ <xsl:apply-templates select="*[local-name()='name']">
11543
11806
  <xsl:with-param name="fo_element" select="$fo_element"/>
11544
11807
  </xsl:apply-templates>
11808
+ </fo:block>
11809
+
11810
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11811
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11812
+ <xsl:variable name="example_body">
11813
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11814
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11815
+ </xsl:apply-templates>
11816
+ </xsl:variable>
11817
+ <xsl:choose>
11818
+ <xsl:when test="xalan:nodeset($example_body)/*">
11819
+ <xsl:copy-of select="$example_body"/>
11820
+ </xsl:when>
11821
+ <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
11822
+ </xsl:choose>
11823
+ </fo:block-container>
11824
+ </fo:block-container>
11825
+ </xsl:when> <!-- end block -->
11826
+
11827
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
11828
+
11829
+ <xsl:variable name="provisional_distance_between_starts_">
11830
+ 7
11545
11831
  </xsl:variable>
11546
- <xsl:choose>
11547
- <xsl:when test="xalan:nodeset($example_body)/*">
11548
- <xsl:copy-of select="$example_body"/>
11549
- </xsl:when>
11550
- <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
11551
- </xsl:choose>
11552
- </fo:block-container>
11553
- </fo:block-container>
11554
- </xsl:when> <!-- end block -->
11832
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11833
+ <xsl:variable name="indent_">
11834
+ 0
11835
+ </xsl:variable>
11836
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
11555
11837
 
11556
- <xsl:when test="contains(normalize-space($fo_element), 'list')">
11838
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11839
+ <fo:list-item>
11840
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11841
+ <fo:block>
11842
+ <xsl:apply-templates select="*[local-name()='name']">
11843
+ <xsl:with-param name="fo_element">block</xsl:with-param>
11844
+ </xsl:apply-templates>
11845
+ </fo:block>
11846
+ </fo:list-item-label>
11847
+ <fo:list-item-body start-indent="body-start()">
11848
+ <fo:block>
11849
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11850
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11851
+ </xsl:apply-templates>
11852
+ </fo:block>
11853
+ </fo:list-item-body>
11854
+ </fo:list-item>
11855
+ </fo:list-block>
11856
+ </xsl:when> <!-- end list -->
11557
11857
 
11558
- <xsl:variable name="provisional_distance_between_starts_">
11559
- 7
11560
- </xsl:variable>
11561
- <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11562
- <xsl:variable name="indent_">
11563
- 0
11564
- </xsl:variable>
11565
- <xsl:variable name="indent" select="normalize-space($indent_)"/>
11858
+ <xsl:otherwise> <!-- inline -->
11566
11859
 
11567
- <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11568
- <fo:list-item>
11569
- <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11570
- <fo:block>
11571
- <xsl:apply-templates select="*[local-name()='name']">
11572
- <xsl:with-param name="fo_element">block</xsl:with-param>
11573
- </xsl:apply-templates>
11574
- </fo:block>
11575
- </fo:list-item-label>
11576
- <fo:list-item-body start-indent="body-start()">
11577
- <fo:block>
11578
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11860
+ <!-- display 'EXAMPLE' and first element in the same line -->
11861
+ <fo:block>
11862
+ <xsl:apply-templates select="*[local-name()='name']">
11863
+ <xsl:with-param name="fo_element" select="$fo_element"/>
11864
+ </xsl:apply-templates>
11865
+ <fo:inline>
11866
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
11579
11867
  <xsl:with-param name="fo_element" select="$fo_element"/>
11580
11868
  </xsl:apply-templates>
11581
- </fo:block>
11582
- </fo:list-item-body>
11583
- </fo:list-item>
11584
- </fo:list-block>
11585
- </xsl:when> <!-- end list -->
11586
-
11587
- <xsl:otherwise> <!-- inline -->
11869
+ </fo:inline>
11870
+ </fo:block>
11588
11871
 
11589
- <!-- display 'EXAMPLE' and first element in the same line -->
11590
- <fo:block>
11591
- <xsl:apply-templates select="*[local-name()='name']">
11592
- <xsl:with-param name="fo_element" select="$fo_element"/>
11593
- </xsl:apply-templates>
11594
- <fo:inline>
11595
- <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
11596
- <xsl:with-param name="fo_element" select="$fo_element"/>
11597
- </xsl:apply-templates>
11598
- </fo:inline>
11599
- </fo:block>
11872
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
11873
+ <!-- display further elements in blocks -->
11874
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11875
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11876
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
11877
+ <xsl:with-param name="fo_element" select="'block'"/>
11878
+ </xsl:apply-templates>
11879
+ </fo:block-container>
11880
+ </fo:block-container>
11881
+ </xsl:if>
11882
+ </xsl:otherwise> <!-- end inline -->
11600
11883
 
11601
- <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
11602
- <!-- display further elements in blocks -->
11603
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11604
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11605
- <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
11606
- <xsl:with-param name="fo_element" select="'block'"/>
11607
- </xsl:apply-templates>
11608
- </fo:block-container>
11609
- </fo:block-container>
11610
- </xsl:if>
11611
- </xsl:otherwise> <!-- end inline -->
11884
+ </xsl:choose>
11885
+ </fo:block-container>
11886
+ </fo:block-container>
11612
11887
 
11613
- </xsl:choose>
11614
- </fo:block-container>
11615
- </fo:block-container>
11616
11888
  </xsl:template>
11617
11889
 
11618
11890
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
@@ -11633,7 +11905,7 @@
11633
11905
  <xsl:otherwise>
11634
11906
  <fo:inline xsl:use-attribute-sets="example-name-style">
11635
11907
  <xsl:call-template name="refine_example-name-style"/>
11636
- <xsl:apply-templates/>
11908
+ <xsl:apply-templates/> <!-- $namespace = 'ieee', see https://github.com/metanorma/isodoc/issues/614 -->
11637
11909
  </fo:inline>
11638
11910
  </xsl:otherwise>
11639
11911
  </xsl:choose>
@@ -11815,15 +12087,17 @@
11815
12087
 
11816
12088
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11817
12089
  <fo:block role="BlockQuote">
11818
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
12090
+ <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 -->
11819
12091
  </fo:block>
11820
12092
  </fo:block-container>
11821
12093
  </fo:block-container>
11822
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
12094
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source'] or *[local-name() = 'attribution']">
11823
12095
  <fo:block xsl:use-attribute-sets="quote-source-style">
11824
12096
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
11825
12097
  <xsl:apply-templates select="*[local-name() = 'author']"/>
11826
12098
  <xsl:apply-templates select="*[local-name() = 'source']"/>
12099
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
12100
+ <xsl:apply-templates select="*[local-name() = 'attribution']/*[local-name() = 'p']/node()"/>
11827
12101
  </fo:block>
11828
12102
  </xsl:if>
11829
12103
 
@@ -11845,9 +12119,13 @@
11845
12119
  </xsl:template>
11846
12120
 
11847
12121
  <xsl:template match="*[local-name() = 'author']">
11848
- <xsl:text>— </xsl:text>
12122
+ <xsl:if test="local-name(..) = 'quote'"> <!-- for old Presentation XML, https://github.com/metanorma/isodoc/issues/607 -->
12123
+ <xsl:text>— </xsl:text>
12124
+ </xsl:if>
11849
12125
  <xsl:apply-templates/>
11850
12126
  </xsl:template>
12127
+
12128
+ <xsl:template match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
11851
12129
  <!-- ====== -->
11852
12130
  <!-- ====== -->
11853
12131
 
@@ -11989,6 +12267,13 @@
11989
12267
 
11990
12268
  </xsl:template> <!-- tab -->
11991
12269
 
12270
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
12271
+ <xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
12272
+
12273
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
12274
+
12275
+ </xsl:template>
12276
+
11992
12277
  <xsl:template name="insertNonBreakSpaces">
11993
12278
  <xsl:param name="count"/>
11994
12279
  <xsl:if test="$count &gt; 0">
@@ -12028,8 +12313,12 @@
12028
12313
  </xsl:template>
12029
12314
 
12030
12315
  <xsl:template match="*[local-name() = 'domain']">
12316
+ <!-- https://github.com/metanorma/isodoc/issues/607
12031
12317
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
12032
- <xsl:text> </xsl:text>
12318
+ <xsl:text> </xsl:text> -->
12319
+ <xsl:if test="not(@hidden = 'true')">
12320
+ <xsl:apply-templates/>
12321
+ </xsl:if>
12033
12322
  </xsl:template>
12034
12323
 
12035
12324
  <xsl:template match="*[local-name() = 'admitted']">
@@ -12077,6 +12366,29 @@
12077
12366
  <!-- END definition -->
12078
12367
  <!-- ========== -->
12079
12368
 
12369
+ <xsl:variable name="reviews_">
12370
+ <xsl:for-each select="//*[local-name() = 'review'][@from]">
12371
+ <xsl:copy>
12372
+ <xsl:copy-of select="@from"/>
12373
+ <xsl:copy-of select="@id"/>
12374
+ </xsl:copy>
12375
+ </xsl:for-each>
12376
+ </xsl:variable>
12377
+ <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
12378
+
12379
+ <xsl:template name="addReviewHelper">
12380
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
12381
+ <xsl:variable name="curr_id" select="@id"/>
12382
+ <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
12383
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
12384
+ <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>
12385
+ </xsl:if>
12386
+ <!-- <fo:block>
12387
+ <curr_id><xsl:value-of select="$curr_id"/></curr_id>
12388
+ <xsl:copy-of select="$reviews"/>
12389
+ </fo:block> -->
12390
+ </xsl:template>
12391
+
12080
12392
  <!-- main sections -->
12081
12393
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
12082
12394
 
@@ -12085,6 +12397,8 @@
12085
12397
 
12086
12398
  <xsl:call-template name="sections_element_style"/>
12087
12399
 
12400
+ <xsl:call-template name="addReviewHelper"/>
12401
+
12088
12402
  <xsl:apply-templates/>
12089
12403
  </fo:block>
12090
12404
 
@@ -12127,6 +12441,7 @@
12127
12441
 
12128
12442
  <fo:block>
12129
12443
  <xsl:call-template name="setId"/>
12444
+ <xsl:call-template name="addReviewHelper"/>
12130
12445
  <xsl:apply-templates/>
12131
12446
  </fo:block>
12132
12447
  </xsl:template>
@@ -12163,6 +12478,8 @@
12163
12478
 
12164
12479
  <xsl:call-template name="refine_clause_style"/>
12165
12480
 
12481
+ <xsl:call-template name="addReviewHelper"/>
12482
+
12166
12483
  <xsl:apply-templates/>
12167
12484
  </fo:block>
12168
12485
  </xsl:template>
@@ -12219,6 +12536,23 @@
12219
12536
 
12220
12537
  <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
12221
12538
 
12539
+ <xsl:if test="1 = 1">
12540
+ <xsl:choose>
12541
+ <!-- if there isn't the attribute '@from', then -->
12542
+ <xsl:when test="$id_from = ''">
12543
+ <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>
12544
+ </xsl:when>
12545
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
12546
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12547
+ <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>
12548
+ </xsl:when>
12549
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12550
+ <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>
12551
+ </xsl:when>
12552
+ </xsl:choose>
12553
+ </xsl:if>
12554
+
12555
+ <xsl:if test="1 = 2">
12222
12556
  <xsl:choose>
12223
12557
  <!-- if there isn't the attribute '@from', then -->
12224
12558
  <xsl:when test="$id_from = ''">
@@ -12232,6 +12566,7 @@
12232
12566
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12233
12567
  </xsl:when>
12234
12568
  </xsl:choose>
12569
+ </xsl:if>
12235
12570
 
12236
12571
  </xsl:template>
12237
12572
 
@@ -13512,6 +13847,10 @@
13512
13847
  <!-- - Remove semantic xml part -->
13513
13848
  <!-- - Remove image/emf (EMF vector image for Word) -->
13514
13849
  <!-- - add @id, redundant for table auto-layout algorithm -->
13850
+ <!-- - process 'passthrough' element -->
13851
+ <!-- - split math by element with @linebreak into maths -->
13852
+ <!-- - rename fmt-title to title, fmt-name to name and another changes to convert new presentation XML to -->
13853
+ <!-- - old XML without significant changes in XSLT -->
13515
13854
  <!-- =========================================================================== -->
13516
13855
  <xsl:template match="@*|node()" mode="update_xml_step1">
13517
13856
  <xsl:copy>
@@ -13519,6 +13858,12 @@
13519
13858
  </xsl:copy>
13520
13859
  </xsl:template>
13521
13860
 
13861
+ <xsl:template match="@*|node()" mode="update_xml_pres">
13862
+ <xsl:copy>
13863
+ <xsl:apply-templates select="@*|node()" mode="update_xml_pres"/>
13864
+ </xsl:copy>
13865
+ </xsl:template>
13866
+
13522
13867
  <!-- change section's order based on @displayorder value -->
13523
13868
  <xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
13524
13869
  <xsl:copy>
@@ -13595,7 +13940,7 @@
13595
13940
  </xsl:template>
13596
13941
 
13597
13942
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
13598
- <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">
13943
+ <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">
13599
13944
  <xsl:copy>
13600
13945
  <xsl:copy-of select="@*"/>
13601
13946
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -13614,14 +13959,17 @@
13614
13959
 
13615
13960
  <!-- remove semantic xml -->
13616
13961
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
13962
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_pres"/>
13617
13963
 
13618
13964
  <!-- remove image/emf -->
13619
13965
  <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
13966
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_pres"/>
13620
13967
 
13621
13968
  <!-- remove preprocess-xslt -->
13622
13969
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
13970
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
13623
13971
 
13624
- <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image'] | *[local-name() = 'sourcecode'] | *[local-name() = 'bibdata'] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
13972
+ <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">
13625
13973
  <xsl:copy-of select="."/>
13626
13974
  </xsl:template>
13627
13975
 
@@ -13687,6 +14035,93 @@
13687
14035
  </xsl:choose>
13688
14036
  </xsl:template>
13689
14037
 
14038
+ <xsl:variable name="regex_passthrough">.*\bpdf\b.*</xsl:variable>
14039
+ <xsl:template match="*[local-name() = 'passthrough']" mode="update_xml_step1">
14040
+ <!-- <xsl:if test="contains(@formats, ' pdf ')"> -->
14041
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@formats), $regex_passthrough)) = 'true'">
14042
+ <xsl:apply-templates mode="update_xml_step1"/>
14043
+ </xsl:if>
14044
+ </xsl:template>
14045
+
14046
+ <!-- split math by element with @linebreak into maths -->
14047
+ <xsl:template match="mathml:math[.//mathml:mo[@linebreak] or .//mathml:mspace[@linebreak]]" mode="update_xml_step1">
14048
+ <xsl:variable name="maths">
14049
+ <xsl:apply-templates select="." mode="mathml_linebreak"/>
14050
+ </xsl:variable>
14051
+ <xsl:copy-of select="$maths"/>
14052
+ </xsl:template>
14053
+
14054
+ <!-- update new Presentation XML -->
14055
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_step1"/>
14056
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_pres"/>
14057
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_step1"/>
14058
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
14059
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
14060
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
14061
+
14062
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
14063
+ <xsl:copy>
14064
+ <xsl:apply-templates select="@*" mode="update_xml_step1"/>
14065
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
14066
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
14067
+ </xsl:copy>
14068
+ </xsl:template>
14069
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_pres">
14070
+ <xsl:copy>
14071
+ <xsl:apply-templates select="@*" mode="update_xml_pres"/>
14072
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
14073
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
14074
+ </xsl:copy>
14075
+ </xsl:template>
14076
+
14077
+ <xsl:template match="*[local-name() = 'fmt-title']"/>
14078
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
14079
+ <xsl:element name="title" namespace="{$namespace_full}">
14080
+ <xsl:copy-of select="@*"/>
14081
+ <xsl:apply-templates mode="update_xml_step1"/>
14082
+ </xsl:element>
14083
+ </xsl:template>
14084
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
14085
+ <xsl:element name="title" namespace="{$namespace_full}">
14086
+ <xsl:copy-of select="@*"/>
14087
+ <xsl:apply-templates mode="update_xml_pres"/>
14088
+ </xsl:element>
14089
+ </xsl:template>
14090
+
14091
+ <xsl:template match="*[local-name() = 'fmt-name']"/>
14092
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
14093
+ <xsl:element name="name" namespace="{$namespace_full}">
14094
+ <xsl:copy-of select="@*"/>
14095
+ <xsl:apply-templates mode="update_xml_step1"/>
14096
+ </xsl:element>
14097
+ </xsl:template>
14098
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres">
14099
+ <xsl:element name="name" namespace="{$namespace_full}">
14100
+ <xsl:copy-of select="@*"/>
14101
+ <xsl:apply-templates mode="update_xml_pres"/>
14102
+ </xsl:element>
14103
+ </xsl:template>
14104
+
14105
+ <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">
14106
+ <xsl:apply-templates mode="update_xml_step1"/>
14107
+ </xsl:template>
14108
+ <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">
14109
+ <xsl:apply-templates mode="update_xml_pres"/>
14110
+ </xsl:template>
14111
+
14112
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_step1">
14113
+ <xsl:apply-templates mode="update_xml_step1"/>
14114
+ </xsl:template>
14115
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_pres">
14116
+ <xsl:apply-templates mode="update_xml_pres"/>
14117
+ </xsl:template>
14118
+
14119
+ <xsl:template match="*[local-name() = 'fmt-xref-label']"/>
14120
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_step1"/>
14121
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_pres"/>
14122
+
14123
+ <!-- END: update new Presentation XML -->
14124
+
13690
14125
  <!-- =========================================================================== -->
13691
14126
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
13692
14127
  <!-- =========================================================================== -->
@@ -13790,6 +14225,8 @@
13790
14225
 
13791
14226
  <xsl:template name="insertOpeningElements">
13792
14227
  <xsl:param name="tree"/>
14228
+ <xsl:param name="xmlns"/>
14229
+ <xsl:param name="add_continue">true</xsl:param>
13793
14230
  <xsl:for-each select="$tree//element">
13794
14231
  <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
13795
14232
  <xsl:value-of select="."/>
@@ -13800,7 +14237,8 @@
13800
14237
  <xsl:value-of select="."/>
13801
14238
  <xsl:text>"</xsl:text>
13802
14239
  </xsl:for-each>
13803
- <xsl:if test="position() = 1"> continue="true"</xsl:if>
14240
+ <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
14241
+ <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
13804
14242
  <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
13805
14243
  <xsl:if test="$debug = 'true'">
13806
14244
  <xsl:message>&lt;<xsl:value-of select="."/>&gt;</xsl:message>
@@ -13876,7 +14314,7 @@
13876
14314
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
13877
14315
  <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>
13878
14316
 
13879
- <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">
14317
+ <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">
13880
14318
 
13881
14319
  <xsl:variable name="parent" select="local-name(..)"/>
13882
14320
 
@@ -14455,6 +14893,7 @@
14455
14893
  </pdf:catalog>
14456
14894
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14457
14895
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14896
+ <!-- Commented after upgrade to Apache FOP 2.10
14458
14897
  <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="">
14459
14898
  <pdfaExtension:schemas>
14460
14899
  <rdf:Bag>
@@ -14487,7 +14926,7 @@
14487
14926
  </rdf:li>
14488
14927
  </rdf:Bag>
14489
14928
  </pdfaExtension:schemas>
14490
- </rdf:Description>
14929
+ </rdf:Description> -->
14491
14930
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
14492
14931
  <!-- Dublin Core properties go here -->
14493
14932
  <dc:title>
@@ -14534,7 +14973,7 @@
14534
14973
  <xsl:variable name="dc_description">
14535
14974
  <xsl:variable name="abstract">
14536
14975
 
14537
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
14976
+ <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'])]"/>
14538
14977
 
14539
14978
  </xsl:variable>
14540
14979
  <rdf:Alt>
@@ -15079,31 +15518,123 @@
15079
15518
 
15080
15519
  <!-- END: insert cover page image -->
15081
15520
 
15082
- <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
15521
+ <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
15522
+ <xsl:variable name="regex_ja_spec_">[
15523
+ <!-- Rotate 90° clockwise -->
15524
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
15525
+ \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
15526
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
15527
+ \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
15528
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
15529
+ \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
15530
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
15531
+ \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
15532
+ \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
15533
+ \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
15534
+ \u3010 <!-- U+3010 LEFT BLACK LENTICULAR BRACKET (【) -->
15535
+ \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
15536
+ \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
15537
+ \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
15538
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
15539
+ \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
15540
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
15541
+ \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
15542
+ \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
15543
+ \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
15544
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
15545
+ \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
15546
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
15547
+ \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
15548
+ \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
15549
+ \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
15550
+ \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
15551
+ \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
15552
+
15553
+ \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
15554
+ \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
15555
+ \u301C <!-- U+301C WAVE DASH (〜) -->
15556
+ \u3030 <!-- U+3030 WAVY DASH (〰 )-->
15557
+ \u30FC <!-- U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK (ー) -->
15558
+ \u2329 <!-- U+2329 LEFT-POINTING ANGLE BRACKET (〈) -->
15559
+ \u232A <!-- U+232A RIGHT-POINTING ANGLE BRACKET (〉) -->
15560
+ \u3018 <!-- U+3018 LEFT WHITE TORTOISE SHELL BRACKET (〘) -->
15561
+ \u3019 <!-- U+3019 RIGHT WHITE TORTOISE SHELL BRACKET (〙) -->
15562
+ \u30A0 <!-- U+30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN (゠) -->
15563
+ \uFE59 <!-- U+FE59 SMALL LEFT PARENTHESIS (﹙) -->
15564
+ \uFE5A <!-- U+FE5A SMALL RIGHT PARENTHESIS (﹚) -->
15565
+ \uFE5B <!-- U+FE5B SMALL LEFT CURLY BRACKET (﹛) -->
15566
+ \uFE5C <!-- U+FE5C SMALL RIGHT CURLY BRACKET (﹜) -->
15567
+ \uFE5D <!-- U+FE5D SMALL LEFT TORTOISE SHELL BRACKET (﹝) -->
15568
+ \uFE5E <!-- U+FE5E SMALL RIGHT TORTOISE SHELL BRACKET (﹞) -->
15569
+ \uFF5C <!-- U+FF5C FULLWIDTH VERTICAL LINE (|) -->
15570
+ \uFF5F <!-- U+FF5F FULLWIDTH LEFT WHITE PARENTHESIS (⦅) -->
15571
+ \uFF60 <!-- U+FF60 FULLWIDTH RIGHT WHITE PARENTHESIS (⦆) -->
15572
+ \uFFE3 <!-- U+FFE3 FULLWIDTH MACRON ( ̄) -->
15573
+ \uFF3F <!-- U+FF3F FULLWIDTH LOW LINE (_) -->
15574
+ \uFF5E <!-- U+FF5E FULLWIDTH TILDE (~) -->
15575
+ <!-- Rotate 180° -->
15576
+ \u309C <!-- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜) -->
15577
+ \u3002 <!-- U+3002 IDEOGRAPHIC FULL STOP (。) -->
15578
+ \uFE52 <!-- U+FE52 SMALL FULL STOP (﹒) -->
15579
+ \uFF0E <!-- U+FF0E FULLWIDTH FULL STOP (.) -->
15580
+ ]</xsl:variable>
15581
+ <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
15083
15582
  <xsl:template name="insertVerticalChar">
15084
15583
  <xsl:param name="str"/>
15085
15584
  <xsl:param name="writing-mode">lr-tb</xsl:param>
15086
15585
  <xsl:param name="reference-orientation">90</xsl:param>
15087
- <xsl:if test="string-length($str) &gt; 0">
15088
- <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">
15089
- <xsl:if test="normalize-space($writing-mode) != ''">
15090
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
15091
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
15092
- </xsl:if>
15093
- <xsl:variable name="char" select="substring($str,1,1)"/>
15094
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
15095
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
15586
+ <xsl:param name="add_zero_width_space">false</xsl:param>
15587
+ <xsl:choose>
15588
+ <xsl:when test="ancestor::*[local-name() = 'span'][@class = 'norotate']">
15589
+ <xsl:value-of select="$str"/>
15590
+ </xsl:when>
15591
+ <xsl:otherwise>
15592
+ <xsl:if test="string-length($str) &gt; 0">
15593
+ <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
15594
+ <xsl:variable name="char" select="substring($str,1,1)"/>
15595
+ <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">
15596
+ <xsl:if test="normalize-space($writing-mode) != ''">
15597
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
15598
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
15599
+ </xsl:if>
15600
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
15601
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
15602
+ </xsl:if>
15603
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
15604
+ <!-- Rotate 180°:
15605
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
15606
+ U+3002 IDEOGRAPHIC FULL STOP (。)
15607
+ U+FE52 SMALL FULL STOP (﹒)
15608
+ U+FF0E FULLWIDTH FULL STOP (.)
15609
+ -->
15610
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
15611
+ </xsl:if>
15612
+ <fo:block-container width="1em">
15613
+ <fo:block line-height="1em">
15614
+ <xsl:choose>
15615
+ <xsl:when test="$horizontal_mode = 'true'">
15616
+ <xsl:value-of select="$str"/>
15617
+ </xsl:when>
15618
+ <xsl:otherwise>
15619
+ <xsl:value-of select="$char"/>
15620
+ </xsl:otherwise>
15621
+ </xsl:choose>
15622
+ </fo:block>
15623
+ </fo:block-container>
15624
+ </fo:inline-container>
15625
+ <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>
15626
+
15627
+ <xsl:if test="$horizontal_mode = 'false'">
15628
+ <xsl:call-template name="insertVerticalChar">
15629
+ <xsl:with-param name="str" select="substring($str, 2)"/>
15630
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
15631
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
15632
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
15633
+ </xsl:call-template>
15634
+ </xsl:if>
15096
15635
  </xsl:if>
15097
- <fo:block-container width="1em">
15098
- <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
15099
- </fo:block-container>
15100
- </fo:inline-container>
15101
- <xsl:call-template name="insertVerticalChar">
15102
- <xsl:with-param name="str" select="substring($str, 2)"/>
15103
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
15104
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
15105
- </xsl:call-template>
15106
- </xsl:if>
15636
+ </xsl:otherwise>
15637
+ </xsl:choose>
15107
15638
  </xsl:template>
15108
15639
 
15109
15640
  <xsl:template name="number-to-words">