metanorma-bipm 2.2.0 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,8 +6,9 @@
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
- <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
+ <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"/>
11
12
 
12
13
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
13
14
 
@@ -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, ')')"/> -->
381
+
382
+ <xsl:variable name="base64" select="java:org.metanorma.fop.Util.encodeBase64($mathml_content)"/>
364
383
 
365
- <xsl:variable name="url" select="concat('url(file:',$basepath, ')')"/>
384
+ <xsl:variable name="url" select="concat('data:application/xml;base64,',$base64)"/>
366
385
 
367
- <xsl:if test="normalize-space($url) != ''">
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 -->
@@ -6459,7 +6502,7 @@
6459
6502
  </fn>
6460
6503
  -->
6461
6504
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
6462
- <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">
6505
+ <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">
6463
6506
 
6464
6507
  <!-- list of footnotes to calculate actual footnotes number -->
6465
6508
  <xsl:variable name="p_fn_">
@@ -6490,7 +6533,22 @@
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>
6494
6552
 
6495
6553
  <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
6496
6554
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -6501,8 +6559,7 @@
6501
6559
  </fo:basic-link>
6502
6560
  </fo:inline>
6503
6561
  </xsl:variable>
6504
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
6505
- gen_id=<xsl:value-of select="$gen_id"/> -->
6562
+
6506
6563
  <xsl:choose>
6507
6564
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
6508
6565
  <xsl:copy-of select="$footnote_inline"/>
@@ -6554,7 +6611,10 @@
6554
6611
  </xsl:for-each>
6555
6612
  <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']/*">
6556
6613
  <xsl:sort select="@displayorder" data-type="number"/>
6557
- <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])]">
6614
+ <!-- commented:
6615
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
6616
+ because 'fn' there is in biblio-tag -->
6617
+ <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])]">
6558
6618
  <!-- copy unique fn -->
6559
6619
  <fn gen_id="{generate-id(.)}">
6560
6620
  <xsl:copy-of select="@*"/>
@@ -7412,7 +7472,7 @@
7412
7472
 
7413
7473
  <xsl:variable name="_font-size">
7414
7474
 
7415
- <!-- 10 -->
7475
+ <!-- inherit -->
7416
7476
 
7417
7477
  </xsl:variable>
7418
7478
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -8380,6 +8440,33 @@
8380
8440
  </xsl:choose>
8381
8441
  </xsl:template>
8382
8442
 
8443
+ <xsl:template name="getLang_fromCurrentNode">
8444
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
8445
+ <xsl:variable name="language">
8446
+ <xsl:choose>
8447
+ <xsl:when test="$language_current != ''">
8448
+ <xsl:value-of select="$language_current"/>
8449
+ </xsl:when>
8450
+ <xsl:otherwise>
8451
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
8452
+ <xsl:choose>
8453
+ <xsl:when test="$language_current_2 != ''">
8454
+ <xsl:value-of select="$language_current_2"/>
8455
+ </xsl:when>
8456
+ <xsl:otherwise>
8457
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
8458
+ </xsl:otherwise>
8459
+ </xsl:choose>
8460
+ </xsl:otherwise>
8461
+ </xsl:choose>
8462
+ </xsl:variable>
8463
+
8464
+ <xsl:choose>
8465
+ <xsl:when test="$language = 'English'">en</xsl:when>
8466
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
8467
+ </xsl:choose>
8468
+ </xsl:template>
8469
+
8383
8470
  <xsl:template name="capitalizeWords">
8384
8471
  <xsl:param name="str"/>
8385
8472
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -9060,7 +9147,7 @@
9060
9147
  <xsl:template match="*[local-name() = 'figure']" name="figure">
9061
9148
  <xsl:variable name="isAdded" select="@added"/>
9062
9149
  <xsl:variable name="isDeleted" select="@deleted"/>
9063
- <fo:block-container id="{@id}">
9150
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
9064
9151
 
9065
9152
  <xsl:if test="*[local-name() = 'name']">
9066
9153
  <xsl:attribute name="space-after">12pt</xsl:attribute>
@@ -9142,7 +9229,9 @@
9142
9229
 
9143
9230
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
9144
9231
  <xsl:if test="number($scale) &lt; 100">
9145
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9232
+
9233
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
9234
+
9146
9235
  </xsl:if>
9147
9236
 
9148
9237
  </xsl:if>
@@ -10064,7 +10153,13 @@
10064
10153
  </xsl:template>
10065
10154
 
10066
10155
  <xsl:template match="text()" mode="contents_item">
10067
- <xsl:call-template name="keep_together_standard_number"/>
10156
+ <xsl:variable name="text">
10157
+ <!-- to split by '_' and other chars -->
10158
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
10159
+ </xsl:variable>
10160
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
10161
+ <xsl:call-template name="keep_together_standard_number"/>
10162
+ </xsl:for-each>
10068
10163
  </xsl:template>
10069
10164
 
10070
10165
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -10075,34 +10170,52 @@
10075
10170
  <!-- =============== -->
10076
10171
  <!-- sourcecode -->
10077
10172
  <!-- =============== -->
10078
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
10079
10173
 
10080
- <xsl:variable name="sourcecode_attributes">
10081
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
10082
- <xsl:variable name="_font-size">
10174
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
10175
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
10176
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
10083
10177
 
10084
- <!-- 9 -->
10178
+ <xsl:template match="*[local-name() = 'property']" mode="css">
10179
+ <xsl:attribute name="{@name}">
10180
+ <xsl:value-of select="@value"/>
10181
+ </xsl:attribute>
10182
+ </xsl:template>
10085
10183
 
10086
- <!-- <xsl:if test="$namespace = 'ieee'">
10087
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
10088
- </xsl:if> -->
10184
+ <xsl:template name="get_sourcecode_attributes">
10185
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
10186
+ <xsl:variable name="_font-size">
10089
10187
 
10090
- </xsl:variable>
10188
+ <!-- inherit -->
10091
10189
 
10092
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
10093
- <xsl:if test="$font-size != ''">
10094
- <xsl:attribute name="font-size">
10095
- <xsl:choose>
10096
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
10097
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
10098
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
10099
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
10100
- </xsl:choose>
10101
- </xsl:attribute>
10102
- </xsl:if>
10103
- </xsl:element>
10190
+ <!-- <xsl:if test="$namespace = 'ieee'">
10191
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
10192
+ </xsl:if> -->
10193
+
10194
+ </xsl:variable>
10195
+
10196
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
10197
+ <xsl:if test="$font-size != ''">
10198
+ <xsl:attribute name="font-size">
10199
+ <xsl:choose>
10200
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
10201
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
10202
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
10203
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
10204
+ </xsl:choose>
10205
+ </xsl:attribute>
10206
+ </xsl:if>
10207
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
10208
+ </xsl:element>
10209
+ </xsl:template>
10210
+
10211
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
10212
+
10213
+ <xsl:variable name="sourcecode_attributes">
10214
+ <xsl:call-template name="get_sourcecode_attributes"/>
10104
10215
  </xsl:variable>
10105
10216
 
10217
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
10218
+
10106
10219
  <xsl:choose>
10107
10220
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
10108
10221
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -10145,6 +10258,12 @@
10145
10258
  </xsl:attribute>
10146
10259
  </xsl:for-each>
10147
10260
 
10261
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
10262
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
10263
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10264
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10265
+ </xsl:if>
10266
+
10148
10267
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10149
10268
  </fo:block>
10150
10269
 
@@ -10156,9 +10275,10 @@
10156
10275
  </xsl:choose>
10157
10276
  </xsl:template>
10158
10277
 
10159
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
10278
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
10160
10279
  <xsl:choose>
10161
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
10280
+ <!-- disabled -->
10281
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
10162
10282
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
10163
10283
  <xsl:choose>
10164
10284
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -10173,8 +10293,76 @@
10173
10293
  <xsl:call-template name="add_spaces_to_sourcecode"/>
10174
10294
  </xsl:otherwise>
10175
10295
  </xsl:choose>
10296
+ </xsl:template>
10297
+
10298
+ <!-- add sourcecode highlighting -->
10299
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
10300
+ <xsl:variable name="class" select="@class"/>
10301
+ <xsl:choose>
10302
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
10303
+ <fo:inline>
10304
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
10305
+ <xsl:apply-templates/>
10306
+ </fo:inline>
10307
+ </xsl:when>
10308
+ <xsl:otherwise>
10309
+ <xsl:apply-templates/>
10310
+ </xsl:otherwise>
10311
+ </xsl:choose>
10312
+ </xsl:template>
10313
+
10314
+ <!-- outer table with line numbers for sourcecode -->
10315
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
10316
+ <fo:block>
10317
+ <fo:table width="100%" table-layout="fixed">
10318
+ <xsl:copy-of select="@id"/>
10319
+ <fo:table-column column-width="8%"/>
10320
+ <fo:table-column column-width="92%"/>
10321
+ <fo:table-body>
10322
+ <xsl:apply-templates/>
10323
+ </fo:table-body>
10324
+ </fo:table>
10325
+ </fo:block>
10326
+ </xsl:template>
10327
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
10328
+ <xsl:apply-templates/>
10329
+ </xsl:template>
10330
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
10331
+ <fo:table-row>
10332
+ <xsl:apply-templates/>
10333
+ </fo:table-row>
10334
+ </xsl:template>
10335
+ <!-- first td with line numbers -->
10336
+ <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'] -->
10337
+ <fo:table-cell>
10338
+ <fo:block>
10176
10339
 
10340
+ <!-- set attibutes for line numbers - same as sourcecode -->
10341
+ <xsl:variable name="sourcecode_attributes">
10342
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
10343
+ <xsl:call-template name="get_sourcecode_attributes"/>
10344
+ </xsl:for-each>
10345
+ </xsl:variable>
10346
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
10347
+ <xsl:attribute name="{local-name()}">
10348
+ <xsl:value-of select="."/>
10349
+ </xsl:attribute>
10350
+ </xsl:for-each>
10351
+
10352
+ <xsl:apply-templates/>
10353
+ </fo:block>
10354
+ </fo:table-cell>
10355
+ </xsl:template>
10356
+
10357
+ <!-- second td with sourcecode -->
10358
+ <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'] -->
10359
+ <fo:table-cell>
10360
+ <fo:block>
10361
+ <xsl:apply-templates/>
10362
+ </fo:block>
10363
+ </fo:table-cell>
10177
10364
  </xsl:template>
10365
+ <!-- END outer table with line numbers for sourcecode -->
10178
10366
 
10179
10367
  <xsl:template name="add_spaces_to_sourcecode">
10180
10368
  <xsl:variable name="text_step1">
@@ -10405,7 +10593,25 @@
10405
10593
  <xsl:template match="*[local-name()='pre']" name="pre">
10406
10594
  <fo:block xsl:use-attribute-sets="pre-style">
10407
10595
  <xsl:copy-of select="@id"/>
10408
- <xsl:apply-templates/>
10596
+ <xsl:choose>
10597
+
10598
+ <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' -->
10599
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
10600
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
10601
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10602
+ </xsl:if>
10603
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
10604
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
10605
+ <mtext><xsl:value-of select="."/></mtext>
10606
+ </math>
10607
+ </fo:instream-foreign-object>
10608
+ </xsl:when>
10609
+
10610
+ <xsl:otherwise>
10611
+ <xsl:apply-templates/>
10612
+ </xsl:otherwise>
10613
+
10614
+ </xsl:choose>
10409
10615
  </fo:block>
10410
10616
  </xsl:template>
10411
10617
  <!-- =============== -->
@@ -11853,23 +12059,17 @@
11853
12059
  <fo:list-item-label end-indent="label-end()">
11854
12060
  <fo:block>
11855
12061
  <fo:inline>
11856
- <xsl:value-of select="bipm:docidentifier[@type='metanorma-ordinal']"/>
11857
- <xsl:if test="not(bipm:docidentifier[@type='metanorma-ordinal'])">
11858
- <xsl:choose>
11859
- <xsl:when test="bipm:docidentifier[@type='metanorma']">
11860
- <xsl:value-of select="bipm:docidentifier[@type='metanorma']"/>
11861
- </xsl:when>
11862
- <xsl:otherwise>
11863
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
11864
- </xsl:otherwise>
11865
- </xsl:choose>
11866
- </xsl:if>
12062
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
12063
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
12064
+ </xsl:apply-templates>
11867
12065
  </fo:inline>
11868
12066
  </fo:block>
11869
12067
  </fo:list-item-label>
11870
12068
  <fo:list-item-body start-indent="body-start()">
11871
12069
  <fo:block>
11872
- <xsl:call-template name="processBibitem"/>
12070
+ <xsl:call-template name="processBibitem">
12071
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
12072
+ </xsl:call-template>
11873
12073
  </fo:block>
11874
12074
  </fo:list-item-body>
11875
12075
  </fo:list-item>
@@ -11879,178 +12079,51 @@
11879
12079
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
11880
12080
 
11881
12081
  <xsl:template name="processBibitem">
12082
+ <xsl:param name="biblio_tag_part">both</xsl:param>
11882
12083
 
11883
- <!-- start BIPM bibitem processing -->
11884
- <xsl:if test=".//bipm:fn">
12084
+ <!-- start bibitem processing -->
12085
+ <xsl:if test=".//*[local-name() = 'fn']">
11885
12086
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
11886
12087
  </xsl:if>
11887
12088
 
11888
- <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')]"/>
11889
- <xsl:variable name="docidentifier_main" select="*[local-name() = 'docidentifier'][not(@type)]"/>
11890
- <xsl:variable name="docidentifier">
11891
- <xsl:choose>
11892
- <xsl:when test="$docidentifier_ = $docidentifier_main and @suppress_identifier = 'true'"><!-- suppress indentifier --></xsl:when>
11893
- <xsl:otherwise><xsl:value-of select="$docidentifier_"/></xsl:otherwise>
11894
- </xsl:choose>
11895
- </xsl:variable>
11896
- <xsl:value-of select="normalize-space($docidentifier)"/>
11897
-
11898
- <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">, </xsl:if>
12089
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
12090
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
12091
+ </xsl:apply-templates>
11899
12092
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
11900
- <!-- end BIPM bibitem processing-->
12093
+ <!-- end bibitem processing -->
11901
12094
 
11902
12095
  </xsl:template> <!-- processBibitem (bibitem) -->
11903
12096
 
11904
- <xsl:template name="processBibitemDocId">
11905
- <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')]"/>
11906
- <xsl:choose>
11907
- <xsl:when test="normalize-space($_doc_ident) != ''">
11908
- <!-- <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"/>
11909
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
11910
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
11911
- </xsl:if> -->
11912
- <xsl:value-of select="$_doc_ident"/>
11913
- </xsl:when>
11914
- <xsl:otherwise>
11915
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
11916
- <xsl:if test="$type != ''">
11917
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
11918
- </xsl:if> -->
11919
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
11920
- </xsl:otherwise>
11921
- </xsl:choose>
11922
- </xsl:template> <!-- processBibitemDocId -->
12097
+ <xsl:template match="*[local-name() = 'title']" mode="title">
12098
+ <fo:inline><xsl:apply-templates/></fo:inline>
12099
+ </xsl:template>
11923
12100
 
11924
- <xsl:template name="processPersonalAuthor">
12101
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
12102
+
12103
+ <xsl:template match="*[local-name() = 'formattedref']">
12104
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
12105
+ <xsl:text>, </xsl:text>
12106
+ </xsl:if> -->
12107
+ <xsl:apply-templates/>
12108
+ </xsl:template>
12109
+
12110
+ <xsl:template match="*[local-name() = 'biblio-tag']">
12111
+ <xsl:param name="biblio_tag_part">both</xsl:param>
11925
12112
  <xsl:choose>
11926
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
11927
- <author>
11928
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
11929
- </author>
12113
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
12114
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
11930
12115
  </xsl:when>
11931
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
11932
- <author>
11933
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
11934
- <xsl:text> </xsl:text>
11935
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
11936
- </author>
11937
- </xsl:when>
11938
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
11939
- <author>
11940
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
11941
- <xsl:text> </xsl:text>
11942
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
11943
- </author>
12116
+ <xsl:when test="$biblio_tag_part = 'last'">
12117
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
11944
12118
  </xsl:when>
11945
12119
  <xsl:otherwise>
11946
12120
  <xsl:apply-templates/>
11947
12121
  </xsl:otherwise>
11948
12122
  </xsl:choose>
11949
- </xsl:template> <!-- processPersonalAuthor -->
11950
-
11951
- <xsl:template name="renderDate">
11952
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
11953
- <xsl:value-of select="*[local-name() = 'on']"/>
11954
- </xsl:if>
11955
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
11956
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
11957
- </xsl:if>
11958
- </xsl:template>
11959
-
11960
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
11961
- <xsl:value-of select="translate(.,'. ','')"/>
11962
- </xsl:template>
11963
-
11964
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
11965
- <xsl:value-of select="substring(.,1,1)"/>
11966
- </xsl:template>
11967
-
11968
- <xsl:template match="*[local-name() = 'title']" mode="title">
11969
- <fo:inline><xsl:apply-templates/></fo:inline>
11970
- </xsl:template>
11971
-
11972
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
11973
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
11974
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
11975
- <xsl:apply-templates/>
11976
- </fo:inline>
11977
- </xsl:template>
11978
-
11979
- <!-- bibitem/note renders as footnote -->
11980
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
11981
-
11982
- <!-- list of footnotes to calculate actual footnotes number -->
11983
- <xsl:variable name="p_fn_">
11984
- <xsl:call-template name="get_fn_list"/>
11985
- </xsl:variable>
11986
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
11987
- <xsl:variable name="gen_id" select="generate-id(.)"/>
11988
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
11989
- <!-- fn sequence number in document -->
11990
- <xsl:variable name="current_fn_number">
11991
- <xsl:choose>
11992
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
11993
- <xsl:otherwise>
11994
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
11995
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
11996
- </xsl:otherwise>
11997
- </xsl:choose>
11998
- </xsl:variable>
11999
- <fo:footnote>
12000
- <xsl:variable name="number">
12001
-
12002
- <xsl:choose>
12003
- <xsl:when test="ancestor::*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]">
12004
- <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
12005
- </xsl:when>
12006
- <xsl:otherwise>
12007
- <xsl:value-of select="$current_fn_number"/>
12008
- </xsl:otherwise>
12009
- </xsl:choose>
12010
-
12011
- </xsl:variable>
12012
-
12013
- <xsl:variable name="current_fn_number_text">
12014
- <xsl:value-of select="$number"/>
12015
-
12016
- </xsl:variable>
12017
-
12018
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
12019
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
12020
- <xsl:value-of select="$current_fn_number_text"/>
12021
- </fo:basic-link>
12022
- </fo:inline>
12023
- <fo:footnote-body>
12024
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
12025
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
12026
- <xsl:value-of select="$current_fn_number_text"/>
12027
- </fo:inline>
12028
- <xsl:apply-templates/>
12029
- </fo:block>
12030
- </fo:footnote-body>
12031
- </fo:footnote>
12032
- </xsl:template>
12033
-
12034
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
12035
- <xsl:text> edition </xsl:text>
12036
- <xsl:value-of select="."/>
12037
- </xsl:template>
12038
-
12039
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
12040
- <xsl:text> (</xsl:text>
12041
- <fo:inline xsl:use-attribute-sets="link-style">
12042
- <fo:basic-link external-destination="." fox:alt-text=".">
12043
- <xsl:value-of select="."/>
12044
- </fo:basic-link>
12045
- </fo:inline>
12046
- <xsl:text>)</xsl:text>
12047
12123
  </xsl:template>
12048
12124
 
12049
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
12050
-
12051
- <xsl:template match="*[local-name() = 'formattedref']">
12052
-
12053
- <xsl:apply-templates/>
12125
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
12126
+ <xsl:text> </xsl:text>
12054
12127
  </xsl:template>
12055
12128
 
12056
12129
  <!-- ======================= -->
@@ -12479,6 +12552,12 @@
12479
12552
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12480
12553
  <xsl:apply-templates mode="update_xml_step1"/>
12481
12554
  </xsl:template>
12555
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
12556
+ <xsl:copy>
12557
+ <xsl:copy-of select="@*"/>
12558
+ <xsl:apply-templates mode="update_xml_step1"/>
12559
+ </xsl:copy>
12560
+ </xsl:template>
12482
12561
  <!-- =========================================================================== -->
12483
12562
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12484
12563
  <!-- =========================================================================== -->
@@ -12959,6 +13038,10 @@
12959
13038
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
12960
13039
  </xsl:template>
12961
13040
 
13041
+ <xsl:template name="getDocumentId_fromCurrentNode">
13042
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
13043
+ </xsl:template>
13044
+
12962
13045
  <xsl:template name="namespaceCheck">
12963
13046
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
12964
13047
  <xsl:variable name="XSLNS">