metanorma-bipm 2.2.0 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@
4
4
 
5
5
  <xsl:param name="align-cross-elements"/>
6
6
 
7
- <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"/>
7
+ <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"/>
8
8
 
9
9
  <xsl:variable name="align_cross_elements_default">clause</xsl:variable>
10
10
  <xsl:variable name="align_cross_elements_doc">
@@ -2506,6 +2506,12 @@
2506
2506
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2507
2507
  </xsl:attribute-set>
2508
2508
 
2509
+ <xsl:attribute-set name="figure-block-style">
2510
+
2511
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2512
+
2513
+ </xsl:attribute-set>
2514
+
2509
2515
  <xsl:attribute-set name="figure-style">
2510
2516
 
2511
2517
  </xsl:attribute-set>
@@ -2515,7 +2521,7 @@
2515
2521
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2516
2522
  <xsl:attribute name="text-align">center</xsl:attribute>
2517
2523
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2518
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2524
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
2519
2525
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2520
2526
 
2521
2527
  </xsl:attribute-set>
@@ -3917,6 +3923,10 @@
3917
3923
  <xsl:with-param name="continued">true</xsl:with-param>
3918
3924
  </xsl:apply-templates>
3919
3925
 
3926
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
3927
+ <fo:block/>
3928
+ </xsl:if>
3929
+
3920
3930
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
3921
3931
  <xsl:call-template name="table_name_fn_display"/>
3922
3932
  </xsl:for-each>
@@ -4338,7 +4348,7 @@
4338
4348
  </fn>
4339
4349
  -->
4340
4350
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
4341
- <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">
4351
+ <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">
4342
4352
 
4343
4353
  <!-- list of footnotes to calculate actual footnotes number -->
4344
4354
  <xsl:variable name="p_fn_">
@@ -4369,7 +4379,22 @@
4369
4379
 
4370
4380
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4371
4381
  <xsl:variable name="footnote_inline">
4372
- <fo:inline xsl:use-attribute-sets="fn-num-style">
4382
+ <fo:inline>
4383
+
4384
+ <xsl:variable name="fn_styles">
4385
+ <xsl:choose>
4386
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
4387
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
4388
+ </xsl:when>
4389
+ <xsl:otherwise>
4390
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
4391
+ </xsl:otherwise>
4392
+ </xsl:choose>
4393
+ </xsl:variable>
4394
+
4395
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
4396
+ <xsl:copy-of select="."/>
4397
+ </xsl:for-each>
4373
4398
 
4374
4399
  <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
4375
4400
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -4380,8 +4405,7 @@
4380
4405
  </fo:basic-link>
4381
4406
  </fo:inline>
4382
4407
  </xsl:variable>
4383
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
4384
- gen_id=<xsl:value-of select="$gen_id"/> -->
4408
+
4385
4409
  <xsl:choose>
4386
4410
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4387
4411
  <xsl:copy-of select="$footnote_inline"/>
@@ -4433,7 +4457,10 @@
4433
4457
  </xsl:for-each>
4434
4458
  <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']/*">
4435
4459
  <xsl:sort select="@displayorder" data-type="number"/>
4436
- <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])]">
4460
+ <!-- commented:
4461
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
4462
+ because 'fn' there is in biblio-tag -->
4463
+ <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])]">
4437
4464
  <!-- copy unique fn -->
4438
4465
  <fn gen_id="{generate-id(.)}">
4439
4466
  <xsl:copy-of select="@*"/>
@@ -5301,7 +5328,7 @@
5301
5328
 
5302
5329
  <xsl:variable name="_font-size">
5303
5330
 
5304
- <!-- 10 -->
5331
+ <!-- inherit -->
5305
5332
 
5306
5333
  10
5307
5334
 
@@ -6272,6 +6299,33 @@
6272
6299
  </xsl:choose>
6273
6300
  </xsl:template>
6274
6301
 
6302
+ <xsl:template name="getLang_fromCurrentNode">
6303
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6304
+ <xsl:variable name="language">
6305
+ <xsl:choose>
6306
+ <xsl:when test="$language_current != ''">
6307
+ <xsl:value-of select="$language_current"/>
6308
+ </xsl:when>
6309
+ <xsl:otherwise>
6310
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6311
+ <xsl:choose>
6312
+ <xsl:when test="$language_current_2 != ''">
6313
+ <xsl:value-of select="$language_current_2"/>
6314
+ </xsl:when>
6315
+ <xsl:otherwise>
6316
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
6317
+ </xsl:otherwise>
6318
+ </xsl:choose>
6319
+ </xsl:otherwise>
6320
+ </xsl:choose>
6321
+ </xsl:variable>
6322
+
6323
+ <xsl:choose>
6324
+ <xsl:when test="$language = 'English'">en</xsl:when>
6325
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
6326
+ </xsl:choose>
6327
+ </xsl:template>
6328
+
6275
6329
  <xsl:template name="capitalizeWords">
6276
6330
  <xsl:param name="str"/>
6277
6331
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -6895,7 +6949,7 @@
6895
6949
  <xsl:template match="*[local-name() = 'figure']" name="figure">
6896
6950
  <xsl:variable name="isAdded" select="@added"/>
6897
6951
  <xsl:variable name="isDeleted" select="@deleted"/>
6898
- <fo:block-container id="{@id}">
6952
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6899
6953
 
6900
6954
  <xsl:call-template name="setTrackChangesStyles">
6901
6955
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -6973,7 +7027,9 @@
6973
7027
 
6974
7028
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
6975
7029
  <xsl:if test="number($scale) &lt; 100">
6976
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7030
+
7031
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7032
+
6977
7033
  </xsl:if>
6978
7034
 
6979
7035
  </xsl:if>
@@ -7881,7 +7937,13 @@
7881
7937
  </xsl:template>
7882
7938
 
7883
7939
  <xsl:template match="text()" mode="contents_item">
7884
- <xsl:call-template name="keep_together_standard_number"/>
7940
+ <xsl:variable name="text">
7941
+ <!-- to split by '_' and other chars -->
7942
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
7943
+ </xsl:variable>
7944
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
7945
+ <xsl:call-template name="keep_together_standard_number"/>
7946
+ </xsl:for-each>
7885
7947
  </xsl:template>
7886
7948
 
7887
7949
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -7892,35 +7954,53 @@
7892
7954
  <!-- =============== -->
7893
7955
  <!-- sourcecode -->
7894
7956
  <!-- =============== -->
7895
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7896
7957
 
7897
- <xsl:variable name="sourcecode_attributes">
7898
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7899
- <xsl:variable name="_font-size">
7958
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7959
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
7960
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
7900
7961
 
7901
- <!-- 9 -->
7962
+ <xsl:template match="*[local-name() = 'property']" mode="css">
7963
+ <xsl:attribute name="{@name}">
7964
+ <xsl:value-of select="@value"/>
7965
+ </xsl:attribute>
7966
+ </xsl:template>
7902
7967
 
7903
- 9
7904
- <!-- <xsl:if test="$namespace = 'ieee'">
7905
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
7906
- </xsl:if> -->
7968
+ <xsl:template name="get_sourcecode_attributes">
7969
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7970
+ <xsl:variable name="_font-size">
7907
7971
 
7908
- </xsl:variable>
7972
+ <!-- inherit -->
7909
7973
 
7910
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7911
- <xsl:if test="$font-size != ''">
7912
- <xsl:attribute name="font-size">
7913
- <xsl:choose>
7914
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7915
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7916
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7917
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7918
- </xsl:choose>
7919
- </xsl:attribute>
7920
- </xsl:if>
7921
- </xsl:element>
7974
+ 9
7975
+ <!-- <xsl:if test="$namespace = 'ieee'">
7976
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7977
+ </xsl:if> -->
7978
+
7979
+ </xsl:variable>
7980
+
7981
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7982
+ <xsl:if test="$font-size != ''">
7983
+ <xsl:attribute name="font-size">
7984
+ <xsl:choose>
7985
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7986
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7987
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7988
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7989
+ </xsl:choose>
7990
+ </xsl:attribute>
7991
+ </xsl:if>
7992
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
7993
+ </xsl:element>
7994
+ </xsl:template>
7995
+
7996
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7997
+
7998
+ <xsl:variable name="sourcecode_attributes">
7999
+ <xsl:call-template name="get_sourcecode_attributes"/>
7922
8000
  </xsl:variable>
7923
8001
 
8002
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
8003
+
7924
8004
  <xsl:choose>
7925
8005
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
7926
8006
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -7963,6 +8043,12 @@
7963
8043
  </xsl:attribute>
7964
8044
  </xsl:for-each>
7965
8045
 
8046
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
8047
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
8048
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8049
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8050
+ </xsl:if>
8051
+
7966
8052
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7967
8053
  </fo:block>
7968
8054
 
@@ -7974,9 +8060,10 @@
7974
8060
  </xsl:choose>
7975
8061
  </xsl:template>
7976
8062
 
7977
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
8063
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
7978
8064
  <xsl:choose>
7979
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
8065
+ <!-- disabled -->
8066
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7980
8067
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
7981
8068
  <xsl:choose>
7982
8069
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -7991,8 +8078,76 @@
7991
8078
  <xsl:call-template name="add_spaces_to_sourcecode"/>
7992
8079
  </xsl:otherwise>
7993
8080
  </xsl:choose>
8081
+ </xsl:template>
8082
+
8083
+ <!-- add sourcecode highlighting -->
8084
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
8085
+ <xsl:variable name="class" select="@class"/>
8086
+ <xsl:choose>
8087
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
8088
+ <fo:inline>
8089
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
8090
+ <xsl:apply-templates/>
8091
+ </fo:inline>
8092
+ </xsl:when>
8093
+ <xsl:otherwise>
8094
+ <xsl:apply-templates/>
8095
+ </xsl:otherwise>
8096
+ </xsl:choose>
8097
+ </xsl:template>
7994
8098
 
8099
+ <!-- outer table with line numbers for sourcecode -->
8100
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
8101
+ <fo:block>
8102
+ <fo:table width="100%" table-layout="fixed">
8103
+ <xsl:copy-of select="@id"/>
8104
+ <fo:table-column column-width="8%"/>
8105
+ <fo:table-column column-width="92%"/>
8106
+ <fo:table-body>
8107
+ <xsl:apply-templates/>
8108
+ </fo:table-body>
8109
+ </fo:table>
8110
+ </fo:block>
8111
+ </xsl:template>
8112
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
8113
+ <xsl:apply-templates/>
8114
+ </xsl:template>
8115
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
8116
+ <fo:table-row>
8117
+ <xsl:apply-templates/>
8118
+ </fo:table-row>
7995
8119
  </xsl:template>
8120
+ <!-- first td with line numbers -->
8121
+ <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'] -->
8122
+ <fo:table-cell>
8123
+ <fo:block>
8124
+
8125
+ <!-- set attibutes for line numbers - same as sourcecode -->
8126
+ <xsl:variable name="sourcecode_attributes">
8127
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
8128
+ <xsl:call-template name="get_sourcecode_attributes"/>
8129
+ </xsl:for-each>
8130
+ </xsl:variable>
8131
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
8132
+ <xsl:attribute name="{local-name()}">
8133
+ <xsl:value-of select="."/>
8134
+ </xsl:attribute>
8135
+ </xsl:for-each>
8136
+
8137
+ <xsl:apply-templates/>
8138
+ </fo:block>
8139
+ </fo:table-cell>
8140
+ </xsl:template>
8141
+
8142
+ <!-- second td with sourcecode -->
8143
+ <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'] -->
8144
+ <fo:table-cell>
8145
+ <fo:block>
8146
+ <xsl:apply-templates/>
8147
+ </fo:block>
8148
+ </fo:table-cell>
8149
+ </xsl:template>
8150
+ <!-- END outer table with line numbers for sourcecode -->
7996
8151
 
7997
8152
  <xsl:template name="add_spaces_to_sourcecode">
7998
8153
  <xsl:variable name="text_step1">
@@ -8223,7 +8378,25 @@
8223
8378
  <xsl:template match="*[local-name()='pre']" name="pre">
8224
8379
  <fo:block xsl:use-attribute-sets="pre-style">
8225
8380
  <xsl:copy-of select="@id"/>
8226
- <xsl:apply-templates/>
8381
+ <xsl:choose>
8382
+
8383
+ <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' -->
8384
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
8385
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8386
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8387
+ </xsl:if>
8388
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
8389
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
8390
+ <mtext><xsl:value-of select="."/></mtext>
8391
+ </math>
8392
+ </fo:instream-foreign-object>
8393
+ </xsl:when>
8394
+
8395
+ <xsl:otherwise>
8396
+ <xsl:apply-templates/>
8397
+ </xsl:otherwise>
8398
+
8399
+ </xsl:choose>
8227
8400
  </fo:block>
8228
8401
  </xsl:template>
8229
8402
  <!-- =============== -->
@@ -9685,17 +9858,17 @@
9685
9858
  <fo:block>
9686
9859
  <fo:inline>
9687
9860
 
9688
- <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
9689
- <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
9690
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
9691
- </xsl:if>
9692
-
9861
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9862
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
9863
+ </xsl:apply-templates>
9693
9864
  </fo:inline>
9694
9865
  </fo:block>
9695
9866
  </fo:list-item-label>
9696
9867
  <fo:list-item-body start-indent="body-start()">
9697
9868
  <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style">
9698
- <xsl:call-template name="processBibitem"/>
9869
+ <xsl:call-template name="processBibitem">
9870
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
9871
+ </xsl:call-template>
9699
9872
  </fo:block>
9700
9873
  </fo:list-item-body>
9701
9874
  </fo:list-item>
@@ -9704,168 +9877,56 @@
9704
9877
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
9705
9878
 
9706
9879
  <xsl:template name="processBibitem">
9880
+ <xsl:param name="biblio_tag_part">both</xsl:param>
9707
9881
 
9708
- <!-- start JCGM bibitem processing -->
9709
- <xsl:variable name="docidentifier">
9710
- <xsl:choose>
9711
- <xsl:when test="*[local-name()='docidentifier']/@type = 'metanorma'"/>
9712
- <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier'][not(@type = 'metanorma-ordinal') and not(@type = 'BIPM')]"/></xsl:otherwise>
9713
- </xsl:choose>
9714
- </xsl:variable>
9715
- <xsl:value-of select="$docidentifier"/>
9882
+ <!-- start bibitem processing -->
9883
+ <xsl:if test=".//*[local-name() = 'fn']">
9884
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
9885
+ </xsl:if>
9716
9886
 
9717
- <xsl:if test="*[local-name()='formattedref'] and normalize-space($docidentifier) != ''">, </xsl:if>
9718
- <xsl:apply-templates select="*[local-name()='formattedref']"/>
9887
+ <!-- move opening ace-tag before number -->
9888
+ <xsl:apply-templates select="*[local-name() = 'formattedref']/node()[1][local-name() = 'add' and contains(., '_start')]">
9889
+ <xsl:with-param name="skip">false</xsl:with-param>
9890
+ </xsl:apply-templates>
9719
9891
 
9720
- <!-- end JCGM bibitem processing -->
9892
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9893
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
9894
+ </xsl:apply-templates>
9895
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
9896
+ <!-- end bibitem processing -->
9721
9897
 
9722
9898
  </xsl:template> <!-- processBibitem (bibitem) -->
9723
9899
 
9724
- <xsl:template name="processBibitemDocId">
9725
- <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')]"/>
9726
- <xsl:choose>
9727
- <xsl:when test="normalize-space($_doc_ident) != ''">
9728
- <!-- <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"/>
9729
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
9730
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9731
- </xsl:if> -->
9732
- <xsl:value-of select="$_doc_ident"/>
9733
- </xsl:when>
9734
- <xsl:otherwise>
9735
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
9736
- <xsl:if test="$type != ''">
9737
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9738
- </xsl:if> -->
9739
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
9740
- </xsl:otherwise>
9741
- </xsl:choose>
9742
- </xsl:template> <!-- processBibitemDocId -->
9900
+ <xsl:template match="*[local-name() = 'title']" mode="title">
9901
+ <fo:inline><xsl:apply-templates/></fo:inline>
9902
+ </xsl:template>
9903
+
9904
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
9905
+
9906
+ <xsl:template match="*[local-name() = 'formattedref']">
9907
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
9908
+ <xsl:text>, </xsl:text>
9909
+ </xsl:if> -->
9910
+ <xsl:apply-templates/>
9911
+ </xsl:template>
9743
9912
 
9744
- <xsl:template name="processPersonalAuthor">
9913
+ <xsl:template match="*[local-name() = 'biblio-tag']">
9914
+ <xsl:param name="biblio_tag_part">both</xsl:param>
9745
9915
  <xsl:choose>
9746
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
9747
- <author>
9748
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
9749
- </author>
9750
- </xsl:when>
9751
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
9752
- <author>
9753
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
9754
- <xsl:text> </xsl:text>
9755
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
9756
- </author>
9916
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
9917
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9757
9918
  </xsl:when>
9758
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
9759
- <author>
9760
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
9761
- <xsl:text> </xsl:text>
9762
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
9763
- </author>
9919
+ <xsl:when test="$biblio_tag_part = 'last'">
9920
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
9764
9921
  </xsl:when>
9765
9922
  <xsl:otherwise>
9766
9923
  <xsl:apply-templates/>
9767
9924
  </xsl:otherwise>
9768
9925
  </xsl:choose>
9769
- </xsl:template> <!-- processPersonalAuthor -->
9770
-
9771
- <xsl:template name="renderDate">
9772
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
9773
- <xsl:value-of select="*[local-name() = 'on']"/>
9774
- </xsl:if>
9775
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
9776
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
9777
- </xsl:if>
9778
- </xsl:template>
9779
-
9780
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
9781
- <xsl:value-of select="translate(.,'. ','')"/>
9782
- </xsl:template>
9783
-
9784
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
9785
- <xsl:value-of select="substring(.,1,1)"/>
9786
- </xsl:template>
9787
-
9788
- <xsl:template match="*[local-name() = 'title']" mode="title">
9789
- <fo:inline><xsl:apply-templates/></fo:inline>
9790
- </xsl:template>
9791
-
9792
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
9793
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
9794
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
9795
- <xsl:apply-templates/>
9796
- </fo:inline>
9797
- </xsl:template>
9798
-
9799
- <!-- bibitem/note renders as footnote -->
9800
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
9801
-
9802
- <!-- list of footnotes to calculate actual footnotes number -->
9803
- <xsl:variable name="p_fn_">
9804
- <xsl:call-template name="get_fn_list"/>
9805
- </xsl:variable>
9806
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9807
- <xsl:variable name="gen_id" select="generate-id(.)"/>
9808
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9809
- <!-- fn sequence number in document -->
9810
- <xsl:variable name="current_fn_number">
9811
- <xsl:choose>
9812
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
9813
- <xsl:otherwise>
9814
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
9815
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
9816
- </xsl:otherwise>
9817
- </xsl:choose>
9818
- </xsl:variable>
9819
- <fo:footnote>
9820
- <xsl:variable name="number">
9821
-
9822
- <xsl:value-of select="$current_fn_number"/>
9823
-
9824
- </xsl:variable>
9825
-
9826
- <xsl:variable name="current_fn_number_text">
9827
- <xsl:value-of select="$number"/>
9828
-
9829
- <xsl:text>)</xsl:text>
9830
-
9831
- </xsl:variable>
9832
-
9833
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
9834
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
9835
- <xsl:value-of select="$current_fn_number_text"/>
9836
- </fo:basic-link>
9837
- </fo:inline>
9838
- <fo:footnote-body>
9839
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
9840
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
9841
- <xsl:value-of select="$current_fn_number_text"/>
9842
- </fo:inline>
9843
- <xsl:apply-templates/>
9844
- </fo:block>
9845
- </fo:footnote-body>
9846
- </fo:footnote>
9847
- </xsl:template>
9848
-
9849
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
9850
- <xsl:text> edition </xsl:text>
9851
- <xsl:value-of select="."/>
9852
- </xsl:template>
9853
-
9854
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
9855
- <xsl:text> (</xsl:text>
9856
- <fo:inline xsl:use-attribute-sets="link-style">
9857
- <fo:basic-link external-destination="." fox:alt-text=".">
9858
- <xsl:value-of select="."/>
9859
- </fo:basic-link>
9860
- </fo:inline>
9861
- <xsl:text>)</xsl:text>
9862
9926
  </xsl:template>
9863
9927
 
9864
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
9865
-
9866
- <xsl:template match="*[local-name() = 'formattedref']">
9867
-
9868
- <xsl:apply-templates/>
9928
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
9929
+ <xsl:text> </xsl:text>
9869
9930
  </xsl:template>
9870
9931
 
9871
9932
  <!-- ======================= -->
@@ -10299,6 +10360,12 @@
10299
10360
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
10300
10361
  <xsl:apply-templates mode="update_xml_step1"/>
10301
10362
  </xsl:template>
10363
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
10364
+ <xsl:copy>
10365
+ <xsl:copy-of select="@*"/>
10366
+ <xsl:apply-templates mode="update_xml_step1"/>
10367
+ </xsl:copy>
10368
+ </xsl:template>
10302
10369
  <!-- =========================================================================== -->
10303
10370
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10304
10371
  <!-- =========================================================================== -->
@@ -10776,6 +10843,10 @@
10776
10843
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
10777
10844
  </xsl:template>
10778
10845
 
10846
+ <xsl:template name="getDocumentId_fromCurrentNode">
10847
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
10848
+ </xsl:template>
10849
+
10779
10850
  <xsl:template name="namespaceCheck">
10780
10851
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
10781
10852
  <xsl:variable name="XSLNS">
@@ -208,6 +208,24 @@ module IsoDoc
208
208
  elem.children = l10n("[#{@i18n.source} #{to_xml(elem.children).strip}]")
209
209
  end
210
210
 
211
+ def norm_ref_entry_code(_ordinal, identifiers, _ids, _standard, datefn)
212
+ ret = (identifiers[0] || identifiers[1])
213
+ ret += " #{identifiers[1]}" if identifiers[0] && identifiers[1]
214
+ "#{ret}#{datefn} "
215
+ end
216
+
217
+ def biblio_ref_entry_code(ordinal, ids, _id, standard, datefn)
218
+ standard and id = nil
219
+ ret = (ids[:ordinal] || ids[:metanorma] || "[#{ordinal}]")
220
+ if ids[:sdo]
221
+ ret = prefix_bracketed_ref(ret)
222
+ ret += "#{ids[:sdo]}#{datefn} "
223
+ else
224
+ ret = prefix_bracketed_ref("#{ret}#{datefn}")
225
+ end
226
+ ret
227
+ end
228
+
211
229
  include Init
212
230
  end
213
231
  end