metanorma-bipm 1.2.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@
14
14
 
15
15
 
16
16
 
17
- <xsl:key name="kfn" match="*[local-name()='p']/*[local-name()='fn']" use="@reference"/>
17
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
18
18
 
19
19
 
20
20
 
@@ -185,12 +185,21 @@
185
185
  <!-- internal cover page -->
186
186
  <fo:simple-page-master master-name="internal-cover-page-jcgm" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
187
187
  <fo:region-body margin-top="11mm" margin-bottom="21mm" margin-left="25mm" margin-right="19mm"/>
188
- <fo:region-before extent="11mm"/>
188
+ <fo:region-before region-name="header" extent="11mm"/>
189
189
  <fo:region-after region-name="internal-cover-page-jcgm-footer" extent="21mm"/>
190
190
  <fo:region-start extent="25mm"/>
191
191
  <fo:region-end extent="19mm"/>
192
192
  </fo:simple-page-master>
193
193
 
194
+ <!-- blank page -->
195
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
196
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
197
+ <fo:region-before region-name="header-blank" extent="{$marginTop}mm"/>
198
+ <fo:region-after region-name="footer-blank" extent="{$marginBottom}mm"/>
199
+ <fo:region-start region-name="left-region" extent="17mm"/>
200
+ <fo:region-end region-name="right-region" extent="26.5mm"/>
201
+ </fo:simple-page-master>
202
+
194
203
  <fo:simple-page-master master-name="odd-jcgm" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
195
204
  <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
196
205
  <fo:region-before region-name="header-odd-jcgm" extent="{$marginTop}mm"/> <!-- display-align="center" -->
@@ -207,6 +216,7 @@
207
216
  </fo:simple-page-master>
208
217
  <fo:page-sequence-master master-name="document-jcgm">
209
218
  <fo:repeatable-page-master-alternatives>
219
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
210
220
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-jcgm"/>
211
221
  <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-jcgm"/>
212
222
  </fo:repeatable-page-master-alternatives>
@@ -241,6 +251,7 @@
241
251
  </fo:static-content>
242
252
  <fo:flow flow-name="xsl-region-body">
243
253
  <xsl:call-template name="insert_Logo-BIPM-Metro"/>
254
+ <xsl:call-template name="insertDraftWatermark"/>
244
255
  <fo:block-container font-weight="bold">
245
256
  <fo:block font-size="16.5pt">
246
257
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:ext/jcgm:editorialgroup/jcgm:committee/@acronym"/>
@@ -286,6 +297,7 @@
286
297
  </fo:block>
287
298
  </fo:static-content>
288
299
  <fo:flow flow-name="xsl-region-body">
300
+ <xsl:call-template name="insertDraftWatermark"/>
289
301
  <fo:table table-layout="fixed" width="100%" font-size="13pt">
290
302
  <fo:table-column column-width="134mm"/>
291
303
  <fo:table-column column-width="30mm"/>
@@ -574,7 +586,7 @@
574
586
  <xsl:choose>
575
587
  <xsl:when test="ancestor-or-self::*[local-name()='annex'] and $level &gt;= 2">false</xsl:when>
576
588
  <xsl:when test="$section = '' and $type = 'clause'">false</xsl:when>
577
- <xsl:when test="$level &lt;= 3">true</xsl:when>
589
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
578
590
  <xsl:otherwise>false</xsl:otherwise>
579
591
  </xsl:choose>
580
592
  </xsl:variable>
@@ -617,8 +629,9 @@
617
629
 
618
630
  <xsl:template name="getListItemFormat">
619
631
  <xsl:choose>
620
- <xsl:when test="local-name(..) = 'ul' and ../ancestor::jcgm:ul">−</xsl:when> <!-- &#x2212; - minus sign. &#x2014; - dash -->
621
- <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- &#x2014; dash -->
632
+ <xsl:when test="local-name(..) = 'ul'">
633
+ <xsl:call-template name="setULLabel"/>
634
+ </xsl:when>
622
635
  <xsl:otherwise> <!-- for ordered lists -->
623
636
  <xsl:variable name="start_value">
624
637
  <xsl:choose>
@@ -707,101 +720,15 @@
707
720
  </xsl:if>
708
721
  </xsl:template>
709
722
 
710
-
711
- <!--
712
- <fn reference="1">
713
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
714
- </fn>
715
- -->
716
-
717
- <xsl:variable name="p_fn">
718
- <xsl:for-each select="//*[local-name()='p']/*[local-name()='fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
719
- <!-- copy unique fn -->
720
- <fn gen_id="{generate-id(.)}">
721
- <xsl:copy-of select="@*"/>
722
- <xsl:copy-of select="node()"/>
723
- </fn>
724
- </xsl:for-each>
725
- </xsl:variable>
726
-
727
- <xsl:template match="*[local-name()='p']/*[local-name()='fn']" priority="2">
728
- <xsl:variable name="gen_id" select="generate-id(.)"/>
729
- <xsl:variable name="reference" select="@reference"/>
730
- <xsl:variable name="number">
731
- <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
732
- </xsl:variable>
733
- <xsl:choose>
734
- <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
735
- <fo:footnote>
736
- <fo:inline font-size="80%" keep-with-previous.within-line="always" vertical-align="super">
737
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
738
- <!-- <xsl:value-of select="@reference"/> -->
739
- <xsl:value-of select="$number + count(//*[local-name()='bibitem'][ancestor::*[local-name()='references'][@normative='true']]/*[local-name()='note'])"/><xsl:text>)</xsl:text>
740
- </fo:basic-link>
741
- </fo:inline>
742
- <fo:footnote-body>
743
- <fo:block font-size="10pt" margin-bottom="12pt">
744
- <fo:inline id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" padding-right="3mm"> <!-- font-size="60%" alignment-baseline="hanging" -->
745
- <xsl:value-of select="$number + count(//*[local-name()='bibitem'][ancestor::*[local-name()='references'][@normative='true']]/*[local-name()='note'])"/><xsl:text>)</xsl:text>
746
- </fo:inline>
747
- <xsl:for-each select="*[local-name()='p']">
748
- <xsl:apply-templates/>
749
- </xsl:for-each>
750
- </fo:block>
751
- </fo:footnote-body>
752
- </fo:footnote>
753
- </xsl:when>
754
- <xsl:otherwise>
755
- <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
756
- <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
757
- <xsl:value-of select="$number + count(//*[local-name()='bibitem']/*[local-name()='note'])"/>
758
- </fo:basic-link>
759
- </fo:inline>
760
- </xsl:otherwise>
761
- </xsl:choose>
762
- </xsl:template>
763
723
 
764
724
  <xsl:template match="*[local-name()='p']/*[local-name()='fn']/*[local-name()='p']">
765
725
  <xsl:apply-templates/>
766
726
  </xsl:template>
767
727
 
768
-
769
-
728
+
770
729
  <xsl:template match="*[local-name()='bibitem']">
771
- <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
772
- <xsl:variable name="docidentifier">
773
- <xsl:if test="*[local-name()='docidentifier']">
774
- <xsl:choose>
775
- <xsl:when test="*[local-name()='docidentifier']/@type = 'metanorma'"/>
776
- <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier']"/></xsl:otherwise>
777
- </xsl:choose>
778
- </xsl:if>
779
- </xsl:variable>
780
- <xsl:value-of select="$docidentifier"/>
781
-
782
- <xsl:choose>
783
- <xsl:when test="*[local-name()='formattedref']">
784
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
785
- <xsl:apply-templates select="*[local-name()='formattedref']"/>
786
- </xsl:when>
787
- <xsl:otherwise>
788
- <xsl:apply-templates select="*[local-name()='note']"/>
789
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
790
- <fo:inline font-style="italic">
791
- <xsl:choose>
792
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = $lang]">
793
- <xsl:value-of select="*[local-name()='title'][@type = 'main' and @language = $lang]"/>
794
- </xsl:when>
795
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = 'en']">
796
- <xsl:value-of select="*[local-name()='title'][@type = 'main' and @language = 'en']"/>
797
- </xsl:when>
798
- <xsl:otherwise>
799
- <xsl:value-of select="*[local-name()='title']"/>
800
- </xsl:otherwise>
801
- </xsl:choose>
802
- </fo:inline>
803
- </xsl:otherwise>
804
- </xsl:choose>
730
+ <fo:block id="{@id}" margin-bottom="6pt">
731
+ <xsl:call-template name="processBibitem"/>
805
732
  </fo:block>
806
733
  </xsl:template>
807
734
 
@@ -827,37 +754,7 @@
827
754
  </fo:footnote>
828
755
  </xsl:template>
829
756
 
830
-
831
- <!--
832
- <fn reference="1">
833
- <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
834
- </fn>
835
- -->
836
- <xsl:template match="jcgm:title//jcgm:fn | jcgm:name//jcgm:fn | jcgm:p/jcgm:fn[not(ancestor::jcgm:table)] | jcgm:p/*/jcgm:fn[not(ancestor::jcgm:table)] | jcgm:sourcecode/jcgm:fn[not(ancestor::jcgm:table)]" priority="2" name="fn">
837
- <fo:footnote keep-with-previous.within-line="always">
838
- <xsl:variable name="number">
839
- <xsl:number count="jcgm:fn[not(ancestor::jcgm:table)]" level="any"/>
840
- </xsl:variable>
841
- <xsl:variable name="gen_id" select="generate-id()"/>
842
- <xsl:variable name="lang" select="ancestor::jcgm:bipm-standard/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
843
- <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
844
- <fo:basic-link internal-destination="{$lang}_footnote_{@reference}_{$number}_{$gen_id}" fox:alt-text="footnote {@reference}">
845
- <xsl:value-of select="$number"/>
846
- </fo:basic-link>
847
- </fo:inline>
848
- <fo:footnote-body>
849
- <fo:block font-size="9pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" line-height="124%" text-align="justify">
850
- <fo:inline id="{$lang}_footnote_{@reference}_{$number}_{$gen_id}" keep-with-next.within-line="always" font-size="60%" vertical-align="super" padding-right="1mm"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
851
- <xsl:value-of select="$number "/>
852
- </fo:inline>
853
- <xsl:for-each select="jcgm:p">
854
- <xsl:apply-templates/>
855
- </xsl:for-each>
856
- </fo:block>
857
- </fo:footnote-body>
858
- </fo:footnote>
859
- </xsl:template>
860
-
757
+
861
758
  <xsl:template match="jcgm:fn/jcgm:p">
862
759
  <fo:block>
863
760
  <xsl:apply-templates/>
@@ -930,6 +827,7 @@
930
827
  <xsl:apply-templates select="ancestor::*[local-name()='term'][1]/*[local-name()='name']" mode="presentation"/>
931
828
  </fo:block>
932
829
  <fo:block font-weight="bold" keep-with-next="always">
830
+ <xsl:call-template name="setStyle_preferred"/>
933
831
  <xsl:apply-templates/>
934
832
  </fo:block>
935
833
  </fo:block>
@@ -944,6 +842,7 @@
944
842
  <xsl:apply-templates select="preceding-sibling::*[local-name()='term_name'][1]" mode="presentation"/>
945
843
  </fo:block>
946
844
  <fo:block font-weight="bold" keep-with-next="always">
845
+ <xsl:call-template name="setStyle_preferred"/>
947
846
  <xsl:apply-templates/>
948
847
  </fo:block>
949
848
  </fo:block>
@@ -994,44 +893,24 @@
994
893
  <fo:list-item-label end-indent="label-end()">
995
894
  <fo:block>
996
895
  <fo:inline id="{@id}">
997
- <xsl:number format="[1]"/>
896
+ <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
897
+ <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
898
+ <xsl:number format="[1]"/>
899
+ </xsl:if>
998
900
  </fo:inline>
999
901
  </fo:block>
1000
902
  </fo:list-item-label>
1001
903
  <fo:list-item-body start-indent="body-start()">
1002
904
  <fo:block>
1003
- <xsl:variable name="docidentifier">
1004
- <xsl:if test="*[local-name()='docidentifier']">
1005
- <xsl:choose>
1006
- <xsl:when test="*[local-name()='docidentifier']/@type = 'metanorma'"/>
1007
- <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier']"/></xsl:otherwise>
1008
- </xsl:choose>
1009
- </xsl:if>
1010
- </xsl:variable>
1011
- <xsl:value-of select="$docidentifier"/>
1012
- <xsl:apply-templates select="*[local-name()='note']"/>
1013
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1014
- <xsl:choose>
1015
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = $lang]">
1016
- <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = $lang]"/>
1017
- </xsl:when>
1018
- <xsl:when test="*[local-name()='title'][@type = 'main' and @language = 'en']">
1019
- <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = 'en']"/>
1020
- </xsl:when>
1021
- <xsl:otherwise>
1022
- <xsl:apply-templates select="*[local-name()='title']"/>
1023
- </xsl:otherwise>
1024
- </xsl:choose>
1025
- <xsl:apply-templates select="*[local-name()='formattedref']"/>
905
+ <xsl:call-template name="processBibitem"/>
1026
906
  </fo:block>
1027
907
  </fo:list-item-body>
1028
908
  </fo:list-item>
1029
909
  </fo:list-block>
1030
910
  </xsl:template>
1031
911
 
1032
- <xsl:template match="*[local-name()='references']/*[local-name()='bibitem']" mode="contents"/>
1033
912
 
1034
- <xsl:template match="*[local-name()='references'][not(@normative='true')]/*[local-name()='bibitem']/*[local-name()='title']">
913
+ <xsl:template match="*[local-name()='references']/*[local-name()='bibitem']/*[local-name()='title']">
1035
914
  <fo:inline font-style="italic">
1036
915
  <xsl:apply-templates/>
1037
916
  </fo:inline>
@@ -1268,7 +1147,11 @@
1268
1147
  </xsl:variable>
1269
1148
 
1270
1149
  <xsl:template name="insertHeaderFooter">
1150
+ <xsl:param name="isDraft"/>
1271
1151
  <fo:static-content flow-name="header-even-jcgm" role="artifact">
1152
+ <xsl:call-template name="insertDraftWatermark">
1153
+ <xsl:with-param name="isDraft" select="$isDraft"/>
1154
+ </xsl:call-template>
1272
1155
  <fo:block-container height="98%">
1273
1156
  <fo:block font-size="13pt" font-weight="bold" padding-top="12mm">
1274
1157
  <xsl:value-of select="$header_text"/>
@@ -1287,6 +1170,9 @@
1287
1170
  </fo:block-container>
1288
1171
  </fo:static-content>
1289
1172
  <fo:static-content flow-name="header-odd-jcgm" role="artifact">
1173
+ <xsl:call-template name="insertDraftWatermark">
1174
+ <xsl:with-param name="isDraft" select="$isDraft"/>
1175
+ </xsl:call-template>
1290
1176
  <fo:block-container height="98%">
1291
1177
  <fo:block font-size="13pt" font-weight="bold" text-align="right" padding-top="12mm">
1292
1178
  <xsl:value-of select="$header_text"/>
@@ -1302,12 +1188,52 @@
1302
1188
  <fo:inline font-size="12pt" font-weight="bold"><fo:page-number/></fo:inline>
1303
1189
  </fo:inline>
1304
1190
  </fo:block>
1305
-
1306
1191
  </fo:block-container>
1307
1192
  </fo:static-content>
1193
+ <fo:static-content flow-name="header-blank" role="artifact">
1194
+ <xsl:call-template name="insertDraftWatermark">
1195
+ <xsl:with-param name="isDraft" select="$isDraft"/>
1196
+ </xsl:call-template>
1197
+ <fo:block/>
1198
+ </fo:static-content>
1199
+ </xsl:template>
1200
+
1201
+ <xsl:template name="insertDraftWatermark">
1202
+ <xsl:param name="isDraft"/>
1203
+ <xsl:if test="$isDraft = 'true' or normalize-space(//jcgm:bipm-standard/jcgm:bibdata/jcgm:version/jcgm:draft or contains(//jcgm:bipm-standard/jcgm:bibdata/jcgm:status/jcgm:stage, 'draft') or contains(//jcgm:bipm-standard/jcgm:bibdata/jcgm:status/jcgm:stage, 'projet')) = 'true'">
1204
+ <!-- DRAFT -->
1205
+ <xsl:variable name="draft_label">
1206
+ <xsl:call-template name="getLocalizedString">
1207
+ <xsl:with-param name="key">draft_label</xsl:with-param>
1208
+ </xsl:call-template>
1209
+ </xsl:variable>
1210
+ <fo:block-container absolute-position="fixed" left="0mm" top="30mm">
1211
+ <fo:block line-height="0">
1212
+ <fo:instream-foreign-object fox:alt-text="DRAFT">
1213
+ <svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="200mm" height="250mm">
1214
+ <svg:g transform="rotate(-45) scale(0.6, 1)">
1215
+ <xsl:variable name="font-size">
1216
+ <xsl:choose>
1217
+ <xsl:when test="string-length($draft_label) &gt; 5">150</xsl:when>
1218
+ <xsl:otherwise>260</xsl:otherwise>
1219
+ </xsl:choose>
1220
+ </xsl:variable>
1221
+ <svg:text x="-175mm" y="205mm" style="font-family:Arial;font-size:{$font-size}pt;font-weight:normal;fill:rgb(223, 223, 223);">
1222
+ <xsl:if test="string-length($draft_label) &gt; 5">
1223
+ <xsl:attribute name="x">-175mm</xsl:attribute>
1224
+ <xsl:attribute name="y">180mm</xsl:attribute>
1225
+ </xsl:if>
1226
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($draft_label))"/>
1227
+ </svg:text>
1228
+ </svg:g>
1229
+ </svg:svg>
1230
+ </fo:instream-foreign-object>
1231
+ </fo:block>
1232
+ </fo:block-container>
1233
+ </xsl:if>
1308
1234
  </xsl:template>
1309
1235
 
1310
- <xsl:template match="jcgm:title">
1236
+ <xsl:template match="jcgm:title" name="title">
1311
1237
 
1312
1238
  <xsl:variable name="level">
1313
1239
  <xsl:call-template name="getLevel"/>
@@ -2036,11 +1962,6 @@
2036
1962
 
2037
1963
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2038
1964
 
2039
- <title-annex lang="en">Annex </title-annex>
2040
- <title-annex lang="fr">Annexe </title-annex>
2041
-
2042
-
2043
-
2044
1965
  <title-edition lang="en">
2045
1966
 
2046
1967
  <xsl:text>Edition </xsl:text>
@@ -2054,7 +1975,8 @@
2054
1975
 
2055
1976
  </title-edition>
2056
1977
 
2057
-
1978
+
1979
+ <!-- These titles of Table of contents renders different than determined in localized-strings -->
2058
1980
  <title-toc lang="en">
2059
1981
 
2060
1982
 
@@ -2062,19 +1984,9 @@
2062
1984
  </title-toc>
2063
1985
  <title-toc lang="fr">
2064
1986
 
2065
-
2066
- </title-toc>
2067
-
2068
-
1987
+ </title-toc>
2069
1988
 
2070
- <title-page lang="en">Page</title-page>
2071
- <title-page lang="fr">Page</title-page>
2072
1989
 
2073
- <title-key lang="en">Key</title-key>
2074
- <title-key lang="fr">Légende</title-key>
2075
-
2076
- <title-where lang="en">where</title-where>
2077
- <title-where lang="fr">où</title-where>
2078
1990
 
2079
1991
  <title-descriptors lang="en">Descriptors</title-descriptors>
2080
1992
 
@@ -2097,21 +2009,6 @@
2097
2009
 
2098
2010
  </title-subpart>
2099
2011
 
2100
- <title-modified lang="en">modified</title-modified>
2101
- <title-modified lang="fr">modifiée</title-modified>
2102
-
2103
-
2104
-
2105
- <title-source lang="en">
2106
-
2107
-
2108
- </title-source>
2109
-
2110
- <title-keywords lang="en">Keywords</title-keywords>
2111
-
2112
- <title-deprecated lang="en">DEPRECATED</title-deprecated>
2113
- <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2114
-
2115
2012
  <title-list-tables lang="en">List of Tables</title-list-tables>
2116
2013
 
2117
2014
  <title-list-figures lang="en">List of Figures</title-list-figures>
@@ -2120,37 +2017,8 @@
2120
2017
 
2121
2018
  <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
2122
2019
 
2123
- <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2124
-
2125
- <title-abstract lang="en">Abstract</title-abstract>
2126
-
2127
2020
  <title-summary lang="en">Summary</title-summary>
2128
2021
 
2129
- <title-in lang="en">in </title-in>
2130
-
2131
- <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
2132
- <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2133
-
2134
- <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
2135
- <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2136
-
2137
- <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
2138
- <title-issuance-date lang="zh"># 发布</title-issuance-date>
2139
-
2140
- <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
2141
- <title-implementation-date lang="zh"># 实施</title-implementation-date>
2142
-
2143
- <title-obligation-normative lang="en">normative</title-obligation-normative>
2144
- <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2145
-
2146
- <title-caution lang="en">CAUTION</title-caution>
2147
- <title-caution lang="zh">注意</title-caution>
2148
-
2149
- <title-warning lang="en">WARNING</title-warning>
2150
- <title-warning lang="zh">警告</title-warning>
2151
-
2152
- <title-amendment lang="en">AMENDMENT</title-amendment>
2153
-
2154
2022
  <title-continued lang="en">(continued)</title-continued>
2155
2023
  <title-continued lang="fr">(continué)</title-continued>
2156
2024
 
@@ -2268,16 +2136,18 @@
2268
2136
 
2269
2137
 
2270
2138
 
2139
+
2271
2140
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2272
2141
 
2273
2142
 
2274
2143
 
2144
+
2275
2145
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2146
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2276
2147
 
2277
2148
 
2278
2149
 
2279
2150
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2280
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2281
2151
 
2282
2152
 
2283
2153
 
@@ -2312,6 +2182,7 @@
2312
2182
 
2313
2183
 
2314
2184
 
2185
+
2315
2186
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
2316
2187
 
2317
2188
 
@@ -2599,7 +2470,81 @@
2599
2470
 
2600
2471
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2601
2472
  <xsl:attribute name="line-height">135%</xsl:attribute>
2602
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
2473
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
2474
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2475
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
2476
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2477
+
2478
+ <xsl:attribute name="font-size">65%</xsl:attribute>
2479
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2480
+
2481
+
2482
+
2483
+
2484
+
2485
+
2486
+
2487
+
2488
+
2489
+
2490
+
2491
+
2492
+
2493
+
2494
+
2495
+
2496
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
2497
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2498
+ <xsl:attribute name="font-style">normal</xsl:attribute>
2499
+ <xsl:attribute name="text-indent">0</xsl:attribute>
2500
+ <xsl:attribute name="start-indent">0</xsl:attribute>
2501
+
2502
+
2503
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
2504
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2505
+ <xsl:attribute name="line-height">124%</xsl:attribute>
2506
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2507
+
2508
+
2509
+
2510
+
2511
+
2512
+
2513
+
2514
+
2515
+
2516
+
2517
+
2518
+
2519
+
2520
+
2521
+
2522
+
2523
+
2524
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
2525
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2526
+
2527
+ <xsl:attribute name="font-size">60%</xsl:attribute>
2528
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2529
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2530
+
2531
+
2532
+
2533
+
2534
+
2535
+
2536
+
2537
+
2538
+
2539
+
2540
+
2541
+
2542
+
2543
+
2544
+
2545
+
2546
+
2547
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
2603
2548
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2604
2549
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2605
2550
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2624,7 +2569,8 @@
2624
2569
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
2625
2570
 
2626
2571
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2627
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2572
+
2573
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
2628
2574
  <xsl:sort select="@displayorder" data-type="number"/>
2629
2575
  <xsl:apply-templates select="." mode="contents"/>
2630
2576
  </xsl:for-each>
@@ -2634,7 +2580,7 @@
2634
2580
  <xsl:apply-templates select="." mode="contents"/>
2635
2581
  </xsl:for-each>
2636
2582
 
2637
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2583
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2638
2584
  <xsl:sort select="@displayorder" data-type="number"/>
2639
2585
  <xsl:apply-templates select="." mode="contents"/>
2640
2586
  </xsl:for-each>
@@ -3639,6 +3585,102 @@
3639
3585
 
3640
3586
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='name']" mode="process"/><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3641
3587
  <xsl:apply-templates/>
3588
+ </xsl:template><xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
3589
+
3590
+ <!-- list of footnotes to calculate actual footnotes number -->
3591
+ <xsl:variable name="p_fn_">
3592
+ <xsl:choose>
3593
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3594
+ <fn gen_id="{generate-id(.)}">
3595
+ <xsl:copy-of select="@*"/>
3596
+ <xsl:copy-of select="node()"/>
3597
+ </fn>
3598
+ </xsl:when>
3599
+ <xsl:otherwise>
3600
+ <!-- itetation for:
3601
+ footnotes in bibdata/title
3602
+ footnotes in bibliography
3603
+ footnotes in document's body (except table's head/body/foot and figure text)
3604
+ -->
3605
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3606
+ <fn gen_id="{generate-id(.)}">
3607
+ <xsl:copy-of select="@*"/>
3608
+ <xsl:copy-of select="node()"/>
3609
+ </fn>
3610
+ </xsl:for-each>
3611
+ <xsl:for-each select="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']/*">
3612
+ <xsl:sort select="@displayorder" data-type="number"/>
3613
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3614
+ <!-- copy unique fn -->
3615
+ <fn gen_id="{generate-id(.)}">
3616
+ <xsl:copy-of select="@*"/>
3617
+ <xsl:copy-of select="node()"/>
3618
+ </fn>
3619
+ </xsl:for-each>
3620
+ </xsl:for-each>
3621
+ </xsl:otherwise>
3622
+ </xsl:choose>
3623
+ </xsl:variable>
3624
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3625
+
3626
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
3627
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3628
+ <xsl:variable name="reference" select="@reference"/>
3629
+ <!-- fn sequence number in document -->
3630
+ <xsl:variable name="current_fn_number">
3631
+ <xsl:choose>
3632
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
3633
+ <xsl:otherwise>
3634
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
3635
+ </xsl:otherwise>
3636
+ </xsl:choose>
3637
+ </xsl:variable>
3638
+ <xsl:variable name="current_fn_number_text">
3639
+ <xsl:value-of select="$current_fn_number"/>
3640
+
3641
+
3642
+ </xsl:variable>
3643
+
3644
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3645
+ <xsl:variable name="footnote_inline">
3646
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
3647
+
3648
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3649
+ <xsl:value-of select="$current_fn_number_text"/>
3650
+ </fo:basic-link>
3651
+ </fo:inline>
3652
+ </xsl:variable>
3653
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3654
+ gen_id=<xsl:value-of select="$gen_id"/> -->
3655
+ <xsl:choose>
3656
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3657
+ <xsl:copy-of select="$footnote_inline"/>
3658
+ </xsl:when>
3659
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
3660
+ <fo:footnote xsl:use-attribute-sets="fn-style">
3661
+ <xsl:copy-of select="$footnote_inline"/>
3662
+ <fo:footnote-body>
3663
+
3664
+ <fo:block-container text-indent="0" start-indent="0">
3665
+
3666
+
3667
+ <fo:block xsl:use-attribute-sets="fn-body-style">
3668
+
3669
+
3670
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3671
+
3672
+ <xsl:value-of select="$current_fn_number_text"/>
3673
+ </fo:inline>
3674
+ <xsl:apply-templates/>
3675
+ </fo:block>
3676
+ </fo:block-container>
3677
+ </fo:footnote-body>
3678
+ </fo:footnote>
3679
+ </xsl:when>
3680
+ <xsl:otherwise>
3681
+ <xsl:copy-of select="$footnote_inline"/>
3682
+ </xsl:otherwise>
3683
+ </xsl:choose>
3642
3684
  </xsl:template><xsl:template name="fn_display">
3643
3685
  <xsl:variable name="references">
3644
3686
 
@@ -3840,6 +3882,8 @@
3840
3882
 
3841
3883
  </fo:basic-link>
3842
3884
  </fo:inline>
3885
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
3886
+ <fo:inline><xsl:value-of select="."/></fo:inline>
3843
3887
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3844
3888
  <fo:inline>
3845
3889
  <xsl:apply-templates/>
@@ -3892,12 +3936,9 @@
3892
3936
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3893
3937
 
3894
3938
  <xsl:variable name="title-where">
3895
-
3896
- <xsl:call-template name="getLocalizedString">
3897
- <xsl:with-param name="key">where</xsl:with-param>
3898
- </xsl:call-template>
3899
-
3900
-
3939
+ <xsl:call-template name="getLocalizedString">
3940
+ <xsl:with-param name="key">where</xsl:with-param>
3941
+ </xsl:call-template>
3901
3942
  </xsl:variable>
3902
3943
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3903
3944
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -3915,12 +3956,9 @@
3915
3956
 
3916
3957
 
3917
3958
  <xsl:variable name="title-where">
3918
-
3919
- <xsl:call-template name="getLocalizedString">
3920
- <xsl:with-param name="key">where</xsl:with-param>
3921
- </xsl:call-template>
3922
-
3923
-
3959
+ <xsl:call-template name="getLocalizedString">
3960
+ <xsl:with-param name="key">where</xsl:with-param>
3961
+ </xsl:call-template>
3924
3962
  </xsl:variable>
3925
3963
  <xsl:value-of select="$title-where"/>
3926
3964
  </fo:block>
@@ -3935,12 +3973,9 @@
3935
3973
 
3936
3974
 
3937
3975
  <xsl:variable name="title-key">
3938
-
3939
- <xsl:call-template name="getLocalizedString">
3940
- <xsl:with-param name="key">key</xsl:with-param>
3941
- </xsl:call-template>
3942
-
3943
-
3976
+ <xsl:call-template name="getLocalizedString">
3977
+ <xsl:with-param name="key">key</xsl:with-param>
3978
+ </xsl:call-template>
3944
3979
  </xsl:variable>
3945
3980
  <xsl:value-of select="$title-key"/>
3946
3981
  </fo:block>
@@ -4213,6 +4248,7 @@
4213
4248
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4214
4249
  <xsl:apply-templates/>
4215
4250
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
4251
+ <xsl:apply-templates select="@language"/>
4216
4252
  <xsl:apply-templates/>
4217
4253
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4218
4254
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -4274,6 +4310,15 @@
4274
4310
  </fo:inline>
4275
4311
  </xsl:template><xsl:template match="*[local-name()='add']">
4276
4312
  <xsl:choose>
4313
+ <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4314
+ <fo:inline>
4315
+ <xsl:call-template name="insertTag">
4316
+ <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4317
+ <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4318
+ <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4319
+ </xsl:call-template>
4320
+ </fo:inline>
4321
+ </xsl:when>
4277
4322
  <xsl:when test="@amendment">
4278
4323
  <fo:inline>
4279
4324
  <xsl:call-template name="insertTag">
@@ -4308,7 +4353,6 @@
4308
4353
  </fo:inline>
4309
4354
  </xsl:otherwise>
4310
4355
  </xsl:choose>
4311
-
4312
4356
  </xsl:template><xsl:template name="insertTag">
4313
4357
  <xsl:param name="type"/>
4314
4358
  <xsl:param name="kind"/>
@@ -4324,14 +4368,14 @@
4324
4368
  <xsl:attribute name="scaling">uniform</xsl:attribute>
4325
4369
  <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4326
4370
  <g>
4327
- <xsl:if test="$type = 'closing'">
4371
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4328
4372
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4329
4373
  </xsl:if>
4330
4374
  <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4331
4375
  <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4332
4376
  </g>
4333
4377
  <text font-family="Arial" x="15" y="57" font-size="40pt">
4334
- <xsl:if test="$type = 'closing'">
4378
+ <xsl:if test="$type = 'closing' or $type = 'end'">
4335
4379
  <xsl:attribute name="x">25</xsl:attribute>
4336
4380
  </xsl:if>
4337
4381
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
@@ -4824,9 +4868,9 @@
4824
4868
  <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
4825
4869
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
4826
4870
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
4827
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4871
+ <xsl:apply-templates select="*[local-name()='name']"/>
4828
4872
  </fo:block>
4829
- <xsl:apply-templates/>
4873
+ <xsl:apply-templates select="node()[not(local-name()='name')]"/>
4830
4874
  </xsl:template><xsl:template match="*[local-name() = 'callout']">
4831
4875
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4832
4876
  </xsl:template><xsl:template match="*[local-name() = 'annotation']">
@@ -4846,22 +4890,6 @@
4846
4890
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4847
4891
  <xsl:apply-templates/>
4848
4892
  </fo:inline>
4849
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
4850
- <xsl:variable name="title-modified">
4851
-
4852
- <xsl:call-template name="getLocalizedString">
4853
- <xsl:with-param name="key">modified</xsl:with-param>
4854
- </xsl:call-template>
4855
-
4856
-
4857
- </xsl:variable>
4858
-
4859
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4860
- <xsl:choose>
4861
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
4862
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
4863
- </xsl:choose>
4864
- <xsl:apply-templates/>
4865
4893
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
4866
4894
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
4867
4895
 
@@ -5428,20 +5456,67 @@
5428
5456
  </xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><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">
5429
5457
  <xsl:apply-templates mode="contents"/>
5430
5458
  <xsl:text> </xsl:text>
5431
- </xsl:template><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="bookmarks">
5459
+ </xsl:template><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">
5432
5460
  <xsl:apply-templates mode="bookmarks"/>
5433
5461
  <xsl:text> </xsl:text>
5434
5462
  </xsl:template><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">
5435
5463
  <xsl:value-of select="."/>
5436
- </xsl:template><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="bookmarks" priority="2">
5464
+ </xsl:template><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">
5437
5465
  <xsl:value-of select="."/>
5438
5466
  </xsl:template><xsl:template match="node()" mode="contents">
5439
5467
  <xsl:apply-templates mode="contents"/>
5468
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="2" mode="contents">
5469
+ <xsl:variable name="level">
5470
+ <xsl:call-template name="getLevel">
5471
+ <xsl:with-param name="depth" select="@depth"/>
5472
+ </xsl:call-template>
5473
+ </xsl:variable>
5474
+
5475
+ <xsl:variable name="section">
5476
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5477
+ </xsl:variable>
5478
+
5479
+ <xsl:variable name="type">floating-title</xsl:variable>
5480
+
5481
+ <xsl:variable name="display">
5482
+ <xsl:choose>
5483
+ <xsl:when test="normalize-space(@id) = ''">false</xsl:when>
5484
+ <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
5485
+ <xsl:otherwise>false</xsl:otherwise>
5486
+ </xsl:choose>
5487
+ </xsl:variable>
5488
+
5489
+ <xsl:variable name="skip">false</xsl:variable>
5490
+
5491
+ <xsl:if test="$skip = 'false'">
5492
+
5493
+ <xsl:variable name="title">
5494
+ <xsl:choose>
5495
+ <xsl:when test="*[local-name() = 'tab']">
5496
+ <xsl:copy-of select="*[local-name() = 'tab'][1]/following-sibling::node()"/>
5497
+ </xsl:when>
5498
+ <xsl:otherwise>
5499
+ <xsl:copy-of select="node()"/>
5500
+ </xsl:otherwise>
5501
+ </xsl:choose>
5502
+ </xsl:variable>
5503
+
5504
+ <xsl:variable name="root">
5505
+ <xsl:if test="ancestor-or-self::*[local-name() = 'preface']">preface</xsl:if>
5506
+ <xsl:if test="ancestor-or-self::*[local-name() = 'annex']">annex</xsl:if>
5507
+ </xsl:variable>
5508
+
5509
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
5510
+ <title>
5511
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
5512
+ </title>
5513
+ </item>
5514
+ </xsl:if>
5440
5515
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5441
5516
  <xsl:apply-templates mode="bookmarks"/>
5442
5517
  </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5443
5518
  <xsl:apply-templates select="."/>
5444
- </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5519
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5445
5520
  <xsl:apply-templates mode="bookmarks"/>
5446
5521
  </xsl:template><xsl:template name="addBookmarks">
5447
5522
  <xsl:param name="contents"/>
@@ -5612,7 +5687,10 @@
5612
5687
  </fo:block>
5613
5688
  </xsl:if>
5614
5689
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/><xsl:template match="*[local-name() = 'title']" mode="contents_item">
5615
- <xsl:apply-templates mode="contents_item"/>
5690
+ <xsl:param name="mode">bookmarks</xsl:param>
5691
+ <xsl:apply-templates mode="contents_item">
5692
+ <xsl:with-param name="mode" select="$mode"/>
5693
+ </xsl:apply-templates>
5616
5694
  <!-- <xsl:text> </xsl:text> -->
5617
5695
  </xsl:template><xsl:template name="getSection">
5618
5696
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -5685,6 +5763,18 @@
5685
5763
  <xsl:copy-of select="."/>
5686
5764
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
5687
5765
  <xsl:text> </xsl:text>
5766
+ </xsl:template><xsl:template match="*[local-name() = 'name']" mode="contents_item">
5767
+ <xsl:param name="mode">bookmarks</xsl:param>
5768
+ <xsl:apply-templates mode="contents_item">
5769
+ <xsl:with-param name="mode" select="$mode"/>
5770
+ </xsl:apply-templates>
5771
+ </xsl:template><xsl:template match="*[local-name() = 'add'][starts-with(text(), $ace_tag)]" mode="contents_item">
5772
+ <xsl:param name="mode">bookmarks</xsl:param>
5773
+ <xsl:if test="$mode = 'contents'">
5774
+ <xsl:copy>
5775
+ <xsl:apply-templates mode="contents_item"/>
5776
+ </xsl:copy>
5777
+ </xsl:if>
5688
5778
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5689
5779
 
5690
5780
  <fo:block-container margin-left="0mm">
@@ -5703,6 +5793,8 @@
5703
5793
 
5704
5794
 
5705
5795
 
5796
+
5797
+
5706
5798
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5707
5799
  <xsl:variable name="_font-size">
5708
5800
 
@@ -5736,13 +5828,17 @@
5736
5828
 
5737
5829
 
5738
5830
 
5831
+
5832
+
5739
5833
  <xsl:apply-templates/>
5740
5834
  </fo:block>
5741
-
5835
+
5742
5836
 
5743
5837
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5744
5838
 
5745
5839
 
5840
+
5841
+
5746
5842
  </fo:block-container>
5747
5843
  </fo:block-container>
5748
5844
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -6015,42 +6111,48 @@
6015
6111
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
6016
6112
 
6017
6113
 
6018
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
6019
-
6020
- <xsl:variable name="element">
6114
+ <xsl:variable name="fo_element">
6115
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
6021
6116
 
6022
6117
  inline
6023
- <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
6118
+
6024
6119
  </xsl:variable>
6025
6120
 
6121
+ <!-- display 'EXAMPLE' -->
6122
+ <xsl:apply-templates select="*[local-name()='name']">
6123
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6124
+ </xsl:apply-templates>
6125
+
6026
6126
  <xsl:choose>
6027
- <xsl:when test="contains(normalize-space($element), 'block')">
6028
- <fo:block xsl:use-attribute-sets="example-body-style">
6029
- <xsl:apply-templates/>
6030
- </fo:block>
6127
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6128
+ <fo:block-container xsl:use-attribute-sets="example-body-style">
6129
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6130
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6131
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6132
+ </xsl:apply-templates>
6133
+ </fo:block-container>
6134
+ </fo:block-container>
6031
6135
  </xsl:when>
6032
6136
  <xsl:otherwise>
6033
6137
  <fo:inline>
6034
- <xsl:apply-templates/>
6138
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
6139
+ <xsl:with-param name="fo_element" select="$fo_element"/>
6140
+ </xsl:apply-templates>
6035
6141
  </fo:inline>
6036
6142
  </xsl:otherwise>
6037
6143
  </xsl:choose>
6038
6144
 
6039
6145
  </fo:block>
6040
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']" mode="presentation">
6041
-
6042
- <xsl:variable name="element">
6043
-
6044
- inline
6045
- <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
6046
- </xsl:variable>
6146
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
6147
+ <xsl:param name="fo_element">block</xsl:param>
6148
+
6047
6149
  <xsl:choose>
6048
6150
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
6049
6151
  <fo:inline>
6050
6152
  <xsl:apply-templates/>
6051
6153
  </fo:inline>
6052
6154
  </xsl:when>
6053
- <xsl:when test="contains(normalize-space($element), 'block')">
6155
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
6054
6156
  <fo:block xsl:use-attribute-sets="example-name-style">
6055
6157
  <xsl:apply-templates/>
6056
6158
  </fo:block>
@@ -6063,19 +6165,20 @@
6063
6165
  </xsl:choose>
6064
6166
 
6065
6167
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
6168
+ <xsl:param name="fo_element">block</xsl:param>
6169
+
6066
6170
  <xsl:variable name="num"><xsl:number/></xsl:variable>
6067
6171
  <xsl:variable name="element">
6068
6172
 
6069
-
6070
6173
  <xsl:choose>
6071
6174
  <xsl:when test="$num = 1">inline</xsl:when>
6072
6175
  <xsl:otherwise>block</xsl:otherwise>
6073
6176
  </xsl:choose>
6074
6177
 
6075
-
6178
+ <xsl:value-of select="$fo_element"/>
6076
6179
  </xsl:variable>
6077
6180
  <xsl:choose>
6078
- <xsl:when test="normalize-space($element) = 'block'">
6181
+ <xsl:when test="starts-with(normalize-space($element), 'block')">
6079
6182
  <fo:block xsl:use-attribute-sets="example-p-style">
6080
6183
 
6081
6184
  <xsl:apply-templates/>
@@ -6094,60 +6197,66 @@
6094
6197
  <xsl:variable name="termsource_text">
6095
6198
  <xsl:apply-templates/>
6096
6199
  </xsl:variable>
6097
-
6098
- <xsl:choose>
6200
+ <xsl:copy-of select="$termsource_text"/>
6201
+ <!-- <xsl:choose>
6099
6202
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
6100
- <!-- <xsl:apply-templates /> -->
6101
6203
  <xsl:copy-of select="$termsource_text"/>
6102
6204
  </xsl:when>
6103
6205
  <xsl:otherwise>
6104
-
6105
-
6206
+ <xsl:if test="$namespace = 'bsi'">
6207
+ <xsl:choose>
6208
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
6209
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
6210
+ </xsl:choose>
6211
+ </xsl:if>
6212
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
6106
6213
  <xsl:text>[</xsl:text>
6107
-
6108
- <!-- <xsl:apply-templates /> -->
6214
+ </xsl:if>
6109
6215
  <xsl:copy-of select="$termsource_text"/>
6110
-
6111
-
6216
+ <xsl:if test="$namespace = 'bsi'">
6217
+ <xsl:choose>
6218
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
6219
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
6220
+ </xsl:choose>
6221
+ </xsl:if>
6222
+ <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'itu' or $namespace = 'unece' or $namespace = 'unece-rec' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper' or $namespace = 'csa' or $namespace = 'csd' or $namespace = 'm3d' or $namespace = 'iho' or $namespace = 'bipm' or $namespace = 'jcgm'">
6112
6223
  <xsl:text>]</xsl:text>
6113
-
6224
+ </xsl:if>
6114
6225
  </xsl:otherwise>
6115
- </xsl:choose>
6226
+ </xsl:choose> -->
6116
6227
  </fo:block>
6117
6228
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6118
6229
  <xsl:if test="normalize-space() != ''">
6119
6230
  <xsl:value-of select="."/>
6120
6231
  </xsl:if>
6121
- </xsl:template><xsl:variable name="localized.source">
6122
- <xsl:call-template name="getLocalizedString">
6123
- <xsl:with-param name="key">source</xsl:with-param>
6124
- </xsl:call-template>
6125
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
6232
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
6233
+ <fo:inline>
6234
+
6235
+
6236
+ <xsl:value-of select="."/>
6237
+ </fo:inline>
6238
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
6126
6239
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6127
6240
  <xsl:if test="normalize-space(@citeas) = ''">
6128
6241
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6129
6242
  </xsl:if>
6130
-
6131
-
6132
- <fo:inline>
6133
-
6134
-
6135
-
6136
-
6137
-
6138
-
6139
- <xsl:value-of select="$localized.source"/>
6140
- <xsl:text> </xsl:text>
6141
-
6142
-
6143
-
6144
- </fo:inline>
6145
-
6146
6243
  <fo:inline xsl:use-attribute-sets="origin-style">
6147
6244
  <xsl:apply-templates/>
6148
6245
  </fo:inline>
6149
-
6150
- </fo:basic-link>
6246
+ </fo:basic-link>
6247
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
6248
+ <xsl:variable name="title-modified">
6249
+ <xsl:call-template name="getLocalizedString">
6250
+ <xsl:with-param name="key">modified</xsl:with-param>
6251
+ </xsl:call-template>
6252
+ </xsl:variable>
6253
+
6254
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6255
+ <xsl:choose>
6256
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
6257
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
6258
+ </xsl:choose>
6259
+ <xsl:apply-templates/>
6151
6260
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
6152
6261
  <fo:inline><xsl:apply-templates/></fo:inline>
6153
6262
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -6338,25 +6447,29 @@
6338
6447
  </fo:block>
6339
6448
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
6340
6449
  <xsl:variable name="title-deprecated">
6341
-
6342
- <xsl:call-template name="getLocalizedString">
6343
- <xsl:with-param name="key">deprecated</xsl:with-param>
6344
- </xsl:call-template>
6345
-
6346
-
6450
+ <xsl:call-template name="getLocalizedString">
6451
+ <xsl:with-param name="key">deprecated</xsl:with-param>
6452
+ </xsl:call-template>
6347
6453
  </xsl:variable>
6348
6454
  <fo:block xsl:use-attribute-sets="deprecates-style">
6349
6455
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
6350
6456
  </fo:block>
6457
+ </xsl:template><xsl:template name="setStyle_preferred">
6458
+ <xsl:if test="*[local-name() = 'strong']">
6459
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
6460
+ </xsl:if>
6461
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']/text()[contains(., ';')] | *[local-name() = 'preferred']/*[local-name() = 'strong']/text()[contains(., ';')]">
6462
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), ';', $linebreak)"/>
6351
6463
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6352
6464
  <fo:block xsl:use-attribute-sets="definition-style">
6353
6465
  <xsl:apply-templates/>
6354
6466
  </fo:block>
6355
6467
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
6356
6468
  <xsl:apply-templates/>
6357
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
6469
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
6358
6470
  <fo:inline> <xsl:apply-templates/></fo:inline>
6359
- <fo:block> </fo:block>
6471
+ <!-- <fo:block>&#xA0;</fo:block> -->
6472
+ <fo:block/>
6360
6473
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
6361
6474
 
6362
6475
  <fo:block>
@@ -6421,6 +6534,53 @@
6421
6534
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6422
6535
  <!-- 0xA0 to space replacement -->
6423
6536
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6537
+ </xsl:template><xsl:variable name="ul_labels_">
6538
+
6539
+
6540
+
6541
+
6542
+
6543
+
6544
+
6545
+
6546
+ <label level="1">—</label> <!-- em dash -->
6547
+ <label level="2">−</label><!-- minus sign -->
6548
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
6549
+
6550
+
6551
+
6552
+
6553
+
6554
+
6555
+
6556
+
6557
+
6558
+
6559
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6560
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6561
+ <xsl:variable name="list_level">
6562
+ <xsl:choose>
6563
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
6564
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
6565
+ </xsl:choose>
6566
+ </xsl:variable>
6567
+ <xsl:choose>
6568
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
6569
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
6570
+ </xsl:when>
6571
+ <xsl:when test="$list_level mod 3 = 0">
6572
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
6573
+ </xsl:when>
6574
+ <xsl:when test="$list_level mod 2 = 0">
6575
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
6576
+ </xsl:when>
6577
+ <xsl:otherwise>
6578
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
6579
+ </xsl:otherwise>
6580
+ </xsl:choose>
6581
+ </xsl:template><xsl:template match="label" mode="ul_labels">
6582
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6583
+ <xsl:value-of select="."/>
6424
6584
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6425
6585
  <xsl:choose>
6426
6586
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6631,16 +6791,64 @@
6631
6791
 
6632
6792
 
6633
6793
 
6634
-
6794
+
6795
+
6796
+
6797
+
6798
+
6799
+
6635
6800
 
6636
6801
 
6637
6802
 
6638
6803
 
6639
6804
 
6805
+
6806
+
6807
+ <!-- start JCGM bibitem processing -->
6808
+ <xsl:variable name="docidentifier">
6809
+ <xsl:if test="*[local-name()='docidentifier']">
6810
+ <xsl:choose>
6811
+ <xsl:when test="*[local-name()='docidentifier']/@type = 'metanorma'"/>
6812
+ <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
6813
+ </xsl:choose>
6814
+ </xsl:if>
6815
+ </xsl:variable>
6816
+ <xsl:value-of select="$docidentifier"/>
6817
+
6818
+ <xsl:choose>
6819
+ <xsl:when test="*[local-name()='formattedref']">
6820
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6821
+ <xsl:apply-templates select="*[local-name()='formattedref']"/>
6822
+ </xsl:when>
6823
+ <xsl:otherwise>
6824
+ <xsl:apply-templates select="*[local-name()='note']"/>
6825
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
6826
+ <xsl:choose>
6827
+ <xsl:when test="*[local-name()='title'][@type = 'main' and @language = $lang]">
6828
+ <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = $lang]"/>
6829
+ </xsl:when>
6830
+ <xsl:when test="*[local-name()='title'][@type = 'main' and @language = 'en']">
6831
+ <xsl:apply-templates select="*[local-name()='title'][@type = 'main' and @language = 'en']"/>
6832
+ </xsl:when>
6833
+ <xsl:otherwise>
6834
+ <xsl:apply-templates select="*[local-name()='title']"/>
6835
+ </xsl:otherwise>
6836
+ </xsl:choose>
6837
+ </xsl:otherwise>
6838
+ </xsl:choose>
6839
+ <!-- end JCGM bibitem processing -->
6840
+
6841
+
6842
+
6843
+ <!-- end MPFD bibitem processing -->
6844
+
6845
+ <!-- start M3D bibitem processing -->
6640
6846
 
6641
6847
 
6848
+
6849
+
6642
6850
  </xsl:template><xsl:template name="processBibitemDocId">
6643
- <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
6851
+ <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
6644
6852
  <xsl:choose>
6645
6853
  <xsl:when test="normalize-space($_doc_ident) != ''">
6646
6854
  <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
@@ -6654,7 +6862,7 @@
6654
6862
  <xsl:if test="$type != ''">
6655
6863
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6656
6864
  </xsl:if> -->
6657
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6865
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
6658
6866
  </xsl:otherwise>
6659
6867
  </xsl:choose>
6660
6868
  </xsl:template><xsl:template name="processPersonalAuthor">
@@ -6759,7 +6967,35 @@
6759
6967
  <fo:block-container border="1pt solid black" width="50%">
6760
6968
  <fo:block> </fo:block>
6761
6969
  </fo:block-container>
6762
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
6970
+ </xsl:template><xsl:variable name="toc_level">
6971
+ <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
6972
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
6973
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
6974
+ <xsl:choose>
6975
+ <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
6976
+ <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
6977
+ <xsl:otherwise><!-- default value -->
6978
+
6979
+
6980
+
6981
+
6982
+
6983
+
6984
+
6985
+
6986
+ 3
6987
+
6988
+
6989
+
6990
+
6991
+
6992
+
6993
+
6994
+
6995
+
6996
+ </xsl:otherwise>
6997
+ </xsl:choose>
6998
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
6763
6999
  <xsl:param name="colwidths"/>
6764
7000
  <xsl:variable name="colwidths_">
6765
7001
  <xsl:choose>
@@ -6839,7 +7075,7 @@
6839
7075
  </td>
6840
7076
  </xsl:for-each>
6841
7077
  <td>333</td> <!-- page number, just for fill -->
6842
- </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
7078
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6843
7079
  <fo:inline padding-right="5mm"> </fo:inline>
6844
7080
  <fo:inline><xsl:apply-templates/></fo:inline>
6845
7081
  </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
@@ -6850,6 +7086,10 @@
6850
7086
  </svg>
6851
7087
  </fo:instream-foreign-object>
6852
7088
  </fo:inline>
7089
+ </xsl:template><xsl:template match="@language">
7090
+ <xsl:copy-of select="."/>
7091
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
7092
+ <xsl:call-template name="title"/>
6853
7093
  </xsl:template><xsl:template name="convertDate">
6854
7094
  <xsl:param name="date"/>
6855
7095
  <xsl:param name="format" select="'short'"/>
@@ -7204,9 +7444,15 @@
7204
7444
  </xsl:template><xsl:template name="getLocalizedString">
7205
7445
  <xsl:param name="key"/>
7206
7446
  <xsl:param name="formatted">false</xsl:param>
7447
+ <xsl:param name="lang"/>
7207
7448
 
7208
7449
  <xsl:variable name="curr_lang">
7209
- <xsl:call-template name="getLang"/>
7450
+ <xsl:choose>
7451
+ <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
7452
+ <xsl:otherwise>
7453
+ <xsl:call-template name="getLang"/>
7454
+ </xsl:otherwise>
7455
+ </xsl:choose>
7210
7456
  </xsl:variable>
7211
7457
 
7212
7458
  <xsl:variable name="data_value">
@@ -7396,4 +7642,14 @@
7396
7642
  </xsl:otherwise>
7397
7643
  </xsl:choose>
7398
7644
  </xsl:if>
7645
+ </xsl:template><xsl:template name="setAltText">
7646
+ <xsl:param name="value"/>
7647
+ <xsl:attribute name="fox:alt-text">
7648
+ <xsl:choose>
7649
+ <xsl:when test="normalize-space($value) != ''">
7650
+ <xsl:value-of select="$value"/>
7651
+ </xsl:when>
7652
+ <xsl:otherwise>_</xsl:otherwise>
7653
+ </xsl:choose>
7654
+ </xsl:attribute>
7399
7655
  </xsl:template></xsl:stylesheet>