metanorma-itu 2.2.1 → 2.2.3

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
- <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
5
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
@@ -2835,6 +2835,12 @@
2835
2835
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2836
2836
  </xsl:attribute-set>
2837
2837
 
2838
+ <xsl:attribute-set name="figure-block-style">
2839
+
2840
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2841
+
2842
+ </xsl:attribute-set>
2843
+
2838
2844
  <xsl:attribute-set name="figure-style">
2839
2845
 
2840
2846
  </xsl:attribute-set>
@@ -2844,7 +2850,7 @@
2844
2850
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2845
2851
  <xsl:attribute name="text-align">center</xsl:attribute>
2846
2852
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
2847
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2853
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
2848
2854
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2849
2855
 
2850
2856
  </xsl:attribute-set>
@@ -4258,6 +4264,10 @@
4258
4264
  <xsl:with-param name="continued">true</xsl:with-param>
4259
4265
  </xsl:apply-templates>
4260
4266
 
4267
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
4268
+ <fo:block/>
4269
+ </xsl:if>
4270
+
4261
4271
  </fo:table-cell>
4262
4272
  </fo:table-row>
4263
4273
  </xsl:template> <!-- table-header-title -->
@@ -4657,7 +4667,7 @@
4657
4667
  </fn>
4658
4668
  -->
4659
4669
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
4660
- <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">
4670
+ <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">
4661
4671
 
4662
4672
  <!-- list of footnotes to calculate actual footnotes number -->
4663
4673
  <xsl:variable name="p_fn_">
@@ -4688,7 +4698,22 @@
4688
4698
 
4689
4699
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4690
4700
  <xsl:variable name="footnote_inline">
4691
- <fo:inline xsl:use-attribute-sets="fn-num-style">
4701
+ <fo:inline>
4702
+
4703
+ <xsl:variable name="fn_styles">
4704
+ <xsl:choose>
4705
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
4706
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
4707
+ </xsl:when>
4708
+ <xsl:otherwise>
4709
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
4710
+ </xsl:otherwise>
4711
+ </xsl:choose>
4712
+ </xsl:variable>
4713
+
4714
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
4715
+ <xsl:copy-of select="."/>
4716
+ </xsl:for-each>
4692
4717
 
4693
4718
  <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
4694
4719
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -4699,8 +4724,7 @@
4699
4724
  </fo:basic-link>
4700
4725
  </fo:inline>
4701
4726
  </xsl:variable>
4702
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
4703
- gen_id=<xsl:value-of select="$gen_id"/> -->
4727
+
4704
4728
  <xsl:choose>
4705
4729
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4706
4730
  <xsl:copy-of select="$footnote_inline"/>
@@ -4756,7 +4780,10 @@
4756
4780
  </xsl:for-each>
4757
4781
  <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']/*">
4758
4782
  <xsl:sort select="@displayorder" data-type="number"/>
4759
- <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])]">
4783
+ <!-- commented:
4784
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
4785
+ because 'fn' there is in biblio-tag -->
4786
+ <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])]">
4760
4787
  <!-- copy unique fn -->
4761
4788
  <fn gen_id="{generate-id(.)}">
4762
4789
  <xsl:copy-of select="@*"/>
@@ -5627,7 +5654,7 @@
5627
5654
 
5628
5655
  <xsl:variable name="_font-size">
5629
5656
 
5630
- <!-- 10 -->
5657
+ <!-- inherit -->
5631
5658
 
5632
5659
  </xsl:variable>
5633
5660
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -6595,6 +6622,33 @@
6595
6622
  </xsl:choose>
6596
6623
  </xsl:template>
6597
6624
 
6625
+ <xsl:template name="getLang_fromCurrentNode">
6626
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6627
+ <xsl:variable name="language">
6628
+ <xsl:choose>
6629
+ <xsl:when test="$language_current != ''">
6630
+ <xsl:value-of select="$language_current"/>
6631
+ </xsl:when>
6632
+ <xsl:otherwise>
6633
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6634
+ <xsl:choose>
6635
+ <xsl:when test="$language_current_2 != ''">
6636
+ <xsl:value-of select="$language_current_2"/>
6637
+ </xsl:when>
6638
+ <xsl:otherwise>
6639
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
6640
+ </xsl:otherwise>
6641
+ </xsl:choose>
6642
+ </xsl:otherwise>
6643
+ </xsl:choose>
6644
+ </xsl:variable>
6645
+
6646
+ <xsl:choose>
6647
+ <xsl:when test="$language = 'English'">en</xsl:when>
6648
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
6649
+ </xsl:choose>
6650
+ </xsl:template>
6651
+
6598
6652
  <xsl:template name="capitalizeWords">
6599
6653
  <xsl:param name="str"/>
6600
6654
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -7217,7 +7271,7 @@
7217
7271
  <xsl:template match="*[local-name() = 'figure']" name="figure">
7218
7272
  <xsl:variable name="isAdded" select="@added"/>
7219
7273
  <xsl:variable name="isDeleted" select="@deleted"/>
7220
- <fo:block-container id="{@id}">
7274
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
7221
7275
 
7222
7276
  <xsl:call-template name="setTrackChangesStyles">
7223
7277
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -7295,7 +7349,9 @@
7295
7349
 
7296
7350
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7297
7351
  <xsl:if test="number($scale) &lt; 100">
7298
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7352
+
7353
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7354
+
7299
7355
  </xsl:if>
7300
7356
 
7301
7357
  </xsl:if>
@@ -8203,7 +8259,13 @@
8203
8259
  </xsl:template>
8204
8260
 
8205
8261
  <xsl:template match="text()" mode="contents_item">
8206
- <xsl:call-template name="keep_together_standard_number"/>
8262
+ <xsl:variable name="text">
8263
+ <!-- to split by '_' and other chars -->
8264
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
8265
+ </xsl:variable>
8266
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
8267
+ <xsl:call-template name="keep_together_standard_number"/>
8268
+ </xsl:for-each>
8207
8269
  </xsl:template>
8208
8270
 
8209
8271
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -8214,36 +8276,54 @@
8214
8276
  <!-- =============== -->
8215
8277
  <!-- sourcecode -->
8216
8278
  <!-- =============== -->
8217
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
8218
8279
 
8219
- <xsl:variable name="sourcecode_attributes">
8220
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
8221
- <xsl:variable name="_font-size">
8280
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
8281
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
8282
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
8222
8283
 
8223
- <!-- 9 -->
8284
+ <xsl:template match="*[local-name() = 'property']" mode="css">
8285
+ <xsl:attribute name="{@name}">
8286
+ <xsl:value-of select="@value"/>
8287
+ </xsl:attribute>
8288
+ </xsl:template>
8224
8289
 
8225
- <!-- <xsl:if test="$namespace = 'ieee'">
8226
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
8227
- </xsl:if> -->
8228
- 10
8290
+ <xsl:template name="get_sourcecode_attributes">
8291
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
8292
+ <xsl:variable name="_font-size">
8229
8293
 
8294
+ <!-- inherit -->
8230
8295
 
8231
- </xsl:variable>
8296
+ <!-- <xsl:if test="$namespace = 'ieee'">
8297
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
8298
+ </xsl:if> -->
8299
+ 10
8232
8300
 
8233
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
8234
- <xsl:if test="$font-size != ''">
8235
- <xsl:attribute name="font-size">
8236
- <xsl:choose>
8237
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
8238
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
8239
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
8240
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
8241
- </xsl:choose>
8242
- </xsl:attribute>
8243
- </xsl:if>
8244
- </xsl:element>
8301
+
8302
+ </xsl:variable>
8303
+
8304
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
8305
+ <xsl:if test="$font-size != ''">
8306
+ <xsl:attribute name="font-size">
8307
+ <xsl:choose>
8308
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
8309
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
8310
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
8311
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
8312
+ </xsl:choose>
8313
+ </xsl:attribute>
8314
+ </xsl:if>
8315
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
8316
+ </xsl:element>
8317
+ </xsl:template>
8318
+
8319
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
8320
+
8321
+ <xsl:variable name="sourcecode_attributes">
8322
+ <xsl:call-template name="get_sourcecode_attributes"/>
8245
8323
  </xsl:variable>
8246
8324
 
8325
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
8326
+
8247
8327
  <xsl:choose>
8248
8328
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
8249
8329
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -8286,6 +8366,12 @@
8286
8366
  </xsl:attribute>
8287
8367
  </xsl:for-each>
8288
8368
 
8369
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
8370
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
8371
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8372
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8373
+ </xsl:if>
8374
+
8289
8375
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8290
8376
  </fo:block>
8291
8377
 
@@ -8297,9 +8383,10 @@
8297
8383
  </xsl:choose>
8298
8384
  </xsl:template>
8299
8385
 
8300
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
8386
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
8301
8387
  <xsl:choose>
8302
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
8388
+ <!-- disabled -->
8389
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
8303
8390
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
8304
8391
  <xsl:choose>
8305
8392
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -8314,8 +8401,76 @@
8314
8401
  <xsl:call-template name="add_spaces_to_sourcecode"/>
8315
8402
  </xsl:otherwise>
8316
8403
  </xsl:choose>
8404
+ </xsl:template>
8405
+
8406
+ <!-- add sourcecode highlighting -->
8407
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
8408
+ <xsl:variable name="class" select="@class"/>
8409
+ <xsl:choose>
8410
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
8411
+ <fo:inline>
8412
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
8413
+ <xsl:apply-templates/>
8414
+ </fo:inline>
8415
+ </xsl:when>
8416
+ <xsl:otherwise>
8417
+ <xsl:apply-templates/>
8418
+ </xsl:otherwise>
8419
+ </xsl:choose>
8420
+ </xsl:template>
8421
+
8422
+ <!-- outer table with line numbers for sourcecode -->
8423
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
8424
+ <fo:block>
8425
+ <fo:table width="100%" table-layout="fixed">
8426
+ <xsl:copy-of select="@id"/>
8427
+ <fo:table-column column-width="8%"/>
8428
+ <fo:table-column column-width="92%"/>
8429
+ <fo:table-body>
8430
+ <xsl:apply-templates/>
8431
+ </fo:table-body>
8432
+ </fo:table>
8433
+ </fo:block>
8434
+ </xsl:template>
8435
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
8436
+ <xsl:apply-templates/>
8437
+ </xsl:template>
8438
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
8439
+ <fo:table-row>
8440
+ <xsl:apply-templates/>
8441
+ </fo:table-row>
8442
+ </xsl:template>
8443
+ <!-- first td with line numbers -->
8444
+ <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'] -->
8445
+ <fo:table-cell>
8446
+ <fo:block>
8447
+
8448
+ <!-- set attibutes for line numbers - same as sourcecode -->
8449
+ <xsl:variable name="sourcecode_attributes">
8450
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
8451
+ <xsl:call-template name="get_sourcecode_attributes"/>
8452
+ </xsl:for-each>
8453
+ </xsl:variable>
8454
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
8455
+ <xsl:attribute name="{local-name()}">
8456
+ <xsl:value-of select="."/>
8457
+ </xsl:attribute>
8458
+ </xsl:for-each>
8459
+
8460
+ <xsl:apply-templates/>
8461
+ </fo:block>
8462
+ </fo:table-cell>
8463
+ </xsl:template>
8317
8464
 
8465
+ <!-- second td with sourcecode -->
8466
+ <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'] -->
8467
+ <fo:table-cell>
8468
+ <fo:block>
8469
+ <xsl:apply-templates/>
8470
+ </fo:block>
8471
+ </fo:table-cell>
8318
8472
  </xsl:template>
8473
+ <!-- END outer table with line numbers for sourcecode -->
8319
8474
 
8320
8475
  <xsl:template name="add_spaces_to_sourcecode">
8321
8476
  <xsl:variable name="text_step1">
@@ -8546,7 +8701,25 @@
8546
8701
  <xsl:template match="*[local-name()='pre']" name="pre">
8547
8702
  <fo:block xsl:use-attribute-sets="pre-style">
8548
8703
  <xsl:copy-of select="@id"/>
8549
- <xsl:apply-templates/>
8704
+ <xsl:choose>
8705
+
8706
+ <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' -->
8707
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
8708
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8709
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8710
+ </xsl:if>
8711
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
8712
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
8713
+ <mtext><xsl:value-of select="."/></mtext>
8714
+ </math>
8715
+ </fo:instream-foreign-object>
8716
+ </xsl:when>
8717
+
8718
+ <xsl:otherwise>
8719
+ <xsl:apply-templates/>
8720
+ </xsl:otherwise>
8721
+
8722
+ </xsl:choose>
8550
8723
  </fo:block>
8551
8724
  </xsl:template>
8552
8725
  <!-- =============== -->
@@ -9996,49 +10169,27 @@
9996
10169
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
9997
10170
 
9998
10171
  <xsl:template name="processBibitem">
10172
+ <xsl:param name="biblio_tag_part">both</xsl:param>
9999
10173
 
10174
+ <!-- start ITU bibitem processing -->
10000
10175
  <!-- Example: [ITU-T A.23] ITU-T A.23, Recommendation ITU-T A.23, Annex A (2014), Guide for ITU-T and ISO/IEC JTC 1 cooperation. -->
10001
10176
  <xsl:if test="$doctype = 'implementers-guide'">
10002
10177
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
10003
10178
  <xsl:attribute name="text-indent">0mm</xsl:attribute>
10004
10179
  </xsl:if>
10005
10180
 
10006
- <xsl:variable name="docidentifier_metanorma" select="normalize-space(itu:docidentifier[@type = 'metanorma'])"/>
10007
10181
  <xsl:variable name="docidentifier_metanorma_ordinal" select="normalize-space(itu:docidentifier[@type = 'metanorma-ordinal'])"/>
10008
10182
 
10009
10183
  <xsl:variable name="bibitem_label">
10010
- <xsl:value-of select="$docidentifier_metanorma"/>
10011
- <xsl:if test="$docidentifier_metanorma = ''">
10012
- <fo:inline padding-right="5mm">
10013
- <xsl:variable name="docidentifier" select="normalize-space(itu:docidentifier[not(@type = 'metanorma-ordinal')])"/>
10014
- <xsl:choose>
10015
- <xsl:when test="$docidentifier != ''">
10016
- <xsl:text>[</xsl:text>
10017
- <xsl:value-of select="$docidentifier"/>
10018
- <xsl:text>] </xsl:text>
10019
- </xsl:when>
10020
- <xsl:otherwise>
10021
- <xsl:value-of select="$docidentifier_metanorma_ordinal"/>
10022
- </xsl:otherwise>
10023
- </xsl:choose>
10024
- </fo:inline>
10025
- </xsl:if>
10184
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
10185
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
10186
+ </xsl:apply-templates>
10026
10187
  </xsl:variable>
10027
10188
 
10028
10189
  <xsl:variable name="bibitem_body">
10029
- <xsl:variable name="docidentifier">
10030
- <xsl:text> </xsl:text>
10031
- <xsl:choose>
10032
- <xsl:when test="$docidentifier_metanorma != ''">
10033
- <xsl:value-of select="itu:docidentifier[not(@type) or not(@type = 'metanorma' or @type = 'metanorma-ordinal')]"/>
10034
- </xsl:when>
10035
- <xsl:otherwise>
10036
- <xsl:value-of select="itu:docidentifier[not(@type = 'metanorma-ordinal')]"/>
10037
- </xsl:otherwise>
10038
- </xsl:choose>
10039
- </xsl:variable>
10040
- <xsl:value-of select="$docidentifier"/>
10041
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
10190
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
10191
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
10192
+ </xsl:apply-templates>
10042
10193
  <xsl:apply-templates select="itu:formattedref"/>
10043
10194
  </xsl:variable>
10044
10195
 
@@ -10078,152 +10229,40 @@
10078
10229
  </fo:list-block>
10079
10230
  </xsl:otherwise>
10080
10231
  </xsl:choose>
10232
+ <!-- end ITU bibitem processing -->
10081
10233
 
10082
10234
  </xsl:template> <!-- processBibitem (bibitem) -->
10083
10235
 
10084
- <xsl:template name="processBibitemDocId">
10085
- <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')]"/>
10086
- <xsl:choose>
10087
- <xsl:when test="normalize-space($_doc_ident) != ''">
10088
- <!-- <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"/>
10089
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
10090
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
10091
- </xsl:if> -->
10092
- <xsl:value-of select="$_doc_ident"/>
10093
- </xsl:when>
10094
- <xsl:otherwise>
10095
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
10096
- <xsl:if test="$type != ''">
10097
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
10098
- </xsl:if> -->
10099
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
10100
- </xsl:otherwise>
10101
- </xsl:choose>
10102
- </xsl:template> <!-- processBibitemDocId -->
10236
+ <xsl:template match="*[local-name() = 'title']" mode="title">
10237
+ <fo:inline><xsl:apply-templates/></fo:inline>
10238
+ </xsl:template>
10239
+
10240
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
10103
10241
 
10104
- <xsl:template name="processPersonalAuthor">
10242
+ <xsl:template match="*[local-name() = 'formattedref']">
10243
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
10244
+ <xsl:text>, </xsl:text>
10245
+ </xsl:if> -->
10246
+ <xsl:apply-templates/>
10247
+ </xsl:template>
10248
+
10249
+ <xsl:template match="*[local-name() = 'biblio-tag']">
10250
+ <xsl:param name="biblio_tag_part">both</xsl:param>
10105
10251
  <xsl:choose>
10106
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
10107
- <author>
10108
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
10109
- </author>
10110
- </xsl:when>
10111
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
10112
- <author>
10113
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
10114
- <xsl:text> </xsl:text>
10115
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
10116
- </author>
10252
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
10253
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10117
10254
  </xsl:when>
10118
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
10119
- <author>
10120
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
10121
- <xsl:text> </xsl:text>
10122
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
10123
- </author>
10255
+ <xsl:when test="$biblio_tag_part = 'last'">
10256
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
10124
10257
  </xsl:when>
10125
10258
  <xsl:otherwise>
10126
10259
  <xsl:apply-templates/>
10127
10260
  </xsl:otherwise>
10128
10261
  </xsl:choose>
10129
- </xsl:template> <!-- processPersonalAuthor -->
10130
-
10131
- <xsl:template name="renderDate">
10132
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
10133
- <xsl:value-of select="*[local-name() = 'on']"/>
10134
- </xsl:if>
10135
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
10136
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
10137
- </xsl:if>
10138
- </xsl:template>
10139
-
10140
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
10141
- <xsl:value-of select="translate(.,'. ','')"/>
10142
- </xsl:template>
10143
-
10144
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
10145
- <xsl:value-of select="substring(.,1,1)"/>
10146
- </xsl:template>
10147
-
10148
- <xsl:template match="*[local-name() = 'title']" mode="title">
10149
- <fo:inline><xsl:apply-templates/></fo:inline>
10150
10262
  </xsl:template>
10151
10263
 
10152
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
10153
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
10154
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
10155
- <xsl:apply-templates/>
10156
- </fo:inline>
10157
- </xsl:template>
10158
-
10159
- <!-- bibitem/note renders as footnote -->
10160
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
10161
-
10162
- <!-- list of footnotes to calculate actual footnotes number -->
10163
- <xsl:variable name="p_fn_">
10164
- <xsl:call-template name="get_fn_list"/>
10165
- </xsl:variable>
10166
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
10167
- <xsl:variable name="gen_id" select="generate-id(.)"/>
10168
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
10169
- <!-- fn sequence number in document -->
10170
- <xsl:variable name="current_fn_number">
10171
- <xsl:choose>
10172
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
10173
- <xsl:otherwise>
10174
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
10175
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
10176
- </xsl:otherwise>
10177
- </xsl:choose>
10178
- </xsl:variable>
10179
- <fo:footnote>
10180
- <xsl:variable name="number">
10181
-
10182
- <xsl:value-of select="$current_fn_number"/>
10183
-
10184
- </xsl:variable>
10185
-
10186
- <xsl:variable name="current_fn_number_text">
10187
- <xsl:value-of select="$number"/>
10188
-
10189
- </xsl:variable>
10190
-
10191
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
10192
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
10193
- <xsl:value-of select="$current_fn_number_text"/>
10194
- </fo:basic-link>
10195
- </fo:inline>
10196
- <fo:footnote-body>
10197
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
10198
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
10199
- <xsl:value-of select="$current_fn_number_text"/>
10200
- </fo:inline>
10201
- <xsl:apply-templates/>
10202
- </fo:block>
10203
- </fo:footnote-body>
10204
- </fo:footnote>
10205
- </xsl:template>
10206
-
10207
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
10208
- <xsl:text> edition </xsl:text>
10209
- <xsl:value-of select="."/>
10210
- </xsl:template>
10211
-
10212
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
10213
- <xsl:text> (</xsl:text>
10214
- <fo:inline xsl:use-attribute-sets="link-style">
10215
- <fo:basic-link external-destination="." fox:alt-text=".">
10216
- <xsl:value-of select="."/>
10217
- </fo:basic-link>
10218
- </fo:inline>
10219
- <xsl:text>)</xsl:text>
10220
- </xsl:template>
10221
-
10222
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
10223
-
10224
- <xsl:template match="*[local-name() = 'formattedref']">
10225
-
10226
- <xsl:apply-templates/>
10264
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
10265
+ <xsl:text> </xsl:text>
10227
10266
  </xsl:template>
10228
10267
 
10229
10268
  <!-- ======================= -->
@@ -10652,6 +10691,12 @@
10652
10691
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
10653
10692
  <xsl:apply-templates mode="update_xml_step1"/>
10654
10693
  </xsl:template>
10694
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
10695
+ <xsl:copy>
10696
+ <xsl:copy-of select="@*"/>
10697
+ <xsl:apply-templates mode="update_xml_step1"/>
10698
+ </xsl:copy>
10699
+ </xsl:template>
10655
10700
  <!-- =========================================================================== -->
10656
10701
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10657
10702
  <!-- =========================================================================== -->
@@ -11132,6 +11177,10 @@
11132
11177
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
11133
11178
  </xsl:template>
11134
11179
 
11180
+ <xsl:template name="getDocumentId_fromCurrentNode">
11181
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
11182
+ </xsl:template>
11183
+
11135
11184
  <xsl:template name="namespaceCheck">
11136
11185
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
11137
11186
  <xsl:variable name="XSLNS">