metanorma-un 0.9.13 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1584,6 +1584,12 @@
1584
1584
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1585
1585
  </xsl:attribute-set>
1586
1586
 
1587
+ <xsl:attribute-set name="figure-block-style">
1588
+
1589
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1590
+
1591
+ </xsl:attribute-set>
1592
+
1587
1593
  <xsl:attribute-set name="figure-style">
1588
1594
 
1589
1595
  </xsl:attribute-set>
@@ -1592,7 +1598,7 @@
1592
1598
 
1593
1599
  <xsl:attribute name="text-align">center</xsl:attribute>
1594
1600
  <xsl:attribute name="font-size">9pt</xsl:attribute>
1595
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1601
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1596
1602
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1597
1603
  <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
1598
1604
 
@@ -3004,6 +3010,10 @@
3004
3010
  <xsl:with-param name="continued">true</xsl:with-param>
3005
3011
  </xsl:apply-templates>
3006
3012
 
3013
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
3014
+ <fo:block/>
3015
+ </xsl:if>
3016
+
3007
3017
  </fo:table-cell>
3008
3018
  </fo:table-row>
3009
3019
  </xsl:template> <!-- table-header-title -->
@@ -3412,7 +3422,26 @@
3412
3422
 
3413
3423
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3414
3424
  <xsl:variable name="footnote_inline">
3415
- <fo:inline xsl:use-attribute-sets="fn-num-style">
3425
+ <fo:inline>
3426
+
3427
+ <xsl:variable name="fn_styles">
3428
+ <xsl:choose>
3429
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
3430
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
3431
+ </xsl:when>
3432
+ <xsl:otherwise>
3433
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
3434
+ </xsl:otherwise>
3435
+ </xsl:choose>
3436
+ </xsl:variable>
3437
+
3438
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
3439
+ <xsl:copy-of select="."/>
3440
+ </xsl:for-each>
3441
+
3442
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3443
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3444
+ </xsl:if>
3416
3445
 
3417
3446
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3418
3447
  <xsl:value-of select="$current_fn_number_text"/>
@@ -3472,7 +3501,10 @@
3472
3501
  </xsl:for-each>
3473
3502
  <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']/*">
3474
3503
  <xsl:sort select="@displayorder" data-type="number"/>
3475
- <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])]">
3504
+ <!-- commented:
3505
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3506
+ because 'fn' there is in biblio-tag -->
3507
+ <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])]">
3476
3508
  <!-- copy unique fn -->
3477
3509
  <fn gen_id="{generate-id(.)}">
3478
3510
  <xsl:copy-of select="@*"/>
@@ -4321,7 +4353,7 @@
4321
4353
 
4322
4354
  <xsl:variable name="_font-size">
4323
4355
 
4324
- <!-- 10 -->
4356
+ <!-- inherit -->
4325
4357
 
4326
4358
  </xsl:variable>
4327
4359
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4562,6 +4594,23 @@
4562
4594
  <xsl:apply-templates/>
4563
4595
  </xsl:template>
4564
4596
 
4597
+ <!-- Don't break standard's numbers -->
4598
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
4599
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
4600
+ <xsl:choose>
4601
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
4602
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
4603
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
4604
+ </xsl:when>
4605
+ <xsl:otherwise>
4606
+ <xsl:apply-templates/>
4607
+ </xsl:otherwise>
4608
+ </xsl:choose>
4609
+ </xsl:template>
4610
+ <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">
4611
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
4612
+ </xsl:template>
4613
+
4565
4614
  <!-- ========================= -->
4566
4615
  <!-- END Rich text formatting -->
4567
4616
  <!-- ========================= -->
@@ -4957,7 +5006,7 @@
4957
5006
  <xsl:choose>
4958
5007
  <xsl:when test="@colspan">
4959
5008
  <xsl:variable name="td">
4960
- <xsl:element name="td">
5009
+ <xsl:element name="{local-name()}">
4961
5010
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4962
5011
  <xsl:if test="local-name()='th'">
4963
5012
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4972,7 +5021,7 @@
4972
5021
  </xsl:call-template>
4973
5022
  </xsl:when>
4974
5023
  <xsl:otherwise>
4975
- <xsl:element name="td">
5024
+ <xsl:element name="{local-name()}">
4976
5025
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4977
5026
  <xsl:if test="local-name()='th'">
4978
5027
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -5039,7 +5088,7 @@
5039
5088
  <xsl:variable name="currentRow" select="."/>
5040
5089
 
5041
5090
  <xsl:variable name="normalizedTDs">
5042
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
5091
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
5043
5092
  <xsl:choose>
5044
5093
  <xsl:when test="@rowspan &gt; 1">
5045
5094
  <xsl:copy>
@@ -5051,7 +5100,7 @@
5051
5100
  </xsl:copy>
5052
5101
  </xsl:when>
5053
5102
  <xsl:otherwise>
5054
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
5103
+ <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)])]"/>
5055
5104
  </xsl:otherwise>
5056
5105
  </xsl:choose>
5057
5106
  </xsl:for-each>
@@ -5272,6 +5321,33 @@
5272
5321
  </xsl:choose>
5273
5322
  </xsl:template>
5274
5323
 
5324
+ <xsl:template name="getLang_fromCurrentNode">
5325
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5326
+ <xsl:variable name="language">
5327
+ <xsl:choose>
5328
+ <xsl:when test="$language_current != ''">
5329
+ <xsl:value-of select="$language_current"/>
5330
+ </xsl:when>
5331
+ <xsl:otherwise>
5332
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5333
+ <xsl:choose>
5334
+ <xsl:when test="$language_current_2 != ''">
5335
+ <xsl:value-of select="$language_current_2"/>
5336
+ </xsl:when>
5337
+ <xsl:otherwise>
5338
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5339
+ </xsl:otherwise>
5340
+ </xsl:choose>
5341
+ </xsl:otherwise>
5342
+ </xsl:choose>
5343
+ </xsl:variable>
5344
+
5345
+ <xsl:choose>
5346
+ <xsl:when test="$language = 'English'">en</xsl:when>
5347
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5348
+ </xsl:choose>
5349
+ </xsl:template>
5350
+
5275
5351
  <xsl:template name="capitalizeWords">
5276
5352
  <xsl:param name="str"/>
5277
5353
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -5730,12 +5806,6 @@
5730
5806
 
5731
5807
  <fo:block-container margin-left="0mm">
5732
5808
 
5733
- <!-- <xsl:if test="$namespace = 'iho'">
5734
- <xsl:if test="ancestor::iho:td">
5735
- <xsl:attribute name="font-size">12pt</xsl:attribute>
5736
- </xsl:if>
5737
- </xsl:if> -->
5738
-
5739
5809
  <fo:block>
5740
5810
 
5741
5811
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -5914,7 +5984,7 @@
5914
5984
  <xsl:template match="*[local-name() = 'figure']" name="figure">
5915
5985
  <xsl:variable name="isAdded" select="@added"/>
5916
5986
  <xsl:variable name="isDeleted" select="@deleted"/>
5917
- <fo:block-container id="{@id}">
5987
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
5918
5988
 
5919
5989
  <xsl:call-template name="setTrackChangesStyles">
5920
5990
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -6255,6 +6325,31 @@
6255
6325
  <xsl:apply-templates mode="svg_update"/>
6256
6326
  </xsl:copy>
6257
6327
  </xsl:template>
6328
+
6329
+ <!-- regex for 'display: inline-block;' -->
6330
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
6331
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
6332
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
6333
+ </xsl:template>
6334
+
6335
+ <!-- replace
6336
+ stroke="rgba(r, g, b, alpha)" to
6337
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
6338
+ fill="rgba(r, g, b, alpha)" to
6339
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
6340
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
6341
+ <xsl:variable name="components_">
6342
+ <xsl:call-template name="split">
6343
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
6344
+ <xsl:with-param name="sep" select="','"/>
6345
+ </xsl:call-template>
6346
+ </xsl:variable>
6347
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
6348
+ <xsl:variable name="att_name" select="local-name()"/>
6349
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
6350
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
6351
+ </xsl:template>
6352
+
6258
6353
  <!-- ============== -->
6259
6354
  <!-- END: svg_update -->
6260
6355
  <!-- ============== -->
@@ -6880,7 +6975,13 @@
6880
6975
  </xsl:template>
6881
6976
 
6882
6977
  <xsl:template match="text()" mode="contents_item">
6883
- <xsl:call-template name="keep_together_standard_number"/>
6978
+ <xsl:variable name="text">
6979
+ <!-- to split by '_' and other chars -->
6980
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
6981
+ </xsl:variable>
6982
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
6983
+ <xsl:call-template name="keep_together_standard_number"/>
6984
+ </xsl:for-each>
6884
6985
  </xsl:template>
6885
6986
 
6886
6987
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -6891,35 +6992,53 @@
6891
6992
  <!-- =============== -->
6892
6993
  <!-- sourcecode -->
6893
6994
  <!-- =============== -->
6894
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6895
6995
 
6896
- <xsl:variable name="sourcecode_attributes">
6897
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6898
- <xsl:variable name="_font-size">
6996
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6997
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6998
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6899
6999
 
6900
- <!-- 9 -->
7000
+ <xsl:template match="*[local-name() = 'property']" mode="css">
7001
+ <xsl:attribute name="{@name}">
7002
+ <xsl:value-of select="@value"/>
7003
+ </xsl:attribute>
7004
+ </xsl:template>
6901
7005
 
6902
- <!-- <xsl:if test="$namespace = 'ieee'">
6903
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6904
- </xsl:if> -->
7006
+ <xsl:template name="get_sourcecode_attributes">
7007
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7008
+ <xsl:variable name="_font-size">
6905
7009
 
6906
- 10
6907
- </xsl:variable>
7010
+ <!-- inherit -->
6908
7011
 
6909
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6910
- <xsl:if test="$font-size != ''">
6911
- <xsl:attribute name="font-size">
6912
- <xsl:choose>
6913
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6914
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6915
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6916
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6917
- </xsl:choose>
6918
- </xsl:attribute>
6919
- </xsl:if>
6920
- </xsl:element>
7012
+ <!-- <xsl:if test="$namespace = 'ieee'">
7013
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7014
+ </xsl:if> -->
7015
+
7016
+ 10
7017
+ </xsl:variable>
7018
+
7019
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7020
+ <xsl:if test="$font-size != ''">
7021
+ <xsl:attribute name="font-size">
7022
+ <xsl:choose>
7023
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7024
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7025
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7026
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7027
+ </xsl:choose>
7028
+ </xsl:attribute>
7029
+ </xsl:if>
7030
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
7031
+ </xsl:element>
7032
+ </xsl:template>
7033
+
7034
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7035
+
7036
+ <xsl:variable name="sourcecode_attributes">
7037
+ <xsl:call-template name="get_sourcecode_attributes"/>
6921
7038
  </xsl:variable>
6922
7039
 
7040
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
7041
+
6923
7042
  <xsl:choose>
6924
7043
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6925
7044
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -6973,9 +7092,10 @@
6973
7092
  </xsl:choose>
6974
7093
  </xsl:template>
6975
7094
 
6976
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
7095
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
6977
7096
  <xsl:choose>
6978
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7097
+ <!-- disabled -->
7098
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6979
7099
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6980
7100
  <xsl:choose>
6981
7101
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -6990,8 +7110,75 @@
6990
7110
  <xsl:call-template name="add_spaces_to_sourcecode"/>
6991
7111
  </xsl:otherwise>
6992
7112
  </xsl:choose>
7113
+ </xsl:template>
7114
+
7115
+ <!-- add sourcecode highlighting -->
7116
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7117
+ <xsl:variable name="class" select="@class"/>
7118
+ <xsl:choose>
7119
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
7120
+ <fo:inline>
7121
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7122
+ <xsl:apply-templates/>
7123
+ </fo:inline>
7124
+ </xsl:when>
7125
+ <xsl:otherwise>
7126
+ <xsl:apply-templates/>
7127
+ </xsl:otherwise>
7128
+ </xsl:choose>
7129
+ </xsl:template>
7130
+
7131
+ <!-- outer table with line numbers for sourcecode -->
7132
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
7133
+ <fo:block>
7134
+ <fo:table width="100%" table-layout="fixed">
7135
+ <xsl:copy-of select="@id"/>
7136
+ <fo:table-column column-width="8%"/>
7137
+ <fo:table-column column-width="92%"/>
7138
+ <fo:table-body>
7139
+ <xsl:apply-templates/>
7140
+ </fo:table-body>
7141
+ </fo:table>
7142
+ </fo:block>
7143
+ </xsl:template>
7144
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
7145
+ <xsl:apply-templates/>
7146
+ </xsl:template>
7147
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
7148
+ <fo:table-row>
7149
+ <xsl:apply-templates/>
7150
+ </fo:table-row>
7151
+ </xsl:template>
7152
+ <!-- first td with line numbers -->
7153
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
7154
+ <fo:table-cell>
7155
+ <fo:block>
7156
+
7157
+ <!-- set attibutes for line numbers - same as sourcecode -->
7158
+ <xsl:variable name="sourcecode_attributes">
7159
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
7160
+ <xsl:call-template name="get_sourcecode_attributes"/>
7161
+ </xsl:for-each>
7162
+ </xsl:variable>
7163
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
7164
+ <xsl:attribute name="{local-name()}">
7165
+ <xsl:value-of select="."/>
7166
+ </xsl:attribute>
7167
+ </xsl:for-each>
6993
7168
 
7169
+ <xsl:apply-templates/>
7170
+ </fo:block>
7171
+ </fo:table-cell>
6994
7172
  </xsl:template>
7173
+ <!-- second td with sourcecode -->
7174
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
7175
+ <fo:table-cell>
7176
+ <fo:block>
7177
+ <xsl:apply-templates/>
7178
+ </fo:block>
7179
+ </fo:table-cell>
7180
+ </xsl:template>
7181
+ <!-- END outer table with line numbers for sourcecode -->
6995
7182
 
6996
7183
  <xsl:template name="add_spaces_to_sourcecode">
6997
7184
  <xsl:variable name="text_step1">
@@ -8674,160 +8861,53 @@
8674
8861
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8675
8862
 
8676
8863
  <xsl:template name="processBibitem">
8864
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8677
8865
 
8678
8866
  <!-- start UNECE bibitem processing -->
8679
- <fo:inline padding-right="5mm">[<xsl:value-of select="un:docidentifier"/>]</fo:inline><xsl:value-of select="un:docidentifier"/>
8680
- <xsl:text> </xsl:text>
8867
+ <fo:inline padding-right="5mm">
8868
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8869
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
8870
+ </xsl:apply-templates>
8871
+ </fo:inline>
8872
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8873
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
8874
+ </xsl:apply-templates>
8875
+
8681
8876
  <xsl:apply-templates select="un:formattedref"/>
8682
8877
  <!-- END UNECE bibitem processing -->
8683
8878
 
8684
8879
  </xsl:template> <!-- processBibitem (bibitem) -->
8685
8880
 
8686
- <xsl:template name="processBibitemDocId">
8687
- <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')]"/>
8688
- <xsl:choose>
8689
- <xsl:when test="normalize-space($_doc_ident) != ''">
8690
- <!-- <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"/>
8691
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8692
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8693
- </xsl:if> -->
8694
- <xsl:value-of select="$_doc_ident"/>
8695
- </xsl:when>
8696
- <xsl:otherwise>
8697
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8698
- <xsl:if test="$type != ''">
8699
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8700
- </xsl:if> -->
8701
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8702
- </xsl:otherwise>
8703
- </xsl:choose>
8704
- </xsl:template> <!-- processBibitemDocId -->
8881
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8882
+ <fo:inline><xsl:apply-templates/></fo:inline>
8883
+ </xsl:template>
8884
+
8885
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8886
+
8887
+ <xsl:template match="*[local-name() = 'formattedref']">
8888
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8889
+ <xsl:text>, </xsl:text>
8890
+ </xsl:if> -->
8891
+ <xsl:apply-templates/>
8892
+ </xsl:template>
8705
8893
 
8706
- <xsl:template name="processPersonalAuthor">
8894
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8895
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8707
8896
  <xsl:choose>
8708
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8709
- <author>
8710
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8711
- </author>
8712
- </xsl:when>
8713
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8714
- <author>
8715
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8716
- <xsl:text> </xsl:text>
8717
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8718
- </author>
8897
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8898
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8719
8899
  </xsl:when>
8720
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8721
- <author>
8722
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8723
- <xsl:text> </xsl:text>
8724
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8725
- </author>
8900
+ <xsl:when test="$biblio_tag_part = 'last'">
8901
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8726
8902
  </xsl:when>
8727
8903
  <xsl:otherwise>
8728
8904
  <xsl:apply-templates/>
8729
8905
  </xsl:otherwise>
8730
8906
  </xsl:choose>
8731
- </xsl:template> <!-- processPersonalAuthor -->
8732
-
8733
- <xsl:template name="renderDate">
8734
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8735
- <xsl:value-of select="*[local-name() = 'on']"/>
8736
- </xsl:if>
8737
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8738
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8739
- </xsl:if>
8740
- </xsl:template>
8741
-
8742
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8743
- <xsl:value-of select="translate(.,'. ','')"/>
8744
- </xsl:template>
8745
-
8746
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8747
- <xsl:value-of select="substring(.,1,1)"/>
8748
- </xsl:template>
8749
-
8750
- <xsl:template match="*[local-name() = 'title']" mode="title">
8751
- <fo:inline><xsl:apply-templates/></fo:inline>
8752
- </xsl:template>
8753
-
8754
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8755
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8756
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8757
- <xsl:apply-templates/>
8758
- </fo:inline>
8759
- </xsl:template>
8760
-
8761
- <!-- bibitem/note renders as footnote -->
8762
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8763
-
8764
- <!-- list of footnotes to calculate actual footnotes number -->
8765
- <xsl:variable name="p_fn_">
8766
- <xsl:call-template name="get_fn_list"/>
8767
- </xsl:variable>
8768
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8769
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8770
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8771
- <!-- fn sequence number in document -->
8772
- <xsl:variable name="current_fn_number">
8773
- <xsl:choose>
8774
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8775
- <xsl:otherwise>
8776
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8777
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8778
- </xsl:otherwise>
8779
- </xsl:choose>
8780
- </xsl:variable>
8781
- <fo:footnote>
8782
- <xsl:variable name="number">
8783
-
8784
- <xsl:value-of select="$current_fn_number"/>
8785
-
8786
- </xsl:variable>
8787
-
8788
- <xsl:variable name="current_fn_number_text">
8789
- <xsl:value-of select="$number"/>
8790
-
8791
- </xsl:variable>
8792
-
8793
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8794
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8795
- <xsl:value-of select="$current_fn_number_text"/>
8796
- </fo:basic-link>
8797
- </fo:inline>
8798
- <fo:footnote-body>
8799
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8800
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8801
- <xsl:value-of select="$current_fn_number_text"/>
8802
- </fo:inline>
8803
- <xsl:apply-templates/>
8804
- </fo:block>
8805
- </fo:footnote-body>
8806
- </fo:footnote>
8807
- </xsl:template>
8808
-
8809
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8810
- <xsl:text> edition </xsl:text>
8811
- <xsl:value-of select="."/>
8812
- </xsl:template>
8813
-
8814
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8815
- <xsl:text> (</xsl:text>
8816
- <fo:inline xsl:use-attribute-sets="link-style">
8817
- <fo:basic-link external-destination="." fox:alt-text=".">
8818
- <xsl:value-of select="."/>
8819
- </fo:basic-link>
8820
- </fo:inline>
8821
- <xsl:text>)</xsl:text>
8822
8907
  </xsl:template>
8823
8908
 
8824
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8825
-
8826
- <xsl:template match="*[local-name() = 'formattedref']">
8827
-
8828
- <xsl:text>, </xsl:text>
8829
-
8830
- <xsl:apply-templates/>
8909
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
8910
+ <xsl:text> </xsl:text>
8831
8911
  </xsl:template>
8832
8912
 
8833
8913
  <!-- ======================= -->
@@ -9165,7 +9245,9 @@
9165
9245
  <!-- Update xml -->
9166
9246
  <!-- ===================================== -->
9167
9247
  <!-- =========================================================================== -->
9168
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9248
+ <!-- STEP1: -->
9249
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
9250
+ <!-- - Ignore 'span' without style -->
9169
9251
  <!-- =========================================================================== -->
9170
9252
  <xsl:template match="@*|node()" mode="update_xml_step1">
9171
9253
  <xsl:copy>
@@ -9248,7 +9330,8 @@
9248
9330
  </xsl:copy>
9249
9331
  </xsl:template>
9250
9332
 
9251
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
9333
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
9334
+ <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">
9252
9335
  <xsl:copy>
9253
9336
  <xsl:copy-of select="@*"/>
9254
9337
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -9258,6 +9341,12 @@
9258
9341
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9259
9342
  <xsl:apply-templates mode="update_xml_step1"/>
9260
9343
  </xsl:template>
9344
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9345
+ <xsl:copy>
9346
+ <xsl:copy-of select="@*"/>
9347
+ <xsl:apply-templates mode="update_xml_step1"/>
9348
+ </xsl:copy>
9349
+ </xsl:template>
9261
9350
  <!-- =========================================================================== -->
9262
9351
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9263
9352
  <!-- =========================================================================== -->
@@ -9738,6 +9827,10 @@
9738
9827
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9739
9828
  </xsl:template>
9740
9829
 
9830
+ <xsl:template name="getDocumentId_fromCurrentNode">
9831
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9832
+ </xsl:template>
9833
+
9741
9834
  <xsl:template name="namespaceCheck">
9742
9835
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9743
9836
  <xsl:variable name="XSLNS">
@@ -683,6 +683,9 @@
683
683
  </define>
684
684
  <define name="underline">
685
685
  <element name="underline">
686
+ <optional>
687
+ <attribute name="style"/>
688
+ </optional>
686
689
  <zeroOrMore>
687
690
  <ref name="PureTextElement"/>
688
691
  </zeroOrMore>