metanorma-ogc 2.3.0 → 2.3.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 version="1.0" 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
 
@@ -1429,7 +1429,7 @@
1429
1429
 
1430
1430
  <xsl:attribute-set name="note-name-style">
1431
1431
 
1432
- <xsl:attribute name="padding-right">4mm</xsl:attribute>
1432
+ <!-- <xsl:attribute name="padding-right">4mm</xsl:attribute> -->
1433
1433
 
1434
1434
  </xsl:attribute-set>
1435
1435
 
@@ -1505,6 +1505,12 @@
1505
1505
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1506
1506
  </xsl:attribute-set>
1507
1507
 
1508
+ <xsl:attribute-set name="figure-block-style">
1509
+
1510
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1511
+
1512
+ </xsl:attribute-set>
1513
+
1508
1514
  <xsl:attribute-set name="figure-style">
1509
1515
 
1510
1516
  </xsl:attribute-set>
@@ -1517,7 +1523,7 @@
1517
1523
  <xsl:attribute name="font-weight">normal</xsl:attribute>
1518
1524
  <xsl:attribute name="font-style">italic</xsl:attribute>
1519
1525
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
1520
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1526
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1521
1527
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1522
1528
 
1523
1529
  </xsl:attribute-set>
@@ -2962,6 +2968,10 @@
2962
2968
  <xsl:with-param name="continued">true</xsl:with-param>
2963
2969
  </xsl:apply-templates>
2964
2970
 
2971
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
2972
+ <fo:block/>
2973
+ </xsl:if>
2974
+
2965
2975
  </fo:table-cell>
2966
2976
  </fo:table-row>
2967
2977
  </xsl:template> <!-- table-header-title -->
@@ -3315,7 +3325,7 @@
3315
3325
  </fn>
3316
3326
  -->
3317
3327
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
3318
- <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">
3328
+ <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">
3319
3329
 
3320
3330
  <!-- list of footnotes to calculate actual footnotes number -->
3321
3331
  <xsl:variable name="p_fn_">
@@ -3346,7 +3356,22 @@
3346
3356
 
3347
3357
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3348
3358
  <xsl:variable name="footnote_inline">
3349
- <fo:inline xsl:use-attribute-sets="fn-num-style">
3359
+ <fo:inline>
3360
+
3361
+ <xsl:variable name="fn_styles">
3362
+ <xsl:choose>
3363
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
3364
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
3365
+ </xsl:when>
3366
+ <xsl:otherwise>
3367
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
3368
+ </xsl:otherwise>
3369
+ </xsl:choose>
3370
+ </xsl:variable>
3371
+
3372
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
3373
+ <xsl:copy-of select="."/>
3374
+ </xsl:for-each>
3350
3375
 
3351
3376
  <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3352
3377
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -3357,8 +3382,7 @@
3357
3382
  </fo:basic-link>
3358
3383
  </fo:inline>
3359
3384
  </xsl:variable>
3360
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3361
- gen_id=<xsl:value-of select="$gen_id"/> -->
3385
+
3362
3386
  <xsl:choose>
3363
3387
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3364
3388
  <xsl:copy-of select="$footnote_inline"/>
@@ -3410,7 +3434,10 @@
3410
3434
  </xsl:for-each>
3411
3435
  <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']/*">
3412
3436
  <xsl:sort select="@displayorder" data-type="number"/>
3413
- <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])]">
3437
+ <!-- commented:
3438
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3439
+ because 'fn' there is in biblio-tag -->
3440
+ <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])]">
3414
3441
  <!-- copy unique fn -->
3415
3442
  <fn gen_id="{generate-id(.)}">
3416
3443
  <xsl:copy-of select="@*"/>
@@ -4270,7 +4297,7 @@
4270
4297
 
4271
4298
  <xsl:variable name="_font-size">
4272
4299
 
4273
- <!-- 10 -->
4300
+ <!-- inherit -->
4274
4301
 
4275
4302
  <xsl:choose>
4276
4303
  <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
@@ -5243,6 +5270,33 @@
5243
5270
  </xsl:choose>
5244
5271
  </xsl:template>
5245
5272
 
5273
+ <xsl:template name="getLang_fromCurrentNode">
5274
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5275
+ <xsl:variable name="language">
5276
+ <xsl:choose>
5277
+ <xsl:when test="$language_current != ''">
5278
+ <xsl:value-of select="$language_current"/>
5279
+ </xsl:when>
5280
+ <xsl:otherwise>
5281
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5282
+ <xsl:choose>
5283
+ <xsl:when test="$language_current_2 != ''">
5284
+ <xsl:value-of select="$language_current_2"/>
5285
+ </xsl:when>
5286
+ <xsl:otherwise>
5287
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5288
+ </xsl:otherwise>
5289
+ </xsl:choose>
5290
+ </xsl:otherwise>
5291
+ </xsl:choose>
5292
+ </xsl:variable>
5293
+
5294
+ <xsl:choose>
5295
+ <xsl:when test="$language = 'English'">en</xsl:when>
5296
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5297
+ </xsl:choose>
5298
+ </xsl:template>
5299
+
5246
5300
  <xsl:template name="capitalizeWords">
5247
5301
  <xsl:param name="str"/>
5248
5302
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -5863,7 +5917,7 @@
5863
5917
  <xsl:template match="*[local-name() = 'figure']" name="figure">
5864
5918
  <xsl:variable name="isAdded" select="@added"/>
5865
5919
  <xsl:variable name="isDeleted" select="@deleted"/>
5866
- <fo:block-container id="{@id}">
5920
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
5867
5921
 
5868
5922
  <xsl:call-template name="setTrackChangesStyles">
5869
5923
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -5941,7 +5995,9 @@
5941
5995
 
5942
5996
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
5943
5997
  <xsl:if test="number($scale) &lt; 100">
5944
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
5998
+
5999
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
6000
+
5945
6001
  </xsl:if>
5946
6002
 
5947
6003
  </xsl:if>
@@ -6844,7 +6900,13 @@
6844
6900
  </xsl:template>
6845
6901
 
6846
6902
  <xsl:template match="text()" mode="contents_item">
6847
- <xsl:call-template name="keep_together_standard_number"/>
6903
+ <xsl:variable name="text">
6904
+ <!-- to split by '_' and other chars -->
6905
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
6906
+ </xsl:variable>
6907
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
6908
+ <xsl:call-template name="keep_together_standard_number"/>
6909
+ </xsl:for-each>
6848
6910
  </xsl:template>
6849
6911
 
6850
6912
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -6855,39 +6917,57 @@
6855
6917
  <!-- =============== -->
6856
6918
  <!-- sourcecode -->
6857
6919
  <!-- =============== -->
6858
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6859
6920
 
6860
- <xsl:variable name="sourcecode_attributes">
6861
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6862
- <xsl:variable name="_font-size">
6921
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6922
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6923
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6863
6924
 
6864
- <!-- 9 -->
6925
+ <xsl:template match="*[local-name() = 'property']" mode="css">
6926
+ <xsl:attribute name="{@name}">
6927
+ <xsl:value-of select="@value"/>
6928
+ </xsl:attribute>
6929
+ </xsl:template>
6865
6930
 
6866
- <!-- <xsl:if test="$namespace = 'ieee'">
6867
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6868
- </xsl:if> -->
6931
+ <xsl:template name="get_sourcecode_attributes">
6932
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6933
+ <xsl:variable name="_font-size">
6869
6934
 
6870
- <xsl:choose>
6871
- <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
6872
- <xsl:otherwise>9.5</xsl:otherwise>
6873
- </xsl:choose>
6935
+ <!-- inherit -->
6874
6936
 
6875
- </xsl:variable>
6937
+ <!-- <xsl:if test="$namespace = 'ieee'">
6938
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
6939
+ </xsl:if> -->
6876
6940
 
6877
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6878
- <xsl:if test="$font-size != ''">
6879
- <xsl:attribute name="font-size">
6880
- <xsl:choose>
6881
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6882
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6883
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6884
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6885
- </xsl:choose>
6886
- </xsl:attribute>
6887
- </xsl:if>
6888
- </xsl:element>
6941
+ <xsl:choose>
6942
+ <xsl:when test="ancestor::*[local-name() = 'table'][not(parent::*[local-name() = 'sourcecode'][@linenums = 'true'])]">8.5</xsl:when>
6943
+ <xsl:otherwise>9.5</xsl:otherwise>
6944
+ </xsl:choose>
6945
+
6946
+ </xsl:variable>
6947
+
6948
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6949
+ <xsl:if test="$font-size != ''">
6950
+ <xsl:attribute name="font-size">
6951
+ <xsl:choose>
6952
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6953
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6954
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6955
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6956
+ </xsl:choose>
6957
+ </xsl:attribute>
6958
+ </xsl:if>
6959
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
6960
+ </xsl:element>
6961
+ </xsl:template>
6962
+
6963
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6964
+
6965
+ <xsl:variable name="sourcecode_attributes">
6966
+ <xsl:call-template name="get_sourcecode_attributes"/>
6889
6967
  </xsl:variable>
6890
6968
 
6969
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
6970
+
6891
6971
  <xsl:choose>
6892
6972
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6893
6973
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -6930,6 +7010,12 @@
6930
7010
  </xsl:attribute>
6931
7011
  </xsl:for-each>
6932
7012
 
7013
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
7014
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
7015
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7016
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7017
+ </xsl:if>
7018
+
6933
7019
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6934
7020
  </fo:block>
6935
7021
 
@@ -6941,9 +7027,10 @@
6941
7027
  </xsl:choose>
6942
7028
  </xsl:template>
6943
7029
 
6944
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
7030
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
6945
7031
  <xsl:choose>
6946
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7032
+ <!-- disabled -->
7033
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6947
7034
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6948
7035
  <xsl:choose>
6949
7036
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -6958,8 +7045,76 @@
6958
7045
  <xsl:call-template name="add_spaces_to_sourcecode"/>
6959
7046
  </xsl:otherwise>
6960
7047
  </xsl:choose>
7048
+ </xsl:template>
7049
+
7050
+ <!-- add sourcecode highlighting -->
7051
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7052
+ <xsl:variable name="class" select="@class"/>
7053
+ <xsl:choose>
7054
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
7055
+ <fo:inline>
7056
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7057
+ <xsl:apply-templates/>
7058
+ </fo:inline>
7059
+ </xsl:when>
7060
+ <xsl:otherwise>
7061
+ <xsl:apply-templates/>
7062
+ </xsl:otherwise>
7063
+ </xsl:choose>
7064
+ </xsl:template>
7065
+
7066
+ <!-- outer table with line numbers for sourcecode -->
7067
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
7068
+ <fo:block>
7069
+ <fo:table width="100%" table-layout="fixed">
7070
+ <xsl:copy-of select="@id"/>
7071
+ <fo:table-column column-width="8%"/>
7072
+ <fo:table-column column-width="92%"/>
7073
+ <fo:table-body>
7074
+ <xsl:apply-templates/>
7075
+ </fo:table-body>
7076
+ </fo:table>
7077
+ </fo:block>
7078
+ </xsl:template>
7079
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
7080
+ <xsl:apply-templates/>
7081
+ </xsl:template>
7082
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
7083
+ <fo:table-row>
7084
+ <xsl:apply-templates/>
7085
+ </fo:table-row>
7086
+ </xsl:template>
7087
+ <!-- first td with line numbers -->
7088
+ <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'] -->
7089
+ <fo:table-cell>
7090
+ <fo:block>
7091
+
7092
+ <!-- set attibutes for line numbers - same as sourcecode -->
7093
+ <xsl:variable name="sourcecode_attributes">
7094
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
7095
+ <xsl:call-template name="get_sourcecode_attributes"/>
7096
+ </xsl:for-each>
7097
+ </xsl:variable>
7098
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
7099
+ <xsl:attribute name="{local-name()}">
7100
+ <xsl:value-of select="."/>
7101
+ </xsl:attribute>
7102
+ </xsl:for-each>
7103
+
7104
+ <xsl:apply-templates/>
7105
+ </fo:block>
7106
+ </fo:table-cell>
7107
+ </xsl:template>
6961
7108
 
7109
+ <!-- second td with sourcecode -->
7110
+ <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'] -->
7111
+ <fo:table-cell>
7112
+ <fo:block>
7113
+ <xsl:apply-templates/>
7114
+ </fo:block>
7115
+ </fo:table-cell>
6962
7116
  </xsl:template>
7117
+ <!-- END outer table with line numbers for sourcecode -->
6963
7118
 
6964
7119
  <xsl:template name="add_spaces_to_sourcecode">
6965
7120
  <xsl:variable name="text_step1">
@@ -7190,7 +7345,25 @@
7190
7345
  <xsl:template match="*[local-name()='pre']" name="pre">
7191
7346
  <fo:block xsl:use-attribute-sets="pre-style">
7192
7347
  <xsl:copy-of select="@id"/>
7193
- <xsl:apply-templates/>
7348
+ <xsl:choose>
7349
+
7350
+ <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' -->
7351
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
7352
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7353
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7354
+ </xsl:if>
7355
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
7356
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7357
+ <mtext><xsl:value-of select="."/></mtext>
7358
+ </math>
7359
+ </fo:instream-foreign-object>
7360
+ </xsl:when>
7361
+
7362
+ <xsl:otherwise>
7363
+ <xsl:apply-templates/>
7364
+ </xsl:otherwise>
7365
+
7366
+ </xsl:choose>
7194
7367
  </fo:block>
7195
7368
  </xsl:template>
7196
7369
  <!-- =============== -->
@@ -7897,6 +8070,7 @@
7897
8070
  <xsl:variable name="padding">
7898
8071
 
7899
8072
  <xsl:choose>
8073
+ <xsl:when test="ancestor::*[local-name() = 'note'] and ancestor::*[local-name() = 'name']">4</xsl:when>
7900
8074
  <xsl:when test="$depth &gt;= 5"/>
7901
8075
  <xsl:when test="$depth &gt;= 4">5</xsl:when>
7902
8076
  <xsl:when test="$depth &gt;= 3 and ancestor::ogc:terms">3</xsl:when>
@@ -8665,17 +8839,17 @@
8665
8839
  <fo:block>
8666
8840
  <fo:inline>
8667
8841
 
8668
- <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
8669
- <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
8670
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
8671
- </xsl:if>
8672
-
8842
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8843
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
8844
+ </xsl:apply-templates>
8673
8845
  </fo:inline>
8674
8846
  </fo:block>
8675
8847
  </fo:list-item-label>
8676
8848
  <fo:list-item-body start-indent="body-start()">
8677
8849
  <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style">
8678
- <xsl:call-template name="processBibitem"/>
8850
+ <xsl:call-template name="processBibitem">
8851
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
8852
+ </xsl:call-template>
8679
8853
  </fo:block>
8680
8854
  </fo:list-item-body>
8681
8855
  </fo:list-item>
@@ -8684,166 +8858,51 @@
8684
8858
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8685
8859
 
8686
8860
  <xsl:template name="processBibitem">
8861
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8687
8862
 
8688
- <!-- start OGC bibitem processing -->
8689
- <xsl:if test=".//ogc:fn">
8863
+ <!-- start bibitem processing -->
8864
+ <xsl:if test=".//*[local-name() = 'fn']">
8690
8865
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8691
8866
  </xsl:if>
8867
+
8868
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8869
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
8870
+ </xsl:apply-templates>
8692
8871
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8693
- <!-- end OGC bibitem processing-->
8872
+ <!-- end bibitem processing -->
8694
8873
 
8695
8874
  </xsl:template> <!-- processBibitem (bibitem) -->
8696
8875
 
8697
- <xsl:template name="processBibitemDocId">
8698
- <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')]"/>
8699
- <xsl:choose>
8700
- <xsl:when test="normalize-space($_doc_ident) != ''">
8701
- <!-- <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"/>
8702
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8703
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8704
- </xsl:if> -->
8705
- <xsl:value-of select="$_doc_ident"/>
8706
- </xsl:when>
8707
- <xsl:otherwise>
8708
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8709
- <xsl:if test="$type != ''">
8710
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8711
- </xsl:if> -->
8712
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8713
- </xsl:otherwise>
8714
- </xsl:choose>
8715
- </xsl:template> <!-- processBibitemDocId -->
8876
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8877
+ <fo:inline><xsl:apply-templates/></fo:inline>
8878
+ </xsl:template>
8879
+
8880
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8881
+
8882
+ <xsl:template match="*[local-name() = 'formattedref']">
8883
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8884
+ <xsl:text>, </xsl:text>
8885
+ </xsl:if> -->
8886
+ <xsl:apply-templates/>
8887
+ </xsl:template>
8716
8888
 
8717
- <xsl:template name="processPersonalAuthor">
8889
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8890
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8718
8891
  <xsl:choose>
8719
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8720
- <author>
8721
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8722
- </author>
8892
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8893
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8723
8894
  </xsl:when>
8724
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8725
- <author>
8726
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8727
- <xsl:text> </xsl:text>
8728
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8729
- </author>
8730
- </xsl:when>
8731
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8732
- <author>
8733
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8734
- <xsl:text> </xsl:text>
8735
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8736
- </author>
8895
+ <xsl:when test="$biblio_tag_part = 'last'">
8896
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8737
8897
  </xsl:when>
8738
8898
  <xsl:otherwise>
8739
8899
  <xsl:apply-templates/>
8740
8900
  </xsl:otherwise>
8741
8901
  </xsl:choose>
8742
- </xsl:template> <!-- processPersonalAuthor -->
8743
-
8744
- <xsl:template name="renderDate">
8745
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8746
- <xsl:value-of select="*[local-name() = 'on']"/>
8747
- </xsl:if>
8748
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8749
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8750
- </xsl:if>
8751
- </xsl:template>
8752
-
8753
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8754
- <xsl:value-of select="translate(.,'. ','')"/>
8755
8902
  </xsl:template>
8756
8903
 
8757
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8758
- <xsl:value-of select="substring(.,1,1)"/>
8759
- </xsl:template>
8760
-
8761
- <xsl:template match="*[local-name() = 'title']" mode="title">
8762
- <fo:inline><xsl:apply-templates/></fo:inline>
8763
- </xsl:template>
8764
-
8765
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8766
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8767
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8768
- <xsl:apply-templates/>
8769
- </fo:inline>
8770
- </xsl:template>
8771
-
8772
- <!-- bibitem/note renders as footnote -->
8773
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8774
-
8775
- <!-- list of footnotes to calculate actual footnotes number -->
8776
- <xsl:variable name="p_fn_">
8777
- <xsl:call-template name="get_fn_list"/>
8778
- </xsl:variable>
8779
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8780
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8781
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8782
- <!-- fn sequence number in document -->
8783
- <xsl:variable name="current_fn_number">
8784
- <xsl:choose>
8785
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8786
- <xsl:otherwise>
8787
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8788
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8789
- </xsl:otherwise>
8790
- </xsl:choose>
8791
- </xsl:variable>
8792
- <fo:footnote>
8793
- <xsl:variable name="number">
8794
-
8795
- <xsl:choose>
8796
- <xsl:when test="ancestor::*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]">
8797
- <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
8798
- </xsl:when>
8799
- <xsl:otherwise>
8800
- <xsl:value-of select="$current_fn_number"/>
8801
- </xsl:otherwise>
8802
- </xsl:choose>
8803
-
8804
- </xsl:variable>
8805
-
8806
- <xsl:variable name="current_fn_number_text">
8807
- <xsl:value-of select="$number"/>
8808
-
8809
- </xsl:variable>
8810
-
8811
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8812
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8813
- <xsl:value-of select="$current_fn_number_text"/>
8814
- </fo:basic-link>
8815
- </fo:inline>
8816
- <fo:footnote-body>
8817
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8818
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8819
- <xsl:value-of select="$current_fn_number_text"/>
8820
- </fo:inline>
8821
- <xsl:apply-templates/>
8822
- </fo:block>
8823
- </fo:footnote-body>
8824
- </fo:footnote>
8825
- </xsl:template>
8826
-
8827
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8828
- <xsl:text> edition </xsl:text>
8829
- <xsl:value-of select="."/>
8830
- </xsl:template>
8831
-
8832
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8833
- <xsl:text> (</xsl:text>
8834
- <fo:inline xsl:use-attribute-sets="link-style">
8835
- <fo:basic-link external-destination="." fox:alt-text=".">
8836
- <xsl:value-of select="."/>
8837
- </fo:basic-link>
8838
- </fo:inline>
8839
- <xsl:text>)</xsl:text>
8840
- </xsl:template>
8841
-
8842
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8843
-
8844
- <xsl:template match="*[local-name() = 'formattedref']">
8845
-
8846
- <xsl:apply-templates/>
8904
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
8905
+ <xsl:text> </xsl:text>
8847
8906
  </xsl:template>
8848
8907
 
8849
8908
  <!-- ======================= -->
@@ -9272,6 +9331,12 @@
9272
9331
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9273
9332
  <xsl:apply-templates mode="update_xml_step1"/>
9274
9333
  </xsl:template>
9334
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9335
+ <xsl:copy>
9336
+ <xsl:copy-of select="@*"/>
9337
+ <xsl:apply-templates mode="update_xml_step1"/>
9338
+ </xsl:copy>
9339
+ </xsl:template>
9275
9340
  <!-- =========================================================================== -->
9276
9341
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9277
9342
  <!-- =========================================================================== -->
@@ -9752,6 +9817,10 @@
9752
9817
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9753
9818
  </xsl:template>
9754
9819
 
9820
+ <xsl:template name="getDocumentId_fromCurrentNode">
9821
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9822
+ </xsl:template>
9823
+
9755
9824
  <xsl:template name="namespaceCheck">
9756
9825
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9757
9826
  <xsl:variable name="XSLNS">