metanorma-bipm 1.2.1 → 1.2.5

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,66 +720,12 @@
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
730
  <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
772
731
  <xsl:variable name="docidentifier">
@@ -827,37 +786,7 @@
827
786
  </fo:footnote>
828
787
  </xsl:template>
829
788
 
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
-
789
+
861
790
  <xsl:template match="jcgm:fn/jcgm:p">
862
791
  <fo:block>
863
792
  <xsl:apply-templates/>
@@ -930,6 +859,7 @@
930
859
  <xsl:apply-templates select="ancestor::*[local-name()='term'][1]/*[local-name()='name']" mode="presentation"/>
931
860
  </fo:block>
932
861
  <fo:block font-weight="bold" keep-with-next="always">
862
+ <xsl:call-template name="setStyle_preferred"/>
933
863
  <xsl:apply-templates/>
934
864
  </fo:block>
935
865
  </fo:block>
@@ -944,6 +874,7 @@
944
874
  <xsl:apply-templates select="preceding-sibling::*[local-name()='term_name'][1]" mode="presentation"/>
945
875
  </fo:block>
946
876
  <fo:block font-weight="bold" keep-with-next="always">
877
+ <xsl:call-template name="setStyle_preferred"/>
947
878
  <xsl:apply-templates/>
948
879
  </fo:block>
949
880
  </fo:block>
@@ -1268,7 +1199,11 @@
1268
1199
  </xsl:variable>
1269
1200
 
1270
1201
  <xsl:template name="insertHeaderFooter">
1202
+ <xsl:param name="isDraft"/>
1271
1203
  <fo:static-content flow-name="header-even-jcgm" role="artifact">
1204
+ <xsl:call-template name="insertDraftWatermark">
1205
+ <xsl:with-param name="isDraft" select="$isDraft"/>
1206
+ </xsl:call-template>
1272
1207
  <fo:block-container height="98%">
1273
1208
  <fo:block font-size="13pt" font-weight="bold" padding-top="12mm">
1274
1209
  <xsl:value-of select="$header_text"/>
@@ -1287,6 +1222,9 @@
1287
1222
  </fo:block-container>
1288
1223
  </fo:static-content>
1289
1224
  <fo:static-content flow-name="header-odd-jcgm" role="artifact">
1225
+ <xsl:call-template name="insertDraftWatermark">
1226
+ <xsl:with-param name="isDraft" select="$isDraft"/>
1227
+ </xsl:call-template>
1290
1228
  <fo:block-container height="98%">
1291
1229
  <fo:block font-size="13pt" font-weight="bold" text-align="right" padding-top="12mm">
1292
1230
  <xsl:value-of select="$header_text"/>
@@ -1302,12 +1240,52 @@
1302
1240
  <fo:inline font-size="12pt" font-weight="bold"><fo:page-number/></fo:inline>
1303
1241
  </fo:inline>
1304
1242
  </fo:block>
1305
-
1306
1243
  </fo:block-container>
1307
1244
  </fo:static-content>
1245
+ <fo:static-content flow-name="header-blank" role="artifact">
1246
+ <xsl:call-template name="insertDraftWatermark">
1247
+ <xsl:with-param name="isDraft" select="$isDraft"/>
1248
+ </xsl:call-template>
1249
+ <fo:block/>
1250
+ </fo:static-content>
1308
1251
  </xsl:template>
1309
1252
 
1310
- <xsl:template match="jcgm:title">
1253
+ <xsl:template name="insertDraftWatermark">
1254
+ <xsl:param name="isDraft"/>
1255
+ <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'">
1256
+ <!-- DRAFT -->
1257
+ <xsl:variable name="draft_label">
1258
+ <xsl:call-template name="getLocalizedString">
1259
+ <xsl:with-param name="key">draft_label</xsl:with-param>
1260
+ </xsl:call-template>
1261
+ </xsl:variable>
1262
+ <fo:block-container absolute-position="fixed" left="0mm" top="30mm">
1263
+ <fo:block line-height="0">
1264
+ <fo:instream-foreign-object fox:alt-text="DRAFT">
1265
+ <svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="200mm" height="250mm">
1266
+ <svg:g transform="rotate(-45) scale(0.6, 1)">
1267
+ <xsl:variable name="font-size">
1268
+ <xsl:choose>
1269
+ <xsl:when test="string-length($draft_label) &gt; 5">150</xsl:when>
1270
+ <xsl:otherwise>260</xsl:otherwise>
1271
+ </xsl:choose>
1272
+ </xsl:variable>
1273
+ <svg:text x="-175mm" y="205mm" style="font-family:Arial;font-size:{$font-size}pt;font-weight:normal;fill:rgb(223, 223, 223);">
1274
+ <xsl:if test="string-length($draft_label) &gt; 5">
1275
+ <xsl:attribute name="x">-175mm</xsl:attribute>
1276
+ <xsl:attribute name="y">180mm</xsl:attribute>
1277
+ </xsl:if>
1278
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($draft_label))"/>
1279
+ </svg:text>
1280
+ </svg:g>
1281
+ </svg:svg>
1282
+ </fo:instream-foreign-object>
1283
+ </fo:block>
1284
+ </fo:block-container>
1285
+ </xsl:if>
1286
+ </xsl:template>
1287
+
1288
+ <xsl:template match="jcgm:title" name="title">
1311
1289
 
1312
1290
  <xsl:variable name="level">
1313
1291
  <xsl:call-template name="getLevel"/>
@@ -2599,6 +2577,80 @@
2599
2577
 
2600
2578
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2601
2579
  <xsl:attribute name="line-height">135%</xsl:attribute>
2580
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
2581
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2582
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
2583
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2584
+
2585
+ <xsl:attribute name="font-size">65%</xsl:attribute>
2586
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2587
+
2588
+
2589
+
2590
+
2591
+
2592
+
2593
+
2594
+
2595
+
2596
+
2597
+
2598
+
2599
+
2600
+
2601
+
2602
+
2603
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
2604
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2605
+ <xsl:attribute name="font-style">normal</xsl:attribute>
2606
+ <xsl:attribute name="text-indent">0</xsl:attribute>
2607
+ <xsl:attribute name="start-indent">0</xsl:attribute>
2608
+
2609
+
2610
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
2611
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2612
+ <xsl:attribute name="line-height">124%</xsl:attribute>
2613
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2614
+
2615
+
2616
+
2617
+
2618
+
2619
+
2620
+
2621
+
2622
+
2623
+
2624
+
2625
+
2626
+
2627
+
2628
+
2629
+
2630
+
2631
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
2632
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2633
+
2634
+ <xsl:attribute name="font-size">60%</xsl:attribute>
2635
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2636
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2637
+
2638
+
2639
+
2640
+
2641
+
2642
+
2643
+
2644
+
2645
+
2646
+
2647
+
2648
+
2649
+
2650
+
2651
+
2652
+
2653
+
2602
2654
  </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">
2603
2655
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2604
2656
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2624,7 +2676,8 @@
2624
2676
  <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
2677
 
2626
2678
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2627
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2679
+
2680
+ <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
2681
  <xsl:sort select="@displayorder" data-type="number"/>
2629
2682
  <xsl:apply-templates select="." mode="contents"/>
2630
2683
  </xsl:for-each>
@@ -2634,7 +2687,7 @@
2634
2687
  <xsl:apply-templates select="." mode="contents"/>
2635
2688
  </xsl:for-each>
2636
2689
 
2637
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2690
+ <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
2691
  <xsl:sort select="@displayorder" data-type="number"/>
2639
2692
  <xsl:apply-templates select="." mode="contents"/>
2640
2693
  </xsl:for-each>
@@ -3639,6 +3692,102 @@
3639
3692
 
3640
3693
  </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
3694
  <xsl:apply-templates/>
3695
+ </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">
3696
+
3697
+ <!-- list of footnotes to calculate actual footnotes number -->
3698
+ <xsl:variable name="p_fn_">
3699
+ <xsl:choose>
3700
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3701
+ <fn gen_id="{generate-id(.)}">
3702
+ <xsl:copy-of select="@*"/>
3703
+ <xsl:copy-of select="node()"/>
3704
+ </fn>
3705
+ </xsl:when>
3706
+ <xsl:otherwise>
3707
+ <!-- itetation for:
3708
+ footnotes in bibdata/title
3709
+ footnotes in bibliography
3710
+ footnotes in document's body (except table's head/body/foot and figure text)
3711
+ -->
3712
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3713
+ <fn gen_id="{generate-id(.)}">
3714
+ <xsl:copy-of select="@*"/>
3715
+ <xsl:copy-of select="node()"/>
3716
+ </fn>
3717
+ </xsl:for-each>
3718
+ <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']/*">
3719
+ <xsl:sort select="@displayorder" data-type="number"/>
3720
+ <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])]">
3721
+ <!-- copy unique fn -->
3722
+ <fn gen_id="{generate-id(.)}">
3723
+ <xsl:copy-of select="@*"/>
3724
+ <xsl:copy-of select="node()"/>
3725
+ </fn>
3726
+ </xsl:for-each>
3727
+ </xsl:for-each>
3728
+ </xsl:otherwise>
3729
+ </xsl:choose>
3730
+ </xsl:variable>
3731
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3732
+
3733
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
3734
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3735
+ <xsl:variable name="reference" select="@reference"/>
3736
+ <!-- fn sequence number in document -->
3737
+ <xsl:variable name="current_fn_number">
3738
+ <xsl:choose>
3739
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
3740
+ <xsl:otherwise>
3741
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
3742
+ </xsl:otherwise>
3743
+ </xsl:choose>
3744
+ </xsl:variable>
3745
+ <xsl:variable name="current_fn_number_text">
3746
+ <xsl:value-of select="$current_fn_number"/>
3747
+
3748
+
3749
+ </xsl:variable>
3750
+
3751
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3752
+ <xsl:variable name="footnote_inline">
3753
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
3754
+
3755
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3756
+ <xsl:value-of select="$current_fn_number_text"/>
3757
+ </fo:basic-link>
3758
+ </fo:inline>
3759
+ </xsl:variable>
3760
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3761
+ gen_id=<xsl:value-of select="$gen_id"/> -->
3762
+ <xsl:choose>
3763
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3764
+ <xsl:copy-of select="$footnote_inline"/>
3765
+ </xsl:when>
3766
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
3767
+ <fo:footnote xsl:use-attribute-sets="fn-style">
3768
+ <xsl:copy-of select="$footnote_inline"/>
3769
+ <fo:footnote-body>
3770
+
3771
+ <fo:block-container text-indent="0" start-indent="0">
3772
+
3773
+
3774
+ <fo:block xsl:use-attribute-sets="fn-body-style">
3775
+
3776
+
3777
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3778
+
3779
+ <xsl:value-of select="$current_fn_number_text"/>
3780
+ </fo:inline>
3781
+ <xsl:apply-templates/>
3782
+ </fo:block>
3783
+ </fo:block-container>
3784
+ </fo:footnote-body>
3785
+ </fo:footnote>
3786
+ </xsl:when>
3787
+ <xsl:otherwise>
3788
+ <xsl:copy-of select="$footnote_inline"/>
3789
+ </xsl:otherwise>
3790
+ </xsl:choose>
3642
3791
  </xsl:template><xsl:template name="fn_display">
3643
3792
  <xsl:variable name="references">
3644
3793
 
@@ -3840,6 +3989,8 @@
3840
3989
 
3841
3990
  </fo:basic-link>
3842
3991
  </fo:inline>
3992
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
3993
+ <fo:inline><xsl:value-of select="."/></fo:inline>
3843
3994
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3844
3995
  <fo:inline>
3845
3996
  <xsl:apply-templates/>
@@ -4213,6 +4364,7 @@
4213
4364
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
4214
4365
  <xsl:apply-templates/>
4215
4366
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
4367
+ <xsl:apply-templates select="@language"/>
4216
4368
  <xsl:apply-templates/>
4217
4369
  </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4218
4370
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
@@ -4846,22 +4998,6 @@
4846
4998
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4847
4999
  <xsl:apply-templates/>
4848
5000
  </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
5001
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
4866
5002
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
4867
5003
 
@@ -5428,12 +5564,12 @@
5428
5564
  </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
5565
  <xsl:apply-templates mode="contents"/>
5430
5566
  <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">
5567
+ </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
5568
  <xsl:apply-templates mode="bookmarks"/>
5433
5569
  <xsl:text> </xsl:text>
5434
5570
  </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
5571
  <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">
5572
+ </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
5573
  <xsl:value-of select="."/>
5438
5574
  </xsl:template><xsl:template match="node()" mode="contents">
5439
5575
  <xsl:apply-templates mode="contents"/>
@@ -5703,6 +5839,8 @@
5703
5839
 
5704
5840
 
5705
5841
 
5842
+
5843
+
5706
5844
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5707
5845
  <xsl:variable name="_font-size">
5708
5846
 
@@ -5736,13 +5874,17 @@
5736
5874
 
5737
5875
 
5738
5876
 
5877
+
5878
+
5739
5879
  <xsl:apply-templates/>
5740
5880
  </fo:block>
5741
-
5881
+
5742
5882
 
5743
5883
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5744
5884
 
5745
5885
 
5886
+
5887
+
5746
5888
  </fo:block-container>
5747
5889
  </fo:block-container>
5748
5890
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -6094,60 +6236,69 @@
6094
6236
  <xsl:variable name="termsource_text">
6095
6237
  <xsl:apply-templates/>
6096
6238
  </xsl:variable>
6097
-
6098
- <xsl:choose>
6239
+ <xsl:copy-of select="$termsource_text"/>
6240
+ <!-- <xsl:choose>
6099
6241
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
6100
- <!-- <xsl:apply-templates /> -->
6101
6242
  <xsl:copy-of select="$termsource_text"/>
6102
6243
  </xsl:when>
6103
6244
  <xsl:otherwise>
6104
-
6105
-
6245
+ <xsl:if test="$namespace = 'bsi'">
6246
+ <xsl:choose>
6247
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
6248
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
6249
+ </xsl:choose>
6250
+ </xsl:if>
6251
+ <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
6252
  <xsl:text>[</xsl:text>
6107
-
6108
- <!-- <xsl:apply-templates /> -->
6253
+ </xsl:if>
6109
6254
  <xsl:copy-of select="$termsource_text"/>
6110
-
6111
-
6255
+ <xsl:if test="$namespace = 'bsi'">
6256
+ <xsl:choose>
6257
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
6258
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
6259
+ </xsl:choose>
6260
+ </xsl:if>
6261
+ <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
6262
  <xsl:text>]</xsl:text>
6113
-
6263
+ </xsl:if>
6114
6264
  </xsl:otherwise>
6115
- </xsl:choose>
6265
+ </xsl:choose> -->
6116
6266
  </fo:block>
6117
6267
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6118
6268
  <xsl:if test="normalize-space() != ''">
6119
6269
  <xsl:value-of select="."/>
6120
6270
  </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']">
6271
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
6272
+ <fo:inline>
6273
+
6274
+
6275
+ <xsl:value-of select="."/>
6276
+ </fo:inline>
6277
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
6126
6278
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6127
6279
  <xsl:if test="normalize-space(@citeas) = ''">
6128
6280
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6129
6281
  </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
6282
  <fo:inline xsl:use-attribute-sets="origin-style">
6147
6283
  <xsl:apply-templates/>
6148
6284
  </fo:inline>
6285
+ </fo:basic-link>
6286
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
6287
+ <xsl:variable name="title-modified">
6149
6288
 
6150
- </fo:basic-link>
6289
+ <xsl:call-template name="getLocalizedString">
6290
+ <xsl:with-param name="key">modified</xsl:with-param>
6291
+ </xsl:call-template>
6292
+
6293
+
6294
+ </xsl:variable>
6295
+
6296
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6297
+ <xsl:choose>
6298
+ <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>
6299
+ <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>
6300
+ </xsl:choose>
6301
+ <xsl:apply-templates/>
6151
6302
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
6152
6303
  <fo:inline><xsl:apply-templates/></fo:inline>
6153
6304
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -6348,15 +6499,20 @@
6348
6499
  <fo:block xsl:use-attribute-sets="deprecates-style">
6349
6500
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
6350
6501
  </fo:block>
6502
+ </xsl:template><xsl:template name="setStyle_preferred">
6503
+ <xsl:if test="*[local-name() = 'strong']">
6504
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
6505
+ </xsl:if>
6351
6506
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6352
6507
  <fo:block xsl:use-attribute-sets="definition-style">
6353
6508
  <xsl:apply-templates/>
6354
6509
  </fo:block>
6355
6510
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
6356
6511
  <xsl:apply-templates/>
6357
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
6512
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
6358
6513
  <fo:inline> <xsl:apply-templates/></fo:inline>
6359
- <fo:block> </fo:block>
6514
+ <!-- <fo:block>&#xA0;</fo:block> -->
6515
+ <fo:block/>
6360
6516
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
6361
6517
 
6362
6518
  <fo:block>
@@ -6421,6 +6577,53 @@
6421
6577
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
6422
6578
  <!-- 0xA0 to space replacement -->
6423
6579
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6580
+ </xsl:template><xsl:variable name="ul_labels_">
6581
+
6582
+
6583
+
6584
+
6585
+
6586
+
6587
+
6588
+
6589
+ <label level="1">—</label> <!-- em dash -->
6590
+ <label level="2">−</label><!-- minus sign -->
6591
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
6592
+
6593
+
6594
+
6595
+
6596
+
6597
+
6598
+
6599
+
6600
+
6601
+
6602
+ </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6603
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6604
+ <xsl:variable name="list_level">
6605
+ <xsl:choose>
6606
+ <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
6607
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
6608
+ </xsl:choose>
6609
+ </xsl:variable>
6610
+ <xsl:choose>
6611
+ <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
6612
+ <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
6613
+ </xsl:when>
6614
+ <xsl:when test="$list_level mod 3 = 0">
6615
+ <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
6616
+ </xsl:when>
6617
+ <xsl:when test="$list_level mod 2 = 0">
6618
+ <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
6619
+ </xsl:when>
6620
+ <xsl:otherwise>
6621
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
6622
+ </xsl:otherwise>
6623
+ </xsl:choose>
6624
+ </xsl:template><xsl:template match="label" mode="ul_labels">
6625
+ <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6626
+ <xsl:value-of select="."/>
6424
6627
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6425
6628
  <xsl:choose>
6426
6629
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6759,7 +6962,31 @@
6759
6962
  <fo:block-container border="1pt solid black" width="50%">
6760
6963
  <fo:block> </fo:block>
6761
6964
  </fo:block-container>
6762
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
6965
+ </xsl:template><xsl:variable name="toc_level">
6966
+ <xsl:choose>
6967
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
6968
+ <xsl:otherwise><!-- default value -->
6969
+
6970
+
6971
+
6972
+
6973
+
6974
+
6975
+
6976
+
6977
+ 3
6978
+
6979
+
6980
+
6981
+
6982
+
6983
+
6984
+
6985
+
6986
+
6987
+ </xsl:otherwise>
6988
+ </xsl:choose>
6989
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
6763
6990
  <xsl:param name="colwidths"/>
6764
6991
  <xsl:variable name="colwidths_">
6765
6992
  <xsl:choose>
@@ -6850,6 +7077,10 @@
6850
7077
  </svg>
6851
7078
  </fo:instream-foreign-object>
6852
7079
  </fo:inline>
7080
+ </xsl:template><xsl:template match="@language">
7081
+ <xsl:copy-of select="."/>
7082
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title']" priority="4">
7083
+ <xsl:call-template name="title"/>
6853
7084
  </xsl:template><xsl:template name="convertDate">
6854
7085
  <xsl:param name="date"/>
6855
7086
  <xsl:param name="format" select="'short'"/>
@@ -7291,12 +7522,15 @@
7291
7522
  <xsl:param name="default">left</xsl:param>
7292
7523
  <xsl:attribute name="text-align">
7293
7524
  <xsl:choose>
7294
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7525
+ <xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
7295
7526
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7296
7527
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7297
7528
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7298
7529
  </xsl:choose>
7299
7530
  </xsl:attribute>
7531
+ <xsl:if test="@align = 'indent'">
7532
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
7533
+ </xsl:if>
7300
7534
  </xsl:template><xsl:template name="number-to-words">
7301
7535
  <xsl:param name="number"/>
7302
7536
  <xsl:param name="first"/>
@@ -7393,4 +7627,14 @@
7393
7627
  </xsl:otherwise>
7394
7628
  </xsl:choose>
7395
7629
  </xsl:if>
7630
+ </xsl:template><xsl:template name="setAltText">
7631
+ <xsl:param name="value"/>
7632
+ <xsl:attribute name="fox:alt-text">
7633
+ <xsl:choose>
7634
+ <xsl:when test="normalize-space($value) != ''">
7635
+ <xsl:value-of select="$value"/>
7636
+ </xsl:when>
7637
+ <xsl:otherwise>_</xsl:otherwise>
7638
+ </xsl:choose>
7639
+ </xsl:attribute>
7396
7640
  </xsl:template></xsl:stylesheet>