metanorma-m3aawg 2.2.0 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -1425,6 +1425,12 @@
1425
1425
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1426
1426
  </xsl:attribute-set>
1427
1427
 
1428
+ <xsl:attribute-set name="figure-block-style">
1429
+
1430
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1431
+
1432
+ </xsl:attribute-set>
1433
+
1428
1434
  <xsl:attribute-set name="figure-style">
1429
1435
 
1430
1436
  </xsl:attribute-set>
@@ -1433,7 +1439,7 @@
1433
1439
 
1434
1440
  <xsl:attribute name="text-align">center</xsl:attribute>
1435
1441
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1436
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1442
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
1437
1443
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1438
1444
 
1439
1445
  </xsl:attribute-set>
@@ -2835,6 +2841,10 @@
2835
2841
  <xsl:with-param name="continued">true</xsl:with-param>
2836
2842
  </xsl:apply-templates>
2837
2843
 
2844
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
2845
+ <fo:block/>
2846
+ </xsl:if>
2847
+
2838
2848
  </fo:table-cell>
2839
2849
  </fo:table-row>
2840
2850
  </xsl:template> <!-- table-header-title -->
@@ -3188,7 +3198,7 @@
3188
3198
  </fn>
3189
3199
  -->
3190
3200
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
3191
- <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">
3201
+ <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">
3192
3202
 
3193
3203
  <!-- list of footnotes to calculate actual footnotes number -->
3194
3204
  <xsl:variable name="p_fn_">
@@ -3219,7 +3229,22 @@
3219
3229
 
3220
3230
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3221
3231
  <xsl:variable name="footnote_inline">
3222
- <fo:inline xsl:use-attribute-sets="fn-num-style">
3232
+ <fo:inline>
3233
+
3234
+ <xsl:variable name="fn_styles">
3235
+ <xsl:choose>
3236
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
3237
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
3238
+ </xsl:when>
3239
+ <xsl:otherwise>
3240
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
3241
+ </xsl:otherwise>
3242
+ </xsl:choose>
3243
+ </xsl:variable>
3244
+
3245
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
3246
+ <xsl:copy-of select="."/>
3247
+ </xsl:for-each>
3223
3248
 
3224
3249
  <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3225
3250
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -3230,8 +3255,7 @@
3230
3255
  </fo:basic-link>
3231
3256
  </fo:inline>
3232
3257
  </xsl:variable>
3233
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3234
- gen_id=<xsl:value-of select="$gen_id"/> -->
3258
+
3235
3259
  <xsl:choose>
3236
3260
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3237
3261
  <xsl:copy-of select="$footnote_inline"/>
@@ -3283,7 +3307,10 @@
3283
3307
  </xsl:for-each>
3284
3308
  <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']/*">
3285
3309
  <xsl:sort select="@displayorder" data-type="number"/>
3286
- <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])]">
3310
+ <!-- commented:
3311
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3312
+ because 'fn' there is in biblio-tag -->
3313
+ <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])]">
3287
3314
  <!-- copy unique fn -->
3288
3315
  <fn gen_id="{generate-id(.)}">
3289
3316
  <xsl:copy-of select="@*"/>
@@ -4132,7 +4159,7 @@
4132
4159
 
4133
4160
  <xsl:variable name="_font-size">
4134
4161
 
4135
- <!-- 10 -->
4162
+ <!-- inherit -->
4136
4163
 
4137
4164
  <xsl:choose>
4138
4165
  <xsl:when test="not(ancestor::*[local-name()='note'])">10</xsl:when>
@@ -5105,6 +5132,33 @@
5105
5132
  </xsl:choose>
5106
5133
  </xsl:template>
5107
5134
 
5135
+ <xsl:template name="getLang_fromCurrentNode">
5136
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5137
+ <xsl:variable name="language">
5138
+ <xsl:choose>
5139
+ <xsl:when test="$language_current != ''">
5140
+ <xsl:value-of select="$language_current"/>
5141
+ </xsl:when>
5142
+ <xsl:otherwise>
5143
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5144
+ <xsl:choose>
5145
+ <xsl:when test="$language_current_2 != ''">
5146
+ <xsl:value-of select="$language_current_2"/>
5147
+ </xsl:when>
5148
+ <xsl:otherwise>
5149
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5150
+ </xsl:otherwise>
5151
+ </xsl:choose>
5152
+ </xsl:otherwise>
5153
+ </xsl:choose>
5154
+ </xsl:variable>
5155
+
5156
+ <xsl:choose>
5157
+ <xsl:when test="$language = 'English'">en</xsl:when>
5158
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5159
+ </xsl:choose>
5160
+ </xsl:template>
5161
+
5108
5162
  <xsl:template name="capitalizeWords">
5109
5163
  <xsl:param name="str"/>
5110
5164
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -5725,7 +5779,7 @@
5725
5779
  <xsl:template match="*[local-name() = 'figure']" name="figure">
5726
5780
  <xsl:variable name="isAdded" select="@added"/>
5727
5781
  <xsl:variable name="isDeleted" select="@deleted"/>
5728
- <fo:block-container id="{@id}">
5782
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
5729
5783
 
5730
5784
  <xsl:call-template name="setTrackChangesStyles">
5731
5785
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -5803,7 +5857,9 @@
5803
5857
 
5804
5858
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
5805
5859
  <xsl:if test="number($scale) &lt; 100">
5806
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
5860
+
5861
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
5862
+
5807
5863
  </xsl:if>
5808
5864
 
5809
5865
  </xsl:if>
@@ -6711,7 +6767,13 @@
6711
6767
  </xsl:template>
6712
6768
 
6713
6769
  <xsl:template match="text()" mode="contents_item">
6714
- <xsl:call-template name="keep_together_standard_number"/>
6770
+ <xsl:variable name="text">
6771
+ <!-- to split by '_' and other chars -->
6772
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
6773
+ </xsl:variable>
6774
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
6775
+ <xsl:call-template name="keep_together_standard_number"/>
6776
+ </xsl:for-each>
6715
6777
  </xsl:template>
6716
6778
 
6717
6779
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -6722,34 +6784,52 @@
6722
6784
  <!-- =============== -->
6723
6785
  <!-- sourcecode -->
6724
6786
  <!-- =============== -->
6725
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6726
6787
 
6727
- <xsl:variable name="sourcecode_attributes">
6728
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6729
- <xsl:variable name="_font-size">
6788
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6789
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6790
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6730
6791
 
6731
- <!-- 9 -->
6792
+ <xsl:template match="*[local-name() = 'property']" mode="css">
6793
+ <xsl:attribute name="{@name}">
6794
+ <xsl:value-of select="@value"/>
6795
+ </xsl:attribute>
6796
+ </xsl:template>
6732
6797
 
6733
- <!-- <xsl:if test="$namespace = 'ieee'">
6734
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6735
- </xsl:if> -->
6798
+ <xsl:template name="get_sourcecode_attributes">
6799
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6800
+ <xsl:variable name="_font-size">
6736
6801
 
6737
- </xsl:variable>
6802
+ <!-- inherit -->
6738
6803
 
6739
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6740
- <xsl:if test="$font-size != ''">
6741
- <xsl:attribute name="font-size">
6742
- <xsl:choose>
6743
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6744
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6745
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6746
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6747
- </xsl:choose>
6748
- </xsl:attribute>
6749
- </xsl:if>
6750
- </xsl:element>
6804
+ <!-- <xsl:if test="$namespace = 'ieee'">
6805
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
6806
+ </xsl:if> -->
6807
+
6808
+ </xsl:variable>
6809
+
6810
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6811
+ <xsl:if test="$font-size != ''">
6812
+ <xsl:attribute name="font-size">
6813
+ <xsl:choose>
6814
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6815
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6816
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6817
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6818
+ </xsl:choose>
6819
+ </xsl:attribute>
6820
+ </xsl:if>
6821
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
6822
+ </xsl:element>
6823
+ </xsl:template>
6824
+
6825
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6826
+
6827
+ <xsl:variable name="sourcecode_attributes">
6828
+ <xsl:call-template name="get_sourcecode_attributes"/>
6751
6829
  </xsl:variable>
6752
6830
 
6831
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
6832
+
6753
6833
  <xsl:choose>
6754
6834
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6755
6835
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -6792,6 +6872,12 @@
6792
6872
  </xsl:attribute>
6793
6873
  </xsl:for-each>
6794
6874
 
6875
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
6876
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
6877
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
6878
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
6879
+ </xsl:if>
6880
+
6795
6881
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6796
6882
  </fo:block>
6797
6883
 
@@ -6803,9 +6889,10 @@
6803
6889
  </xsl:choose>
6804
6890
  </xsl:template>
6805
6891
 
6806
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
6892
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
6807
6893
  <xsl:choose>
6808
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6894
+ <!-- disabled -->
6895
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6809
6896
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6810
6897
  <xsl:choose>
6811
6898
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -6820,9 +6907,77 @@
6820
6907
  <xsl:call-template name="add_spaces_to_sourcecode"/>
6821
6908
  </xsl:otherwise>
6822
6909
  </xsl:choose>
6910
+ </xsl:template>
6911
+
6912
+ <!-- add sourcecode highlighting -->
6913
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
6914
+ <xsl:variable name="class" select="@class"/>
6915
+ <xsl:choose>
6916
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
6917
+ <fo:inline>
6918
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
6919
+ <xsl:apply-templates/>
6920
+ </fo:inline>
6921
+ </xsl:when>
6922
+ <xsl:otherwise>
6923
+ <xsl:apply-templates/>
6924
+ </xsl:otherwise>
6925
+ </xsl:choose>
6926
+ </xsl:template>
6927
+
6928
+ <!-- outer table with line numbers for sourcecode -->
6929
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
6930
+ <fo:block>
6931
+ <fo:table width="100%" table-layout="fixed">
6932
+ <xsl:copy-of select="@id"/>
6933
+ <fo:table-column column-width="8%"/>
6934
+ <fo:table-column column-width="92%"/>
6935
+ <fo:table-body>
6936
+ <xsl:apply-templates/>
6937
+ </fo:table-body>
6938
+ </fo:table>
6939
+ </fo:block>
6940
+ </xsl:template>
6941
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
6942
+ <xsl:apply-templates/>
6943
+ </xsl:template>
6944
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
6945
+ <fo:table-row>
6946
+ <xsl:apply-templates/>
6947
+ </fo:table-row>
6948
+ </xsl:template>
6949
+ <!-- first td with line numbers -->
6950
+ <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'] -->
6951
+ <fo:table-cell>
6952
+ <fo:block>
6823
6953
 
6954
+ <!-- set attibutes for line numbers - same as sourcecode -->
6955
+ <xsl:variable name="sourcecode_attributes">
6956
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
6957
+ <xsl:call-template name="get_sourcecode_attributes"/>
6958
+ </xsl:for-each>
6959
+ </xsl:variable>
6960
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
6961
+ <xsl:attribute name="{local-name()}">
6962
+ <xsl:value-of select="."/>
6963
+ </xsl:attribute>
6964
+ </xsl:for-each>
6965
+
6966
+ <xsl:apply-templates/>
6967
+ </fo:block>
6968
+ </fo:table-cell>
6824
6969
  </xsl:template>
6825
6970
 
6971
+ <!-- second td with sourcecode -->
6972
+ <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'] -->
6973
+ <fo:table-cell>
6974
+ <fo:block>
6975
+ <xsl:apply-templates/>
6976
+ </fo:block>
6977
+ </fo:table-cell>
6978
+ </xsl:template>
6979
+ <!-- END outer table with line numbers for sourcecode -->
6980
+
6826
6981
  <xsl:template name="add_spaces_to_sourcecode">
6827
6982
  <xsl:variable name="text_step1">
6828
6983
  <xsl:call-template name="add-zero-spaces-equal"/>
@@ -7052,7 +7207,25 @@
7052
7207
  <xsl:template match="*[local-name()='pre']" name="pre">
7053
7208
  <fo:block xsl:use-attribute-sets="pre-style">
7054
7209
  <xsl:copy-of select="@id"/>
7055
- <xsl:apply-templates/>
7210
+ <xsl:choose>
7211
+
7212
+ <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' -->
7213
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
7214
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7215
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7216
+ </xsl:if>
7217
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
7218
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7219
+ <mtext><xsl:value-of select="."/></mtext>
7220
+ </math>
7221
+ </fo:instream-foreign-object>
7222
+ </xsl:when>
7223
+
7224
+ <xsl:otherwise>
7225
+ <xsl:apply-templates/>
7226
+ </xsl:otherwise>
7227
+
7228
+ </xsl:choose>
7056
7229
  </fo:block>
7057
7230
  </xsl:template>
7058
7231
  <!-- =============== -->
@@ -8511,17 +8684,17 @@
8511
8684
  <fo:block>
8512
8685
  <fo:inline>
8513
8686
 
8514
- <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
8515
- <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
8516
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
8517
- </xsl:if>
8518
-
8687
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8688
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
8689
+ </xsl:apply-templates>
8519
8690
  </fo:inline>
8520
8691
  </fo:block>
8521
8692
  </fo:list-item-label>
8522
8693
  <fo:list-item-body start-indent="body-start()">
8523
8694
  <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style">
8524
- <xsl:call-template name="processBibitem"/>
8695
+ <xsl:call-template name="processBibitem">
8696
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
8697
+ </xsl:call-template>
8525
8698
  </fo:block>
8526
8699
  </fo:list-item-body>
8527
8700
  </fo:list-item>
@@ -8530,176 +8703,51 @@
8530
8703
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8531
8704
 
8532
8705
  <xsl:template name="processBibitem">
8706
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8533
8707
 
8534
8708
  <!-- start bibitem processing -->
8535
8709
  <xsl:if test=".//*[local-name() = 'fn']">
8536
8710
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8537
8711
  </xsl:if>
8538
8712
 
8539
- <!-- display document identifier, not number [1] -->
8540
- <xsl:variable name="docidentifier">
8541
- <xsl:choose>
8542
- <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
8543
- <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
8544
- </xsl:choose>
8545
- </xsl:variable>
8546
- <xsl:value-of select="$docidentifier"/>
8547
-
8548
- <xsl:apply-templates select="*[local-name() = 'note']"/>
8549
-
8550
- <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
8551
- <xsl:text>,</xsl:text>
8552
- <xsl:text> </xsl:text>
8553
- </xsl:if>
8554
-
8713
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8714
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
8715
+ </xsl:apply-templates>
8555
8716
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8556
8717
  <!-- end bibitem processing -->
8557
8718
 
8558
8719
  </xsl:template> <!-- processBibitem (bibitem) -->
8559
8720
 
8560
- <xsl:template name="processBibitemDocId">
8561
- <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')]"/>
8562
- <xsl:choose>
8563
- <xsl:when test="normalize-space($_doc_ident) != ''">
8564
- <!-- <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"/>
8565
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8566
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8567
- </xsl:if> -->
8568
- <xsl:value-of select="$_doc_ident"/>
8569
- </xsl:when>
8570
- <xsl:otherwise>
8571
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8572
- <xsl:if test="$type != ''">
8573
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8574
- </xsl:if> -->
8575
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8576
- </xsl:otherwise>
8577
- </xsl:choose>
8578
- </xsl:template> <!-- processBibitemDocId -->
8721
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8722
+ <fo:inline><xsl:apply-templates/></fo:inline>
8723
+ </xsl:template>
8724
+
8725
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8726
+
8727
+ <xsl:template match="*[local-name() = 'formattedref']">
8728
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8729
+ <xsl:text>, </xsl:text>
8730
+ </xsl:if> -->
8731
+ <xsl:apply-templates/>
8732
+ </xsl:template>
8579
8733
 
8580
- <xsl:template name="processPersonalAuthor">
8734
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8735
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8581
8736
  <xsl:choose>
8582
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8583
- <author>
8584
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8585
- </author>
8737
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8738
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8586
8739
  </xsl:when>
8587
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8588
- <author>
8589
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8590
- <xsl:text> </xsl:text>
8591
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8592
- </author>
8593
- </xsl:when>
8594
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8595
- <author>
8596
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8597
- <xsl:text> </xsl:text>
8598
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8599
- </author>
8740
+ <xsl:when test="$biblio_tag_part = 'last'">
8741
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8600
8742
  </xsl:when>
8601
8743
  <xsl:otherwise>
8602
8744
  <xsl:apply-templates/>
8603
8745
  </xsl:otherwise>
8604
8746
  </xsl:choose>
8605
- </xsl:template> <!-- processPersonalAuthor -->
8606
-
8607
- <xsl:template name="renderDate">
8608
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8609
- <xsl:value-of select="*[local-name() = 'on']"/>
8610
- </xsl:if>
8611
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8612
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8613
- </xsl:if>
8614
- </xsl:template>
8615
-
8616
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8617
- <xsl:value-of select="translate(.,'. ','')"/>
8618
- </xsl:template>
8619
-
8620
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8621
- <xsl:value-of select="substring(.,1,1)"/>
8622
- </xsl:template>
8623
-
8624
- <xsl:template match="*[local-name() = 'title']" mode="title">
8625
- <fo:inline><xsl:apply-templates/></fo:inline>
8626
- </xsl:template>
8627
-
8628
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8629
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8630
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8631
- <xsl:apply-templates/>
8632
- </fo:inline>
8633
- </xsl:template>
8634
-
8635
- <!-- bibitem/note renders as footnote -->
8636
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8637
-
8638
- <!-- list of footnotes to calculate actual footnotes number -->
8639
- <xsl:variable name="p_fn_">
8640
- <xsl:call-template name="get_fn_list"/>
8641
- </xsl:variable>
8642
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8643
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8644
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8645
- <!-- fn sequence number in document -->
8646
- <xsl:variable name="current_fn_number">
8647
- <xsl:choose>
8648
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8649
- <xsl:otherwise>
8650
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8651
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8652
- </xsl:otherwise>
8653
- </xsl:choose>
8654
- </xsl:variable>
8655
- <fo:footnote>
8656
- <xsl:variable name="number">
8657
-
8658
- <xsl:value-of select="$current_fn_number"/>
8659
-
8660
- </xsl:variable>
8661
-
8662
- <xsl:variable name="current_fn_number_text">
8663
- <xsl:value-of select="$number"/>
8664
-
8665
- </xsl:variable>
8666
-
8667
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8668
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8669
- <xsl:value-of select="$current_fn_number_text"/>
8670
- </fo:basic-link>
8671
- </fo:inline>
8672
- <fo:footnote-body>
8673
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8674
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8675
- <xsl:value-of select="$current_fn_number_text"/>
8676
- </fo:inline>
8677
- <xsl:apply-templates/>
8678
- </fo:block>
8679
- </fo:footnote-body>
8680
- </fo:footnote>
8681
- </xsl:template>
8682
-
8683
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8684
- <xsl:text> edition </xsl:text>
8685
- <xsl:value-of select="."/>
8686
- </xsl:template>
8687
-
8688
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8689
- <xsl:text> (</xsl:text>
8690
- <fo:inline xsl:use-attribute-sets="link-style">
8691
- <fo:basic-link external-destination="." fox:alt-text=".">
8692
- <xsl:value-of select="."/>
8693
- </fo:basic-link>
8694
- </fo:inline>
8695
- <xsl:text>)</xsl:text>
8696
8747
  </xsl:template>
8697
8748
 
8698
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8699
-
8700
- <xsl:template match="*[local-name() = 'formattedref']">
8701
-
8702
- <xsl:apply-templates/>
8749
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
8750
+ <xsl:text> </xsl:text>
8703
8751
  </xsl:template>
8704
8752
 
8705
8753
  <!-- ======================= -->
@@ -9125,6 +9173,12 @@
9125
9173
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9126
9174
  <xsl:apply-templates mode="update_xml_step1"/>
9127
9175
  </xsl:template>
9176
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9177
+ <xsl:copy>
9178
+ <xsl:copy-of select="@*"/>
9179
+ <xsl:apply-templates mode="update_xml_step1"/>
9180
+ </xsl:copy>
9181
+ </xsl:template>
9128
9182
  <!-- =========================================================================== -->
9129
9183
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9130
9184
  <!-- =========================================================================== -->
@@ -9605,6 +9659,10 @@
9605
9659
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9606
9660
  </xsl:template>
9607
9661
 
9662
+ <xsl:template name="getDocumentId_fromCurrentNode">
9663
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9664
+ </xsl:template>
9665
+
9608
9666
  <xsl:template name="namespaceCheck">
9609
9667
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9610
9668
  <xsl:variable name="XSLNS">