metanorma-jis 0.4.6 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:jis="https://www.metanorma.org/ns/jis" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:java="http://xml.apache.org/xalan/java" xmlns:jeuclid="http://jeuclid.sf.net/ns/ext" xmlns:barcode="http://barcode4j.krysalis.org/ns" xmlns:redirect="http://xml.apache.org/xalan/redirect" exclude-result-prefixes="java" extension-element-prefixes="redirect" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:jis="https://www.metanorma.org/ns/standoc" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:java="http://xml.apache.org/xalan/java" xmlns:jeuclid="http://jeuclid.sf.net/ns/ext" xmlns:barcode="http://barcode4j.krysalis.org/ns" xmlns:redirect="http://xml.apache.org/xalan/redirect" exclude-result-prefixes="java" extension-element-prefixes="redirect" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -19,14 +19,14 @@
19
19
  <xsl:variable name="numbers_japanese" select="xalan:nodeset($numbers_japanese_)"/>
20
20
 
21
21
  <xsl:variable name="contents_">
22
- <xsl:variable name="bundle" select="count(//jis:jis-standard) &gt; 1"/>
22
+ <xsl:variable name="bundle" select="count(//jis:metanorma) &gt; 1"/>
23
23
 
24
24
  <xsl:if test="normalize-space($bundle) = 'true'">
25
25
  <collection firstpage_id="firstpage_id_0"/>
26
26
  </xsl:if>
27
27
 
28
- <xsl:for-each select="//jis:jis-standard">
29
- <xsl:variable name="num"><xsl:number level="any" count="jis:jis-standard"/></xsl:variable>
28
+ <xsl:for-each select="//jis:metanorma">
29
+ <xsl:variable name="num"><xsl:number level="any" count="jis:metanorma"/></xsl:variable>
30
30
  <xsl:variable name="docnumber"><xsl:value-of select="jis:bibdata/jis:docidentifier[@type = 'JIS']"/></xsl:variable>
31
31
  <xsl:variable name="current_document">
32
32
  <xsl:copy-of select="."/>
@@ -471,8 +471,8 @@
471
471
  <xsl:variable name="updated_xml_step2" select="xalan:nodeset($updated_xml_step2_)"/>
472
472
  <!-- DEBUG: updated_xml_step2=<xsl:copy-of select="$updated_xml_step2"/> -->
473
473
 
474
- <xsl:for-each select="$updated_xml_step2//jis:jis-standard">
475
- <xsl:variable name="num"><xsl:number level="any" count="jis:jis-standard"/></xsl:variable>
474
+ <xsl:for-each select="$updated_xml_step2//jis:metanorma">
475
+ <xsl:variable name="num"><xsl:number level="any" count="jis:metanorma"/></xsl:variable>
476
476
 
477
477
  <xsl:variable name="current_document">
478
478
  <xsl:copy-of select="."/>
@@ -532,7 +532,7 @@
532
532
  <xsl:otherwise><xsl:value-of select="$docidentifier_JIS_"/></xsl:otherwise>
533
533
  </xsl:choose>
534
534
  </xsl:variable>
535
- <xsl:variable name="edition" select="/jis:jis-standard/jis:bibdata/jis:edition[@language = 'ja' and @numberonly = 'true']"/>
535
+ <xsl:variable name="edition" select="/jis:metanorma/jis:bibdata/jis:edition[@language = 'ja' and @numberonly = 'true']"/>
536
536
 
537
537
  <xsl:variable name="doclang">
538
538
  <xsl:call-template name="getLang"/>
@@ -575,7 +575,7 @@
575
575
  <!-- ========================== -->
576
576
 
577
577
  <xsl:variable name="bibdata">
578
- <xsl:copy-of select="/jis:jis-standard/jis:bibdata"/>
578
+ <xsl:copy-of select="/jis:metanorma/jis:bibdata"/>
579
579
  </xsl:variable>
580
580
 
581
581
  <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'clause' and @type = 'contributors')]">
@@ -789,7 +789,7 @@
789
789
  <!-- page break before each section -->
790
790
  <xsl:variable name="structured_xml">
791
791
  <xsl:for-each select="xalan:nodeset($structured_xml_)/item[*]">
792
- <xsl:element name="pagebreak" namespace="https://www.metanorma.org/ns/jis"/>
792
+ <xsl:element name="pagebreak" namespace="{$namespace_full}"/>
793
793
  <xsl:copy-of select="./*"/>
794
794
  </xsl:for-each>
795
795
  </xsl:variable>
@@ -991,7 +991,7 @@
991
991
 
992
992
  </xsl:for-each>
993
993
 
994
- <xsl:if test="not(//jis:jis-standard)">
994
+ <xsl:if test="not(//jis:metanorma)">
995
995
  <fo:page-sequence master-reference="document" force-page-count="no-force">
996
996
  <fo:flow flow-name="xsl-region-body">
997
997
  <fo:block><!-- prevent fop error for empty document --></fo:block>
@@ -1305,14 +1305,14 @@
1305
1305
 
1306
1306
  <fo:page-sequence master-reference="cover-page_2024" force-page-count="no-force">
1307
1307
 
1308
- <!-- <xsl:variable name="cover_page_background_1_value" select="normalize-space(//jis:jis-standard/jis:metanorma-extension/jis:presentation-metadata/jis:color-cover-page-background-1)"/>
1308
+ <!-- <xsl:variable name="cover_page_background_1_value" select="normalize-space(//jis:metanorma/jis:metanorma-extension/jis:presentation-metadata/jis:color-cover-page-background-1)"/>
1309
1309
  <xsl:variable name="cover_page_background_1_">
1310
1310
  <xsl:value-of select="$cover_page_background_1_value"/>
1311
1311
  <xsl:if test="$cover_page_background_1_value = ''">#00063F</xsl:if>
1312
1312
  </xsl:variable>
1313
1313
  <xsl:variable name="cover_page_background_1" select="normalize-space($cover_page_background_1_)"/>
1314
1314
 
1315
- <xsl:variable name="cover_page_background_2_value" select="normalize-space(//jis:jis-standard/jis:metanorma-extension/jis:presentation-metadata/jis:color-cover-page-background-2)"/>
1315
+ <xsl:variable name="cover_page_background_2_value" select="normalize-space(//jis:metanorma/jis:metanorma-extension/jis:presentation-metadata/jis:color-cover-page-background-2)"/>
1316
1316
  <xsl:variable name="cover_page_background_2_">
1317
1317
  <xsl:value-of select="$cover_page_background_2_value"/>
1318
1318
  <xsl:if test="$cover_page_background_2_value = ''">#DBD6BD</xsl:if>
@@ -1488,7 +1488,7 @@
1488
1488
  <fo:static-content flow-name="header">
1489
1489
  <xsl:variable name="presentation_metadata_image_name">
1490
1490
  <xsl:choose>
1491
- <xsl:when test="/*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'backpage-image']/*[local-name() = 'value']/*[local-name() = 'image']">backpage-image</xsl:when>
1491
+ <xsl:when test="/*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'backpage-image']/*[local-name() = 'value']/*[local-name() = 'image']">backpage-image</xsl:when>
1492
1492
  <xsl:otherwise>coverpage-image</xsl:otherwise>
1493
1493
  </xsl:choose>
1494
1494
  </xsl:variable>
@@ -2616,7 +2616,7 @@
2616
2616
  <xsl:param name="structured_xml"/>
2617
2617
  <xsl:choose>
2618
2618
  <xsl:when test="not(xalan:nodeset($structured_xml)/*[local-name()='pagebreak'])">
2619
- <xsl:element name="page" namespace="https://www.metanorma.org/ns/jis">
2619
+ <xsl:element name="page" namespace="{$namespace_full}">
2620
2620
  <xsl:copy-of select="xalan:nodeset($structured_xml)"/>
2621
2621
  </xsl:element>
2622
2622
  </xsl:when>
@@ -2626,7 +2626,7 @@
2626
2626
  <xsl:variable name="pagebreak_id" select="generate-id()"/>
2627
2627
 
2628
2628
  <!-- copy elements before pagebreak -->
2629
- <xsl:element name="page" namespace="https://www.metanorma.org/ns/jis">
2629
+ <xsl:element name="page" namespace="{$namespace_full}">
2630
2630
  <xsl:if test="not(preceding-sibling::jis:pagebreak)">
2631
2631
  <xsl:copy-of select="../@*"/>
2632
2632
  </xsl:if>
@@ -2638,7 +2638,7 @@
2638
2638
 
2639
2639
  <!-- copy elements after last page break -->
2640
2640
  <xsl:if test="position() = last() and following-sibling::node()">
2641
- <xsl:element name="page" namespace="https://www.metanorma.org/ns/jis">
2641
+ <xsl:element name="page" namespace="{$namespace_full}">
2642
2642
  <xsl:copy-of select="@orientation"/>
2643
2643
  <xsl:copy-of select="following-sibling::node()"/>
2644
2644
  </xsl:element>
@@ -2845,7 +2845,7 @@
2845
2845
  <!-- jis:term/jis:preferred2//text() | -->
2846
2846
 
2847
2847
  <!-- <name>注記 1</name> to <name>注記<font_en> 1</font_en></name> -->
2848
- <xsl:template match="jis:title/text() | jis:term/jis:name/text() | jis:note/jis:name/text() | jis:termnote/jis:name/text() | jis:table/jis:name/text() | jis:figure/jis:name/text() | jis:termexample/jis:name/text() | jis:xref//text() | jis:origin/text()" mode="update_xml_step1">
2848
+ <xsl:template match="jis:title/text() | jis:fmt-title/text() | jis:term/jis:name/text() | jis:term/jis:fmt-name/text() | jis:note/jis:name/text() | jis:note/jis:fmt-name/text() | jis:termnote/jis:name/text() |jis:termnote/jis:fmt-name/text() | jis:table/jis:name/text() |jis:table/jis:fmt-name/text() | jis:figure/jis:name/text() |jis:figure/jis:fmt-name/text() | jis:termexample/jis:name/text() |jis:termexample/jis:fmtname/text() | jis:xref//text() | jis:fmt-xref//text() | jis:origin/text() | jis:fmt-origin/text()" mode="update_xml_step1">
2849
2849
  <xsl:choose>
2850
2850
  <xsl:when test="$vertical_layout = 'true'">
2851
2851
  <xsl:choose>
@@ -2889,30 +2889,52 @@
2889
2889
  </xsl:template>
2890
2890
 
2891
2891
  <!-- move example title to the first paragraph -->
2892
- <xsl:template match="jis:example[contains(jis:name/text(), ' — ')]" mode="update_xml_step1">
2892
+ <!-- Example:
2893
+ <example id="_7569d639-c245-acb6-2141-3b746374a9e1" autonum="1">
2894
+ <name id="_8eac959b-b129-4892-b8bb-fcca2914bd39">(可能性の例)</name>
2895
+ <fmt-name>
2896
+ <span class="fmt-caption-label">
2897
+ <span class="fmt-element-name">例</span>
2898
+ <semx element="autonum" source="_7569d639-c245-acb6-2141-3b746374a9e1">1</semx>
2899
+ </span>
2900
+ <span class="fmt-caption-delim"> — </span>
2901
+ <semx element="name" source="_8eac959b-b129-4892-b8bb-fcca2914bd39">(可能性の例)</semx>
2902
+ </fmt-name>
2903
+ -->
2904
+ <!-- <xsl:template match="jis:example[contains(normalize-space(jis:fmt-name), ' — ')]" mode="update_xml_step1"> -->
2905
+ <xsl:template match="jis:example[jis:fmt-name[contains(jis:span/text(), ' — ')]]" mode="update_xml_step1">
2893
2906
  <xsl:copy>
2894
2907
  <xsl:copy-of select="@*"/>
2895
- <xsl:element name="p" namespace="https://www.metanorma.org/ns/jis">
2896
- <xsl:value-of select="substring-after(jis:name/text()[1], ' — ')"/>
2897
- <xsl:apply-templates select="jis:name/text()[1]/following-sibling::node()" mode="update_xml_step1"/>
2908
+ <xsl:element name="p" namespace="{$namespace_full}">
2909
+ <!-- <xsl:variable name="example_name">
2910
+ <xsl:apply-templates select="jis:fmt-name" mode="update_xml_step1"/>
2911
+ </xsl:variable>
2912
+ <xsl:value-of select="substring-after(xalan:nodeset($example_name)/jis:name/text()[1], ' — ')"/>
2913
+ <xsl:apply-templates select="xalan:nodeset($example_name)/jis:name/text()[1]/following-sibling::node()" mode="update_xml_step1"/> -->
2914
+ <xsl:apply-templates select="jis:fmt-name/jis:span[contains(., ' — ')][1]/following-sibling::node()" mode="update_xml_step1"/>
2898
2915
  </xsl:element>
2899
2916
  <xsl:apply-templates mode="update_xml_step1"/>
2900
2917
  </xsl:copy>
2901
2918
  </xsl:template>
2902
- <xsl:template match="jis:example/jis:name[contains(text(), ' — ')]" mode="update_xml_step1">
2903
- <xsl:copy>
2919
+ <!-- <xsl:template match="jis:example/jis:fmt-name[contains(normalize-space(), ' — ')]" mode="update_xml_step1"> -->
2920
+ <xsl:template match="jis:example/jis:fmt-name[contains(jis:span/text(), ' — ')]" mode="update_xml_step1" priority="2">
2921
+ <xsl:element name="name" namespace="{$namespace_full}">
2904
2922
  <xsl:copy-of select="@*"/>
2905
- <xsl:apply-templates select="text()[1]" mode="update_xml_step1"/>
2906
- </xsl:copy>
2923
+ <!-- <xsl:variable name="example_name">
2924
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
2925
+ </xsl:variable>
2926
+ <xsl:apply-templates select="xalan:nodeset($example_name)//text()[1]" mode="update_xml_step1"/>
2927
+ -->
2928
+ <xsl:apply-templates select="*[1]" mode="update_xml_step1"/>
2929
+ </xsl:element>
2907
2930
  </xsl:template>
2908
- <xsl:template match="jis:example/jis:name/text()" mode="update_xml_step1">
2909
- <xsl:variable name="example_name">
2910
- <xsl:choose>
2931
+ <xsl:template match="jis:example/jis:fmt-name//text()" mode="update_xml_step1">
2932
+ <xsl:variable name="example_name" select="."/>
2933
+ <!-- <xsl:choose>
2911
2934
  <xsl:when test="contains(., ' — ')"><xsl:value-of select="substring-before(., ' — ')"/></xsl:when>
2912
2935
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2913
2936
  </xsl:choose>
2914
- </xsl:variable>
2915
-
2937
+ </xsl:variable> -->
2916
2938
  <xsl:choose>
2917
2939
  <xsl:when test="$vertical_layout = 'true'">
2918
2940
  <xsl:call-template name="enclose_text_in_vertical_tag">
@@ -2927,7 +2949,7 @@
2927
2949
  </xsl:choose>
2928
2950
  </xsl:template>
2929
2951
 
2930
- <xsl:template match="jis:eref//text()" mode="update_xml_step1">
2952
+ <xsl:template match="jis:fmt-eref//text()" mode="update_xml_step1">
2931
2953
  <xsl:choose>
2932
2954
  <xsl:when test="$vertical_layout = 'true'">
2933
2955
  <xsl:call-template name="enclose_text_in_vertical_tag"/>
@@ -2968,7 +2990,6 @@
2968
2990
  <xsl:apply-templates mode="update_xml_step1"/>
2969
2991
  </xsl:template>
2970
2992
  <xsl:template match="jis:strong/text()" priority="2" mode="update_xml_step1">
2971
-
2972
2993
  <xsl:choose>
2973
2994
  <xsl:when test="$vertical_layout = 'true'">
2974
2995
  <xsl:call-template name="enclose_text_in_vertical_tag"/>
@@ -5539,21 +5560,21 @@
5539
5560
 
5540
5561
  <xsl:variable name="namespace_full_">
5541
5562
  <xsl:choose>
5542
- <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="namespace-uri(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
5543
- <xsl:otherwise><xsl:value-of select="namespace-uri(/*)"/></xsl:otherwise><!-- example: https://www.metanorma.org/ns/iso -->
5563
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="namespace-uri(//*[local-name() = 'metanorma'][1])"/></xsl:when>
5564
+ <xsl:otherwise><xsl:value-of select="namespace-uri(/*)"/></xsl:otherwise><!-- example: https://www.metanorma.org/ns/standoc -->
5544
5565
  </xsl:choose>
5545
5566
  </xsl:variable>
5546
5567
  <xsl:variable name="namespace_full" select="normalize-space($namespace_full_)"/>
5547
5568
 
5548
5569
  <xsl:variable name="root_element_">
5549
5570
  <xsl:choose>
5550
- <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="local-name(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
5551
- <xsl:otherwise><xsl:value-of select="local-name(/*)"/></xsl:otherwise><!-- example: iso-standard -->
5571
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="local-name(//*[local-name() = 'metanorma'][1])"/></xsl:when>
5572
+ <xsl:otherwise><xsl:value-of select="local-name(/*)"/></xsl:otherwise><!-- example: metanorma (former iso-standard) -->
5552
5573
  </xsl:choose>
5553
5574
  </xsl:variable>
5554
5575
  <xsl:variable name="root_element" select="normalize-space($root_element_)"/>
5555
5576
 
5556
- <xsl:variable name="document_scheme" select="normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
5577
+ <xsl:variable name="document_scheme" select="normalize-space(//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
5557
5578
 
5558
5579
  <!-- external parameters -->
5559
5580
 
@@ -5654,7 +5675,7 @@
5654
5675
  </metanorma-extension>
5655
5676
  -->
5656
5677
 
5657
- <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
5678
+ <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
5658
5679
  <xsl:variable name="papersize_width_">
5659
5680
  <xsl:choose>
5660
5681
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -5736,7 +5757,7 @@
5736
5757
  <xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/>
5737
5758
 
5738
5759
  <xsl:variable name="layout_columns_default">1</xsl:variable>
5739
- <xsl:variable name="layout_columns_" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'layout-columns'])"/>
5760
+ <xsl:variable name="layout_columns_" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'layout-columns'])"/>
5740
5761
  <xsl:variable name="layout_columns">
5741
5762
  <xsl:choose>
5742
5763
  <xsl:when test="$layout_columns_ != ''"><xsl:value-of select="$layout_columns_"/></xsl:when>
@@ -5797,7 +5818,7 @@
5797
5818
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
5798
5819
 
5799
5820
  <xsl:variable name="title-list-tables">
5800
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
5821
+ <xsl:variable name="toc_table_title" select="//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
5801
5822
  <xsl:value-of select="$toc_table_title"/>
5802
5823
  <xsl:if test="normalize-space($toc_table_title) = ''">
5803
5824
  <xsl:call-template name="getLocalizedString">
@@ -5807,7 +5828,7 @@
5807
5828
  </xsl:variable>
5808
5829
 
5809
5830
  <xsl:variable name="title-list-figures">
5810
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
5831
+ <xsl:variable name="toc_figure_title" select="//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
5811
5832
  <xsl:value-of select="$toc_figure_title"/>
5812
5833
  <xsl:if test="normalize-space($toc_figure_title) = ''">
5813
5834
  <xsl:call-template name="getLocalizedString">
@@ -5817,7 +5838,7 @@
5817
5838
  </xsl:variable>
5818
5839
 
5819
5840
  <xsl:variable name="title-list-recommendations">
5820
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
5841
+ <xsl:variable name="toc_requirement_title" select="//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
5821
5842
  <xsl:value-of select="$toc_requirement_title"/>
5822
5843
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
5823
5844
  <xsl:call-template name="getLocalizedString">
@@ -5827,8 +5848,8 @@
5827
5848
  </xsl:variable>
5828
5849
 
5829
5850
  <xsl:variable name="bibdata">
5830
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
5831
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
5851
+ <xsl:copy-of select="//*[local-name() = 'metanorma']/*[local-name() = 'bibdata']"/>
5852
+ <xsl:copy-of select="//*[local-name() = 'metanorma']/*[local-name() = 'localized-strings']"/>
5832
5853
  </xsl:variable>
5833
5854
 
5834
5855
  <!-- Characters -->
@@ -5893,7 +5914,7 @@
5893
5914
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
5894
5915
 
5895
5916
  <xsl:variable name="additional_fonts_">
5896
- <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
5917
+ <xsl:for-each select="//*[local-name() = 'metanorma'][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[local-name() = 'metanorma'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
5897
5918
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
5898
5919
  </xsl:for-each>
5899
5920
  </xsl:variable>
@@ -7315,10 +7336,10 @@
7315
7336
 
7316
7337
  <xsl:template name="processTablesFigures_Contents">
7317
7338
  <xsl:param name="always"/>
7318
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
7339
+ <xsl:if test="(//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
7319
7340
  <xsl:call-template name="processTables_Contents"/>
7320
7341
  </xsl:if>
7321
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
7342
+ <xsl:if test="(//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
7322
7343
  <xsl:call-template name="processFigures_Contents"/>
7323
7344
  </xsl:if>
7324
7345
  </xsl:template>
@@ -7398,7 +7419,7 @@
7398
7419
  </xsl:template><!-- END: processMainSectionsDefault -->
7399
7420
 
7400
7421
  <!-- Example:
7401
- <iso-standard>
7422
+ <metanorma>
7402
7423
  <preface>
7403
7424
  <page_sequence>
7404
7425
  <clause...
@@ -7421,7 +7442,7 @@
7421
7442
  <page_sequence>
7422
7443
  <annex ..
7423
7444
  </page_sequence>
7424
- </iso-standard>
7445
+ </metanorma>
7425
7446
  -->
7426
7447
  <xsl:template name="processPrefaceAndMainSectionsDefault_items">
7427
7448
 
@@ -7464,15 +7485,8 @@
7464
7485
  </xsl:template> <!-- END: insertPrefaceSectionsPageSequences -->
7465
7486
 
7466
7487
  <xsl:template name="insertMainSectionsPageSequences">
7467
- <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
7468
- <xsl:element name="page_sequence" namespace="{$namespace_full}">
7469
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
7470
- <xsl:sort select="@displayorder" data-type="number"/>
7471
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
7472
7488
 
7473
- </xsl:for-each>
7474
- </xsl:element>
7475
- </xsl:element>
7489
+ <xsl:call-template name="insertSectionsInPageSequence"/>
7476
7490
 
7477
7491
  <xsl:element name="page_sequence" namespace="{$namespace_full}">
7478
7492
  <xsl:for-each select="/*/*[local-name()='annex']">
@@ -7491,6 +7505,18 @@
7491
7505
  </xsl:element>
7492
7506
  </xsl:template> <!-- END: insertMainSectionsPageSequences -->
7493
7507
 
7508
+ <xsl:template name="insertSectionsInPageSequence">
7509
+ <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
7510
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
7511
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
7512
+ <xsl:sort select="@displayorder" data-type="number"/>
7513
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
7514
+
7515
+ </xsl:for-each>
7516
+ </xsl:element>
7517
+ </xsl:element>
7518
+ </xsl:template>
7519
+
7494
7520
  <xsl:template name="insertMainSectionsInSeparatePageSequences">
7495
7521
  <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
7496
7522
  <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
@@ -9002,7 +9028,7 @@
9002
9028
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9003
9029
 
9004
9030
  <xsl:variable name="gen_id" select="generate-id(.)"/>
9005
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9031
+ <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9006
9032
  <xsl:variable name="reference_">
9007
9033
  <xsl:value-of select="@reference"/>
9008
9034
  <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
@@ -9188,13 +9214,13 @@
9188
9214
  footnotes in bibliography
9189
9215
  footnotes in document's body (except table's head/body/foot and figure text)
9190
9216
  -->
9191
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
9217
+ <xsl:for-each select="ancestor::*[local-name() = 'metanorma']/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
9192
9218
  <fn gen_id="{generate-id(.)}">
9193
9219
  <xsl:copy-of select="@*"/>
9194
9220
  <xsl:copy-of select="node()"/>
9195
9221
  </fn>
9196
9222
  </xsl:for-each>
9197
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='bibliography']/*">
9223
+ <xsl:for-each select="ancestor::*[local-name() = 'metanorma']/*[local-name()='boilerplate']/* | ancestor::*[local-name() = 'metanorma']//*[local-name()='preface']/* | ancestor::*[local-name() = 'metanorma']//*[local-name()='sections']/* | ancestor::*[local-name() = 'metanorma']//*[local-name()='annex'] | ancestor::*[local-name() = 'metanorma']//*[local-name()='bibliography']/*">
9198
9224
  <xsl:sort select="@displayorder" data-type="number"/>
9199
9225
  <!-- commented:
9200
9226
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
@@ -11591,6 +11617,8 @@
11591
11617
  <!-- ======================================= -->
11592
11618
  <!-- math -->
11593
11619
  <!-- ======================================= -->
11620
+ <xsl:template match="*[local-name() = 'stem'][following-sibling::*[1][local-name() = 'fmt-stem']]"/> <!-- for tablesonly.xml generated by mn2pdf -->
11621
+
11594
11622
  <xsl:template match="mathml:math">
11595
11623
  <xsl:variable name="isAdded" select="@added"/>
11596
11624
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -11950,10 +11978,10 @@
11950
11978
  <xsl:template match="*[local-name()='localityStack']"/>
11951
11979
 
11952
11980
  <xsl:variable name="pdfAttachmentsList_">
11953
- <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
11981
+ <xsl:for-each select="//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
11954
11982
  <attachment filename="{@name}"/>
11955
11983
  </xsl:for-each>
11956
- <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
11984
+ <xsl:if test="not(//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
11957
11985
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
11958
11986
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
11959
11987
  <attachment filename="{$attachment_path}"/>
@@ -13438,7 +13466,9 @@
13438
13466
  <xsl:apply-templates mode="bookmarks"/>
13439
13467
  </xsl:template>
13440
13468
 
13441
- <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">
13469
+ <xsl:template match="*[local-name() = 'stem']" mode="contents"/>
13470
+
13471
+ <xsl:template match="*[local-name() = 'title' or local-name() = 'name' or local-name() = 'fmt-title' or local-name() = 'fmt-name']//*[local-name() = 'fmt-stem']" mode="contents">
13442
13472
  <xsl:apply-templates select="."/>
13443
13473
  </xsl:template>
13444
13474
 
@@ -13455,7 +13485,15 @@
13455
13485
  <xsl:apply-templates mode="contents"/>
13456
13486
  </xsl:template>
13457
13487
 
13458
- <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
13488
+ <xsl:template match="*[local-name() = 'concept']" mode="contents"/>
13489
+ <xsl:template match="*[local-name() = 'eref']" mode="contents"/>
13490
+ <xsl:template match="*[local-name() = 'xref']" mode="contents"/>
13491
+ <xsl:template match="*[local-name() = 'link']" mode="contents"/>
13492
+ <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
13493
+ <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
13494
+
13495
+ <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
13496
+ <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
13459
13497
  <xsl:apply-templates mode="bookmarks"/>
13460
13498
  </xsl:template>
13461
13499
 
@@ -13468,6 +13506,13 @@
13468
13506
  <xsl:apply-templates mode="bookmarks"/>
13469
13507
  </xsl:template>
13470
13508
 
13509
+ <xsl:template match="*[local-name() = 'concept']" mode="bookmarks"/>
13510
+ <xsl:template match="*[local-name() = 'eref']" mode="bookmarks"/>
13511
+ <xsl:template match="*[local-name() = 'xref']" mode="bookmarks"/>
13512
+ <xsl:template match="*[local-name() = 'link']" mode="bookmarks"/>
13513
+ <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
13514
+ <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
13515
+
13471
13516
  <!-- Bookmarks -->
13472
13517
  <xsl:template name="addBookmarks">
13473
13518
  <xsl:param name="contents"/>
@@ -13752,6 +13797,13 @@
13752
13797
 
13753
13798
  <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="contents_item"/>
13754
13799
 
13800
+ <xsl:template match="*[local-name() = 'concept']" mode="contents_item"/>
13801
+ <xsl:template match="*[local-name() = 'eref']" mode="contents_item"/>
13802
+ <xsl:template match="*[local-name() = 'xref']" mode="contents_item"/>
13803
+ <xsl:template match="*[local-name() = 'link']" mode="contents_item"/>
13804
+ <xsl:template match="*[local-name() = 'origin']" mode="contents_item"/>
13805
+ <xsl:template match="*[local-name() = 'erefstack ']" mode="contents_item"/>
13806
+
13755
13807
  <xsl:template name="getSection">
13756
13808
  <xsl:choose>
13757
13809
  <xsl:when test="*[local-name() = 'fmt-title']">
@@ -13871,7 +13923,8 @@
13871
13923
  </xsl:copy>
13872
13924
  </xsl:template>
13873
13925
 
13874
- <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
13926
+ <xsl:template match="*[local-name() = 'stem']" mode="contents_item"/>
13927
+ <xsl:template match="*[local-name() = 'fmt-stem']" mode="contents_item">
13875
13928
  <xsl:copy-of select="."/>
13876
13929
  </xsl:template>
13877
13930
 
@@ -13935,7 +13988,7 @@
13935
13988
  <!-- sourcecode -->
13936
13989
  <!-- =============== -->
13937
13990
 
13938
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
13991
+ <xsl:variable name="source-highlighter-css_" select="//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
13939
13992
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
13940
13993
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
13941
13994
 
@@ -15354,7 +15407,7 @@
15354
15407
 
15355
15408
  </xsl:template> <!-- sections_element_style -->
15356
15409
 
15357
- <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2" name="preface_node"> <!-- /*/*[local-name() = 'preface']/* -->
15410
+ <xsl:template match="//*[local-name() = 'metanorma']/*[local-name() = 'preface']/*" priority="2" name="preface_node"> <!-- /*/*[local-name() = 'preface']/* -->
15358
15411
 
15359
15412
  <fo:block break-after="page"/>
15360
15413
 
@@ -15458,7 +15511,7 @@
15458
15511
  <fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
15459
15512
  </xsl:when>
15460
15513
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
15461
- <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
15514
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
15462
15515
  <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
15463
15516
  </xsl:when>
15464
15517
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
@@ -16839,7 +16892,7 @@
16839
16892
  <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
16840
16893
 
16841
16894
  <!-- move section 'Normative references' inside 'sections' -->
16842
- <xsl:for-each select="* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
16895
+ <xsl:for-each select="* | ancestor::*[local-name() = 'metanorma']/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | ancestor::*[local-name() = 'metanorma']/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
16843
16896
  <xsl:sort select="@displayorder" data-type="number"/>
16844
16897
 
16845
16898
  <!-- process Section's title -->
@@ -16900,10 +16953,126 @@
16900
16953
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
16901
16954
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
16902
16955
 
16903
- <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">
16956
+ <xsl:template match="*[local-name() = 'stem']" mode="update_xml_step1"/>
16957
+ <xsl:template match="*[local-name() = 'stem']" mode="update_xml_pres"/>
16958
+
16959
+ <xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_step1">
16960
+ <xsl:element name="stem" namespace="{$namespace_full}">
16961
+ <xsl:copy-of select="@*"/>
16962
+ <xsl:choose>
16963
+ <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
16964
+ <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
16965
+ </xsl:when>
16966
+ <xsl:otherwise>
16967
+ <xsl:copy-of select="node()"/>
16968
+ </xsl:otherwise>
16969
+ </xsl:choose>
16970
+ </xsl:element>
16971
+ </xsl:template>
16972
+ <xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_pres">
16973
+ <xsl:element name="stem" namespace="{$namespace_full}">
16974
+ <xsl:copy-of select="@*"/>
16975
+ <xsl:choose>
16976
+ <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
16977
+ <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
16978
+ </xsl:when>
16979
+ <xsl:otherwise>
16980
+ <xsl:copy-of select="node()"/>
16981
+ </xsl:otherwise>
16982
+ </xsl:choose>
16983
+ </xsl:element>
16984
+ </xsl:template>
16985
+
16986
+ <xsl:template match="*[local-name() = 'image'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'bibdata'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
16904
16987
  <xsl:copy-of select="."/>
16905
16988
  </xsl:template>
16906
16989
 
16990
+ <!-- https://github.com/metanorma/isodoc/issues/651 -->
16991
+ <!-- *[local-name() = 'sourcecode'][not(.//*[local-name() = 'passthrough']) and not(.//*[local-name() = 'fmt-name'])] -->
16992
+ <xsl:template match="*[local-name() = 'sourcecode']" mode="update_xml_step1">
16993
+ <xsl:copy>
16994
+ <xsl:copy-of select="@*"/>
16995
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
16996
+ <xsl:choose>
16997
+ <xsl:when test="*[local-name() = 'fmt-sourcecode']">
16998
+ <xsl:choose>
16999
+ <xsl:when test="*[local-name() = 'fmt-sourcecode'][not(.//*[local-name() = 'passthrough'])] and not(.//*[local-name() = 'fmt-name'])">
17000
+ <xsl:copy-of select="*[local-name() = 'fmt-sourcecode']/node()"/>
17001
+ </xsl:when>
17002
+ <xsl:otherwise>
17003
+ <xsl:apply-templates select="*[local-name() = 'fmt-sourcecode']/node()" mode="update_xml_step1"/>
17004
+ </xsl:otherwise>
17005
+ </xsl:choose>
17006
+ </xsl:when>
17007
+ <xsl:otherwise> <!-- If fmt-sourcecode is not present -->
17008
+ <xsl:choose>
17009
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[local-name() = 'fmt-name'])">
17010
+ <xsl:copy-of select="node()"/>
17011
+ </xsl:when>
17012
+ <xsl:otherwise>
17013
+ <xsl:apply-templates select="node()[not(local-name() = 'fmt-name')]" mode="update_xml_step1"/>
17014
+ </xsl:otherwise>
17015
+ </xsl:choose>
17016
+ </xsl:otherwise>
17017
+ </xsl:choose>
17018
+ </xsl:copy>
17019
+ </xsl:template>
17020
+ <xsl:template match="*[local-name() = 'sourcecode']" mode="update_xml_pres">
17021
+ <xsl:copy>
17022
+ <xsl:copy-of select="@*"/>
17023
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_pres"/>
17024
+ <xsl:choose>
17025
+ <xsl:when test="*[local-name() = 'fmt-sourcecode']">
17026
+ <xsl:choose>
17027
+ <xsl:when test="*[local-name() = 'fmt-sourcecode'][not(.//*[local-name() = 'passthrough'])] and not(.//*[local-name() = 'fmt-name'])">
17028
+ <xsl:copy-of select="*[local-name() = 'fmt-sourcecode']/node()"/>
17029
+ </xsl:when>
17030
+ <xsl:otherwise>
17031
+ <xsl:apply-templates select="*[local-name() = 'fmt-sourcecode']/node()" mode="update_xml_pres"/>
17032
+ </xsl:otherwise>
17033
+ </xsl:choose>
17034
+ </xsl:when>
17035
+ <xsl:otherwise> <!-- If fmt-sourcecode is not present -->
17036
+ <xsl:choose>
17037
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[local-name() = 'fmt-name'])">
17038
+ <xsl:copy-of select="node()"/>
17039
+ </xsl:when>
17040
+ <xsl:otherwise>
17041
+ <xsl:apply-templates select="node()[not(local-name() = 'fmt-name')]" mode="update_xml_pres"/>
17042
+ </xsl:otherwise>
17043
+ </xsl:choose>
17044
+ </xsl:otherwise>
17045
+ </xsl:choose>
17046
+ </xsl:copy>
17047
+ </xsl:template>
17048
+
17049
+ <!-- https://github.com/metanorma/isodoc/issues/651 -->
17050
+ <xsl:template match="*[local-name() = 'figure'][*[local-name() = 'fmt-figure']]" mode="update_xml_step1" priority="2">
17051
+ <xsl:copy>
17052
+ <xsl:copy-of select="@*"/>
17053
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
17054
+ <xsl:apply-templates select="*[local-name() = 'fmt-figure']/node()" mode="update_xml_step1"/>
17055
+ </xsl:copy>
17056
+ </xsl:template>
17057
+ <xsl:template match="*[local-name() = 'figure'][*[local-name() = 'fmt-figure']]" mode="update_xml_pres" priority="2">
17058
+ <xsl:copy>
17059
+ <xsl:copy-of select="@*"/>
17060
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_pres"/>
17061
+ <xsl:apply-templates select="*[local-name() = 'fmt-figure']/node()" mode="update_xml_pres"/>
17062
+ </xsl:copy>
17063
+ </xsl:template>
17064
+
17065
+ <!-- https://github.com/metanorma/isodoc/issues/652 -->
17066
+ <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'source']"/>
17067
+ <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'author']"/>
17068
+ <xsl:template match="*[local-name() = 'amend']"/>
17069
+ <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'source']" mode="update_xml_step1"/>
17070
+ <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'author']" mode="update_xml_step1"/>
17071
+ <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'source']" mode="update_xml_pres"/>
17072
+ <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'author']" mode="update_xml_pres"/>
17073
+ <xsl:template match="*[local-name() = 'amend']" mode="update_xml_step1"/>
17074
+ <xsl:template match="*[local-name() = 'amend']" mode="update_xml_pres"/>
17075
+
16907
17076
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
16908
17077
  <xsl:copy>
16909
17078
  <xsl:copy-of select="@*"/>
@@ -16934,7 +17103,7 @@
16934
17103
  <!-- add @id - first element with @id plus '_element_name' -->
16935
17104
  <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
16936
17105
  <xsl:variable name="prefix_id"><xsl:value-of select="$prefix_id_"/><xsl:if test="normalize-space($prefix_id_) = ''"><xsl:value-of select="generate-id()"/></xsl:if></xsl:variable>
16937
- <xsl:variable name="document_suffix" select="ancestor::*[contains(local-name(), '-standard')]/@document_suffix"/>
17106
+ <xsl:variable name="document_suffix" select="ancestor::*[local-name() = 'metanorma']/@document_suffix"/>
16938
17107
  <xsl:attribute name="id"><xsl:value-of select="concat($prefix_id, '_', local-name(), '_', $document_suffix)"/></xsl:attribute>
16939
17108
  </xsl:if>
16940
17109
  </xsl:template>
@@ -17184,6 +17353,126 @@
17184
17353
  <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_step1"/>
17185
17354
  <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_pres"/>
17186
17355
 
17356
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="update_xml_step1">
17357
+ <xsl:apply-templates mode="update_xml_step1"/>
17358
+ </xsl:template>
17359
+
17360
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="update_xml_pres">
17361
+ <xsl:apply-templates mode="update_xml_pres"/>
17362
+ </xsl:template>
17363
+
17364
+ <xsl:template match="*[local-name() = 'requirement']/*[not(starts-with(local-name(), 'fmt-'))] | *[local-name() = 'recommendation']/*[not(starts-with(local-name(), 'fmt-'))] | *[local-name() = 'permission']/*[not(starts-with(local-name(), 'fmt-'))]" mode="update_xml_step1"/>
17365
+
17366
+ <xsl:template match="*[local-name() = 'requirement']/*[not(starts-with(local-name(), 'fmt-'))] | *[local-name() = 'recommendation']/*[not(starts-with(local-name(), 'fmt-'))] | *[local-name() = 'permission']/*[not(starts-with(local-name(), 'fmt-'))]" mode="update_xml_pres"/>
17367
+
17368
+ <xsl:template match="*[local-name() = 'fmt-provision']" mode="update_xml_step1">
17369
+ <xsl:apply-templates mode="update_xml_step1"/>
17370
+ </xsl:template>
17371
+ <xsl:template match="*[local-name() = 'fmt-provision']" mode="update_xml_pres">
17372
+ <xsl:apply-templates mode="update_xml_pres"/>
17373
+ </xsl:template>
17374
+
17375
+ <xsl:template match="*[local-name() = 'identifier']" mode="update_xml_step1"/>
17376
+ <xsl:template match="*[local-name() = 'identifier']" mode="update_xml_pres"/>
17377
+ <xsl:template match="*[local-name() = 'fmt-identifier']" mode="update_xml_step1">
17378
+ <xsl:element name="identifier" namespace="{$namespace_full}">
17379
+ <xsl:copy-of select="@*"/>
17380
+ <xsl:apply-templates mode="update_xml_step1"/>
17381
+ </xsl:element>
17382
+ </xsl:template>
17383
+ <xsl:template match="*[local-name() = 'fmt-identifier']" mode="update_xml_pres">
17384
+ <xsl:element name="identifier" namespace="{$namespace_full}">
17385
+ <xsl:copy-of select="@*"/>
17386
+ <xsl:apply-templates mode="update_xml_pres"/>
17387
+ </xsl:element>
17388
+ </xsl:template>
17389
+
17390
+ <xsl:template match="*[local-name() = 'concept']"/>
17391
+ <xsl:template match="*[local-name() = 'concept']" mode="update_xml_step1"/>
17392
+ <xsl:template match="*[local-name() = 'concept']" mode="update_xml_pres"/>
17393
+
17394
+ <xsl:template match="*[local-name() = 'fmt-concept']">
17395
+ <xsl:apply-templates/>
17396
+ </xsl:template>
17397
+ <xsl:template match="*[local-name() = 'fmt-concept']" mode="update_xml_step1">
17398
+ <xsl:apply-templates mode="update_xml_step1"/>
17399
+ </xsl:template>
17400
+ <xsl:template match="*[local-name() = 'fmt-concept']" mode="update_xml_pres">
17401
+ <xsl:apply-templates mode="update_xml_pres"/>
17402
+ </xsl:template>
17403
+
17404
+ <xsl:template match="*[local-name() = 'eref']" mode="update_xml_step1"/>
17405
+ <xsl:template match="*[local-name() = 'eref']" mode="update_xml_pres"/>
17406
+
17407
+ <xsl:template match="*[local-name() = 'fmt-eref']" mode="update_xml_step1">
17408
+ <xsl:element name="eref" namespace="{$namespace_full}">
17409
+ <xsl:copy-of select="@*"/>
17410
+ <xsl:apply-templates mode="update_xml_step1"/>
17411
+ </xsl:element>
17412
+ </xsl:template>
17413
+ <xsl:template match="*[local-name() = 'fmt-eref']" mode="update_xml_pres">
17414
+ <xsl:element name="eref" namespace="{$namespace_full}">
17415
+ <xsl:copy-of select="@*"/>
17416
+ <xsl:apply-templates mode="update_xml_pres"/>
17417
+ </xsl:element>
17418
+ </xsl:template>
17419
+
17420
+ <xsl:template match="*[local-name() = 'xref']" mode="update_xml_step1"/>
17421
+ <xsl:template match="*[local-name() = 'xref']" mode="update_xml_pres"/>
17422
+
17423
+ <xsl:template match="*[local-name() = 'fmt-xref']" mode="update_xml_step1">
17424
+ <xsl:element name="xref" namespace="{$namespace_full}">
17425
+ <xsl:copy-of select="@*"/>
17426
+ <xsl:apply-templates mode="update_xml_step1"/>
17427
+ </xsl:element>
17428
+ </xsl:template>
17429
+ <xsl:template match="*[local-name() = 'fmt-xref']" mode="update_xml_pres">
17430
+ <xsl:element name="xref" namespace="{$namespace_full}">
17431
+ <xsl:copy-of select="@*"/>
17432
+ <xsl:apply-templates mode="update_xml_pres"/>
17433
+ </xsl:element>
17434
+ </xsl:template>
17435
+
17436
+ <xsl:template match="*[local-name() = 'link']" mode="update_xml_step1"/>
17437
+ <xsl:template match="*[local-name() = 'link']" mode="update_xml_pres"/>
17438
+
17439
+ <xsl:template match="*[local-name() = 'fmt-link']" mode="update_xml_step1">
17440
+ <xsl:element name="link" namespace="{$namespace_full}">
17441
+ <xsl:copy-of select="@*"/>
17442
+ <xsl:apply-templates mode="update_xml_step1"/>
17443
+ </xsl:element>
17444
+ </xsl:template>
17445
+ <xsl:template match="*[local-name() = 'fmt-link']" mode="update_xml_pres">
17446
+ <xsl:element name="link" namespace="{$namespace_full}">
17447
+ <xsl:copy-of select="@*"/>
17448
+ <xsl:apply-templates mode="update_xml_pres"/>
17449
+ </xsl:element>
17450
+ </xsl:template>
17451
+
17452
+ <xsl:template match="*[local-name() = 'origin']" mode="update_xml_step1"/>
17453
+ <xsl:template match="*[local-name() = 'origin']" mode="update_xml_pres"/>
17454
+
17455
+ <xsl:template match="*[local-name() = 'fmt-origin']" mode="update_xml_step1">
17456
+ <xsl:element name="origin" namespace="{$namespace_full}">
17457
+ <xsl:copy-of select="@*"/>
17458
+ <xsl:apply-templates mode="update_xml_step1"/>
17459
+ </xsl:element>
17460
+ </xsl:template>
17461
+ <xsl:template match="*[local-name() = 'fmt-origin']" mode="update_xml_pres">
17462
+ <xsl:element name="origin" namespace="{$namespace_full}">
17463
+ <xsl:copy-of select="@*"/>
17464
+ <xsl:apply-templates mode="update_xml_pres"/>
17465
+ </xsl:element>
17466
+ </xsl:template>
17467
+
17468
+ <xsl:template match="*[local-name() = 'erefstack']"/>
17469
+ <xsl:template match="*[local-name() = 'erefstack']" mode="update_xml_step1"/>
17470
+ <xsl:template match="*[local-name() = 'erefstack']" mode="update_xml_pres"/>
17471
+
17472
+ <xsl:template match="*[local-name() = 'svgmap']"/>
17473
+ <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
17474
+ <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
17475
+
17187
17476
  <!-- END: update new Presentation XML -->
17188
17477
 
17189
17478
  <!-- =========================================================================== -->
@@ -17256,7 +17545,7 @@
17256
17545
 
17257
17546
  <xsl:choose>
17258
17547
  <xsl:when test="$page_sequence_at_top = 'true'">
17259
- <xsl:for-each select="ancestor::*[ancestor::*[contains(local-name(), '-standard')]]">
17548
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'metanorma']]">
17260
17549
  <element pos="{position()}">
17261
17550
  <xsl:copy-of select="@*[local-name() != 'id']"/>
17262
17551
  <xsl:value-of select="name()"/>
@@ -17788,7 +18077,7 @@
17788
18077
  </xsl:when>
17789
18078
  <xsl:when test="contains($text, $replace)">
17790
18079
  <xsl:value-of select="substring-before($text,$replace)"/>
17791
- <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
18080
+ <xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/standoc"><xsl:value-of select="$by"/></xsl:element>
17792
18081
  <xsl:call-template name="replaceChar">
17793
18082
  <xsl:with-param name="text" select="substring-after($text,$replace)"/>
17794
18083
  <xsl:with-param name="replace" select="$replace"/>
@@ -17825,7 +18114,7 @@
17825
18114
  </xsl:variable>
17826
18115
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
17827
18116
  <xsl:variable name="gen_id" select="generate-id(.)"/>
17828
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
18117
+ <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
17829
18118
  <xsl:variable name="reference" select="@reference"/>
17830
18119
  <!-- fn sequence number in document -->
17831
18120
  <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
@@ -17873,7 +18162,7 @@
17873
18162
  </xsl:template>
17874
18163
 
17875
18164
  <xsl:template name="printEdition">
17876
- <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
18165
+ <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
17877
18166
 
17878
18167
  <xsl:choose>
17879
18168
  <xsl:when test="$edition_i18n != ''">
@@ -17883,7 +18172,7 @@
17883
18172
  </xsl:call-template>
17884
18173
  </xsl:when>
17885
18174
  <xsl:otherwise>
17886
- <xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
18175
+ <xsl:variable name="edition" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
17887
18176
  <xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
17888
18177
  <xsl:call-template name="capitalize">
17889
18178
  <xsl:with-param name="str">
@@ -18017,7 +18306,7 @@
18017
18306
  <xsl:param name="charDelim" select="', '"/>
18018
18307
  <xsl:choose>
18019
18308
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
18020
- <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
18309
+ <xsl:for-each select="//*[local-name() = 'metanorma']/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
18021
18310
  <xsl:sort data-type="text" order="ascending"/>
18022
18311
  <xsl:call-template name="insertKeyword">
18023
18312
  <xsl:with-param name="meta" select="$meta"/>
@@ -18027,7 +18316,7 @@
18027
18316
  </xsl:for-each>
18028
18317
  </xsl:when>
18029
18318
  <xsl:otherwise>
18030
- <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
18319
+ <xsl:for-each select="//*[local-name() = 'metanorma']/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
18031
18320
  <xsl:call-template name="insertKeyword">
18032
18321
  <xsl:with-param name="meta" select="$meta"/>
18033
18322
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -18102,7 +18391,7 @@
18102
18391
  <!-- Dublin Core properties go here -->
18103
18392
  <dc:title>
18104
18393
  <xsl:variable name="title">
18105
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
18394
+ <xsl:for-each select="(//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']">
18106
18395
 
18107
18396
  <xsl:choose>
18108
18397
  <xsl:when test="*[local-name() = 'title'][@language = $lang and @type = 'main']">
@@ -18129,7 +18418,7 @@
18129
18418
  </rdf:Alt>
18130
18419
  </dc:title>
18131
18420
  <xsl:variable name="dc_creator">
18132
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
18421
+ <xsl:for-each select="(//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']">
18133
18422
 
18134
18423
  <rdf:Seq>
18135
18424
  <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
@@ -18151,7 +18440,7 @@
18151
18440
  <xsl:variable name="dc_description">
18152
18441
  <xsl:variable name="abstract">
18153
18442
 
18154
- <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'])]"/>
18443
+ <xsl:copy-of select="//*[local-name() = 'metanorma']/*[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'])]"/>
18155
18444
 
18156
18445
  </xsl:variable>
18157
18446
  <rdf:Alt>
@@ -18179,7 +18468,7 @@
18179
18468
  </rdf:RDF>
18180
18469
  </x:xmpmeta>
18181
18470
  <!-- add attachments -->
18182
- <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
18471
+ <xsl:for-each select="//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
18183
18472
  <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
18184
18473
  <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
18185
18474
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
@@ -18213,7 +18502,7 @@
18213
18502
  </pdf:embedded-file>
18214
18503
  </xsl:for-each>
18215
18504
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
18216
- <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
18505
+ <xsl:if test="not(//*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
18217
18506
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
18218
18507
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
18219
18508
  <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
@@ -18415,9 +18704,9 @@
18415
18704
  <xsl:variable name="XSLNS">
18416
18705
 
18417
18706
  </xsl:variable>
18418
- <xsl:if test="$documentNS != $XSLNS">
18707
+ <!-- <xsl:if test="$documentNS != $XSLNS">
18419
18708
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
18420
- </xsl:if>
18709
+ </xsl:if> -->
18421
18710
  </xsl:template> <!-- namespaceCheck -->
18422
18711
 
18423
18712
  <xsl:template name="getLanguage">
@@ -18496,10 +18785,10 @@
18496
18785
 
18497
18786
  <xsl:variable name="data_value">
18498
18787
  <xsl:choose>
18499
- <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
18788
+ <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != 0">
18500
18789
  <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
18501
18790
  </xsl:when>
18502
- <xsl:when test="string-length($bibdata_updated) != ''">
18791
+ <xsl:when test="string-length($bibdata_updated) != 0">
18503
18792
  <xsl:value-of select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
18504
18793
  </xsl:when>
18505
18794
  <xsl:when test="$formatted = 'true'">
@@ -18637,7 +18926,7 @@
18637
18926
  <!-- background image -->
18638
18927
  <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage{$suffix}_{$name}_{$number}_{generate-id()}">
18639
18928
  <fo:block>
18640
- <xsl:for-each select="/*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = $name][1]/*[local-name() = 'value']/*[local-name() = 'image'][$num]">
18929
+ <xsl:for-each select="/*[local-name() = 'metanorma']/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = $name][1]/*[local-name() = 'value']/*[local-name() = 'image'][$num]">
18641
18930
  <xsl:choose>
18642
18931
  <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
18643
18932
  <fo:instream-foreign-object fox:alt-text="Image Front">