metanorma-un 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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>
@@ -1584,6 +1584,12 @@
1584
1584
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1585
1585
  </xsl:attribute-set>
1586
1586
 
1587
+ <xsl:attribute-set name="figure-block-style">
1588
+
1589
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1590
+
1591
+ </xsl:attribute-set>
1592
+
1587
1593
  <xsl:attribute-set name="figure-style">
1588
1594
 
1589
1595
  </xsl:attribute-set>
@@ -1592,7 +1598,7 @@
1592
1598
 
1593
1599
  <xsl:attribute name="text-align">center</xsl:attribute>
1594
1600
  <xsl:attribute name="font-size">9pt</xsl:attribute>
1595
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1601
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1596
1602
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1597
1603
  <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
1598
1604
 
@@ -3004,6 +3010,10 @@
3004
3010
  <xsl:with-param name="continued">true</xsl:with-param>
3005
3011
  </xsl:apply-templates>
3006
3012
 
3013
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
3014
+ <fo:block/>
3015
+ </xsl:if>
3016
+
3007
3017
  </fo:table-cell>
3008
3018
  </fo:table-row>
3009
3019
  </xsl:template> <!-- table-header-title -->
@@ -3381,7 +3391,7 @@
3381
3391
  </fn>
3382
3392
  -->
3383
3393
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
3384
- <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">
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">
3385
3395
 
3386
3396
  <!-- list of footnotes to calculate actual footnotes number -->
3387
3397
  <xsl:variable name="p_fn_">
@@ -3412,7 +3422,22 @@
3412
3422
 
3413
3423
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3414
3424
  <xsl:variable name="footnote_inline">
3415
- <fo:inline xsl:use-attribute-sets="fn-num-style">
3425
+ <fo:inline>
3426
+
3427
+ <xsl:variable name="fn_styles">
3428
+ <xsl:choose>
3429
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
3430
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
3431
+ </xsl:when>
3432
+ <xsl:otherwise>
3433
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
3434
+ </xsl:otherwise>
3435
+ </xsl:choose>
3436
+ </xsl:variable>
3437
+
3438
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
3439
+ <xsl:copy-of select="."/>
3440
+ </xsl:for-each>
3416
3441
 
3417
3442
  <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3418
3443
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -3423,8 +3448,7 @@
3423
3448
  </fo:basic-link>
3424
3449
  </fo:inline>
3425
3450
  </xsl:variable>
3426
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3427
- gen_id=<xsl:value-of select="$gen_id"/> -->
3451
+
3428
3452
  <xsl:choose>
3429
3453
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3430
3454
  <xsl:copy-of select="$footnote_inline"/>
@@ -3476,7 +3500,10 @@
3476
3500
  </xsl:for-each>
3477
3501
  <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
3478
3502
  <xsl:sort select="@displayorder" data-type="number"/>
3479
- <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3503
+ <!-- commented:
3504
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3505
+ because 'fn' there is in biblio-tag -->
3506
+ <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])]">
3480
3507
  <!-- copy unique fn -->
3481
3508
  <fn gen_id="{generate-id(.)}">
3482
3509
  <xsl:copy-of select="@*"/>
@@ -4325,7 +4352,7 @@
4325
4352
 
4326
4353
  <xsl:variable name="_font-size">
4327
4354
 
4328
- <!-- 10 -->
4355
+ <!-- inherit -->
4329
4356
 
4330
4357
  </xsl:variable>
4331
4358
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -5293,6 +5320,33 @@
5293
5320
  </xsl:choose>
5294
5321
  </xsl:template>
5295
5322
 
5323
+ <xsl:template name="getLang_fromCurrentNode">
5324
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5325
+ <xsl:variable name="language">
5326
+ <xsl:choose>
5327
+ <xsl:when test="$language_current != ''">
5328
+ <xsl:value-of select="$language_current"/>
5329
+ </xsl:when>
5330
+ <xsl:otherwise>
5331
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5332
+ <xsl:choose>
5333
+ <xsl:when test="$language_current_2 != ''">
5334
+ <xsl:value-of select="$language_current_2"/>
5335
+ </xsl:when>
5336
+ <xsl:otherwise>
5337
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5338
+ </xsl:otherwise>
5339
+ </xsl:choose>
5340
+ </xsl:otherwise>
5341
+ </xsl:choose>
5342
+ </xsl:variable>
5343
+
5344
+ <xsl:choose>
5345
+ <xsl:when test="$language = 'English'">en</xsl:when>
5346
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5347
+ </xsl:choose>
5348
+ </xsl:template>
5349
+
5296
5350
  <xsl:template name="capitalizeWords">
5297
5351
  <xsl:param name="str"/>
5298
5352
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -5929,7 +5983,7 @@
5929
5983
  <xsl:template match="*[local-name() = 'figure']" name="figure">
5930
5984
  <xsl:variable name="isAdded" select="@added"/>
5931
5985
  <xsl:variable name="isDeleted" select="@deleted"/>
5932
- <fo:block-container id="{@id}">
5986
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
5933
5987
 
5934
5988
  <xsl:call-template name="setTrackChangesStyles">
5935
5989
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -6012,7 +6066,9 @@
6012
6066
 
6013
6067
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6014
6068
  <xsl:if test="number($scale) &lt; 100">
6015
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
6069
+
6070
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
6071
+
6016
6072
  </xsl:if>
6017
6073
 
6018
6074
  </xsl:if>
@@ -6920,7 +6976,13 @@
6920
6976
  </xsl:template>
6921
6977
 
6922
6978
  <xsl:template match="text()" mode="contents_item">
6923
- <xsl:call-template name="keep_together_standard_number"/>
6979
+ <xsl:variable name="text">
6980
+ <!-- to split by '_' and other chars -->
6981
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
6982
+ </xsl:variable>
6983
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
6984
+ <xsl:call-template name="keep_together_standard_number"/>
6985
+ </xsl:for-each>
6924
6986
  </xsl:template>
6925
6987
 
6926
6988
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -6931,35 +6993,53 @@
6931
6993
  <!-- =============== -->
6932
6994
  <!-- sourcecode -->
6933
6995
  <!-- =============== -->
6934
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6935
6996
 
6936
- <xsl:variable name="sourcecode_attributes">
6937
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6938
- <xsl:variable name="_font-size">
6997
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6998
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6999
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6939
7000
 
6940
- <!-- 9 -->
7001
+ <xsl:template match="*[local-name() = 'property']" mode="css">
7002
+ <xsl:attribute name="{@name}">
7003
+ <xsl:value-of select="@value"/>
7004
+ </xsl:attribute>
7005
+ </xsl:template>
6941
7006
 
6942
- <!-- <xsl:if test="$namespace = 'ieee'">
6943
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6944
- </xsl:if> -->
7007
+ <xsl:template name="get_sourcecode_attributes">
7008
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7009
+ <xsl:variable name="_font-size">
6945
7010
 
6946
- 10
6947
- </xsl:variable>
7011
+ <!-- inherit -->
6948
7012
 
6949
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6950
- <xsl:if test="$font-size != ''">
6951
- <xsl:attribute name="font-size">
6952
- <xsl:choose>
6953
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6954
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6955
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6956
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6957
- </xsl:choose>
6958
- </xsl:attribute>
6959
- </xsl:if>
6960
- </xsl:element>
7013
+ <!-- <xsl:if test="$namespace = 'ieee'">
7014
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7015
+ </xsl:if> -->
7016
+
7017
+ 10
7018
+ </xsl:variable>
7019
+
7020
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7021
+ <xsl:if test="$font-size != ''">
7022
+ <xsl:attribute name="font-size">
7023
+ <xsl:choose>
7024
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7025
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7026
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7027
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7028
+ </xsl:choose>
7029
+ </xsl:attribute>
7030
+ </xsl:if>
7031
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
7032
+ </xsl:element>
7033
+ </xsl:template>
7034
+
7035
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7036
+
7037
+ <xsl:variable name="sourcecode_attributes">
7038
+ <xsl:call-template name="get_sourcecode_attributes"/>
6961
7039
  </xsl:variable>
6962
7040
 
7041
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
7042
+
6963
7043
  <xsl:choose>
6964
7044
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6965
7045
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -7002,6 +7082,12 @@
7002
7082
  </xsl:attribute>
7003
7083
  </xsl:for-each>
7004
7084
 
7085
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
7086
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7087
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7088
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7089
+ </xsl:if>
7090
+
7005
7091
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7006
7092
  </fo:block>
7007
7093
 
@@ -7013,9 +7099,10 @@
7013
7099
  </xsl:choose>
7014
7100
  </xsl:template>
7015
7101
 
7016
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
7102
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
7017
7103
  <xsl:choose>
7018
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7104
+ <!-- disabled -->
7105
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7019
7106
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
7020
7107
  <xsl:choose>
7021
7108
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -7030,9 +7117,77 @@
7030
7117
  <xsl:call-template name="add_spaces_to_sourcecode"/>
7031
7118
  </xsl:otherwise>
7032
7119
  </xsl:choose>
7120
+ </xsl:template>
7033
7121
 
7122
+ <!-- add sourcecode highlighting -->
7123
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7124
+ <xsl:variable name="class" select="@class"/>
7125
+ <xsl:choose>
7126
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
7127
+ <fo:inline>
7128
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7129
+ <xsl:apply-templates/>
7130
+ </fo:inline>
7131
+ </xsl:when>
7132
+ <xsl:otherwise>
7133
+ <xsl:apply-templates/>
7134
+ </xsl:otherwise>
7135
+ </xsl:choose>
7034
7136
  </xsl:template>
7035
7137
 
7138
+ <!-- outer table with line numbers for sourcecode -->
7139
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
7140
+ <fo:block>
7141
+ <fo:table width="100%" table-layout="fixed">
7142
+ <xsl:copy-of select="@id"/>
7143
+ <fo:table-column column-width="8%"/>
7144
+ <fo:table-column column-width="92%"/>
7145
+ <fo:table-body>
7146
+ <xsl:apply-templates/>
7147
+ </fo:table-body>
7148
+ </fo:table>
7149
+ </fo:block>
7150
+ </xsl:template>
7151
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
7152
+ <xsl:apply-templates/>
7153
+ </xsl:template>
7154
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
7155
+ <fo:table-row>
7156
+ <xsl:apply-templates/>
7157
+ </fo:table-row>
7158
+ </xsl:template>
7159
+ <!-- first td with line numbers -->
7160
+ <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'] -->
7161
+ <fo:table-cell>
7162
+ <fo:block>
7163
+
7164
+ <!-- set attibutes for line numbers - same as sourcecode -->
7165
+ <xsl:variable name="sourcecode_attributes">
7166
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
7167
+ <xsl:call-template name="get_sourcecode_attributes"/>
7168
+ </xsl:for-each>
7169
+ </xsl:variable>
7170
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
7171
+ <xsl:attribute name="{local-name()}">
7172
+ <xsl:value-of select="."/>
7173
+ </xsl:attribute>
7174
+ </xsl:for-each>
7175
+
7176
+ <xsl:apply-templates/>
7177
+ </fo:block>
7178
+ </fo:table-cell>
7179
+ </xsl:template>
7180
+
7181
+ <!-- second td with sourcecode -->
7182
+ <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'] -->
7183
+ <fo:table-cell>
7184
+ <fo:block>
7185
+ <xsl:apply-templates/>
7186
+ </fo:block>
7187
+ </fo:table-cell>
7188
+ </xsl:template>
7189
+ <!-- END outer table with line numbers for sourcecode -->
7190
+
7036
7191
  <xsl:template name="add_spaces_to_sourcecode">
7037
7192
  <xsl:variable name="text_step1">
7038
7193
  <xsl:call-template name="add-zero-spaces-equal"/>
@@ -7262,7 +7417,25 @@
7262
7417
  <xsl:template match="*[local-name()='pre']" name="pre">
7263
7418
  <fo:block xsl:use-attribute-sets="pre-style">
7264
7419
  <xsl:copy-of select="@id"/>
7265
- <xsl:apply-templates/>
7420
+ <xsl:choose>
7421
+
7422
+ <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' -->
7423
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
7424
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7425
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7426
+ </xsl:if>
7427
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
7428
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7429
+ <mtext><xsl:value-of select="."/></mtext>
7430
+ </math>
7431
+ </fo:instream-foreign-object>
7432
+ </xsl:when>
7433
+
7434
+ <xsl:otherwise>
7435
+ <xsl:apply-templates/>
7436
+ </xsl:otherwise>
7437
+
7438
+ </xsl:choose>
7266
7439
  </fo:block>
7267
7440
  </xsl:template>
7268
7441
  <!-- =============== -->
@@ -8714,160 +8887,53 @@
8714
8887
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8715
8888
 
8716
8889
  <xsl:template name="processBibitem">
8890
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8717
8891
 
8718
8892
  <!-- start UNECE bibitem processing -->
8719
- <fo:inline padding-right="5mm">[<xsl:value-of select="un:docidentifier"/>]</fo:inline><xsl:value-of select="un:docidentifier"/>
8720
- <xsl:text> </xsl:text>
8893
+ <fo:inline padding-right="5mm">
8894
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8895
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
8896
+ </xsl:apply-templates>
8897
+ </fo:inline>
8898
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8899
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
8900
+ </xsl:apply-templates>
8901
+
8721
8902
  <xsl:apply-templates select="un:formattedref"/>
8722
8903
  <!-- END UNECE bibitem processing -->
8723
8904
 
8724
8905
  </xsl:template> <!-- processBibitem (bibitem) -->
8725
8906
 
8726
- <xsl:template name="processBibitemDocId">
8727
- <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
8728
- <xsl:choose>
8729
- <xsl:when test="normalize-space($_doc_ident) != ''">
8730
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
8731
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8732
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8733
- </xsl:if> -->
8734
- <xsl:value-of select="$_doc_ident"/>
8735
- </xsl:when>
8736
- <xsl:otherwise>
8737
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8738
- <xsl:if test="$type != ''">
8739
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8740
- </xsl:if> -->
8741
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8742
- </xsl:otherwise>
8743
- </xsl:choose>
8744
- </xsl:template> <!-- processBibitemDocId -->
8907
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8908
+ <fo:inline><xsl:apply-templates/></fo:inline>
8909
+ </xsl:template>
8910
+
8911
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8745
8912
 
8746
- <xsl:template name="processPersonalAuthor">
8913
+ <xsl:template match="*[local-name() = 'formattedref']">
8914
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8915
+ <xsl:text>, </xsl:text>
8916
+ </xsl:if> -->
8917
+ <xsl:apply-templates/>
8918
+ </xsl:template>
8919
+
8920
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8921
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8747
8922
  <xsl:choose>
8748
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8749
- <author>
8750
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8751
- </author>
8923
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8924
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8752
8925
  </xsl:when>
8753
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8754
- <author>
8755
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8756
- <xsl:text> </xsl:text>
8757
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8758
- </author>
8759
- </xsl:when>
8760
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8761
- <author>
8762
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8763
- <xsl:text> </xsl:text>
8764
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8765
- </author>
8926
+ <xsl:when test="$biblio_tag_part = 'last'">
8927
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8766
8928
  </xsl:when>
8767
8929
  <xsl:otherwise>
8768
8930
  <xsl:apply-templates/>
8769
8931
  </xsl:otherwise>
8770
8932
  </xsl:choose>
8771
- </xsl:template> <!-- processPersonalAuthor -->
8772
-
8773
- <xsl:template name="renderDate">
8774
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8775
- <xsl:value-of select="*[local-name() = 'on']"/>
8776
- </xsl:if>
8777
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8778
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8779
- </xsl:if>
8780
- </xsl:template>
8781
-
8782
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8783
- <xsl:value-of select="translate(.,'. ','')"/>
8784
8933
  </xsl:template>
8785
8934
 
8786
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8787
- <xsl:value-of select="substring(.,1,1)"/>
8788
- </xsl:template>
8789
-
8790
- <xsl:template match="*[local-name() = 'title']" mode="title">
8791
- <fo:inline><xsl:apply-templates/></fo:inline>
8792
- </xsl:template>
8793
-
8794
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8795
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8796
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8797
- <xsl:apply-templates/>
8798
- </fo:inline>
8799
- </xsl:template>
8800
-
8801
- <!-- bibitem/note renders as footnote -->
8802
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8803
-
8804
- <!-- list of footnotes to calculate actual footnotes number -->
8805
- <xsl:variable name="p_fn_">
8806
- <xsl:call-template name="get_fn_list"/>
8807
- </xsl:variable>
8808
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8809
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8810
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8811
- <!-- fn sequence number in document -->
8812
- <xsl:variable name="current_fn_number">
8813
- <xsl:choose>
8814
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8815
- <xsl:otherwise>
8816
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8817
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8818
- </xsl:otherwise>
8819
- </xsl:choose>
8820
- </xsl:variable>
8821
- <fo:footnote>
8822
- <xsl:variable name="number">
8823
-
8824
- <xsl:value-of select="$current_fn_number"/>
8825
-
8826
- </xsl:variable>
8827
-
8828
- <xsl:variable name="current_fn_number_text">
8829
- <xsl:value-of select="$number"/>
8830
-
8831
- </xsl:variable>
8832
-
8833
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8834
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8835
- <xsl:value-of select="$current_fn_number_text"/>
8836
- </fo:basic-link>
8837
- </fo:inline>
8838
- <fo:footnote-body>
8839
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8840
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8841
- <xsl:value-of select="$current_fn_number_text"/>
8842
- </fo:inline>
8843
- <xsl:apply-templates/>
8844
- </fo:block>
8845
- </fo:footnote-body>
8846
- </fo:footnote>
8847
- </xsl:template>
8848
-
8849
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8850
- <xsl:text> edition </xsl:text>
8851
- <xsl:value-of select="."/>
8852
- </xsl:template>
8853
-
8854
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8855
- <xsl:text> (</xsl:text>
8856
- <fo:inline xsl:use-attribute-sets="link-style">
8857
- <fo:basic-link external-destination="." fox:alt-text=".">
8858
- <xsl:value-of select="."/>
8859
- </fo:basic-link>
8860
- </fo:inline>
8861
- <xsl:text>)</xsl:text>
8862
- </xsl:template>
8863
-
8864
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8865
-
8866
- <xsl:template match="*[local-name() = 'formattedref']">
8867
-
8868
- <xsl:text>, </xsl:text>
8869
-
8870
- <xsl:apply-templates/>
8935
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
8936
+ <xsl:text> </xsl:text>
8871
8937
  </xsl:template>
8872
8938
 
8873
8939
  <!-- ======================= -->
@@ -9301,6 +9367,12 @@
9301
9367
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9302
9368
  <xsl:apply-templates mode="update_xml_step1"/>
9303
9369
  </xsl:template>
9370
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9371
+ <xsl:copy>
9372
+ <xsl:copy-of select="@*"/>
9373
+ <xsl:apply-templates mode="update_xml_step1"/>
9374
+ </xsl:copy>
9375
+ </xsl:template>
9304
9376
  <!-- =========================================================================== -->
9305
9377
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9306
9378
  <!-- =========================================================================== -->
@@ -9781,6 +9853,10 @@
9781
9853
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9782
9854
  </xsl:template>
9783
9855
 
9856
+ <xsl:template name="getDocumentId_fromCurrentNode">
9857
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9858
+ </xsl:template>
9859
+
9784
9860
  <xsl:template name="namespaceCheck">
9785
9861
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9786
9862
  <xsl:variable name="XSLNS">
@@ -571,6 +571,11 @@
571
571
  <ref name="MultilingualRenderingType"/>
572
572
  </attribute>
573
573
  </optional>
574
+ <optional>
575
+ <attribute name="linenums">
576
+ <data type="boolean"/>
577
+ </attribute>
578
+ </optional>
574
579
  <optional>
575
580
  <ref name="tname"/>
576
581
  </optional>
@@ -1238,6 +1243,11 @@
1238
1243
  </define>
1239
1244
  <define name="concept">
1240
1245
  <element name="concept">
1246
+ <optional>
1247
+ <attribute name="bold">
1248
+ <data type="boolean"/>
1249
+ </attribute>
1250
+ </optional>
1241
1251
  <optional>
1242
1252
  <attribute name="ital">
1243
1253
  <data type="boolean"/>
@@ -2653,7 +2663,7 @@
2653
2663
  <value>full</value>
2654
2664
  <value>short</value>
2655
2665
  <value>id</value>
2656
- <value>modspec</value>
2666
+ <text/>
2657
2667
  </choice>
2658
2668
  </define>
2659
2669
  <define name="erefTypeWithConnective">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.10.0".freeze
3
+ VERSION = "0.10.2".freeze
4
4
  end
5
5
  end