metanorma-ogc 2.0.5 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 056640c9b99f89ac5e10954d3902f72441ec971b2245724e15d47a7f65e20b62
4
- data.tar.gz: 8dd6622cd5bdd70472865ce662e23a555db66f661d33f274bff9cb4b9a2d4742
3
+ metadata.gz: ef612784fe89a2f1a4a71dd5b4a21d76a867d91c04cb41c47d2c01f3ea42ebd2
4
+ data.tar.gz: 724d7fa5be3843a86130b27a59f46221bd2d1abd0f8308132c2df4de67d7621b
5
5
  SHA512:
6
- metadata.gz: 68082bdefeadf5e0be4ac14485c32ee8514788c1734ec10ddab4c449f5d454014834311290a7837002b7022f73811e24ab1ddc66ac8475899357c2a2f7d54b69
7
- data.tar.gz: da8f7bc31006422fa95fc20b99392fe218ef18d9c7335c0d929c2437ed0d438678644e5e200f7c2e7de6ab262d5579dcbf5f857d2cbba0840453817554d42396
6
+ metadata.gz: 55ee40296e95badf067ee1ff19add5204e3cd5ac1cc0c024f3932a40b37113630baedb1edd7469cb070f2bd30aa2d49b16d627aae3a5c5adf00864b1750e87ce
7
+ data.tar.gz: 8578f3bd16e028683cd5769f9bdfeea9f581650bc3ddd56c895d0a621ca2409ed5e675291600ca5536e6cbdac8836021dcd8e859531c74bb65d3b5fe67e7748d
@@ -130,7 +130,13 @@
130
130
 
131
131
  <xsl:template match="/">
132
132
  <xsl:call-template name="namespaceCheck"/>
133
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
133
+ <fo:root xml:lang="{$lang}">
134
+ <xsl:variable name="root-style">
135
+ <root-style xsl:use-attribute-sets="root-style"/>
136
+ </xsl:variable>
137
+ <xsl:call-template name="insertRootStyle">
138
+ <xsl:with-param name="root-style" select="$root-style"/>
139
+ </xsl:call-template>
134
140
  <fo:layout-master-set>
135
141
  <!-- Cover page -->
136
142
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
@@ -1451,7 +1457,7 @@
1451
1457
  </fo:static-content>
1452
1458
  </xsl:template>
1453
1459
 
1454
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:key name="bibitems" match="*[local-name() = 'bibitem']" use="@id"/><xsl:key name="bibitems_hidden" match="*[local-name() = 'bibitem'][@hidden='true'] | *[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']" use="@id"/><xsl:variable name="lang">
1460
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
1455
1461
  <xsl:call-template name="getLang"/>
1456
1462
  </xsl:variable><xsl:variable name="pageWidth_">
1457
1463
  215.9
@@ -1604,7 +1610,30 @@
1604
1610
 
1605
1611
 
1606
1612
 
1607
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
1613
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
1614
+ <xsl:param name="root-style"/>
1615
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1616
+
1617
+ <xsl:variable name="additional_fonts_">
1618
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
1619
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1620
+ </xsl:for-each>
1621
+ </xsl:variable>
1622
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
1623
+
1624
+ <xsl:for-each select="$root-style_/root-style/@*">
1625
+ <xsl:choose>
1626
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
1627
+ <xsl:attribute name="{local-name()}">
1628
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1629
+ </xsl:attribute>
1630
+ </xsl:when>
1631
+ <xsl:otherwise>
1632
+ <xsl:copy-of select="."/>
1633
+ </xsl:otherwise>
1634
+ </xsl:choose>
1635
+ </xsl:for-each>
1636
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
1608
1637
 
1609
1638
  <xsl:attribute name="font-size">8pt</xsl:attribute>
1610
1639
  <xsl:attribute name="line-height">125%</xsl:attribute>
@@ -2195,7 +2224,7 @@
2195
2224
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2196
2225
 
2197
2226
 
2198
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2227
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2199
2228
 
2200
2229
 
2201
2230
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -2930,8 +2959,27 @@
2930
2959
  <xsl:sort select="@displayorder" data-type="number"/>
2931
2960
  <xsl:apply-templates select="."/>
2932
2961
  </xsl:for-each>
2933
- </xsl:template><xsl:template match="text()">
2934
- <xsl:value-of select="."/>
2962
+ </xsl:template><xsl:variable name="tag_open">###fo:inline###</xsl:variable><xsl:variable name="tag_close">###/fo:inline###</xsl:variable><xsl:template match="text()" name="text">
2963
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2964
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2965
+ <xsl:call-template name="replace_fo_inline">
2966
+ <xsl:with-param name="text" select="$text"/>
2967
+ </xsl:call-template>
2968
+ </xsl:template><xsl:template name="replace_fo_inline">
2969
+ <xsl:param name="text"/>
2970
+ <xsl:choose>
2971
+ <xsl:when test="contains($text, $tag_open)">
2972
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
2973
+ <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2974
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2975
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2976
+ <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2977
+ <xsl:call-template name="replace_fo_inline">
2978
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2979
+ </xsl:call-template>
2980
+ </xsl:when>
2981
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
2982
+ </xsl:choose>
2935
2983
  </xsl:template><xsl:template match="*[local-name()='br']">
2936
2984
  <xsl:value-of select="$linebreak"/>
2937
2985
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
@@ -4615,24 +4663,28 @@
4615
4663
  </xsl:template><xsl:template name="add-zero-spaces-equal">
4616
4664
  <xsl:param name="text" select="."/>
4617
4665
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
4666
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
4618
4667
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
4668
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
4619
4669
  <xsl:variable name="zero-space">​</xsl:variable>
4620
4670
  <xsl:choose>
4621
4671
  <xsl:when test="contains($text, $zero-space-after-equals)">
4622
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
4672
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
4623
4673
  <xsl:value-of select="$zero-space-after-equals"/>
4624
4674
  <xsl:value-of select="$zero-space"/>
4625
4675
  <xsl:call-template name="add-zero-spaces-equal">
4626
4676
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
4627
- </xsl:call-template>
4677
+ </xsl:call-template> -->
4678
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
4628
4679
  </xsl:when>
4629
4680
  <xsl:when test="contains($text, $zero-space-after-equal)">
4630
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
4681
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
4631
4682
  <xsl:value-of select="$zero-space-after-equal"/>
4632
4683
  <xsl:value-of select="$zero-space"/>
4633
4684
  <xsl:call-template name="add-zero-spaces-equal">
4634
4685
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
4635
- </xsl:call-template>
4686
+ </xsl:call-template> -->
4687
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
4636
4688
  </xsl:when>
4637
4689
  <xsl:otherwise>
4638
4690
  <xsl:value-of select="$text"/>
@@ -5112,7 +5164,12 @@
5112
5164
 
5113
5165
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5114
5166
 
5167
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5168
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5169
+ </xsl:if>
5170
+
5115
5171
 
5172
+
5116
5173
 
5117
5174
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5118
5175
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -6113,7 +6170,73 @@
6113
6170
  <xsl:with-param name="text" select="$text_step1"/>
6114
6171
  </xsl:call-template>
6115
6172
  </xsl:variable>
6116
- <xsl:value-of select="$text_step2"/>
6173
+
6174
+ <!-- <xsl:value-of select="$text_step2"/> -->
6175
+
6176
+ <!-- add zero-width space after space -->
6177
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ​')"/>
6178
+
6179
+ <!-- split text by zero-width space -->
6180
+ <xsl:variable name="text_step4">
6181
+ <xsl:call-template name="split_for_interspers">
6182
+ <xsl:with-param name="pText" select="$text_step3"/>
6183
+ <xsl:with-param name="sep" select="$zero_width_space"/>
6184
+ </xsl:call-template>
6185
+ </xsl:variable>
6186
+
6187
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6188
+ <xsl:choose>
6189
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6190
+ <xsl:call-template name="interspers">
6191
+ <xsl:with-param name="str" select="."/>
6192
+ </xsl:call-template>
6193
+ </xsl:when>
6194
+ <xsl:otherwise>
6195
+ <xsl:value-of select="."/>
6196
+ </xsl:otherwise>
6197
+ </xsl:choose>
6198
+ </xsl:for-each>
6199
+
6200
+ </xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
6201
+ <xsl:param name="pText" select="."/>
6202
+ <xsl:param name="sep" select="','"/>
6203
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6204
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6205
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6206
+ <xsl:call-template name="replace_tag_interspers">
6207
+ <xsl:with-param name="text" select="$text"/>
6208
+ </xsl:call-template>
6209
+ </xsl:template><xsl:template name="replace_tag_interspers">
6210
+ <xsl:param name="text"/>
6211
+ <xsl:choose>
6212
+ <xsl:when test="contains($text, $interspers_tag_open)">
6213
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6214
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6215
+ <interspers>
6216
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6217
+ </interspers>
6218
+ <xsl:call-template name="replace_tag_interspers">
6219
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6220
+ </xsl:call-template>
6221
+ </xsl:when>
6222
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6223
+ </xsl:choose>
6224
+ </xsl:template><xsl:template name="interspers">
6225
+ <xsl:param name="str"/>
6226
+ <xsl:param name="char" select="$zero_width_space"/>
6227
+ <xsl:if test="$str != ''">
6228
+ <xsl:value-of select="substring($str, 1, 1)"/>
6229
+
6230
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
6231
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
6232
+ <xsl:value-of select="$char"/>
6233
+ </xsl:if>
6234
+
6235
+ <xsl:call-template name="interspers">
6236
+ <xsl:with-param name="str" select="substring($str, 2)"/>
6237
+ <xsl:with-param name="char" select="$char"/>
6238
+ </xsl:call-template>
6239
+ </xsl:if>
6117
6240
  </xsl:template><xsl:template match="*" mode="syntax_highlight">
6118
6241
  <xsl:apply-templates mode="syntax_highlight"/>
6119
6242
  </xsl:template><xsl:variable name="syntax_highlight_styles_">
@@ -6555,7 +6678,7 @@
6555
6678
  </xsl:otherwise>
6556
6679
  </xsl:choose> -->
6557
6680
  </fo:block>
6558
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6681
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
6559
6682
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6560
6683
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6561
6684
  <xsl:if test="normalize-space() != ''">
@@ -6591,7 +6714,8 @@
6591
6714
  <fo:inline><xsl:apply-templates/></fo:inline>
6592
6715
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
6593
6716
  <xsl:if test="normalize-space() != ''">
6594
- <xsl:value-of select="."/>
6717
+ <!-- <xsl:value-of select="."/> -->
6718
+ <xsl:call-template name="text"/>
6595
6719
  </xsl:if>
6596
6720
  </xsl:template><xsl:template match="*[local-name() = 'quote']">
6597
6721
  <fo:block-container margin-left="0mm">
@@ -6631,11 +6755,24 @@
6631
6755
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6632
6756
  <xsl:text>— </xsl:text>
6633
6757
  <xsl:apply-templates/>
6634
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
6758
+ </xsl:template><xsl:variable name="bibitems_">
6759
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
6760
+ <xsl:copy-of select="."/>
6761
+ </xsl:for-each>
6762
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
6763
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6764
+ <xsl:copy-of select="."/>
6765
+ </xsl:for-each>
6766
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
6767
+ <xsl:copy-of select="."/>
6768
+ </xsl:for-each>
6769
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
6635
6770
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
6636
- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
6771
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
6772
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
6637
6773
  <xsl:choose>
6638
- <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
6774
+ <!-- <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> --> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
6775
+ <xsl:when test="$external-destination != '' or not($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid])"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
6639
6776
  <fo:inline xsl:use-attribute-sets="eref-style">
6640
6777
  <xsl:if test="@type = 'footnote'">
6641
6778
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -7881,7 +8018,7 @@
7881
8018
  <xsl:copy>
7882
8019
  <xsl:copy-of select="@*"/>
7883
8020
  <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
7884
- <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
8021
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
7885
8022
  <xsl:sort select="@displayorder" data-type="number"/>
7886
8023
  <xsl:apply-templates select="." mode="update_xml_step1"/>
7887
8024
  </xsl:for-each>
@@ -8130,22 +8267,25 @@
8130
8267
  <xsl:param name="pText" select="."/>
8131
8268
  <xsl:param name="sep" select="','"/>
8132
8269
  <xsl:param name="normalize-space" select="'true'"/>
8270
+ <xsl:param name="keep_sep" select="'false'"/>
8133
8271
  <xsl:if test="string-length($pText) &gt;0">
8134
- <item>
8135
- <xsl:choose>
8136
- <xsl:when test="$normalize-space = 'true'">
8137
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8138
- </xsl:when>
8139
- <xsl:otherwise>
8140
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8141
- </xsl:otherwise>
8142
- </xsl:choose>
8143
- </item>
8144
- <xsl:call-template name="split">
8145
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8146
- <xsl:with-param name="sep" select="$sep"/>
8147
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
8148
- </xsl:call-template>
8272
+ <item>
8273
+ <xsl:choose>
8274
+ <xsl:when test="$normalize-space = 'true'">
8275
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
8276
+ </xsl:when>
8277
+ <xsl:otherwise>
8278
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
8279
+ </xsl:otherwise>
8280
+ </xsl:choose>
8281
+ </item>
8282
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
8283
+ <xsl:call-template name="split">
8284
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
8285
+ <xsl:with-param name="sep" select="$sep"/>
8286
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
8287
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
8288
+ </xsl:call-template>
8149
8289
  </xsl:if>
8150
8290
  </xsl:template><xsl:template name="getDocumentId">
8151
8291
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>