metanorma-iho 0.7.0 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  <xsl:output 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']))]" use="@reference"/>
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
@@ -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 -->
@@ -3417,7 +3427,7 @@
3417
3427
  </fn>
3418
3428
  -->
3419
3429
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
3420
- <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">
3430
+ <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">
3421
3431
 
3422
3432
  <!-- list of footnotes to calculate actual footnotes number -->
3423
3433
  <xsl:variable name="p_fn_">
@@ -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>
@@ -3459,8 +3484,7 @@
3459
3484
  </fo:basic-link>
3460
3485
  </fo:inline>
3461
3486
  </xsl:variable>
3462
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3463
- gen_id=<xsl:value-of select="$gen_id"/> -->
3487
+
3464
3488
  <xsl:choose>
3465
3489
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3466
3490
  <xsl:copy-of select="$footnote_inline"/>
@@ -3512,7 +3536,10 @@
3512
3536
  </xsl:for-each>
3513
3537
  <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
3538
  <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])]">
3539
+ <!-- commented:
3540
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3541
+ because 'fn' there is in biblio-tag -->
3542
+ <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
3543
  <!-- copy unique fn -->
3517
3544
  <fn gen_id="{generate-id(.)}">
3518
3545
  <xsl:copy-of select="@*"/>
@@ -4368,7 +4395,7 @@
4368
4395
  <xsl:variable name="_font-size">
4369
4396
 
4370
4397
  9.5
4371
- <!-- 10 -->
4398
+ <!-- inherit -->
4372
4399
 
4373
4400
  </xsl:variable>
4374
4401
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -5405,6 +5432,33 @@
5405
5432
  </xsl:choose>
5406
5433
  </xsl:template>
5407
5434
 
5435
+ <xsl:template name="getLang_fromCurrentNode">
5436
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5437
+ <xsl:variable name="language">
5438
+ <xsl:choose>
5439
+ <xsl:when test="$language_current != ''">
5440
+ <xsl:value-of select="$language_current"/>
5441
+ </xsl:when>
5442
+ <xsl:otherwise>
5443
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5444
+ <xsl:choose>
5445
+ <xsl:when test="$language_current_2 != ''">
5446
+ <xsl:value-of select="$language_current_2"/>
5447
+ </xsl:when>
5448
+ <xsl:otherwise>
5449
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5450
+ </xsl:otherwise>
5451
+ </xsl:choose>
5452
+ </xsl:otherwise>
5453
+ </xsl:choose>
5454
+ </xsl:variable>
5455
+
5456
+ <xsl:choose>
5457
+ <xsl:when test="$language = 'English'">en</xsl:when>
5458
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5459
+ </xsl:choose>
5460
+ </xsl:template>
5461
+
5408
5462
  <xsl:template name="capitalizeWords">
5409
5463
  <xsl:param name="str"/>
5410
5464
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -6021,7 +6075,7 @@
6021
6075
  <xsl:template match="*[local-name() = 'figure']" name="figure">
6022
6076
  <xsl:variable name="isAdded" select="@added"/>
6023
6077
  <xsl:variable name="isDeleted" select="@deleted"/>
6024
- <fo:block-container id="{@id}">
6078
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6025
6079
 
6026
6080
  <xsl:call-template name="setTrackChangesStyles">
6027
6081
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -6099,7 +6153,9 @@
6099
6153
 
6100
6154
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6101
6155
  <xsl:if test="number($scale) &lt; 100">
6102
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
6156
+
6157
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
6158
+
6103
6159
  </xsl:if>
6104
6160
 
6105
6161
  </xsl:if>
@@ -7007,7 +7063,13 @@
7007
7063
  </xsl:template>
7008
7064
 
7009
7065
  <xsl:template match="text()" mode="contents_item">
7010
- <xsl:call-template name="keep_together_standard_number"/>
7066
+ <xsl:variable name="text">
7067
+ <!-- to split by '_' and other chars -->
7068
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
7069
+ </xsl:variable>
7070
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
7071
+ <xsl:call-template name="keep_together_standard_number"/>
7072
+ </xsl:for-each>
7011
7073
  </xsl:template>
7012
7074
 
7013
7075
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -7018,35 +7080,53 @@
7018
7080
  <!-- =============== -->
7019
7081
  <!-- sourcecode -->
7020
7082
  <!-- =============== -->
7021
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7022
7083
 
7023
- <xsl:variable name="sourcecode_attributes">
7024
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7025
- <xsl:variable name="_font-size">
7084
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7085
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
7086
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
7026
7087
 
7027
- 9.5
7028
- <!-- 9 -->
7088
+ <xsl:template match="*[local-name() = 'property']" mode="css">
7089
+ <xsl:attribute name="{@name}">
7090
+ <xsl:value-of select="@value"/>
7091
+ </xsl:attribute>
7092
+ </xsl:template>
7029
7093
 
7030
- <!-- <xsl:if test="$namespace = 'ieee'">
7031
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
7032
- </xsl:if> -->
7094
+ <xsl:template name="get_sourcecode_attributes">
7095
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7096
+ <xsl:variable name="_font-size">
7033
7097
 
7034
- </xsl:variable>
7098
+ 9.5
7099
+ <!-- inherit -->
7035
7100
 
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>
7101
+ <!-- <xsl:if test="$namespace = 'ieee'">
7102
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7103
+ </xsl:if> -->
7104
+
7105
+ </xsl:variable>
7106
+
7107
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7108
+ <xsl:if test="$font-size != ''">
7109
+ <xsl:attribute name="font-size">
7110
+ <xsl:choose>
7111
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7112
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7113
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7114
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7115
+ </xsl:choose>
7116
+ </xsl:attribute>
7117
+ </xsl:if>
7118
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
7119
+ </xsl:element>
7120
+ </xsl:template>
7121
+
7122
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7123
+
7124
+ <xsl:variable name="sourcecode_attributes">
7125
+ <xsl:call-template name="get_sourcecode_attributes"/>
7048
7126
  </xsl:variable>
7049
7127
 
7128
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
7129
+
7050
7130
  <xsl:choose>
7051
7131
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
7052
7132
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -7089,6 +7169,12 @@
7089
7169
  </xsl:attribute>
7090
7170
  </xsl:for-each>
7091
7171
 
7172
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
7173
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7174
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7175
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7176
+ </xsl:if>
7177
+
7092
7178
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7093
7179
  </fo:block>
7094
7180
 
@@ -7100,9 +7186,10 @@
7100
7186
  </xsl:choose>
7101
7187
  </xsl:template>
7102
7188
 
7103
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
7189
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
7104
7190
  <xsl:choose>
7105
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7191
+ <!-- disabled -->
7192
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7106
7193
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
7107
7194
  <xsl:choose>
7108
7195
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -7117,9 +7204,77 @@
7117
7204
  <xsl:call-template name="add_spaces_to_sourcecode"/>
7118
7205
  </xsl:otherwise>
7119
7206
  </xsl:choose>
7207
+ </xsl:template>
7208
+
7209
+ <!-- add sourcecode highlighting -->
7210
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7211
+ <xsl:variable name="class" select="@class"/>
7212
+ <xsl:choose>
7213
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
7214
+ <fo:inline>
7215
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7216
+ <xsl:apply-templates/>
7217
+ </fo:inline>
7218
+ </xsl:when>
7219
+ <xsl:otherwise>
7220
+ <xsl:apply-templates/>
7221
+ </xsl:otherwise>
7222
+ </xsl:choose>
7223
+ </xsl:template>
7224
+
7225
+ <!-- outer table with line numbers for sourcecode -->
7226
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
7227
+ <fo:block>
7228
+ <fo:table width="100%" table-layout="fixed">
7229
+ <xsl:copy-of select="@id"/>
7230
+ <fo:table-column column-width="8%"/>
7231
+ <fo:table-column column-width="92%"/>
7232
+ <fo:table-body>
7233
+ <xsl:apply-templates/>
7234
+ </fo:table-body>
7235
+ </fo:table>
7236
+ </fo:block>
7237
+ </xsl:template>
7238
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
7239
+ <xsl:apply-templates/>
7240
+ </xsl:template>
7241
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
7242
+ <fo:table-row>
7243
+ <xsl:apply-templates/>
7244
+ </fo:table-row>
7245
+ </xsl:template>
7246
+ <!-- first td with line numbers -->
7247
+ <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'] -->
7248
+ <fo:table-cell>
7249
+ <fo:block>
7250
+
7251
+ <!-- set attibutes for line numbers - same as sourcecode -->
7252
+ <xsl:variable name="sourcecode_attributes">
7253
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
7254
+ <xsl:call-template name="get_sourcecode_attributes"/>
7255
+ </xsl:for-each>
7256
+ </xsl:variable>
7257
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
7258
+ <xsl:attribute name="{local-name()}">
7259
+ <xsl:value-of select="."/>
7260
+ </xsl:attribute>
7261
+ </xsl:for-each>
7120
7262
 
7263
+ <xsl:apply-templates/>
7264
+ </fo:block>
7265
+ </fo:table-cell>
7121
7266
  </xsl:template>
7122
7267
 
7268
+ <!-- second td with sourcecode -->
7269
+ <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'] -->
7270
+ <fo:table-cell>
7271
+ <fo:block>
7272
+ <xsl:apply-templates/>
7273
+ </fo:block>
7274
+ </fo:table-cell>
7275
+ </xsl:template>
7276
+ <!-- END outer table with line numbers for sourcecode -->
7277
+
7123
7278
  <xsl:template name="add_spaces_to_sourcecode">
7124
7279
  <xsl:variable name="text_step1">
7125
7280
  <xsl:call-template name="add-zero-spaces-equal"/>
@@ -7349,7 +7504,25 @@
7349
7504
  <xsl:template match="*[local-name()='pre']" name="pre">
7350
7505
  <fo:block xsl:use-attribute-sets="pre-style">
7351
7506
  <xsl:copy-of select="@id"/>
7352
- <xsl:apply-templates/>
7507
+ <xsl:choose>
7508
+
7509
+ <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' -->
7510
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
7511
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7512
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7513
+ </xsl:if>
7514
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
7515
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7516
+ <mtext><xsl:value-of select="."/></mtext>
7517
+ </math>
7518
+ </fo:instream-foreign-object>
7519
+ </xsl:when>
7520
+
7521
+ <xsl:otherwise>
7522
+ <xsl:apply-templates/>
7523
+ </xsl:otherwise>
7524
+
7525
+ </xsl:choose>
7353
7526
  </fo:block>
7354
7527
  </xsl:template>
7355
7528
  <!-- =============== -->
@@ -8774,7 +8947,11 @@
8774
8947
 
8775
8948
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-normative-list-style">
8776
8949
 
8777
- <xsl:variable name="docidentifier" select="normalize-space(iho:docidentifier[@type != 'metanorma'][1])"/>
8950
+ <xsl:variable name="docidentifier">
8951
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8952
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
8953
+ </xsl:apply-templates>
8954
+ </xsl:variable>
8778
8955
 
8779
8956
  <xsl:attribute name="provisional-distance-between-starts">
8780
8957
  <xsl:choose>
@@ -8789,15 +8966,15 @@
8789
8966
  <fo:list-item-label end-indent="label-end()">
8790
8967
  <fo:block>
8791
8968
  <fo:inline>
8792
-
8793
- <xsl:value-of select="$docidentifier"/>
8794
-
8969
+ <xsl:copy-of select="$docidentifier"/>
8795
8970
  </fo:inline>
8796
8971
  </fo:block>
8797
8972
  </fo:list-item-label>
8798
8973
  <fo:list-item-body start-indent="body-start()">
8799
8974
  <fo:block xsl:use-attribute-sets="bibitem-normative-list-body-style">
8800
- <xsl:call-template name="processBibitem"/>
8975
+ <xsl:call-template name="processBibitem">
8976
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
8977
+ </xsl:call-template>
8801
8978
  </fo:block>
8802
8979
  </fo:list-item-body>
8803
8980
  </fo:list-item>
@@ -8813,158 +8990,51 @@
8813
8990
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8814
8991
 
8815
8992
  <xsl:template name="processBibitem">
8993
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8816
8994
 
8817
- <!-- start IHO bibitem processing -->
8818
- <xsl:apply-templates select="iho:formattedref"/>
8819
- <!-- end IHO bibitem processing -->
8995
+ <!-- start bibitem processing -->
8996
+ <xsl:if test=".//*[local-name() = 'fn']">
8997
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8998
+ </xsl:if>
8999
+
9000
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9001
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
9002
+ </xsl:apply-templates>
9003
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
9004
+ <!-- end bibitem processing -->
8820
9005
 
8821
9006
  </xsl:template> <!-- processBibitem (bibitem) -->
8822
9007
 
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 -->
9008
+ <xsl:template match="*[local-name() = 'title']" mode="title">
9009
+ <fo:inline><xsl:apply-templates/></fo:inline>
9010
+ </xsl:template>
9011
+
9012
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
9013
+
9014
+ <xsl:template match="*[local-name() = 'formattedref']">
9015
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
9016
+ <xsl:text>, </xsl:text>
9017
+ </xsl:if> -->
9018
+ <xsl:apply-templates/>
9019
+ </xsl:template>
8842
9020
 
8843
- <xsl:template name="processPersonalAuthor">
9021
+ <xsl:template match="*[local-name() = 'biblio-tag']">
9022
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8844
9023
  <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>
8849
- </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>
9024
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
9025
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8856
9026
  </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>
9027
+ <xsl:when test="$biblio_tag_part = 'last'">
9028
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8863
9029
  </xsl:when>
8864
9030
  <xsl:otherwise>
8865
9031
  <xsl:apply-templates/>
8866
9032
  </xsl:otherwise>
8867
9033
  </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
- </xsl:template>
8886
-
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
9034
  </xsl:template>
8962
9035
 
8963
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8964
-
8965
- <xsl:template match="*[local-name() = 'formattedref']">
8966
-
8967
- <xsl:apply-templates/>
9036
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
9037
+ <xsl:text> </xsl:text>
8968
9038
  </xsl:template>
8969
9039
 
8970
9040
  <!-- ======================= -->
@@ -9390,6 +9460,12 @@
9390
9460
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9391
9461
  <xsl:apply-templates mode="update_xml_step1"/>
9392
9462
  </xsl:template>
9463
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9464
+ <xsl:copy>
9465
+ <xsl:copy-of select="@*"/>
9466
+ <xsl:apply-templates mode="update_xml_step1"/>
9467
+ </xsl:copy>
9468
+ </xsl:template>
9393
9469
  <!-- =========================================================================== -->
9394
9470
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9395
9471
  <!-- =========================================================================== -->
@@ -9870,6 +9946,10 @@
9870
9946
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9871
9947
  </xsl:template>
9872
9948
 
9949
+ <xsl:template name="getDocumentId_fromCurrentNode">
9950
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9951
+ </xsl:template>
9952
+
9873
9953
  <xsl:template name="namespaceCheck">
9874
9954
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9875
9955
  <xsl:variable name="XSLNS">