metanorma-bipm 1.2.0 → 1.2.4

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>
@@ -707,66 +719,12 @@
707
719
  </xsl:if>
708
720
  </xsl:template>
709
721
 
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
722
 
764
723
  <xsl:template match="*[local-name()='p']/*[local-name()='fn']/*[local-name()='p']">
765
724
  <xsl:apply-templates/>
766
725
  </xsl:template>
767
726
 
768
-
769
-
727
+
770
728
  <xsl:template match="*[local-name()='bibitem']">
771
729
  <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
772
730
  <xsl:variable name="docidentifier">
@@ -827,37 +785,7 @@
827
785
  </fo:footnote>
828
786
  </xsl:template>
829
787
 
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
-
788
+
861
789
  <xsl:template match="jcgm:fn/jcgm:p">
862
790
  <fo:block>
863
791
  <xsl:apply-templates/>
@@ -927,9 +855,10 @@
927
855
  </xsl:variable>
928
856
  <fo:block line-height="1.1" role="H{$level}">
929
857
  <fo:block font-weight="bold" keep-with-next="always">
930
- <xsl:apply-templates select="ancestor::*[local-name()='term']/*[local-name()='name']" mode="presentation"/>
858
+ <xsl:apply-templates select="ancestor::*[local-name()='term'][1]/*[local-name()='name']" mode="presentation"/>
931
859
  </fo:block>
932
860
  <fo:block font-weight="bold" keep-with-next="always">
861
+ <xsl:call-template name="setStyle_preferred"/>
933
862
  <xsl:apply-templates/>
934
863
  </fo:block>
935
864
  </fo:block>
@@ -944,6 +873,7 @@
944
873
  <xsl:apply-templates select="preceding-sibling::*[local-name()='term_name'][1]" mode="presentation"/>
945
874
  </fo:block>
946
875
  <fo:block font-weight="bold" keep-with-next="always">
876
+ <xsl:call-template name="setStyle_preferred"/>
947
877
  <xsl:apply-templates/>
948
878
  </fo:block>
949
879
  </fo:block>
@@ -1268,7 +1198,11 @@
1268
1198
  </xsl:variable>
1269
1199
 
1270
1200
  <xsl:template name="insertHeaderFooter">
1201
+ <xsl:param name="isDraft"/>
1271
1202
  <fo:static-content flow-name="header-even-jcgm" role="artifact">
1203
+ <xsl:call-template name="insertDraftWatermark">
1204
+ <xsl:with-param name="isDraft" select="$isDraft"/>
1205
+ </xsl:call-template>
1272
1206
  <fo:block-container height="98%">
1273
1207
  <fo:block font-size="13pt" font-weight="bold" padding-top="12mm">
1274
1208
  <xsl:value-of select="$header_text"/>
@@ -1287,6 +1221,9 @@
1287
1221
  </fo:block-container>
1288
1222
  </fo:static-content>
1289
1223
  <fo:static-content flow-name="header-odd-jcgm" role="artifact">
1224
+ <xsl:call-template name="insertDraftWatermark">
1225
+ <xsl:with-param name="isDraft" select="$isDraft"/>
1226
+ </xsl:call-template>
1290
1227
  <fo:block-container height="98%">
1291
1228
  <fo:block font-size="13pt" font-weight="bold" text-align="right" padding-top="12mm">
1292
1229
  <xsl:value-of select="$header_text"/>
@@ -1302,9 +1239,49 @@
1302
1239
  <fo:inline font-size="12pt" font-weight="bold"><fo:page-number/></fo:inline>
1303
1240
  </fo:inline>
1304
1241
  </fo:block>
1305
-
1306
1242
  </fo:block-container>
1307
1243
  </fo:static-content>
1244
+ <fo:static-content flow-name="header-blank" role="artifact">
1245
+ <xsl:call-template name="insertDraftWatermark">
1246
+ <xsl:with-param name="isDraft" select="$isDraft"/>
1247
+ </xsl:call-template>
1248
+ <fo:block/>
1249
+ </fo:static-content>
1250
+ </xsl:template>
1251
+
1252
+ <xsl:template name="insertDraftWatermark">
1253
+ <xsl:param name="isDraft"/>
1254
+ <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'">
1255
+ <!-- DRAFT -->
1256
+ <xsl:variable name="draft_label">
1257
+ <xsl:call-template name="getLocalizedString">
1258
+ <xsl:with-param name="key">draft_label</xsl:with-param>
1259
+ </xsl:call-template>
1260
+ </xsl:variable>
1261
+ <fo:block-container absolute-position="fixed" left="0mm" top="30mm">
1262
+ <fo:block line-height="0">
1263
+ <fo:instream-foreign-object fox:alt-text="DRAFT">
1264
+ <svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="200mm" height="250mm">
1265
+ <svg:g transform="rotate(-45) scale(0.6, 1)">
1266
+ <xsl:variable name="font-size">
1267
+ <xsl:choose>
1268
+ <xsl:when test="string-length($draft_label) &gt; 5">150</xsl:when>
1269
+ <xsl:otherwise>260</xsl:otherwise>
1270
+ </xsl:choose>
1271
+ </xsl:variable>
1272
+ <svg:text x="-175mm" y="205mm" style="font-family:Arial;font-size:{$font-size}pt;font-weight:normal;fill:rgb(223, 223, 223);">
1273
+ <xsl:if test="string-length($draft_label) &gt; 5">
1274
+ <xsl:attribute name="x">-175mm</xsl:attribute>
1275
+ <xsl:attribute name="y">180mm</xsl:attribute>
1276
+ </xsl:if>
1277
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($draft_label))"/>
1278
+ </svg:text>
1279
+ </svg:g>
1280
+ </svg:svg>
1281
+ </fo:instream-foreign-object>
1282
+ </fo:block>
1283
+ </fo:block-container>
1284
+ </xsl:if>
1308
1285
  </xsl:template>
1309
1286
 
1310
1287
  <xsl:template match="jcgm:title">
@@ -2599,6 +2576,80 @@
2599
2576
 
2600
2577
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2601
2578
  <xsl:attribute name="line-height">135%</xsl:attribute>
2579
+ </xsl:attribute-set><xsl:attribute-set name="fn-style">
2580
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2581
+ </xsl:attribute-set><xsl:attribute-set name="fn-num-style">
2582
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2583
+
2584
+ <xsl:attribute name="font-size">65%</xsl:attribute>
2585
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2586
+
2587
+
2588
+
2589
+
2590
+
2591
+
2592
+
2593
+
2594
+
2595
+
2596
+
2597
+
2598
+
2599
+
2600
+
2601
+
2602
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
2603
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2604
+ <xsl:attribute name="font-style">normal</xsl:attribute>
2605
+ <xsl:attribute name="text-indent">0</xsl:attribute>
2606
+ <xsl:attribute name="start-indent">0</xsl:attribute>
2607
+
2608
+
2609
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
2610
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2611
+ <xsl:attribute name="line-height">124%</xsl:attribute>
2612
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2613
+
2614
+
2615
+
2616
+
2617
+
2618
+
2619
+
2620
+
2621
+
2622
+
2623
+
2624
+
2625
+
2626
+
2627
+
2628
+
2629
+
2630
+ </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
2631
+ <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
2632
+
2633
+ <xsl:attribute name="font-size">60%</xsl:attribute>
2634
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2635
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2636
+
2637
+
2638
+
2639
+
2640
+
2641
+
2642
+
2643
+
2644
+
2645
+
2646
+
2647
+
2648
+
2649
+
2650
+
2651
+
2652
+
2602
2653
  </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
2654
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2604
2655
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2624,7 +2675,8 @@
2624
2675
  <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
2676
 
2626
2677
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2627
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2678
+
2679
+ <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
2680
  <xsl:sort select="@displayorder" data-type="number"/>
2629
2681
  <xsl:apply-templates select="." mode="contents"/>
2630
2682
  </xsl:for-each>
@@ -2634,7 +2686,7 @@
2634
2686
  <xsl:apply-templates select="." mode="contents"/>
2635
2687
  </xsl:for-each>
2636
2688
 
2637
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2689
+ <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
2690
  <xsl:sort select="@displayorder" data-type="number"/>
2639
2691
  <xsl:apply-templates select="." mode="contents"/>
2640
2692
  </xsl:for-each>
@@ -3639,6 +3691,102 @@
3639
3691
 
3640
3692
  </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
3693
  <xsl:apply-templates/>
3694
+ </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">
3695
+
3696
+ <!-- list of footnotes to calculate actual footnotes number -->
3697
+ <xsl:variable name="p_fn_">
3698
+ <xsl:choose>
3699
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
3700
+ <fn gen_id="{generate-id(.)}">
3701
+ <xsl:copy-of select="@*"/>
3702
+ <xsl:copy-of select="node()"/>
3703
+ </fn>
3704
+ </xsl:when>
3705
+ <xsl:otherwise>
3706
+ <!-- itetation for:
3707
+ footnotes in bibdata/title
3708
+ footnotes in bibliography
3709
+ footnotes in document's body (except table's head/body/foot and figure text)
3710
+ -->
3711
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
3712
+ <fn gen_id="{generate-id(.)}">
3713
+ <xsl:copy-of select="@*"/>
3714
+ <xsl:copy-of select="node()"/>
3715
+ </fn>
3716
+ </xsl:for-each>
3717
+ <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']/*">
3718
+ <xsl:sort select="@displayorder" data-type="number"/>
3719
+ <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])]">
3720
+ <!-- copy unique fn -->
3721
+ <fn gen_id="{generate-id(.)}">
3722
+ <xsl:copy-of select="@*"/>
3723
+ <xsl:copy-of select="node()"/>
3724
+ </fn>
3725
+ </xsl:for-each>
3726
+ </xsl:for-each>
3727
+ </xsl:otherwise>
3728
+ </xsl:choose>
3729
+ </xsl:variable>
3730
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
3731
+
3732
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
3733
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
3734
+ <xsl:variable name="reference" select="@reference"/>
3735
+ <!-- fn sequence number in document -->
3736
+ <xsl:variable name="current_fn_number">
3737
+ <xsl:choose>
3738
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
3739
+ <xsl:otherwise>
3740
+ <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
3741
+ </xsl:otherwise>
3742
+ </xsl:choose>
3743
+ </xsl:variable>
3744
+ <xsl:variable name="current_fn_number_text">
3745
+ <xsl:value-of select="$current_fn_number"/>
3746
+
3747
+
3748
+ </xsl:variable>
3749
+
3750
+ <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3751
+ <xsl:variable name="footnote_inline">
3752
+ <fo:inline xsl:use-attribute-sets="fn-num-style">
3753
+
3754
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3755
+ <xsl:value-of select="$current_fn_number_text"/>
3756
+ </fo:basic-link>
3757
+ </fo:inline>
3758
+ </xsl:variable>
3759
+ <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3760
+ gen_id=<xsl:value-of select="$gen_id"/> -->
3761
+ <xsl:choose>
3762
+ <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3763
+ <xsl:copy-of select="$footnote_inline"/>
3764
+ </xsl:when>
3765
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
3766
+ <fo:footnote xsl:use-attribute-sets="fn-style">
3767
+ <xsl:copy-of select="$footnote_inline"/>
3768
+ <fo:footnote-body>
3769
+
3770
+ <fo:block-container text-indent="0" start-indent="0">
3771
+
3772
+
3773
+ <fo:block xsl:use-attribute-sets="fn-body-style">
3774
+
3775
+
3776
+ <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
3777
+
3778
+ <xsl:value-of select="$current_fn_number_text"/>
3779
+ </fo:inline>
3780
+ <xsl:apply-templates/>
3781
+ </fo:block>
3782
+ </fo:block-container>
3783
+ </fo:footnote-body>
3784
+ </fo:footnote>
3785
+ </xsl:when>
3786
+ <xsl:otherwise>
3787
+ <xsl:copy-of select="$footnote_inline"/>
3788
+ </xsl:otherwise>
3789
+ </xsl:choose>
3642
3790
  </xsl:template><xsl:template name="fn_display">
3643
3791
  <xsl:variable name="references">
3644
3792
 
@@ -3840,6 +3988,8 @@
3840
3988
 
3841
3989
  </fo:basic-link>
3842
3990
  </fo:inline>
3991
+ </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
3992
+ <fo:inline><xsl:value-of select="."/></fo:inline>
3843
3993
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3844
3994
  <fo:inline>
3845
3995
  <xsl:apply-templates/>
@@ -4153,6 +4303,7 @@
4153
4303
  <fo:table-cell>
4154
4304
 
4155
4305
  <fo:block margin-top="6pt">
4306
+ <xsl:copy-of select="@id"/>
4156
4307
 
4157
4308
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
4158
4309
 
@@ -4845,22 +4996,6 @@
4845
4996
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4846
4997
  <xsl:apply-templates/>
4847
4998
  </fo:inline>
4848
- </xsl:template><xsl:template match="*[local-name() = 'modification']">
4849
- <xsl:variable name="title-modified">
4850
-
4851
- <xsl:call-template name="getLocalizedString">
4852
- <xsl:with-param name="key">modified</xsl:with-param>
4853
- </xsl:call-template>
4854
-
4855
-
4856
- </xsl:variable>
4857
-
4858
- <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4859
- <xsl:choose>
4860
- <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>
4861
- <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>
4862
- </xsl:choose>
4863
- <xsl:apply-templates/>
4864
4999
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
4865
5000
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
4866
5001
 
@@ -4992,14 +5127,18 @@
4992
5127
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
4993
5128
  <fo:inline><xsl:apply-templates/></fo:inline>
4994
5129
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
5130
+ <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
4995
5131
  <fo:block id="{@id}">
4996
5132
  <xsl:apply-templates/>
4997
5133
  </fo:block>
4998
5134
  </xsl:template><xsl:template match="*[local-name() = 'term']">
5135
+ <!-- <xsl:message>'term' <xsl:number/> processing, name=<xsl:value-of select="iso:name"/>, preferred=<xsl:value-of select="iso:preferred"/>...</xsl:message> -->
4999
5136
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
5000
5137
 
5001
5138
 
5002
-
5139
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
5140
+
5141
+ </xsl:if>
5003
5142
  <xsl:apply-templates/>
5004
5143
  </fo:block>
5005
5144
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
@@ -5423,12 +5562,12 @@
5423
5562
  </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">
5424
5563
  <xsl:apply-templates mode="contents"/>
5425
5564
  <xsl:text> </xsl:text>
5426
- </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">
5565
+ </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">
5427
5566
  <xsl:apply-templates mode="bookmarks"/>
5428
5567
  <xsl:text> </xsl:text>
5429
5568
  </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">
5430
5569
  <xsl:value-of select="."/>
5431
- </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">
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' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
5432
5571
  <xsl:value-of select="."/>
5433
5572
  </xsl:template><xsl:template match="node()" mode="contents">
5434
5573
  <xsl:apply-templates mode="contents"/>
@@ -5698,6 +5837,8 @@
5698
5837
 
5699
5838
 
5700
5839
 
5840
+
5841
+
5701
5842
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5702
5843
  <xsl:variable name="_font-size">
5703
5844
 
@@ -5731,13 +5872,17 @@
5731
5872
 
5732
5873
 
5733
5874
 
5875
+
5876
+
5734
5877
  <xsl:apply-templates/>
5735
5878
  </fo:block>
5736
-
5879
+
5737
5880
 
5738
5881
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5739
5882
 
5740
5883
 
5884
+
5885
+
5741
5886
  </fo:block-container>
5742
5887
  </fo:block-container>
5743
5888
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -5973,7 +6118,8 @@
5973
6118
  </fo:block>
5974
6119
  </fo:table-cell>
5975
6120
  </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
5976
- <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" -->
6121
+ <fo:block font-size="11pt">
6122
+
5977
6123
  <xsl:apply-templates/>
5978
6124
  </fo:block>
5979
6125
  </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
@@ -6088,58 +6234,69 @@
6088
6234
  <xsl:variable name="termsource_text">
6089
6235
  <xsl:apply-templates/>
6090
6236
  </xsl:variable>
6091
-
6092
- <xsl:choose>
6237
+ <xsl:copy-of select="$termsource_text"/>
6238
+ <!-- <xsl:choose>
6093
6239
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
6094
- <!-- <xsl:apply-templates /> -->
6095
6240
  <xsl:copy-of select="$termsource_text"/>
6096
6241
  </xsl:when>
6097
- <xsl:otherwise>
6098
-
6242
+ <xsl:otherwise>
6243
+ <xsl:if test="$namespace = 'bsi'">
6244
+ <xsl:choose>
6245
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>{</xsl:text></xsl:when>
6246
+ <xsl:otherwise><xsl:text>[</xsl:text></xsl:otherwise>
6247
+ </xsl:choose>
6248
+ </xsl:if>
6249
+ <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'">
6099
6250
  <xsl:text>[</xsl:text>
6100
-
6101
- <!-- <xsl:apply-templates /> -->
6251
+ </xsl:if>
6102
6252
  <xsl:copy-of select="$termsource_text"/>
6103
-
6253
+ <xsl:if test="$namespace = 'bsi'">
6254
+ <xsl:choose>
6255
+ <xsl:when test="$document_type = 'PAS' and starts-with(*[local-name() = 'origin']/@citeas, '[')"><xsl:text>}</xsl:text></xsl:when>
6256
+ <xsl:otherwise><xsl:text>]</xsl:text></xsl:otherwise>
6257
+ </xsl:choose>
6258
+ </xsl:if>
6259
+ <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'">
6104
6260
  <xsl:text>]</xsl:text>
6105
-
6261
+ </xsl:if>
6106
6262
  </xsl:otherwise>
6107
- </xsl:choose>
6263
+ </xsl:choose> -->
6108
6264
  </fo:block>
6109
6265
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6110
6266
  <xsl:if test="normalize-space() != ''">
6111
6267
  <xsl:value-of select="."/>
6112
6268
  </xsl:if>
6113
- </xsl:template><xsl:variable name="localized.source">
6114
- <xsl:call-template name="getLocalizedString">
6115
- <xsl:with-param name="key">source</xsl:with-param>
6116
- </xsl:call-template>
6117
- </xsl:variable><xsl:template match="*[local-name() = 'origin']">
6269
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/*[local-name() = 'strong'][1][following-sibling::*[1][local-name() = 'origin']]/text()">
6270
+ <fo:inline>
6271
+
6272
+
6273
+ <xsl:value-of select="."/>
6274
+ </fo:inline>
6275
+ </xsl:template><xsl:template match="*[local-name() = 'origin']">
6118
6276
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6119
6277
  <xsl:if test="normalize-space(@citeas) = ''">
6120
6278
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6121
6279
  </xsl:if>
6122
-
6123
-
6124
- <fo:inline>
6125
-
6126
-
6127
-
6128
-
6129
-
6130
-
6131
- <xsl:value-of select="$localized.source"/>
6132
- <xsl:text> </xsl:text>
6133
-
6134
-
6135
-
6136
- </fo:inline>
6137
-
6138
6280
  <fo:inline xsl:use-attribute-sets="origin-style">
6139
6281
  <xsl:apply-templates/>
6140
6282
  </fo:inline>
6283
+ </fo:basic-link>
6284
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
6285
+ <xsl:variable name="title-modified">
6141
6286
 
6142
- </fo:basic-link>
6287
+ <xsl:call-template name="getLocalizedString">
6288
+ <xsl:with-param name="key">modified</xsl:with-param>
6289
+ </xsl:call-template>
6290
+
6291
+
6292
+ </xsl:variable>
6293
+
6294
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6295
+ <xsl:choose>
6296
+ <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>
6297
+ <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>
6298
+ </xsl:choose>
6299
+ <xsl:apply-templates/>
6143
6300
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
6144
6301
  <fo:inline><xsl:apply-templates/></fo:inline>
6145
6302
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
@@ -6192,12 +6349,20 @@
6192
6349
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6193
6350
  <xsl:text>— </xsl:text>
6194
6351
  <xsl:apply-templates/>
6195
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
6352
+ </xsl:template><xsl:variable name="bibitem_hidden_">
6353
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6354
+ <xsl:copy-of select="."/>
6355
+ </xsl:for-each>
6356
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
6357
+ <xsl:copy-of select="."/>
6358
+ </xsl:for-each>
6359
+ </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
6196
6360
 
6197
6361
  <xsl:variable name="bibitemid">
6198
6362
  <xsl:choose>
6199
- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
6200
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6363
+ <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
6364
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
6365
+ <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6201
6366
  <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6202
6367
  </xsl:choose>
6203
6368
  </xsl:variable>
@@ -6286,10 +6451,10 @@
6286
6451
  </xsl:choose>
6287
6452
  </xsl:variable>
6288
6453
 
6289
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
6454
+ <!-- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/> -->
6290
6455
 
6291
6456
  <xsl:choose>
6292
- <xsl:when test="$language = 'zh'">
6457
+ <xsl:when test="$lang = 'zh'">
6293
6458
  <fo:inline><xsl:value-of select="$tab_zh"/></fo:inline>
6294
6459
  </xsl:when>
6295
6460
  <xsl:when test="../../@inline-header = 'true'">
@@ -6332,15 +6497,20 @@
6332
6497
  <fo:block xsl:use-attribute-sets="deprecates-style">
6333
6498
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
6334
6499
  </fo:block>
6500
+ </xsl:template><xsl:template name="setStyle_preferred">
6501
+ <xsl:if test="*[local-name() = 'strong']">
6502
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
6503
+ </xsl:if>
6335
6504
  </xsl:template><xsl:template match="*[local-name() = 'definition']">
6336
6505
  <fo:block xsl:use-attribute-sets="definition-style">
6337
6506
  <xsl:apply-templates/>
6338
6507
  </fo:block>
6339
6508
  </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]">
6340
6509
  <xsl:apply-templates/>
6341
- </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p']">
6510
+ </xsl:template><xsl:template match="*[local-name() = 'definition'][preceding-sibling::*[local-name() = 'domain']]/*[local-name() = 'p'][1]">
6342
6511
  <fo:inline> <xsl:apply-templates/></fo:inline>
6343
- <fo:block> </fo:block>
6512
+ <!-- <fo:block>&#xA0;</fo:block> -->
6513
+ <fo:block/>
6344
6514
  </xsl:template><xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
6345
6515
 
6346
6516
  <fo:block>
@@ -6743,7 +6913,31 @@
6743
6913
  <fo:block-container border="1pt solid black" width="50%">
6744
6914
  <fo:block> </fo:block>
6745
6915
  </fo:block-container>
6746
- </xsl:template><xsl:template match="*[local-name() = 'toc']">
6916
+ </xsl:template><xsl:variable name="toc_level">
6917
+ <xsl:choose>
6918
+ <xsl:when test="1 = 2"/> <!-- to do https://github.com/metanorma/mn-native-pdf/issues/337: if there is value in xml -->
6919
+ <xsl:otherwise><!-- default value -->
6920
+
6921
+
6922
+
6923
+
6924
+
6925
+
6926
+
6927
+
6928
+ 3
6929
+
6930
+
6931
+
6932
+
6933
+
6934
+
6935
+
6936
+
6937
+
6938
+ </xsl:otherwise>
6939
+ </xsl:choose>
6940
+ </xsl:variable><xsl:template match="*[local-name() = 'toc']">
6747
6941
  <xsl:param name="colwidths"/>
6748
6942
  <xsl:variable name="colwidths_">
6749
6943
  <xsl:choose>
@@ -7275,12 +7469,15 @@
7275
7469
  <xsl:param name="default">left</xsl:param>
7276
7470
  <xsl:attribute name="text-align">
7277
7471
  <xsl:choose>
7278
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7472
+ <xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
7279
7473
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7280
7474
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7281
7475
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7282
7476
  </xsl:choose>
7283
7477
  </xsl:attribute>
7478
+ <xsl:if test="@align = 'indent'">
7479
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
7480
+ </xsl:if>
7284
7481
  </xsl:template><xsl:template name="number-to-words">
7285
7482
  <xsl:param name="number"/>
7286
7483
  <xsl:param name="first"/>
@@ -7377,4 +7574,14 @@
7377
7574
  </xsl:otherwise>
7378
7575
  </xsl:choose>
7379
7576
  </xsl:if>
7577
+ </xsl:template><xsl:template name="setAltText">
7578
+ <xsl:param name="value"/>
7579
+ <xsl:attribute name="fox:alt-text">
7580
+ <xsl:choose>
7581
+ <xsl:when test="normalize-space($value) != ''">
7582
+ <xsl:value-of select="$value"/>
7583
+ </xsl:when>
7584
+ <xsl:otherwise>_</xsl:otherwise>
7585
+ </xsl:choose>
7586
+ </xsl:attribute>
7380
7587
  </xsl:template></xsl:stylesheet>