metanorma-bipm 2.1.1 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -167,7 +167,7 @@
167
167
  <xsl:template name="generateContents">
168
168
  <contents>
169
169
 
170
- <xsl:apply-templates select="/*/bipm:preface/*[position() &gt; 1]" mode="contents"/>
170
+ <xsl:apply-templates select="/*/bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][position() &gt; 1]" mode="contents"/>
171
171
 
172
172
  <xsl:apply-templates select="/*/bipm:sections/*" mode="contents"/>
173
173
  <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[@normative='true']" mode="contents"/>
@@ -631,7 +631,7 @@
631
631
  </xsl:template>
632
632
 
633
633
 
634
- <xsl:template match="bipm:note" name="change_note_kind" mode="flatxml">
634
+ <xsl:template match="bipm:note[not(parent::bipm:preface)]" name="change_note_kind" mode="flatxml">
635
635
  <xsl:variable name="element">
636
636
  <xsl:choose>
637
637
  <xsl:when test="ancestor::bipm:quote">note</xsl:when>
@@ -949,7 +949,9 @@
949
949
 
950
950
  <xsl:call-template name="insertFootnoteSeparator"/>
951
951
 
952
- <xsl:call-template name="insertHeaderDraftWatermark"/>
952
+ <xsl:call-template name="insertHeaderDraftWatermark">
953
+ <xsl:with-param name="lang" select="$curr_lang"/>
954
+ </xsl:call-template>
953
955
 
954
956
  <fo:flow flow-name="xsl-region-body" font-family="Arial">
955
957
 
@@ -1020,17 +1022,17 @@
1020
1022
  </fo:page-sequence>
1021
1023
 
1022
1024
 
1023
- <xsl:if test="bipm:preface/*">
1025
+ <xsl:if test="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]">
1024
1026
  <fo:page-sequence master-reference="document" force-page-count="no-force">
1025
1027
  <xsl:call-template name="insertFootnoteSeparator"/>
1026
1028
 
1027
1029
  <xsl:variable name="header-title">
1028
1030
  <xsl:choose>
1029
- <xsl:when test="bipm:preface/*[1]/bipm:title[1]/*[local-name() = 'tab']">
1030
- <xsl:apply-templates select="bipm:preface/*[1]/bipm:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
1031
+ <xsl:when test="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/bipm:title[1]/*[local-name() = 'tab']">
1032
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/bipm:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
1031
1033
  </xsl:when>
1032
1034
  <xsl:otherwise>
1033
- <xsl:apply-templates select="bipm:preface/*[1]/bipm:title[1]" mode="header"/>
1035
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/bipm:title[1]" mode="header"/>
1034
1036
  </xsl:otherwise>
1035
1037
  </xsl:choose>
1036
1038
  </xsl:variable>
@@ -1040,7 +1042,7 @@
1040
1042
 
1041
1043
  <fo:flow flow-name="xsl-region-body">
1042
1044
  <fo:block line-height="135%">
1043
- <xsl:apply-templates select="bipm:preface/*[1]"/>
1045
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]"/>
1044
1046
  </fo:block>
1045
1047
  </fo:flow>
1046
1048
  </fo:page-sequence>
@@ -1139,7 +1141,7 @@
1139
1141
  </fo:page-sequence>
1140
1142
 
1141
1143
 
1142
- <xsl:apply-templates select="bipm:preface/*[position() &gt; 1]" mode="sections"/> <!-- bipm:clause -->
1144
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][position() &gt; 1]" mode="sections"/> <!-- bipm:clause -->
1143
1145
 
1144
1146
 
1145
1147
 
@@ -1164,6 +1166,7 @@
1164
1166
  <!-- Index -->
1165
1167
  <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index">
1166
1168
  <xsl:with-param name="isDraft" select="normalize-space(//bipm:bipm-standard/bipm:bibdata/bipm:version/bipm:draft or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'draft') or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'projet'))"/>
1169
+ <xsl:with-param name="lang" select="$curr_lang"/>
1167
1170
  </xsl:apply-templates>
1168
1171
 
1169
1172
  <!-- End Document Pages -->
@@ -1304,7 +1307,7 @@
1304
1307
  </fo:page-sequence>
1305
1308
 
1306
1309
 
1307
- <xsl:apply-templates select="bipm:preface/*" mode="sections"/>
1310
+ <xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]" mode="sections"/>
1308
1311
 
1309
1312
  <!-- Document Pages -->
1310
1313
  <xsl:apply-templates select="bipm:sections/*" mode="sections"/>
@@ -1324,6 +1327,7 @@
1324
1327
  <!-- Index -->
1325
1328
  <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index">
1326
1329
  <xsl:with-param name="isDraft" select="normalize-space(//bipm:bipm-standard/bipm:bibdata/bipm:version/bipm:draft or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'draft') or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'projet'))"/>
1330
+ <xsl:with-param name="lang" select="$curr_lang"/>
1327
1331
  </xsl:apply-templates>
1328
1332
 
1329
1333
  </xsl:otherwise>
@@ -1640,7 +1644,9 @@
1640
1644
  </fo:block>
1641
1645
  </fo:block-container>
1642
1646
 
1643
- <xsl:call-template name="insertDraftWatermark"/>
1647
+ <xsl:call-template name="insertDraftWatermark">
1648
+ <xsl:with-param name="lang" select="$doc_split_by_language"/>
1649
+ </xsl:call-template>
1644
1650
 
1645
1651
  <!-- BIPM logo -->
1646
1652
  <fo:block-container absolute-position="fixed" left="12.8mm" top="12.2mm">
@@ -2280,7 +2286,7 @@
2280
2286
  <!-- ====== -->
2281
2287
 
2282
2288
 
2283
- <xsl:template match="bipm:preface/*[1]" priority="3">
2289
+ <xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]" priority="3">
2284
2290
  <fo:table table-layout="fixed" width="173.5mm">
2285
2291
  <xsl:call-template name="setId"/>
2286
2292
  <fo:table-column column-width="137mm"/>
@@ -2371,7 +2377,7 @@
2371
2377
  </xsl:template>
2372
2378
 
2373
2379
 
2374
- <xsl:template match="bipm:preface/*[1]/*" mode="clause_table">
2380
+ <xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/*" mode="clause_table">
2375
2381
  <xsl:param name="rows"/>
2376
2382
 
2377
2383
  <xsl:variable name="current_row"><xsl:number count="*"/></xsl:variable>
@@ -2403,7 +2409,7 @@
2403
2409
  <xsl:variable name="end_row" select="$current_row + $number-rows-spanned"/>
2404
2410
  <fo:block>
2405
2411
 
2406
- <xsl:for-each select="ancestor::bipm:preface/*[1]/*[position() &gt;= $start_row and position() &lt; $end_row]//bipm:note_side">
2412
+ <xsl:for-each select="ancestor::bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/*[position() &gt;= $start_row and position() &lt; $end_row]//bipm:note_side">
2407
2413
  <xsl:apply-templates select="." mode="note_side"/>
2408
2414
  </xsl:for-each>
2409
2415
  </fo:block>
@@ -2663,7 +2669,7 @@
2663
2669
 
2664
2670
 
2665
2671
  <!-- skip, because it process in note_side template -->
2666
- <xsl:template match="bipm:preface/*[1]//bipm:note_side" priority="3"/>
2672
+ <xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]//bipm:note_side" priority="3"/>
2667
2673
 
2668
2674
 
2669
2675
  <xsl:template match="bipm:sections//bipm:note_side | bipm:annex//bipm:note_side" priority="3">
@@ -3273,9 +3279,11 @@
3273
3279
  <xsl:param name="header-title"/>
3274
3280
  <xsl:param name="orientation"/>
3275
3281
  <xsl:param name="isDraft"/>
3282
+ <xsl:param name="lang"/>
3276
3283
  <fo:static-content flow-name="header-odd" role="artifact">
3277
3284
  <xsl:call-template name="insertDraftWatermark">
3278
3285
  <xsl:with-param name="isDraft" select="$isDraft"/>
3286
+ <xsl:with-param name="lang" select="$lang"/>
3279
3287
  </xsl:call-template>
3280
3288
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3281
3289
  <fo:block text-align="right">
@@ -3296,6 +3304,7 @@
3296
3304
  <fo:static-content flow-name="header-even" role="artifact">
3297
3305
  <xsl:call-template name="insertDraftWatermark">
3298
3306
  <xsl:with-param name="isDraft" select="$isDraft"/>
3307
+ <xsl:with-param name="lang" select="$lang"/>
3299
3308
  </xsl:call-template>
3300
3309
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3301
3310
  <fo:block>
@@ -3313,6 +3322,7 @@
3313
3322
  <fo:static-content flow-name="header-blank" role="artifact">
3314
3323
  <xsl:call-template name="insertDraftWatermark">
3315
3324
  <xsl:with-param name="isDraft" select="$isDraft"/>
3325
+ <xsl:with-param name="lang" select="$lang"/>
3316
3326
  </xsl:call-template>
3317
3327
  <fo:block/>
3318
3328
  </fo:static-content>
@@ -3320,12 +3330,23 @@
3320
3330
 
3321
3331
  <xsl:template name="insertDraftWatermark">
3322
3332
  <xsl:param name="isDraft"/>
3333
+ <xsl:param name="lang"/>
3323
3334
  <xsl:if test="$isDraft = 'true' or normalize-space(//bipm:bipm-standard/bipm:bibdata/bipm:version/bipm:draft or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'draft') or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'projet')) = 'true'">
3324
3335
  <!-- DRAFT -->
3325
3336
  <xsl:variable name="draft_label">
3326
- <xsl:call-template name="getLocalizedString">
3327
- <xsl:with-param name="key">draft_label</xsl:with-param>
3328
- </xsl:call-template>
3337
+ <xsl:choose>
3338
+ <xsl:when test="normalize-space($lang) != ''">
3339
+ <xsl:call-template name="getLocalizedString">
3340
+ <xsl:with-param name="key">draft_label</xsl:with-param>
3341
+ <xsl:with-param name="lang" select="$lang"/>
3342
+ </xsl:call-template>
3343
+ </xsl:when>
3344
+ <xsl:otherwise>
3345
+ <xsl:call-template name="getLocalizedString">
3346
+ <xsl:with-param name="key">draft_label</xsl:with-param>
3347
+ </xsl:call-template>
3348
+ </xsl:otherwise>
3349
+ </xsl:choose>
3329
3350
  </xsl:variable>
3330
3351
  <fo:block-container absolute-position="fixed" left="0mm" top="30mm">
3331
3352
  <fo:block line-height="0">
@@ -3355,25 +3376,30 @@
3355
3376
 
3356
3377
  <xsl:template name="insertHeaderDraftWatermark">
3357
3378
  <xsl:variable name="isDraft" select="normalize-space(//bipm:bipm-standard/bipm:bibdata/bipm:version/bipm:draft or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'draft') or contains(//bipm:bipm-standard/bipm:bibdata/bipm:status/bipm:stage, 'projet'))"/>
3379
+ <xsl:variable name="curr_lang" select="$doc_split_by_language"/>
3358
3380
  <xsl:if test="$isDraft = 'true'">
3359
3381
  <fo:static-content flow-name="header-blank" role="artifact">
3360
3382
  <xsl:call-template name="insertDraftWatermark">
3361
3383
  <xsl:with-param name="isDraft" select="$isDraft"/>
3384
+ <xsl:with-param name="lang" select="$curr_lang"/>
3362
3385
  </xsl:call-template>
3363
3386
  </fo:static-content>
3364
3387
  <fo:static-content flow-name="header" role="artifact">
3365
3388
  <xsl:call-template name="insertDraftWatermark">
3366
3389
  <xsl:with-param name="isDraft" select="$isDraft"/>
3390
+ <xsl:with-param name="lang" select="$curr_lang"/>
3367
3391
  </xsl:call-template>
3368
3392
  </fo:static-content>
3369
3393
  <fo:static-content flow-name="header-odd" role="artifact">
3370
3394
  <xsl:call-template name="insertDraftWatermark">
3371
3395
  <xsl:with-param name="isDraft" select="$isDraft"/>
3396
+ <xsl:with-param name="lang" select="$curr_lang"/>
3372
3397
  </xsl:call-template>
3373
3398
  </fo:static-content>
3374
3399
  <fo:static-content flow-name="header-even" role="artifact">
3375
3400
  <xsl:call-template name="insertDraftWatermark">
3376
3401
  <xsl:with-param name="isDraft" select="$isDraft"/>
3402
+ <xsl:with-param name="lang" select="$curr_lang"/>
3377
3403
  </xsl:call-template>
3378
3404
  </fo:static-content>
3379
3405
  </xsl:if>
@@ -3426,6 +3452,7 @@
3426
3452
  <xsl:template match="bipm:indexsect"/>
3427
3453
  <xsl:template match="bipm:indexsect" mode="index">
3428
3454
  <xsl:param name="isDraft"/>
3455
+ <xsl:param name="lang"/>
3429
3456
 
3430
3457
  <fo:page-sequence master-reference="index" force-page-count="no-force">
3431
3458
  <xsl:variable name="header-title">
@@ -3441,6 +3468,7 @@
3441
3468
  <xsl:call-template name="insertHeaderFooter">
3442
3469
  <xsl:with-param name="header-title" select="$header-title"/>
3443
3470
  <xsl:with-param name="isDraft" select="$isDraft"/>
3471
+ <xsl:with-param name="lang" select="$lang"/>
3444
3472
  </xsl:call-template>
3445
3473
 
3446
3474
  <fo:flow flow-name="xsl-region-body">
@@ -3813,14 +3841,41 @@
3813
3841
  </xsl:template>
3814
3842
 
3815
3843
 
3816
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
3844
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:variable name="table_widths_from_if_calculated_">
3845
+ <xsl:for-each select="$table_widths_from_if//table">
3846
+ <xsl:copy>
3847
+ <xsl:copy-of select="@*"/>
3848
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
3849
+ </xsl:copy>
3850
+ </xsl:for-each>
3851
+ </xsl:variable><xsl:variable name="table_widths_from_if_calculated" select="xalan:nodeset($table_widths_from_if_calculated_)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
3817
3852
  false
3818
3853
  </xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
3819
3854
  <xsl:call-template name="getLang"/>
3820
- </xsl:variable><xsl:variable name="pageWidth_">
3821
- 210
3855
+ </xsl:variable><xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/><xsl:variable name="papersize_width_">
3856
+ <xsl:choose>
3857
+ <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
3858
+ <xsl:when test="$papersize = 'a4'">210</xsl:when>
3859
+ </xsl:choose>
3860
+ </xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
3861
+ <xsl:choose>
3862
+ <xsl:when test="$papersize = 'letter'">279.4</xsl:when>
3863
+ <xsl:when test="$papersize = 'a4'">297</xsl:when>
3864
+ </xsl:choose>
3865
+ </xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
3866
+ <xsl:choose>
3867
+ <xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
3868
+ <xsl:otherwise>
3869
+ 210
3870
+ </xsl:otherwise>
3871
+ </xsl:choose>
3822
3872
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
3823
- 297
3873
+ <xsl:choose>
3874
+ <xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
3875
+ <xsl:otherwise>
3876
+ 297
3877
+ </xsl:otherwise>
3878
+ </xsl:choose>
3824
3879
  </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
3825
3880
  31.7
3826
3881
  </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
@@ -3936,9 +3991,10 @@
3936
3991
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
3937
3992
  </xsl:otherwise>
3938
3993
  </xsl:choose>
3939
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:attribute-set name="root-style">
3994
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="font_noto_sans">Noto Sans, Noto Sans HK, Noto Sans JP, Noto Sans KR, Noto Sans SC, Noto Sans TC</xsl:variable><xsl:variable name="font_noto_sans_mono">Noto Sans Mono, Noto Sans Mono CJK HK, Noto Sans Mono CJK JP, Noto Sans Mono CJK KR, Noto Sans Mono CJK SC, Noto Sans Mono CJK TC</xsl:variable><xsl:variable name="font_noto_serif">Noto Serif, Noto Serif HK, Noto Serif JP, Noto Serif KR, Noto Serif SC, Noto Serif TC</xsl:variable><xsl:attribute-set name="root-style">
3940
3995
 
3941
- <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
3996
+ <xsl:attribute name="font-family">Times New Roman, STIX Two Math, <xsl:value-of select="$font_noto_serif"/></xsl:attribute>
3997
+ <xsl:attribute name="font-family-generic">Serif</xsl:attribute>
3942
3998
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
3943
3999
 
3944
4000
 
@@ -3956,6 +4012,7 @@
3956
4012
 
3957
4013
 
3958
4014
 
4015
+
3959
4016
  </xsl:attribute-set><xsl:template name="insertRootStyle">
3960
4017
  <xsl:param name="root-style"/>
3961
4018
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
@@ -3967,17 +4024,60 @@
3967
4024
  </xsl:variable>
3968
4025
  <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
3969
4026
 
4027
+ <xsl:variable name="font_family_generic" select="$root-style_/root-style/@font-family-generic"/>
4028
+
3970
4029
  <xsl:for-each select="$root-style_/root-style/@*">
4030
+
3971
4031
  <xsl:choose>
3972
- <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
4032
+ <xsl:when test="local-name() = 'font-family-generic'"><!-- skip, it's using for determine 'sans' or 'serif' --></xsl:when>
4033
+ <xsl:when test="local-name() = 'font-family'">
4034
+
4035
+ <xsl:variable name="font_regional_prefix">
4036
+ <xsl:choose>
4037
+ <xsl:when test="$font_family_generic = 'Sans'">Noto Sans</xsl:when>
4038
+ <xsl:otherwise>Noto Serif</xsl:otherwise>
4039
+ </xsl:choose>
4040
+ </xsl:variable>
4041
+
3973
4042
  <xsl:attribute name="{local-name()}">
3974
- <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
4043
+
4044
+ <xsl:variable name="font_extended">
4045
+ <xsl:choose>
4046
+ <xsl:when test="$lang = 'zh'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
4047
+ <xsl:when test="$lang = 'hk'"><xsl:value-of select="$font_regional_prefix"/> HK</xsl:when>
4048
+ <xsl:when test="$lang = 'jp'"><xsl:value-of select="$font_regional_prefix"/> JP</xsl:when>
4049
+ <xsl:when test="$lang = 'kr'"><xsl:value-of select="$font_regional_prefix"/> KR</xsl:when>
4050
+ <xsl:when test="$lang = 'sc'"><xsl:value-of select="$font_regional_prefix"/> SC</xsl:when>
4051
+ <xsl:when test="$lang = 'tc'"><xsl:value-of select="$font_regional_prefix"/> TC</xsl:when>
4052
+ </xsl:choose>
4053
+ </xsl:variable>
4054
+ <xsl:if test="normalize-space($font_extended) != ''">
4055
+ <xsl:value-of select="$font_regional_prefix"/><xsl:text>, </xsl:text>
4056
+ <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
4057
+ </xsl:if>
4058
+
4059
+ <xsl:value-of select="."/>
4060
+
4061
+ <xsl:if test="$additional_fonts != ''">
4062
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4063
+ </xsl:if>
3975
4064
  </xsl:attribute>
3976
4065
  </xsl:when>
3977
4066
  <xsl:otherwise>
3978
4067
  <xsl:copy-of select="."/>
3979
4068
  </xsl:otherwise>
3980
4069
  </xsl:choose>
4070
+
4071
+ <!-- <xsl:choose>
4072
+ <xsl:when test="local-name() = 'font-family'">
4073
+ <xsl:attribute name="{local-name()}">
4074
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
4075
+ </xsl:attribute>
4076
+ </xsl:when>
4077
+ <xsl:otherwise>
4078
+ <xsl:copy-of select="."/>
4079
+ </xsl:otherwise>
4080
+ </xsl:choose> -->
3981
4081
  </xsl:for-each>
3982
4082
  </xsl:template><xsl:attribute-set name="copyright-statement-style">
3983
4083
 
@@ -4063,6 +4163,7 @@
4063
4163
 
4064
4164
 
4065
4165
 
4166
+
4066
4167
 
4067
4168
 
4068
4169
 
@@ -4077,7 +4178,10 @@
4077
4178
 
4078
4179
  </xsl:attribute-set><xsl:attribute-set name="requirement-style">
4079
4180
 
4181
+
4080
4182
  </xsl:attribute-set><xsl:attribute-set name="requirement-name-style">
4183
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4184
+
4081
4185
 
4082
4186
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
4083
4187
 
@@ -4103,6 +4207,7 @@
4103
4207
 
4104
4208
 
4105
4209
 
4210
+
4106
4211
 
4107
4212
  </xsl:attribute-set><xsl:attribute-set name="example-style">
4108
4213
 
@@ -4117,6 +4222,7 @@
4117
4222
 
4118
4223
 
4119
4224
 
4225
+
4120
4226
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
4121
4227
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4122
4228
 
@@ -4140,6 +4246,7 @@
4140
4246
 
4141
4247
 
4142
4248
 
4249
+
4143
4250
 
4144
4251
 
4145
4252
 
@@ -4168,10 +4275,12 @@
4168
4275
 
4169
4276
 
4170
4277
 
4278
+
4171
4279
 
4172
4280
 
4173
4281
  </xsl:attribute-set><xsl:variable name="table-border_">
4174
4282
 
4283
+
4175
4284
  </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-container-style">
4176
4285
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4177
4286
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -4196,6 +4305,7 @@
4196
4305
 
4197
4306
 
4198
4307
 
4308
+
4199
4309
 
4200
4310
 
4201
4311
 
@@ -4224,6 +4334,7 @@
4224
4334
 
4225
4335
 
4226
4336
 
4337
+
4227
4338
 
4228
4339
 
4229
4340
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
@@ -4232,6 +4343,7 @@
4232
4343
 
4233
4344
 
4234
4345
 
4346
+
4235
4347
 
4236
4348
 
4237
4349
 
@@ -4317,6 +4429,7 @@
4317
4429
 
4318
4430
 
4319
4431
 
4432
+
4320
4433
  </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
4321
4434
  <xsl:attribute name="border">solid black 1pt</xsl:attribute>
4322
4435
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
@@ -4331,7 +4444,7 @@
4331
4444
 
4332
4445
 
4333
4446
 
4334
-
4447
+
4335
4448
 
4336
4449
 
4337
4450
 
@@ -4349,6 +4462,7 @@
4349
4462
 
4350
4463
 
4351
4464
 
4465
+
4352
4466
  </xsl:attribute-set><xsl:attribute-set name="table-fn-style">
4353
4467
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4354
4468
 
@@ -4362,6 +4476,8 @@
4362
4476
 
4363
4477
 
4364
4478
 
4479
+
4480
+
4365
4481
  </xsl:attribute-set><xsl:attribute-set name="table-fn-number-style">
4366
4482
  <xsl:attribute name="font-size">80%</xsl:attribute>
4367
4483
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -4380,6 +4496,7 @@
4380
4496
 
4381
4497
 
4382
4498
 
4499
+
4383
4500
  </xsl:attribute-set><xsl:attribute-set name="fn-container-body-style">
4384
4501
  <xsl:attribute name="text-indent">0</xsl:attribute>
4385
4502
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -4415,6 +4532,27 @@
4415
4532
 
4416
4533
 
4417
4534
 
4535
+
4536
+ </xsl:attribute-set><xsl:attribute-set name="dl-name-style">
4537
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4538
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4539
+
4540
+
4541
+
4542
+
4543
+
4544
+
4545
+
4546
+
4547
+
4548
+
4549
+
4550
+
4551
+
4552
+
4553
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4554
+
4555
+
4418
4556
  </xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
4419
4557
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
4420
4558
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
@@ -4444,6 +4582,7 @@
4444
4582
 
4445
4583
 
4446
4584
 
4585
+
4447
4586
 
4448
4587
 
4449
4588
 
@@ -4483,7 +4622,8 @@
4483
4622
 
4484
4623
 
4485
4624
 
4486
-
4625
+
4626
+
4487
4627
 
4488
4628
 
4489
4629
 
@@ -4498,6 +4638,7 @@
4498
4638
  </xsl:attribute-set><xsl:attribute-set name="termnote-style">
4499
4639
 
4500
4640
 
4641
+
4501
4642
 
4502
4643
 
4503
4644
 
@@ -4510,6 +4651,8 @@
4510
4651
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4511
4652
 
4512
4653
 
4654
+ </xsl:attribute-set><xsl:attribute-set name="termnote-p-style">
4655
+
4513
4656
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
4514
4657
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
4515
4658
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -4554,6 +4697,7 @@
4554
4697
  <xsl:attribute name="text-align">left</xsl:attribute>
4555
4698
  <xsl:attribute name="margin-left">19mm</xsl:attribute>
4556
4699
  <xsl:attribute name="text-indent">-19mm</xsl:attribute>
4700
+
4557
4701
 
4558
4702
 
4559
4703
 
@@ -4598,6 +4742,7 @@
4598
4742
 
4599
4743
 
4600
4744
 
4745
+
4601
4746
  </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
4602
4747
  <xsl:attribute name="text-align">right</xsl:attribute>
4603
4748
 
@@ -4616,16 +4761,16 @@
4616
4761
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
4617
4762
 
4618
4763
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
4764
+ <xsl:attribute name="width">100%</xsl:attribute>
4765
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4766
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4619
4767
 
4620
4768
 
4621
- <xsl:attribute name="width">100%</xsl:attribute>
4622
4769
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
4623
- <xsl:attribute name="scaling">uniform</xsl:attribute>
4624
4770
 
4625
4771
 
4626
4772
 
4627
-
4628
-
4773
+
4629
4774
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
4630
4775
 
4631
4776
 
@@ -4704,6 +4849,25 @@
4704
4849
 
4705
4850
 
4706
4851
 
4852
+
4853
+ </xsl:attribute-set><xsl:attribute-set name="list-name-style">
4854
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4855
+
4856
+
4857
+
4858
+
4859
+
4860
+
4861
+
4862
+
4863
+
4864
+
4865
+
4866
+
4867
+
4868
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
4869
+
4870
+
4707
4871
  </xsl:attribute-set><xsl:attribute-set name="list-item-style">
4708
4872
 
4709
4873
 
@@ -4755,6 +4919,7 @@
4755
4919
 
4756
4920
 
4757
4921
 
4922
+
4758
4923
  </xsl:attribute-set><xsl:attribute-set name="fn-body-style">
4759
4924
  <xsl:attribute name="font-weight">normal</xsl:attribute>
4760
4925
  <xsl:attribute name="font-style">normal</xsl:attribute>
@@ -4783,6 +4948,7 @@
4783
4948
 
4784
4949
 
4785
4950
 
4951
+
4786
4952
  </xsl:attribute-set><xsl:attribute-set name="fn-body-num-style">
4787
4953
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
4788
4954
 
@@ -4806,6 +4972,7 @@
4806
4972
 
4807
4973
 
4808
4974
 
4975
+
4809
4976
  </xsl:attribute-set><xsl:attribute-set name="admonition-style">
4810
4977
 
4811
4978
 
@@ -4826,11 +4993,12 @@
4826
4993
 
4827
4994
 
4828
4995
 
4996
+
4829
4997
  </xsl:attribute-set><xsl:attribute-set name="admonition-container-style">
4998
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
4999
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
4830
5000
 
4831
5001
 
4832
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
4833
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
4834
5002
  <xsl:attribute name="padding">2mm</xsl:attribute>
4835
5003
  <xsl:attribute name="padding-top">3mm</xsl:attribute>
4836
5004
 
@@ -4842,6 +5010,7 @@
4842
5010
 
4843
5011
 
4844
5012
 
5013
+
4845
5014
  </xsl:attribute-set><xsl:attribute-set name="admonition-name-style">
4846
5015
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4847
5016
 
@@ -4877,6 +5046,7 @@
4877
5046
 
4878
5047
 
4879
5048
 
5049
+
4880
5050
  </xsl:attribute-set><xsl:attribute-set name="bibitem-normative-style">
4881
5051
 
4882
5052
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -4910,6 +5080,10 @@
4910
5080
 
4911
5081
 
4912
5082
 
5083
+ <!-- <xsl:if test="$namespace = 'ieee'">
5084
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
5085
+ <xsl:attribute name="provisional-distance-between-starts">9.5mm</xsl:attribute>
5086
+ </xsl:if> -->
4913
5087
 
4914
5088
 
4915
5089
 
@@ -4938,6 +5112,7 @@
4938
5112
 
4939
5113
 
4940
5114
 
5115
+
4941
5116
  </xsl:attribute-set><xsl:attribute-set name="bibitem-normative-list-body-style">
4942
5117
 
4943
5118
 
@@ -4966,6 +5141,7 @@
4966
5141
 
4967
5142
 
4968
5143
 
5144
+
4969
5145
  </xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-number-style">
4970
5146
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
4971
5147
 
@@ -4987,6 +5163,7 @@
4987
5163
 
4988
5164
 
4989
5165
 
5166
+
4990
5167
  </xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-body-style">
4991
5168
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4992
5169
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -5002,6 +5179,7 @@
5002
5179
 
5003
5180
 
5004
5181
 
5182
+
5005
5183
  </xsl:attribute-set><xsl:attribute-set name="references-non-normative-style">
5006
5184
 
5007
5185
  <xsl:attribute name="line-height">120%</xsl:attribute>
@@ -5124,13 +5302,13 @@
5124
5302
 
5125
5303
  </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="processPrefaceSectionsDefault_Contents">
5126
5304
  <xsl:variable name="nodes_preface_">
5127
- <xsl:for-each select="/*/*[local-name()='preface']/*">
5305
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
5128
5306
  <node id="{@id}"/>
5129
5307
  </xsl:for-each>
5130
5308
  </xsl:variable>
5131
5309
  <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
5132
5310
 
5133
- <xsl:for-each select="/*/*[local-name()='preface']/*">
5311
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
5134
5312
  <xsl:sort select="@displayorder" data-type="number"/>
5135
5313
 
5136
5314
  <!-- process Section's title -->
@@ -5196,7 +5374,7 @@
5196
5374
  </xsl:for-each>
5197
5375
  </figures>
5198
5376
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
5199
- <xsl:for-each select="/*/*[local-name()='preface']/*">
5377
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
5200
5378
  <xsl:sort select="@displayorder" data-type="number"/>
5201
5379
  <xsl:apply-templates select="."/>
5202
5380
  </xsl:for-each>
@@ -5459,6 +5637,8 @@
5459
5637
 
5460
5638
 
5461
5639
 
5640
+
5641
+
5462
5642
 
5463
5643
 
5464
5644
 
@@ -5505,6 +5685,8 @@
5505
5685
 
5506
5686
 
5507
5687
 
5688
+
5689
+
5508
5690
  </xsl:element>
5509
5691
  </xsl:variable>
5510
5692
 
@@ -5647,30 +5829,36 @@
5647
5829
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
5648
5830
  <xsl:param name="continued"/>
5649
5831
  <xsl:if test="normalize-space() != ''">
5650
- <fo:block xsl:use-attribute-sets="table-name-style">
5651
-
5652
-
5653
- <xsl:if test="not(*[local-name()='tab'])"> <!-- table without number -->
5654
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
5655
- </xsl:if>
5656
- <xsl:if test="not(../preceding-sibling::*) and ancestor::node()[@orientation]">
5657
- <xsl:attribute name="margin-top">0pt</xsl:attribute>
5658
- </xsl:if>
5659
-
5660
-
5661
-
5832
+
5833
+
5662
5834
 
5663
- <xsl:choose>
5664
- <xsl:when test="$continued = 'true'">
5835
+ <fo:block xsl:use-attribute-sets="table-name-style">
5836
+
5665
5837
 
5666
- </xsl:when>
5667
- <xsl:otherwise>
5668
- <xsl:apply-templates/>
5669
- </xsl:otherwise>
5670
- </xsl:choose>
5671
-
5838
+ <xsl:if test="not(*[local-name()='tab'])"> <!-- table without number -->
5839
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
5840
+ </xsl:if>
5841
+ <xsl:if test="not(../preceding-sibling::*) and ancestor::node()[@orientation]">
5842
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
5843
+ </xsl:if>
5844
+
5845
+
5846
+
5847
+
5848
+ <xsl:choose>
5849
+ <xsl:when test="$continued = 'true'">
5850
+
5851
+ </xsl:when>
5852
+ <xsl:otherwise>
5853
+ <xsl:apply-templates/>
5854
+ </xsl:otherwise>
5855
+ </xsl:choose>
5856
+
5857
+
5858
+ </fo:block>
5859
+
5672
5860
 
5673
- </fo:block>
5861
+
5674
5862
  </xsl:if>
5675
5863
  </xsl:template><xsl:template name="calculate-columns-numbers">
5676
5864
  <xsl:param name="table-row"/>
@@ -5833,8 +6021,9 @@
5833
6021
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
5834
6022
  </xsl:if>
5835
6023
  </xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
5836
- <xsl:param name="table"/>
5837
- <xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
6024
+ <xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
6025
+
6026
+ <!-- via intermediate format -->
5838
6027
 
5839
6028
  <!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
5840
6029
 
@@ -5845,9 +6034,8 @@
5845
6034
  <!-- get current table id -->
5846
6035
  <xsl:variable name="table_id" select="@id"/>
5847
6036
  <!-- find table by id in the file 'table_widths' -->
5848
- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
5849
- <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
5850
-
6037
+ <!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
6038
+ <xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
5851
6039
 
5852
6040
  <!-- table='<xsl:copy-of select="$table"/>' -->
5853
6041
  <!-- table_id='<xsl:value-of select="$table_id"/>\ -->
@@ -5855,24 +6043,13 @@
5855
6043
  <!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
5856
6044
 
5857
6045
  <xsl:variable name="table_with_cell_widths_">
5858
- <xsl:choose>
5859
- <xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
5860
-
5861
- <!-- Example: <column>10</column>
5862
- <column>11</column>
5863
- -->
5864
- <xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
5865
- </xsl:when>
5866
- <xsl:otherwise>
5867
- <xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
5868
- </xsl:otherwise>
5869
- </xsl:choose>
6046
+ <xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
5870
6047
  </xsl:variable>
5871
6048
  <xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
5872
6049
 
5873
- <xsl:if test="$table_if_debug = 'true'">
6050
+ <!-- <xsl:if test="$table_if_debug = 'true'">
5874
6051
  <xsl:copy-of select="$table_with_cell_widths"/>
5875
- </xsl:if>
6052
+ </xsl:if> -->
5876
6053
 
5877
6054
 
5878
6055
  <!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
@@ -5918,8 +6095,12 @@
5918
6095
 
5919
6096
  <xsl:variable name="page_width">
5920
6097
  <xsl:choose>
5921
- <xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
5922
- <xsl:otherwise>75</xsl:otherwise>
6098
+ <xsl:when test="$parent_table_page-width != ''">
6099
+ <xsl:value-of select="$parent_table_page-width"/>
6100
+ </xsl:when>
6101
+ <xsl:otherwise>
6102
+ <xsl:value-of select="@page-width"/>
6103
+ </xsl:otherwise>
5923
6104
  </xsl:choose>
5924
6105
  </xsl:variable>
5925
6106
 
@@ -5927,9 +6108,6 @@
5927
6108
  <table_width>
5928
6109
  <xsl:copy-of select="$table_widths"/>
5929
6110
  </table_width>
5930
- <!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
5931
- <debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
5932
- -->
5933
6111
  <debug>$page_width=<xsl:value-of select="$page_width"/></debug>
5934
6112
  </xsl:if>
5935
6113
 
@@ -5940,11 +6118,11 @@
5940
6118
  <xsl:when test="$table_widths/table/@width_min &gt;= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
5941
6119
  <!-- call old algorithm -->
5942
6120
  <case1/>
5943
- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
6121
+ <!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
5944
6122
  <xsl:call-template name="calculate-column-widths-proportional">
5945
6123
  <xsl:with-param name="cols-count" select="$cols-count"/>
5946
6124
  <xsl:with-param name="table" select="$table"/>
5947
- </xsl:call-template>
6125
+ </xsl:call-template> -->
5948
6126
  </xsl:when>
5949
6127
  <!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
5950
6128
  <xsl:when test="$table_widths/table/@width_max &lt;= $page_width">
@@ -5988,95 +6166,49 @@
5988
6166
  <xsl:otherwise><unknown_case/></xsl:otherwise>
5989
6167
  </xsl:choose>
5990
6168
 
6169
+ </xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
5991
6170
 
5992
- </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
5993
- <xsl:copy>
5994
- <xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
5995
- </xsl:copy>
5996
- </xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
5997
- <xsl:copy>
5998
- <xsl:copy-of select="@*"/>
6171
+ <!-- if nested 'dl' or 'table' -->
6172
+ <xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
6173
+ <parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
5999
6174
 
6000
- <!-- The maximum width is given by the widest line. -->
6001
- <xsl:variable name="widths_max">
6002
- <xsl:for-each select=".//*[local-name() = 'p']">
6003
- <xsl:call-template name="add_width"/>
6004
- </xsl:for-each>
6005
- <xsl:if test="not(*[local-name() = 'p'])">
6006
- <xsl:call-template name="add_width"/>
6007
- </xsl:if>
6008
- </xsl:variable>
6009
- <xsl:variable name="width_max">
6010
- <xsl:for-each select="xalan:nodeset($widths_max)//width">
6011
- <xsl:sort select="." data-type="number" order="descending"/>
6012
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
6013
- </xsl:for-each>
6014
- </xsl:variable>
6015
- <xsl:attribute name="width_max">
6016
- <xsl:value-of select="$width_max"/>
6017
- </xsl:attribute>
6175
+ <parent_element><xsl:value-of select="local-name(..)"/></parent_element>
6018
6176
 
6019
- <!-- The minimum width is given by the widest text element (word, image, etc.) -->
6020
- <!-- To do: image width -->
6021
- <xsl:variable name="td_text">
6022
- <xsl:apply-templates select="." mode="td_text"/>
6023
- </xsl:variable>
6024
- <xsl:variable name="words">
6025
- <xsl:variable name="string_with_added_zerospaces">
6026
- <xsl:call-template name="add-zero-spaces-java">
6027
- <xsl:with-param name="text" select="$td_text"/>
6028
- </xsl:call-template>
6177
+ <xsl:variable name="parent_table_page-width_">
6178
+ <xsl:if test="$parent_table_id != ''">
6179
+ <!-- determine column number in the parent table -->
6180
+ <xsl:variable name="parent_table_column_number">
6181
+ <xsl:choose>
6182
+ <xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
6183
+ <xsl:otherwise> <!-- parent is table -->
6184
+ <xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
6185
+ </xsl:otherwise>
6186
+ </xsl:choose>
6029
6187
  </xsl:variable>
6030
- <xsl:call-template name="tokenize">
6031
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
6032
- </xsl:call-template>
6033
- </xsl:variable>
6034
-
6035
- <xsl:variable name="max_word_length">
6036
- <xsl:call-template name="max_length">
6037
- <xsl:with-param name="words" select="xalan:nodeset($words)"/>
6038
- </xsl:call-template>
6039
- </xsl:variable>
6040
- <xsl:variable name="width_min">
6041
- <xsl:value-of select="$max_word_length"/>
6042
- </xsl:variable>
6043
- <xsl:attribute name="width_min">
6044
- <xsl:value-of select="$width_min"/>
6045
- </xsl:attribute>
6046
- <!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
6047
- <xsl:if test="$width_min &gt; $width_max">
6048
- <xsl:attribute name="width_max">
6049
- <xsl:value-of select="$width_min"/>
6050
- </xsl:attribute>
6051
- </xsl:if>
6052
- <xsl:if test="$width_min = 0">
6053
- <xsl:attribute name="width_min">1</xsl:attribute>
6188
+ <!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
6189
+ <xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
6054
6190
  </xsl:if>
6055
-
6056
- <xsl:apply-templates select="node()" mode="determine_cell_widths"/>
6057
-
6058
- </xsl:copy>
6059
- </xsl:template><xsl:template name="add_width">
6060
- <xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
6061
- <xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
6062
-
6063
- <xsl:variable name="p_text_len">
6064
- <xsl:choose>
6065
- <xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
6066
- <xsl:value-of select="$p_text_len_ * 1.5"/>
6067
- </xsl:when>
6068
- <xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
6069
- </xsl:choose>
6070
6191
  </xsl:variable>
6192
+ <xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
6071
6193
 
6072
- <xsl:variable name="math_addon_text">
6073
- <xsl:for-each select=".//*[local-name() = 'math']">
6074
- <xsl:apply-templates mode="td_text"/>
6075
- </xsl:for-each>
6076
- </xsl:variable>
6077
- <xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
6194
+ <!-- get current table id -->
6195
+ <xsl:variable name="table_id" select="@id"/>
6196
+
6197
+ <xsl:choose>
6198
+ <xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
6199
+ <!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
6200
+ <xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
6201
+ </xsl:when>
6202
+ <xsl:otherwise>
6203
+ <!-- recalculate columns width based on parent table width -->
6204
+ <xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
6205
+ <xsl:call-template name="calculate-column-widths-autolayout-algorithm">
6206
+ <xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
6207
+ </xsl:call-template>
6208
+ </xsl:for-each>
6209
+ </xsl:otherwise>
6210
+ </xsl:choose>
6078
6211
 
6079
- <width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
6080
6212
  </xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
6081
6213
  <xsl:copy>
6082
6214
  <xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
@@ -6124,12 +6256,18 @@
6124
6256
  <fo:table-row>
6125
6257
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
6126
6258
 
6127
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
6128
- <xsl:with-param name="continued">true</xsl:with-param>
6129
- </xsl:apply-templates>
6130
6259
 
6131
6260
 
6132
6261
 
6262
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
6263
+ <xsl:with-param name="continued">true</xsl:with-param>
6264
+ </xsl:apply-templates>
6265
+
6266
+
6267
+
6268
+
6269
+
6270
+
6133
6271
  </fo:table-cell>
6134
6272
  </fo:table-row>
6135
6273
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -6169,87 +6307,101 @@
6169
6307
  </xsl:choose>
6170
6308
  </xsl:variable>
6171
6309
 
6172
- <fo:table keep-with-previous="always">
6173
- <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
6174
- <xsl:variable name="name" select="local-name()"/>
6310
+
6311
+ <xsl:variable name="tableWithNotesAndFootnotes">
6312
+
6313
+ <fo:table keep-with-previous="always">
6314
+ <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
6315
+ <xsl:variable name="name" select="local-name()"/>
6316
+ <xsl:choose>
6317
+ <xsl:when test="$name = 'border-top'">
6318
+ <xsl:attribute name="{$name}">0pt solid black</xsl:attribute>
6319
+ </xsl:when>
6320
+ <xsl:when test="$name = 'border'">
6321
+ <xsl:attribute name="{$name}"><xsl:value-of select="."/></xsl:attribute>
6322
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
6323
+ </xsl:when>
6324
+ <xsl:otherwise>
6325
+ <xsl:attribute name="{$name}"><xsl:value-of select="."/></xsl:attribute>
6326
+ </xsl:otherwise>
6327
+ </xsl:choose>
6328
+ </xsl:for-each>
6329
+
6330
+
6331
+
6175
6332
  <xsl:choose>
6176
- <xsl:when test="$name = 'border-top'">
6177
- <xsl:attribute name="{$name}">0pt solid black</xsl:attribute>
6178
- </xsl:when>
6179
- <xsl:when test="$name = 'border'">
6180
- <xsl:attribute name="{$name}"><xsl:value-of select="."/></xsl:attribute>
6181
- <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
6333
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
6334
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
6335
+ <fo:table-column column-width="{@width}"/>
6336
+ </xsl:for-each>
6182
6337
  </xsl:when>
6183
6338
  <xsl:otherwise>
6184
- <xsl:attribute name="{$name}"><xsl:value-of select="."/></xsl:attribute>
6339
+ <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
6340
+ <xsl:call-template name="insertTableColumnWidth">
6341
+ <xsl:with-param name="colwidths" select="$colwidths"/>
6342
+ </xsl:call-template>
6185
6343
  </xsl:otherwise>
6186
6344
  </xsl:choose>
6187
- </xsl:for-each>
6188
-
6189
-
6190
-
6191
- <xsl:choose>
6192
- <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
6193
- <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
6194
- <fo:table-column column-width="{@width}"/>
6195
- </xsl:for-each>
6196
- </xsl:when>
6197
- <xsl:otherwise>
6198
- <!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
6199
- <xsl:call-template name="insertTableColumnWidth">
6200
- <xsl:with-param name="colwidths" select="$colwidths"/>
6201
- </xsl:call-template>
6202
- </xsl:otherwise>
6203
- </xsl:choose>
6204
-
6205
- <fo:table-body>
6206
- <fo:table-row>
6207
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6208
-
6209
-
6345
+
6346
+ <fo:table-body>
6347
+ <fo:table-row>
6348
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6349
+
6350
+
6210
6351
 
6211
-
6212
-
6213
- <!-- fn will be processed inside 'note' processing -->
6214
-
6215
-
6216
-
6217
- <xsl:if test="count(ancestor::bipm:table//*[local-name()='note']) &gt; 1">
6218
- <fo:block font-weight="bold">
6219
- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
6220
- <xsl:choose>
6221
- <xsl:when test="$curr_lang = 'fr'">Remarques</xsl:when>
6222
- <xsl:otherwise>Notes</xsl:otherwise>
6223
- </xsl:choose>
6224
- </fo:block>
6225
- </xsl:if>
6226
-
6227
-
6228
-
6229
-
6230
- <!-- for BSI (not PAS) display Notes before footnotes -->
6231
-
6232
-
6233
- <!-- except gb and bsi -->
6234
-
6235
- <xsl:apply-templates select="../*[local-name()='note']"/>
6236
6352
 
6237
-
6238
-
6239
- <!-- horizontal row separator -->
6240
-
6241
-
6242
- <!-- fn processing -->
6243
- <xsl:call-template name="table_fn_display"/>
6244
-
6245
- <!-- for PAS display Notes after footnotes -->
6246
-
6247
-
6248
- </fo:table-cell>
6249
- </fo:table-row>
6250
- </fo:table-body>
6251
-
6252
- </fo:table>
6353
+
6354
+ <!-- fn will be processed inside 'note' processing -->
6355
+
6356
+
6357
+
6358
+ <xsl:if test="count(ancestor::bipm:table//*[local-name()='note']) &gt; 1">
6359
+ <fo:block font-weight="bold">
6360
+ <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
6361
+ <xsl:choose>
6362
+ <xsl:when test="$curr_lang = 'fr'">Remarques</xsl:when>
6363
+ <xsl:otherwise>Notes</xsl:otherwise>
6364
+ </xsl:choose>
6365
+ </fo:block>
6366
+ </xsl:if>
6367
+
6368
+
6369
+
6370
+
6371
+ <!-- for BSI (not PAS) display Notes before footnotes -->
6372
+
6373
+
6374
+ <!-- except gb and bsi -->
6375
+
6376
+ <xsl:apply-templates select="../*[local-name()='note']"/>
6377
+
6378
+
6379
+
6380
+ <!-- horizontal row separator -->
6381
+
6382
+
6383
+ <!-- fn processing -->
6384
+
6385
+ <xsl:call-template name="table_fn_display"/>
6386
+
6387
+
6388
+
6389
+ <!-- for PAS display Notes after footnotes -->
6390
+
6391
+
6392
+ </fo:table-cell>
6393
+ </fo:table-row>
6394
+ </fo:table-body>
6395
+
6396
+ </fo:table>
6397
+ </xsl:variable>
6398
+
6399
+ <xsl:if test="normalize-space($tableWithNotesAndFootnotes) != ''">
6400
+ <xsl:copy-of select="$tableWithNotesAndFootnotes"/>
6401
+ </xsl:if>
6402
+
6403
+
6404
+
6253
6405
  </xsl:if>
6254
6406
  </xsl:template><xsl:template match="*[local-name()='tbody']">
6255
6407
 
@@ -6338,6 +6490,9 @@
6338
6490
 
6339
6491
 
6340
6492
 
6493
+
6494
+
6495
+
6341
6496
 
6342
6497
 
6343
6498
  <xsl:call-template name="setTableRowAttributes"/>
@@ -6357,6 +6512,8 @@
6357
6512
 
6358
6513
 
6359
6514
 
6515
+
6516
+
6360
6517
  <xsl:call-template name="setTableRowAttributes"/>
6361
6518
  <xsl:apply-templates/>
6362
6519
  </fo:table-row>
@@ -6467,6 +6624,8 @@
6467
6624
 
6468
6625
 
6469
6626
 
6627
+
6628
+
6470
6629
 
6471
6630
 
6472
6631
 
@@ -6560,7 +6719,11 @@
6560
6719
 
6561
6720
  <xsl:variable name="gen_id" select="generate-id(.)"/>
6562
6721
  <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
6563
- <xsl:variable name="reference" select="@reference"/>
6722
+ <xsl:variable name="reference_">
6723
+ <xsl:value-of select="@reference"/>
6724
+ <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
6725
+ </xsl:variable>
6726
+ <xsl:variable name="reference" select="normalize-space($reference_)"/>
6564
6727
  <!-- fn sequence number in document -->
6565
6728
  <xsl:variable name="current_fn_number">
6566
6729
  <xsl:choose>
@@ -6580,6 +6743,7 @@
6580
6743
  <xsl:variable name="footnote_inline">
6581
6744
  <fo:inline xsl:use-attribute-sets="fn-num-style">
6582
6745
 
6746
+
6583
6747
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6584
6748
  <xsl:value-of select="$current_fn_number_text"/>
6585
6749
  </fo:basic-link>
@@ -6601,8 +6765,12 @@
6601
6765
  <fo:block xsl:use-attribute-sets="fn-body-style">
6602
6766
 
6603
6767
 
6768
+
6604
6769
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
6605
6770
 
6771
+
6772
+
6773
+
6606
6774
  <xsl:value-of select="$current_fn_number_text"/>
6607
6775
  </fo:inline>
6608
6776
  <xsl:apply-templates/>
@@ -6635,7 +6803,7 @@
6635
6803
  <xsl:copy-of select="node()"/>
6636
6804
  </fn>
6637
6805
  </xsl:for-each>
6638
- <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']/*">
6806
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
6639
6807
  <xsl:sort select="@displayorder" data-type="number"/>
6640
6808
  <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])]">
6641
6809
  <!-- copy unique fn -->
@@ -6924,11 +7092,19 @@
6924
7092
 
6925
7093
 
6926
7094
 
7095
+
7096
+ <xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
7097
+ <xsl:attribute name="margin-top">0</xsl:attribute>
7098
+ </xsl:if>
7099
+
6927
7100
  <fo:block>
6928
7101
 
6929
7102
 
6930
7103
 
6931
7104
 
7105
+ <xsl:apply-templates select="*[local-name() = 'name']">
7106
+ <xsl:with-param name="process">true</xsl:with-param>
7107
+ </xsl:apply-templates>
6932
7108
 
6933
7109
  <xsl:if test="$isGenerateTableIF = 'true'">
6934
7110
  <!-- to determine start of table -->
@@ -6951,6 +7127,7 @@
6951
7127
  </xsl:choose>
6952
7128
 
6953
7129
 
7130
+
6954
7131
  <xsl:choose>
6955
7132
  <xsl:when test="$isGenerateTableIF = 'true'">
6956
7133
  <!-- generate IF for table widths -->
@@ -7079,6 +7256,18 @@
7079
7256
  </xsl:if> <!-- END: a few components -->
7080
7257
  </fo:block-container>
7081
7258
  </fo:block-container>
7259
+
7260
+ <xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
7261
+ <xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
7262
+ </xsl:if>
7263
+
7264
+ </xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
7265
+ <xsl:param name="process">false</xsl:param>
7266
+ <xsl:if test="$process = 'true'">
7267
+ <fo:block xsl:use-attribute-sets="dl-name-style">
7268
+ <xsl:apply-templates/>
7269
+ </fo:block>
7270
+ </xsl:if>
7082
7271
  </xsl:template><xsl:template name="setColumnWidth_dl">
7083
7272
  <xsl:param name="colwidths"/>
7084
7273
  <xsl:param name="maxlength_dt"/>
@@ -7087,6 +7276,11 @@
7087
7276
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
7088
7277
 
7089
7278
  <xsl:choose>
7279
+ <xsl:when test="xalan:nodeset($colwidths)/autolayout">
7280
+ <xsl:call-template name="insertTableColumnWidth">
7281
+ <xsl:with-param name="colwidths" select="$colwidths"/>
7282
+ </xsl:call-template>
7283
+ </xsl:when>
7090
7284
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
7091
7285
  <fo:table-column column-width="50%"/>
7092
7286
  <fo:table-column column-width="50%"/>
@@ -7339,12 +7533,24 @@
7339
7533
  </td>
7340
7534
  <td>
7341
7535
 
7342
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
7536
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
7537
+
7538
+ <!-- get paragraphs from nested 'dl' -->
7539
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
7540
+
7343
7541
 
7344
7542
  </td>
7345
7543
  </tr>
7346
7544
 
7347
- </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
7545
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
7546
+ <xsl:for-each select="*[local-name() = 'dt']">
7547
+ <p>
7548
+ <xsl:copy-of select="node()"/>
7549
+ <xsl:text> </xsl:text>
7550
+ <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
7551
+ </p>
7552
+ </xsl:for-each>
7553
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
7348
7554
  <fo:inline font-style="italic">
7349
7555
  <xsl:apply-templates/>
7350
7556
  </fo:inline>
@@ -7375,7 +7581,7 @@
7375
7581
 
7376
7582
 
7377
7583
 
7378
-
7584
+ <!-- 10 -->
7379
7585
 
7380
7586
 
7381
7587
 
@@ -8282,6 +8488,13 @@
8282
8488
  </xsl:variable>
8283
8489
  <fo:inline xsl:use-attribute-sets="link-style">
8284
8490
 
8491
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
8492
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8493
+ </xsl:if>
8494
+
8495
+
8496
+
8497
+
8285
8498
 
8286
8499
 
8287
8500
 
@@ -8507,6 +8720,7 @@
8507
8720
 
8508
8721
 
8509
8722
 
8723
+
8510
8724
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
8511
8725
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
8512
8726
  <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
@@ -8528,6 +8742,7 @@
8528
8742
  </xsl:when>
8529
8743
  <xsl:otherwise>
8530
8744
 
8745
+
8531
8746
  <xsl:text>:</xsl:text>
8532
8747
 
8533
8748
 
@@ -8547,6 +8762,7 @@
8547
8762
  </xsl:when>
8548
8763
  <xsl:otherwise>
8549
8764
 
8765
+
8550
8766
  <xsl:text>:</xsl:text>
8551
8767
 
8552
8768
 
@@ -8558,7 +8774,19 @@
8558
8774
  <xsl:value-of select="$suffix"/>
8559
8775
  </xsl:if>
8560
8776
  </xsl:template><xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'p']">
8561
- <fo:inline><xsl:apply-templates/></fo:inline>
8777
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
8778
+ <xsl:choose>
8779
+ <xsl:when test="$num = 1"> <!-- first paragraph renders in the same line as titlenote name -->
8780
+ <fo:inline xsl:use-attribute-sets="termnote-p-style">
8781
+ <xsl:apply-templates/>
8782
+ </fo:inline>
8783
+ </xsl:when>
8784
+ <xsl:otherwise>
8785
+ <fo:block xsl:use-attribute-sets="termnote-p-style">
8786
+ <xsl:apply-templates/>
8787
+ </fo:block>
8788
+ </xsl:otherwise>
8789
+ </xsl:choose>
8562
8790
  </xsl:template><xsl:template match="*[local-name() = 'terms']">
8563
8791
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
8564
8792
  <fo:block id="{@id}">
@@ -9331,6 +9559,9 @@
9331
9559
  <fo:block xsl:use-attribute-sets="figure-name-style">
9332
9560
 
9333
9561
 
9562
+
9563
+
9564
+
9334
9565
  <xsl:apply-templates/>
9335
9566
  </fo:block>
9336
9567
  </xsl:if>
@@ -9391,9 +9622,9 @@
9391
9622
  <xsl:apply-templates/>
9392
9623
  </xsl:otherwise>
9393
9624
  </xsl:choose>
9394
- </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'xref']" mode="contents">
9625
+ </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'xref'] | *[local-name() = 'eref']" mode="contents">
9395
9626
  <xsl:value-of select="."/>
9396
- </xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
9627
+ </xsl:template><xsl:template match="*[local-name() = 'review']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
9397
9628
  <xsl:text> </xsl:text>
9398
9629
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9399
9630
  <xsl:copy>
@@ -9464,9 +9695,12 @@
9464
9695
 
9465
9696
 
9466
9697
 
9698
+ <!-- 9 -->
9467
9699
 
9468
9700
 
9469
-
9701
+ <!-- <xsl:if test="$namespace = 'ieee'">
9702
+ <xsl:if test="$doctype = 'standard' and $stage = 'published'">8</xsl:if>
9703
+ </xsl:if> -->
9470
9704
 
9471
9705
 
9472
9706
 
@@ -9548,7 +9782,7 @@
9548
9782
  <xsl:for-each select="xalan:nodeset($text_step4)/node()">
9549
9783
  <xsl:choose>
9550
9784
  <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
9551
- <xsl:call-template name="interspers">
9785
+ <xsl:call-template name="interspers-java">
9552
9786
  <xsl:with-param name="str" select="."/>
9553
9787
  </xsl:call-template>
9554
9788
  </xsl:when>
@@ -9598,6 +9832,10 @@
9598
9832
  <xsl:with-param name="char" select="$char"/>
9599
9833
  </xsl:call-template>
9600
9834
  </xsl:if>
9835
+ </xsl:template><xsl:template name="interspers-java">
9836
+ <xsl:param name="str"/>
9837
+ <xsl:param name="char" select="$zero_width_space"/>
9838
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
9601
9839
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
9602
9840
  <xsl:apply-templates mode="syntax_highlight"/>
9603
9841
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -9907,10 +10145,14 @@
9907
10145
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
9908
10146
  <xsl:variable name="element">inline
9909
10147
 
10148
+
9910
10149
  </xsl:variable>
9911
10150
  <xsl:choose>
9912
10151
  <xsl:when test="contains($element, 'block')">
9913
10152
  <fo:block xsl:use-attribute-sets="example-p-style">
10153
+
10154
+
10155
+
9914
10156
  <xsl:apply-templates/>
9915
10157
  </fo:block>
9916
10158
  </xsl:when>
@@ -10018,6 +10260,7 @@
10018
10260
  </xsl:if>
10019
10261
  <fo:block xsl:use-attribute-sets="example-p-style">
10020
10262
 
10263
+
10021
10264
  <xsl:apply-templates/>
10022
10265
  </fo:block>
10023
10266
  </fo:block-container>
@@ -10174,6 +10417,8 @@
10174
10417
 
10175
10418
 
10176
10419
 
10420
+
10421
+
10177
10422
  <fo:basic-link fox:alt-text="{@citeas}">
10178
10423
  <xsl:if test="normalize-space(@citeas) = ''">
10179
10424
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -10248,6 +10493,7 @@
10248
10493
 
10249
10494
 
10250
10495
 
10496
+
10251
10497
  <xsl:choose>
10252
10498
  <xsl:when test="ancestor::bipm:annex">2</xsl:when>
10253
10499
  <xsl:otherwise>8</xsl:otherwise>
@@ -10556,6 +10802,11 @@
10556
10802
  </xsl:otherwise>
10557
10803
  </xsl:choose>
10558
10804
  </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
10805
+
10806
+ <xsl:apply-templates select="*[local-name() = 'name']">
10807
+ <xsl:with-param name="process">true</xsl:with-param>
10808
+ </xsl:apply-templates>
10809
+
10559
10810
  <fo:list-block xsl:use-attribute-sets="list-style">
10560
10811
 
10561
10812
 
@@ -10566,12 +10817,23 @@
10566
10817
 
10567
10818
 
10568
10819
 
10820
+ <xsl:if test="*[local-name() = 'name']">
10821
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10822
+ </xsl:if>
10823
+
10569
10824
  <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
10570
10825
  </fo:list-block>
10571
10826
  <!-- <xsl:for-each select="./iho:note">
10572
10827
  <xsl:call-template name="note"/>
10573
10828
  </xsl:for-each> -->
10574
10829
  <xsl:apply-templates select="./*[local-name() = 'note']"/>
10830
+ </xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
10831
+ <xsl:param name="process">false</xsl:param>
10832
+ <xsl:if test="$process = 'true'">
10833
+ <fo:block xsl:use-attribute-sets="list-name-style">
10834
+ <xsl:apply-templates/>
10835
+ </fo:block>
10836
+ </xsl:if>
10575
10837
  </xsl:template><xsl:template match="*[local-name()='li']">
10576
10838
  <fo:list-item xsl:use-attribute-sets="list-item-style">
10577
10839
  <xsl:copy-of select="@id"/>
@@ -10583,6 +10845,8 @@
10583
10845
 
10584
10846
 
10585
10847
 
10848
+
10849
+
10586
10850
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
10587
10851
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
10588
10852
  <xsl:call-template name="append_add-style"/>
@@ -10840,9 +11104,10 @@
10840
11104
  </fo:block>
10841
11105
 
10842
11106
 
10843
- </xsl:template><xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" priority="2">
11107
+ </xsl:template><xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" name="bibitem_non_normative" priority="2">
10844
11108
 
10845
11109
 
11110
+ <!-- start BIPM bibitem processing -->
10846
11111
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
10847
11112
  <fo:list-item>
10848
11113
  <fo:list-item-label end-indent="label-end()">
@@ -10855,7 +11120,7 @@
10855
11120
  <xsl:value-of select="bipm:docidentifier[@type='metanorma']"/>
10856
11121
  </xsl:when>
10857
11122
  <xsl:otherwise>
10858
- <xsl:number format="[1]"/>
11123
+ <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
10859
11124
  </xsl:otherwise>
10860
11125
  </xsl:choose>
10861
11126
  </xsl:if>
@@ -10869,6 +11134,7 @@
10869
11134
  </fo:list-item-body>
10870
11135
  </fo:list-item>
10871
11136
  </fo:list-block>
11137
+ <!-- END BIPM bibitem processing -->
10872
11138
 
10873
11139
 
10874
11140
  </xsl:template><xsl:template name="processBibitem">
@@ -10878,32 +11144,19 @@
10878
11144
  <xsl:if test=".//bipm:fn">
10879
11145
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
10880
11146
  </xsl:if>
10881
- <xsl:choose>
10882
- <xsl:when test="*[local-name() = 'formattedref']">
10883
- <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
10884
- </xsl:when>
10885
- <xsl:otherwise>
10886
- <xsl:variable name="docidentifier" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
10887
-
10888
- <xsl:value-of select="$docidentifier"/>
10889
- <xsl:if test="$docidentifier != '' and *[local-name() = 'title']">, </xsl:if>
10890
-
10891
- <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
10892
-
10893
- <xsl:choose>
10894
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $curr_lang]">
10895
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $curr_lang]"/>
10896
- </xsl:when>
10897
- <xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
10898
- <xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
10899
- </xsl:when>
10900
- <xsl:otherwise>
10901
- <xsl:apply-templates select="*[local-name() = 'title']"/>
10902
- </xsl:otherwise>
10903
- </xsl:choose>
10904
-
10905
- </xsl:otherwise>
10906
- </xsl:choose>
11147
+
11148
+ <xsl:variable name="docidentifier_" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
11149
+ <xsl:variable name="docidentifier_main" select="*[local-name() = 'docidentifier'][not(@type)]"/>
11150
+ <xsl:variable name="docidentifier">
11151
+ <xsl:choose>
11152
+ <xsl:when test="$docidentifier_ = $docidentifier_main and @suppress_identifier = 'true'"><!-- suppress indentifier --></xsl:when>
11153
+ <xsl:otherwise><xsl:value-of select="$docidentifier_"/></xsl:otherwise>
11154
+ </xsl:choose>
11155
+ </xsl:variable>
11156
+ <xsl:value-of select="normalize-space($docidentifier)"/>
11157
+
11158
+ <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">, </xsl:if>
11159
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
10907
11160
  <!-- end BIPM bibitem processing-->
10908
11161
 
10909
11162
  </xsl:template><xsl:template name="processBibitemDocId">
@@ -11213,12 +11466,16 @@
11213
11466
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
11214
11467
 
11215
11468
 
11469
+
11470
+
11216
11471
 
11217
11472
 
11218
11473
 
11219
11474
  <fo:block-container xsl:use-attribute-sets="admonition-container-style">
11220
11475
 
11221
11476
 
11477
+
11478
+
11222
11479
  <fo:block xsl:use-attribute-sets="admonition-name-style">
11223
11480
  <xsl:call-template name="displayAdmonitionName"/>
11224
11481
  </fo:block>
@@ -11231,25 +11488,32 @@
11231
11488
  </fo:block-container>
11232
11489
 
11233
11490
  </xsl:template><xsl:template name="displayAdmonitionName">
11234
-
11491
+ <xsl:param name="sep"/> <!-- Example: ' - ' -->
11492
+ <!-- <xsl:choose>
11493
+ <xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
11494
+ <xsl:choose>
11495
+ <xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
11496
+ <xsl:otherwise>
11497
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
11498
+ </xsl:otherwise>
11499
+ </xsl:choose>
11500
+ </xsl:when>
11501
+ <xsl:otherwise>
11235
11502
  <xsl:apply-templates select="*[local-name() = 'name']"/>
11236
11503
  <xsl:if test="not(*[local-name() = 'name'])">
11237
11504
  <xsl:apply-templates select="@type"/>
11238
11505
  </xsl:if>
11239
-
11240
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
11241
- <xsl:apply-templates/>
11242
- </xsl:template><xsl:template match="*[local-name() = 'admonition']/@type">
11243
- <xsl:variable name="admonition_type_">
11244
- <xsl:call-template name="getLocalizedString">
11245
- <xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
11246
- </xsl:call-template>
11506
+ </xsl:otherwise>
11507
+ </xsl:choose> -->
11508
+ <xsl:variable name="name">
11509
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
11247
11510
  </xsl:variable>
11248
- <xsl:variable name="admonition_type" select="normalize-space(java:toUpperCase(java:java.lang.String.new($admonition_type_)))"/>
11249
- <xsl:value-of select="$admonition_type"/>
11250
- <xsl:if test="$admonition_type = ''">
11251
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
11511
+ <xsl:copy-of select="$name"/>
11512
+ <xsl:if test="normalize-space($name) != ''">
11513
+ <xsl:value-of select="$sep"/>
11252
11514
  </xsl:if>
11515
+ </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
11516
+ <xsl:apply-templates/>
11253
11517
  </xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
11254
11518
 
11255
11519
  <fo:block xsl:use-attribute-sets="admonition-p-style">
@@ -11420,6 +11684,8 @@
11420
11684
  </xsl:when>
11421
11685
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
11422
11686
  </xsl:choose>
11687
+ </xsl:template><xsl:template match="*[local-name() = 'lang_none']">
11688
+ <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
11423
11689
  </xsl:template><xsl:template name="printEdition">
11424
11690
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
11425
11691
  <xsl:text> </xsl:text>
@@ -11526,6 +11792,27 @@
11526
11792
  </xsl:when>
11527
11793
  <xsl:otherwise><xsl:value-of select="$monthStr_"/></xsl:otherwise>
11528
11794
  </xsl:choose>
11795
+ </xsl:template><xsl:template name="getMonthLocalizedByNum">
11796
+ <xsl:param name="num"/>
11797
+ <xsl:variable name="monthStr">
11798
+ <xsl:choose>
11799
+ <xsl:when test="$num = '01'">january</xsl:when>
11800
+ <xsl:when test="$num = '02'">february</xsl:when>
11801
+ <xsl:when test="$num = '03'">march</xsl:when>
11802
+ <xsl:when test="$num = '04'">april</xsl:when>
11803
+ <xsl:when test="$num = '05'">may</xsl:when>
11804
+ <xsl:when test="$num = '06'">june</xsl:when>
11805
+ <xsl:when test="$num = '07'">july</xsl:when>
11806
+ <xsl:when test="$num = '08'">august</xsl:when>
11807
+ <xsl:when test="$num = '09'">september</xsl:when>
11808
+ <xsl:when test="$num = '10'">october</xsl:when>
11809
+ <xsl:when test="$num = '11'">november</xsl:when>
11810
+ <xsl:when test="$num = '12'">december</xsl:when>
11811
+ </xsl:choose>
11812
+ </xsl:variable>
11813
+ <xsl:call-template name="getLocalizedString">
11814
+ <xsl:with-param name="key">month_<xsl:value-of select="$monthStr"/></xsl:with-param>
11815
+ </xsl:call-template>
11529
11816
  </xsl:template><xsl:template name="insertKeywords">
11530
11817
  <xsl:param name="sorting" select="'true'"/>
11531
11818
  <xsl:param name="charAtEnd" select="'.'"/>
@@ -11597,7 +11884,7 @@
11597
11884
  <dc:description>
11598
11885
  <xsl:variable name="abstract">
11599
11886
 
11600
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
11887
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
11601
11888
 
11602
11889
  </xsl:variable>
11603
11890
  <xsl:value-of select="normalize-space($abstract)"/>
@@ -11725,6 +12012,7 @@
11725
12012
 
11726
12013
 
11727
12014
 
12015
+
11728
12016
 
11729
12017
 
11730
12018