metanorma-bipm 2.5.6 → 2.5.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -396,9 +396,11 @@
396
396
  <xsl:with-param name="contents" select="$contents"/>
397
397
  </xsl:call-template>
398
398
 
399
- <!-- <contents>
400
- <xsl:copy-of select="$contents"/>
401
- </contents> -->
399
+ <xsl:if test="$debug = 'true'">
400
+ <redirect:write file="contents_.xml">
401
+ <xsl:copy-of select="$contents"/>
402
+ </redirect:write>
403
+ </xsl:if>
402
404
 
403
405
  <xsl:choose>
404
406
 
@@ -429,9 +431,16 @@
429
431
  <xsl:apply-templates select="." mode="title_eref"/>
430
432
  </xsl:variable> -->
431
433
 
434
+ <xsl:variable name="update_xml_pres">
435
+ <xsl:apply-templates mode="update_xml_pres"/>
436
+ </xsl:variable>
437
+
438
+ <xsl:message>START flatxml_</xsl:message>
439
+ <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
432
440
  <xsl:variable name="flatxml__">
433
441
  <!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
434
- <xsl:apply-templates select="." mode="flatxml"/>
442
+ <!-- <xsl:apply-templates select="." mode="flatxml"/> -->
443
+ <xsl:apply-templates select="xalan:nodeset($update_xml_pres)" mode="flatxml"/>
435
444
  </xsl:variable>
436
445
  <!-- save flatxml into the file and reload it -->
437
446
  <xsl:variable name="updated_flatxml_filename" select="concat($output_path,'_flatxml_', java:getTime(java:java.util.Date.new()), '.xml')"/>
@@ -467,9 +476,14 @@
467
476
  <xsl:apply-templates select="." mode="title_eref"/>
468
477
  </xsl:variable> -->
469
478
 
479
+ <xsl:variable name="update_xml_pres">
480
+ <xsl:apply-templates mode="update_xml_pres"/>
481
+ </xsl:variable>
482
+
470
483
  <xsl:variable name="flatxml__">
471
484
  <!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
472
- <xsl:apply-templates select="." mode="flatxml"/>
485
+ <!-- <xsl:apply-templates select="." mode="flatxml"/> -->
486
+ <xsl:apply-templates select="xalan:nodeset($update_xml_pres)" mode="flatxml"/>
473
487
  </xsl:variable>
474
488
  <!-- save flatxml into the file and reload it -->
475
489
  <xsl:variable name="updated_flatxml_filename" select="concat($output_path,'_flatxml_', java:getTime(java:java.util.Date.new()), '.xml')"/>
@@ -502,9 +516,20 @@
502
516
  <xsl:apply-templates mode="title_eref"/>
503
517
  </xsl:variable> -->
504
518
 
519
+ <xsl:variable name="update_xml_pres">
520
+ <xsl:apply-templates mode="update_xml_pres"/>
521
+ </xsl:variable>
522
+
523
+ <xsl:if test="$debug = 'true'">
524
+ <redirect:write file="update_xml_pres.xml">
525
+ <xsl:copy-of select="xalan:nodeset($update_xml_pres)"/>
526
+ </redirect:write>
527
+ </xsl:if>
528
+
505
529
  <xsl:variable name="flatxml__">
506
530
  <!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
507
- <xsl:apply-templates select="." mode="flatxml"/>
531
+ <!-- <xsl:apply-templates select="." mode="flatxml"/> -->
532
+ <xsl:apply-templates select="xalan:nodeset($update_xml_pres)" mode="flatxml"/>
508
533
  </xsl:variable>
509
534
 
510
535
  <!-- save flatxml into the file and reload it -->
@@ -984,13 +1009,6 @@
984
1009
 
985
1010
  <xsl:variable name="curr_lang" select="bipm:bibdata/bipm:language[@current = 'true']"/>
986
1011
 
987
- <xsl:if test="$debug = 'true'">
988
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
989
- DEBUG
990
- contents=<xsl:copy-of select="$contents"/>
991
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
992
- </xsl:if>
993
-
994
1012
  <xsl:choose>
995
1013
  <xsl:when test="$independentAppendix = '' and not($doctype = 'guide')">
996
1014
 
@@ -1993,10 +2011,10 @@
1993
2011
  <!-- ============================= -->
1994
2012
 
1995
2013
  <!-- element with title -->
1996
- <xsl:template match="*[bipm:title]" mode="contents">
2014
+ <xsl:template match="*[bipm:title or bipm:fmt-title]" mode="contents">
1997
2015
  <xsl:variable name="level">
1998
2016
  <xsl:call-template name="getLevel">
1999
- <xsl:with-param name="depth" select="bipm:title/@depth"/>
2017
+ <xsl:with-param name="depth" select="bipm:fmt-title/@depth | bipm:title/@depth"/>
2000
2018
  </xsl:call-template>
2001
2019
  </xsl:variable>
2002
2020
 
@@ -3926,7 +3944,7 @@
3926
3944
  </xsl:if>
3927
3945
  </xsl:template>
3928
3946
 
3929
- <xsl:strip-space elements="bipm:xref"/>
3947
+ <!-- <xsl:strip-space elements="bipm:xref"/> -->
3930
3948
 
3931
3949
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
3932
3950
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
@@ -4943,6 +4961,10 @@
4943
4961
 
4944
4962
  <xsl:template name="refine_termnote-name-style">
4945
4963
 
4964
+ <!-- <xsl:if test="$namespace = 'ieee'">
4965
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
4966
+ </xsl:if> -->
4967
+
4946
4968
  </xsl:template>
4947
4969
 
4948
4970
  <xsl:attribute-set name="termnote-p-style">
@@ -5629,9 +5651,21 @@
5629
5651
  <xsl:template name="processTables_Contents">
5630
5652
  <tables>
5631
5653
  <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
5632
- <table id="{@id}" alt-text="{*[local-name() = 'name']}">
5633
- <xsl:copy-of select="*[local-name() = 'name']"/>
5634
- </table>
5654
+ <xsl:choose>
5655
+ <xsl:when test="*[local-name() = 'fmt-name']">
5656
+ <xsl:variable name="fmt_name">
5657
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
5658
+ </xsl:variable>
5659
+ <table id="{@id}" alt-text="{normalize-space($fmt_name)}">
5660
+ <xsl:copy-of select="$fmt_name"/>
5661
+ </table>
5662
+ </xsl:when>
5663
+ <xsl:otherwise>
5664
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
5665
+ <xsl:copy-of select="*[local-name() = 'name']"/>
5666
+ </table>
5667
+ </xsl:otherwise>
5668
+ </xsl:choose>
5635
5669
  </xsl:for-each>
5636
5670
  </tables>
5637
5671
  </xsl:template>
@@ -5639,9 +5673,21 @@
5639
5673
  <xsl:template name="processFigures_Contents">
5640
5674
  <figures>
5641
5675
  <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) != '']">
5642
- <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
5643
- <xsl:copy-of select="*[local-name() = 'name']"/>
5644
- </figure>
5676
+ <xsl:choose>
5677
+ <xsl:when test="*[local-name() = 'fmt-name']">
5678
+ <xsl:variable name="fmt_name">
5679
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
5680
+ </xsl:variable>
5681
+ <figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
5682
+ <xsl:copy-of select="$fmt_name"/>
5683
+ </figure>
5684
+ </xsl:when>
5685
+ <xsl:otherwise>
5686
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
5687
+ <xsl:copy-of select="*[local-name() = 'name']"/>
5688
+ </figure>
5689
+ </xsl:otherwise>
5690
+ </xsl:choose>
5645
5691
  </xsl:for-each>
5646
5692
  </figures>
5647
5693
  </xsl:template>
@@ -10472,6 +10518,8 @@
10472
10518
 
10473
10519
  <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
10474
10520
 
10521
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab"/>
10522
+
10475
10523
  <xsl:call-template name="refine_note-name-style"/>
10476
10524
 
10477
10525
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -10535,10 +10583,6 @@
10535
10583
 
10536
10584
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
10537
10585
 
10538
- <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
10539
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
10540
- </xsl:if>
10541
-
10542
10586
  <xsl:call-template name="refine_termnote-name-style"/>
10543
10587
 
10544
10588
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -10699,17 +10743,29 @@
10699
10743
  <!-- Example: Dimensions in millimeters -->
10700
10744
  <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
10701
10745
 
10746
+ <xsl:variable name="show_figure_key_in_block_container">
10747
+ true
10748
+ </xsl:variable>
10749
+
10702
10750
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
10703
10751
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
10704
10752
  </fo:block>
10705
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
10706
- <xsl:call-template name="note"/>
10707
- </xsl:for-each>
10708
- <xsl:call-template name="fn_display_figure"/>
10753
+
10754
+ <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
10755
+ <xsl:call-template name="showFigureKey"/>
10756
+ </xsl:if>
10709
10757
 
10710
10758
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
10711
10759
 
10712
10760
  </fo:block-container>
10761
+
10762
+ </xsl:template>
10763
+
10764
+ <xsl:template name="showFigureKey">
10765
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
10766
+ <xsl:call-template name="note"/>
10767
+ </xsl:for-each>
10768
+ <xsl:call-template name="fn_display_figure"/>
10713
10769
  </xsl:template>
10714
10770
 
10715
10771
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -10905,6 +10961,22 @@
10905
10961
  </xsl:if>
10906
10962
  </xsl:template>
10907
10963
 
10964
+ <xsl:template name="getImageSrc">
10965
+ <xsl:choose>
10966
+ <xsl:when test="not(starts-with(@src, 'data:'))">
10967
+ <xsl:choose>
10968
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
10969
+ <xsl:value-of select="@src"/>
10970
+ </xsl:when>
10971
+ <xsl:otherwise>
10972
+ <xsl:value-of select="concat($basepath, @src)"/>
10973
+ </xsl:otherwise>
10974
+ </xsl:choose>
10975
+ </xsl:when>
10976
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
10977
+ </xsl:choose>
10978
+ </xsl:template>
10979
+
10908
10980
  <xsl:template name="getImageScale">
10909
10981
  <xsl:param name="indent"/>
10910
10982
  <xsl:variable name="indent_left">
@@ -10914,19 +10986,7 @@
10914
10986
  </xsl:choose>
10915
10987
  </xsl:variable>
10916
10988
  <xsl:variable name="img_src">
10917
- <xsl:choose>
10918
- <xsl:when test="not(starts-with(@src, 'data:'))">
10919
- <xsl:choose>
10920
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
10921
- <xsl:value-of select="@src"/>
10922
- </xsl:when>
10923
- <xsl:otherwise>
10924
- <xsl:value-of select="concat($basepath, @src)"/>
10925
- </xsl:otherwise>
10926
- </xsl:choose>
10927
- </xsl:when>
10928
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
10929
- </xsl:choose>
10989
+ <xsl:call-template name="getImageSrc"/>
10930
10990
  </xsl:variable>
10931
10991
 
10932
10992
  <xsl:variable name="image_width_effective">
@@ -10934,10 +10994,15 @@
10934
10994
  <xsl:value-of select="$width_effective - number($indent_left)"/>
10935
10995
 
10936
10996
  </xsl:variable>
10997
+ <xsl:variable name="image_height_effective" select="$height_effective - number($indent_left)"/>
10937
10998
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
10938
10999
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
10939
11000
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
10940
- <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
11001
+ <xsl:variable name="scale">
11002
+
11003
+ <xsl:value-of select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
11004
+
11005
+ </xsl:variable>
10941
11006
  <xsl:value-of select="$scale"/>
10942
11007
  </xsl:template>
10943
11008
 
@@ -11490,20 +11555,48 @@
11490
11555
  <xsl:template match="*[local-name() = 'emf']"/>
11491
11556
 
11492
11557
  <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">
11558
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
11559
+ <xsl:apply-templates mode="contents"/>
11560
+ <xsl:text> </xsl:text>
11561
+ </xsl:if>
11562
+ </xsl:template>
11563
+
11564
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="contents"/>
11565
+
11566
+ <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">
11493
11567
  <xsl:apply-templates mode="contents"/>
11494
11568
  <xsl:text> </xsl:text>
11495
11569
  </xsl:template>
11496
11570
 
11497
11571
  <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">
11572
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
11573
+ <xsl:apply-templates mode="bookmarks"/>
11574
+ <xsl:text> </xsl:text>
11575
+ </xsl:if>
11576
+ </xsl:template>
11577
+
11578
+ <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">
11498
11579
  <xsl:apply-templates mode="bookmarks"/>
11499
11580
  <xsl:text> </xsl:text>
11500
11581
  </xsl:template>
11501
11582
 
11502
11583
  <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">
11584
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
11585
+ <xsl:value-of select="."/>
11586
+ </xsl:if>
11587
+ </xsl:template>
11588
+
11589
+ <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">
11503
11590
  <xsl:value-of select="."/>
11504
11591
  </xsl:template>
11505
11592
 
11506
11593
  <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">
11594
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
11595
+ <xsl:value-of select="."/>
11596
+ </xsl:if>
11597
+ </xsl:template>
11598
+
11599
+ <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">
11507
11600
  <xsl:value-of select="."/>
11508
11601
  </xsl:template>
11509
11602
 
@@ -11524,7 +11617,7 @@
11524
11617
  </xsl:template>
11525
11618
 
11526
11619
  <!-- special case: ignore section-title if @depth different than @depth of parent clause, or @depth of parent clause = 1 -->
11527
- <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"/>
11620
+ <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"/>
11528
11621
 
11529
11622
  <xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
11530
11623
  <xsl:variable name="level">
@@ -11536,6 +11629,9 @@
11536
11629
  <xsl:variable name="section">
11537
11630
  <xsl:choose>
11538
11631
  <xsl:when test="@type = 'section-title'"/>
11632
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
11633
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
11634
+ </xsl:when>
11539
11635
  <xsl:otherwise>
11540
11636
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
11541
11637
  </xsl:otherwise>
@@ -11558,6 +11654,19 @@
11558
11654
 
11559
11655
  <xsl:variable name="title">
11560
11656
  <xsl:choose>
11657
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/770 -->
11658
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
11659
+ <xsl:choose>
11660
+ <xsl:when test="@type = 'section-title'">
11661
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
11662
+ <xsl:text>: </xsl:text>
11663
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
11664
+ </xsl:when>
11665
+ <xsl:otherwise>
11666
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
11667
+ </xsl:otherwise>
11668
+ </xsl:choose>
11669
+ </xsl:when>
11561
11670
  <xsl:when test="*[local-name() = 'tab']">
11562
11671
  <xsl:choose>
11563
11672
  <xsl:when test="@type = 'section-title'">
@@ -11593,7 +11702,7 @@
11593
11702
  <xsl:apply-templates mode="bookmarks"/>
11594
11703
  </xsl:template>
11595
11704
 
11596
- <xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
11705
+ <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">
11597
11706
  <xsl:apply-templates select="."/>
11598
11707
  </xsl:template>
11599
11708
 
@@ -11606,6 +11715,10 @@
11606
11715
  <xsl:apply-templates mode="contents"/>
11607
11716
  </xsl:template>
11608
11717
 
11718
+ <xsl:template match="*[local-name() = 'semx']" mode="contents">
11719
+ <xsl:apply-templates mode="contents"/>
11720
+ </xsl:template>
11721
+
11609
11722
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
11610
11723
  <xsl:apply-templates mode="bookmarks"/>
11611
11724
  </xsl:template>
@@ -11615,9 +11728,14 @@
11615
11728
  <xsl:apply-templates mode="bookmarks"/>
11616
11729
  </xsl:template>
11617
11730
 
11731
+ <xsl:template match="*[local-name() = 'semx']" mode="bookmarks">
11732
+ <xsl:apply-templates mode="bookmarks"/>
11733
+ </xsl:template>
11734
+
11618
11735
  <!-- Bookmarks -->
11619
11736
  <xsl:template name="addBookmarks">
11620
11737
  <xsl:param name="contents"/>
11738
+ <xsl:param name="contents_addon"/>
11621
11739
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
11622
11740
  <xsl:if test="$contents_nodes//item">
11623
11741
  <fo:bookmark-tree>
@@ -11715,6 +11833,9 @@
11715
11833
  </xsl:otherwise>
11716
11834
  </xsl:choose>
11717
11835
 
11836
+ <!-- for $namespace = 'nist-sp' $namespace = 'ogc' $namespace = 'ogc-white-paper' -->
11837
+ <xsl:copy-of select="$contents_addon"/>
11838
+
11718
11839
  </fo:bookmark-tree>
11719
11840
  </xsl:if>
11720
11841
  </xsl:template>
@@ -11882,6 +12003,16 @@
11882
12003
  <!-- ====== -->
11883
12004
  <!-- ====== -->
11884
12005
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
12006
+ <xsl:param name="mode">bookmarks</xsl:param>
12007
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-title'])">
12008
+ <xsl:apply-templates mode="contents_item">
12009
+ <xsl:with-param name="mode" select="$mode"/>
12010
+ </xsl:apply-templates>
12011
+ <!-- <xsl:text> </xsl:text> -->
12012
+ </xsl:if>
12013
+ </xsl:template>
12014
+
12015
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="contents_item">
11885
12016
  <xsl:param name="mode">bookmarks</xsl:param>
11886
12017
  <xsl:apply-templates mode="contents_item">
11887
12018
  <xsl:with-param name="mode" select="$mode"/>
@@ -11889,12 +12020,38 @@
11889
12020
  <!-- <xsl:text> </xsl:text> -->
11890
12021
  </xsl:template>
11891
12022
 
12023
+ <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">
12024
+ <xsl:apply-templates mode="contents_item"/>
12025
+ </xsl:template>
12026
+
12027
+ <xsl:template match="*[local-name() = 'semx']" mode="contents_item">
12028
+ <xsl:apply-templates mode="contents_item"/>
12029
+ </xsl:template>
12030
+
12031
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="contents_item"/>
12032
+
11892
12033
  <xsl:template name="getSection">
11893
- <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
12034
+ <xsl:choose>
12035
+ <xsl:when test="*[local-name() = 'fmt-title']">
12036
+ <xsl:variable name="fmt_title_section">
12037
+ <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')]"/>
12038
+ </xsl:variable>
12039
+ <xsl:value-of select="normalize-space($fmt_title_section)"/>
12040
+ </xsl:when>
12041
+ <xsl:otherwise>
12042
+ <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
12043
+ </xsl:otherwise>
12044
+ </xsl:choose>
11894
12045
  </xsl:template>
11895
12046
 
11896
12047
  <xsl:template name="getName">
11897
12048
  <xsl:choose>
12049
+ <xsl:when test="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']]">
12050
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/following-sibling::node()"/>
12051
+ </xsl:when>
12052
+ <xsl:when test="*[local-name() = 'fmt-title']">
12053
+ <xsl:copy-of select="*[local-name() = 'fmt-title']/node()"/>
12054
+ </xsl:when>
11898
12055
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
11899
12056
  <xsl:copy-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/following-sibling::node()"/>
11900
12057
  </xsl:when>
@@ -12001,6 +12158,15 @@
12001
12158
  </xsl:template>
12002
12159
 
12003
12160
  <xsl:template match="*[local-name() = 'name']" mode="contents_item">
12161
+ <xsl:param name="mode">bookmarks</xsl:param>
12162
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
12163
+ <xsl:apply-templates mode="contents_item">
12164
+ <xsl:with-param name="mode" select="$mode"/>
12165
+ </xsl:apply-templates>
12166
+ </xsl:if>
12167
+ </xsl:template>
12168
+
12169
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="contents_item">
12004
12170
  <xsl:param name="mode">bookmarks</xsl:param>
12005
12171
  <xsl:apply-templates mode="contents_item">
12006
12172
  <xsl:with-param name="mode" select="$mode"/>
@@ -12837,107 +13003,108 @@
12837
13003
  -->
12838
13004
  <xsl:template match="*[local-name() = 'example']">
12839
13005
 
12840
- <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
12841
-
12842
- <xsl:call-template name="setBlockSpanAll"/>
13006
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
12843
13007
 
12844
- <xsl:call-template name="refine_example-style"/>
13008
+ <xsl:call-template name="setBlockSpanAll"/>
12845
13009
 
12846
- <xsl:variable name="fo_element">
12847
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
12848
- block
12849
- </xsl:variable>
13010
+ <xsl:call-template name="refine_example-style"/>
12850
13011
 
12851
- <fo:block-container margin-left="0mm" role="SKIP">
13012
+ <xsl:variable name="fo_element">
13013
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
13014
+ block
13015
+ </xsl:variable>
12852
13016
 
12853
- <xsl:choose>
13017
+ <fo:block-container margin-left="0mm" role="SKIP">
12854
13018
 
12855
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
13019
+ <xsl:choose>
12856
13020
 
12857
- <!-- display name 'EXAMPLE' in a separate block -->
12858
- <fo:block>
12859
- <xsl:apply-templates select="*[local-name()='name']">
12860
- <xsl:with-param name="fo_element" select="$fo_element"/>
12861
- </xsl:apply-templates>
12862
- </fo:block>
13021
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
12863
13022
 
12864
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
12865
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
12866
- <xsl:variable name="example_body">
12867
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
13023
+ <!-- display name 'EXAMPLE' in a separate block -->
13024
+ <fo:block>
13025
+ <xsl:apply-templates select="*[local-name()='name']">
12868
13026
  <xsl:with-param name="fo_element" select="$fo_element"/>
12869
13027
  </xsl:apply-templates>
12870
- </xsl:variable>
12871
- <xsl:choose>
12872
- <xsl:when test="xalan:nodeset($example_body)/*">
12873
- <xsl:copy-of select="$example_body"/>
12874
- </xsl:when>
12875
- <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
12876
- </xsl:choose>
12877
- </fo:block-container>
12878
- </fo:block-container>
12879
- </xsl:when> <!-- end block -->
13028
+ </fo:block>
12880
13029
 
12881
- <xsl:when test="contains(normalize-space($fo_element), 'list')">
13030
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
13031
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
13032
+ <xsl:variable name="example_body">
13033
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
13034
+ <xsl:with-param name="fo_element" select="$fo_element"/>
13035
+ </xsl:apply-templates>
13036
+ </xsl:variable>
13037
+ <xsl:choose>
13038
+ <xsl:when test="xalan:nodeset($example_body)/*">
13039
+ <xsl:copy-of select="$example_body"/>
13040
+ </xsl:when>
13041
+ <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
13042
+ </xsl:choose>
13043
+ </fo:block-container>
13044
+ </fo:block-container>
13045
+ </xsl:when> <!-- end block -->
12882
13046
 
12883
- <xsl:variable name="provisional_distance_between_starts_">
12884
- 7
12885
- </xsl:variable>
12886
- <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
12887
- <xsl:variable name="indent_">
12888
- 0
12889
- </xsl:variable>
12890
- <xsl:variable name="indent" select="normalize-space($indent_)"/>
13047
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
12891
13048
 
12892
- <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
12893
- <fo:list-item>
12894
- <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
12895
- <fo:block>
12896
- <xsl:apply-templates select="*[local-name()='name']">
12897
- <xsl:with-param name="fo_element">block</xsl:with-param>
12898
- </xsl:apply-templates>
12899
- </fo:block>
12900
- </fo:list-item-label>
12901
- <fo:list-item-body start-indent="body-start()">
12902
- <fo:block>
12903
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
13049
+ <xsl:variable name="provisional_distance_between_starts_">
13050
+ 7
13051
+ </xsl:variable>
13052
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
13053
+ <xsl:variable name="indent_">
13054
+ 0
13055
+ </xsl:variable>
13056
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
13057
+
13058
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
13059
+ <fo:list-item>
13060
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
13061
+ <fo:block>
13062
+ <xsl:apply-templates select="*[local-name()='name']">
13063
+ <xsl:with-param name="fo_element">block</xsl:with-param>
13064
+ </xsl:apply-templates>
13065
+ </fo:block>
13066
+ </fo:list-item-label>
13067
+ <fo:list-item-body start-indent="body-start()">
13068
+ <fo:block>
13069
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
13070
+ <xsl:with-param name="fo_element" select="$fo_element"/>
13071
+ </xsl:apply-templates>
13072
+ </fo:block>
13073
+ </fo:list-item-body>
13074
+ </fo:list-item>
13075
+ </fo:list-block>
13076
+ </xsl:when> <!-- end list -->
13077
+
13078
+ <xsl:otherwise> <!-- inline -->
13079
+
13080
+ <!-- display 'EXAMPLE' and first element in the same line -->
13081
+ <fo:block>
13082
+ <xsl:apply-templates select="*[local-name()='name']">
13083
+ <xsl:with-param name="fo_element" select="$fo_element"/>
13084
+ </xsl:apply-templates>
13085
+ <fo:inline>
13086
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
12904
13087
  <xsl:with-param name="fo_element" select="$fo_element"/>
12905
13088
  </xsl:apply-templates>
12906
- </fo:block>
12907
- </fo:list-item-body>
12908
- </fo:list-item>
12909
- </fo:list-block>
12910
- </xsl:when> <!-- end list -->
12911
-
12912
- <xsl:otherwise> <!-- inline -->
13089
+ </fo:inline>
13090
+ </fo:block>
12913
13091
 
12914
- <!-- display 'EXAMPLE' and first element in the same line -->
12915
- <fo:block>
12916
- <xsl:apply-templates select="*[local-name()='name']">
12917
- <xsl:with-param name="fo_element" select="$fo_element"/>
12918
- </xsl:apply-templates>
12919
- <fo:inline>
12920
- <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
12921
- <xsl:with-param name="fo_element" select="$fo_element"/>
12922
- </xsl:apply-templates>
12923
- </fo:inline>
12924
- </fo:block>
13092
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
13093
+ <!-- display further elements in blocks -->
13094
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
13095
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
13096
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
13097
+ <xsl:with-param name="fo_element" select="'block'"/>
13098
+ </xsl:apply-templates>
13099
+ </fo:block-container>
13100
+ </fo:block-container>
13101
+ </xsl:if>
13102
+ </xsl:otherwise> <!-- end inline -->
12925
13103
 
12926
- <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
12927
- <!-- display further elements in blocks -->
12928
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
12929
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
12930
- <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
12931
- <xsl:with-param name="fo_element" select="'block'"/>
12932
- </xsl:apply-templates>
12933
- </fo:block-container>
12934
- </fo:block-container>
12935
- </xsl:if>
12936
- </xsl:otherwise> <!-- end inline -->
13104
+ </xsl:choose>
13105
+ </fo:block-container>
13106
+ </fo:block-container>
12937
13107
 
12938
- </xsl:choose>
12939
- </fo:block-container>
12940
- </fo:block-container>
12941
13108
  </xsl:template>
12942
13109
 
12943
13110
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
@@ -13326,6 +13493,13 @@
13326
13493
 
13327
13494
  </xsl:template> <!-- tab -->
13328
13495
 
13496
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
13497
+ <xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
13498
+
13499
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
13500
+
13501
+ </xsl:template>
13502
+
13329
13503
  <xsl:template name="insertNonBreakSpaces">
13330
13504
  <xsl:param name="count"/>
13331
13505
  <xsl:if test="$count &gt; 0">
@@ -14862,6 +15036,10 @@
14862
15036
  <!-- - Remove semantic xml part -->
14863
15037
  <!-- - Remove image/emf (EMF vector image for Word) -->
14864
15038
  <!-- - add @id, redundant for table auto-layout algorithm -->
15039
+ <!-- - process 'passthrough' element -->
15040
+ <!-- - split math by element with @linebreak into maths -->
15041
+ <!-- - rename fmt-title to title, fmt-name to name and another changes to convert new presentation XML to -->
15042
+ <!-- - old XML without significant changes in XSLT -->
14865
15043
  <!-- =========================================================================== -->
14866
15044
  <xsl:template match="@*|node()" mode="update_xml_step1">
14867
15045
  <xsl:copy>
@@ -14869,6 +15047,12 @@
14869
15047
  </xsl:copy>
14870
15048
  </xsl:template>
14871
15049
 
15050
+ <xsl:template match="@*|node()" mode="update_xml_pres">
15051
+ <xsl:copy>
15052
+ <xsl:apply-templates select="@*|node()" mode="update_xml_pres"/>
15053
+ </xsl:copy>
15054
+ </xsl:template>
15055
+
14872
15056
  <!-- change section's order based on @displayorder value -->
14873
15057
  <xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
14874
15058
  <xsl:copy>
@@ -14945,7 +15129,7 @@
14945
15129
  </xsl:template>
14946
15130
 
14947
15131
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
14948
- <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">
15132
+ <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">
14949
15133
  <xsl:copy>
14950
15134
  <xsl:copy-of select="@*"/>
14951
15135
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -14964,14 +15148,17 @@
14964
15148
 
14965
15149
  <!-- remove semantic xml -->
14966
15150
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
15151
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_pres"/>
14967
15152
 
14968
15153
  <!-- remove image/emf -->
14969
15154
  <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
15155
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_pres"/>
14970
15156
 
14971
15157
  <!-- remove preprocess-xslt -->
14972
15158
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
15159
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
14973
15160
 
14974
- <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">
15161
+ <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">
14975
15162
  <xsl:copy-of select="."/>
14976
15163
  </xsl:template>
14977
15164
 
@@ -15053,6 +15240,77 @@
15053
15240
  <xsl:copy-of select="$maths"/>
15054
15241
  </xsl:template>
15055
15242
 
15243
+ <!-- update new Presentation XML -->
15244
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_step1"/>
15245
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_pres"/>
15246
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_step1"/>
15247
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
15248
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
15249
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
15250
+
15251
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
15252
+ <xsl:copy>
15253
+ <xsl:apply-templates select="@*" mode="update_xml_step1"/>
15254
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
15255
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
15256
+ </xsl:copy>
15257
+ </xsl:template>
15258
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_pres">
15259
+ <xsl:copy>
15260
+ <xsl:apply-templates select="@*" mode="update_xml_pres"/>
15261
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
15262
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
15263
+ </xsl:copy>
15264
+ </xsl:template>
15265
+
15266
+ <xsl:template match="*[local-name() = 'fmt-title']"/>
15267
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
15268
+ <xsl:element name="title" namespace="{$namespace_full}">
15269
+ <xsl:copy-of select="@*"/>
15270
+ <xsl:apply-templates mode="update_xml_step1"/>
15271
+ </xsl:element>
15272
+ </xsl:template>
15273
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
15274
+ <xsl:element name="title" namespace="{$namespace_full}">
15275
+ <xsl:copy-of select="@*"/>
15276
+ <xsl:apply-templates mode="update_xml_pres"/>
15277
+ </xsl:element>
15278
+ </xsl:template>
15279
+
15280
+ <xsl:template match="*[local-name() = 'fmt-name']"/>
15281
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
15282
+ <xsl:element name="name" namespace="{$namespace_full}">
15283
+ <xsl:copy-of select="@*"/>
15284
+ <xsl:apply-templates mode="update_xml_step1"/>
15285
+ </xsl:element>
15286
+ </xsl:template>
15287
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres">
15288
+ <xsl:element name="name" namespace="{$namespace_full}">
15289
+ <xsl:copy-of select="@*"/>
15290
+ <xsl:apply-templates mode="update_xml_pres"/>
15291
+ </xsl:element>
15292
+ </xsl:template>
15293
+
15294
+ <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">
15295
+ <xsl:apply-templates mode="update_xml_step1"/>
15296
+ </xsl:template>
15297
+ <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">
15298
+ <xsl:apply-templates mode="update_xml_pres"/>
15299
+ </xsl:template>
15300
+
15301
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_step1">
15302
+ <xsl:apply-templates mode="update_xml_step1"/>
15303
+ </xsl:template>
15304
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_pres">
15305
+ <xsl:apply-templates mode="update_xml_pres"/>
15306
+ </xsl:template>
15307
+
15308
+ <xsl:template match="*[local-name() = 'fmt-xref-label']"/>
15309
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_step1"/>
15310
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_pres"/>
15311
+
15312
+ <!-- END: update new Presentation XML -->
15313
+
15056
15314
  <!-- =========================================================================== -->
15057
15315
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
15058
15316
  <!-- =========================================================================== -->
@@ -15245,7 +15503,7 @@
15245
15503
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
15246
15504
  <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>
15247
15505
 
15248
- <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">
15506
+ <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">
15249
15507
 
15250
15508
  <xsl:variable name="parent" select="local-name(..)"/>
15251
15509
 
@@ -15824,6 +16082,7 @@
15824
16082
  </pdf:catalog>
15825
16083
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
15826
16084
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
16085
+ <!-- Commented after upgrade to Apache FOP 2.10
15827
16086
  <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="">
15828
16087
  <pdfaExtension:schemas>
15829
16088
  <rdf:Bag>
@@ -15856,7 +16115,7 @@
15856
16115
  </rdf:li>
15857
16116
  </rdf:Bag>
15858
16117
  </pdfaExtension:schemas>
15859
- </rdf:Description>
16118
+ </rdf:Description> -->
15860
16119
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
15861
16120
  <!-- Dublin Core properties go here -->
15862
16121
  <dc:title>
@@ -15903,7 +16162,7 @@
15903
16162
  <xsl:variable name="dc_description">
15904
16163
  <xsl:variable name="abstract">
15905
16164
 
15906
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
16165
+ <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'])]"/>
15907
16166
 
15908
16167
  </xsl:variable>
15909
16168
  <rdf:Alt>
@@ -16448,31 +16707,123 @@
16448
16707
 
16449
16708
  <!-- END: insert cover page image -->
16450
16709
 
16451
- <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
16710
+ <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
16711
+ <xsl:variable name="regex_ja_spec_">[
16712
+ <!-- Rotate 90° clockwise -->
16713
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
16714
+ \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
16715
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
16716
+ \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
16717
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
16718
+ \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
16719
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
16720
+ \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
16721
+ \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
16722
+ \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
16723
+ \u3010 <!-- U+3010 LEFT BLACK LENTICULAR BRACKET (【) -->
16724
+ \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
16725
+ \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
16726
+ \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
16727
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
16728
+ \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
16729
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
16730
+ \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
16731
+ \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
16732
+ \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
16733
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
16734
+ \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
16735
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
16736
+ \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
16737
+ \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
16738
+ \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
16739
+ \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
16740
+ \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
16741
+
16742
+ \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
16743
+ \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
16744
+ \u301C <!-- U+301C WAVE DASH (〜) -->
16745
+ \u3030 <!-- U+3030 WAVY DASH (〰 )-->
16746
+ \u30FC <!-- U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK (ー) -->
16747
+ \u2329 <!-- U+2329 LEFT-POINTING ANGLE BRACKET (〈) -->
16748
+ \u232A <!-- U+232A RIGHT-POINTING ANGLE BRACKET (〉) -->
16749
+ \u3018 <!-- U+3018 LEFT WHITE TORTOISE SHELL BRACKET (〘) -->
16750
+ \u3019 <!-- U+3019 RIGHT WHITE TORTOISE SHELL BRACKET (〙) -->
16751
+ \u30A0 <!-- U+30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN (゠) -->
16752
+ \uFE59 <!-- U+FE59 SMALL LEFT PARENTHESIS (﹙) -->
16753
+ \uFE5A <!-- U+FE5A SMALL RIGHT PARENTHESIS (﹚) -->
16754
+ \uFE5B <!-- U+FE5B SMALL LEFT CURLY BRACKET (﹛) -->
16755
+ \uFE5C <!-- U+FE5C SMALL RIGHT CURLY BRACKET (﹜) -->
16756
+ \uFE5D <!-- U+FE5D SMALL LEFT TORTOISE SHELL BRACKET (﹝) -->
16757
+ \uFE5E <!-- U+FE5E SMALL RIGHT TORTOISE SHELL BRACKET (﹞) -->
16758
+ \uFF5C <!-- U+FF5C FULLWIDTH VERTICAL LINE (|) -->
16759
+ \uFF5F <!-- U+FF5F FULLWIDTH LEFT WHITE PARENTHESIS (⦅) -->
16760
+ \uFF60 <!-- U+FF60 FULLWIDTH RIGHT WHITE PARENTHESIS (⦆) -->
16761
+ \uFFE3 <!-- U+FFE3 FULLWIDTH MACRON ( ̄) -->
16762
+ \uFF3F <!-- U+FF3F FULLWIDTH LOW LINE (_) -->
16763
+ \uFF5E <!-- U+FF5E FULLWIDTH TILDE (~) -->
16764
+ <!-- Rotate 180° -->
16765
+ \u309C <!-- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜) -->
16766
+ \u3002 <!-- U+3002 IDEOGRAPHIC FULL STOP (。) -->
16767
+ \uFE52 <!-- U+FE52 SMALL FULL STOP (﹒) -->
16768
+ \uFF0E <!-- U+FF0E FULLWIDTH FULL STOP (.) -->
16769
+ ]</xsl:variable>
16770
+ <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
16452
16771
  <xsl:template name="insertVerticalChar">
16453
16772
  <xsl:param name="str"/>
16454
16773
  <xsl:param name="writing-mode">lr-tb</xsl:param>
16455
16774
  <xsl:param name="reference-orientation">90</xsl:param>
16456
- <xsl:if test="string-length($str) &gt; 0">
16457
- <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">
16458
- <xsl:if test="normalize-space($writing-mode) != ''">
16459
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
16460
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
16461
- </xsl:if>
16462
- <xsl:variable name="char" select="substring($str,1,1)"/>
16463
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
16464
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
16775
+ <xsl:param name="add_zero_width_space">false</xsl:param>
16776
+ <xsl:choose>
16777
+ <xsl:when test="ancestor::*[local-name() = 'span'][@class = 'norotate']">
16778
+ <xsl:value-of select="$str"/>
16779
+ </xsl:when>
16780
+ <xsl:otherwise>
16781
+ <xsl:if test="string-length($str) &gt; 0">
16782
+ <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
16783
+ <xsl:variable name="char" select="substring($str,1,1)"/>
16784
+ <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">
16785
+ <xsl:if test="normalize-space($writing-mode) != ''">
16786
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
16787
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
16788
+ </xsl:if>
16789
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
16790
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
16791
+ </xsl:if>
16792
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
16793
+ <!-- Rotate 180°:
16794
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
16795
+ U+3002 IDEOGRAPHIC FULL STOP (。)
16796
+ U+FE52 SMALL FULL STOP (﹒)
16797
+ U+FF0E FULLWIDTH FULL STOP (.)
16798
+ -->
16799
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
16800
+ </xsl:if>
16801
+ <fo:block-container width="1em">
16802
+ <fo:block line-height="1em">
16803
+ <xsl:choose>
16804
+ <xsl:when test="$horizontal_mode = 'true'">
16805
+ <xsl:value-of select="$str"/>
16806
+ </xsl:when>
16807
+ <xsl:otherwise>
16808
+ <xsl:value-of select="$char"/>
16809
+ </xsl:otherwise>
16810
+ </xsl:choose>
16811
+ </fo:block>
16812
+ </fo:block-container>
16813
+ </fo:inline-container>
16814
+ <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>
16815
+
16816
+ <xsl:if test="$horizontal_mode = 'false'">
16817
+ <xsl:call-template name="insertVerticalChar">
16818
+ <xsl:with-param name="str" select="substring($str, 2)"/>
16819
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
16820
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
16821
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
16822
+ </xsl:call-template>
16823
+ </xsl:if>
16465
16824
  </xsl:if>
16466
- <fo:block-container width="1em">
16467
- <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
16468
- </fo:block-container>
16469
- </fo:inline-container>
16470
- <xsl:call-template name="insertVerticalChar">
16471
- <xsl:with-param name="str" select="substring($str, 2)"/>
16472
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
16473
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
16474
- </xsl:call-template>
16475
- </xsl:if>
16825
+ </xsl:otherwise>
16826
+ </xsl:choose>
16476
16827
  </xsl:template>
16477
16828
 
16478
16829
  <xsl:template name="number-to-words">