metanorma-bipm 2.1.13 → 2.2.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.
@@ -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>
@@ -4369,7 +4379,26 @@
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>
4398
+
4399
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
4400
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4401
+ </xsl:if>
4373
4402
 
4374
4403
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4375
4404
  <xsl:value-of select="$current_fn_number_text"/>
@@ -4429,7 +4458,10 @@
4429
4458
  </xsl:for-each>
4430
4459
  <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']/*">
4431
4460
  <xsl:sort select="@displayorder" data-type="number"/>
4432
- <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])]">
4461
+ <!-- commented:
4462
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
4463
+ because 'fn' there is in biblio-tag -->
4464
+ <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])]">
4433
4465
  <!-- copy unique fn -->
4434
4466
  <fn gen_id="{generate-id(.)}">
4435
4467
  <xsl:copy-of select="@*"/>
@@ -5297,7 +5329,7 @@
5297
5329
 
5298
5330
  <xsl:variable name="_font-size">
5299
5331
 
5300
- <!-- 10 -->
5332
+ <!-- inherit -->
5301
5333
 
5302
5334
  10
5303
5335
 
@@ -5541,6 +5573,23 @@
5541
5573
  <xsl:apply-templates/>
5542
5574
  </xsl:template>
5543
5575
 
5576
+ <!-- Don't break standard's numbers -->
5577
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
5578
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
5579
+ <xsl:choose>
5580
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
5581
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
5582
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
5583
+ </xsl:when>
5584
+ <xsl:otherwise>
5585
+ <xsl:apply-templates/>
5586
+ </xsl:otherwise>
5587
+ </xsl:choose>
5588
+ </xsl:template>
5589
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
5590
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5591
+ </xsl:template>
5592
+
5544
5593
  <!-- ========================= -->
5545
5594
  <!-- END Rich text formatting -->
5546
5595
  <!-- ========================= -->
@@ -5936,7 +5985,7 @@
5936
5985
  <xsl:choose>
5937
5986
  <xsl:when test="@colspan">
5938
5987
  <xsl:variable name="td">
5939
- <xsl:element name="td">
5988
+ <xsl:element name="{local-name()}">
5940
5989
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
5941
5990
  <xsl:if test="local-name()='th'">
5942
5991
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -5951,7 +6000,7 @@
5951
6000
  </xsl:call-template>
5952
6001
  </xsl:when>
5953
6002
  <xsl:otherwise>
5954
- <xsl:element name="td">
6003
+ <xsl:element name="{local-name()}">
5955
6004
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
5956
6005
  <xsl:if test="local-name()='th'">
5957
6006
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -6018,7 +6067,7 @@
6018
6067
  <xsl:variable name="currentRow" select="."/>
6019
6068
 
6020
6069
  <xsl:variable name="normalizedTDs">
6021
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
6070
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
6022
6071
  <xsl:choose>
6023
6072
  <xsl:when test="@rowspan &gt; 1">
6024
6073
  <xsl:copy>
@@ -6030,7 +6079,7 @@
6030
6079
  </xsl:copy>
6031
6080
  </xsl:when>
6032
6081
  <xsl:otherwise>
6033
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
6082
+ <xsl:copy-of select="$currentRow/*[self::td or self::th][1 + count(current()/preceding-sibling::*[self::td or self::th][not(@rowspan) or (@rowspan = 1)])]"/>
6034
6083
  </xsl:otherwise>
6035
6084
  </xsl:choose>
6036
6085
  </xsl:for-each>
@@ -6251,6 +6300,33 @@
6251
6300
  </xsl:choose>
6252
6301
  </xsl:template>
6253
6302
 
6303
+ <xsl:template name="getLang_fromCurrentNode">
6304
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6305
+ <xsl:variable name="language">
6306
+ <xsl:choose>
6307
+ <xsl:when test="$language_current != ''">
6308
+ <xsl:value-of select="$language_current"/>
6309
+ </xsl:when>
6310
+ <xsl:otherwise>
6311
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6312
+ <xsl:choose>
6313
+ <xsl:when test="$language_current_2 != ''">
6314
+ <xsl:value-of select="$language_current_2"/>
6315
+ </xsl:when>
6316
+ <xsl:otherwise>
6317
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
6318
+ </xsl:otherwise>
6319
+ </xsl:choose>
6320
+ </xsl:otherwise>
6321
+ </xsl:choose>
6322
+ </xsl:variable>
6323
+
6324
+ <xsl:choose>
6325
+ <xsl:when test="$language = 'English'">en</xsl:when>
6326
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
6327
+ </xsl:choose>
6328
+ </xsl:template>
6329
+
6254
6330
  <xsl:template name="capitalizeWords">
6255
6331
  <xsl:param name="str"/>
6256
6332
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -6707,12 +6783,6 @@
6707
6783
 
6708
6784
  <fo:block-container margin-left="0mm">
6709
6785
 
6710
- <!-- <xsl:if test="$namespace = 'iho'">
6711
- <xsl:if test="ancestor::iho:td">
6712
- <xsl:attribute name="font-size">12pt</xsl:attribute>
6713
- </xsl:if>
6714
- </xsl:if> -->
6715
-
6716
6786
  <fo:block>
6717
6787
 
6718
6788
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -6880,7 +6950,7 @@
6880
6950
  <xsl:template match="*[local-name() = 'figure']" name="figure">
6881
6951
  <xsl:variable name="isAdded" select="@added"/>
6882
6952
  <xsl:variable name="isDeleted" select="@deleted"/>
6883
- <fo:block-container id="{@id}">
6953
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6884
6954
 
6885
6955
  <xsl:call-template name="setTrackChangesStyles">
6886
6956
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -7216,6 +7286,31 @@
7216
7286
  <xsl:apply-templates mode="svg_update"/>
7217
7287
  </xsl:copy>
7218
7288
  </xsl:template>
7289
+
7290
+ <!-- regex for 'display: inline-block;' -->
7291
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7292
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
7293
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
7294
+ </xsl:template>
7295
+
7296
+ <!-- replace
7297
+ stroke="rgba(r, g, b, alpha)" to
7298
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
7299
+ fill="rgba(r, g, b, alpha)" to
7300
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
7301
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
7302
+ <xsl:variable name="components_">
7303
+ <xsl:call-template name="split">
7304
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
7305
+ <xsl:with-param name="sep" select="','"/>
7306
+ </xsl:call-template>
7307
+ </xsl:variable>
7308
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
7309
+ <xsl:variable name="att_name" select="local-name()"/>
7310
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
7311
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
7312
+ </xsl:template>
7313
+
7219
7314
  <!-- ============== -->
7220
7315
  <!-- END: svg_update -->
7221
7316
  <!-- ============== -->
@@ -7841,7 +7936,13 @@
7841
7936
  </xsl:template>
7842
7937
 
7843
7938
  <xsl:template match="text()" mode="contents_item">
7844
- <xsl:call-template name="keep_together_standard_number"/>
7939
+ <xsl:variable name="text">
7940
+ <!-- to split by '_' and other chars -->
7941
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
7942
+ </xsl:variable>
7943
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
7944
+ <xsl:call-template name="keep_together_standard_number"/>
7945
+ </xsl:for-each>
7845
7946
  </xsl:template>
7846
7947
 
7847
7948
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -7852,35 +7953,53 @@
7852
7953
  <!-- =============== -->
7853
7954
  <!-- sourcecode -->
7854
7955
  <!-- =============== -->
7855
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7856
7956
 
7857
- <xsl:variable name="sourcecode_attributes">
7858
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7859
- <xsl:variable name="_font-size">
7957
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7958
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
7959
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
7860
7960
 
7861
- <!-- 9 -->
7961
+ <xsl:template match="*[local-name() = 'property']" mode="css">
7962
+ <xsl:attribute name="{@name}">
7963
+ <xsl:value-of select="@value"/>
7964
+ </xsl:attribute>
7965
+ </xsl:template>
7862
7966
 
7863
- 9
7864
- <!-- <xsl:if test="$namespace = 'ieee'">
7865
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
7866
- </xsl:if> -->
7967
+ <xsl:template name="get_sourcecode_attributes">
7968
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7969
+ <xsl:variable name="_font-size">
7867
7970
 
7868
- </xsl:variable>
7971
+ <!-- inherit -->
7869
7972
 
7870
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7871
- <xsl:if test="$font-size != ''">
7872
- <xsl:attribute name="font-size">
7873
- <xsl:choose>
7874
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7875
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7876
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7877
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7878
- </xsl:choose>
7879
- </xsl:attribute>
7880
- </xsl:if>
7881
- </xsl:element>
7973
+ 9
7974
+ <!-- <xsl:if test="$namespace = 'ieee'">
7975
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7976
+ </xsl:if> -->
7977
+
7978
+ </xsl:variable>
7979
+
7980
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7981
+ <xsl:if test="$font-size != ''">
7982
+ <xsl:attribute name="font-size">
7983
+ <xsl:choose>
7984
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7985
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7986
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7987
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7988
+ </xsl:choose>
7989
+ </xsl:attribute>
7990
+ </xsl:if>
7991
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
7992
+ </xsl:element>
7993
+ </xsl:template>
7994
+
7995
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7996
+
7997
+ <xsl:variable name="sourcecode_attributes">
7998
+ <xsl:call-template name="get_sourcecode_attributes"/>
7882
7999
  </xsl:variable>
7883
8000
 
8001
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
8002
+
7884
8003
  <xsl:choose>
7885
8004
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
7886
8005
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -7934,9 +8053,10 @@
7934
8053
  </xsl:choose>
7935
8054
  </xsl:template>
7936
8055
 
7937
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
8056
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
7938
8057
  <xsl:choose>
7939
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
8058
+ <!-- disabled -->
8059
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7940
8060
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
7941
8061
  <xsl:choose>
7942
8062
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -7951,9 +8071,76 @@
7951
8071
  <xsl:call-template name="add_spaces_to_sourcecode"/>
7952
8072
  </xsl:otherwise>
7953
8073
  </xsl:choose>
8074
+ </xsl:template>
7954
8075
 
8076
+ <!-- add sourcecode highlighting -->
8077
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
8078
+ <xsl:variable name="class" select="@class"/>
8079
+ <xsl:choose>
8080
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
8081
+ <fo:inline>
8082
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
8083
+ <xsl:apply-templates/>
8084
+ </fo:inline>
8085
+ </xsl:when>
8086
+ <xsl:otherwise>
8087
+ <xsl:apply-templates/>
8088
+ </xsl:otherwise>
8089
+ </xsl:choose>
7955
8090
  </xsl:template>
7956
8091
 
8092
+ <!-- outer table with line numbers for sourcecode -->
8093
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
8094
+ <fo:block>
8095
+ <fo:table width="100%" table-layout="fixed">
8096
+ <xsl:copy-of select="@id"/>
8097
+ <fo:table-column column-width="8%"/>
8098
+ <fo:table-column column-width="92%"/>
8099
+ <fo:table-body>
8100
+ <xsl:apply-templates/>
8101
+ </fo:table-body>
8102
+ </fo:table>
8103
+ </fo:block>
8104
+ </xsl:template>
8105
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
8106
+ <xsl:apply-templates/>
8107
+ </xsl:template>
8108
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
8109
+ <fo:table-row>
8110
+ <xsl:apply-templates/>
8111
+ </fo:table-row>
8112
+ </xsl:template>
8113
+ <!-- first td with line numbers -->
8114
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
8115
+ <fo:table-cell>
8116
+ <fo:block>
8117
+
8118
+ <!-- set attibutes for line numbers - same as sourcecode -->
8119
+ <xsl:variable name="sourcecode_attributes">
8120
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
8121
+ <xsl:call-template name="get_sourcecode_attributes"/>
8122
+ </xsl:for-each>
8123
+ </xsl:variable>
8124
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
8125
+ <xsl:attribute name="{local-name()}">
8126
+ <xsl:value-of select="."/>
8127
+ </xsl:attribute>
8128
+ </xsl:for-each>
8129
+
8130
+ <xsl:apply-templates/>
8131
+ </fo:block>
8132
+ </fo:table-cell>
8133
+ </xsl:template>
8134
+ <!-- second td with sourcecode -->
8135
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
8136
+ <fo:table-cell>
8137
+ <fo:block>
8138
+ <xsl:apply-templates/>
8139
+ </fo:block>
8140
+ </fo:table-cell>
8141
+ </xsl:template>
8142
+ <!-- END outer table with line numbers for sourcecode -->
8143
+
7957
8144
  <xsl:template name="add_spaces_to_sourcecode">
7958
8145
  <xsl:variable name="text_step1">
7959
8146
  <xsl:call-template name="add-zero-spaces-equal"/>
@@ -9645,17 +9832,17 @@
9645
9832
  <fo:block>
9646
9833
  <fo:inline>
9647
9834
 
9648
- <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
9649
- <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
9650
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
9651
- </xsl:if>
9652
-
9835
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9836
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
9837
+ </xsl:apply-templates>
9653
9838
  </fo:inline>
9654
9839
  </fo:block>
9655
9840
  </fo:list-item-label>
9656
9841
  <fo:list-item-body start-indent="body-start()">
9657
9842
  <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style">
9658
- <xsl:call-template name="processBibitem"/>
9843
+ <xsl:call-template name="processBibitem">
9844
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
9845
+ </xsl:call-template>
9659
9846
  </fo:block>
9660
9847
  </fo:list-item-body>
9661
9848
  </fo:list-item>
@@ -9664,168 +9851,56 @@
9664
9851
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
9665
9852
 
9666
9853
  <xsl:template name="processBibitem">
9854
+ <xsl:param name="biblio_tag_part">both</xsl:param>
9667
9855
 
9668
- <!-- start JCGM bibitem processing -->
9669
- <xsl:variable name="docidentifier">
9670
- <xsl:choose>
9671
- <xsl:when test="*[local-name()='docidentifier']/@type = 'metanorma'"/>
9672
- <xsl:otherwise><xsl:value-of select="*[local-name()='docidentifier'][not(@type = 'metanorma-ordinal') and not(@type = 'BIPM')]"/></xsl:otherwise>
9673
- </xsl:choose>
9674
- </xsl:variable>
9675
- <xsl:value-of select="$docidentifier"/>
9856
+ <!-- start bibitem processing -->
9857
+ <xsl:if test=".//*[local-name() = 'fn']">
9858
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
9859
+ </xsl:if>
9676
9860
 
9677
- <xsl:if test="*[local-name()='formattedref'] and normalize-space($docidentifier) != ''">, </xsl:if>
9678
- <xsl:apply-templates select="*[local-name()='formattedref']"/>
9861
+ <!-- move opening ace-tag before number -->
9862
+ <xsl:apply-templates select="*[local-name() = 'formattedref']/node()[1][local-name() = 'add' and contains(., '_start')]">
9863
+ <xsl:with-param name="skip">false</xsl:with-param>
9864
+ </xsl:apply-templates>
9679
9865
 
9680
- <!-- end JCGM bibitem processing -->
9866
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9867
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
9868
+ </xsl:apply-templates>
9869
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
9870
+ <!-- end bibitem processing -->
9681
9871
 
9682
9872
  </xsl:template> <!-- processBibitem (bibitem) -->
9683
9873
 
9684
- <xsl:template name="processBibitemDocId">
9685
- <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')]"/>
9686
- <xsl:choose>
9687
- <xsl:when test="normalize-space($_doc_ident) != ''">
9688
- <!-- <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"/>
9689
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
9690
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9691
- </xsl:if> -->
9692
- <xsl:value-of select="$_doc_ident"/>
9693
- </xsl:when>
9694
- <xsl:otherwise>
9695
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
9696
- <xsl:if test="$type != ''">
9697
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9698
- </xsl:if> -->
9699
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
9700
- </xsl:otherwise>
9701
- </xsl:choose>
9702
- </xsl:template> <!-- processBibitemDocId -->
9874
+ <xsl:template match="*[local-name() = 'title']" mode="title">
9875
+ <fo:inline><xsl:apply-templates/></fo:inline>
9876
+ </xsl:template>
9877
+
9878
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
9879
+
9880
+ <xsl:template match="*[local-name() = 'formattedref']">
9881
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
9882
+ <xsl:text>, </xsl:text>
9883
+ </xsl:if> -->
9884
+ <xsl:apply-templates/>
9885
+ </xsl:template>
9703
9886
 
9704
- <xsl:template name="processPersonalAuthor">
9887
+ <xsl:template match="*[local-name() = 'biblio-tag']">
9888
+ <xsl:param name="biblio_tag_part">both</xsl:param>
9705
9889
  <xsl:choose>
9706
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
9707
- <author>
9708
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
9709
- </author>
9890
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
9891
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9710
9892
  </xsl:when>
9711
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
9712
- <author>
9713
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
9714
- <xsl:text> </xsl:text>
9715
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
9716
- </author>
9717
- </xsl:when>
9718
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
9719
- <author>
9720
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
9721
- <xsl:text> </xsl:text>
9722
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
9723
- </author>
9893
+ <xsl:when test="$biblio_tag_part = 'last'">
9894
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
9724
9895
  </xsl:when>
9725
9896
  <xsl:otherwise>
9726
9897
  <xsl:apply-templates/>
9727
9898
  </xsl:otherwise>
9728
9899
  </xsl:choose>
9729
- </xsl:template> <!-- processPersonalAuthor -->
9730
-
9731
- <xsl:template name="renderDate">
9732
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
9733
- <xsl:value-of select="*[local-name() = 'on']"/>
9734
- </xsl:if>
9735
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
9736
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
9737
- </xsl:if>
9738
- </xsl:template>
9739
-
9740
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
9741
- <xsl:value-of select="translate(.,'. ','')"/>
9742
- </xsl:template>
9743
-
9744
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
9745
- <xsl:value-of select="substring(.,1,1)"/>
9746
- </xsl:template>
9747
-
9748
- <xsl:template match="*[local-name() = 'title']" mode="title">
9749
- <fo:inline><xsl:apply-templates/></fo:inline>
9750
- </xsl:template>
9751
-
9752
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
9753
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
9754
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
9755
- <xsl:apply-templates/>
9756
- </fo:inline>
9757
9900
  </xsl:template>
9758
9901
 
9759
- <!-- bibitem/note renders as footnote -->
9760
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
9761
-
9762
- <!-- list of footnotes to calculate actual footnotes number -->
9763
- <xsl:variable name="p_fn_">
9764
- <xsl:call-template name="get_fn_list"/>
9765
- </xsl:variable>
9766
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9767
- <xsl:variable name="gen_id" select="generate-id(.)"/>
9768
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9769
- <!-- fn sequence number in document -->
9770
- <xsl:variable name="current_fn_number">
9771
- <xsl:choose>
9772
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
9773
- <xsl:otherwise>
9774
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
9775
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
9776
- </xsl:otherwise>
9777
- </xsl:choose>
9778
- </xsl:variable>
9779
- <fo:footnote>
9780
- <xsl:variable name="number">
9781
-
9782
- <xsl:value-of select="$current_fn_number"/>
9783
-
9784
- </xsl:variable>
9785
-
9786
- <xsl:variable name="current_fn_number_text">
9787
- <xsl:value-of select="$number"/>
9788
-
9789
- <xsl:text>)</xsl:text>
9790
-
9791
- </xsl:variable>
9792
-
9793
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
9794
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
9795
- <xsl:value-of select="$current_fn_number_text"/>
9796
- </fo:basic-link>
9797
- </fo:inline>
9798
- <fo:footnote-body>
9799
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
9800
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
9801
- <xsl:value-of select="$current_fn_number_text"/>
9802
- </fo:inline>
9803
- <xsl:apply-templates/>
9804
- </fo:block>
9805
- </fo:footnote-body>
9806
- </fo:footnote>
9807
- </xsl:template>
9808
-
9809
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
9810
- <xsl:text> edition </xsl:text>
9811
- <xsl:value-of select="."/>
9812
- </xsl:template>
9813
-
9814
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
9815
- <xsl:text> (</xsl:text>
9816
- <fo:inline xsl:use-attribute-sets="link-style">
9817
- <fo:basic-link external-destination="." fox:alt-text=".">
9818
- <xsl:value-of select="."/>
9819
- </fo:basic-link>
9820
- </fo:inline>
9821
- <xsl:text>)</xsl:text>
9822
- </xsl:template>
9823
-
9824
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
9825
-
9826
- <xsl:template match="*[local-name() = 'formattedref']">
9827
-
9828
- <xsl:apply-templates/>
9902
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
9903
+ <xsl:text> </xsl:text>
9829
9904
  </xsl:template>
9830
9905
 
9831
9906
  <!-- ======================= -->
@@ -10163,7 +10238,9 @@
10163
10238
  <!-- Update xml -->
10164
10239
  <!-- ===================================== -->
10165
10240
  <!-- =========================================================================== -->
10166
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10241
+ <!-- STEP1: -->
10242
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
10243
+ <!-- - Ignore 'span' without style -->
10167
10244
  <!-- =========================================================================== -->
10168
10245
  <xsl:template match="@*|node()" mode="update_xml_step1">
10169
10246
  <xsl:copy>
@@ -10246,7 +10323,8 @@
10246
10323
  </xsl:copy>
10247
10324
  </xsl:template>
10248
10325
 
10249
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
10326
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
10327
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
10250
10328
  <xsl:copy>
10251
10329
  <xsl:copy-of select="@*"/>
10252
10330
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -10256,6 +10334,12 @@
10256
10334
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
10257
10335
  <xsl:apply-templates mode="update_xml_step1"/>
10258
10336
  </xsl:template>
10337
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
10338
+ <xsl:copy>
10339
+ <xsl:copy-of select="@*"/>
10340
+ <xsl:apply-templates mode="update_xml_step1"/>
10341
+ </xsl:copy>
10342
+ </xsl:template>
10259
10343
  <!-- =========================================================================== -->
10260
10344
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10261
10345
  <!-- =========================================================================== -->
@@ -10733,6 +10817,10 @@
10733
10817
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
10734
10818
  </xsl:template>
10735
10819
 
10820
+ <xsl:template name="getDocumentId_fromCurrentNode">
10821
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
10822
+ </xsl:template>
10823
+
10736
10824
  <xsl:template name="namespaceCheck">
10737
10825
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
10738
10826
  <xsl:variable name="XSLNS">