metanorma-itu 2.5.8 → 2.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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>
@@ -2778,7 +2778,7 @@
2778
2778
  </xsl:if>
2779
2779
  </xsl:template>
2780
2780
 
2781
- <xsl:strip-space elements="itu:xref"/>
2781
+ <!-- <xsl:strip-space elements="itu:xref"/> -->
2782
2782
 
2783
2783
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
2784
2784
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
@@ -3780,6 +3780,10 @@
3780
3780
 
3781
3781
  <xsl:template name="refine_termnote-name-style">
3782
3782
 
3783
+ <!-- <xsl:if test="$namespace = 'ieee'">
3784
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
3785
+ </xsl:if> -->
3786
+
3783
3787
  </xsl:template>
3784
3788
 
3785
3789
  <xsl:attribute-set name="termnote-p-style">
@@ -4466,9 +4470,21 @@
4466
4470
  <xsl:template name="processTables_Contents">
4467
4471
  <tables>
4468
4472
  <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
4469
- <table id="{@id}" alt-text="{*[local-name() = 'name']}">
4470
- <xsl:copy-of select="*[local-name() = 'name']"/>
4471
- </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>
4472
4488
  </xsl:for-each>
4473
4489
  </tables>
4474
4490
  </xsl:template>
@@ -4476,9 +4492,21 @@
4476
4492
  <xsl:template name="processFigures_Contents">
4477
4493
  <figures>
4478
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) != '']">
4479
- <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
4480
- <xsl:copy-of select="*[local-name() = 'name']"/>
4481
- </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>
4482
4510
  </xsl:for-each>
4483
4511
  </figures>
4484
4512
  </xsl:template>
@@ -9299,6 +9327,8 @@
9299
9327
 
9300
9328
  <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
9301
9329
 
9330
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab"/>
9331
+
9302
9332
  <xsl:call-template name="refine_note-name-style"/>
9303
9333
 
9304
9334
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -9359,10 +9389,6 @@
9359
9389
 
9360
9390
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
9361
9391
 
9362
- <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
9363
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
9364
- </xsl:if>
9365
-
9366
9392
  <xsl:call-template name="refine_termnote-name-style"/>
9367
9393
 
9368
9394
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -9509,17 +9535,29 @@
9509
9535
  <!-- Example: Dimensions in millimeters -->
9510
9536
  <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
9511
9537
 
9538
+ <xsl:variable name="show_figure_key_in_block_container">
9539
+ true
9540
+ </xsl:variable>
9541
+
9512
9542
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
9513
9543
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
9514
9544
  </fo:block>
9515
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9516
- <xsl:call-template name="note"/>
9517
- </xsl:for-each>
9518
- <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>
9519
9549
 
9520
9550
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
9521
9551
 
9522
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"/>
9523
9561
  </xsl:template>
9524
9562
 
9525
9563
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -9715,6 +9753,22 @@
9715
9753
  </xsl:if>
9716
9754
  </xsl:template>
9717
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
+
9718
9772
  <xsl:template name="getImageScale">
9719
9773
  <xsl:param name="indent"/>
9720
9774
  <xsl:variable name="indent_left">
@@ -9724,19 +9778,7 @@
9724
9778
  </xsl:choose>
9725
9779
  </xsl:variable>
9726
9780
  <xsl:variable name="img_src">
9727
- <xsl:choose>
9728
- <xsl:when test="not(starts-with(@src, 'data:'))">
9729
- <xsl:choose>
9730
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9731
- <xsl:value-of select="@src"/>
9732
- </xsl:when>
9733
- <xsl:otherwise>
9734
- <xsl:value-of select="concat($basepath, @src)"/>
9735
- </xsl:otherwise>
9736
- </xsl:choose>
9737
- </xsl:when>
9738
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9739
- </xsl:choose>
9781
+ <xsl:call-template name="getImageSrc"/>
9740
9782
  </xsl:variable>
9741
9783
 
9742
9784
  <xsl:variable name="image_width_effective">
@@ -9744,10 +9786,15 @@
9744
9786
  <xsl:value-of select="$width_effective - number($indent_left)"/>
9745
9787
 
9746
9788
  </xsl:variable>
9789
+ <xsl:variable name="image_height_effective" select="$height_effective - number($indent_left)"/>
9747
9790
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
9748
9791
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
9749
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> -->
9750
- <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>
9751
9798
  <xsl:value-of select="$scale"/>
9752
9799
  </xsl:template>
9753
9800
 
@@ -10300,20 +10347,48 @@
10300
10347
  <xsl:template match="*[local-name() = 'emf']"/>
10301
10348
 
10302
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">
10303
10359
  <xsl:apply-templates mode="contents"/>
10304
10360
  <xsl:text> </xsl:text>
10305
10361
  </xsl:template>
10306
10362
 
10307
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">
10308
10371
  <xsl:apply-templates mode="bookmarks"/>
10309
10372
  <xsl:text> </xsl:text>
10310
10373
  </xsl:template>
10311
10374
 
10312
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">
10313
10382
  <xsl:value-of select="."/>
10314
10383
  </xsl:template>
10315
10384
 
10316
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">
10317
10392
  <xsl:value-of select="."/>
10318
10393
  </xsl:template>
10319
10394
 
@@ -10334,7 +10409,7 @@
10334
10409
  </xsl:template>
10335
10410
 
10336
10411
  <!-- special case: ignore section-title if @depth different than @depth of parent clause, or @depth of parent clause = 1 -->
10337
- <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"/>
10338
10413
 
10339
10414
  <xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
10340
10415
  <xsl:variable name="level">
@@ -10346,6 +10421,9 @@
10346
10421
  <xsl:variable name="section">
10347
10422
  <xsl:choose>
10348
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>
10349
10427
  <xsl:otherwise>
10350
10428
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10351
10429
  </xsl:otherwise>
@@ -10368,6 +10446,19 @@
10368
10446
 
10369
10447
  <xsl:variable name="title">
10370
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>
10371
10462
  <xsl:when test="*[local-name() = 'tab']">
10372
10463
  <xsl:choose>
10373
10464
  <xsl:when test="@type = 'section-title'">
@@ -10403,7 +10494,7 @@
10403
10494
  <xsl:apply-templates mode="bookmarks"/>
10404
10495
  </xsl:template>
10405
10496
 
10406
- <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">
10407
10498
  <xsl:apply-templates select="."/>
10408
10499
  </xsl:template>
10409
10500
 
@@ -10416,6 +10507,10 @@
10416
10507
  <xsl:apply-templates mode="contents"/>
10417
10508
  </xsl:template>
10418
10509
 
10510
+ <xsl:template match="*[local-name() = 'semx']" mode="contents">
10511
+ <xsl:apply-templates mode="contents"/>
10512
+ </xsl:template>
10513
+
10419
10514
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
10420
10515
  <xsl:apply-templates mode="bookmarks"/>
10421
10516
  </xsl:template>
@@ -10425,9 +10520,14 @@
10425
10520
  <xsl:apply-templates mode="bookmarks"/>
10426
10521
  </xsl:template>
10427
10522
 
10523
+ <xsl:template match="*[local-name() = 'semx']" mode="bookmarks">
10524
+ <xsl:apply-templates mode="bookmarks"/>
10525
+ </xsl:template>
10526
+
10428
10527
  <!-- Bookmarks -->
10429
10528
  <xsl:template name="addBookmarks">
10430
10529
  <xsl:param name="contents"/>
10530
+ <xsl:param name="contents_addon"/>
10431
10531
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
10432
10532
  <xsl:if test="$contents_nodes//item">
10433
10533
  <fo:bookmark-tree>
@@ -10525,6 +10625,9 @@
10525
10625
  </xsl:otherwise>
10526
10626
  </xsl:choose>
10527
10627
 
10628
+ <!-- for $namespace = 'nist-sp' $namespace = 'ogc' $namespace = 'ogc-white-paper' -->
10629
+ <xsl:copy-of select="$contents_addon"/>
10630
+
10528
10631
  </fo:bookmark-tree>
10529
10632
  </xsl:if>
10530
10633
  </xsl:template>
@@ -10678,6 +10781,16 @@
10678
10781
  <!-- ====== -->
10679
10782
  <!-- ====== -->
10680
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">
10681
10794
  <xsl:param name="mode">bookmarks</xsl:param>
10682
10795
  <xsl:apply-templates mode="contents_item">
10683
10796
  <xsl:with-param name="mode" select="$mode"/>
@@ -10685,12 +10798,38 @@
10685
10798
  <!-- <xsl:text> </xsl:text> -->
10686
10799
  </xsl:template>
10687
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
+
10688
10811
  <xsl:template name="getSection">
10689
- <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>
10690
10823
  </xsl:template>
10691
10824
 
10692
10825
  <xsl:template name="getName">
10693
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>
10694
10833
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
10695
10834
  <xsl:copy-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/following-sibling::node()"/>
10696
10835
  </xsl:when>
@@ -10797,6 +10936,15 @@
10797
10936
  </xsl:template>
10798
10937
 
10799
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">
10800
10948
  <xsl:param name="mode">bookmarks</xsl:param>
10801
10949
  <xsl:apply-templates mode="contents_item">
10802
10950
  <xsl:with-param name="mode" select="$mode"/>
@@ -11635,107 +11783,108 @@
11635
11783
  -->
11636
11784
  <xsl:template match="*[local-name() = 'example']">
11637
11785
 
11638
- <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11639
-
11640
- <xsl:call-template name="setBlockSpanAll"/>
11786
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11641
11787
 
11642
- <xsl:call-template name="refine_example-style"/>
11788
+ <xsl:call-template name="setBlockSpanAll"/>
11643
11789
 
11644
- <xsl:variable name="fo_element">
11645
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11646
- block
11647
- </xsl:variable>
11790
+ <xsl:call-template name="refine_example-style"/>
11648
11791
 
11649
- <fo:block-container margin-left="0mm" role="SKIP">
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>
11650
11796
 
11651
- <xsl:choose>
11797
+ <fo:block-container margin-left="0mm" role="SKIP">
11652
11798
 
11653
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
11799
+ <xsl:choose>
11654
11800
 
11655
- <!-- display name 'EXAMPLE' in a separate block -->
11656
- <fo:block>
11657
- <xsl:apply-templates select="*[local-name()='name']">
11658
- <xsl:with-param name="fo_element" select="$fo_element"/>
11659
- </xsl:apply-templates>
11660
- </fo:block>
11801
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
11661
11802
 
11662
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11663
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11664
- <xsl:variable name="example_body">
11665
- <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']">
11666
11806
  <xsl:with-param name="fo_element" select="$fo_element"/>
11667
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
11668
11831
  </xsl:variable>
11669
- <xsl:choose>
11670
- <xsl:when test="xalan:nodeset($example_body)/*">
11671
- <xsl:copy-of select="$example_body"/>
11672
- </xsl:when>
11673
- <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
11674
- </xsl:choose>
11675
- </fo:block-container>
11676
- </fo:block-container>
11677
- </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_)"/>
11678
11837
 
11679
- <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 -->
11680
11857
 
11681
- <xsl:variable name="provisional_distance_between_starts_">
11682
- 7
11683
- </xsl:variable>
11684
- <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11685
- <xsl:variable name="indent_">
11686
- 0
11687
- </xsl:variable>
11688
- <xsl:variable name="indent" select="normalize-space($indent_)"/>
11858
+ <xsl:otherwise> <!-- inline -->
11689
11859
 
11690
- <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11691
- <fo:list-item>
11692
- <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11693
- <fo:block>
11694
- <xsl:apply-templates select="*[local-name()='name']">
11695
- <xsl:with-param name="fo_element">block</xsl:with-param>
11696
- </xsl:apply-templates>
11697
- </fo:block>
11698
- </fo:list-item-label>
11699
- <fo:list-item-body start-indent="body-start()">
11700
- <fo:block>
11701
- <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]">
11702
11867
  <xsl:with-param name="fo_element" select="$fo_element"/>
11703
11868
  </xsl:apply-templates>
11704
- </fo:block>
11705
- </fo:list-item-body>
11706
- </fo:list-item>
11707
- </fo:list-block>
11708
- </xsl:when> <!-- end list -->
11709
-
11710
- <xsl:otherwise> <!-- inline -->
11869
+ </fo:inline>
11870
+ </fo:block>
11711
11871
 
11712
- <!-- display 'EXAMPLE' and first element in the same line -->
11713
- <fo:block>
11714
- <xsl:apply-templates select="*[local-name()='name']">
11715
- <xsl:with-param name="fo_element" select="$fo_element"/>
11716
- </xsl:apply-templates>
11717
- <fo:inline>
11718
- <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
11719
- <xsl:with-param name="fo_element" select="$fo_element"/>
11720
- </xsl:apply-templates>
11721
- </fo:inline>
11722
- </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 -->
11723
11883
 
11724
- <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
11725
- <!-- display further elements in blocks -->
11726
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11727
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11728
- <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
11729
- <xsl:with-param name="fo_element" select="'block'"/>
11730
- </xsl:apply-templates>
11731
- </fo:block-container>
11732
- </fo:block-container>
11733
- </xsl:if>
11734
- </xsl:otherwise> <!-- end inline -->
11884
+ </xsl:choose>
11885
+ </fo:block-container>
11886
+ </fo:block-container>
11735
11887
 
11736
- </xsl:choose>
11737
- </fo:block-container>
11738
- </fo:block-container>
11739
11888
  </xsl:template>
11740
11889
 
11741
11890
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
@@ -12118,6 +12267,13 @@
12118
12267
 
12119
12268
  </xsl:template> <!-- tab -->
12120
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
+
12121
12277
  <xsl:template name="insertNonBreakSpaces">
12122
12278
  <xsl:param name="count"/>
12123
12279
  <xsl:if test="$count &gt; 0">
@@ -13691,6 +13847,10 @@
13691
13847
  <!-- - Remove semantic xml part -->
13692
13848
  <!-- - Remove image/emf (EMF vector image for Word) -->
13693
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 -->
13694
13854
  <!-- =========================================================================== -->
13695
13855
  <xsl:template match="@*|node()" mode="update_xml_step1">
13696
13856
  <xsl:copy>
@@ -13698,6 +13858,12 @@
13698
13858
  </xsl:copy>
13699
13859
  </xsl:template>
13700
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
+
13701
13867
  <!-- change section's order based on @displayorder value -->
13702
13868
  <xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
13703
13869
  <xsl:copy>
@@ -13774,7 +13940,7 @@
13774
13940
  </xsl:template>
13775
13941
 
13776
13942
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
13777
- <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">
13778
13944
  <xsl:copy>
13779
13945
  <xsl:copy-of select="@*"/>
13780
13946
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -13793,14 +13959,17 @@
13793
13959
 
13794
13960
  <!-- remove semantic xml -->
13795
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"/>
13796
13963
 
13797
13964
  <!-- remove image/emf -->
13798
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"/>
13799
13967
 
13800
13968
  <!-- remove preprocess-xslt -->
13801
13969
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
13970
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
13802
13971
 
13803
- <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'])] | *[local-name() = 'bibdata'][not(.//*[local-name() = 'passthrough'])] | *[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">
13804
13973
  <xsl:copy-of select="."/>
13805
13974
  </xsl:template>
13806
13975
 
@@ -13882,6 +14051,77 @@
13882
14051
  <xsl:copy-of select="$maths"/>
13883
14052
  </xsl:template>
13884
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
+
13885
14125
  <!-- =========================================================================== -->
13886
14126
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
13887
14127
  <!-- =========================================================================== -->
@@ -14074,7 +14314,7 @@
14074
14314
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
14075
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>
14076
14316
 
14077
- <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">
14078
14318
 
14079
14319
  <xsl:variable name="parent" select="local-name(..)"/>
14080
14320
 
@@ -14653,6 +14893,7 @@
14653
14893
  </pdf:catalog>
14654
14894
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14655
14895
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14896
+ <!-- Commented after upgrade to Apache FOP 2.10
14656
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="">
14657
14898
  <pdfaExtension:schemas>
14658
14899
  <rdf:Bag>
@@ -14685,7 +14926,7 @@
14685
14926
  </rdf:li>
14686
14927
  </rdf:Bag>
14687
14928
  </pdfaExtension:schemas>
14688
- </rdf:Description>
14929
+ </rdf:Description> -->
14689
14930
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
14690
14931
  <!-- Dublin Core properties go here -->
14691
14932
  <dc:title>
@@ -14732,7 +14973,7 @@
14732
14973
  <xsl:variable name="dc_description">
14733
14974
  <xsl:variable name="abstract">
14734
14975
 
14735
- <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'])]"/>
14736
14977
 
14737
14978
  </xsl:variable>
14738
14979
  <rdf:Alt>
@@ -15277,31 +15518,123 @@
15277
15518
 
15278
15519
  <!-- END: insert cover page image -->
15279
15520
 
15280
- <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>
15281
15582
  <xsl:template name="insertVerticalChar">
15282
15583
  <xsl:param name="str"/>
15283
15584
  <xsl:param name="writing-mode">lr-tb</xsl:param>
15284
15585
  <xsl:param name="reference-orientation">90</xsl:param>
15285
- <xsl:if test="string-length($str) &gt; 0">
15286
- <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">
15287
- <xsl:if test="normalize-space($writing-mode) != ''">
15288
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
15289
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
15290
- </xsl:if>
15291
- <xsl:variable name="char" select="substring($str,1,1)"/>
15292
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
15293
- <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>
15294
15635
  </xsl:if>
15295
- <fo:block-container width="1em">
15296
- <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
15297
- </fo:block-container>
15298
- </fo:inline-container>
15299
- <xsl:call-template name="insertVerticalChar">
15300
- <xsl:with-param name="str" select="substring($str, 2)"/>
15301
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
15302
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
15303
- </xsl:call-template>
15304
- </xsl:if>
15636
+ </xsl:otherwise>
15637
+ </xsl:choose>
15305
15638
  </xsl:template>
15306
15639
 
15307
15640
  <xsl:template name="number-to-words">