metanorma-bipm 2.7.7 → 2.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2298,71 +2298,18 @@
2298
2298
  <xsl:call-template name="getLevel"/>
2299
2299
  </xsl:variable>
2300
2300
 
2301
- <xsl:variable name="font-size">
2302
- <xsl:choose>
2303
- <xsl:when test="$level = 1">16pt</xsl:when>
2304
- <xsl:when test="$level = 2 and ancestor::mn:annex and ../@type = 'toc'">16pt</xsl:when>
2305
- <xsl:when test="$level = 2 and ancestor::mn:annex">10.5pt</xsl:when>
2306
- <xsl:when test="$level = 2">14pt</xsl:when>
2307
- <xsl:when test="$level &gt;= 3 and ancestor::mn:annex and ../@type = 'toc'">9pt</xsl:when>
2308
- <xsl:when test="$level = 3 and ancestor::mn:annex">10pt</xsl:when>
2309
- <xsl:when test="$level &gt;= 4 and ancestor::mn:annex">9pt</xsl:when>
2310
- <xsl:when test="$level = 3">12pt</xsl:when>
2311
- <xsl:otherwise>11pt</xsl:otherwise>
2312
- </xsl:choose>
2301
+ <xsl:variable name="title_styles">
2302
+ <styles xsl:use-attribute-sets="title-style"><xsl:call-template name="refine_title-style"/></styles>
2313
2303
  </xsl:variable>
2314
2304
 
2315
- <xsl:variable name="element-name">
2316
- <xsl:choose>
2317
- <xsl:when test="../@inline-header = 'true'">fo:inline</xsl:when>
2318
- <xsl:otherwise>fo:block</xsl:otherwise>
2319
- </xsl:choose>
2320
- </xsl:variable>
2321
-
2322
- <fo:block-container margin-left="-14mm" font-family="Arial" font-size="{$font-size}" font-weight="bold" keep-with-next="always" line-height="130%"> <!-- line-height="145%" -->
2323
- <xsl:if test="local-name(preceding-sibling::*[1]) = 'clause'">
2324
- <xsl:attribute name="id"><xsl:value-of select="preceding-sibling::*[1]/@id"/></xsl:attribute>
2325
- </xsl:if>
2326
- <xsl:attribute name="margin-bottom">
2327
- <xsl:choose>
2328
- <xsl:when test="$level = 1 and (parent::mn:annex or ancestor::mn:annex or parent::mn:abstract or ancestor::mn:preface)">84pt</xsl:when>
2329
- <xsl:when test="$level = 1">6pt</xsl:when>
2330
- <xsl:when test="$level = 2 and ancestor::mn:annex and ../@type = 'toc'">29mm</xsl:when>
2331
- <xsl:when test="$level = 2 and ancestor::mn:annex">6pt</xsl:when>
2332
- <xsl:when test="$level = 2">10pt</xsl:when>
2333
- <xsl:otherwise>6pt</xsl:otherwise>
2334
- </xsl:choose>
2335
- </xsl:attribute>
2336
-
2337
- <xsl:if test="$level = 2 and ancestor::mn:annex">
2338
- <xsl:attribute name="space-before">18pt</xsl:attribute> <!-- 24 pt -->
2339
- </xsl:if>
2340
- <xsl:if test="$level = 2 and not(ancestor::mn:annex)">
2341
- <xsl:attribute name="space-before">30pt</xsl:attribute>
2342
- </xsl:if>
2343
- <xsl:if test="$level = 3 and ancestor::mn:annex">
2344
- <xsl:attribute name="space-before">12pt</xsl:attribute> <!-- 6pt -->
2345
- </xsl:if>
2346
- <xsl:if test="$level = 4 and ancestor::mn:annex">
2347
- <xsl:attribute name="space-before">12pt</xsl:attribute>
2348
- </xsl:if>
2349
- <xsl:if test="$level = 3 and not(ancestor::mn:annex)">
2350
- <xsl:attribute name="space-before">20pt</xsl:attribute>
2351
- </xsl:if>
2352
-
2353
- <xsl:if test="$level &gt;= 3 and ancestor::mn:annex and ../@type = 'toc'">
2354
- <xsl:attribute name="space-before">0pt</xsl:attribute>
2355
- </xsl:if>
2356
-
2357
- <xsl:if test="@type = 'quoted'">
2358
- <xsl:attribute name="font-weight">normal</xsl:attribute>
2359
- </xsl:if>
2305
+ <fo:block-container xsl:use-attribute-sets="title-style">
2306
+ <xsl:copy-of select="xalan:nodeset($title_styles)/styles/@*"/>
2360
2307
 
2361
2308
  <fo:block-container margin-left="0mm">
2362
2309
 
2363
2310
  <xsl:choose>
2364
2311
  <xsl:when test="mn:tab and not(ancestor::mn:annex) "><!-- split number and title -->
2365
- <fo:table table-layout="fixed" width="100%" role="H{$level}">
2312
+ <fo:table table-layout="fixed" width="100%" role="SKIP">
2366
2313
  <fo:table-column column-width="14mm"/>
2367
2314
  <fo:table-column column-width="136mm"/>
2368
2315
  <fo:table-body>
@@ -2383,7 +2330,7 @@
2383
2330
  </fo:table>
2384
2331
  </xsl:when>
2385
2332
  <xsl:otherwise>
2386
- <fo:block role="H{$level}">
2333
+ <fo:block role="SKIP">
2387
2334
 
2388
2335
  <xsl:if test="ancestor::mn:clause[@type = 'toc'] and $level &gt;= 3">
2389
2336
  <xsl:attribute name="role">Caption</xsl:attribute>
@@ -2904,42 +2851,15 @@
2904
2851
  </xsl:choose>
2905
2852
  </xsl:variable>
2906
2853
 
2854
+ <xsl:variable name="p_styles">
2855
+ <styles xsl:use-attribute-sets="p-style">
2856
+ <xsl:call-template name="refine_p-style"><xsl:with-param name="element-name" select="$element-name"/></xsl:call-template>
2857
+ </styles>
2858
+ </xsl:variable>
2859
+
2907
2860
  <xsl:element name="{$element-name}">
2908
- <xsl:attribute name="id">
2909
- <xsl:value-of select="@id"/>
2910
- </xsl:attribute>
2911
- <xsl:attribute name="text-align">
2912
- <xsl:choose>
2913
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
2914
- <xsl:when test="ancestor::mn:note_side">left</xsl:when>
2915
- <xsl:when test="../@align"><xsl:value-of select="../@align"/></xsl:when>
2916
- <xsl:otherwise>justify</xsl:otherwise>
2917
- </xsl:choose>
2918
- </xsl:attribute>
2919
- <xsl:call-template name="setKeepAttributes"/>
2920
- <xsl:copy-of select="@font-family"/>
2921
- <xsl:if test="not(ancestor::mn:table)">
2922
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2923
- </xsl:if>
2924
- <xsl:if test="ancestor::mn:table and ancestor::mn:preface">
2925
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2926
- </xsl:if>
2927
- <xsl:if test="parent::mn:li">
2928
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2929
- </xsl:if>
2930
- <xsl:if test="@align = 'center'">
2931
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2932
- </xsl:if>
2933
- <xsl:if test="*[1][self::mn:strong] and normalize-space(.) = normalize-space(*[1])">
2934
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2935
- </xsl:if>
2936
- <xsl:if test="@parent-type = 'quote'">
2937
- <xsl:attribute name="font-family">Arial</xsl:attribute>
2938
- <xsl:attribute name="font-size">9pt</xsl:attribute>
2939
- <xsl:attribute name="line-height">130%</xsl:attribute>
2940
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
2941
- </xsl:if>
2942
- <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
2861
+ <xsl:copy-of select="xalan:nodeset($p_styles)/styles/@*"/>
2862
+
2943
2863
  <xsl:apply-templates>
2944
2864
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
2945
2865
  </xsl:apply-templates>
@@ -6072,6 +5992,10 @@
6072
5992
  </xsl:element>
6073
5993
  </xsl:template>
6074
5994
 
5995
+ <!-- show sourcecode's name 'before' or 'after' source code -->
5996
+ <xsl:variable name="sourcecode-name-position"><xsl:text>after</xsl:text>
5997
+ </xsl:variable>
5998
+
6075
5999
  <xsl:template match="mn:sourcecode" name="sourcecode">
6076
6000
 
6077
6001
  <xsl:variable name="sourcecode_attributes">
@@ -6095,7 +6019,12 @@
6095
6019
 
6096
6020
  <xsl:call-template name="refine_sourcecode-container-style"/>
6097
6021
 
6098
- <fo:block-container margin-left="0mm" role="SKIP">
6022
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
6023
+
6024
+ <!-- <xsl:if test="$namespace = 'rsd'"> -->
6025
+ <xsl:if test="$sourcecode-name-position = 'before'">
6026
+ <xsl:apply-templates select="mn:fmt-name"/> <!-- show sourcecode's name BEFORE content -->
6027
+ </xsl:if>
6099
6028
 
6100
6029
  <fo:block xsl:use-attribute-sets="sourcecode-style">
6101
6030
 
@@ -6117,7 +6046,16 @@
6117
6046
  </fo:block>
6118
6047
 
6119
6048
  <xsl:apply-templates select="mn:dl"/> <!-- Key table -->
6120
- <xsl:apply-templates select="mn:fmt-name"/> <!-- show sourcecode's name AFTER content -->
6049
+
6050
+ <!-- <xsl:choose>
6051
+ <xsl:when test="$namespace = 'rsd'"></xsl:when>
6052
+ <xsl:otherwise>
6053
+ <xsl:apply-templates select="mn:fmt-name" /> --><!-- show sourcecode's name AFTER content -->
6054
+ <!-- </xsl:otherwise>
6055
+ </xsl:choose> -->
6056
+ <xsl:if test="$sourcecode-name-position = 'after'">
6057
+ <xsl:apply-templates select="mn:fmt-name"/> <!-- show sourcecode's name AFTER content -->
6058
+ </xsl:if>
6121
6059
 
6122
6060
  </fo:block-container>
6123
6061
  </fo:block-container>
@@ -11966,6 +11904,10 @@
11966
11904
  <!-- image -->
11967
11905
  <!-- ====== -->
11968
11906
 
11907
+ <!-- show figure's name 'before' or 'after' image -->
11908
+ <xsl:variable name="figure-name-position"><xsl:text>after</xsl:text>
11909
+ </xsl:variable>
11910
+
11969
11911
  <xsl:template match="mn:figure" name="figure">
11970
11912
  <xsl:variable name="isAdded" select="@added"/>
11971
11913
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -11978,6 +11920,10 @@
11978
11920
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
11979
11921
  </xsl:call-template>
11980
11922
 
11923
+ <xsl:if test="$figure-name-position = 'before'"> <!-- show figure's name BEFORE image -->
11924
+ <xsl:apply-templates select="mn:fmt-name"/>
11925
+ </xsl:if>
11926
+
11981
11927
  <!-- Example: Dimensions in millimeters -->
11982
11928
  <xsl:apply-templates select="mn:note[@type = 'units']"/>
11983
11929
 
@@ -11998,7 +11944,16 @@
11998
11944
  <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
11999
11945
  <xsl:call-template name="showFigureKey"/>
12000
11946
  </xsl:if>
12001
- <xsl:apply-templates select="mn:fmt-name"/> <!-- show figure's name AFTER image -->
11947
+
11948
+ <!-- <xsl:choose>
11949
+ <xsl:when test="$namespace = 'bsi' or $namespace = 'pas' or $namespace = 'rsd'"></xsl:when>
11950
+ <xsl:otherwise>
11951
+ <xsl:apply-templates select="mn:fmt-name" /> --> <!-- show figure's name AFTER image -->
11952
+ <!-- </xsl:otherwise>
11953
+ </xsl:choose> -->
11954
+ <xsl:if test="$figure-name-position = 'after'">
11955
+ <xsl:apply-templates select="mn:fmt-name"/> <!-- show figure's name AFTER image -->
11956
+ </xsl:if>
12002
11957
 
12003
11958
  </fo:block-container>
12004
11959
  </xsl:template>
@@ -14121,7 +14076,6 @@
14121
14076
  </xsl:attribute-set>
14122
14077
 
14123
14078
  <xsl:template name="refine_references-non-normative-title-style">
14124
-
14125
14079
  </xsl:template>
14126
14080
 
14127
14081
  <!-- bibitem in Normative References (references/@normative="true") -->
@@ -16234,7 +16188,7 @@
16234
16188
  <!-- ===================================== -->
16235
16189
 
16236
16190
  <xsl:attribute-set name="annex-title-style">
16237
- </xsl:attribute-set>
16191
+ </xsl:attribute-set> <!-- annex-title-style -->
16238
16192
 
16239
16193
  <xsl:template name="refine_annex-title-style">
16240
16194
  </xsl:template>
@@ -16245,6 +16199,125 @@
16245
16199
  <xsl:template name="refine_p-zzSTDTitle1-style">
16246
16200
  </xsl:template>
16247
16201
 
16202
+ <xsl:attribute-set name="p-style">
16203
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
16204
+ </xsl:attribute-set> <!-- p-style -->
16205
+
16206
+ <xsl:template name="refine_p-style">
16207
+ <xsl:param name="element-name"/>
16208
+ <xsl:param name="margin"/>
16209
+ <xsl:copy-of select="@id"/>
16210
+ <xsl:attribute name="text-align">
16211
+ <xsl:choose>
16212
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
16213
+ <xsl:when test="ancestor::mn:note_side">left</xsl:when>
16214
+ <xsl:when test="../@align"><xsl:value-of select="../@align"/></xsl:when>
16215
+ <xsl:otherwise>justify</xsl:otherwise>
16216
+ </xsl:choose>
16217
+ </xsl:attribute>
16218
+ <xsl:call-template name="setKeepAttributes"/>
16219
+ <xsl:copy-of select="@font-family"/>
16220
+ <xsl:if test="not(ancestor::mn:table)">
16221
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
16222
+ </xsl:if>
16223
+ <xsl:if test="ancestor::mn:table and ancestor::mn:preface">
16224
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
16225
+ </xsl:if>
16226
+ <xsl:if test="parent::mn:li">
16227
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
16228
+ </xsl:if>
16229
+ <xsl:if test="@align = 'center'">
16230
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
16231
+ </xsl:if>
16232
+ <xsl:if test="*[1][self::mn:strong] and normalize-space(.) = normalize-space(*[1])">
16233
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
16234
+ </xsl:if>
16235
+ <xsl:if test="@parent-type = 'quote'">
16236
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
16237
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
16238
+ <xsl:attribute name="line-height">130%</xsl:attribute>
16239
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
16240
+ </xsl:if>
16241
+ <!-- $namespace = 'bipm' -->
16242
+
16243
+ </xsl:template> <!-- refine_p-style -->
16244
+
16245
+ <xsl:attribute-set name="title-style">
16246
+ <!-- Note: font-size for level 1 title -->
16247
+ <xsl:attribute name="font-size">16pt</xsl:attribute>
16248
+ <xsl:attribute name="margin-left">-14mm</xsl:attribute>
16249
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
16250
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
16251
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
16252
+ <xsl:attribute name="line-height">130%</xsl:attribute>
16253
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
16254
+ </xsl:attribute-set> <!-- title-style -->
16255
+
16256
+ <xsl:template name="refine_title-style">
16257
+ <xsl:param name="element-name"/>
16258
+ <xsl:variable name="level">
16259
+ <xsl:call-template name="getLevel"/>
16260
+ </xsl:variable>
16261
+
16262
+ <xsl:if test="$level = 1">
16263
+ <xsl:if test="parent::mn:annex or ancestor::mn:annex or parent::mn:abstract or ancestor::mn:preface">
16264
+ <xsl:attribute name="margin-bottom">84pt</xsl:attribute>
16265
+ </xsl:if>
16266
+ </xsl:if>
16267
+
16268
+ <xsl:if test="$level = 2">
16269
+ <xsl:attribute name="font-size">14pt</xsl:attribute>
16270
+ <xsl:attribute name="space-before">30pt</xsl:attribute>
16271
+ <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
16272
+ <xsl:if test="ancestor::mn:annex">
16273
+ <xsl:attribute name="font-size">10.5pt</xsl:attribute>
16274
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
16275
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
16276
+ <xsl:if test="../@type = 'toc'">
16277
+ <xsl:attribute name="font-size">16pt</xsl:attribute>
16278
+ <xsl:attribute name="margin-bottom">29mm</xsl:attribute>
16279
+ </xsl:if>
16280
+ </xsl:if>
16281
+ </xsl:if>
16282
+
16283
+ <xsl:if test="$level = 3">
16284
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
16285
+ <xsl:attribute name="space-before">20pt</xsl:attribute>
16286
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
16287
+ <xsl:if test="ancestor::mn:annex">
16288
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
16289
+ <xsl:attribute name="space-before">12pt</xsl:attribute>
16290
+ <xsl:if test="../@type = 'toc'">
16291
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
16292
+ <xsl:attribute name="space-before">0pt</xsl:attribute>
16293
+ </xsl:if>
16294
+ </xsl:if>
16295
+ </xsl:if>
16296
+
16297
+ <xsl:if test="$level &gt;= 4">
16298
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
16299
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
16300
+ <xsl:if test="ancestor::mn:annex">
16301
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
16302
+ <xsl:if test="$level = 4">
16303
+ <xsl:attribute name="space-before">12pt</xsl:attribute>
16304
+ </xsl:if>
16305
+ <xsl:if test="../@type = 'toc'">
16306
+ <xsl:attribute name="space-before">0pt</xsl:attribute>
16307
+ </xsl:if>
16308
+ </xsl:if>
16309
+ </xsl:if>
16310
+
16311
+ <xsl:if test="local-name(preceding-sibling::*[1]) = 'clause'">
16312
+ <xsl:attribute name="id"><xsl:value-of select="preceding-sibling::*[1]/@id"/></xsl:attribute>
16313
+ </xsl:if>
16314
+ <xsl:if test="@type = 'quoted'">
16315
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
16316
+ </xsl:if>
16317
+ <!-- $namespace = 'bipm' -->
16318
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
16319
+ </xsl:template> <!-- refine_title-style -->
16320
+
16248
16321
  <xsl:template name="processPrefaceSectionsDefault">
16249
16322
  <xsl:for-each select="/*/mn:preface/*[not(self::mn:note or self::mn:admonition)]">
16250
16323
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -16583,6 +16656,12 @@
16583
16656
  </xsl:choose>
16584
16657
  </xsl:template>
16585
16658
 
16659
+ <xsl:attribute-set name="reset-margins-style">
16660
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
16661
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
16662
+ <xsl:attribute name="role">SKIP</xsl:attribute>
16663
+ </xsl:attribute-set>
16664
+
16586
16665
  <xsl:attribute-set name="clause-style">
16587
16666
 
16588
16667
  </xsl:attribute-set>
@@ -17619,8 +17698,9 @@
17619
17698
 
17620
17699
  <xsl:template name="setTextAlignment">
17621
17700
  <xsl:param name="default">left</xsl:param>
17701
+ <xsl:param name="skip_default">false</xsl:param>
17622
17702
  <xsl:variable name="align" select="normalize-space(@align)"/>
17623
- <xsl:attribute name="text-align">
17703
+ <xsl:variable name="text_align">
17624
17704
  <xsl:choose>
17625
17705
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
17626
17706
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
@@ -17628,9 +17708,13 @@
17628
17708
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
17629
17709
  <xsl:when test="ancestor::mn:td/@align"><xsl:value-of select="ancestor::mn:td/@align"/></xsl:when>
17630
17710
  <xsl:when test="ancestor::mn:th/@align"><xsl:value-of select="ancestor::mn:th/@align"/></xsl:when>
17711
+ <xsl:when test="$skip_default = 'true'"/>
17631
17712
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
17632
17713
  </xsl:choose>
17633
- </xsl:attribute>
17714
+ </xsl:variable>
17715
+ <xsl:if test="normalize-space($text_align) != ''">
17716
+ <xsl:attribute name="text-align"><xsl:value-of select="$text_align"/></xsl:attribute>
17717
+ </xsl:if>
17634
17718
  <xsl:if test="$align = 'indent'">
17635
17719
  <xsl:attribute name="margin-left">7mm</xsl:attribute>
17636
17720
  </xsl:if>
@@ -17638,8 +17722,10 @@
17638
17722
 
17639
17723
  <xsl:template name="setBlockAttributes">
17640
17724
  <xsl:param name="text_align_default">left</xsl:param>
17725
+ <xsl:param name="skip_text_align_default">false</xsl:param>
17641
17726
  <xsl:call-template name="setTextAlignment">
17642
17727
  <xsl:with-param name="default" select="$text_align_default"/>
17728
+ <xsl:with-param name="skip_default" select="$skip_text_align_default"/>
17643
17729
  </xsl:call-template>
17644
17730
  <xsl:call-template name="setKeepAttributes"/>
17645
17731
  <xsl:if test="node()[1][self::mn:span][contains(@style, 'line-height')]">