metanorma-ogc 2.2.7 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1067,10 +1067,10 @@
1067
1067
  <xsl:call-template name="getLevelTermName"/>
1068
1068
  </xsl:variable>
1069
1069
  <fo:block space-before="36pt" margin-bottom="10pt" keep-with-next="always" role="H{$levelTerm}">
1070
- <fo:list-block color="{$color_blue}" keep-with-next="always" provisional-distance-between-starts="{string-length()*3}mm">
1070
+ <fo:list-block color="{$color_blue}" keep-with-next="always" provisional-distance-between-starts="{string-length()*3.2}mm">
1071
1071
  <fo:list-item>
1072
1072
  <fo:list-item-label end-indent="label-end()">
1073
- <fo:block><fo:inline font-size="18pt" padding-right="1mm"><xsl:apply-templates/></fo:inline></fo:block>
1073
+ <fo:block><fo:inline font-size="18pt"><xsl:apply-templates/></fo:inline></fo:block> <!-- padding-right="1mm" -->
1074
1074
  </fo:list-item-label>
1075
1075
  <fo:list-item-body start-indent="body-start()">
1076
1076
  <fo:block>
@@ -2322,6 +2322,12 @@
2322
2322
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2323
2323
  </xsl:attribute-set>
2324
2324
 
2325
+ <xsl:attribute-set name="figure-block-style">
2326
+
2327
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2328
+
2329
+ </xsl:attribute-set>
2330
+
2325
2331
  <xsl:attribute-set name="figure-style">
2326
2332
 
2327
2333
  </xsl:attribute-set>
@@ -2331,8 +2337,7 @@
2331
2337
  <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
2332
2338
  <!-- <xsl:attribute name="margin-top">12pt</xsl:attribute> -->
2333
2339
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
2334
- <!-- <xsl:attribute name="margin-bottom">6pt</xsl:attribute> -->
2335
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2340
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
2336
2341
  <!-- <xsl:attribute name="keep-with-next">always</xsl:attribute> -->
2337
2342
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2338
2343
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -3762,6 +3767,10 @@
3762
3767
  <xsl:with-param name="continued">true</xsl:with-param>
3763
3768
  </xsl:apply-templates>
3764
3769
 
3770
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
3771
+ <fo:block/>
3772
+ </xsl:if>
3773
+
3765
3774
  </fo:table-cell>
3766
3775
  </fo:table-row>
3767
3776
  </xsl:template> <!-- table-header-title -->
@@ -4160,7 +4169,26 @@
4160
4169
 
4161
4170
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4162
4171
  <xsl:variable name="footnote_inline">
4163
- <fo:inline xsl:use-attribute-sets="fn-num-style">
4172
+ <fo:inline>
4173
+
4174
+ <xsl:variable name="fn_styles">
4175
+ <xsl:choose>
4176
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
4177
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
4178
+ </xsl:when>
4179
+ <xsl:otherwise>
4180
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
4181
+ </xsl:otherwise>
4182
+ </xsl:choose>
4183
+ </xsl:variable>
4184
+
4185
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
4186
+ <xsl:copy-of select="."/>
4187
+ </xsl:for-each>
4188
+
4189
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
4190
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4191
+ </xsl:if>
4164
4192
 
4165
4193
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
4166
4194
  <xsl:value-of select="$current_fn_number_text"/>
@@ -4220,7 +4248,10 @@
4220
4248
  </xsl:for-each>
4221
4249
  <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']/*">
4222
4250
  <xsl:sort select="@displayorder" data-type="number"/>
4223
- <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])]">
4251
+ <!-- commented:
4252
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
4253
+ because 'fn' there is in biblio-tag -->
4254
+ <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])]">
4224
4255
  <!-- copy unique fn -->
4225
4256
  <fn gen_id="{generate-id(.)}">
4226
4257
  <xsl:copy-of select="@*"/>
@@ -5080,7 +5111,7 @@
5080
5111
 
5081
5112
  <xsl:variable name="_font-size">
5082
5113
 
5083
- <!-- 10 -->
5114
+ <!-- inherit -->
5084
5115
 
5085
5116
  <xsl:choose>
5086
5117
  <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
@@ -5326,6 +5357,23 @@
5326
5357
  <xsl:apply-templates/>
5327
5358
  </xsl:template>
5328
5359
 
5360
+ <!-- Don't break standard's numbers -->
5361
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
5362
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
5363
+ <xsl:choose>
5364
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
5365
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
5366
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
5367
+ </xsl:when>
5368
+ <xsl:otherwise>
5369
+ <xsl:apply-templates/>
5370
+ </xsl:otherwise>
5371
+ </xsl:choose>
5372
+ </xsl:template>
5373
+ <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">
5374
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5375
+ </xsl:template>
5376
+
5329
5377
  <!-- ========================= -->
5330
5378
  <!-- END Rich text formatting -->
5331
5379
  <!-- ========================= -->
@@ -5721,7 +5769,7 @@
5721
5769
  <xsl:choose>
5722
5770
  <xsl:when test="@colspan">
5723
5771
  <xsl:variable name="td">
5724
- <xsl:element name="td">
5772
+ <xsl:element name="{local-name()}">
5725
5773
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
5726
5774
  <xsl:if test="local-name()='th'">
5727
5775
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -5736,7 +5784,7 @@
5736
5784
  </xsl:call-template>
5737
5785
  </xsl:when>
5738
5786
  <xsl:otherwise>
5739
- <xsl:element name="td">
5787
+ <xsl:element name="{local-name()}">
5740
5788
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
5741
5789
  <xsl:if test="local-name()='th'">
5742
5790
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -5803,7 +5851,7 @@
5803
5851
  <xsl:variable name="currentRow" select="."/>
5804
5852
 
5805
5853
  <xsl:variable name="normalizedTDs">
5806
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
5854
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
5807
5855
  <xsl:choose>
5808
5856
  <xsl:when test="@rowspan &gt; 1">
5809
5857
  <xsl:copy>
@@ -5815,7 +5863,7 @@
5815
5863
  </xsl:copy>
5816
5864
  </xsl:when>
5817
5865
  <xsl:otherwise>
5818
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
5866
+ <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)])]"/>
5819
5867
  </xsl:otherwise>
5820
5868
  </xsl:choose>
5821
5869
  </xsl:for-each>
@@ -6036,6 +6084,33 @@
6036
6084
  </xsl:choose>
6037
6085
  </xsl:template>
6038
6086
 
6087
+ <xsl:template name="getLang_fromCurrentNode">
6088
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6089
+ <xsl:variable name="language">
6090
+ <xsl:choose>
6091
+ <xsl:when test="$language_current != ''">
6092
+ <xsl:value-of select="$language_current"/>
6093
+ </xsl:when>
6094
+ <xsl:otherwise>
6095
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6096
+ <xsl:choose>
6097
+ <xsl:when test="$language_current_2 != ''">
6098
+ <xsl:value-of select="$language_current_2"/>
6099
+ </xsl:when>
6100
+ <xsl:otherwise>
6101
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
6102
+ </xsl:otherwise>
6103
+ </xsl:choose>
6104
+ </xsl:otherwise>
6105
+ </xsl:choose>
6106
+ </xsl:variable>
6107
+
6108
+ <xsl:choose>
6109
+ <xsl:when test="$language = 'English'">en</xsl:when>
6110
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
6111
+ </xsl:choose>
6112
+ </xsl:template>
6113
+
6039
6114
  <xsl:template name="capitalizeWords">
6040
6115
  <xsl:param name="str"/>
6041
6116
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -6489,12 +6564,6 @@
6489
6564
 
6490
6565
  <fo:block-container margin-left="0mm">
6491
6566
 
6492
- <!-- <xsl:if test="$namespace = 'iho'">
6493
- <xsl:if test="ancestor::iho:td">
6494
- <xsl:attribute name="font-size">12pt</xsl:attribute>
6495
- </xsl:if>
6496
- </xsl:if> -->
6497
-
6498
6567
  <fo:block>
6499
6568
 
6500
6569
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -6666,7 +6735,7 @@
6666
6735
  <xsl:template match="*[local-name() = 'figure']" name="figure">
6667
6736
  <xsl:variable name="isAdded" select="@added"/>
6668
6737
  <xsl:variable name="isDeleted" select="@deleted"/>
6669
- <fo:block-container id="{@id}">
6738
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6670
6739
 
6671
6740
  <xsl:call-template name="setTrackChangesStyles">
6672
6741
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -7002,6 +7071,31 @@
7002
7071
  <xsl:apply-templates mode="svg_update"/>
7003
7072
  </xsl:copy>
7004
7073
  </xsl:template>
7074
+
7075
+ <!-- regex for 'display: inline-block;' -->
7076
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7077
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
7078
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
7079
+ </xsl:template>
7080
+
7081
+ <!-- replace
7082
+ stroke="rgba(r, g, b, alpha)" to
7083
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
7084
+ fill="rgba(r, g, b, alpha)" to
7085
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
7086
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
7087
+ <xsl:variable name="components_">
7088
+ <xsl:call-template name="split">
7089
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
7090
+ <xsl:with-param name="sep" select="','"/>
7091
+ </xsl:call-template>
7092
+ </xsl:variable>
7093
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
7094
+ <xsl:variable name="att_name" select="local-name()"/>
7095
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
7096
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
7097
+ </xsl:template>
7098
+
7005
7099
  <!-- ============== -->
7006
7100
  <!-- END: svg_update -->
7007
7101
  <!-- ============== -->
@@ -7645,7 +7739,13 @@
7645
7739
  </xsl:template>
7646
7740
 
7647
7741
  <xsl:template match="text()" mode="contents_item">
7648
- <xsl:call-template name="keep_together_standard_number"/>
7742
+ <xsl:variable name="text">
7743
+ <!-- to split by '_' and other chars -->
7744
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
7745
+ </xsl:variable>
7746
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
7747
+ <xsl:call-template name="keep_together_standard_number"/>
7748
+ </xsl:for-each>
7649
7749
  </xsl:template>
7650
7750
 
7651
7751
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -7656,39 +7756,57 @@
7656
7756
  <!-- =============== -->
7657
7757
  <!-- sourcecode -->
7658
7758
  <!-- =============== -->
7659
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7660
7759
 
7661
- <xsl:variable name="sourcecode_attributes">
7662
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7663
- <xsl:variable name="_font-size">
7760
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7761
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
7762
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
7664
7763
 
7665
- <!-- 9 -->
7764
+ <xsl:template match="*[local-name() = 'property']" mode="css">
7765
+ <xsl:attribute name="{@name}">
7766
+ <xsl:value-of select="@value"/>
7767
+ </xsl:attribute>
7768
+ </xsl:template>
7666
7769
 
7667
- <!-- <xsl:if test="$namespace = 'ieee'">
7668
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
7669
- </xsl:if> -->
7770
+ <xsl:template name="get_sourcecode_attributes">
7771
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7772
+ <xsl:variable name="_font-size">
7670
7773
 
7671
- <xsl:choose>
7672
- <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
7673
- <xsl:otherwise>9.5</xsl:otherwise>
7674
- </xsl:choose>
7774
+ <!-- inherit -->
7675
7775
 
7676
- </xsl:variable>
7776
+ <!-- <xsl:if test="$namespace = 'ieee'">
7777
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7778
+ </xsl:if> -->
7677
7779
 
7678
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7679
- <xsl:if test="$font-size != ''">
7680
- <xsl:attribute name="font-size">
7681
- <xsl:choose>
7682
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7683
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7684
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7685
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7686
- </xsl:choose>
7687
- </xsl:attribute>
7688
- </xsl:if>
7689
- </xsl:element>
7780
+ <xsl:choose>
7781
+ <xsl:when test="ancestor::*[local-name() = 'table'][not(@type = 'sourcecode')]">8.5</xsl:when>
7782
+ <xsl:otherwise>9.5</xsl:otherwise>
7783
+ </xsl:choose>
7784
+
7785
+ </xsl:variable>
7786
+
7787
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7788
+ <xsl:if test="$font-size != ''">
7789
+ <xsl:attribute name="font-size">
7790
+ <xsl:choose>
7791
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7792
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7793
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7794
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7795
+ </xsl:choose>
7796
+ </xsl:attribute>
7797
+ </xsl:if>
7798
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
7799
+ </xsl:element>
7800
+ </xsl:template>
7801
+
7802
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7803
+
7804
+ <xsl:variable name="sourcecode_attributes">
7805
+ <xsl:call-template name="get_sourcecode_attributes"/>
7690
7806
  </xsl:variable>
7691
7807
 
7808
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
7809
+
7692
7810
  <xsl:choose>
7693
7811
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
7694
7812
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -7754,9 +7872,10 @@
7754
7872
  </xsl:choose>
7755
7873
  </xsl:template>
7756
7874
 
7757
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
7875
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
7758
7876
  <xsl:choose>
7759
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7877
+ <!-- disabled -->
7878
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7760
7879
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
7761
7880
  <xsl:choose>
7762
7881
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -7771,8 +7890,75 @@
7771
7890
  <xsl:call-template name="add_spaces_to_sourcecode"/>
7772
7891
  </xsl:otherwise>
7773
7892
  </xsl:choose>
7893
+ </xsl:template>
7894
+
7895
+ <!-- add sourcecode highlighting -->
7896
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7897
+ <xsl:variable name="class" select="@class"/>
7898
+ <xsl:choose>
7899
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
7900
+ <fo:inline>
7901
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7902
+ <xsl:apply-templates/>
7903
+ </fo:inline>
7904
+ </xsl:when>
7905
+ <xsl:otherwise>
7906
+ <xsl:apply-templates/>
7907
+ </xsl:otherwise>
7908
+ </xsl:choose>
7909
+ </xsl:template>
7910
+
7911
+ <!-- outer table with line numbers for sourcecode -->
7912
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
7913
+ <fo:block>
7914
+ <fo:table width="100%" table-layout="fixed">
7915
+ <xsl:copy-of select="@id"/>
7916
+ <fo:table-column column-width="8%"/>
7917
+ <fo:table-column column-width="92%"/>
7918
+ <fo:table-body>
7919
+ <xsl:apply-templates/>
7920
+ </fo:table-body>
7921
+ </fo:table>
7922
+ </fo:block>
7923
+ </xsl:template>
7924
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
7925
+ <xsl:apply-templates/>
7926
+ </xsl:template>
7927
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
7928
+ <fo:table-row>
7929
+ <xsl:apply-templates/>
7930
+ </fo:table-row>
7931
+ </xsl:template>
7932
+ <!-- first td with line numbers -->
7933
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
7934
+ <fo:table-cell>
7935
+ <fo:block>
7936
+
7937
+ <!-- set attibutes for line numbers - same as sourcecode -->
7938
+ <xsl:variable name="sourcecode_attributes">
7939
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
7940
+ <xsl:call-template name="get_sourcecode_attributes"/>
7941
+ </xsl:for-each>
7942
+ </xsl:variable>
7943
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
7944
+ <xsl:attribute name="{local-name()}">
7945
+ <xsl:value-of select="."/>
7946
+ </xsl:attribute>
7947
+ </xsl:for-each>
7774
7948
 
7949
+ <xsl:apply-templates/>
7950
+ </fo:block>
7951
+ </fo:table-cell>
7952
+ </xsl:template>
7953
+ <!-- second td with sourcecode -->
7954
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
7955
+ <fo:table-cell>
7956
+ <fo:block>
7957
+ <xsl:apply-templates/>
7958
+ </fo:block>
7959
+ </fo:table-cell>
7775
7960
  </xsl:template>
7961
+ <!-- END outer table with line numbers for sourcecode -->
7776
7962
 
7777
7963
  <xsl:template name="add_spaces_to_sourcecode">
7778
7964
  <xsl:variable name="text_step1">
@@ -9474,14 +9660,17 @@
9474
9660
  <fo:block>
9475
9661
  <fo:inline>
9476
9662
 
9477
- <xsl:number format="1." count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
9478
-
9663
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9664
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
9665
+ </xsl:apply-templates>
9479
9666
  </fo:inline>
9480
9667
  </fo:block>
9481
9668
  </fo:list-item-label>
9482
9669
  <fo:list-item-body start-indent="body-start()">
9483
9670
  <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style">
9484
- <xsl:call-template name="processBibitem"/>
9671
+ <xsl:call-template name="processBibitem">
9672
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
9673
+ </xsl:call-template>
9485
9674
  </fo:block>
9486
9675
  </fo:list-item-body>
9487
9676
  </fo:list-item>
@@ -9490,166 +9679,51 @@
9490
9679
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
9491
9680
 
9492
9681
  <xsl:template name="processBibitem">
9682
+ <xsl:param name="biblio_tag_part">both</xsl:param>
9493
9683
 
9494
- <!-- start OGC bibitem processing -->
9495
- <xsl:if test=".//ogc:fn">
9684
+ <!-- start bibitem processing -->
9685
+ <xsl:if test=".//*[local-name() = 'fn']">
9496
9686
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
9497
9687
  </xsl:if>
9688
+
9689
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9690
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
9691
+ </xsl:apply-templates>
9498
9692
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
9499
- <!-- end OGC bibitem processing-->
9693
+ <!-- end bibitem processing -->
9500
9694
 
9501
9695
  </xsl:template> <!-- processBibitem (bibitem) -->
9502
9696
 
9503
- <xsl:template name="processBibitemDocId">
9504
- <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')]"/>
9505
- <xsl:choose>
9506
- <xsl:when test="normalize-space($_doc_ident) != ''">
9507
- <!-- <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"/>
9508
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
9509
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9510
- </xsl:if> -->
9511
- <xsl:value-of select="$_doc_ident"/>
9512
- </xsl:when>
9513
- <xsl:otherwise>
9514
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
9515
- <xsl:if test="$type != ''">
9516
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9517
- </xsl:if> -->
9518
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
9519
- </xsl:otherwise>
9520
- </xsl:choose>
9521
- </xsl:template> <!-- processBibitemDocId -->
9697
+ <xsl:template match="*[local-name() = 'title']" mode="title">
9698
+ <fo:inline><xsl:apply-templates/></fo:inline>
9699
+ </xsl:template>
9700
+
9701
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
9522
9702
 
9523
- <xsl:template name="processPersonalAuthor">
9703
+ <xsl:template match="*[local-name() = 'formattedref']">
9704
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
9705
+ <xsl:text>, </xsl:text>
9706
+ </xsl:if> -->
9707
+ <xsl:apply-templates/>
9708
+ </xsl:template>
9709
+
9710
+ <xsl:template match="*[local-name() = 'biblio-tag']">
9711
+ <xsl:param name="biblio_tag_part">both</xsl:param>
9524
9712
  <xsl:choose>
9525
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
9526
- <author>
9527
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
9528
- </author>
9529
- </xsl:when>
9530
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
9531
- <author>
9532
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
9533
- <xsl:text> </xsl:text>
9534
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
9535
- </author>
9713
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
9714
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9536
9715
  </xsl:when>
9537
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
9538
- <author>
9539
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
9540
- <xsl:text> </xsl:text>
9541
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
9542
- </author>
9716
+ <xsl:when test="$biblio_tag_part = 'last'">
9717
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
9543
9718
  </xsl:when>
9544
9719
  <xsl:otherwise>
9545
9720
  <xsl:apply-templates/>
9546
9721
  </xsl:otherwise>
9547
9722
  </xsl:choose>
9548
- </xsl:template> <!-- processPersonalAuthor -->
9549
-
9550
- <xsl:template name="renderDate">
9551
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
9552
- <xsl:value-of select="*[local-name() = 'on']"/>
9553
- </xsl:if>
9554
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
9555
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
9556
- </xsl:if>
9557
- </xsl:template>
9558
-
9559
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
9560
- <xsl:value-of select="translate(.,'. ','')"/>
9561
- </xsl:template>
9562
-
9563
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
9564
- <xsl:value-of select="substring(.,1,1)"/>
9565
- </xsl:template>
9566
-
9567
- <xsl:template match="*[local-name() = 'title']" mode="title">
9568
- <fo:inline><xsl:apply-templates/></fo:inline>
9569
9723
  </xsl:template>
9570
9724
 
9571
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
9572
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
9573
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
9574
- <xsl:apply-templates/>
9575
- </fo:inline>
9576
- </xsl:template>
9577
-
9578
- <!-- bibitem/note renders as footnote -->
9579
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
9580
-
9581
- <!-- list of footnotes to calculate actual footnotes number -->
9582
- <xsl:variable name="p_fn_">
9583
- <xsl:call-template name="get_fn_list"/>
9584
- </xsl:variable>
9585
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9586
- <xsl:variable name="gen_id" select="generate-id(.)"/>
9587
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9588
- <!-- fn sequence number in document -->
9589
- <xsl:variable name="current_fn_number">
9590
- <xsl:choose>
9591
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
9592
- <xsl:otherwise>
9593
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
9594
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
9595
- </xsl:otherwise>
9596
- </xsl:choose>
9597
- </xsl:variable>
9598
- <fo:footnote>
9599
- <xsl:variable name="number">
9600
-
9601
- <xsl:choose>
9602
- <xsl:when test="ancestor::*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]">
9603
- <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
9604
- </xsl:when>
9605
- <xsl:otherwise>
9606
- <xsl:value-of select="$current_fn_number"/>
9607
- </xsl:otherwise>
9608
- </xsl:choose>
9609
-
9610
- </xsl:variable>
9611
-
9612
- <xsl:variable name="current_fn_number_text">
9613
- <xsl:value-of select="$number"/>
9614
-
9615
- </xsl:variable>
9616
-
9617
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
9618
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
9619
- <xsl:value-of select="$current_fn_number_text"/>
9620
- </fo:basic-link>
9621
- </fo:inline>
9622
- <fo:footnote-body>
9623
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
9624
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
9625
- <xsl:value-of select="$current_fn_number_text"/>
9626
- </fo:inline>
9627
- <xsl:apply-templates/>
9628
- </fo:block>
9629
- </fo:footnote-body>
9630
- </fo:footnote>
9631
- </xsl:template>
9632
-
9633
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
9634
- <xsl:text> edition </xsl:text>
9635
- <xsl:value-of select="."/>
9636
- </xsl:template>
9637
-
9638
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
9639
- <xsl:text> (</xsl:text>
9640
- <fo:inline xsl:use-attribute-sets="link-style">
9641
- <fo:basic-link external-destination="." fox:alt-text=".">
9642
- <xsl:value-of select="."/>
9643
- </fo:basic-link>
9644
- </fo:inline>
9645
- <xsl:text>)</xsl:text>
9646
- </xsl:template>
9647
-
9648
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
9649
-
9650
- <xsl:template match="*[local-name() = 'formattedref']">
9651
-
9652
- <xsl:apply-templates/>
9725
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
9726
+ <xsl:text> </xsl:text>
9653
9727
  </xsl:template>
9654
9728
 
9655
9729
  <!-- ======================= -->
@@ -9982,7 +10056,9 @@
9982
10056
  <!-- Update xml -->
9983
10057
  <!-- ===================================== -->
9984
10058
  <!-- =========================================================================== -->
9985
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10059
+ <!-- STEP1: -->
10060
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
10061
+ <!-- - Ignore 'span' without style -->
9986
10062
  <!-- =========================================================================== -->
9987
10063
  <xsl:template match="@*|node()" mode="update_xml_step1">
9988
10064
  <xsl:copy>
@@ -10065,7 +10141,8 @@
10065
10141
  </xsl:copy>
10066
10142
  </xsl:template>
10067
10143
 
10068
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
10144
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
10145
+ <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">
10069
10146
  <xsl:copy>
10070
10147
  <xsl:copy-of select="@*"/>
10071
10148
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -10075,6 +10152,12 @@
10075
10152
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
10076
10153
  <xsl:apply-templates mode="update_xml_step1"/>
10077
10154
  </xsl:template>
10155
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
10156
+ <xsl:copy>
10157
+ <xsl:copy-of select="@*"/>
10158
+ <xsl:apply-templates mode="update_xml_step1"/>
10159
+ </xsl:copy>
10160
+ </xsl:template>
10078
10161
  <!-- =========================================================================== -->
10079
10162
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
10080
10163
  <!-- =========================================================================== -->
@@ -10555,6 +10638,10 @@
10555
10638
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
10556
10639
  </xsl:template>
10557
10640
 
10641
+ <xsl:template name="getDocumentId_fromCurrentNode">
10642
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
10643
+ </xsl:template>
10644
+
10558
10645
  <xsl:template name="namespaceCheck">
10559
10646
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
10560
10647
  <xsl:variable name="XSLNS">