metanorma-bipm 2.2.1 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e4882c799316d8fa098e67957ac7ba521996f758c74c251a09c8f50d490aade
4
- data.tar.gz: aa4302843b8f252c053f76653c9def6f73d0b9f13badd397206e70b806897dc4
3
+ metadata.gz: 35c5ab21f229cea538768c183e03a233d111f888778ab2854eb38230d281c27f
4
+ data.tar.gz: 54afcb5e5381ad9f32d977d5edb7dbf5aec9959f5edd88bcd8b7d67dd5352629
5
5
  SHA512:
6
- metadata.gz: 28ccb12955bdced162d84dca3b1a93c8244603187d81108eb9d9db3001a2308b04d8481bb4a7986ce459a06c0fd8d2a468e23aca8f7231c2c23d750ee1545ddc
7
- data.tar.gz: 5ae15b413d3559a05606bbb3d163215551c4d915362c20b5344d9a92270e619d9e185ba1a7305c30a3c35011c57514140a7848659687043e3e3d40cf64591949
6
+ metadata.gz: 3e23ed3b3c67bfda7c19d9c4b483e4c906535d4b7cbe266d2489b9c90a80e2f3d0954d2612038290c36b1ac6a7ff21f513db67e4736f6a5e0e2ae286de403d19
7
+ data.tar.gz: a456e30efc6e8a75fb041fada6d134cc43369745278e5971e744dcffa2715809cb743909f8ab3b307414e684a96522144c6ba3e8e827d14ddb714ce3b392608a
@@ -35,15 +35,15 @@ module IsoDoc
35
35
 
36
36
  def render_identifier(ident)
37
37
  ret = super
38
- ret[:sdo] = ret[:sdo]&.sub(/^(BIPM) (PV|CR) (\d.*)$/,
39
- "\\1 <strong>\\2</strong>, \\3")
38
+ ret[:sdo] = ret[:sdo]&.sub(/^(BIPM)([  ])(PV|CR)([  ])(\d.*)$/,
39
+ "\\1\\2<strong>\\3</strong>,\\4\\5")
40
40
  ret
41
41
  end
42
42
 
43
43
  def implicit_reference(bib)
44
44
  b = bib.at(ns("./docidentifier[@primary = 'true'][@type = 'BIPM']"))
45
45
  doctype = bib.at(ns("//bibdata/ext/doctype"))&.text
46
- return true if doctype == "brochure" && /^(CGPM|CIPM|CCDS|CCTF)\s
46
+ return true if doctype == "brochure" && /^(CGPM|CIPM|CCDS|CCTF)[  ]
47
47
  (Resolution|Recommendation|Declaration|Decision|Recommendation|Meeting)/x
48
48
  .match?(b&.text)
49
49
 
@@ -8,7 +8,7 @@
8
8
  <xsl:param name="add_math_as_attachment">true</xsl:param>
9
9
  <xsl:param name="final_transform">true</xsl:param>
10
10
 
11
- <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>
12
12
 
13
13
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
14
14
 
@@ -3897,14 +3897,14 @@
3897
3897
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
3898
3898
 
3899
3899
  <!--
3900
- <misc-container>
3900
+ <metanorma-extension>
3901
3901
  <presentation-metadata>
3902
3902
  <papersize>letter</papersize>
3903
3903
  </presentation-metadata>
3904
- </misc-container>
3904
+ </metanorma-extension>
3905
3905
  -->
3906
3906
 
3907
- <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'])))"/>
3907
+ <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
3908
3908
  <xsl:variable name="papersize_width_">
3909
3909
  <xsl:choose>
3910
3910
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -4023,7 +4023,7 @@
4023
4023
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
4024
4024
 
4025
4025
  <xsl:variable name="title-list-tables">
4026
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
4026
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
4027
4027
  <xsl:value-of select="$toc_table_title"/>
4028
4028
  <xsl:if test="normalize-space($toc_table_title) = ''">
4029
4029
  <xsl:call-template name="getTitle">
@@ -4033,7 +4033,7 @@
4033
4033
  </xsl:variable>
4034
4034
 
4035
4035
  <xsl:variable name="title-list-figures">
4036
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
4036
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
4037
4037
  <xsl:value-of select="$toc_figure_title"/>
4038
4038
  <xsl:if test="normalize-space($toc_figure_title) = ''">
4039
4039
  <xsl:call-template name="getTitle">
@@ -4043,7 +4043,7 @@
4043
4043
  </xsl:variable>
4044
4044
 
4045
4045
  <xsl:variable name="title-list-recommendations">
4046
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
4046
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
4047
4047
  <xsl:value-of select="$toc_requirement_title"/>
4048
4048
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
4049
4049
  <xsl:call-template name="getTitle">
@@ -4115,7 +4115,7 @@
4115
4115
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
4116
4116
 
4117
4117
  <xsl:variable name="additional_fonts_">
4118
- <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
4118
+ <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
4119
4119
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
4120
4120
  </xsl:for-each>
4121
4121
  </xsl:variable>
@@ -5181,10 +5181,10 @@
5181
5181
 
5182
5182
  <xsl:template name="processTablesFigures_Contents">
5183
5183
  <xsl:param name="always"/>
5184
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5184
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5185
5185
  <xsl:call-template name="processTables_Contents"/>
5186
5186
  </xsl:if>
5187
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5187
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5188
5188
  <xsl:call-template name="processFigures_Contents"/>
5189
5189
  </xsl:if>
5190
5190
  </xsl:template>
@@ -5537,6 +5537,8 @@
5537
5537
  <xsl:attribute name="border-bottom">0.5pt solid black</xsl:attribute>
5538
5538
  </xsl:if>
5539
5539
 
5540
+ <xsl:call-template name="setBordersTableArray"/>
5541
+
5540
5542
  </xsl:element>
5541
5543
  </xsl:variable>
5542
5544
 
@@ -5678,6 +5680,10 @@
5678
5680
 
5679
5681
  </xsl:template>
5680
5682
 
5683
+ <xsl:template name="setBordersTableArray">
5684
+
5685
+ </xsl:template>
5686
+
5681
5687
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
5682
5688
  <xsl:param name="continued"/>
5683
5689
  <xsl:if test="normalize-space() != ''">
@@ -6172,6 +6178,8 @@
6172
6178
  <fo:table-row>
6173
6179
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6174
6180
 
6181
+ <xsl:call-template name="setBordersTableArray"/>
6182
+
6175
6183
  <!-- fn will be processed inside 'note' processing -->
6176
6184
 
6177
6185
  <xsl:if test="count(ancestor::bipm:table//*[local-name()='note']) &gt; 1">
@@ -6303,6 +6311,8 @@
6303
6311
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
6304
6312
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
6305
6313
 
6314
+ <xsl:call-template name="setBordersTableArray"/>
6315
+
6306
6316
  <xsl:call-template name="setTableRowAttributes"/>
6307
6317
 
6308
6318
  <xsl:apply-templates/>
@@ -6326,6 +6336,8 @@
6326
6336
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
6327
6337
  </xsl:if>
6328
6338
 
6339
+ <xsl:call-template name="setBordersTableArray"/>
6340
+
6329
6341
  <xsl:call-template name="setTableRowAttributes"/>
6330
6342
  <xsl:apply-templates/>
6331
6343
  </fo:table-row>
@@ -6363,6 +6375,8 @@
6363
6375
  <xsl:attribute name="display-align">before</xsl:attribute>
6364
6376
  </xsl:if>
6365
6377
 
6378
+ <xsl:call-template name="setBordersTableArray"/>
6379
+
6366
6380
  <xsl:if test="$lang = 'ar'">
6367
6381
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6368
6382
  </xsl:if>
@@ -6426,6 +6440,8 @@
6426
6440
 
6427
6441
  <!-- bsi -->
6428
6442
 
6443
+ <xsl:call-template name="setBordersTableArray"/>
6444
+
6429
6445
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
6430
6446
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6431
6447
  </xsl:if>
@@ -6502,7 +6518,7 @@
6502
6518
  </fn>
6503
6519
  -->
6504
6520
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
6505
- <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
6521
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
6506
6522
 
6507
6523
  <!-- list of footnotes to calculate actual footnotes number -->
6508
6524
  <xsl:variable name="p_fn_">
@@ -6559,8 +6575,7 @@
6559
6575
  </fo:basic-link>
6560
6576
  </fo:inline>
6561
6577
  </xsl:variable>
6562
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
6563
- gen_id=<xsl:value-of select="$gen_id"/> -->
6578
+
6564
6579
  <xsl:choose>
6565
6580
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
6566
6581
  <xsl:copy-of select="$footnote_inline"/>
@@ -6615,7 +6630,7 @@
6615
6630
  <!-- commented:
6616
6631
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
6617
6632
  because 'fn' there is in biblio-tag -->
6618
- <xsl:for-each select=".//*[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])]">
6633
+ <xsl:for-each select=".//*[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])]">
6619
6634
  <!-- copy unique fn -->
6620
6635
  <fn gen_id="{generate-id(.)}">
6621
6636
  <xsl:copy-of select="@*"/>
@@ -9230,7 +9245,9 @@
9230
9245
 
9231
9246
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
9232
9247
  <xsl:if test="number($scale) &lt; 100">
9233
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9248
+
9249
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9250
+
9234
9251
  </xsl:if>
9235
9252
 
9236
9253
  </xsl:if>
@@ -10170,7 +10187,7 @@
10170
10187
  <!-- sourcecode -->
10171
10188
  <!-- =============== -->
10172
10189
 
10173
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
10190
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
10174
10191
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
10175
10192
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
10176
10193
 
@@ -10257,6 +10274,12 @@
10257
10274
  </xsl:attribute>
10258
10275
  </xsl:for-each>
10259
10276
 
10277
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
10278
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
10279
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10280
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10281
+ </xsl:if>
10282
+
10260
10283
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10261
10284
  </fo:block>
10262
10285
 
@@ -10305,7 +10328,7 @@
10305
10328
  </xsl:template>
10306
10329
 
10307
10330
  <!-- outer table with line numbers for sourcecode -->
10308
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
10331
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
10309
10332
  <fo:block>
10310
10333
  <fo:table width="100%" table-layout="fixed">
10311
10334
  <xsl:copy-of select="@id"/>
@@ -10317,16 +10340,16 @@
10317
10340
  </fo:table>
10318
10341
  </fo:block>
10319
10342
  </xsl:template>
10320
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
10343
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
10321
10344
  <xsl:apply-templates/>
10322
10345
  </xsl:template>
10323
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
10346
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
10324
10347
  <fo:table-row>
10325
10348
  <xsl:apply-templates/>
10326
10349
  </fo:table-row>
10327
10350
  </xsl:template>
10328
10351
  <!-- first td with line numbers -->
10329
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
10352
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
10330
10353
  <fo:table-cell>
10331
10354
  <fo:block>
10332
10355
 
@@ -10346,8 +10369,9 @@
10346
10369
  </fo:block>
10347
10370
  </fo:table-cell>
10348
10371
  </xsl:template>
10372
+
10349
10373
  <!-- second td with sourcecode -->
10350
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
10374
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
10351
10375
  <fo:table-cell>
10352
10376
  <fo:block>
10353
10377
  <xsl:apply-templates/>
@@ -10585,7 +10609,25 @@
10585
10609
  <xsl:template match="*[local-name()='pre']" name="pre">
10586
10610
  <fo:block xsl:use-attribute-sets="pre-style">
10587
10611
  <xsl:copy-of select="@id"/>
10588
- <xsl:apply-templates/>
10612
+ <xsl:choose>
10613
+
10614
+ <xsl:when test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name()='td'][1][not(preceding-sibling::*)]"> <!-- pre in the first td in the table with @linenums = 'true' -->
10615
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
10616
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10617
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10618
+ </xsl:if>
10619
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
10620
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
10621
+ <mtext><xsl:value-of select="."/></mtext>
10622
+ </math>
10623
+ </fo:instream-foreign-object>
10624
+ </xsl:when>
10625
+
10626
+ <xsl:otherwise>
10627
+ <xsl:apply-templates/>
10628
+ </xsl:otherwise>
10629
+
10630
+ </xsl:choose>
10589
10631
  </fo:block>
10590
10632
  </xsl:template>
10591
10633
  <!-- =============== -->
@@ -12203,8 +12245,8 @@
12203
12245
 
12204
12246
  <xsl:variable name="toc_level">
12205
12247
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
12206
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
12207
- <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
12248
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
12249
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
12208
12250
  <xsl:choose>
12209
12251
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
12210
12252
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -13196,6 +13238,7 @@
13196
13238
  <xsl:choose>
13197
13239
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
13198
13240
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
13241
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
13199
13242
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
13200
13243
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
13201
13244
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
@@ -8,7 +8,7 @@
8
8
  <xsl:param name="add_math_as_attachment">true</xsl:param>
9
9
  <xsl:param name="final_transform">true</xsl:param>
10
10
 
11
- <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>
12
12
 
13
13
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
14
14
 
@@ -3897,14 +3897,14 @@
3897
3897
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
3898
3898
 
3899
3899
  <!--
3900
- <misc-container>
3900
+ <metanorma-extension>
3901
3901
  <presentation-metadata>
3902
3902
  <papersize>letter</papersize>
3903
3903
  </presentation-metadata>
3904
- </misc-container>
3904
+ </metanorma-extension>
3905
3905
  -->
3906
3906
 
3907
- <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'])))"/>
3907
+ <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
3908
3908
  <xsl:variable name="papersize_width_">
3909
3909
  <xsl:choose>
3910
3910
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -4023,7 +4023,7 @@
4023
4023
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
4024
4024
 
4025
4025
  <xsl:variable name="title-list-tables">
4026
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
4026
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
4027
4027
  <xsl:value-of select="$toc_table_title"/>
4028
4028
  <xsl:if test="normalize-space($toc_table_title) = ''">
4029
4029
  <xsl:call-template name="getTitle">
@@ -4033,7 +4033,7 @@
4033
4033
  </xsl:variable>
4034
4034
 
4035
4035
  <xsl:variable name="title-list-figures">
4036
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
4036
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
4037
4037
  <xsl:value-of select="$toc_figure_title"/>
4038
4038
  <xsl:if test="normalize-space($toc_figure_title) = ''">
4039
4039
  <xsl:call-template name="getTitle">
@@ -4043,7 +4043,7 @@
4043
4043
  </xsl:variable>
4044
4044
 
4045
4045
  <xsl:variable name="title-list-recommendations">
4046
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
4046
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
4047
4047
  <xsl:value-of select="$toc_requirement_title"/>
4048
4048
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
4049
4049
  <xsl:call-template name="getTitle">
@@ -4115,7 +4115,7 @@
4115
4115
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
4116
4116
 
4117
4117
  <xsl:variable name="additional_fonts_">
4118
- <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
4118
+ <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
4119
4119
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
4120
4120
  </xsl:for-each>
4121
4121
  </xsl:variable>
@@ -5181,10 +5181,10 @@
5181
5181
 
5182
5182
  <xsl:template name="processTablesFigures_Contents">
5183
5183
  <xsl:param name="always"/>
5184
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5184
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5185
5185
  <xsl:call-template name="processTables_Contents"/>
5186
5186
  </xsl:if>
5187
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5187
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
5188
5188
  <xsl:call-template name="processFigures_Contents"/>
5189
5189
  </xsl:if>
5190
5190
  </xsl:template>
@@ -5537,6 +5537,8 @@
5537
5537
  <xsl:attribute name="border-bottom">0.5pt solid black</xsl:attribute>
5538
5538
  </xsl:if>
5539
5539
 
5540
+ <xsl:call-template name="setBordersTableArray"/>
5541
+
5540
5542
  </xsl:element>
5541
5543
  </xsl:variable>
5542
5544
 
@@ -5678,6 +5680,10 @@
5678
5680
 
5679
5681
  </xsl:template>
5680
5682
 
5683
+ <xsl:template name="setBordersTableArray">
5684
+
5685
+ </xsl:template>
5686
+
5681
5687
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
5682
5688
  <xsl:param name="continued"/>
5683
5689
  <xsl:if test="normalize-space() != ''">
@@ -6172,6 +6178,8 @@
6172
6178
  <fo:table-row>
6173
6179
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6174
6180
 
6181
+ <xsl:call-template name="setBordersTableArray"/>
6182
+
6175
6183
  <!-- fn will be processed inside 'note' processing -->
6176
6184
 
6177
6185
  <xsl:if test="count(ancestor::bipm:table//*[local-name()='note']) &gt; 1">
@@ -6303,6 +6311,8 @@
6303
6311
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
6304
6312
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
6305
6313
 
6314
+ <xsl:call-template name="setBordersTableArray"/>
6315
+
6306
6316
  <xsl:call-template name="setTableRowAttributes"/>
6307
6317
 
6308
6318
  <xsl:apply-templates/>
@@ -6326,6 +6336,8 @@
6326
6336
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
6327
6337
  </xsl:if>
6328
6338
 
6339
+ <xsl:call-template name="setBordersTableArray"/>
6340
+
6329
6341
  <xsl:call-template name="setTableRowAttributes"/>
6330
6342
  <xsl:apply-templates/>
6331
6343
  </fo:table-row>
@@ -6363,6 +6375,8 @@
6363
6375
  <xsl:attribute name="display-align">before</xsl:attribute>
6364
6376
  </xsl:if>
6365
6377
 
6378
+ <xsl:call-template name="setBordersTableArray"/>
6379
+
6366
6380
  <xsl:if test="$lang = 'ar'">
6367
6381
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6368
6382
  </xsl:if>
@@ -6426,6 +6440,8 @@
6426
6440
 
6427
6441
  <!-- bsi -->
6428
6442
 
6443
+ <xsl:call-template name="setBordersTableArray"/>
6444
+
6429
6445
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
6430
6446
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
6431
6447
  </xsl:if>
@@ -6502,7 +6518,7 @@
6502
6518
  </fn>
6503
6519
  -->
6504
6520
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
6505
- <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
6521
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
6506
6522
 
6507
6523
  <!-- list of footnotes to calculate actual footnotes number -->
6508
6524
  <xsl:variable name="p_fn_">
@@ -6559,8 +6575,7 @@
6559
6575
  </fo:basic-link>
6560
6576
  </fo:inline>
6561
6577
  </xsl:variable>
6562
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
6563
- gen_id=<xsl:value-of select="$gen_id"/> -->
6578
+
6564
6579
  <xsl:choose>
6565
6580
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
6566
6581
  <xsl:copy-of select="$footnote_inline"/>
@@ -6615,7 +6630,7 @@
6615
6630
  <!-- commented:
6616
6631
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
6617
6632
  because 'fn' there is in biblio-tag -->
6618
- <xsl:for-each select=".//*[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])]">
6633
+ <xsl:for-each select=".//*[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])]">
6619
6634
  <!-- copy unique fn -->
6620
6635
  <fn gen_id="{generate-id(.)}">
6621
6636
  <xsl:copy-of select="@*"/>
@@ -9230,7 +9245,9 @@
9230
9245
 
9231
9246
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
9232
9247
  <xsl:if test="number($scale) &lt; 100">
9233
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9248
+
9249
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9250
+
9234
9251
  </xsl:if>
9235
9252
 
9236
9253
  </xsl:if>
@@ -10170,7 +10187,7 @@
10170
10187
  <!-- sourcecode -->
10171
10188
  <!-- =============== -->
10172
10189
 
10173
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
10190
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
10174
10191
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
10175
10192
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
10176
10193
 
@@ -10257,6 +10274,12 @@
10257
10274
  </xsl:attribute>
10258
10275
  </xsl:for-each>
10259
10276
 
10277
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
10278
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
10279
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10280
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10281
+ </xsl:if>
10282
+
10260
10283
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10261
10284
  </fo:block>
10262
10285
 
@@ -10305,7 +10328,7 @@
10305
10328
  </xsl:template>
10306
10329
 
10307
10330
  <!-- outer table with line numbers for sourcecode -->
10308
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
10331
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
10309
10332
  <fo:block>
10310
10333
  <fo:table width="100%" table-layout="fixed">
10311
10334
  <xsl:copy-of select="@id"/>
@@ -10317,16 +10340,16 @@
10317
10340
  </fo:table>
10318
10341
  </fo:block>
10319
10342
  </xsl:template>
10320
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
10343
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
10321
10344
  <xsl:apply-templates/>
10322
10345
  </xsl:template>
10323
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
10346
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
10324
10347
  <fo:table-row>
10325
10348
  <xsl:apply-templates/>
10326
10349
  </fo:table-row>
10327
10350
  </xsl:template>
10328
10351
  <!-- first td with line numbers -->
10329
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
10352
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
10330
10353
  <fo:table-cell>
10331
10354
  <fo:block>
10332
10355
 
@@ -10346,8 +10369,9 @@
10346
10369
  </fo:block>
10347
10370
  </fo:table-cell>
10348
10371
  </xsl:template>
10372
+
10349
10373
  <!-- second td with sourcecode -->
10350
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
10374
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
10351
10375
  <fo:table-cell>
10352
10376
  <fo:block>
10353
10377
  <xsl:apply-templates/>
@@ -10585,7 +10609,25 @@
10585
10609
  <xsl:template match="*[local-name()='pre']" name="pre">
10586
10610
  <fo:block xsl:use-attribute-sets="pre-style">
10587
10611
  <xsl:copy-of select="@id"/>
10588
- <xsl:apply-templates/>
10612
+ <xsl:choose>
10613
+
10614
+ <xsl:when test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name()='td'][1][not(preceding-sibling::*)]"> <!-- pre in the first td in the table with @linenums = 'true' -->
10615
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
10616
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10617
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10618
+ </xsl:if>
10619
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
10620
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
10621
+ <mtext><xsl:value-of select="."/></mtext>
10622
+ </math>
10623
+ </fo:instream-foreign-object>
10624
+ </xsl:when>
10625
+
10626
+ <xsl:otherwise>
10627
+ <xsl:apply-templates/>
10628
+ </xsl:otherwise>
10629
+
10630
+ </xsl:choose>
10589
10631
  </fo:block>
10590
10632
  </xsl:template>
10591
10633
  <!-- =============== -->
@@ -12203,8 +12245,8 @@
12203
12245
 
12204
12246
  <xsl:variable name="toc_level">
12205
12247
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
12206
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
12207
- <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
12248
+ <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
12249
+ <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
12208
12250
  <xsl:choose>
12209
12251
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
12210
12252
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -13196,6 +13238,7 @@
13196
13238
  <xsl:choose>
13197
13239
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
13198
13240
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
13241
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
13199
13242
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
13200
13243
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
13201
13244
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>