metanorma-iho 0.7.0 → 0.7.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1340067bd6efc8f1651dabb526b2ec76dd66335b5a66a61db8343029c1ee8a8b
4
- data.tar.gz: 154d9df5ac5eb11ac659b9eec41cb8ed76b03ae22bad9e5decf59eb7773475ea
3
+ metadata.gz: ff15d46be3cd4bcd0e0c945fa667a86428776adb3ce71e0b4df4573bd55212c9
4
+ data.tar.gz: ba1ce31c0b92bcda79e5b908b3d9ef42628f17aed64cab4da0672e0925ef1ff0
5
5
  SHA512:
6
- metadata.gz: 9183c1385f0914009343d4d81db0f18f4bf44a8f1902589d49dc544fc67eba4ec34c5275046b76400ca347eeafbacf0178d9d5fb4b6e1fdc93df1be327885f5a
7
- data.tar.gz: a9675063b1b0b1fd5fa793a2b4c0a1b802a586fe08d60151cb890f6228a9317b0c3d7beacace2ed16dcc929781262757d8bc6a130c7016e0a8f2f6825e52cc2b
6
+ metadata.gz: c6b4599aa6390ee14bc3792214c81984092cf8826cddb0d197841cfc4eb0164ec933c4dafa4f9d2da847f47f90268c8c366f0fb12025bf36e62667d771c51a0d
7
+ data.tar.gz: 970bb8a0451845ac23a5d5cb59745740d48064cea35ee3ca2f24a4f2ce5fe08cbf31998282c85d4f1759c01a9025ba53a7da2d56c7e317c5b6182107fb6c6d4b
data/.gitignore CHANGED
@@ -1,7 +1,6 @@
1
1
  .rubocop-https--*
2
2
 
3
3
  /.rspec_status
4
- /Gemfile.devel
5
4
  /Gemfile.lock
6
5
  /coverage/
7
6
  /test.doc
@@ -9,13 +9,6 @@ module IsoDoc
9
9
  super
10
10
  end
11
11
  end
12
-
13
- def std_bibitem_entry(list, bib, ordinal, biblio)
14
- list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
15
- prefix_bracketed_ref(ref, "[#{ordinal}]")
16
- reference_format(bib, ref)
17
- end
18
- end
19
12
  end
20
13
  end
21
14
  end
@@ -624,8 +624,11 @@ a:hover {
624
624
  background: #fedc5b;
625
625
  box-shadow: 3px 0 0 #fedc5b, -3px 0 0 #fedc5b; }
626
626
 
627
- ::selection,
628
- ::-moz-selection {
627
+ *::selection {
628
+ background: #fedc5b;
629
+ color: #05164d; }
630
+
631
+ *::-moz-selection {
629
632
  background: #fedc5b;
630
633
  color: #05164d; }
631
634
 
@@ -1658,6 +1658,12 @@
1658
1658
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1659
1659
  </xsl:attribute-set>
1660
1660
 
1661
+ <xsl:attribute-set name="figure-block-style">
1662
+
1663
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1664
+
1665
+ </xsl:attribute-set>
1666
+
1661
1667
  <xsl:attribute-set name="figure-style">
1662
1668
 
1663
1669
  </xsl:attribute-set>
@@ -1668,7 +1674,7 @@
1668
1674
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1669
1675
  <xsl:attribute name="text-align">center</xsl:attribute>
1670
1676
  <xsl:attribute name="margin-top">2pt</xsl:attribute>
1671
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1677
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1672
1678
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1673
1679
 
1674
1680
  </xsl:attribute-set>
@@ -3064,6 +3070,10 @@
3064
3070
  <xsl:with-param name="continued">true</xsl:with-param>
3065
3071
  </xsl:apply-templates>
3066
3072
 
3073
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
3074
+ <fo:block/>
3075
+ </xsl:if>
3076
+
3067
3077
  </fo:table-cell>
3068
3078
  </fo:table-row>
3069
3079
  </xsl:template> <!-- table-header-title -->
@@ -3448,7 +3458,22 @@
3448
3458
 
3449
3459
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3450
3460
  <xsl:variable name="footnote_inline">
3451
- <fo:inline xsl:use-attribute-sets="fn-num-style">
3461
+ <fo:inline>
3462
+
3463
+ <xsl:variable name="fn_styles">
3464
+ <xsl:choose>
3465
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
3466
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
3467
+ </xsl:when>
3468
+ <xsl:otherwise>
3469
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
3470
+ </xsl:otherwise>
3471
+ </xsl:choose>
3472
+ </xsl:variable>
3473
+
3474
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
3475
+ <xsl:copy-of select="."/>
3476
+ </xsl:for-each>
3452
3477
 
3453
3478
  <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3454
3479
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -3512,7 +3537,10 @@
3512
3537
  </xsl:for-each>
3513
3538
  <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']/*">
3514
3539
  <xsl:sort select="@displayorder" data-type="number"/>
3515
- <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])]">
3540
+ <!-- commented:
3541
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3542
+ because 'fn' there is in biblio-tag -->
3543
+ <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])]">
3516
3544
  <!-- copy unique fn -->
3517
3545
  <fn gen_id="{generate-id(.)}">
3518
3546
  <xsl:copy-of select="@*"/>
@@ -4368,7 +4396,7 @@
4368
4396
  <xsl:variable name="_font-size">
4369
4397
 
4370
4398
  9.5
4371
- <!-- 10 -->
4399
+ <!-- inherit -->
4372
4400
 
4373
4401
  </xsl:variable>
4374
4402
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -5405,6 +5433,33 @@
5405
5433
  </xsl:choose>
5406
5434
  </xsl:template>
5407
5435
 
5436
+ <xsl:template name="getLang_fromCurrentNode">
5437
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5438
+ <xsl:variable name="language">
5439
+ <xsl:choose>
5440
+ <xsl:when test="$language_current != ''">
5441
+ <xsl:value-of select="$language_current"/>
5442
+ </xsl:when>
5443
+ <xsl:otherwise>
5444
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5445
+ <xsl:choose>
5446
+ <xsl:when test="$language_current_2 != ''">
5447
+ <xsl:value-of select="$language_current_2"/>
5448
+ </xsl:when>
5449
+ <xsl:otherwise>
5450
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5451
+ </xsl:otherwise>
5452
+ </xsl:choose>
5453
+ </xsl:otherwise>
5454
+ </xsl:choose>
5455
+ </xsl:variable>
5456
+
5457
+ <xsl:choose>
5458
+ <xsl:when test="$language = 'English'">en</xsl:when>
5459
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5460
+ </xsl:choose>
5461
+ </xsl:template>
5462
+
5408
5463
  <xsl:template name="capitalizeWords">
5409
5464
  <xsl:param name="str"/>
5410
5465
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -6021,7 +6076,7 @@
6021
6076
  <xsl:template match="*[local-name() = 'figure']" name="figure">
6022
6077
  <xsl:variable name="isAdded" select="@added"/>
6023
6078
  <xsl:variable name="isDeleted" select="@deleted"/>
6024
- <fo:block-container id="{@id}">
6079
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6025
6080
 
6026
6081
  <xsl:call-template name="setTrackChangesStyles">
6027
6082
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -7007,7 +7062,13 @@
7007
7062
  </xsl:template>
7008
7063
 
7009
7064
  <xsl:template match="text()" mode="contents_item">
7010
- <xsl:call-template name="keep_together_standard_number"/>
7065
+ <xsl:variable name="text">
7066
+ <!-- to split by '_' and other chars -->
7067
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
7068
+ </xsl:variable>
7069
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
7070
+ <xsl:call-template name="keep_together_standard_number"/>
7071
+ </xsl:for-each>
7011
7072
  </xsl:template>
7012
7073
 
7013
7074
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -7018,35 +7079,53 @@
7018
7079
  <!-- =============== -->
7019
7080
  <!-- sourcecode -->
7020
7081
  <!-- =============== -->
7021
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7022
7082
 
7023
- <xsl:variable name="sourcecode_attributes">
7024
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7025
- <xsl:variable name="_font-size">
7083
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7084
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
7085
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
7026
7086
 
7027
- 9.5
7028
- <!-- 9 -->
7087
+ <xsl:template match="*[local-name() = 'property']" mode="css">
7088
+ <xsl:attribute name="{@name}">
7089
+ <xsl:value-of select="@value"/>
7090
+ </xsl:attribute>
7091
+ </xsl:template>
7029
7092
 
7030
- <!-- <xsl:if test="$namespace = 'ieee'">
7031
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
7032
- </xsl:if> -->
7093
+ <xsl:template name="get_sourcecode_attributes">
7094
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7095
+ <xsl:variable name="_font-size">
7033
7096
 
7034
- </xsl:variable>
7097
+ 9.5
7098
+ <!-- inherit -->
7035
7099
 
7036
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7037
- <xsl:if test="$font-size != ''">
7038
- <xsl:attribute name="font-size">
7039
- <xsl:choose>
7040
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7041
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7042
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7043
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7044
- </xsl:choose>
7045
- </xsl:attribute>
7046
- </xsl:if>
7047
- </xsl:element>
7100
+ <!-- <xsl:if test="$namespace = 'ieee'">
7101
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7102
+ </xsl:if> -->
7103
+
7104
+ </xsl:variable>
7105
+
7106
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7107
+ <xsl:if test="$font-size != ''">
7108
+ <xsl:attribute name="font-size">
7109
+ <xsl:choose>
7110
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7111
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7112
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7113
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7114
+ </xsl:choose>
7115
+ </xsl:attribute>
7116
+ </xsl:if>
7117
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
7118
+ </xsl:element>
7119
+ </xsl:template>
7120
+
7121
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7122
+
7123
+ <xsl:variable name="sourcecode_attributes">
7124
+ <xsl:call-template name="get_sourcecode_attributes"/>
7048
7125
  </xsl:variable>
7049
7126
 
7127
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
7128
+
7050
7129
  <xsl:choose>
7051
7130
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
7052
7131
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -7100,9 +7179,10 @@
7100
7179
  </xsl:choose>
7101
7180
  </xsl:template>
7102
7181
 
7103
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
7182
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
7104
7183
  <xsl:choose>
7105
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7184
+ <!-- disabled -->
7185
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7106
7186
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
7107
7187
  <xsl:choose>
7108
7188
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -7117,8 +7197,75 @@
7117
7197
  <xsl:call-template name="add_spaces_to_sourcecode"/>
7118
7198
  </xsl:otherwise>
7119
7199
  </xsl:choose>
7200
+ </xsl:template>
7201
+
7202
+ <!-- add sourcecode highlighting -->
7203
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7204
+ <xsl:variable name="class" select="@class"/>
7205
+ <xsl:choose>
7206
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
7207
+ <fo:inline>
7208
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7209
+ <xsl:apply-templates/>
7210
+ </fo:inline>
7211
+ </xsl:when>
7212
+ <xsl:otherwise>
7213
+ <xsl:apply-templates/>
7214
+ </xsl:otherwise>
7215
+ </xsl:choose>
7216
+ </xsl:template>
7217
+
7218
+ <!-- outer table with line numbers for sourcecode -->
7219
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
7220
+ <fo:block>
7221
+ <fo:table width="100%" table-layout="fixed">
7222
+ <xsl:copy-of select="@id"/>
7223
+ <fo:table-column column-width="8%"/>
7224
+ <fo:table-column column-width="92%"/>
7225
+ <fo:table-body>
7226
+ <xsl:apply-templates/>
7227
+ </fo:table-body>
7228
+ </fo:table>
7229
+ </fo:block>
7230
+ </xsl:template>
7231
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
7232
+ <xsl:apply-templates/>
7233
+ </xsl:template>
7234
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
7235
+ <fo:table-row>
7236
+ <xsl:apply-templates/>
7237
+ </fo:table-row>
7238
+ </xsl:template>
7239
+ <!-- first td with line numbers -->
7240
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
7241
+ <fo:table-cell>
7242
+ <fo:block>
7243
+
7244
+ <!-- set attibutes for line numbers - same as sourcecode -->
7245
+ <xsl:variable name="sourcecode_attributes">
7246
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
7247
+ <xsl:call-template name="get_sourcecode_attributes"/>
7248
+ </xsl:for-each>
7249
+ </xsl:variable>
7250
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
7251
+ <xsl:attribute name="{local-name()}">
7252
+ <xsl:value-of select="."/>
7253
+ </xsl:attribute>
7254
+ </xsl:for-each>
7120
7255
 
7256
+ <xsl:apply-templates/>
7257
+ </fo:block>
7258
+ </fo:table-cell>
7121
7259
  </xsl:template>
7260
+ <!-- second td with sourcecode -->
7261
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
7262
+ <fo:table-cell>
7263
+ <fo:block>
7264
+ <xsl:apply-templates/>
7265
+ </fo:block>
7266
+ </fo:table-cell>
7267
+ </xsl:template>
7268
+ <!-- END outer table with line numbers for sourcecode -->
7122
7269
 
7123
7270
  <xsl:template name="add_spaces_to_sourcecode">
7124
7271
  <xsl:variable name="text_step1">
@@ -8774,7 +8921,11 @@
8774
8921
 
8775
8922
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-normative-list-style">
8776
8923
 
8777
- <xsl:variable name="docidentifier" select="normalize-space(iho:docidentifier[@type != 'metanorma'][1])"/>
8924
+ <xsl:variable name="docidentifier">
8925
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8926
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
8927
+ </xsl:apply-templates>
8928
+ </xsl:variable>
8778
8929
 
8779
8930
  <xsl:attribute name="provisional-distance-between-starts">
8780
8931
  <xsl:choose>
@@ -8789,15 +8940,15 @@
8789
8940
  <fo:list-item-label end-indent="label-end()">
8790
8941
  <fo:block>
8791
8942
  <fo:inline>
8792
-
8793
- <xsl:value-of select="$docidentifier"/>
8794
-
8943
+ <xsl:copy-of select="$docidentifier"/>
8795
8944
  </fo:inline>
8796
8945
  </fo:block>
8797
8946
  </fo:list-item-label>
8798
8947
  <fo:list-item-body start-indent="body-start()">
8799
8948
  <fo:block xsl:use-attribute-sets="bibitem-normative-list-body-style">
8800
- <xsl:call-template name="processBibitem"/>
8949
+ <xsl:call-template name="processBibitem">
8950
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
8951
+ </xsl:call-template>
8801
8952
  </fo:block>
8802
8953
  </fo:list-item-body>
8803
8954
  </fo:list-item>
@@ -8813,158 +8964,51 @@
8813
8964
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8814
8965
 
8815
8966
  <xsl:template name="processBibitem">
8967
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8816
8968
 
8817
- <!-- start IHO bibitem processing -->
8818
- <xsl:apply-templates select="iho:formattedref"/>
8819
- <!-- end IHO bibitem processing -->
8969
+ <!-- start bibitem processing -->
8970
+ <xsl:if test=".//*[local-name() = 'fn']">
8971
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8972
+ </xsl:if>
8973
+
8974
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8975
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
8976
+ </xsl:apply-templates>
8977
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8978
+ <!-- end bibitem processing -->
8820
8979
 
8821
8980
  </xsl:template> <!-- processBibitem (bibitem) -->
8822
8981
 
8823
- <xsl:template name="processBibitemDocId">
8824
- <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')]"/>
8825
- <xsl:choose>
8826
- <xsl:when test="normalize-space($_doc_ident) != ''">
8827
- <!-- <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"/>
8828
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8829
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8830
- </xsl:if> -->
8831
- <xsl:value-of select="$_doc_ident"/>
8832
- </xsl:when>
8833
- <xsl:otherwise>
8834
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8835
- <xsl:if test="$type != ''">
8836
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8837
- </xsl:if> -->
8838
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8839
- </xsl:otherwise>
8840
- </xsl:choose>
8841
- </xsl:template> <!-- processBibitemDocId -->
8982
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8983
+ <fo:inline><xsl:apply-templates/></fo:inline>
8984
+ </xsl:template>
8985
+
8986
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8987
+
8988
+ <xsl:template match="*[local-name() = 'formattedref']">
8989
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8990
+ <xsl:text>, </xsl:text>
8991
+ </xsl:if> -->
8992
+ <xsl:apply-templates/>
8993
+ </xsl:template>
8842
8994
 
8843
- <xsl:template name="processPersonalAuthor">
8995
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8996
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8844
8997
  <xsl:choose>
8845
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8846
- <author>
8847
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8848
- </author>
8998
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8999
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8849
9000
  </xsl:when>
8850
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8851
- <author>
8852
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8853
- <xsl:text> </xsl:text>
8854
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8855
- </author>
8856
- </xsl:when>
8857
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8858
- <author>
8859
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8860
- <xsl:text> </xsl:text>
8861
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8862
- </author>
9001
+ <xsl:when test="$biblio_tag_part = 'last'">
9002
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8863
9003
  </xsl:when>
8864
9004
  <xsl:otherwise>
8865
9005
  <xsl:apply-templates/>
8866
9006
  </xsl:otherwise>
8867
9007
  </xsl:choose>
8868
- </xsl:template> <!-- processPersonalAuthor -->
8869
-
8870
- <xsl:template name="renderDate">
8871
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8872
- <xsl:value-of select="*[local-name() = 'on']"/>
8873
- </xsl:if>
8874
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8875
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8876
- </xsl:if>
8877
- </xsl:template>
8878
-
8879
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8880
- <xsl:value-of select="translate(.,'. ','')"/>
8881
- </xsl:template>
8882
-
8883
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8884
- <xsl:value-of select="substring(.,1,1)"/>
8885
9008
  </xsl:template>
8886
9009
 
8887
- <xsl:template match="*[local-name() = 'title']" mode="title">
8888
- <fo:inline><xsl:apply-templates/></fo:inline>
8889
- </xsl:template>
8890
-
8891
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8892
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8893
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8894
- <xsl:apply-templates/>
8895
- </fo:inline>
8896
- </xsl:template>
8897
-
8898
- <!-- bibitem/note renders as footnote -->
8899
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8900
-
8901
- <!-- list of footnotes to calculate actual footnotes number -->
8902
- <xsl:variable name="p_fn_">
8903
- <xsl:call-template name="get_fn_list"/>
8904
- </xsl:variable>
8905
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8906
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8907
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8908
- <!-- fn sequence number in document -->
8909
- <xsl:variable name="current_fn_number">
8910
- <xsl:choose>
8911
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8912
- <xsl:otherwise>
8913
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8914
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8915
- </xsl:otherwise>
8916
- </xsl:choose>
8917
- </xsl:variable>
8918
- <fo:footnote>
8919
- <xsl:variable name="number">
8920
-
8921
- <xsl:value-of select="$current_fn_number"/>
8922
-
8923
- </xsl:variable>
8924
-
8925
- <xsl:variable name="current_fn_number_text">
8926
- <xsl:value-of select="$number"/>
8927
-
8928
- <xsl:text>)</xsl:text>
8929
-
8930
- </xsl:variable>
8931
-
8932
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8933
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8934
- <xsl:value-of select="$current_fn_number_text"/>
8935
- </fo:basic-link>
8936
- </fo:inline>
8937
- <fo:footnote-body>
8938
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8939
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8940
- <xsl:value-of select="$current_fn_number_text"/>
8941
- </fo:inline>
8942
- <xsl:apply-templates/>
8943
- </fo:block>
8944
- </fo:footnote-body>
8945
- </fo:footnote>
8946
- </xsl:template>
8947
-
8948
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8949
- <xsl:text> edition </xsl:text>
8950
- <xsl:value-of select="."/>
8951
- </xsl:template>
8952
-
8953
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8954
- <xsl:text> (</xsl:text>
8955
- <fo:inline xsl:use-attribute-sets="link-style">
8956
- <fo:basic-link external-destination="." fox:alt-text=".">
8957
- <xsl:value-of select="."/>
8958
- </fo:basic-link>
8959
- </fo:inline>
8960
- <xsl:text>)</xsl:text>
8961
- </xsl:template>
8962
-
8963
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8964
-
8965
- <xsl:template match="*[local-name() = 'formattedref']">
8966
-
8967
- <xsl:apply-templates/>
9010
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
9011
+ <xsl:text> </xsl:text>
8968
9012
  </xsl:template>
8969
9013
 
8970
9014
  <!-- ======================= -->
@@ -9390,6 +9434,12 @@
9390
9434
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9391
9435
  <xsl:apply-templates mode="update_xml_step1"/>
9392
9436
  </xsl:template>
9437
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9438
+ <xsl:copy>
9439
+ <xsl:copy-of select="@*"/>
9440
+ <xsl:apply-templates mode="update_xml_step1"/>
9441
+ </xsl:copy>
9442
+ </xsl:template>
9393
9443
  <!-- =========================================================================== -->
9394
9444
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9395
9445
  <!-- =========================================================================== -->
@@ -9870,6 +9920,10 @@
9870
9920
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9871
9921
  </xsl:template>
9872
9922
 
9923
+ <xsl:template name="getDocumentId_fromCurrentNode">
9924
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9925
+ </xsl:template>
9926
+
9873
9927
  <xsl:template name="namespaceCheck">
9874
9928
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9875
9929
  <xsl:variable name="XSLNS">
@@ -1658,6 +1658,12 @@
1658
1658
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1659
1659
  </xsl:attribute-set>
1660
1660
 
1661
+ <xsl:attribute-set name="figure-block-style">
1662
+
1663
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1664
+
1665
+ </xsl:attribute-set>
1666
+
1661
1667
  <xsl:attribute-set name="figure-style">
1662
1668
 
1663
1669
  </xsl:attribute-set>
@@ -1668,7 +1674,7 @@
1668
1674
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1669
1675
  <xsl:attribute name="text-align">center</xsl:attribute>
1670
1676
  <xsl:attribute name="margin-top">2pt</xsl:attribute>
1671
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1677
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1672
1678
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1673
1679
 
1674
1680
  </xsl:attribute-set>
@@ -3064,6 +3070,10 @@
3064
3070
  <xsl:with-param name="continued">true</xsl:with-param>
3065
3071
  </xsl:apply-templates>
3066
3072
 
3073
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
3074
+ <fo:block/>
3075
+ </xsl:if>
3076
+
3067
3077
  </fo:table-cell>
3068
3078
  </fo:table-row>
3069
3079
  </xsl:template> <!-- table-header-title -->
@@ -3448,7 +3458,22 @@
3448
3458
 
3449
3459
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3450
3460
  <xsl:variable name="footnote_inline">
3451
- <fo:inline xsl:use-attribute-sets="fn-num-style">
3461
+ <fo:inline>
3462
+
3463
+ <xsl:variable name="fn_styles">
3464
+ <xsl:choose>
3465
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
3466
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
3467
+ </xsl:when>
3468
+ <xsl:otherwise>
3469
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
3470
+ </xsl:otherwise>
3471
+ </xsl:choose>
3472
+ </xsl:variable>
3473
+
3474
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
3475
+ <xsl:copy-of select="."/>
3476
+ </xsl:for-each>
3452
3477
 
3453
3478
  <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3454
3479
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -3512,7 +3537,10 @@
3512
3537
  </xsl:for-each>
3513
3538
  <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']/*">
3514
3539
  <xsl:sort select="@displayorder" data-type="number"/>
3515
- <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])]">
3540
+ <!-- commented:
3541
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3542
+ because 'fn' there is in biblio-tag -->
3543
+ <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])]">
3516
3544
  <!-- copy unique fn -->
3517
3545
  <fn gen_id="{generate-id(.)}">
3518
3546
  <xsl:copy-of select="@*"/>
@@ -4368,7 +4396,7 @@
4368
4396
  <xsl:variable name="_font-size">
4369
4397
 
4370
4398
  9.5
4371
- <!-- 10 -->
4399
+ <!-- inherit -->
4372
4400
 
4373
4401
  </xsl:variable>
4374
4402
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -5405,6 +5433,33 @@
5405
5433
  </xsl:choose>
5406
5434
  </xsl:template>
5407
5435
 
5436
+ <xsl:template name="getLang_fromCurrentNode">
5437
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5438
+ <xsl:variable name="language">
5439
+ <xsl:choose>
5440
+ <xsl:when test="$language_current != ''">
5441
+ <xsl:value-of select="$language_current"/>
5442
+ </xsl:when>
5443
+ <xsl:otherwise>
5444
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5445
+ <xsl:choose>
5446
+ <xsl:when test="$language_current_2 != ''">
5447
+ <xsl:value-of select="$language_current_2"/>
5448
+ </xsl:when>
5449
+ <xsl:otherwise>
5450
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5451
+ </xsl:otherwise>
5452
+ </xsl:choose>
5453
+ </xsl:otherwise>
5454
+ </xsl:choose>
5455
+ </xsl:variable>
5456
+
5457
+ <xsl:choose>
5458
+ <xsl:when test="$language = 'English'">en</xsl:when>
5459
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5460
+ </xsl:choose>
5461
+ </xsl:template>
5462
+
5408
5463
  <xsl:template name="capitalizeWords">
5409
5464
  <xsl:param name="str"/>
5410
5465
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -6021,7 +6076,7 @@
6021
6076
  <xsl:template match="*[local-name() = 'figure']" name="figure">
6022
6077
  <xsl:variable name="isAdded" select="@added"/>
6023
6078
  <xsl:variable name="isDeleted" select="@deleted"/>
6024
- <fo:block-container id="{@id}">
6079
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6025
6080
 
6026
6081
  <xsl:call-template name="setTrackChangesStyles">
6027
6082
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -7007,7 +7062,13 @@
7007
7062
  </xsl:template>
7008
7063
 
7009
7064
  <xsl:template match="text()" mode="contents_item">
7010
- <xsl:call-template name="keep_together_standard_number"/>
7065
+ <xsl:variable name="text">
7066
+ <!-- to split by '_' and other chars -->
7067
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
7068
+ </xsl:variable>
7069
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
7070
+ <xsl:call-template name="keep_together_standard_number"/>
7071
+ </xsl:for-each>
7011
7072
  </xsl:template>
7012
7073
 
7013
7074
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -7018,35 +7079,53 @@
7018
7079
  <!-- =============== -->
7019
7080
  <!-- sourcecode -->
7020
7081
  <!-- =============== -->
7021
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7022
7082
 
7023
- <xsl:variable name="sourcecode_attributes">
7024
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7025
- <xsl:variable name="_font-size">
7083
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7084
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
7085
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
7026
7086
 
7027
- 9.5
7028
- <!-- 9 -->
7087
+ <xsl:template match="*[local-name() = 'property']" mode="css">
7088
+ <xsl:attribute name="{@name}">
7089
+ <xsl:value-of select="@value"/>
7090
+ </xsl:attribute>
7091
+ </xsl:template>
7029
7092
 
7030
- <!-- <xsl:if test="$namespace = 'ieee'">
7031
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
7032
- </xsl:if> -->
7093
+ <xsl:template name="get_sourcecode_attributes">
7094
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7095
+ <xsl:variable name="_font-size">
7033
7096
 
7034
- </xsl:variable>
7097
+ 9.5
7098
+ <!-- inherit -->
7035
7099
 
7036
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7037
- <xsl:if test="$font-size != ''">
7038
- <xsl:attribute name="font-size">
7039
- <xsl:choose>
7040
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7041
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7042
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7043
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7044
- </xsl:choose>
7045
- </xsl:attribute>
7046
- </xsl:if>
7047
- </xsl:element>
7100
+ <!-- <xsl:if test="$namespace = 'ieee'">
7101
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7102
+ </xsl:if> -->
7103
+
7104
+ </xsl:variable>
7105
+
7106
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7107
+ <xsl:if test="$font-size != ''">
7108
+ <xsl:attribute name="font-size">
7109
+ <xsl:choose>
7110
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7111
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7112
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7113
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7114
+ </xsl:choose>
7115
+ </xsl:attribute>
7116
+ </xsl:if>
7117
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
7118
+ </xsl:element>
7119
+ </xsl:template>
7120
+
7121
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7122
+
7123
+ <xsl:variable name="sourcecode_attributes">
7124
+ <xsl:call-template name="get_sourcecode_attributes"/>
7048
7125
  </xsl:variable>
7049
7126
 
7127
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
7128
+
7050
7129
  <xsl:choose>
7051
7130
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
7052
7131
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -7100,9 +7179,10 @@
7100
7179
  </xsl:choose>
7101
7180
  </xsl:template>
7102
7181
 
7103
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
7182
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
7104
7183
  <xsl:choose>
7105
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7184
+ <!-- disabled -->
7185
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7106
7186
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
7107
7187
  <xsl:choose>
7108
7188
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -7117,8 +7197,75 @@
7117
7197
  <xsl:call-template name="add_spaces_to_sourcecode"/>
7118
7198
  </xsl:otherwise>
7119
7199
  </xsl:choose>
7200
+ </xsl:template>
7201
+
7202
+ <!-- add sourcecode highlighting -->
7203
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7204
+ <xsl:variable name="class" select="@class"/>
7205
+ <xsl:choose>
7206
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
7207
+ <fo:inline>
7208
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7209
+ <xsl:apply-templates/>
7210
+ </fo:inline>
7211
+ </xsl:when>
7212
+ <xsl:otherwise>
7213
+ <xsl:apply-templates/>
7214
+ </xsl:otherwise>
7215
+ </xsl:choose>
7216
+ </xsl:template>
7217
+
7218
+ <!-- outer table with line numbers for sourcecode -->
7219
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
7220
+ <fo:block>
7221
+ <fo:table width="100%" table-layout="fixed">
7222
+ <xsl:copy-of select="@id"/>
7223
+ <fo:table-column column-width="8%"/>
7224
+ <fo:table-column column-width="92%"/>
7225
+ <fo:table-body>
7226
+ <xsl:apply-templates/>
7227
+ </fo:table-body>
7228
+ </fo:table>
7229
+ </fo:block>
7230
+ </xsl:template>
7231
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
7232
+ <xsl:apply-templates/>
7233
+ </xsl:template>
7234
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
7235
+ <fo:table-row>
7236
+ <xsl:apply-templates/>
7237
+ </fo:table-row>
7238
+ </xsl:template>
7239
+ <!-- first td with line numbers -->
7240
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
7241
+ <fo:table-cell>
7242
+ <fo:block>
7243
+
7244
+ <!-- set attibutes for line numbers - same as sourcecode -->
7245
+ <xsl:variable name="sourcecode_attributes">
7246
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
7247
+ <xsl:call-template name="get_sourcecode_attributes"/>
7248
+ </xsl:for-each>
7249
+ </xsl:variable>
7250
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
7251
+ <xsl:attribute name="{local-name()}">
7252
+ <xsl:value-of select="."/>
7253
+ </xsl:attribute>
7254
+ </xsl:for-each>
7120
7255
 
7256
+ <xsl:apply-templates/>
7257
+ </fo:block>
7258
+ </fo:table-cell>
7121
7259
  </xsl:template>
7260
+ <!-- second td with sourcecode -->
7261
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
7262
+ <fo:table-cell>
7263
+ <fo:block>
7264
+ <xsl:apply-templates/>
7265
+ </fo:block>
7266
+ </fo:table-cell>
7267
+ </xsl:template>
7268
+ <!-- END outer table with line numbers for sourcecode -->
7122
7269
 
7123
7270
  <xsl:template name="add_spaces_to_sourcecode">
7124
7271
  <xsl:variable name="text_step1">
@@ -8774,7 +8921,11 @@
8774
8921
 
8775
8922
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-normative-list-style">
8776
8923
 
8777
- <xsl:variable name="docidentifier" select="normalize-space(iho:docidentifier[@type != 'metanorma'][1])"/>
8924
+ <xsl:variable name="docidentifier">
8925
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8926
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
8927
+ </xsl:apply-templates>
8928
+ </xsl:variable>
8778
8929
 
8779
8930
  <xsl:attribute name="provisional-distance-between-starts">
8780
8931
  <xsl:choose>
@@ -8789,15 +8940,15 @@
8789
8940
  <fo:list-item-label end-indent="label-end()">
8790
8941
  <fo:block>
8791
8942
  <fo:inline>
8792
-
8793
- <xsl:value-of select="$docidentifier"/>
8794
-
8943
+ <xsl:copy-of select="$docidentifier"/>
8795
8944
  </fo:inline>
8796
8945
  </fo:block>
8797
8946
  </fo:list-item-label>
8798
8947
  <fo:list-item-body start-indent="body-start()">
8799
8948
  <fo:block xsl:use-attribute-sets="bibitem-normative-list-body-style">
8800
- <xsl:call-template name="processBibitem"/>
8949
+ <xsl:call-template name="processBibitem">
8950
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
8951
+ </xsl:call-template>
8801
8952
  </fo:block>
8802
8953
  </fo:list-item-body>
8803
8954
  </fo:list-item>
@@ -8813,158 +8964,51 @@
8813
8964
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8814
8965
 
8815
8966
  <xsl:template name="processBibitem">
8967
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8816
8968
 
8817
- <!-- start IHO bibitem processing -->
8818
- <xsl:apply-templates select="iho:formattedref"/>
8819
- <!-- end IHO bibitem processing -->
8969
+ <!-- start bibitem processing -->
8970
+ <xsl:if test=".//*[local-name() = 'fn']">
8971
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8972
+ </xsl:if>
8973
+
8974
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8975
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
8976
+ </xsl:apply-templates>
8977
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8978
+ <!-- end bibitem processing -->
8820
8979
 
8821
8980
  </xsl:template> <!-- processBibitem (bibitem) -->
8822
8981
 
8823
- <xsl:template name="processBibitemDocId">
8824
- <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')]"/>
8825
- <xsl:choose>
8826
- <xsl:when test="normalize-space($_doc_ident) != ''">
8827
- <!-- <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"/>
8828
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8829
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8830
- </xsl:if> -->
8831
- <xsl:value-of select="$_doc_ident"/>
8832
- </xsl:when>
8833
- <xsl:otherwise>
8834
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8835
- <xsl:if test="$type != ''">
8836
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8837
- </xsl:if> -->
8838
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8839
- </xsl:otherwise>
8840
- </xsl:choose>
8841
- </xsl:template> <!-- processBibitemDocId -->
8982
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8983
+ <fo:inline><xsl:apply-templates/></fo:inline>
8984
+ </xsl:template>
8985
+
8986
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8987
+
8988
+ <xsl:template match="*[local-name() = 'formattedref']">
8989
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8990
+ <xsl:text>, </xsl:text>
8991
+ </xsl:if> -->
8992
+ <xsl:apply-templates/>
8993
+ </xsl:template>
8842
8994
 
8843
- <xsl:template name="processPersonalAuthor">
8995
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8996
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8844
8997
  <xsl:choose>
8845
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8846
- <author>
8847
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8848
- </author>
8998
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8999
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8849
9000
  </xsl:when>
8850
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8851
- <author>
8852
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8853
- <xsl:text> </xsl:text>
8854
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8855
- </author>
8856
- </xsl:when>
8857
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8858
- <author>
8859
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8860
- <xsl:text> </xsl:text>
8861
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8862
- </author>
9001
+ <xsl:when test="$biblio_tag_part = 'last'">
9002
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8863
9003
  </xsl:when>
8864
9004
  <xsl:otherwise>
8865
9005
  <xsl:apply-templates/>
8866
9006
  </xsl:otherwise>
8867
9007
  </xsl:choose>
8868
- </xsl:template> <!-- processPersonalAuthor -->
8869
-
8870
- <xsl:template name="renderDate">
8871
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8872
- <xsl:value-of select="*[local-name() = 'on']"/>
8873
- </xsl:if>
8874
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8875
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8876
- </xsl:if>
8877
- </xsl:template>
8878
-
8879
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8880
- <xsl:value-of select="translate(.,'. ','')"/>
8881
- </xsl:template>
8882
-
8883
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8884
- <xsl:value-of select="substring(.,1,1)"/>
8885
9008
  </xsl:template>
8886
9009
 
8887
- <xsl:template match="*[local-name() = 'title']" mode="title">
8888
- <fo:inline><xsl:apply-templates/></fo:inline>
8889
- </xsl:template>
8890
-
8891
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8892
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8893
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8894
- <xsl:apply-templates/>
8895
- </fo:inline>
8896
- </xsl:template>
8897
-
8898
- <!-- bibitem/note renders as footnote -->
8899
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8900
-
8901
- <!-- list of footnotes to calculate actual footnotes number -->
8902
- <xsl:variable name="p_fn_">
8903
- <xsl:call-template name="get_fn_list"/>
8904
- </xsl:variable>
8905
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8906
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8907
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8908
- <!-- fn sequence number in document -->
8909
- <xsl:variable name="current_fn_number">
8910
- <xsl:choose>
8911
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8912
- <xsl:otherwise>
8913
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8914
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8915
- </xsl:otherwise>
8916
- </xsl:choose>
8917
- </xsl:variable>
8918
- <fo:footnote>
8919
- <xsl:variable name="number">
8920
-
8921
- <xsl:value-of select="$current_fn_number"/>
8922
-
8923
- </xsl:variable>
8924
-
8925
- <xsl:variable name="current_fn_number_text">
8926
- <xsl:value-of select="$number"/>
8927
-
8928
- <xsl:text>)</xsl:text>
8929
-
8930
- </xsl:variable>
8931
-
8932
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8933
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8934
- <xsl:value-of select="$current_fn_number_text"/>
8935
- </fo:basic-link>
8936
- </fo:inline>
8937
- <fo:footnote-body>
8938
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8939
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8940
- <xsl:value-of select="$current_fn_number_text"/>
8941
- </fo:inline>
8942
- <xsl:apply-templates/>
8943
- </fo:block>
8944
- </fo:footnote-body>
8945
- </fo:footnote>
8946
- </xsl:template>
8947
-
8948
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8949
- <xsl:text> edition </xsl:text>
8950
- <xsl:value-of select="."/>
8951
- </xsl:template>
8952
-
8953
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8954
- <xsl:text> (</xsl:text>
8955
- <fo:inline xsl:use-attribute-sets="link-style">
8956
- <fo:basic-link external-destination="." fox:alt-text=".">
8957
- <xsl:value-of select="."/>
8958
- </fo:basic-link>
8959
- </fo:inline>
8960
- <xsl:text>)</xsl:text>
8961
- </xsl:template>
8962
-
8963
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8964
-
8965
- <xsl:template match="*[local-name() = 'formattedref']">
8966
-
8967
- <xsl:apply-templates/>
9010
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
9011
+ <xsl:text> </xsl:text>
8968
9012
  </xsl:template>
8969
9013
 
8970
9014
  <!-- ======================= -->
@@ -9390,6 +9434,12 @@
9390
9434
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9391
9435
  <xsl:apply-templates mode="update_xml_step1"/>
9392
9436
  </xsl:template>
9437
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9438
+ <xsl:copy>
9439
+ <xsl:copy-of select="@*"/>
9440
+ <xsl:apply-templates mode="update_xml_step1"/>
9441
+ </xsl:copy>
9442
+ </xsl:template>
9393
9443
  <!-- =========================================================================== -->
9394
9444
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9395
9445
  <!-- =========================================================================== -->
@@ -9870,6 +9920,10 @@
9870
9920
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9871
9921
  </xsl:template>
9872
9922
 
9923
+ <xsl:template name="getDocumentId_fromCurrentNode">
9924
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9925
+ </xsl:template>
9926
+
9873
9927
  <xsl:template name="namespaceCheck">
9874
9928
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9875
9929
  <xsl:variable name="XSLNS">
@@ -10,6 +10,14 @@ module IsoDoc
10
10
  ::Relaton::Render::IHO::General.new(language: @lang)
11
11
  end
12
12
 
13
+ def norm_ref_entry_code(ordinal, _idents, _ids, _standard, _datefn)
14
+ "[#{ordinal}]<tab/>"
15
+ end
16
+
17
+ def biblio_ref_entry_code(ordinal, _idents, _ids, _standard, _datefn)
18
+ "[#{ordinal}]<tab/>"
19
+ end
20
+
13
21
  include Init
14
22
  end
15
23
  end
@@ -47,7 +47,7 @@
47
47
  </element>
48
48
  </define>
49
49
  <define name="DocumentType">
50
- <value>document</value>
50
+ <text/>
51
51
  </define>
52
52
  <define name="docsubtype">
53
53
  <element name="subdoctype">
@@ -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 IHO
3
- VERSION = "0.7.0".freeze
3
+ VERSION = "0.7.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
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-05 00:00:00.000000000 Z
11
+ date: 2022-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic