metanorma-ieee 0.1.3 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -77,7 +77,7 @@
77
77
  <xsl:variable name="current_template">
78
78
  <xsl:choose>
79
79
  <xsl:when test="($doctype = 'standard' or $doctype = 'guide' or $doctype = 'recommended-practice') and $stage = 'draft'">draft</xsl:when>
80
- <xsl:when test="($doctype = 'standard' or $doctype = 'guide' or $doctype = 'recommended-practice') and $stage = 'published'">standard</xsl:when>
80
+ <xsl:when test="($doctype = 'standard' or $doctype = 'guide' or $doctype = 'recommended-practice') and ($stage = 'published' or $stage = 'approved')">standard</xsl:when>
81
81
  <xsl:otherwise><xsl:value-of select="$doctype"/></xsl:otherwise>
82
82
  </xsl:choose>
83
83
  </xsl:variable>
@@ -768,7 +768,7 @@
768
768
  </fo:block>
769
769
  </fo:flow>
770
770
  </fo:page-sequence>
771
- </xsl:when> <!-- $stage = 'published' -->
771
+ </xsl:when> <!-- $current_template = 'standard' -->
772
772
 
773
773
  <xsl:when test="$current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report'">
774
774
  <fo:page-sequence master-reference="document-nonstandard" force-page-count="no-force" font-family="Calibri Light">
@@ -873,7 +873,7 @@
873
873
  </fo:block>
874
874
 
875
875
  <fo:block font-family="Arial" font-size="12pt" role="H1" font-weight="bold" margin-top="12pt" margin-bottom="24pt">
876
- <xsl:if test="$stage = 'published'">
876
+ <xsl:if test="$stage = 'published' or $stage = 'approved'">
877
877
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
878
878
  </xsl:if>
879
879
  <!-- Contents -->
@@ -944,7 +944,7 @@
944
944
 
945
945
  </xsl:when> <!-- $stage = 'draft' -->
946
946
 
947
- <xsl:when test="$stage = 'published'">
947
+ <xsl:when test="$stage = 'published' or $stage = 'approved'">
948
948
 
949
949
  <xsl:variable name="provisional-distance-between-starts">10</xsl:variable>
950
950
 
@@ -1016,7 +1016,7 @@
1016
1016
  </xsl:for-each>
1017
1017
  </xsl:if>
1018
1018
 
1019
- </xsl:when> <!-- $stage = 'published' -->
1019
+ </xsl:when> <!-- $stage = 'published' or 'approved' -->
1020
1020
  </xsl:choose>
1021
1021
 
1022
1022
  </xsl:if>
@@ -1513,15 +1513,15 @@
1513
1513
  </fo:table>
1514
1514
  </fo:block>
1515
1515
 
1516
- <xsl:if test="following-sibling::*[not(@type = 'officemember' or @type = 'emeritus_sign')]">
1517
- <fo:block font-size="10pt" space-after="12pt"> </fo:block>
1516
+ <xsl:if test="following-sibling::*[1][not(@type = 'officemember' or @type = 'emeritus_sign')]">
1517
+ <fo:block font-size="10pt" space-after="12pt" keep-with-previous="always"> </fo:block>
1518
1518
  </xsl:if>
1519
1519
  </xsl:when> <!-- @type = 'officemember' -->
1520
1520
 
1521
1521
  <xsl:when test="@type = 'officemember' and preceding-sibling::*[1][self::ieee:p][@type = 'officemember']"><!-- skip --></xsl:when>
1522
1522
 
1523
1523
  <xsl:when test="@type = 'emeritus_sign'">
1524
- <fo:block font-size="9pt" margin-left="9.4mm">
1524
+ <fo:block font-size="9pt" margin-left="9.4mm" space-before="6pt" space-after="12pt" keep-with-previous="always">
1525
1525
  <xsl:apply-templates/>
1526
1526
  </fo:block>
1527
1527
  </xsl:when>
@@ -2108,25 +2108,25 @@
2108
2108
  </xsl:copy>
2109
2109
  </xsl:template>
2110
2110
 
2111
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" mode="flatxml">
2111
+ <!-- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" mode="flatxml">
2112
2112
  <xsl:variable name="p_fn_">
2113
2113
  <xsl:call-template name="get_fn_list"/>
2114
2114
  </xsl:variable>
2115
2115
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2116
2116
  <xsl:variable name="gen_id" select="generate-id(.)"/>
2117
2117
  <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
2118
- <xsl:variable name="reference" select="@reference"/> <!-- @reference added to bibitem/note in step 'update_xml_step2' -->
2118
+ <xsl:variable name="reference" select="@reference"/> --><!-- @reference added to bibitem/note in step 'update_xml_step2' -->
2119
2119
  <!-- fn sequence number in document -->
2120
- <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
2120
+ <!-- <xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" />
2121
2121
  <xsl:copy>
2122
- <xsl:apply-templates select="@*" mode="flatxml"/>
2122
+ <xsl:apply-templates select="@*" mode="flatxml"/> -->
2123
2123
  <!-- put actual reference number -->
2124
- <xsl:attribute name="current_fn_number">
2124
+ <!-- <xsl:attribute name="current_fn_number">
2125
2125
  <xsl:value-of select="$current_fn_number"/>
2126
2126
  </xsl:attribute>
2127
2127
  <xsl:apply-templates select="node()" mode="flatxml"/>
2128
2128
  </xsl:copy>
2129
- </xsl:template>
2129
+ </xsl:template> -->
2130
2130
 
2131
2131
  <xsl:template match="ieee:p[@type = 'section-title']" priority="3" mode="flatxml">
2132
2132
  <xsl:copy>
@@ -4548,6 +4548,12 @@
4548
4548
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4549
4549
  </xsl:attribute-set>
4550
4550
 
4551
+ <xsl:attribute-set name="figure-block-style">
4552
+
4553
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4554
+
4555
+ </xsl:attribute-set>
4556
+
4551
4557
  <xsl:attribute-set name="figure-style">
4552
4558
 
4553
4559
  </xsl:attribute-set>
@@ -4558,7 +4564,7 @@
4558
4564
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4559
4565
  <xsl:attribute name="text-align">center</xsl:attribute>
4560
4566
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
4561
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4567
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
4562
4568
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
4563
4569
 
4564
4570
  </xsl:attribute-set>
@@ -6404,7 +6410,26 @@
6404
6410
 
6405
6411
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
6406
6412
  <xsl:variable name="footnote_inline">
6407
- <fo:inline xsl:use-attribute-sets="fn-num-style">
6413
+ <fo:inline>
6414
+
6415
+ <xsl:variable name="fn_styles">
6416
+ <xsl:choose>
6417
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
6418
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
6419
+ </xsl:when>
6420
+ <xsl:otherwise>
6421
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
6422
+ </xsl:otherwise>
6423
+ </xsl:choose>
6424
+ </xsl:variable>
6425
+
6426
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
6427
+ <xsl:copy-of select="."/>
6428
+ </xsl:for-each>
6429
+
6430
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
6431
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
6432
+ </xsl:if>
6408
6433
 
6409
6434
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
6410
6435
  <xsl:value-of select="$current_fn_number_text"/>
@@ -6473,7 +6498,10 @@
6473
6498
  </xsl:for-each>
6474
6499
  <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']/*">
6475
6500
  <xsl:sort select="@displayorder" data-type="number"/>
6476
- <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])]">
6501
+ <!-- commented:
6502
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
6503
+ because 'fn' there is in biblio-tag -->
6504
+ <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])]">
6477
6505
  <!-- copy unique fn -->
6478
6506
  <fn gen_id="{generate-id(.)}">
6479
6507
  <xsl:copy-of select="@*"/>
@@ -7322,7 +7350,7 @@
7322
7350
 
7323
7351
  <xsl:variable name="_font-size">
7324
7352
 
7325
- <!-- 10 -->
7353
+ <!-- inherit -->
7326
7354
 
7327
7355
  </xsl:variable>
7328
7356
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -7563,6 +7591,23 @@
7563
7591
  <xsl:apply-templates/>
7564
7592
  </xsl:template>
7565
7593
 
7594
+ <!-- Don't break standard's numbers -->
7595
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
7596
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
7597
+ <xsl:choose>
7598
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
7599
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
7600
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
7601
+ </xsl:when>
7602
+ <xsl:otherwise>
7603
+ <xsl:apply-templates/>
7604
+ </xsl:otherwise>
7605
+ </xsl:choose>
7606
+ </xsl:template>
7607
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
7608
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
7609
+ </xsl:template>
7610
+
7566
7611
  <!-- ========================= -->
7567
7612
  <!-- END Rich text formatting -->
7568
7613
  <!-- ========================= -->
@@ -7958,7 +8003,7 @@
7958
8003
  <xsl:choose>
7959
8004
  <xsl:when test="@colspan">
7960
8005
  <xsl:variable name="td">
7961
- <xsl:element name="td">
8006
+ <xsl:element name="{local-name()}">
7962
8007
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
7963
8008
  <xsl:if test="local-name()='th'">
7964
8009
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -7973,7 +8018,7 @@
7973
8018
  </xsl:call-template>
7974
8019
  </xsl:when>
7975
8020
  <xsl:otherwise>
7976
- <xsl:element name="td">
8021
+ <xsl:element name="{local-name()}">
7977
8022
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
7978
8023
  <xsl:if test="local-name()='th'">
7979
8024
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -8040,7 +8085,7 @@
8040
8085
  <xsl:variable name="currentRow" select="."/>
8041
8086
 
8042
8087
  <xsl:variable name="normalizedTDs">
8043
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
8088
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
8044
8089
  <xsl:choose>
8045
8090
  <xsl:when test="@rowspan &gt; 1">
8046
8091
  <xsl:copy>
@@ -8052,7 +8097,7 @@
8052
8097
  </xsl:copy>
8053
8098
  </xsl:when>
8054
8099
  <xsl:otherwise>
8055
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
8100
+ <xsl:copy-of select="$currentRow/*[self::td or self::th][1 + count(current()/preceding-sibling::*[self::td or self::th][not(@rowspan) or (@rowspan = 1)])]"/>
8056
8101
  </xsl:otherwise>
8057
8102
  </xsl:choose>
8058
8103
  </xsl:for-each>
@@ -8273,6 +8318,33 @@
8273
8318
  </xsl:choose>
8274
8319
  </xsl:template>
8275
8320
 
8321
+ <xsl:template name="getLang_fromCurrentNode">
8322
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
8323
+ <xsl:variable name="language">
8324
+ <xsl:choose>
8325
+ <xsl:when test="$language_current != ''">
8326
+ <xsl:value-of select="$language_current"/>
8327
+ </xsl:when>
8328
+ <xsl:otherwise>
8329
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
8330
+ <xsl:choose>
8331
+ <xsl:when test="$language_current_2 != ''">
8332
+ <xsl:value-of select="$language_current_2"/>
8333
+ </xsl:when>
8334
+ <xsl:otherwise>
8335
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
8336
+ </xsl:otherwise>
8337
+ </xsl:choose>
8338
+ </xsl:otherwise>
8339
+ </xsl:choose>
8340
+ </xsl:variable>
8341
+
8342
+ <xsl:choose>
8343
+ <xsl:when test="$language = 'English'">en</xsl:when>
8344
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
8345
+ </xsl:choose>
8346
+ </xsl:template>
8347
+
8276
8348
  <xsl:template name="capitalizeWords">
8277
8349
  <xsl:param name="str"/>
8278
8350
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -8736,12 +8808,6 @@
8736
8808
 
8737
8809
  <fo:block-container margin-left="0mm">
8738
8810
 
8739
- <!-- <xsl:if test="$namespace = 'iho'">
8740
- <xsl:if test="ancestor::iho:td">
8741
- <xsl:attribute name="font-size">12pt</xsl:attribute>
8742
- </xsl:if>
8743
- </xsl:if> -->
8744
-
8745
8811
  <fo:block>
8746
8812
 
8747
8813
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -8913,7 +8979,7 @@
8913
8979
  <xsl:template match="*[local-name() = 'figure']" name="figure">
8914
8980
  <xsl:variable name="isAdded" select="@added"/>
8915
8981
  <xsl:variable name="isDeleted" select="@deleted"/>
8916
- <fo:block-container id="{@id}">
8982
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
8917
8983
 
8918
8984
  <xsl:call-template name="setTrackChangesStyles">
8919
8985
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -9249,6 +9315,31 @@
9249
9315
  <xsl:apply-templates mode="svg_update"/>
9250
9316
  </xsl:copy>
9251
9317
  </xsl:template>
9318
+
9319
+ <!-- regex for 'display: inline-block;' -->
9320
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
9321
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
9322
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
9323
+ </xsl:template>
9324
+
9325
+ <!-- replace
9326
+ stroke="rgba(r, g, b, alpha)" to
9327
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
9328
+ fill="rgba(r, g, b, alpha)" to
9329
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
9330
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
9331
+ <xsl:variable name="components_">
9332
+ <xsl:call-template name="split">
9333
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
9334
+ <xsl:with-param name="sep" select="','"/>
9335
+ </xsl:call-template>
9336
+ </xsl:variable>
9337
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
9338
+ <xsl:variable name="att_name" select="local-name()"/>
9339
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
9340
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
9341
+ </xsl:template>
9342
+
9252
9343
  <!-- ============== -->
9253
9344
  <!-- END: svg_update -->
9254
9345
  <!-- ============== -->
@@ -9879,7 +9970,13 @@
9879
9970
  </xsl:template>
9880
9971
 
9881
9972
  <xsl:template match="text()" mode="contents_item">
9882
- <xsl:call-template name="keep_together_standard_number"/>
9973
+ <xsl:variable name="text">
9974
+ <!-- to split by '_' and other chars -->
9975
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
9976
+ </xsl:variable>
9977
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
9978
+ <xsl:call-template name="keep_together_standard_number"/>
9979
+ </xsl:for-each>
9883
9980
  </xsl:template>
9884
9981
 
9885
9982
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -9890,34 +9987,52 @@
9890
9987
  <!-- =============== -->
9891
9988
  <!-- sourcecode -->
9892
9989
  <!-- =============== -->
9893
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
9894
9990
 
9895
- <xsl:variable name="sourcecode_attributes">
9896
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
9897
- <xsl:variable name="_font-size">
9991
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
9992
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
9993
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
9898
9994
 
9899
- <!-- 9 -->
9995
+ <xsl:template match="*[local-name() = 'property']" mode="css">
9996
+ <xsl:attribute name="{@name}">
9997
+ <xsl:value-of select="@value"/>
9998
+ </xsl:attribute>
9999
+ </xsl:template>
9900
10000
 
9901
- <!-- <xsl:if test="$namespace = 'ieee'">
9902
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
9903
- </xsl:if> -->
10001
+ <xsl:template name="get_sourcecode_attributes">
10002
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
10003
+ <xsl:variable name="_font-size">
9904
10004
 
9905
- </xsl:variable>
10005
+ <!-- inherit -->
9906
10006
 
9907
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
9908
- <xsl:if test="$font-size != ''">
9909
- <xsl:attribute name="font-size">
9910
- <xsl:choose>
9911
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
9912
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
9913
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
9914
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
9915
- </xsl:choose>
9916
- </xsl:attribute>
9917
- </xsl:if>
9918
- </xsl:element>
10007
+ <!-- <xsl:if test="$namespace = 'ieee'">
10008
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
10009
+ </xsl:if> -->
10010
+
10011
+ </xsl:variable>
10012
+
10013
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
10014
+ <xsl:if test="$font-size != ''">
10015
+ <xsl:attribute name="font-size">
10016
+ <xsl:choose>
10017
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
10018
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
10019
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
10020
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
10021
+ </xsl:choose>
10022
+ </xsl:attribute>
10023
+ </xsl:if>
10024
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
10025
+ </xsl:element>
10026
+ </xsl:template>
10027
+
10028
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
10029
+
10030
+ <xsl:variable name="sourcecode_attributes">
10031
+ <xsl:call-template name="get_sourcecode_attributes"/>
9919
10032
  </xsl:variable>
9920
10033
 
10034
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
10035
+
9921
10036
  <xsl:choose>
9922
10037
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
9923
10038
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -9971,9 +10086,10 @@
9971
10086
  </xsl:choose>
9972
10087
  </xsl:template>
9973
10088
 
9974
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
10089
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
9975
10090
  <xsl:choose>
9976
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
10091
+ <!-- disabled -->
10092
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
9977
10093
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
9978
10094
  <xsl:choose>
9979
10095
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -9988,8 +10104,75 @@
9988
10104
  <xsl:call-template name="add_spaces_to_sourcecode"/>
9989
10105
  </xsl:otherwise>
9990
10106
  </xsl:choose>
10107
+ </xsl:template>
10108
+
10109
+ <!-- add sourcecode highlighting -->
10110
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
10111
+ <xsl:variable name="class" select="@class"/>
10112
+ <xsl:choose>
10113
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
10114
+ <fo:inline>
10115
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
10116
+ <xsl:apply-templates/>
10117
+ </fo:inline>
10118
+ </xsl:when>
10119
+ <xsl:otherwise>
10120
+ <xsl:apply-templates/>
10121
+ </xsl:otherwise>
10122
+ </xsl:choose>
10123
+ </xsl:template>
10124
+
10125
+ <!-- outer table with line numbers for sourcecode -->
10126
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
10127
+ <fo:block>
10128
+ <fo:table width="100%" table-layout="fixed">
10129
+ <xsl:copy-of select="@id"/>
10130
+ <fo:table-column column-width="8%"/>
10131
+ <fo:table-column column-width="92%"/>
10132
+ <fo:table-body>
10133
+ <xsl:apply-templates/>
10134
+ </fo:table-body>
10135
+ </fo:table>
10136
+ </fo:block>
10137
+ </xsl:template>
10138
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
10139
+ <xsl:apply-templates/>
10140
+ </xsl:template>
10141
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
10142
+ <fo:table-row>
10143
+ <xsl:apply-templates/>
10144
+ </fo:table-row>
10145
+ </xsl:template>
10146
+ <!-- first td with line numbers -->
10147
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
10148
+ <fo:table-cell>
10149
+ <fo:block>
10150
+
10151
+ <!-- set attibutes for line numbers - same as sourcecode -->
10152
+ <xsl:variable name="sourcecode_attributes">
10153
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
10154
+ <xsl:call-template name="get_sourcecode_attributes"/>
10155
+ </xsl:for-each>
10156
+ </xsl:variable>
10157
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
10158
+ <xsl:attribute name="{local-name()}">
10159
+ <xsl:value-of select="."/>
10160
+ </xsl:attribute>
10161
+ </xsl:for-each>
9991
10162
 
10163
+ <xsl:apply-templates/>
10164
+ </fo:block>
10165
+ </fo:table-cell>
10166
+ </xsl:template>
10167
+ <!-- second td with sourcecode -->
10168
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
10169
+ <fo:table-cell>
10170
+ <fo:block>
10171
+ <xsl:apply-templates/>
10172
+ </fo:block>
10173
+ </fo:table-cell>
9992
10174
  </xsl:template>
10175
+ <!-- END outer table with line numbers for sourcecode -->
9993
10176
 
9994
10177
  <xsl:template name="add_spaces_to_sourcecode">
9995
10178
  <xsl:variable name="text_step1">
@@ -11684,31 +11867,21 @@
11684
11867
  <fo:block>
11685
11868
  <fo:inline>
11686
11869
 
11687
- <xsl:value-of select="*[local-name() = 'docidentifier'][@type = 'metanorma-ordinal']"/>
11688
- <xsl:if test="not(*[local-name() = 'docidentifier'][@type = 'metanorma-ordinal'])">
11689
- <xsl:choose>
11690
- <xsl:when test="($current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report')">
11691
- <fo:inline color="{$color_blue}">
11692
- <xsl:text>[ </xsl:text>
11693
- <xsl:number format="1" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
11694
- <xsl:text> ]</xsl:text>
11695
- </fo:inline>
11696
- </xsl:when>
11697
- <xsl:otherwise>
11698
- <xsl:text>[B</xsl:text>
11699
- <xsl:number format="1" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
11700
- <xsl:text>]</xsl:text>
11701
- </xsl:otherwise>
11702
- </xsl:choose>
11703
- </xsl:if>
11704
- <!-- ieee -->
11870
+ <xsl:if test="($current_template = 'whitepaper' or $current_template = 'icap-whitepaper' or $current_template = 'industry-connection-report')">
11871
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
11872
+ </xsl:if>
11705
11873
 
11874
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
11875
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
11876
+ </xsl:apply-templates>
11706
11877
  </fo:inline>
11707
11878
  </fo:block>
11708
11879
  </fo:list-item-label>
11709
11880
  <fo:list-item-body start-indent="body-start()">
11710
11881
  <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style">
11711
- <xsl:call-template name="processBibitem"/>
11882
+ <xsl:call-template name="processBibitem">
11883
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
11884
+ </xsl:call-template>
11712
11885
  </fo:block>
11713
11886
  </fo:list-item-body>
11714
11887
  </fo:list-item>
@@ -11717,176 +11890,51 @@
11717
11890
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
11718
11891
 
11719
11892
  <xsl:template name="processBibitem">
11893
+ <xsl:param name="biblio_tag_part">both</xsl:param>
11720
11894
 
11721
11895
  <!-- start bibitem processing -->
11722
11896
  <xsl:if test=".//*[local-name() = 'fn']">
11723
11897
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
11724
11898
  </xsl:if>
11725
11899
 
11726
- <!-- display document identifier, not number [1] -->
11727
- <xsl:variable name="docidentifier">
11728
- <xsl:choose>
11729
- <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
11730
- <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
11731
- </xsl:choose>
11732
- </xsl:variable>
11733
- <xsl:value-of select="$docidentifier"/>
11734
-
11735
- <xsl:apply-templates select="*[local-name() = 'note']"/>
11736
-
11737
- <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
11738
- <xsl:text>,</xsl:text>
11739
- <xsl:text> </xsl:text>
11740
- </xsl:if>
11741
-
11900
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
11901
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
11902
+ </xsl:apply-templates>
11742
11903
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
11743
11904
  <!-- end bibitem processing -->
11744
11905
 
11745
11906
  </xsl:template> <!-- processBibitem (bibitem) -->
11746
11907
 
11747
- <xsl:template name="processBibitemDocId">
11748
- <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')]"/>
11749
- <xsl:choose>
11750
- <xsl:when test="normalize-space($_doc_ident) != ''">
11751
- <!-- <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"/>
11752
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
11753
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
11754
- </xsl:if> -->
11755
- <xsl:value-of select="$_doc_ident"/>
11756
- </xsl:when>
11757
- <xsl:otherwise>
11758
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
11759
- <xsl:if test="$type != ''">
11760
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
11761
- </xsl:if> -->
11762
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
11763
- </xsl:otherwise>
11764
- </xsl:choose>
11765
- </xsl:template> <!-- processBibitemDocId -->
11908
+ <xsl:template match="*[local-name() = 'title']" mode="title">
11909
+ <fo:inline><xsl:apply-templates/></fo:inline>
11910
+ </xsl:template>
11911
+
11912
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
11913
+
11914
+ <xsl:template match="*[local-name() = 'formattedref']">
11915
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
11916
+ <xsl:text>, </xsl:text>
11917
+ </xsl:if> -->
11918
+ <xsl:apply-templates/>
11919
+ </xsl:template>
11766
11920
 
11767
- <xsl:template name="processPersonalAuthor">
11921
+ <xsl:template match="*[local-name() = 'biblio-tag']">
11922
+ <xsl:param name="biblio_tag_part">both</xsl:param>
11768
11923
  <xsl:choose>
11769
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
11770
- <author>
11771
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
11772
- </author>
11773
- </xsl:when>
11774
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
11775
- <author>
11776
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
11777
- <xsl:text> </xsl:text>
11778
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
11779
- </author>
11924
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
11925
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
11780
11926
  </xsl:when>
11781
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
11782
- <author>
11783
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
11784
- <xsl:text> </xsl:text>
11785
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
11786
- </author>
11927
+ <xsl:when test="$biblio_tag_part = 'last'">
11928
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
11787
11929
  </xsl:when>
11788
11930
  <xsl:otherwise>
11789
11931
  <xsl:apply-templates/>
11790
11932
  </xsl:otherwise>
11791
11933
  </xsl:choose>
11792
- </xsl:template> <!-- processPersonalAuthor -->
11793
-
11794
- <xsl:template name="renderDate">
11795
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
11796
- <xsl:value-of select="*[local-name() = 'on']"/>
11797
- </xsl:if>
11798
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
11799
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
11800
- </xsl:if>
11801
- </xsl:template>
11802
-
11803
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
11804
- <xsl:value-of select="translate(.,'. ','')"/>
11805
- </xsl:template>
11806
-
11807
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
11808
- <xsl:value-of select="substring(.,1,1)"/>
11809
- </xsl:template>
11810
-
11811
- <xsl:template match="*[local-name() = 'title']" mode="title">
11812
- <fo:inline><xsl:apply-templates/></fo:inline>
11813
11934
  </xsl:template>
11814
11935
 
11815
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
11816
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
11817
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
11818
- <xsl:apply-templates/>
11819
- </fo:inline>
11820
- </xsl:template>
11821
-
11822
- <!-- bibitem/note renders as footnote -->
11823
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
11824
-
11825
- <!-- list of footnotes to calculate actual footnotes number -->
11826
- <xsl:variable name="p_fn_">
11827
- <xsl:call-template name="get_fn_list"/>
11828
- </xsl:variable>
11829
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
11830
- <xsl:variable name="gen_id" select="generate-id(.)"/>
11831
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
11832
- <!-- fn sequence number in document -->
11833
- <xsl:variable name="current_fn_number">
11834
- <xsl:choose>
11835
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
11836
- <xsl:otherwise>
11837
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
11838
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
11839
- </xsl:otherwise>
11840
- </xsl:choose>
11841
- </xsl:variable>
11842
- <fo:footnote>
11843
- <xsl:variable name="number">
11844
-
11845
- <xsl:value-of select="$current_fn_number"/>
11846
-
11847
- </xsl:variable>
11848
-
11849
- <xsl:variable name="current_fn_number_text">
11850
- <xsl:value-of select="$number"/>
11851
-
11852
- </xsl:variable>
11853
-
11854
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
11855
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
11856
- <xsl:value-of select="$current_fn_number_text"/>
11857
- </fo:basic-link>
11858
- </fo:inline>
11859
- <fo:footnote-body>
11860
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
11861
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
11862
- <xsl:value-of select="$current_fn_number_text"/>
11863
- </fo:inline>
11864
- <xsl:apply-templates/>
11865
- </fo:block>
11866
- </fo:footnote-body>
11867
- </fo:footnote>
11868
- </xsl:template>
11869
-
11870
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
11871
- <xsl:text> edition </xsl:text>
11872
- <xsl:value-of select="."/>
11873
- </xsl:template>
11874
-
11875
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
11876
- <xsl:text> (</xsl:text>
11877
- <fo:inline xsl:use-attribute-sets="link-style">
11878
- <fo:basic-link external-destination="." fox:alt-text=".">
11879
- <xsl:value-of select="."/>
11880
- </fo:basic-link>
11881
- </fo:inline>
11882
- <xsl:text>)</xsl:text>
11883
- </xsl:template>
11884
-
11885
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
11886
-
11887
- <xsl:template match="*[local-name() = 'formattedref']">
11888
-
11889
- <xsl:apply-templates/>
11936
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
11937
+ <xsl:text> </xsl:text>
11890
11938
  </xsl:template>
11891
11939
 
11892
11940
  <!-- ======================= -->
@@ -12257,7 +12305,9 @@
12257
12305
  <!-- Update xml -->
12258
12306
  <!-- ===================================== -->
12259
12307
  <!-- =========================================================================== -->
12260
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12308
+ <!-- STEP1: -->
12309
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
12310
+ <!-- - Ignore 'span' without style -->
12261
12311
  <!-- =========================================================================== -->
12262
12312
  <xsl:template match="@*|node()" mode="update_xml_step1">
12263
12313
  <xsl:copy>
@@ -12340,7 +12390,8 @@
12340
12390
  </xsl:copy>
12341
12391
  </xsl:template>
12342
12392
 
12343
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
12393
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
12394
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
12344
12395
  <xsl:copy>
12345
12396
  <xsl:copy-of select="@*"/>
12346
12397
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12350,6 +12401,12 @@
12350
12401
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
12351
12402
  <xsl:apply-templates mode="update_xml_step1"/>
12352
12403
  </xsl:template>
12404
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
12405
+ <xsl:copy>
12406
+ <xsl:copy-of select="@*"/>
12407
+ <xsl:apply-templates mode="update_xml_step1"/>
12408
+ </xsl:copy>
12409
+ </xsl:template>
12353
12410
  <!-- =========================================================================== -->
12354
12411
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12355
12412
  <!-- =========================================================================== -->
@@ -12423,17 +12480,17 @@
12423
12480
  </xsl:template>
12424
12481
 
12425
12482
  <!-- add @reference for bibitem/note, similar to fn/reference -->
12426
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" mode="update_xml_step2">
12483
+ <!-- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" mode="update_xml_step2">
12427
12484
  <xsl:copy>
12428
12485
  <xsl:apply-templates select="@*" mode="update_xml_step2"/>
12429
-
12486
+
12430
12487
  <xsl:attribute name="reference">
12431
12488
  <xsl:value-of select="concat('bibitem_', ../@id, '_', count(preceding-sibling::*[local-name() = 'note']))"/>
12432
12489
  </xsl:attribute>
12433
-
12490
+
12434
12491
  <xsl:apply-templates select="node()" mode="update_xml_step2"/>
12435
12492
  </xsl:copy>
12436
- </xsl:template>
12493
+ </xsl:template> -->
12437
12494
 
12438
12495
  <!-- enclose sequence of 'char x' + 'combining char y' to <lang_none>xy</lang_none> -->
12439
12496
  <xsl:variable name="regex_combining_chars">(.[̀-ͯ])</xsl:variable>
@@ -12928,6 +12985,10 @@
12928
12985
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
12929
12986
  </xsl:template>
12930
12987
 
12988
+ <xsl:template name="getDocumentId_fromCurrentNode">
12989
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
12990
+ </xsl:template>
12991
+
12931
12992
  <xsl:template name="namespaceCheck">
12932
12993
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
12933
12994
  <xsl:variable name="XSLNS">