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.
@@ -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 -->
@@ -3346,7 +3356,26 @@
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>
3375
+
3376
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3377
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3378
+ </xsl:if>
3350
3379
 
3351
3380
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3352
3381
  <xsl:value-of select="$current_fn_number_text"/>
@@ -3406,7 +3435,10 @@
3406
3435
  </xsl:for-each>
3407
3436
  <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']/*">
3408
3437
  <xsl:sort select="@displayorder" data-type="number"/>
3409
- <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])]">
3438
+ <!-- commented:
3439
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3440
+ because 'fn' there is in biblio-tag -->
3441
+ <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])]">
3410
3442
  <!-- copy unique fn -->
3411
3443
  <fn gen_id="{generate-id(.)}">
3412
3444
  <xsl:copy-of select="@*"/>
@@ -4266,7 +4298,7 @@
4266
4298
 
4267
4299
  <xsl:variable name="_font-size">
4268
4300
 
4269
- <!-- 10 -->
4301
+ <!-- inherit -->
4270
4302
 
4271
4303
  <xsl:choose>
4272
4304
  <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
@@ -4512,6 +4544,23 @@
4512
4544
  <xsl:apply-templates/>
4513
4545
  </xsl:template>
4514
4546
 
4547
+ <!-- Don't break standard's numbers -->
4548
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
4549
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
4550
+ <xsl:choose>
4551
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
4552
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
4553
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
4554
+ </xsl:when>
4555
+ <xsl:otherwise>
4556
+ <xsl:apply-templates/>
4557
+ </xsl:otherwise>
4558
+ </xsl:choose>
4559
+ </xsl:template>
4560
+ <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">
4561
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
4562
+ </xsl:template>
4563
+
4515
4564
  <!-- ========================= -->
4516
4565
  <!-- END Rich text formatting -->
4517
4566
  <!-- ========================= -->
@@ -4907,7 +4956,7 @@
4907
4956
  <xsl:choose>
4908
4957
  <xsl:when test="@colspan">
4909
4958
  <xsl:variable name="td">
4910
- <xsl:element name="td">
4959
+ <xsl:element name="{local-name()}">
4911
4960
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4912
4961
  <xsl:if test="local-name()='th'">
4913
4962
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4922,7 +4971,7 @@
4922
4971
  </xsl:call-template>
4923
4972
  </xsl:when>
4924
4973
  <xsl:otherwise>
4925
- <xsl:element name="td">
4974
+ <xsl:element name="{local-name()}">
4926
4975
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4927
4976
  <xsl:if test="local-name()='th'">
4928
4977
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4989,7 +5038,7 @@
4989
5038
  <xsl:variable name="currentRow" select="."/>
4990
5039
 
4991
5040
  <xsl:variable name="normalizedTDs">
4992
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
5041
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
4993
5042
  <xsl:choose>
4994
5043
  <xsl:when test="@rowspan &gt; 1">
4995
5044
  <xsl:copy>
@@ -5001,7 +5050,7 @@
5001
5050
  </xsl:copy>
5002
5051
  </xsl:when>
5003
5052
  <xsl:otherwise>
5004
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
5053
+ <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)])]"/>
5005
5054
  </xsl:otherwise>
5006
5055
  </xsl:choose>
5007
5056
  </xsl:for-each>
@@ -5222,6 +5271,33 @@
5222
5271
  </xsl:choose>
5223
5272
  </xsl:template>
5224
5273
 
5274
+ <xsl:template name="getLang_fromCurrentNode">
5275
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5276
+ <xsl:variable name="language">
5277
+ <xsl:choose>
5278
+ <xsl:when test="$language_current != ''">
5279
+ <xsl:value-of select="$language_current"/>
5280
+ </xsl:when>
5281
+ <xsl:otherwise>
5282
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5283
+ <xsl:choose>
5284
+ <xsl:when test="$language_current_2 != ''">
5285
+ <xsl:value-of select="$language_current_2"/>
5286
+ </xsl:when>
5287
+ <xsl:otherwise>
5288
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5289
+ </xsl:otherwise>
5290
+ </xsl:choose>
5291
+ </xsl:otherwise>
5292
+ </xsl:choose>
5293
+ </xsl:variable>
5294
+
5295
+ <xsl:choose>
5296
+ <xsl:when test="$language = 'English'">en</xsl:when>
5297
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5298
+ </xsl:choose>
5299
+ </xsl:template>
5300
+
5225
5301
  <xsl:template name="capitalizeWords">
5226
5302
  <xsl:param name="str"/>
5227
5303
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -5675,12 +5751,6 @@
5675
5751
 
5676
5752
  <fo:block-container margin-left="0mm">
5677
5753
 
5678
- <!-- <xsl:if test="$namespace = 'iho'">
5679
- <xsl:if test="ancestor::iho:td">
5680
- <xsl:attribute name="font-size">12pt</xsl:attribute>
5681
- </xsl:if>
5682
- </xsl:if> -->
5683
-
5684
5754
  <fo:block>
5685
5755
 
5686
5756
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -5848,7 +5918,7 @@
5848
5918
  <xsl:template match="*[local-name() = 'figure']" name="figure">
5849
5919
  <xsl:variable name="isAdded" select="@added"/>
5850
5920
  <xsl:variable name="isDeleted" select="@deleted"/>
5851
- <fo:block-container id="{@id}">
5921
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
5852
5922
 
5853
5923
  <xsl:call-template name="setTrackChangesStyles">
5854
5924
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -6184,6 +6254,31 @@
6184
6254
  <xsl:apply-templates mode="svg_update"/>
6185
6255
  </xsl:copy>
6186
6256
  </xsl:template>
6257
+
6258
+ <!-- regex for 'display: inline-block;' -->
6259
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
6260
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
6261
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
6262
+ </xsl:template>
6263
+
6264
+ <!-- replace
6265
+ stroke="rgba(r, g, b, alpha)" to
6266
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
6267
+ fill="rgba(r, g, b, alpha)" to
6268
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
6269
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
6270
+ <xsl:variable name="components_">
6271
+ <xsl:call-template name="split">
6272
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
6273
+ <xsl:with-param name="sep" select="','"/>
6274
+ </xsl:call-template>
6275
+ </xsl:variable>
6276
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
6277
+ <xsl:variable name="att_name" select="local-name()"/>
6278
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
6279
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
6280
+ </xsl:template>
6281
+
6187
6282
  <!-- ============== -->
6188
6283
  <!-- END: svg_update -->
6189
6284
  <!-- ============== -->
@@ -6804,7 +6899,13 @@
6804
6899
  </xsl:template>
6805
6900
 
6806
6901
  <xsl:template match="text()" mode="contents_item">
6807
- <xsl:call-template name="keep_together_standard_number"/>
6902
+ <xsl:variable name="text">
6903
+ <!-- to split by '_' and other chars -->
6904
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
6905
+ </xsl:variable>
6906
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
6907
+ <xsl:call-template name="keep_together_standard_number"/>
6908
+ </xsl:for-each>
6808
6909
  </xsl:template>
6809
6910
 
6810
6911
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -6815,39 +6916,57 @@
6815
6916
  <!-- =============== -->
6816
6917
  <!-- sourcecode -->
6817
6918
  <!-- =============== -->
6818
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6819
6919
 
6820
- <xsl:variable name="sourcecode_attributes">
6821
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6822
- <xsl:variable name="_font-size">
6920
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6921
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6922
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6823
6923
 
6824
- <!-- 9 -->
6924
+ <xsl:template match="*[local-name() = 'property']" mode="css">
6925
+ <xsl:attribute name="{@name}">
6926
+ <xsl:value-of select="@value"/>
6927
+ </xsl:attribute>
6928
+ </xsl:template>
6825
6929
 
6826
- <!-- <xsl:if test="$namespace = 'ieee'">
6827
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6828
- </xsl:if> -->
6930
+ <xsl:template name="get_sourcecode_attributes">
6931
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6932
+ <xsl:variable name="_font-size">
6829
6933
 
6830
- <xsl:choose>
6831
- <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
6832
- <xsl:otherwise>9.5</xsl:otherwise>
6833
- </xsl:choose>
6934
+ <!-- inherit -->
6834
6935
 
6835
- </xsl:variable>
6936
+ <!-- <xsl:if test="$namespace = 'ieee'">
6937
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
6938
+ </xsl:if> -->
6836
6939
 
6837
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6838
- <xsl:if test="$font-size != ''">
6839
- <xsl:attribute name="font-size">
6840
- <xsl:choose>
6841
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6842
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6843
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6844
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6845
- </xsl:choose>
6846
- </xsl:attribute>
6847
- </xsl:if>
6848
- </xsl:element>
6940
+ <xsl:choose>
6941
+ <xsl:when test="ancestor::*[local-name() = 'table'][not(@type = 'sourcecode')]">8.5</xsl:when>
6942
+ <xsl:otherwise>9.5</xsl:otherwise>
6943
+ </xsl:choose>
6944
+
6945
+ </xsl:variable>
6946
+
6947
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6948
+ <xsl:if test="$font-size != ''">
6949
+ <xsl:attribute name="font-size">
6950
+ <xsl:choose>
6951
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6952
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6953
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6954
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6955
+ </xsl:choose>
6956
+ </xsl:attribute>
6957
+ </xsl:if>
6958
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
6959
+ </xsl:element>
6960
+ </xsl:template>
6961
+
6962
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6963
+
6964
+ <xsl:variable name="sourcecode_attributes">
6965
+ <xsl:call-template name="get_sourcecode_attributes"/>
6849
6966
  </xsl:variable>
6850
6967
 
6968
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
6969
+
6851
6970
  <xsl:choose>
6852
6971
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6853
6972
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -6901,9 +7020,10 @@
6901
7020
  </xsl:choose>
6902
7021
  </xsl:template>
6903
7022
 
6904
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
7023
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
6905
7024
  <xsl:choose>
6906
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7025
+ <!-- disabled -->
7026
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6907
7027
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6908
7028
  <xsl:choose>
6909
7029
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -6918,8 +7038,75 @@
6918
7038
  <xsl:call-template name="add_spaces_to_sourcecode"/>
6919
7039
  </xsl:otherwise>
6920
7040
  </xsl:choose>
7041
+ </xsl:template>
7042
+
7043
+ <!-- add sourcecode highlighting -->
7044
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7045
+ <xsl:variable name="class" select="@class"/>
7046
+ <xsl:choose>
7047
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
7048
+ <fo:inline>
7049
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7050
+ <xsl:apply-templates/>
7051
+ </fo:inline>
7052
+ </xsl:when>
7053
+ <xsl:otherwise>
7054
+ <xsl:apply-templates/>
7055
+ </xsl:otherwise>
7056
+ </xsl:choose>
7057
+ </xsl:template>
7058
+
7059
+ <!-- outer table with line numbers for sourcecode -->
7060
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
7061
+ <fo:block>
7062
+ <fo:table width="100%" table-layout="fixed">
7063
+ <xsl:copy-of select="@id"/>
7064
+ <fo:table-column column-width="8%"/>
7065
+ <fo:table-column column-width="92%"/>
7066
+ <fo:table-body>
7067
+ <xsl:apply-templates/>
7068
+ </fo:table-body>
7069
+ </fo:table>
7070
+ </fo:block>
7071
+ </xsl:template>
7072
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
7073
+ <xsl:apply-templates/>
7074
+ </xsl:template>
7075
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
7076
+ <fo:table-row>
7077
+ <xsl:apply-templates/>
7078
+ </fo:table-row>
7079
+ </xsl:template>
7080
+ <!-- first td with line numbers -->
7081
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
7082
+ <fo:table-cell>
7083
+ <fo:block>
7084
+
7085
+ <!-- set attibutes for line numbers - same as sourcecode -->
7086
+ <xsl:variable name="sourcecode_attributes">
7087
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
7088
+ <xsl:call-template name="get_sourcecode_attributes"/>
7089
+ </xsl:for-each>
7090
+ </xsl:variable>
7091
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
7092
+ <xsl:attribute name="{local-name()}">
7093
+ <xsl:value-of select="."/>
7094
+ </xsl:attribute>
7095
+ </xsl:for-each>
6921
7096
 
7097
+ <xsl:apply-templates/>
7098
+ </fo:block>
7099
+ </fo:table-cell>
7100
+ </xsl:template>
7101
+ <!-- second td with sourcecode -->
7102
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
7103
+ <fo:table-cell>
7104
+ <fo:block>
7105
+ <xsl:apply-templates/>
7106
+ </fo:block>
7107
+ </fo:table-cell>
6922
7108
  </xsl:template>
7109
+ <!-- END outer table with line numbers for sourcecode -->
6923
7110
 
6924
7111
  <xsl:template name="add_spaces_to_sourcecode">
6925
7112
  <xsl:variable name="text_step1">
@@ -8625,17 +8812,17 @@
8625
8812
  <fo:block>
8626
8813
  <fo:inline>
8627
8814
 
8628
- <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
8629
- <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
8630
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
8631
- </xsl:if>
8632
-
8815
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8816
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
8817
+ </xsl:apply-templates>
8633
8818
  </fo:inline>
8634
8819
  </fo:block>
8635
8820
  </fo:list-item-label>
8636
8821
  <fo:list-item-body start-indent="body-start()">
8637
8822
  <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style">
8638
- <xsl:call-template name="processBibitem"/>
8823
+ <xsl:call-template name="processBibitem">
8824
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
8825
+ </xsl:call-template>
8639
8826
  </fo:block>
8640
8827
  </fo:list-item-body>
8641
8828
  </fo:list-item>
@@ -8644,166 +8831,51 @@
8644
8831
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8645
8832
 
8646
8833
  <xsl:template name="processBibitem">
8834
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8647
8835
 
8648
- <!-- start OGC bibitem processing -->
8649
- <xsl:if test=".//ogc:fn">
8836
+ <!-- start bibitem processing -->
8837
+ <xsl:if test=".//*[local-name() = 'fn']">
8650
8838
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8651
8839
  </xsl:if>
8840
+
8841
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8842
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
8843
+ </xsl:apply-templates>
8652
8844
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8653
- <!-- end OGC bibitem processing-->
8845
+ <!-- end bibitem processing -->
8654
8846
 
8655
8847
  </xsl:template> <!-- processBibitem (bibitem) -->
8656
8848
 
8657
- <xsl:template name="processBibitemDocId">
8658
- <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')]"/>
8659
- <xsl:choose>
8660
- <xsl:when test="normalize-space($_doc_ident) != ''">
8661
- <!-- <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"/>
8662
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8663
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8664
- </xsl:if> -->
8665
- <xsl:value-of select="$_doc_ident"/>
8666
- </xsl:when>
8667
- <xsl:otherwise>
8668
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8669
- <xsl:if test="$type != ''">
8670
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8671
- </xsl:if> -->
8672
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8673
- </xsl:otherwise>
8674
- </xsl:choose>
8675
- </xsl:template> <!-- processBibitemDocId -->
8849
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8850
+ <fo:inline><xsl:apply-templates/></fo:inline>
8851
+ </xsl:template>
8852
+
8853
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8676
8854
 
8677
- <xsl:template name="processPersonalAuthor">
8855
+ <xsl:template match="*[local-name() = 'formattedref']">
8856
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8857
+ <xsl:text>, </xsl:text>
8858
+ </xsl:if> -->
8859
+ <xsl:apply-templates/>
8860
+ </xsl:template>
8861
+
8862
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8863
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8678
8864
  <xsl:choose>
8679
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8680
- <author>
8681
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8682
- </author>
8683
- </xsl:when>
8684
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8685
- <author>
8686
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8687
- <xsl:text> </xsl:text>
8688
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8689
- </author>
8865
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8866
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8690
8867
  </xsl:when>
8691
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8692
- <author>
8693
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8694
- <xsl:text> </xsl:text>
8695
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8696
- </author>
8868
+ <xsl:when test="$biblio_tag_part = 'last'">
8869
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8697
8870
  </xsl:when>
8698
8871
  <xsl:otherwise>
8699
8872
  <xsl:apply-templates/>
8700
8873
  </xsl:otherwise>
8701
8874
  </xsl:choose>
8702
- </xsl:template> <!-- processPersonalAuthor -->
8703
-
8704
- <xsl:template name="renderDate">
8705
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8706
- <xsl:value-of select="*[local-name() = 'on']"/>
8707
- </xsl:if>
8708
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8709
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8710
- </xsl:if>
8711
- </xsl:template>
8712
-
8713
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8714
- <xsl:value-of select="translate(.,'. ','')"/>
8715
- </xsl:template>
8716
-
8717
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8718
- <xsl:value-of select="substring(.,1,1)"/>
8719
- </xsl:template>
8720
-
8721
- <xsl:template match="*[local-name() = 'title']" mode="title">
8722
- <fo:inline><xsl:apply-templates/></fo:inline>
8723
8875
  </xsl:template>
8724
8876
 
8725
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8726
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8727
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8728
- <xsl:apply-templates/>
8729
- </fo:inline>
8730
- </xsl:template>
8731
-
8732
- <!-- bibitem/note renders as footnote -->
8733
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8734
-
8735
- <!-- list of footnotes to calculate actual footnotes number -->
8736
- <xsl:variable name="p_fn_">
8737
- <xsl:call-template name="get_fn_list"/>
8738
- </xsl:variable>
8739
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8740
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8741
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8742
- <!-- fn sequence number in document -->
8743
- <xsl:variable name="current_fn_number">
8744
- <xsl:choose>
8745
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8746
- <xsl:otherwise>
8747
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8748
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8749
- </xsl:otherwise>
8750
- </xsl:choose>
8751
- </xsl:variable>
8752
- <fo:footnote>
8753
- <xsl:variable name="number">
8754
-
8755
- <xsl:choose>
8756
- <xsl:when test="ancestor::*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]">
8757
- <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
8758
- </xsl:when>
8759
- <xsl:otherwise>
8760
- <xsl:value-of select="$current_fn_number"/>
8761
- </xsl:otherwise>
8762
- </xsl:choose>
8763
-
8764
- </xsl:variable>
8765
-
8766
- <xsl:variable name="current_fn_number_text">
8767
- <xsl:value-of select="$number"/>
8768
-
8769
- </xsl:variable>
8770
-
8771
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8772
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8773
- <xsl:value-of select="$current_fn_number_text"/>
8774
- </fo:basic-link>
8775
- </fo:inline>
8776
- <fo:footnote-body>
8777
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8778
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8779
- <xsl:value-of select="$current_fn_number_text"/>
8780
- </fo:inline>
8781
- <xsl:apply-templates/>
8782
- </fo:block>
8783
- </fo:footnote-body>
8784
- </fo:footnote>
8785
- </xsl:template>
8786
-
8787
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8788
- <xsl:text> edition </xsl:text>
8789
- <xsl:value-of select="."/>
8790
- </xsl:template>
8791
-
8792
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8793
- <xsl:text> (</xsl:text>
8794
- <fo:inline xsl:use-attribute-sets="link-style">
8795
- <fo:basic-link external-destination="." fox:alt-text=".">
8796
- <xsl:value-of select="."/>
8797
- </fo:basic-link>
8798
- </fo:inline>
8799
- <xsl:text>)</xsl:text>
8800
- </xsl:template>
8801
-
8802
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8803
-
8804
- <xsl:template match="*[local-name() = 'formattedref']">
8805
-
8806
- <xsl:apply-templates/>
8877
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
8878
+ <xsl:text> </xsl:text>
8807
8879
  </xsl:template>
8808
8880
 
8809
8881
  <!-- ======================= -->
@@ -9136,7 +9208,9 @@
9136
9208
  <!-- Update xml -->
9137
9209
  <!-- ===================================== -->
9138
9210
  <!-- =========================================================================== -->
9139
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9211
+ <!-- STEP1: -->
9212
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
9213
+ <!-- - Ignore 'span' without style -->
9140
9214
  <!-- =========================================================================== -->
9141
9215
  <xsl:template match="@*|node()" mode="update_xml_step1">
9142
9216
  <xsl:copy>
@@ -9219,7 +9293,8 @@
9219
9293
  </xsl:copy>
9220
9294
  </xsl:template>
9221
9295
 
9222
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
9296
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
9297
+ <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">
9223
9298
  <xsl:copy>
9224
9299
  <xsl:copy-of select="@*"/>
9225
9300
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -9229,6 +9304,12 @@
9229
9304
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9230
9305
  <xsl:apply-templates mode="update_xml_step1"/>
9231
9306
  </xsl:template>
9307
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9308
+ <xsl:copy>
9309
+ <xsl:copy-of select="@*"/>
9310
+ <xsl:apply-templates mode="update_xml_step1"/>
9311
+ </xsl:copy>
9312
+ </xsl:template>
9232
9313
  <!-- =========================================================================== -->
9233
9314
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9234
9315
  <!-- =========================================================================== -->
@@ -9709,6 +9790,10 @@
9709
9790
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9710
9791
  </xsl:template>
9711
9792
 
9793
+ <xsl:template name="getDocumentId_fromCurrentNode">
9794
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9795
+ </xsl:template>
9796
+
9712
9797
  <xsl:template name="namespaceCheck">
9713
9798
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9714
9799
  <xsl:variable name="XSLNS">