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.
@@ -6,6 +6,7 @@
6
6
  <xsl:param name="doc_split_by_language"/>
7
7
 
8
8
  <xsl:param name="add_math_as_attachment">true</xsl:param>
9
+ <xsl:param name="final_transform">true</xsl:param>
9
10
 
10
11
  <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"/>
11
12
 
@@ -82,63 +83,77 @@
82
83
  <xsl:when test="$doc_split_by_language = ''"><!-- all documents -->
83
84
  <xsl:for-each select="//bipm:bipm-standard">
84
85
 
85
- <xsl:variable name="current_document">
86
+ <!-- <xsl:variable name="current_document">
86
87
  <xsl:copy-of select="."/>
87
88
  </xsl:variable>
88
-
89
- <xsl:for-each select="xalan:nodeset($current_document)">
89
+
90
+ <xsl:for-each select="xalan:nodeset($current_document)"> -->
90
91
 
91
92
  <xsl:variable name="docid">
92
- <xsl:call-template name="getDocumentId"/>
93
+ <xsl:call-template name="getDocumentId_fromCurrentNode"/>
94
+ <!-- <xsl:call-template name="getDocumentId"/> -->
93
95
  </xsl:variable>
94
96
 
95
97
  <!-- add id to xref and split xref with @to into two xref -->
96
98
  <xsl:variable name="current_document_index_id">
97
- <xsl:apply-templates select=".//bipm:indexsect" mode="index_add_id"/>
99
+ <xsl:apply-templates select=".//bipm:indexsect" mode="index_add_id">
100
+ <xsl:with-param name="docid" select="$docid"/>
101
+ </xsl:apply-templates>
98
102
  </xsl:variable>
99
103
 
100
- <xsl:variable name="current_document_index">
104
+ <!-- <xsl:variable name="current_document_index">
101
105
  <xsl:apply-templates select="xalan:nodeset($current_document_index_id)" mode="index_update"/>
102
106
  </xsl:variable>
103
-
107
+
104
108
  <xsl:for-each select="xalan:nodeset($current_document_index)">
105
109
  <doc id="{$docid}">
106
110
  <xsl:copy-of select="."/>
107
111
  </doc>
108
- </xsl:for-each>
112
+ </xsl:for-each> -->
109
113
 
110
- </xsl:for-each>
114
+ <doc id="{$docid}">
115
+ <xsl:apply-templates select="xalan:nodeset($current_document_index_id)" mode="index_update"/>
116
+ </doc>
117
+
118
+ <!-- </xsl:for-each> -->
111
119
 
112
120
  </xsl:for-each>
113
121
  </xsl:when>
114
122
  <xsl:otherwise>
115
123
  <xsl:for-each select="(//bipm:bipm-standard)[*[local-name()='bibdata']/*[local-name()='language'][@current = 'true'] = $doc_split_by_language]">
116
124
 
117
- <xsl:variable name="current_document">
125
+ <!-- <xsl:variable name="current_document">
118
126
  <xsl:copy-of select="."/>
119
127
  </xsl:variable>
120
-
121
- <xsl:for-each select="xalan:nodeset($current_document)">
128
+
129
+ <xsl:for-each select="xalan:nodeset($current_document)"> -->
122
130
 
123
131
  <xsl:variable name="docid">
124
- <xsl:call-template name="getDocumentId"/>
132
+ <!-- <xsl:call-template name="getDocumentId"/> -->
133
+ <xsl:call-template name="getDocumentId_fromCurrentNode"/>
125
134
  </xsl:variable>
126
135
 
127
136
  <xsl:variable name="current_document_index_id">
128
- <xsl:apply-templates select=".//bipm:indexsect" mode="index_add_id"/>
137
+ <xsl:apply-templates select=".//bipm:indexsect" mode="index_add_id">
138
+ <xsl:with-param name="docid" select="$docid"/>
139
+ </xsl:apply-templates>
129
140
  </xsl:variable>
130
141
 
131
- <xsl:variable name="current_document_index">
142
+ <!-- <xsl:variable name="current_document_index">
132
143
  <xsl:apply-templates select="xalan:nodeset($current_document_index_id)" mode="index_update"/>
133
144
  </xsl:variable>
134
-
145
+
135
146
  <xsl:for-each select="xalan:nodeset($current_document_index)">
136
147
  <doc id="{$docid}">
137
148
  <xsl:copy-of select="."/>
138
149
  </doc>
139
- </xsl:for-each>
150
+ </xsl:for-each> -->
140
151
 
141
- </xsl:for-each>
152
+ <doc id="{$docid}">
153
+ <xsl:apply-templates select="xalan:nodeset($current_document_index_id)" mode="index_update"/>
154
+ </doc>
155
+
156
+ <!-- </xsl:for-each> -->
142
157
 
143
158
  </xsl:for-each>
144
159
  </xsl:otherwise>
@@ -179,7 +194,7 @@
179
194
  </xsl:template>
180
195
 
181
196
  <xsl:variable name="mathml_attachments">
182
- <xsl:if test="$add_math_as_attachment = 'true'">
197
+ <xsl:if test="$add_math_as_attachment = 'true' and $final_transform = 'true'">
183
198
  <xsl:for-each select="//mathml:math">
184
199
 
185
200
  <xsl:variable name="sequence_number"><xsl:number level="any" format="00001"/></xsl:variable>
@@ -353,18 +368,23 @@
353
368
  <fo:declarations>
354
369
  <xsl:call-template name="addPDFUAmeta"/>
355
370
 
356
- <xsl:if test="$add_math_as_attachment = 'true'">
371
+ <xsl:if test="$add_math_as_attachment = 'true' and $final_transform = 'true'">
357
372
  <!-- DEBUG: mathml_attachments=<xsl:copy-of select="$mathml_attachments"/> -->
358
373
  <xsl:for-each select="xalan:nodeset($mathml_attachments)//attachment">
359
374
 
360
375
  <xsl:variable name="mathml_filename" select="@filename"/>
361
376
  <xsl:variable name="mathml_content" select="."/>
362
377
 
363
- <xsl:variable name="basepath" select="java:org.metanorma.fop.Util.saveFileToDisk($mathml_filename,$mathml_content)"/>
378
+ <!-- <xsl:variable name="basepath" select="java:org.metanorma.fop.Util.saveFileToDisk($mathml_filename,$mathml_content)"/> -->
379
+
380
+ <!-- <xsl:variable name="url" select="concat('url(file:',$basepath, ')')"/> -->
364
381
 
365
- <xsl:variable name="url" select="concat('url(file:',$basepath, ')')"/>
382
+ <xsl:variable name="base64" select="java:org.metanorma.fop.Util.encodeBase64($mathml_content)"/>
366
383
 
367
- <xsl:if test="normalize-space($url) != ''">
384
+ <xsl:variable name="url" select="concat('data:application/xml;base64,',$base64)"/>
385
+
386
+ <!-- <xsl:if test="normalize-space($url) != ''"> -->
387
+ <xsl:if test="normalize-space($base64) != ''">
368
388
  <pdf:embedded-file src="{$url}" filename="{$mathml_filename}"/>
369
389
  </xsl:if>
370
390
  </xsl:for-each>
@@ -405,12 +425,13 @@
405
425
  <xsl:variable name="lang" select="*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
406
426
  <xsl:variable name="num"><xsl:number level="any" count="bipm:bipm-standard"/></xsl:variable>
407
427
 
408
- <xsl:variable name="title_eref">
428
+ <!-- <xsl:variable name="title_eref">
409
429
  <xsl:apply-templates select="." mode="title_eref"/>
410
- </xsl:variable>
430
+ </xsl:variable> -->
411
431
 
412
432
  <xsl:variable name="flatxml_">
413
- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/>
433
+ <!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
434
+ <xsl:apply-templates select="." mode="flatxml"/>
414
435
  </xsl:variable>
415
436
 
416
437
  <xsl:variable name="flatxml">
@@ -430,12 +451,13 @@
430
451
  <xsl:variable name="lang" select="*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
431
452
  <xsl:variable name="num"><xsl:number level="any" count="bipm:bipm-standard"/></xsl:variable>
432
453
 
433
- <xsl:variable name="title_eref">
454
+ <!-- <xsl:variable name="title_eref">
434
455
  <xsl:apply-templates select="." mode="title_eref"/>
435
- </xsl:variable>
456
+ </xsl:variable> -->
436
457
 
437
458
  <xsl:variable name="flatxml_">
438
- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/>
459
+ <!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
460
+ <xsl:apply-templates select="." mode="flatxml"/>
439
461
  </xsl:variable>
440
462
 
441
463
  <xsl:variable name="flatxml">
@@ -453,12 +475,13 @@
453
475
  </xsl:when>
454
476
  <xsl:otherwise>
455
477
 
456
- <xsl:variable name="title_eref">
478
+ <!-- <xsl:variable name="title_eref">
457
479
  <xsl:apply-templates mode="title_eref"/>
458
- </xsl:variable>
480
+ </xsl:variable> -->
459
481
 
460
482
  <xsl:variable name="flatxml_">
461
- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/>
483
+ <!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
484
+ <xsl:apply-templates select="." mode="flatxml"/>
462
485
  </xsl:variable>
463
486
 
464
487
  <xsl:variable name="flatxml">
@@ -3249,7 +3272,8 @@
3249
3272
  </xsl:call-template>
3250
3273
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3251
3274
  <fo:block text-align="right">
3252
- <xsl:copy-of select="$header-title"/>
3275
+ <!-- <xsl:copy-of select="$header-title"/> -->
3276
+ <xsl:apply-templates select="xalan:nodeset($header-title)" mode="header_title_remove_link_embedded"/>
3253
3277
  <xsl:text>  </xsl:text>
3254
3278
  <fo:inline font-size="13pt" baseline-shift="-15%">•</fo:inline>
3255
3279
  <xsl:text>  </xsl:text>
@@ -3274,7 +3298,8 @@
3274
3298
  <xsl:text>  </xsl:text>
3275
3299
  <fo:inline font-size="13pt" baseline-shift="-15%">•</fo:inline>
3276
3300
  <xsl:text>  </xsl:text>
3277
- <xsl:copy-of select="$header-title"/>
3301
+ <!-- <xsl:copy-of select="$header-title"/> -->
3302
+ <xsl:apply-templates select="xalan:nodeset($header-title)" mode="header_title_remove_link_embedded"/>
3278
3303
  </fo:block>
3279
3304
  <fo:block-container font-size="1pt" border-top="0.5pt solid black" width="86.6mm">
3280
3305
  <fo:block> </fo:block>
@@ -3290,6 +3315,16 @@
3290
3315
  </fo:static-content>
3291
3316
  </xsl:template>
3292
3317
 
3318
+ <xsl:template match="@*|node()" mode="header_title_remove_link_embedded">
3319
+ <xsl:copy>
3320
+ <xsl:apply-templates select="@*|node()" mode="header_title_remove_link_embedded"/>
3321
+ </xsl:copy>
3322
+ </xsl:template>
3323
+
3324
+ <xsl:template match="fo:basic-link[contains(@external-destination,'embedded-file')]" mode="header_title_remove_link_embedded">
3325
+ <xsl:apply-templates mode="header_title_remove_link_embedded"/>
3326
+ </xsl:template>
3327
+
3293
3328
  <xsl:template name="insertDraftWatermark">
3294
3329
  <xsl:param name="isDraft"/>
3295
3330
  <xsl:param name="lang"/>
@@ -4592,6 +4627,10 @@
4592
4627
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4593
4628
  </xsl:attribute-set>
4594
4629
 
4630
+ <xsl:attribute-set name="figure-block-style">
4631
+
4632
+ </xsl:attribute-set>
4633
+
4595
4634
  <xsl:attribute-set name="figure-style">
4596
4635
 
4597
4636
  </xsl:attribute-set>
@@ -6045,6 +6084,10 @@
6045
6084
  <xsl:with-param name="continued">true</xsl:with-param>
6046
6085
  </xsl:apply-templates>
6047
6086
 
6087
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
6088
+ <fo:block/>
6089
+ </xsl:if>
6090
+
6048
6091
  </fo:table-cell>
6049
6092
  </fo:table-row>
6050
6093
  </xsl:template> <!-- table-header-title -->
@@ -6490,7 +6533,26 @@
6490
6533
 
6491
6534
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
6492
6535
  <xsl:variable name="footnote_inline">
6493
- <fo:inline xsl:use-attribute-sets="fn-num-style">
6536
+ <fo:inline>
6537
+
6538
+ <xsl:variable name="fn_styles">
6539
+ <xsl:choose>
6540
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
6541
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
6542
+ </xsl:when>
6543
+ <xsl:otherwise>
6544
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
6545
+ </xsl:otherwise>
6546
+ </xsl:choose>
6547
+ </xsl:variable>
6548
+
6549
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
6550
+ <xsl:copy-of select="."/>
6551
+ </xsl:for-each>
6552
+
6553
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
6554
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
6555
+ </xsl:if>
6494
6556
 
6495
6557
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6496
6558
  <xsl:value-of select="$current_fn_number_text"/>
@@ -6550,7 +6612,10 @@
6550
6612
  </xsl:for-each>
6551
6613
  <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']/*">
6552
6614
  <xsl:sort select="@displayorder" data-type="number"/>
6553
- <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])]">
6615
+ <!-- commented:
6616
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
6617
+ because 'fn' there is in biblio-tag -->
6618
+ <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])]">
6554
6619
  <!-- copy unique fn -->
6555
6620
  <fn gen_id="{generate-id(.)}">
6556
6621
  <xsl:copy-of select="@*"/>
@@ -7408,7 +7473,7 @@
7408
7473
 
7409
7474
  <xsl:variable name="_font-size">
7410
7475
 
7411
- <!-- 10 -->
7476
+ <!-- inherit -->
7412
7477
 
7413
7478
  </xsl:variable>
7414
7479
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -7649,6 +7714,23 @@
7649
7714
  <xsl:apply-templates/>
7650
7715
  </xsl:template>
7651
7716
 
7717
+ <!-- Don't break standard's numbers -->
7718
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
7719
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
7720
+ <xsl:choose>
7721
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
7722
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
7723
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
7724
+ </xsl:when>
7725
+ <xsl:otherwise>
7726
+ <xsl:apply-templates/>
7727
+ </xsl:otherwise>
7728
+ </xsl:choose>
7729
+ </xsl:template>
7730
+ <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">
7731
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
7732
+ </xsl:template>
7733
+
7652
7734
  <!-- ========================= -->
7653
7735
  <!-- END Rich text formatting -->
7654
7736
  <!-- ========================= -->
@@ -8044,7 +8126,7 @@
8044
8126
  <xsl:choose>
8045
8127
  <xsl:when test="@colspan">
8046
8128
  <xsl:variable name="td">
8047
- <xsl:element name="td">
8129
+ <xsl:element name="{local-name()}">
8048
8130
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
8049
8131
  <xsl:if test="local-name()='th'">
8050
8132
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -8059,7 +8141,7 @@
8059
8141
  </xsl:call-template>
8060
8142
  </xsl:when>
8061
8143
  <xsl:otherwise>
8062
- <xsl:element name="td">
8144
+ <xsl:element name="{local-name()}">
8063
8145
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
8064
8146
  <xsl:if test="local-name()='th'">
8065
8147
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -8126,7 +8208,7 @@
8126
8208
  <xsl:variable name="currentRow" select="."/>
8127
8209
 
8128
8210
  <xsl:variable name="normalizedTDs">
8129
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
8211
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
8130
8212
  <xsl:choose>
8131
8213
  <xsl:when test="@rowspan &gt; 1">
8132
8214
  <xsl:copy>
@@ -8138,7 +8220,7 @@
8138
8220
  </xsl:copy>
8139
8221
  </xsl:when>
8140
8222
  <xsl:otherwise>
8141
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
8223
+ <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)])]"/>
8142
8224
  </xsl:otherwise>
8143
8225
  </xsl:choose>
8144
8226
  </xsl:for-each>
@@ -8359,6 +8441,33 @@
8359
8441
  </xsl:choose>
8360
8442
  </xsl:template>
8361
8443
 
8444
+ <xsl:template name="getLang_fromCurrentNode">
8445
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
8446
+ <xsl:variable name="language">
8447
+ <xsl:choose>
8448
+ <xsl:when test="$language_current != ''">
8449
+ <xsl:value-of select="$language_current"/>
8450
+ </xsl:when>
8451
+ <xsl:otherwise>
8452
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
8453
+ <xsl:choose>
8454
+ <xsl:when test="$language_current_2 != ''">
8455
+ <xsl:value-of select="$language_current_2"/>
8456
+ </xsl:when>
8457
+ <xsl:otherwise>
8458
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
8459
+ </xsl:otherwise>
8460
+ </xsl:choose>
8461
+ </xsl:otherwise>
8462
+ </xsl:choose>
8463
+ </xsl:variable>
8464
+
8465
+ <xsl:choose>
8466
+ <xsl:when test="$language = 'English'">en</xsl:when>
8467
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
8468
+ </xsl:choose>
8469
+ </xsl:template>
8470
+
8362
8471
  <xsl:template name="capitalizeWords">
8363
8472
  <xsl:param name="str"/>
8364
8473
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -8853,12 +8962,6 @@
8853
8962
 
8854
8963
  <fo:block-container margin-left="0mm">
8855
8964
 
8856
- <!-- <xsl:if test="$namespace = 'iho'">
8857
- <xsl:if test="ancestor::iho:td">
8858
- <xsl:attribute name="font-size">12pt</xsl:attribute>
8859
- </xsl:if>
8860
- </xsl:if> -->
8861
-
8862
8965
  <fo:block>
8863
8966
 
8864
8967
  <xsl:if test="@parent-type = 'quote'">
@@ -9045,7 +9148,7 @@
9045
9148
  <xsl:template match="*[local-name() = 'figure']" name="figure">
9046
9149
  <xsl:variable name="isAdded" select="@added"/>
9047
9150
  <xsl:variable name="isDeleted" select="@deleted"/>
9048
- <fo:block-container id="{@id}">
9151
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
9049
9152
 
9050
9153
  <xsl:if test="*[local-name() = 'name']">
9051
9154
  <xsl:attribute name="space-after">12pt</xsl:attribute>
@@ -9385,6 +9488,31 @@
9385
9488
  <xsl:apply-templates mode="svg_update"/>
9386
9489
  </xsl:copy>
9387
9490
  </xsl:template>
9491
+
9492
+ <!-- regex for 'display: inline-block;' -->
9493
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
9494
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
9495
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
9496
+ </xsl:template>
9497
+
9498
+ <!-- replace
9499
+ stroke="rgba(r, g, b, alpha)" to
9500
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
9501
+ fill="rgba(r, g, b, alpha)" to
9502
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
9503
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
9504
+ <xsl:variable name="components_">
9505
+ <xsl:call-template name="split">
9506
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
9507
+ <xsl:with-param name="sep" select="','"/>
9508
+ </xsl:call-template>
9509
+ </xsl:variable>
9510
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
9511
+ <xsl:variable name="att_name" select="local-name()"/>
9512
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
9513
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
9514
+ </xsl:template>
9515
+
9388
9516
  <!-- ============== -->
9389
9517
  <!-- END: svg_update -->
9390
9518
  <!-- ============== -->
@@ -10024,7 +10152,13 @@
10024
10152
  </xsl:template>
10025
10153
 
10026
10154
  <xsl:template match="text()" mode="contents_item">
10027
- <xsl:call-template name="keep_together_standard_number"/>
10155
+ <xsl:variable name="text">
10156
+ <!-- to split by '_' and other chars -->
10157
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
10158
+ </xsl:variable>
10159
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
10160
+ <xsl:call-template name="keep_together_standard_number"/>
10161
+ </xsl:for-each>
10028
10162
  </xsl:template>
10029
10163
 
10030
10164
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -10035,34 +10169,52 @@
10035
10169
  <!-- =============== -->
10036
10170
  <!-- sourcecode -->
10037
10171
  <!-- =============== -->
10038
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
10039
10172
 
10040
- <xsl:variable name="sourcecode_attributes">
10041
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
10042
- <xsl:variable name="_font-size">
10173
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
10174
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
10175
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
10043
10176
 
10044
- <!-- 9 -->
10177
+ <xsl:template match="*[local-name() = 'property']" mode="css">
10178
+ <xsl:attribute name="{@name}">
10179
+ <xsl:value-of select="@value"/>
10180
+ </xsl:attribute>
10181
+ </xsl:template>
10045
10182
 
10046
- <!-- <xsl:if test="$namespace = 'ieee'">
10047
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
10048
- </xsl:if> -->
10183
+ <xsl:template name="get_sourcecode_attributes">
10184
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
10185
+ <xsl:variable name="_font-size">
10049
10186
 
10050
- </xsl:variable>
10187
+ <!-- inherit -->
10051
10188
 
10052
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
10053
- <xsl:if test="$font-size != ''">
10054
- <xsl:attribute name="font-size">
10055
- <xsl:choose>
10056
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
10057
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
10058
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
10059
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
10060
- </xsl:choose>
10061
- </xsl:attribute>
10062
- </xsl:if>
10063
- </xsl:element>
10189
+ <!-- <xsl:if test="$namespace = 'ieee'">
10190
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
10191
+ </xsl:if> -->
10192
+
10193
+ </xsl:variable>
10194
+
10195
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
10196
+ <xsl:if test="$font-size != ''">
10197
+ <xsl:attribute name="font-size">
10198
+ <xsl:choose>
10199
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
10200
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
10201
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
10202
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
10203
+ </xsl:choose>
10204
+ </xsl:attribute>
10205
+ </xsl:if>
10206
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
10207
+ </xsl:element>
10208
+ </xsl:template>
10209
+
10210
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
10211
+
10212
+ <xsl:variable name="sourcecode_attributes">
10213
+ <xsl:call-template name="get_sourcecode_attributes"/>
10064
10214
  </xsl:variable>
10065
10215
 
10216
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
10217
+
10066
10218
  <xsl:choose>
10067
10219
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
10068
10220
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -10116,9 +10268,10 @@
10116
10268
  </xsl:choose>
10117
10269
  </xsl:template>
10118
10270
 
10119
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
10271
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
10120
10272
  <xsl:choose>
10121
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
10273
+ <!-- disabled -->
10274
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
10122
10275
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
10123
10276
  <xsl:choose>
10124
10277
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -10133,8 +10286,75 @@
10133
10286
  <xsl:call-template name="add_spaces_to_sourcecode"/>
10134
10287
  </xsl:otherwise>
10135
10288
  </xsl:choose>
10289
+ </xsl:template>
10290
+
10291
+ <!-- add sourcecode highlighting -->
10292
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
10293
+ <xsl:variable name="class" select="@class"/>
10294
+ <xsl:choose>
10295
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
10296
+ <fo:inline>
10297
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
10298
+ <xsl:apply-templates/>
10299
+ </fo:inline>
10300
+ </xsl:when>
10301
+ <xsl:otherwise>
10302
+ <xsl:apply-templates/>
10303
+ </xsl:otherwise>
10304
+ </xsl:choose>
10305
+ </xsl:template>
10306
+
10307
+ <!-- outer table with line numbers for sourcecode -->
10308
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
10309
+ <fo:block>
10310
+ <fo:table width="100%" table-layout="fixed">
10311
+ <xsl:copy-of select="@id"/>
10312
+ <fo:table-column column-width="8%"/>
10313
+ <fo:table-column column-width="92%"/>
10314
+ <fo:table-body>
10315
+ <xsl:apply-templates/>
10316
+ </fo:table-body>
10317
+ </fo:table>
10318
+ </fo:block>
10319
+ </xsl:template>
10320
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
10321
+ <xsl:apply-templates/>
10322
+ </xsl:template>
10323
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
10324
+ <fo:table-row>
10325
+ <xsl:apply-templates/>
10326
+ </fo:table-row>
10327
+ </xsl:template>
10328
+ <!-- first td with line numbers -->
10329
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
10330
+ <fo:table-cell>
10331
+ <fo:block>
10136
10332
 
10333
+ <!-- set attibutes for line numbers - same as sourcecode -->
10334
+ <xsl:variable name="sourcecode_attributes">
10335
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
10336
+ <xsl:call-template name="get_sourcecode_attributes"/>
10337
+ </xsl:for-each>
10338
+ </xsl:variable>
10339
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
10340
+ <xsl:attribute name="{local-name()}">
10341
+ <xsl:value-of select="."/>
10342
+ </xsl:attribute>
10343
+ </xsl:for-each>
10344
+
10345
+ <xsl:apply-templates/>
10346
+ </fo:block>
10347
+ </fo:table-cell>
10137
10348
  </xsl:template>
10349
+ <!-- second td with sourcecode -->
10350
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
10351
+ <fo:table-cell>
10352
+ <fo:block>
10353
+ <xsl:apply-templates/>
10354
+ </fo:block>
10355
+ </fo:table-cell>
10356
+ </xsl:template>
10357
+ <!-- END outer table with line numbers for sourcecode -->
10138
10358
 
10139
10359
  <xsl:template name="add_spaces_to_sourcecode">
10140
10360
  <xsl:variable name="text_step1">
@@ -11813,23 +12033,17 @@
11813
12033
  <fo:list-item-label end-indent="label-end()">
11814
12034
  <fo:block>
11815
12035
  <fo:inline>
11816
- <xsl:value-of select="bipm:docidentifier[@type='metanorma-ordinal']"/>
11817
- <xsl:if test="not(bipm:docidentifier[@type='metanorma-ordinal'])">
11818
- <xsl:choose>
11819
- <xsl:when test="bipm:docidentifier[@type='metanorma']">
11820
- <xsl:value-of select="bipm:docidentifier[@type='metanorma']"/>
11821
- </xsl:when>
11822
- <xsl:otherwise>
11823
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
11824
- </xsl:otherwise>
11825
- </xsl:choose>
11826
- </xsl:if>
12036
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
12037
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
12038
+ </xsl:apply-templates>
11827
12039
  </fo:inline>
11828
12040
  </fo:block>
11829
12041
  </fo:list-item-label>
11830
12042
  <fo:list-item-body start-indent="body-start()">
11831
12043
  <fo:block>
11832
- <xsl:call-template name="processBibitem"/>
12044
+ <xsl:call-template name="processBibitem">
12045
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
12046
+ </xsl:call-template>
11833
12047
  </fo:block>
11834
12048
  </fo:list-item-body>
11835
12049
  </fo:list-item>
@@ -11839,178 +12053,51 @@
11839
12053
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
11840
12054
 
11841
12055
  <xsl:template name="processBibitem">
12056
+ <xsl:param name="biblio_tag_part">both</xsl:param>
11842
12057
 
11843
- <!-- start BIPM bibitem processing -->
11844
- <xsl:if test=".//bipm:fn">
12058
+ <!-- start bibitem processing -->
12059
+ <xsl:if test=".//*[local-name() = 'fn']">
11845
12060
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
11846
12061
  </xsl:if>
11847
12062
 
11848
- <xsl:variable name="docidentifier_" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
11849
- <xsl:variable name="docidentifier_main" select="*[local-name() = 'docidentifier'][not(@type)]"/>
11850
- <xsl:variable name="docidentifier">
11851
- <xsl:choose>
11852
- <xsl:when test="$docidentifier_ = $docidentifier_main and @suppress_identifier = 'true'"><!-- suppress indentifier --></xsl:when>
11853
- <xsl:otherwise><xsl:value-of select="$docidentifier_"/></xsl:otherwise>
11854
- </xsl:choose>
11855
- </xsl:variable>
11856
- <xsl:value-of select="normalize-space($docidentifier)"/>
11857
-
11858
- <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">, </xsl:if>
12063
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
12064
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
12065
+ </xsl:apply-templates>
11859
12066
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
11860
- <!-- end BIPM bibitem processing-->
12067
+ <!-- end bibitem processing -->
11861
12068
 
11862
12069
  </xsl:template> <!-- processBibitem (bibitem) -->
11863
12070
 
11864
- <xsl:template name="processBibitemDocId">
11865
- <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')]"/>
11866
- <xsl:choose>
11867
- <xsl:when test="normalize-space($_doc_ident) != ''">
11868
- <!-- <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"/>
11869
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
11870
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
11871
- </xsl:if> -->
11872
- <xsl:value-of select="$_doc_ident"/>
11873
- </xsl:when>
11874
- <xsl:otherwise>
11875
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
11876
- <xsl:if test="$type != ''">
11877
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
11878
- </xsl:if> -->
11879
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
11880
- </xsl:otherwise>
11881
- </xsl:choose>
11882
- </xsl:template> <!-- processBibitemDocId -->
12071
+ <xsl:template match="*[local-name() = 'title']" mode="title">
12072
+ <fo:inline><xsl:apply-templates/></fo:inline>
12073
+ </xsl:template>
12074
+
12075
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
12076
+
12077
+ <xsl:template match="*[local-name() = 'formattedref']">
12078
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
12079
+ <xsl:text>, </xsl:text>
12080
+ </xsl:if> -->
12081
+ <xsl:apply-templates/>
12082
+ </xsl:template>
11883
12083
 
11884
- <xsl:template name="processPersonalAuthor">
12084
+ <xsl:template match="*[local-name() = 'biblio-tag']">
12085
+ <xsl:param name="biblio_tag_part">both</xsl:param>
11885
12086
  <xsl:choose>
11886
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
11887
- <author>
11888
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
11889
- </author>
12087
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
12088
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
11890
12089
  </xsl:when>
11891
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
11892
- <author>
11893
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
11894
- <xsl:text> </xsl:text>
11895
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
11896
- </author>
11897
- </xsl:when>
11898
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
11899
- <author>
11900
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
11901
- <xsl:text> </xsl:text>
11902
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
11903
- </author>
12090
+ <xsl:when test="$biblio_tag_part = 'last'">
12091
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
11904
12092
  </xsl:when>
11905
12093
  <xsl:otherwise>
11906
12094
  <xsl:apply-templates/>
11907
12095
  </xsl:otherwise>
11908
12096
  </xsl:choose>
11909
- </xsl:template> <!-- processPersonalAuthor -->
11910
-
11911
- <xsl:template name="renderDate">
11912
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
11913
- <xsl:value-of select="*[local-name() = 'on']"/>
11914
- </xsl:if>
11915
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
11916
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
11917
- </xsl:if>
11918
- </xsl:template>
11919
-
11920
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
11921
- <xsl:value-of select="translate(.,'. ','')"/>
11922
12097
  </xsl:template>
11923
12098
 
11924
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
11925
- <xsl:value-of select="substring(.,1,1)"/>
11926
- </xsl:template>
11927
-
11928
- <xsl:template match="*[local-name() = 'title']" mode="title">
11929
- <fo:inline><xsl:apply-templates/></fo:inline>
11930
- </xsl:template>
11931
-
11932
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
11933
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
11934
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
11935
- <xsl:apply-templates/>
11936
- </fo:inline>
11937
- </xsl:template>
11938
-
11939
- <!-- bibitem/note renders as footnote -->
11940
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
11941
-
11942
- <!-- list of footnotes to calculate actual footnotes number -->
11943
- <xsl:variable name="p_fn_">
11944
- <xsl:call-template name="get_fn_list"/>
11945
- </xsl:variable>
11946
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
11947
- <xsl:variable name="gen_id" select="generate-id(.)"/>
11948
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
11949
- <!-- fn sequence number in document -->
11950
- <xsl:variable name="current_fn_number">
11951
- <xsl:choose>
11952
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
11953
- <xsl:otherwise>
11954
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
11955
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
11956
- </xsl:otherwise>
11957
- </xsl:choose>
11958
- </xsl:variable>
11959
- <fo:footnote>
11960
- <xsl:variable name="number">
11961
-
11962
- <xsl:choose>
11963
- <xsl:when test="ancestor::*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]">
11964
- <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
11965
- </xsl:when>
11966
- <xsl:otherwise>
11967
- <xsl:value-of select="$current_fn_number"/>
11968
- </xsl:otherwise>
11969
- </xsl:choose>
11970
-
11971
- </xsl:variable>
11972
-
11973
- <xsl:variable name="current_fn_number_text">
11974
- <xsl:value-of select="$number"/>
11975
-
11976
- </xsl:variable>
11977
-
11978
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
11979
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
11980
- <xsl:value-of select="$current_fn_number_text"/>
11981
- </fo:basic-link>
11982
- </fo:inline>
11983
- <fo:footnote-body>
11984
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
11985
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
11986
- <xsl:value-of select="$current_fn_number_text"/>
11987
- </fo:inline>
11988
- <xsl:apply-templates/>
11989
- </fo:block>
11990
- </fo:footnote-body>
11991
- </fo:footnote>
11992
- </xsl:template>
11993
-
11994
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
11995
- <xsl:text> edition </xsl:text>
11996
- <xsl:value-of select="."/>
11997
- </xsl:template>
11998
-
11999
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
12000
- <xsl:text> (</xsl:text>
12001
- <fo:inline xsl:use-attribute-sets="link-style">
12002
- <fo:basic-link external-destination="." fox:alt-text=".">
12003
- <xsl:value-of select="."/>
12004
- </fo:basic-link>
12005
- </fo:inline>
12006
- <xsl:text>)</xsl:text>
12007
- </xsl:template>
12008
-
12009
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
12010
-
12011
- <xsl:template match="*[local-name() = 'formattedref']">
12012
-
12013
- <xsl:apply-templates/>
12099
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
12100
+ <xsl:text> </xsl:text>
12014
12101
  </xsl:template>
12015
12102
 
12016
12103
  <!-- ======================= -->
@@ -12343,7 +12430,9 @@
12343
12430
  <!-- Update xml -->
12344
12431
  <!-- ===================================== -->
12345
12432
  <!-- =========================================================================== -->
12346
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12433
+ <!-- STEP1: -->
12434
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
12435
+ <!-- - Ignore 'span' without style -->
12347
12436
  <!-- =========================================================================== -->
12348
12437
  <xsl:template match="@*|node()" mode="update_xml_step1">
12349
12438
  <xsl:copy>
@@ -12426,7 +12515,8 @@
12426
12515
  </xsl:copy>
12427
12516
  </xsl:template>
12428
12517
 
12429
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
12518
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
12519
+ <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">
12430
12520
  <xsl:copy>
12431
12521
  <xsl:copy-of select="@*"/>
12432
12522
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12436,6 +12526,12 @@
12436
12526
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12437
12527
  <xsl:apply-templates mode="update_xml_step1"/>
12438
12528
  </xsl:template>
12529
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
12530
+ <xsl:copy>
12531
+ <xsl:copy-of select="@*"/>
12532
+ <xsl:apply-templates mode="update_xml_step1"/>
12533
+ </xsl:copy>
12534
+ </xsl:template>
12439
12535
  <!-- =========================================================================== -->
12440
12536
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12441
12537
  <!-- =========================================================================== -->
@@ -12916,6 +13012,10 @@
12916
13012
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
12917
13013
  </xsl:template>
12918
13014
 
13015
+ <xsl:template name="getDocumentId_fromCurrentNode">
13016
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
13017
+ </xsl:template>
13018
+
12919
13019
  <xsl:template name="namespaceCheck">
12920
13020
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
12921
13021
  <xsl:variable name="XSLNS">