metanorma-un 0.10.1 → 0.10.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: 4bb58f5070137457c97598dc1dc44036a0f3f126500ed833367c7b8833e11b50
4
- data.tar.gz: 854ca121c4d69913f5706b8f1daf13f81bcce711130f061aff5c9c85b968a77b
3
+ metadata.gz: 41ff83b6e3a4da6dd0d9ecb65321c39aabfcfe70ba20bda707f7ea991ef9eac2
4
+ data.tar.gz: 709e49ec42a2b2ea48ed225601f2d8a0716cdfdd864d5aec6c775ad454617f1d
5
5
  SHA512:
6
- metadata.gz: 71b85c17cbf8264a281708db02c3d0c6073bd9fa99a4b8cd3bdd4cced42fc76d98220e646a4a65820edd0a87484655b445479368ae8d09f878816725dca75c1c
7
- data.tar.gz: f16c9f80b0d0d1a686083ec19a47587aa73ab4216beffbbb60a834b4545e7159ccbec47b738e75d85b8b7b1599bd1beb4e98817a94ed3f2aa304ab5dffe665c6
6
+ metadata.gz: db75076f8afb99308b895bcd318effaaf271e7c5588334307bf057dd82af901cd62065142a5cc9d13ec99b36609bbb77adc747d18764b4e063ec8ae5651c6580
7
+ data.tar.gz: 4f7d1c1a7c2295aaab897f2f1322b1d775d8ee1ecb5b2c425752cbd88db67534492cce9a3312654384aebbac3c50f9602761405bace87c524c1220d72560fcae
@@ -131,6 +131,35 @@ a.FootnoteRef + a.FootnoteRef:before {
131
131
  color: red;
132
132
  text-decoration: line-through; }
133
133
 
134
+ /* code highlighting with line numbers */
135
+ table.rouge-line-table td.rouge-gutter {
136
+ -moz-user-select: none;
137
+ -ms-user-select: none;
138
+ -webkit-user-select: none;
139
+ user-select: none;
140
+ padding-right: 1em; }
141
+
142
+ table.rouge-line-table td.rouge-code {
143
+ -moz-user-select: all;
144
+ -ms-user-select: all;
145
+ -webkit-user-select: all;
146
+ user-select: all; }
147
+
148
+ table.rouge-line-table,
149
+ table.rouge-line-table th,
150
+ table.rouge-line-table td {
151
+ width: auto;
152
+ border: none;
153
+ margin: 0;
154
+ padding: 0;
155
+ font-size: 100%; }
156
+
157
+ table.rouge-line-table pre {
158
+ margin: 0;
159
+ padding: 0;
160
+ overflow-x: visible;
161
+ font-size: 100%; }
162
+
134
163
  #standard-band {
135
164
  background-color: #0AC442; }
136
165
 
@@ -843,7 +872,7 @@ table {
843
872
  table th, table td {
844
873
  padding: 1em; }
845
874
  table td.header {
846
- font-weigth: 400; }
875
+ font-weight: 400; }
847
876
 
848
877
  p.TableTitle {
849
878
  text-align: center;
@@ -2,7 +2,7 @@
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
- <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"/>
5
+ <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'])) and not(ancestor::*[local-name() = 'bibdata'] and ancestor::*[local-name() = 'abstract'])]" use="@reference"/>
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
@@ -645,7 +645,7 @@
645
645
  <!-- ============================ -->
646
646
 
647
647
  <xsl:template match="un:figure" priority="2">
648
- <fo:block-container id="{@id}">
648
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
649
649
  <fo:block>
650
650
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
651
651
  </fo:block>
@@ -794,14 +794,14 @@
794
794
  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 -->
795
795
 
796
796
  <!--
797
- <misc-container>
797
+ <metanorma-extension>
798
798
  <presentation-metadata>
799
799
  <papersize>letter</papersize>
800
800
  </presentation-metadata>
801
- </misc-container>
801
+ </metanorma-extension>
802
802
  -->
803
803
 
804
- <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'])))"/>
804
+ <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'])))"/>
805
805
  <xsl:variable name="papersize_width_">
806
806
  <xsl:choose>
807
807
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -916,7 +916,7 @@
916
916
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
917
917
 
918
918
  <xsl:variable name="title-list-tables">
919
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
919
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
920
920
  <xsl:value-of select="$toc_table_title"/>
921
921
  <xsl:if test="normalize-space($toc_table_title) = ''">
922
922
  <xsl:call-template name="getTitle">
@@ -926,7 +926,7 @@
926
926
  </xsl:variable>
927
927
 
928
928
  <xsl:variable name="title-list-figures">
929
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
929
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
930
930
  <xsl:value-of select="$toc_figure_title"/>
931
931
  <xsl:if test="normalize-space($toc_figure_title) = ''">
932
932
  <xsl:call-template name="getTitle">
@@ -936,7 +936,7 @@
936
936
  </xsl:variable>
937
937
 
938
938
  <xsl:variable name="title-list-recommendations">
939
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
939
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
940
940
  <xsl:value-of select="$toc_requirement_title"/>
941
941
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
942
942
  <xsl:call-template name="getTitle">
@@ -1008,7 +1008,7 @@
1008
1008
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1009
1009
 
1010
1010
  <xsl:variable name="additional_fonts_">
1011
- <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']">
1011
+ <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']">
1012
1012
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1013
1013
  </xsl:for-each>
1014
1014
  </xsl:variable>
@@ -1561,6 +1561,7 @@
1561
1561
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1562
1562
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1563
1563
  <xsl:attribute name="border">2pt solid black</xsl:attribute>
1564
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1564
1565
 
1565
1566
  </xsl:attribute-set>
1566
1567
 
@@ -2060,10 +2061,10 @@
2060
2061
 
2061
2062
  <xsl:template name="processTablesFigures_Contents">
2062
2063
  <xsl:param name="always"/>
2063
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2064
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2064
2065
  <xsl:call-template name="processTables_Contents"/>
2065
2066
  </xsl:if>
2066
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2067
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2067
2068
  <xsl:call-template name="processFigures_Contents"/>
2068
2069
  </xsl:if>
2069
2070
  </xsl:template>
@@ -2405,6 +2406,8 @@
2405
2406
  <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2406
2407
  </xsl:if>
2407
2408
 
2409
+ <xsl:call-template name="setBordersTableArray"/>
2410
+
2408
2411
  </xsl:element>
2409
2412
  </xsl:variable>
2410
2413
 
@@ -2546,6 +2549,10 @@
2546
2549
 
2547
2550
  </xsl:template>
2548
2551
 
2552
+ <xsl:template name="setBordersTableArray">
2553
+
2554
+ </xsl:template>
2555
+
2549
2556
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
2550
2557
  <xsl:param name="continued"/>
2551
2558
  <xsl:if test="normalize-space() != ''">
@@ -3020,6 +3027,8 @@
3020
3027
  <fo:table-row>
3021
3028
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3022
3029
 
3030
+ <xsl:call-template name="setBordersTableArray"/>
3031
+
3023
3032
  <!-- fn will be processed inside 'note' processing -->
3024
3033
 
3025
3034
  <!-- for BSI (not PAS) display Notes before footnotes -->
@@ -3141,6 +3150,8 @@
3141
3150
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3142
3151
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3143
3152
 
3153
+ <xsl:call-template name="setBordersTableArray"/>
3154
+
3144
3155
  <xsl:call-template name="setTableRowAttributes"/>
3145
3156
 
3146
3157
  <xsl:apply-templates/>
@@ -3164,6 +3175,8 @@
3164
3175
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3165
3176
  </xsl:if>
3166
3177
 
3178
+ <xsl:call-template name="setBordersTableArray"/>
3179
+
3167
3180
  <xsl:call-template name="setTableRowAttributes"/>
3168
3181
  <xsl:apply-templates/>
3169
3182
  </fo:table-row>
@@ -3187,6 +3200,8 @@
3187
3200
  <xsl:with-param name="default">center</xsl:with-param>
3188
3201
  </xsl:call-template>
3189
3202
 
3203
+ <xsl:call-template name="setBordersTableArray"/>
3204
+
3190
3205
  <xsl:if test="$lang = 'ar'">
3191
3206
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3192
3207
  </xsl:if>
@@ -3239,6 +3254,8 @@
3239
3254
 
3240
3255
  <!-- bsi -->
3241
3256
 
3257
+ <xsl:call-template name="setBordersTableArray"/>
3258
+
3242
3259
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3243
3260
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3244
3261
  </xsl:if>
@@ -3297,7 +3314,7 @@
3297
3314
  </fn>
3298
3315
  -->
3299
3316
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
3300
- <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">
3317
+ <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">
3301
3318
 
3302
3319
  <!-- list of footnotes to calculate actual footnotes number -->
3303
3320
  <xsl:variable name="p_fn_">
@@ -3354,8 +3371,7 @@
3354
3371
  </fo:basic-link>
3355
3372
  </fo:inline>
3356
3373
  </xsl:variable>
3357
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3358
- gen_id=<xsl:value-of select="$gen_id"/> -->
3374
+
3359
3375
  <xsl:choose>
3360
3376
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3361
3377
  <xsl:copy-of select="$footnote_inline"/>
@@ -3410,7 +3426,7 @@
3410
3426
  <!-- commented:
3411
3427
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3412
3428
  because 'fn' there is in biblio-tag -->
3413
- <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])]">
3429
+ <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])]">
3414
3430
  <!-- copy unique fn -->
3415
3431
  <fn gen_id="{generate-id(.)}">
3416
3432
  <xsl:copy-of select="@*"/>
@@ -5964,7 +5980,9 @@
5964
5980
 
5965
5981
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
5966
5982
  <xsl:if test="number($scale) &lt; 100">
5967
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
5983
+
5984
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale * 0.985"/>%</xsl:attribute><!-- 0.985 due border around image -->
5985
+
5968
5986
  </xsl:if>
5969
5987
 
5970
5988
  </xsl:if>
@@ -6890,7 +6908,7 @@
6890
6908
  <!-- sourcecode -->
6891
6909
  <!-- =============== -->
6892
6910
 
6893
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6911
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
6894
6912
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6895
6913
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6896
6914
 
@@ -6978,6 +6996,12 @@
6978
6996
  </xsl:attribute>
6979
6997
  </xsl:for-each>
6980
6998
 
6999
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
7000
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7001
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7002
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7003
+ </xsl:if>
7004
+
6981
7005
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6982
7006
  </fo:block>
6983
7007
 
@@ -7026,7 +7050,7 @@
7026
7050
  </xsl:template>
7027
7051
 
7028
7052
  <!-- outer table with line numbers for sourcecode -->
7029
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
7053
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
7030
7054
  <fo:block>
7031
7055
  <fo:table width="100%" table-layout="fixed">
7032
7056
  <xsl:copy-of select="@id"/>
@@ -7038,16 +7062,16 @@
7038
7062
  </fo:table>
7039
7063
  </fo:block>
7040
7064
  </xsl:template>
7041
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
7065
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
7042
7066
  <xsl:apply-templates/>
7043
7067
  </xsl:template>
7044
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
7068
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
7045
7069
  <fo:table-row>
7046
7070
  <xsl:apply-templates/>
7047
7071
  </fo:table-row>
7048
7072
  </xsl:template>
7049
7073
  <!-- first td with line numbers -->
7050
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
7074
+ <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'] -->
7051
7075
  <fo:table-cell>
7052
7076
  <fo:block>
7053
7077
 
@@ -7067,8 +7091,9 @@
7067
7091
  </fo:block>
7068
7092
  </fo:table-cell>
7069
7093
  </xsl:template>
7094
+
7070
7095
  <!-- second td with sourcecode -->
7071
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
7096
+ <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'] -->
7072
7097
  <fo:table-cell>
7073
7098
  <fo:block>
7074
7099
  <xsl:apply-templates/>
@@ -7306,7 +7331,25 @@
7306
7331
  <xsl:template match="*[local-name()='pre']" name="pre">
7307
7332
  <fo:block xsl:use-attribute-sets="pre-style">
7308
7333
  <xsl:copy-of select="@id"/>
7309
- <xsl:apply-templates/>
7334
+ <xsl:choose>
7335
+
7336
+ <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' -->
7337
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
7338
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7339
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7340
+ </xsl:if>
7341
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
7342
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7343
+ <mtext><xsl:value-of select="."/></mtext>
7344
+ </math>
7345
+ </fo:instream-foreign-object>
7346
+ </xsl:when>
7347
+
7348
+ <xsl:otherwise>
7349
+ <xsl:apply-templates/>
7350
+ </xsl:otherwise>
7351
+
7352
+ </xsl:choose>
7310
7353
  </fo:block>
7311
7354
  </xsl:template>
7312
7355
  <!-- =============== -->
@@ -8910,8 +8953,8 @@
8910
8953
 
8911
8954
  <xsl:variable name="toc_level">
8912
8955
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
8913
- <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:-->
8914
- <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 -->
8956
+ <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:-->
8957
+ <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 -->
8915
8958
  <xsl:choose>
8916
8959
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
8917
8960
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -9907,6 +9950,7 @@
9907
9950
  <xsl:choose>
9908
9951
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
9909
9952
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
9953
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
9910
9954
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
9911
9955
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
9912
9956
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
- <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"/>
5
+ <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'])) and not(ancestor::*[local-name() = 'bibdata'] and ancestor::*[local-name() = 'abstract'])]" use="@reference"/>
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
@@ -645,7 +645,7 @@
645
645
  <!-- ============================ -->
646
646
 
647
647
  <xsl:template match="un:figure" priority="2">
648
- <fo:block-container id="{@id}">
648
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
649
649
  <fo:block>
650
650
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
651
651
  </fo:block>
@@ -794,14 +794,14 @@
794
794
  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 -->
795
795
 
796
796
  <!--
797
- <misc-container>
797
+ <metanorma-extension>
798
798
  <presentation-metadata>
799
799
  <papersize>letter</papersize>
800
800
  </presentation-metadata>
801
- </misc-container>
801
+ </metanorma-extension>
802
802
  -->
803
803
 
804
- <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'])))"/>
804
+ <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'])))"/>
805
805
  <xsl:variable name="papersize_width_">
806
806
  <xsl:choose>
807
807
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -916,7 +916,7 @@
916
916
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
917
917
 
918
918
  <xsl:variable name="title-list-tables">
919
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
919
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
920
920
  <xsl:value-of select="$toc_table_title"/>
921
921
  <xsl:if test="normalize-space($toc_table_title) = ''">
922
922
  <xsl:call-template name="getTitle">
@@ -926,7 +926,7 @@
926
926
  </xsl:variable>
927
927
 
928
928
  <xsl:variable name="title-list-figures">
929
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
929
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
930
930
  <xsl:value-of select="$toc_figure_title"/>
931
931
  <xsl:if test="normalize-space($toc_figure_title) = ''">
932
932
  <xsl:call-template name="getTitle">
@@ -936,7 +936,7 @@
936
936
  </xsl:variable>
937
937
 
938
938
  <xsl:variable name="title-list-recommendations">
939
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
939
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
940
940
  <xsl:value-of select="$toc_requirement_title"/>
941
941
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
942
942
  <xsl:call-template name="getTitle">
@@ -1008,7 +1008,7 @@
1008
1008
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1009
1009
 
1010
1010
  <xsl:variable name="additional_fonts_">
1011
- <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']">
1011
+ <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']">
1012
1012
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1013
1013
  </xsl:for-each>
1014
1014
  </xsl:variable>
@@ -1561,6 +1561,7 @@
1561
1561
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1562
1562
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1563
1563
  <xsl:attribute name="border">2pt solid black</xsl:attribute>
1564
+ <xsl:attribute name="text-indent">0</xsl:attribute>
1564
1565
 
1565
1566
  </xsl:attribute-set>
1566
1567
 
@@ -2060,10 +2061,10 @@
2060
2061
 
2061
2062
  <xsl:template name="processTablesFigures_Contents">
2062
2063
  <xsl:param name="always"/>
2063
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2064
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2064
2065
  <xsl:call-template name="processTables_Contents"/>
2065
2066
  </xsl:if>
2066
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2067
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2067
2068
  <xsl:call-template name="processFigures_Contents"/>
2068
2069
  </xsl:if>
2069
2070
  </xsl:template>
@@ -2405,6 +2406,8 @@
2405
2406
  <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2406
2407
  </xsl:if>
2407
2408
 
2409
+ <xsl:call-template name="setBordersTableArray"/>
2410
+
2408
2411
  </xsl:element>
2409
2412
  </xsl:variable>
2410
2413
 
@@ -2546,6 +2549,10 @@
2546
2549
 
2547
2550
  </xsl:template>
2548
2551
 
2552
+ <xsl:template name="setBordersTableArray">
2553
+
2554
+ </xsl:template>
2555
+
2549
2556
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
2550
2557
  <xsl:param name="continued"/>
2551
2558
  <xsl:if test="normalize-space() != ''">
@@ -3020,6 +3027,8 @@
3020
3027
  <fo:table-row>
3021
3028
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3022
3029
 
3030
+ <xsl:call-template name="setBordersTableArray"/>
3031
+
3023
3032
  <!-- fn will be processed inside 'note' processing -->
3024
3033
 
3025
3034
  <!-- for BSI (not PAS) display Notes before footnotes -->
@@ -3141,6 +3150,8 @@
3141
3150
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3142
3151
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3143
3152
 
3153
+ <xsl:call-template name="setBordersTableArray"/>
3154
+
3144
3155
  <xsl:call-template name="setTableRowAttributes"/>
3145
3156
 
3146
3157
  <xsl:apply-templates/>
@@ -3164,6 +3175,8 @@
3164
3175
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3165
3176
  </xsl:if>
3166
3177
 
3178
+ <xsl:call-template name="setBordersTableArray"/>
3179
+
3167
3180
  <xsl:call-template name="setTableRowAttributes"/>
3168
3181
  <xsl:apply-templates/>
3169
3182
  </fo:table-row>
@@ -3187,6 +3200,8 @@
3187
3200
  <xsl:with-param name="default">center</xsl:with-param>
3188
3201
  </xsl:call-template>
3189
3202
 
3203
+ <xsl:call-template name="setBordersTableArray"/>
3204
+
3190
3205
  <xsl:if test="$lang = 'ar'">
3191
3206
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3192
3207
  </xsl:if>
@@ -3239,6 +3254,8 @@
3239
3254
 
3240
3255
  <!-- bsi -->
3241
3256
 
3257
+ <xsl:call-template name="setBordersTableArray"/>
3258
+
3242
3259
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3243
3260
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3244
3261
  </xsl:if>
@@ -3297,7 +3314,7 @@
3297
3314
  </fn>
3298
3315
  -->
3299
3316
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
3300
- <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">
3317
+ <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">
3301
3318
 
3302
3319
  <!-- list of footnotes to calculate actual footnotes number -->
3303
3320
  <xsl:variable name="p_fn_">
@@ -3354,8 +3371,7 @@
3354
3371
  </fo:basic-link>
3355
3372
  </fo:inline>
3356
3373
  </xsl:variable>
3357
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3358
- gen_id=<xsl:value-of select="$gen_id"/> -->
3374
+
3359
3375
  <xsl:choose>
3360
3376
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3361
3377
  <xsl:copy-of select="$footnote_inline"/>
@@ -3410,7 +3426,7 @@
3410
3426
  <!-- commented:
3411
3427
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3412
3428
  because 'fn' there is in biblio-tag -->
3413
- <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])]">
3429
+ <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])]">
3414
3430
  <!-- copy unique fn -->
3415
3431
  <fn gen_id="{generate-id(.)}">
3416
3432
  <xsl:copy-of select="@*"/>
@@ -5964,7 +5980,9 @@
5964
5980
 
5965
5981
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
5966
5982
  <xsl:if test="number($scale) &lt; 100">
5967
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
5983
+
5984
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale * 0.985"/>%</xsl:attribute><!-- 0.985 due border around image -->
5985
+
5968
5986
  </xsl:if>
5969
5987
 
5970
5988
  </xsl:if>
@@ -6890,7 +6908,7 @@
6890
6908
  <!-- sourcecode -->
6891
6909
  <!-- =============== -->
6892
6910
 
6893
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6911
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
6894
6912
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6895
6913
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6896
6914
 
@@ -6978,6 +6996,12 @@
6978
6996
  </xsl:attribute>
6979
6997
  </xsl:for-each>
6980
6998
 
6999
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
7000
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7001
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7002
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7003
+ </xsl:if>
7004
+
6981
7005
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6982
7006
  </fo:block>
6983
7007
 
@@ -7026,7 +7050,7 @@
7026
7050
  </xsl:template>
7027
7051
 
7028
7052
  <!-- outer table with line numbers for sourcecode -->
7029
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
7053
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
7030
7054
  <fo:block>
7031
7055
  <fo:table width="100%" table-layout="fixed">
7032
7056
  <xsl:copy-of select="@id"/>
@@ -7038,16 +7062,16 @@
7038
7062
  </fo:table>
7039
7063
  </fo:block>
7040
7064
  </xsl:template>
7041
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
7065
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
7042
7066
  <xsl:apply-templates/>
7043
7067
  </xsl:template>
7044
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
7068
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
7045
7069
  <fo:table-row>
7046
7070
  <xsl:apply-templates/>
7047
7071
  </fo:table-row>
7048
7072
  </xsl:template>
7049
7073
  <!-- first td with line numbers -->
7050
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
7074
+ <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'] -->
7051
7075
  <fo:table-cell>
7052
7076
  <fo:block>
7053
7077
 
@@ -7067,8 +7091,9 @@
7067
7091
  </fo:block>
7068
7092
  </fo:table-cell>
7069
7093
  </xsl:template>
7094
+
7070
7095
  <!-- second td with sourcecode -->
7071
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
7096
+ <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'] -->
7072
7097
  <fo:table-cell>
7073
7098
  <fo:block>
7074
7099
  <xsl:apply-templates/>
@@ -7306,7 +7331,25 @@
7306
7331
  <xsl:template match="*[local-name()='pre']" name="pre">
7307
7332
  <fo:block xsl:use-attribute-sets="pre-style">
7308
7333
  <xsl:copy-of select="@id"/>
7309
- <xsl:apply-templates/>
7334
+ <xsl:choose>
7335
+
7336
+ <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' -->
7337
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
7338
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7339
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7340
+ </xsl:if>
7341
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
7342
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7343
+ <mtext><xsl:value-of select="."/></mtext>
7344
+ </math>
7345
+ </fo:instream-foreign-object>
7346
+ </xsl:when>
7347
+
7348
+ <xsl:otherwise>
7349
+ <xsl:apply-templates/>
7350
+ </xsl:otherwise>
7351
+
7352
+ </xsl:choose>
7310
7353
  </fo:block>
7311
7354
  </xsl:template>
7312
7355
  <!-- =============== -->
@@ -8910,8 +8953,8 @@
8910
8953
 
8911
8954
  <xsl:variable name="toc_level">
8912
8955
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
8913
- <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:-->
8914
- <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 -->
8956
+ <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:-->
8957
+ <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 -->
8915
8958
  <xsl:choose>
8916
8959
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
8917
8960
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -9907,6 +9950,7 @@
9907
9950
  <xsl:choose>
9908
9951
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
9909
9952
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
9953
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
9910
9954
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
9911
9955
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
9912
9956
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
- <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"/>
5
+ <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'])) and not(ancestor::*[local-name() = 'bibdata'] and ancestor::*[local-name() = 'abstract'])]" use="@reference"/>
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
@@ -750,7 +750,7 @@
750
750
  <!-- ============================ -->
751
751
 
752
752
  <xsl:template match="un:figure" priority="2">
753
- <fo:block-container id="{@id}">
753
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
754
754
  <xsl:if test="ancestor::un:admonition">
755
755
  <xsl:attribute name="margin-left">-5mm</xsl:attribute>
756
756
  <xsl:attribute name="margin-right">-5mm</xsl:attribute>
@@ -875,14 +875,14 @@
875
875
  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 -->
876
876
 
877
877
  <!--
878
- <misc-container>
878
+ <metanorma-extension>
879
879
  <presentation-metadata>
880
880
  <papersize>letter</papersize>
881
881
  </presentation-metadata>
882
- </misc-container>
882
+ </metanorma-extension>
883
883
  -->
884
884
 
885
- <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'])))"/>
885
+ <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'])))"/>
886
886
  <xsl:variable name="papersize_width_">
887
887
  <xsl:choose>
888
888
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -999,7 +999,7 @@
999
999
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
1000
1000
 
1001
1001
  <xsl:variable name="title-list-tables">
1002
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1002
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1003
1003
  <xsl:value-of select="$toc_table_title"/>
1004
1004
  <xsl:if test="normalize-space($toc_table_title) = ''">
1005
1005
  <xsl:call-template name="getTitle">
@@ -1009,7 +1009,7 @@
1009
1009
  </xsl:variable>
1010
1010
 
1011
1011
  <xsl:variable name="title-list-figures">
1012
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1012
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1013
1013
  <xsl:value-of select="$toc_figure_title"/>
1014
1014
  <xsl:if test="normalize-space($toc_figure_title) = ''">
1015
1015
  <xsl:call-template name="getTitle">
@@ -1019,7 +1019,7 @@
1019
1019
  </xsl:variable>
1020
1020
 
1021
1021
  <xsl:variable name="title-list-recommendations">
1022
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1022
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1023
1023
  <xsl:value-of select="$toc_requirement_title"/>
1024
1024
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
1025
1025
  <xsl:call-template name="getTitle">
@@ -1091,7 +1091,7 @@
1091
1091
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1092
1092
 
1093
1093
  <xsl:variable name="additional_fonts_">
1094
- <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']">
1094
+ <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']">
1095
1095
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1096
1096
  </xsl:for-each>
1097
1097
  </xsl:variable>
@@ -2129,10 +2129,10 @@
2129
2129
 
2130
2130
  <xsl:template name="processTablesFigures_Contents">
2131
2131
  <xsl:param name="always"/>
2132
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2132
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2133
2133
  <xsl:call-template name="processTables_Contents"/>
2134
2134
  </xsl:if>
2135
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2135
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
2136
2136
  <xsl:call-template name="processFigures_Contents"/>
2137
2137
  </xsl:if>
2138
2138
  </xsl:template>
@@ -2478,6 +2478,8 @@
2478
2478
  <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
2479
2479
  </xsl:if>
2480
2480
 
2481
+ <xsl:call-template name="setBordersTableArray"/>
2482
+
2481
2483
  <xsl:if test="ancestor::*[local-name()='sections']">
2482
2484
  <xsl:attribute name="border-top">1.5pt solid black</xsl:attribute>
2483
2485
  <xsl:attribute name="border-bottom">1.5pt solid black</xsl:attribute>
@@ -2624,6 +2626,10 @@
2624
2626
 
2625
2627
  </xsl:template>
2626
2628
 
2629
+ <xsl:template name="setBordersTableArray">
2630
+
2631
+ </xsl:template>
2632
+
2627
2633
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
2628
2634
  <xsl:param name="continued"/>
2629
2635
  <xsl:if test="normalize-space() != ''">
@@ -3098,6 +3104,8 @@
3098
3104
  <fo:table-row>
3099
3105
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
3100
3106
 
3107
+ <xsl:call-template name="setBordersTableArray"/>
3108
+
3101
3109
  <!-- fn will be processed inside 'note' processing -->
3102
3110
 
3103
3111
  <!-- for BSI (not PAS) display Notes before footnotes -->
@@ -3219,6 +3227,8 @@
3219
3227
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
3220
3228
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
3221
3229
 
3230
+ <xsl:call-template name="setBordersTableArray"/>
3231
+
3222
3232
  <xsl:call-template name="setTableRowAttributes"/>
3223
3233
 
3224
3234
  <xsl:apply-templates/>
@@ -3242,6 +3252,8 @@
3242
3252
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3243
3253
  </xsl:if>
3244
3254
 
3255
+ <xsl:call-template name="setBordersTableArray"/>
3256
+
3245
3257
  <xsl:call-template name="setTableRowAttributes"/>
3246
3258
  <xsl:apply-templates/>
3247
3259
  </fo:table-row>
@@ -3261,6 +3273,8 @@
3261
3273
  <xsl:with-param name="default">center</xsl:with-param>
3262
3274
  </xsl:call-template>
3263
3275
 
3276
+ <xsl:call-template name="setBordersTableArray"/>
3277
+
3264
3278
  <xsl:if test="ancestor::*[local-name()='sections']">
3265
3279
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
3266
3280
  <xsl:attribute name="display-align">before</xsl:attribute>
@@ -3328,6 +3342,8 @@
3328
3342
 
3329
3343
  <!-- bsi -->
3330
3344
 
3345
+ <xsl:call-template name="setBordersTableArray"/>
3346
+
3331
3347
  <xsl:if test="ancestor::*[local-name()='sections']">
3332
3348
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
3333
3349
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
@@ -3391,7 +3407,7 @@
3391
3407
  </fn>
3392
3408
  -->
3393
3409
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
3394
- <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">
3410
+ <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">
3395
3411
 
3396
3412
  <!-- list of footnotes to calculate actual footnotes number -->
3397
3413
  <xsl:variable name="p_fn_">
@@ -3448,8 +3464,7 @@
3448
3464
  </fo:basic-link>
3449
3465
  </fo:inline>
3450
3466
  </xsl:variable>
3451
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3452
- gen_id=<xsl:value-of select="$gen_id"/> -->
3467
+
3453
3468
  <xsl:choose>
3454
3469
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3455
3470
  <xsl:copy-of select="$footnote_inline"/>
@@ -3504,7 +3519,7 @@
3504
3519
  <!-- commented:
3505
3520
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3506
3521
  because 'fn' there is in biblio-tag -->
3507
- <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])]">
3522
+ <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])]">
3508
3523
  <!-- copy unique fn -->
3509
3524
  <fn gen_id="{generate-id(.)}">
3510
3525
  <xsl:copy-of select="@*"/>
@@ -6067,7 +6082,9 @@
6067
6082
 
6068
6083
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6069
6084
  <xsl:if test="number($scale) &lt; 100">
6070
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
6085
+
6086
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
6087
+
6071
6088
  </xsl:if>
6072
6089
 
6073
6090
  </xsl:if>
@@ -6993,7 +7010,7 @@
6993
7010
  <!-- sourcecode -->
6994
7011
  <!-- =============== -->
6995
7012
 
6996
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7013
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
6997
7014
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6998
7015
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6999
7016
 
@@ -7081,6 +7098,12 @@
7081
7098
  </xsl:attribute>
7082
7099
  </xsl:for-each>
7083
7100
 
7101
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
7102
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7103
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7104
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7105
+ </xsl:if>
7106
+
7084
7107
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7085
7108
  </fo:block>
7086
7109
 
@@ -7129,7 +7152,7 @@
7129
7152
  </xsl:template>
7130
7153
 
7131
7154
  <!-- outer table with line numbers for sourcecode -->
7132
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
7155
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
7133
7156
  <fo:block>
7134
7157
  <fo:table width="100%" table-layout="fixed">
7135
7158
  <xsl:copy-of select="@id"/>
@@ -7141,16 +7164,16 @@
7141
7164
  </fo:table>
7142
7165
  </fo:block>
7143
7166
  </xsl:template>
7144
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
7167
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
7145
7168
  <xsl:apply-templates/>
7146
7169
  </xsl:template>
7147
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
7170
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
7148
7171
  <fo:table-row>
7149
7172
  <xsl:apply-templates/>
7150
7173
  </fo:table-row>
7151
7174
  </xsl:template>
7152
7175
  <!-- first td with line numbers -->
7153
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
7176
+ <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'] -->
7154
7177
  <fo:table-cell>
7155
7178
  <fo:block>
7156
7179
 
@@ -7170,8 +7193,9 @@
7170
7193
  </fo:block>
7171
7194
  </fo:table-cell>
7172
7195
  </xsl:template>
7196
+
7173
7197
  <!-- second td with sourcecode -->
7174
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
7198
+ <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'] -->
7175
7199
  <fo:table-cell>
7176
7200
  <fo:block>
7177
7201
  <xsl:apply-templates/>
@@ -7409,7 +7433,25 @@
7409
7433
  <xsl:template match="*[local-name()='pre']" name="pre">
7410
7434
  <fo:block xsl:use-attribute-sets="pre-style">
7411
7435
  <xsl:copy-of select="@id"/>
7412
- <xsl:apply-templates/>
7436
+ <xsl:choose>
7437
+
7438
+ <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' -->
7439
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
7440
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7441
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7442
+ </xsl:if>
7443
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
7444
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7445
+ <mtext><xsl:value-of select="."/></mtext>
7446
+ </math>
7447
+ </fo:instream-foreign-object>
7448
+ </xsl:when>
7449
+
7450
+ <xsl:otherwise>
7451
+ <xsl:apply-templates/>
7452
+ </xsl:otherwise>
7453
+
7454
+ </xsl:choose>
7413
7455
  </fo:block>
7414
7456
  </xsl:template>
7415
7457
  <!-- =============== -->
@@ -9013,8 +9055,8 @@
9013
9055
 
9014
9056
  <xsl:variable name="toc_level">
9015
9057
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
9016
- <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:-->
9017
- <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 -->
9058
+ <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:-->
9059
+ <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 -->
9018
9060
  <xsl:choose>
9019
9061
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
9020
9062
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -10011,6 +10053,7 @@
10011
10053
  <xsl:choose>
10012
10054
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
10013
10055
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
10056
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
10014
10057
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
10015
10058
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
10016
10059
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
@@ -1316,7 +1316,7 @@
1316
1316
  <value>commentaryOf</value>
1317
1317
  <value>hasCommentary</value>
1318
1318
  <value>related</value>
1319
- <value>complements</value>
1319
+ <value>hasComplement</value>
1320
1320
  <value>complementOf</value>
1321
1321
  <value>obsoletes</value>
1322
1322
  <value>obsoletedBy</value>
@@ -1580,7 +1580,7 @@
1580
1580
  </element>
1581
1581
  </define>
1582
1582
  <define name="misccontainer">
1583
- <element name="misc-container">
1583
+ <element name="metanorma-extension">
1584
1584
  <oneOrMore>
1585
1585
  <ref name="AnyElement"/>
1586
1586
  </oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.10.1".freeze
3
+ VERSION = "0.10.3".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2023-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639