metanorma-itu 2.2.6 → 2.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/itu/base_convert.rb +3 -3
- data/lib/isodoc/itu/html/_coverpage.css +4 -0
- data/lib/isodoc/itu/html/htmlstyle.css +8 -0
- data/lib/isodoc/itu/i18n-ar.yaml +2 -1
- data/lib/isodoc/itu/i18n-de.yaml +1 -0
- data/lib/isodoc/itu/i18n-en.yaml +1 -0
- data/lib/isodoc/itu/i18n-es.yaml +1 -0
- data/lib/isodoc/itu/i18n-fr.yaml +1 -0
- data/lib/isodoc/itu/i18n-ru.yaml +1 -0
- data/lib/isodoc/itu/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc/itu/itu.implementers-guide.xsl +546 -104
- data/lib/isodoc/itu/itu.in-force.xsl +546 -104
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +546 -104
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +546 -104
- data/lib/isodoc/itu/itu.recommendation.xsl +546 -104
- data/lib/isodoc/itu/itu.resolution.xsl +546 -104
- data/lib/isodoc/itu/itu.service-publication.xsl +546 -104
- data/lib/isodoc/itu/itu.technical-paper.xsl +546 -104
- data/lib/isodoc/itu/itu.technical-report.xsl +546 -104
- data/lib/isodoc/itu/word_convert.rb +1 -1
- data/lib/metanorma/itu/isodoc.rng +46 -296
- data/lib/metanorma/itu/version.rb +1 -1
- data/metanorma-itu.gemspec +1 -1
- metadata +4 -4
@@ -2684,7 +2684,6 @@
|
|
2684
2684
|
|
2685
2685
|
<xsl:attribute-set name="table-header-cell-style">
|
2686
2686
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
2687
|
-
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
2688
2687
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
2689
2688
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
2690
2689
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
@@ -2693,10 +2692,10 @@
|
|
2693
2692
|
|
2694
2693
|
<xsl:attribute-set name="table-cell-style">
|
2695
2694
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
2696
|
-
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
2697
2695
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
2698
2696
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
2699
2697
|
|
2698
|
+
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
2700
2699
|
<xsl:attribute name="display-align">before</xsl:attribute>
|
2701
2700
|
|
2702
2701
|
</xsl:attribute-set> <!-- table-cell-style -->
|
@@ -2888,6 +2887,7 @@
|
|
2888
2887
|
<xsl:attribute-set name="term-name-style">
|
2889
2888
|
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
2890
2889
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
2890
|
+
|
2891
2891
|
</xsl:attribute-set>
|
2892
2892
|
|
2893
2893
|
<xsl:attribute-set name="figure-block-style">
|
@@ -3439,7 +3439,7 @@
|
|
3439
3439
|
<xsl:apply-templates select="." mode="contents"/>
|
3440
3440
|
</xsl:for-each>
|
3441
3441
|
|
3442
|
-
<xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
|
3442
|
+
<xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) > 0] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) > 0]">
|
3443
3443
|
<xsl:sort select="@displayorder" data-type="number"/>
|
3444
3444
|
<xsl:apply-templates select="." mode="contents"/>
|
3445
3445
|
</xsl:for-each>
|
@@ -3866,7 +3866,7 @@
|
|
3866
3866
|
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
3867
3867
|
</xsl:when>
|
3868
3868
|
<xsl:otherwise>
|
3869
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer and
|
3869
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
|
3870
3870
|
</xsl:otherwise>
|
3871
3871
|
</xsl:choose>
|
3872
3872
|
|
@@ -4369,7 +4369,7 @@
|
|
4369
4369
|
<xsl:param name="colwidths"/>
|
4370
4370
|
<xsl:param name="colgroup"/>
|
4371
4371
|
|
4372
|
-
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
|
4372
|
+
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
|
4373
4373
|
|
4374
4374
|
<xsl:variable name="isNoteOrFnExistShowAfterTable">
|
4375
4375
|
|
@@ -4388,6 +4388,10 @@
|
|
4388
4388
|
</xsl:choose>
|
4389
4389
|
</xsl:variable>
|
4390
4390
|
|
4391
|
+
<xsl:variable name="table_fn_block">
|
4392
|
+
<xsl:call-template name="table_fn_display"/>
|
4393
|
+
</xsl:variable>
|
4394
|
+
|
4391
4395
|
<xsl:variable name="tableWithNotesAndFootnotes">
|
4392
4396
|
|
4393
4397
|
<fo:table keep-with-previous="always">
|
@@ -4452,13 +4456,28 @@
|
|
4452
4456
|
|
4453
4457
|
<!-- except gb and bsi -->
|
4454
4458
|
|
4459
|
+
<xsl:apply-templates select="../*[local-name()='dl']"/>
|
4455
4460
|
<xsl:apply-templates select="../*[local-name()='note']"/>
|
4456
4461
|
|
4462
|
+
<xsl:variable name="isDisplayRowSeparator">
|
4463
|
+
|
4464
|
+
</xsl:variable>
|
4465
|
+
|
4457
4466
|
<!-- horizontal row separator -->
|
4467
|
+
<xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
|
4468
|
+
<xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
|
4469
|
+
<fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
|
4470
|
+
|
4471
|
+
<xsl:call-template name="setBordersTableArray"/>
|
4472
|
+
<fo:block font-size="1pt"> </fo:block>
|
4473
|
+
</fo:block-container>
|
4474
|
+
</xsl:if>
|
4475
|
+
</xsl:if>
|
4458
4476
|
|
4459
4477
|
<!-- fn processing -->
|
4460
4478
|
|
4461
|
-
<xsl:call-template name="table_fn_display"/>
|
4479
|
+
<!-- <xsl:call-template name="table_fn_display" /> -->
|
4480
|
+
<xsl:copy-of select="$table_fn_block"/>
|
4462
4481
|
|
4463
4482
|
<!-- for PAS display Notes after footnotes -->
|
4464
4483
|
|
@@ -4563,7 +4582,7 @@
|
|
4563
4582
|
<!-- ===================== -->
|
4564
4583
|
<!-- Table's row processing -->
|
4565
4584
|
<!-- ===================== -->
|
4566
|
-
<!-- row in table header (thead) -->
|
4585
|
+
<!-- row in table header (thead) thead/tr -->
|
4567
4586
|
<xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
4568
4587
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
4569
4588
|
|
@@ -4579,7 +4598,29 @@
|
|
4579
4598
|
</fo:table-row>
|
4580
4599
|
</xsl:template>
|
4581
4600
|
|
4582
|
-
|
4601
|
+
<xsl:template name="setBorderUnderRow">
|
4602
|
+
<xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
|
4603
|
+
<xsl:choose>
|
4604
|
+
<xsl:when test="$border_under_row_ != ''">
|
4605
|
+
<xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
|
4606
|
+
<xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
|
4607
|
+
<xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
|
4608
|
+
<xsl:variable name="border_under_row">
|
4609
|
+
<xsl:call-template name="split">
|
4610
|
+
<xsl:with-param name="pText" select="$border_under_row_"/>
|
4611
|
+
</xsl:call-template>
|
4612
|
+
</xsl:variable>
|
4613
|
+
<xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
|
4614
|
+
<xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
|
4615
|
+
</xsl:if>
|
4616
|
+
</xsl:when>
|
4617
|
+
<xsl:otherwise>
|
4618
|
+
<xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
|
4619
|
+
</xsl:otherwise>
|
4620
|
+
</xsl:choose>
|
4621
|
+
</xsl:template>
|
4622
|
+
|
4623
|
+
<!-- row in table footer (tfoot), tfoot/tr -->
|
4583
4624
|
<xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
|
4584
4625
|
<fo:table-row xsl:use-attribute-sets="table-footer-row-style">
|
4585
4626
|
|
@@ -4940,8 +4981,16 @@
|
|
4940
4981
|
<!-- figure's footnotes rendering -->
|
4941
4982
|
<xsl:template name="fn_display_figure">
|
4942
4983
|
|
4984
|
+
<!-- current figure id -->
|
4985
|
+
<xsl:variable name="figure_id_">
|
4986
|
+
<xsl:value-of select="@id"/>
|
4987
|
+
<xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
|
4988
|
+
</xsl:variable>
|
4989
|
+
<xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
|
4990
|
+
|
4991
|
+
<!-- all footnotes relates to the current figure -->
|
4943
4992
|
<xsl:variable name="references">
|
4944
|
-
<xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
|
4993
|
+
<xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
|
4945
4994
|
<fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
|
4946
4995
|
<xsl:apply-templates/>
|
4947
4996
|
</fn>
|
@@ -4954,91 +5003,93 @@
|
|
4954
5003
|
|
4955
5004
|
</xsl:variable>
|
4956
5005
|
|
4957
|
-
|
4958
|
-
|
4959
|
-
|
4960
|
-
|
4961
|
-
|
4962
|
-
|
5006
|
+
<fo:block>
|
5007
|
+
|
5008
|
+
<!-- current hierarchy is 'figure' element -->
|
5009
|
+
<xsl:variable name="following_dl_colwidths">
|
5010
|
+
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
5011
|
+
<xsl:variable name="simple-table">
|
5012
|
+
<!-- <xsl:variable name="doc_ns">
|
5013
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
5014
|
+
</xsl:variable>
|
5015
|
+
<xsl:variable name="ns">
|
5016
|
+
<xsl:choose>
|
5017
|
+
<xsl:when test="normalize-space($doc_ns) != ''">
|
5018
|
+
<xsl:value-of select="normalize-space($doc_ns)"/>
|
5019
|
+
</xsl:when>
|
5020
|
+
<xsl:otherwise>
|
5021
|
+
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
5022
|
+
</xsl:otherwise>
|
5023
|
+
</xsl:choose>
|
5024
|
+
</xsl:variable> -->
|
5025
|
+
|
5026
|
+
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
5027
|
+
<tbody>
|
5028
|
+
<xsl:apply-templates mode="dl"/>
|
5029
|
+
</tbody>
|
5030
|
+
</xsl:for-each>
|
5031
|
+
</xsl:variable>
|
5032
|
+
|
5033
|
+
<xsl:call-template name="calculate-column-widths">
|
5034
|
+
<xsl:with-param name="cols-count" select="2"/>
|
5035
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
5036
|
+
</xsl:call-template>
|
5037
|
+
|
5038
|
+
</xsl:if>
|
4963
5039
|
</xsl:variable>
|
4964
|
-
|
5040
|
+
|
5041
|
+
<xsl:variable name="maxlength_dt">
|
5042
|
+
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
5043
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
5044
|
+
</xsl:for-each>
|
5045
|
+
</xsl:variable>
|
5046
|
+
|
5047
|
+
<fo:table width="95%" table-layout="fixed">
|
5048
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
5049
|
+
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
5050
|
+
|
5051
|
+
</xsl:if>
|
4965
5052
|
<xsl:choose>
|
4966
|
-
|
4967
|
-
|
5053
|
+
<!-- if there 'dl', then set same columns width -->
|
5054
|
+
<xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
|
5055
|
+
<xsl:call-template name="setColumnWidth_dl">
|
5056
|
+
<xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
|
5057
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
5058
|
+
</xsl:call-template>
|
4968
5059
|
</xsl:when>
|
4969
5060
|
<xsl:otherwise>
|
4970
|
-
<
|
5061
|
+
<fo:table-column column-width="5%"/>
|
5062
|
+
<fo:table-column column-width="95%"/>
|
4971
5063
|
</xsl:otherwise>
|
4972
5064
|
</xsl:choose>
|
4973
|
-
|
4974
|
-
|
4975
|
-
|
4976
|
-
|
4977
|
-
|
4978
|
-
|
4979
|
-
|
4980
|
-
|
4981
|
-
|
4982
|
-
|
4983
|
-
|
4984
|
-
|
4985
|
-
|
4986
|
-
|
4987
|
-
|
4988
|
-
</xsl:variable>
|
4989
|
-
|
4990
|
-
<xsl:variable name="maxlength_dt">
|
4991
|
-
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
4992
|
-
<xsl:call-template name="getMaxLength_dt"/>
|
4993
|
-
</xsl:for-each>
|
4994
|
-
</xsl:variable>
|
4995
|
-
|
4996
|
-
<fo:block>
|
4997
|
-
<fo:table width="95%" table-layout="fixed">
|
4998
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4999
|
-
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
5065
|
+
<fo:table-body>
|
5066
|
+
<xsl:for-each select="xalan:nodeset($references)//fn">
|
5067
|
+
<xsl:variable name="reference" select="@reference"/>
|
5068
|
+
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
5069
|
+
<fo:table-row>
|
5070
|
+
<fo:table-cell>
|
5071
|
+
<fo:block>
|
5072
|
+
<fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
|
5073
|
+
<xsl:value-of select="@reference"/>
|
5074
|
+
</fo:inline>
|
5075
|
+
</fo:block>
|
5076
|
+
</fo:table-cell>
|
5077
|
+
<fo:table-cell>
|
5078
|
+
<fo:block xsl:use-attribute-sets="figure-fn-body-style">
|
5079
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
5000
5080
|
|
5001
|
-
|
5002
|
-
<xsl:choose>
|
5003
|
-
<!-- if there 'dl', then set same columns width -->
|
5004
|
-
<xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
|
5005
|
-
<xsl:call-template name="setColumnWidth_dl">
|
5006
|
-
<xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
|
5007
|
-
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
5008
|
-
</xsl:call-template>
|
5009
|
-
</xsl:when>
|
5010
|
-
<xsl:otherwise>
|
5011
|
-
<fo:table-column column-width="15%"/>
|
5012
|
-
<fo:table-column column-width="85%"/>
|
5013
|
-
</xsl:otherwise>
|
5014
|
-
</xsl:choose>
|
5015
|
-
<fo:table-body>
|
5016
|
-
<xsl:for-each select="xalan:nodeset($references)//fn">
|
5017
|
-
<xsl:variable name="reference" select="@reference"/>
|
5018
|
-
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
5019
|
-
<fo:table-row>
|
5020
|
-
<fo:table-cell>
|
5021
|
-
<fo:block>
|
5022
|
-
<fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
|
5023
|
-
<xsl:value-of select="@reference"/>
|
5024
|
-
</fo:inline>
|
5025
|
-
</fo:block>
|
5026
|
-
</fo:table-cell>
|
5027
|
-
<fo:table-cell>
|
5028
|
-
<fo:block xsl:use-attribute-sets="figure-fn-body-style">
|
5029
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
5081
|
+
<xsl:attribute name="margin-bottom">0</xsl:attribute>
|
5030
5082
|
|
5031
|
-
|
5083
|
+
</xsl:if>
|
5084
|
+
<xsl:copy-of select="./node()"/>
|
5085
|
+
</fo:block>
|
5086
|
+
</fo:table-cell>
|
5087
|
+
</fo:table-row>
|
5088
|
+
</xsl:if>
|
5089
|
+
</xsl:for-each>
|
5090
|
+
</fo:table-body>
|
5091
|
+
</fo:table>
|
5032
5092
|
|
5033
|
-
</xsl:if>
|
5034
|
-
<xsl:copy-of select="./node()"/>
|
5035
|
-
</fo:block>
|
5036
|
-
</fo:table-cell>
|
5037
|
-
</fo:table-row>
|
5038
|
-
</xsl:if>
|
5039
|
-
</xsl:for-each>
|
5040
|
-
</fo:table-body>
|
5041
|
-
</fo:table>
|
5042
5093
|
</fo:block>
|
5043
5094
|
</xsl:if>
|
5044
5095
|
|
@@ -5078,6 +5129,8 @@
|
|
5078
5129
|
<!-- <dl><xsl:copy-of select="."/></dl> -->
|
5079
5130
|
<fo:block-container>
|
5080
5131
|
|
5132
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
5133
|
+
|
5081
5134
|
<xsl:if test="not(ancestor::*[local-name() = 'quote'])">
|
5082
5135
|
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
5083
5136
|
</xsl:if>
|
@@ -5114,12 +5167,14 @@
|
|
5114
5167
|
|
5115
5168
|
<fo:block margin-bottom="12pt" text-align="left">
|
5116
5169
|
|
5117
|
-
<xsl:variable name="title-where">
|
5170
|
+
<!-- <xsl:variable name="title-where">
|
5118
5171
|
<xsl:call-template name="getLocalizedString">
|
5119
5172
|
<xsl:with-param name="key">where</xsl:with-param>
|
5120
5173
|
</xsl:call-template>
|
5121
5174
|
</xsl:variable>
|
5122
|
-
<xsl:value-of select="$title-where"
|
5175
|
+
<xsl:value-of select="$title-where"/> -->
|
5176
|
+
<xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
|
5177
|
+
<xsl:text> </xsl:text>
|
5123
5178
|
<xsl:apply-templates select="*[local-name()='dt']/*"/>
|
5124
5179
|
<xsl:text/>
|
5125
5180
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
@@ -5131,12 +5186,14 @@
|
|
5131
5186
|
|
5132
5187
|
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
5133
5188
|
|
5134
|
-
<xsl:variable name="title-where">
|
5189
|
+
<!-- <xsl:variable name="title-where">
|
5135
5190
|
<xsl:call-template name="getLocalizedString">
|
5136
5191
|
<xsl:with-param name="key">where</xsl:with-param>
|
5137
5192
|
</xsl:call-template>
|
5138
5193
|
</xsl:variable>
|
5139
|
-
<xsl:value-of select="$title-where"
|
5194
|
+
<xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
|
5195
|
+
<!-- preceding 'p' with word 'where' -->
|
5196
|
+
<xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
|
5140
5197
|
</fo:block>
|
5141
5198
|
</xsl:when> <!-- END: a few components -->
|
5142
5199
|
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
@@ -5323,6 +5380,9 @@
|
|
5323
5380
|
|
5324
5381
|
</xsl:template> <!-- END: dl -->
|
5325
5382
|
|
5383
|
+
<!-- ignore 'p' with 'where' in formula, before 'dl' -->
|
5384
|
+
<xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
|
5385
|
+
|
5326
5386
|
<xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
|
5327
5387
|
<xsl:param name="process">false</xsl:param>
|
5328
5388
|
<xsl:if test="$process = 'true'">
|
@@ -6160,8 +6220,8 @@
|
|
6160
6220
|
|
6161
6221
|
<!-- add zero-width space (#x200B) after dot with next non-digit -->
|
6162
6222
|
<xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1$2')"/>
|
6163
|
-
<!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
|
6164
|
-
<xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—|
|
6223
|
+
<!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
|
6224
|
+
<xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1')"/>
|
6165
6225
|
<!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
|
6166
6226
|
<xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1$2')"/>
|
6167
6227
|
<!-- add zero-width space (#x200B) after characters: 'great than' -->
|
@@ -6172,8 +6232,19 @@
|
|
6172
6232
|
<xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?<!\W)(\{)', '$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
|
6173
6233
|
<!-- add zero-width space (#x200B) after character: , -->
|
6174
6234
|
<xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1')"/> <!-- negative lookahead: ',' not followed by digit -->
|
6235
|
+
<!-- add zero-width space (#x200B) after character: '/' -->
|
6236
|
+
<xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1')"/><!-- negative lookahead: '/' not followed by '/' -->
|
6175
6237
|
|
6176
|
-
<xsl:
|
6238
|
+
<xsl:variable name="text9">
|
6239
|
+
<xsl:choose>
|
6240
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
6241
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
|
6242
|
+
</xsl:when>
|
6243
|
+
<xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
|
6244
|
+
</xsl:choose>
|
6245
|
+
</xsl:variable>
|
6246
|
+
|
6247
|
+
<xsl:value-of select="$text9"/>
|
6177
6248
|
</xsl:template>
|
6178
6249
|
|
6179
6250
|
<xsl:template name="add-zero-spaces-link-java">
|
@@ -6181,8 +6252,8 @@
|
|
6181
6252
|
|
6182
6253
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
|
6183
6254
|
<xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
|
6184
|
-
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
|
6185
|
-
<xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—|
|
6255
|
+
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
|
6256
|
+
<xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1')"/>
|
6186
6257
|
<!-- remove zero-width space at the end -->
|
6187
6258
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '$', '')"/>
|
6188
6259
|
</xsl:template>
|
@@ -6537,9 +6608,28 @@
|
|
6537
6608
|
</xsl:variable>
|
6538
6609
|
<xsl:copy-of select="$newRow"/>
|
6539
6610
|
|
6540
|
-
|
6541
|
-
|
6542
|
-
|
6611
|
+
<!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
|
6612
|
+
<xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
|
6613
|
+
<xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
|
6614
|
+
<xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
|
6615
|
+
<xsl:choose>
|
6616
|
+
<xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan <= 0">
|
6617
|
+
<xsl:copy-of select="following-sibling::tr"/>
|
6618
|
+
</xsl:when>
|
6619
|
+
<!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan > 0">
|
6620
|
+
<xsl:copy-of select="following-sibling::tr[position() <= $nextrow_without_rowspan]"/>
|
6621
|
+
|
6622
|
+
<xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
|
6623
|
+
<xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
|
6624
|
+
<xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
|
6625
|
+
</xsl:apply-templates>
|
6626
|
+
</xsl:when> -->
|
6627
|
+
<xsl:otherwise>
|
6628
|
+
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
6629
|
+
<xsl:with-param name="previousRow" select="$newRow"/>
|
6630
|
+
</xsl:apply-templates>
|
6631
|
+
</xsl:otherwise>
|
6632
|
+
</xsl:choose>
|
6543
6633
|
</xsl:template>
|
6544
6634
|
<!-- End mode simple-table-rowspan -->
|
6545
6635
|
|
@@ -6702,6 +6792,27 @@
|
|
6702
6792
|
</xsl:call-template>
|
6703
6793
|
</xsl:template>
|
6704
6794
|
|
6795
|
+
<xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
|
6796
|
+
<xsl:variable name="link">
|
6797
|
+
<link_updated>
|
6798
|
+
<xsl:variable name="target_text">
|
6799
|
+
<xsl:choose>
|
6800
|
+
<xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
|
6801
|
+
<xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
|
6802
|
+
</xsl:when>
|
6803
|
+
<xsl:otherwise>
|
6804
|
+
<xsl:value-of select="normalize-space(@target)"/>
|
6805
|
+
</xsl:otherwise>
|
6806
|
+
</xsl:choose>
|
6807
|
+
</xsl:variable>
|
6808
|
+
<xsl:value-of select="$target_text"/>
|
6809
|
+
</link_updated>
|
6810
|
+
</xsl:variable>
|
6811
|
+
<xsl:for-each select="xalan:nodeset($link)/*">
|
6812
|
+
<xsl:apply-templates mode="td_text_with_formatting"/>
|
6813
|
+
</xsl:for-each>
|
6814
|
+
</xsl:template>
|
6815
|
+
|
6705
6816
|
<xsl:template name="getFormattingTags">
|
6706
6817
|
<tags>
|
6707
6818
|
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
@@ -7043,7 +7154,7 @@
|
|
7043
7154
|
</xsl:variable>
|
7044
7155
|
<fo:inline xsl:use-attribute-sets="link-style">
|
7045
7156
|
|
7046
|
-
<xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
|
7157
|
+
<xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
|
7047
7158
|
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
|
7048
7159
|
</xsl:if>
|
7049
7160
|
|
@@ -7098,13 +7209,17 @@
|
|
7098
7209
|
</xsl:template>
|
7099
7210
|
|
7100
7211
|
<xsl:template match="*[local-name() = 'callout']">
|
7101
|
-
<
|
7212
|
+
<xsl:choose>
|
7213
|
+
<xsl:when test="normalize-space(@target) = ''"><<xsl:apply-templates/>></xsl:when>
|
7214
|
+
<xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}"><<xsl:apply-templates/>></fo:basic-link></xsl:otherwise>
|
7215
|
+
</xsl:choose>
|
7102
7216
|
</xsl:template>
|
7103
7217
|
|
7104
7218
|
<xsl:template match="*[local-name() = 'annotation']">
|
7105
7219
|
<xsl:variable name="annotation-id" select="@id"/>
|
7106
7220
|
<xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
|
7107
7221
|
<fo:block id="{$annotation-id}" white-space="nowrap">
|
7222
|
+
|
7108
7223
|
<fo:inline>
|
7109
7224
|
<xsl:apply-templates>
|
7110
7225
|
<xsl:with-param name="callout" select="concat('<', $callout, '> ')"/>
|
@@ -7209,6 +7324,10 @@
|
|
7209
7324
|
<!-- ====== -->
|
7210
7325
|
<!-- ====== -->
|
7211
7326
|
|
7327
|
+
<xsl:template name="setBlockSpanAll">
|
7328
|
+
<xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
|
7329
|
+
</xsl:template>
|
7330
|
+
|
7212
7331
|
<!-- ====== -->
|
7213
7332
|
<!-- note -->
|
7214
7333
|
<!-- termnote -->
|
@@ -7218,6 +7337,8 @@
|
|
7218
7337
|
|
7219
7338
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
|
7220
7339
|
|
7340
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
7341
|
+
|
7221
7342
|
<fo:block-container margin-left="0mm" margin-right="0mm">
|
7222
7343
|
|
7223
7344
|
<fo:block>
|
@@ -7272,6 +7393,8 @@
|
|
7272
7393
|
<xsl:template match="*[local-name() = 'termnote']">
|
7273
7394
|
<fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
|
7274
7395
|
|
7396
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
7397
|
+
|
7275
7398
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
7276
7399
|
|
7277
7400
|
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
@@ -7406,10 +7529,10 @@
|
|
7406
7529
|
<fo:block xsl:use-attribute-sets="figure-style">
|
7407
7530
|
<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
|
7408
7531
|
</fo:block>
|
7409
|
-
<xsl:call-template name="fn_display_figure"/>
|
7410
7532
|
<xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
|
7411
7533
|
<xsl:call-template name="note"/>
|
7412
7534
|
</xsl:for-each>
|
7535
|
+
<xsl:call-template name="fn_display_figure"/>
|
7413
7536
|
|
7414
7537
|
<xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
|
7415
7538
|
|
@@ -7472,7 +7595,13 @@
|
|
7472
7595
|
</xsl:choose>
|
7473
7596
|
</xsl:variable>
|
7474
7597
|
|
7475
|
-
<xsl:variable name="
|
7598
|
+
<xsl:variable name="image_width_effective">
|
7599
|
+
|
7600
|
+
<xsl:value-of select="$width_effective"/>
|
7601
|
+
|
7602
|
+
</xsl:variable>
|
7603
|
+
|
7604
|
+
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
|
7476
7605
|
<xsl:if test="number($scale) < 100">
|
7477
7606
|
|
7478
7607
|
<xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
|
@@ -8059,6 +8188,13 @@
|
|
8059
8188
|
<xsl:when test="$contents_nodes/doc">
|
8060
8189
|
<xsl:choose>
|
8061
8190
|
<xsl:when test="count($contents_nodes/doc) > 1">
|
8191
|
+
|
8192
|
+
<xsl:if test="$contents_nodes/collection">
|
8193
|
+
<fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
|
8194
|
+
<fo:bookmark-title>collection.pdf</fo:bookmark-title>
|
8195
|
+
</fo:bookmark>
|
8196
|
+
</xsl:if>
|
8197
|
+
|
8062
8198
|
<xsl:for-each select="$contents_nodes/doc">
|
8063
8199
|
<fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
|
8064
8200
|
<xsl:if test="@bundle = 'true'">
|
@@ -9172,6 +9308,9 @@
|
|
9172
9308
|
<!-- ====== -->
|
9173
9309
|
<xsl:template match="*[local-name() = 'termexample']">
|
9174
9310
|
<fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
|
9311
|
+
|
9312
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
9313
|
+
|
9175
9314
|
<xsl:apply-templates select="*[local-name()='name']"/>
|
9176
9315
|
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
9177
9316
|
</fo:block>
|
@@ -9223,6 +9362,8 @@
|
|
9223
9362
|
|
9224
9363
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
9225
9364
|
|
9365
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
9366
|
+
|
9226
9367
|
<xsl:variable name="fo_element">
|
9227
9368
|
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
9228
9369
|
block
|
@@ -9250,6 +9391,35 @@
|
|
9250
9391
|
</fo:block-container>
|
9251
9392
|
</xsl:when> <!-- end block -->
|
9252
9393
|
|
9394
|
+
<xsl:when test="contains(normalize-space($fo_element), 'list')">
|
9395
|
+
|
9396
|
+
<xsl:variable name="provisional_distance_between_starts">
|
9397
|
+
7
|
9398
|
+
</xsl:variable>
|
9399
|
+
<xsl:variable name="indent">
|
9400
|
+
0
|
9401
|
+
</xsl:variable>
|
9402
|
+
|
9403
|
+
<fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
|
9404
|
+
<fo:list-item>
|
9405
|
+
<fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
|
9406
|
+
<fo:block>
|
9407
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
9408
|
+
<xsl:with-param name="fo_element">block</xsl:with-param>
|
9409
|
+
</xsl:apply-templates>
|
9410
|
+
</fo:block>
|
9411
|
+
</fo:list-item-label>
|
9412
|
+
<fo:list-item-body start-indent="body-start()">
|
9413
|
+
<fo:block>
|
9414
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
9415
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
9416
|
+
</xsl:apply-templates>
|
9417
|
+
</fo:block>
|
9418
|
+
</fo:list-item-body>
|
9419
|
+
</fo:list-item>
|
9420
|
+
</fo:list-block>
|
9421
|
+
</xsl:when> <!-- end list -->
|
9422
|
+
|
9253
9423
|
<xsl:otherwise> <!-- inline -->
|
9254
9424
|
|
9255
9425
|
<!-- display 'EXAMPLE' and first element in the same line -->
|
@@ -9325,6 +9495,11 @@
|
|
9325
9495
|
</fo:block>
|
9326
9496
|
</fo:block-container>
|
9327
9497
|
</xsl:when>
|
9498
|
+
<xsl:when test="starts-with(normalize-space($element), 'list')">
|
9499
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
9500
|
+
<xsl:apply-templates/>
|
9501
|
+
</fo:block>
|
9502
|
+
</xsl:when>
|
9328
9503
|
<xsl:otherwise>
|
9329
9504
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
9330
9505
|
<xsl:apply-templates/>
|
@@ -9442,6 +9617,9 @@
|
|
9442
9617
|
<!-- ====== -->
|
9443
9618
|
<xsl:template match="*[local-name() = 'quote']">
|
9444
9619
|
<fo:block-container margin-left="0mm">
|
9620
|
+
|
9621
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
9622
|
+
|
9445
9623
|
<xsl:if test="parent::*[local-name() = 'note']">
|
9446
9624
|
<xsl:if test="not(ancestor::*[local-name() = 'table'])">
|
9447
9625
|
<xsl:attribute name="margin-left">5mm</xsl:attribute>
|
@@ -9734,6 +9912,8 @@
|
|
9734
9912
|
<fo:block>
|
9735
9913
|
<xsl:call-template name="setId"/>
|
9736
9914
|
|
9915
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
9916
|
+
|
9737
9917
|
<xsl:if test="@inline-header='true'">
|
9738
9918
|
<xsl:attribute name="text-align">justify</xsl:attribute>
|
9739
9919
|
</xsl:if>
|
@@ -9752,6 +9932,8 @@
|
|
9752
9932
|
<fo:block break-after="page"/>
|
9753
9933
|
<fo:block id="{@id}">
|
9754
9934
|
|
9935
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
9936
|
+
|
9755
9937
|
</fo:block>
|
9756
9938
|
<xsl:apply-templates/>
|
9757
9939
|
</xsl:template>
|
@@ -9942,6 +10124,44 @@
|
|
9942
10124
|
|
9943
10125
|
<fo:list-block xsl:use-attribute-sets="list-style">
|
9944
10126
|
|
10127
|
+
<xsl:variable name="provisional_distance_between_starts_">
|
10128
|
+
<attributes xsl:use-attribute-sets="list-style">
|
10129
|
+
|
10130
|
+
</attributes>
|
10131
|
+
</xsl:variable>
|
10132
|
+
<xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
|
10133
|
+
<xsl:if test="$provisional_distance_between_starts != ''">
|
10134
|
+
<xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
|
10135
|
+
</xsl:if>
|
10136
|
+
<xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
|
10137
|
+
|
10138
|
+
<!-- increase provisional-distance-between-starts for long lists -->
|
10139
|
+
<xsl:if test="local-name() = 'ol'">
|
10140
|
+
<!-- Examples: xiii), xviii), xxviii) -->
|
10141
|
+
<xsl:variable name="item_numbers">
|
10142
|
+
<xsl:for-each select="*[local-name() = 'li']">
|
10143
|
+
<item><xsl:call-template name="getListItemFormat"/></item>
|
10144
|
+
</xsl:for-each>
|
10145
|
+
</xsl:variable>
|
10146
|
+
|
10147
|
+
<xsl:variable name="max_length">
|
10148
|
+
<xsl:for-each select="xalan:nodeset($item_numbers)/item">
|
10149
|
+
<xsl:sort select="string-length(.)" data-type="number" order="descending"/>
|
10150
|
+
<xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
|
10151
|
+
</xsl:for-each>
|
10152
|
+
</xsl:variable>
|
10153
|
+
|
10154
|
+
<!-- base width (provisional-distance-between-starts) for 4 chars -->
|
10155
|
+
<xsl:variable name="addon" select="$max_length - 4"/>
|
10156
|
+
<xsl:if test="$addon > 0">
|
10157
|
+
<xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
|
10158
|
+
</xsl:if>
|
10159
|
+
<!-- DEBUG -->
|
10160
|
+
<!-- <xsl:copy-of select="$item_numbers"/>
|
10161
|
+
<max_length><xsl:value-of select="$max_length"/></max_length>
|
10162
|
+
<addon><xsl:value-of select="$addon"/></addon> -->
|
10163
|
+
</xsl:if>
|
10164
|
+
|
9945
10165
|
<xsl:if test="*[local-name() = 'name']">
|
9946
10166
|
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
9947
10167
|
</xsl:if>
|
@@ -10694,6 +10914,8 @@
|
|
10694
10914
|
<!-- text in the box -->
|
10695
10915
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
|
10696
10916
|
|
10917
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
10918
|
+
|
10697
10919
|
<fo:block-container xsl:use-attribute-sets="admonition-container-style">
|
10698
10920
|
|
10699
10921
|
<fo:block xsl:use-attribute-sets="admonition-name-style">
|
@@ -10872,6 +11094,16 @@
|
|
10872
11094
|
<xsl:apply-templates mode="update_xml_step1"/>
|
10873
11095
|
</xsl:copy>
|
10874
11096
|
</xsl:template>
|
11097
|
+
|
11098
|
+
<!-- remove semantic xml -->
|
11099
|
+
<xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
|
11100
|
+
|
11101
|
+
<!-- remove image/emf -->
|
11102
|
+
<xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
|
11103
|
+
|
11104
|
+
<xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
|
11105
|
+
<xsl:copy-of select="."/>
|
11106
|
+
</xsl:template>
|
10875
11107
|
<!-- =========================================================================== -->
|
10876
11108
|
<!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
|
10877
11109
|
<!-- =========================================================================== -->
|
@@ -10893,7 +11125,7 @@
|
|
10893
11125
|
|
10894
11126
|
<xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
|
10895
11127
|
|
10896
|
-
<xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
|
11128
|
+
<xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
|
10897
11129
|
|
10898
11130
|
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
10899
11131
|
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
@@ -10923,7 +11155,7 @@
|
|
10923
11155
|
<!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
|
10924
11156
|
<!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
|
10925
11157
|
<!-- add < and > to \S -->
|
10926
|
-
<xsl:variable name="regex_S">[^\r\n\t\f\v \<>
|
11158
|
+
<xsl:variable name="regex_S">[^\r\n\t\f\v \<>\u3000-\u9FFF]</xsl:variable>
|
10927
11159
|
<xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
|
10928
11160
|
<xsl:variable name="text3">
|
10929
11161
|
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
@@ -10945,7 +11177,8 @@
|
|
10945
11177
|
<xsl:choose>
|
10946
11178
|
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
10947
11179
|
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
10948
|
-
<xsl:variable name="
|
11180
|
+
<xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
|
11181
|
+
<xsl:variable name="regex_dots_units">((\b((<xsl:value-of select="$non_white_space"/>{1,3}\.<xsl:value-of select="$non_white_space"/>+)|(<xsl:value-of select="$non_white_space"/>+\.<xsl:value-of select="$non_white_space"/>{1,3}))\b)|(\.<xsl:value-of select="$non_white_space"/>{1,3})\b)</xsl:variable>
|
10949
11182
|
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
10950
11183
|
<xsl:choose>
|
10951
11184
|
<xsl:when test="self::text()">
|
@@ -10966,6 +11199,10 @@
|
|
10966
11199
|
|
10967
11200
|
</xsl:template>
|
10968
11201
|
|
11202
|
+
<xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
|
11203
|
+
<xsl:copy-of select="."/>
|
11204
|
+
</xsl:template>
|
11205
|
+
|
10969
11206
|
<xsl:template name="replace_text_tags">
|
10970
11207
|
<xsl:param name="tag_open"/>
|
10971
11208
|
<xsl:param name="tag_close"/>
|
@@ -10992,6 +11229,194 @@
|
|
10992
11229
|
<!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
|
10993
11230
|
<!-- ===================================== -->
|
10994
11231
|
|
11232
|
+
<!-- ===================================== -->
|
11233
|
+
<!-- ===================================== -->
|
11234
|
+
<!-- Make linear XML (need for landscape orientation) -->
|
11235
|
+
<!-- ===================================== -->
|
11236
|
+
<!-- ===================================== -->
|
11237
|
+
<xsl:template match="@*|node()" mode="linear_xml">
|
11238
|
+
<xsl:copy>
|
11239
|
+
<xsl:apply-templates select="@*|node()" mode="linear_xml"/>
|
11240
|
+
</xsl:copy>
|
11241
|
+
</xsl:template>
|
11242
|
+
|
11243
|
+
<xsl:template match="processing-instruction()" mode="linear_xml">
|
11244
|
+
<xsl:copy-of select="."/>
|
11245
|
+
</xsl:template>
|
11246
|
+
|
11247
|
+
<!-- From:
|
11248
|
+
<clause>
|
11249
|
+
<title>...</title>
|
11250
|
+
<p>...</p>
|
11251
|
+
</clause>
|
11252
|
+
To:
|
11253
|
+
<clause/>
|
11254
|
+
<title>...</title>
|
11255
|
+
<p>...</p>
|
11256
|
+
-->
|
11257
|
+
<xsl:template match="*[local-name() = 'foreword'] | *[local-name() = 'foreword']//*[local-name() = 'clause'] | *[local-name() = 'preface']//*[local-name() = 'clause'][not(@type = 'corrigenda') and not(@type = 'policy') and not(@type = 'related-refs')] | *[local-name() = 'introduction'] | *[local-name() = 'introduction']//*[local-name() = 'clause'] | *[local-name() = 'sections']//*[local-name() = 'clause'] | *[local-name() = 'annex'] | *[local-name() = 'annex']//*[local-name() = 'clause'] | *[local-name() = 'references'][not(@hidden = 'true')] | *[local-name() = 'bibliography']/*[local-name() = 'clause'] | *[local-name() = 'colophon'] | *[local-name() = 'colophon']//*[local-name() = 'clause'] | *[local-name()='sections']//*[local-name()='terms'] | *[local-name()='sections']//*[local-name()='definitions'] | *[local-name()='annex']//*[local-name()='definitions']" mode="linear_xml" name="clause_linear">
|
11258
|
+
|
11259
|
+
<xsl:copy>
|
11260
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
11261
|
+
|
11262
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
11263
|
+
|
11264
|
+
<xsl:if test="local-name() = 'foreword' or local-name() = 'introduction' or local-name(..) = 'preface' or local-name(..) = 'sections' or (local-name() = 'references' and parent::*[local-name() = 'bibliography']) or (local-name() = 'clause' and parent::*[local-name() = 'bibliography']) or local-name() = 'annex' or local-name(..) = 'annex' or local-name(..) = 'colophon'">
|
11265
|
+
<xsl:attribute name="mainsection">true</xsl:attribute>
|
11266
|
+
</xsl:if>
|
11267
|
+
</xsl:copy>
|
11268
|
+
|
11269
|
+
<xsl:apply-templates mode="linear_xml"/>
|
11270
|
+
</xsl:template>
|
11271
|
+
|
11272
|
+
<xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
|
11273
|
+
<xsl:copy>
|
11274
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
11275
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
11276
|
+
<xsl:variable name="level">
|
11277
|
+
<xsl:call-template name="getLevel"/>
|
11278
|
+
</xsl:variable>
|
11279
|
+
<xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
|
11280
|
+
<xsl:attribute name="ancestor">sections</xsl:attribute>
|
11281
|
+
<xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
|
11282
|
+
</xsl:copy>
|
11283
|
+
<xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
|
11284
|
+
</xsl:template>
|
11285
|
+
|
11286
|
+
<xsl:template match="*[local-name() = 'introduction']//*[local-name() = 'title'] | *[local-name() = 'foreword']//*[local-name() = 'title'] | *[local-name() = 'sections']//*[local-name() = 'title'] | *[local-name() = 'annex']//*[local-name() = 'title'] | *[local-name() = 'bibliography']/*[local-name() = 'clause']/*[local-name() = 'title'] | *[local-name() = 'references']/*[local-name() = 'title'] | *[local-name() = 'colophon']//*[local-name() = 'title']" mode="linear_xml" priority="2">
|
11287
|
+
<xsl:copy>
|
11288
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
11289
|
+
|
11290
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
11291
|
+
|
11292
|
+
<xsl:variable name="level">
|
11293
|
+
<xsl:call-template name="getLevel"/>
|
11294
|
+
</xsl:variable>
|
11295
|
+
<xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
|
11296
|
+
|
11297
|
+
<xsl:if test="parent::*[local-name() = 'annex']">
|
11298
|
+
<xsl:attribute name="depth">1</xsl:attribute>
|
11299
|
+
</xsl:if>
|
11300
|
+
|
11301
|
+
<xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
|
11302
|
+
<xsl:copy-of select="../@inline-header"/>
|
11303
|
+
</xsl:if>
|
11304
|
+
|
11305
|
+
<xsl:attribute name="ancestor">
|
11306
|
+
<xsl:choose>
|
11307
|
+
<xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
|
11308
|
+
<xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
|
11309
|
+
<xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
|
11310
|
+
<xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
|
11311
|
+
<xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
|
11312
|
+
</xsl:choose>
|
11313
|
+
</xsl:attribute>
|
11314
|
+
|
11315
|
+
<xsl:apply-templates mode="linear_xml"/>
|
11316
|
+
</xsl:copy>
|
11317
|
+
</xsl:template>
|
11318
|
+
|
11319
|
+
<!-- add @to = figure, table, clause -->
|
11320
|
+
<!-- add @depth = from -->
|
11321
|
+
<xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
|
11322
|
+
<xsl:copy>
|
11323
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
11324
|
+
<xsl:variable name="target" select="@target"/>
|
11325
|
+
<xsl:attribute name="to">
|
11326
|
+
<xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
|
11327
|
+
</xsl:attribute>
|
11328
|
+
<xsl:attribute name="depth">
|
11329
|
+
<xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
|
11330
|
+
</xsl:attribute>
|
11331
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
11332
|
+
</xsl:copy>
|
11333
|
+
</xsl:template>
|
11334
|
+
|
11335
|
+
<xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
|
11336
|
+
<xsl:choose>
|
11337
|
+
<xsl:when test="contains(., $non_breaking_hyphen)">
|
11338
|
+
<xsl:call-template name="replaceChar">
|
11339
|
+
<xsl:with-param name="text" select="."/>
|
11340
|
+
<xsl:with-param name="replace" select="$non_breaking_hyphen"/>
|
11341
|
+
<xsl:with-param name="by" select="'-'"/>
|
11342
|
+
</xsl:call-template>
|
11343
|
+
</xsl:when>
|
11344
|
+
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
11345
|
+
</xsl:choose>
|
11346
|
+
</xsl:template>
|
11347
|
+
|
11348
|
+
<xsl:template name="replaceChar">
|
11349
|
+
<xsl:param name="text"/>
|
11350
|
+
<xsl:param name="replace"/>
|
11351
|
+
<xsl:param name="by"/>
|
11352
|
+
<xsl:choose>
|
11353
|
+
<xsl:when test="$text = '' or $replace = '' or not($replace)">
|
11354
|
+
<xsl:value-of select="$text"/>
|
11355
|
+
</xsl:when>
|
11356
|
+
<xsl:when test="contains($text, $replace)">
|
11357
|
+
<xsl:value-of select="substring-before($text,$replace)"/>
|
11358
|
+
<xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
|
11359
|
+
<xsl:call-template name="replaceChar">
|
11360
|
+
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
|
11361
|
+
<xsl:with-param name="replace" select="$replace"/>
|
11362
|
+
<xsl:with-param name="by" select="$by"/>
|
11363
|
+
</xsl:call-template>
|
11364
|
+
</xsl:when>
|
11365
|
+
<xsl:otherwise>
|
11366
|
+
<xsl:value-of select="$text"/>
|
11367
|
+
</xsl:otherwise>
|
11368
|
+
</xsl:choose>
|
11369
|
+
</xsl:template>
|
11370
|
+
|
11371
|
+
<xsl:template match="*[local-name() = 'inlineChar']">
|
11372
|
+
<fo:inline><xsl:value-of select="."/></fo:inline>
|
11373
|
+
</xsl:template>
|
11374
|
+
|
11375
|
+
<!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
|
11376
|
+
<!--
|
11377
|
+
<fn reference="1">
|
11378
|
+
<p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
|
11379
|
+
</fn>
|
11380
|
+
-->
|
11381
|
+
<xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
|
11382
|
+
<xsl:variable name="p_fn_">
|
11383
|
+
<xsl:call-template name="get_fn_list"/>
|
11384
|
+
</xsl:variable>
|
11385
|
+
<xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
|
11386
|
+
<xsl:variable name="gen_id" select="generate-id(.)"/>
|
11387
|
+
<xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
|
11388
|
+
<xsl:variable name="reference" select="@reference"/>
|
11389
|
+
<!-- fn sequence number in document -->
|
11390
|
+
<xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
|
11391
|
+
|
11392
|
+
<xsl:copy>
|
11393
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
11394
|
+
<!-- put actual reference number -->
|
11395
|
+
<xsl:attribute name="current_fn_number">
|
11396
|
+
<xsl:value-of select="$current_fn_number"/>
|
11397
|
+
</xsl:attribute>
|
11398
|
+
<xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
|
11399
|
+
<xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
|
11400
|
+
</xsl:attribute>
|
11401
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
11402
|
+
</xsl:copy>
|
11403
|
+
</xsl:template>
|
11404
|
+
|
11405
|
+
<xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
|
11406
|
+
<xsl:copy>
|
11407
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
11408
|
+
<xsl:if test="@depth = '1'">
|
11409
|
+
<xsl:attribute name="mainsection">true</xsl:attribute>
|
11410
|
+
</xsl:if>
|
11411
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
11412
|
+
</xsl:copy>
|
11413
|
+
</xsl:template>
|
11414
|
+
<!-- ===================================== -->
|
11415
|
+
<!-- ===================================== -->
|
11416
|
+
<!-- END: Make linear XML (need for landscape orientation) -->
|
11417
|
+
<!-- ===================================== -->
|
11418
|
+
<!-- ===================================== -->
|
11419
|
+
|
10995
11420
|
<!-- for correct rendering combining chars -->
|
10996
11421
|
<xsl:template match="*[local-name() = 'lang_none']">
|
10997
11422
|
<fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
|
@@ -11548,6 +11973,23 @@
|
|
11548
11973
|
</xsl:if>
|
11549
11974
|
</xsl:template>
|
11550
11975
|
|
11976
|
+
<xsl:template name="setBlockAttributes">
|
11977
|
+
<xsl:param name="text_align_default">left</xsl:param>
|
11978
|
+
<xsl:call-template name="setTextAlignment">
|
11979
|
+
<xsl:with-param name="default" select="$text_align_default"/>
|
11980
|
+
</xsl:call-template>
|
11981
|
+
|
11982
|
+
<!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
|
11983
|
+
<!-- Example: keep-lines-together="true" -->
|
11984
|
+
<xsl:if test="@keep-lines-together = 'true'">
|
11985
|
+
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
|
11986
|
+
</xsl:if>
|
11987
|
+
<!-- Example: keep-with-next="true" -->
|
11988
|
+
<xsl:if test="@keep-with-next = 'true'">
|
11989
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
11990
|
+
</xsl:if>
|
11991
|
+
</xsl:template>
|
11992
|
+
|
11551
11993
|
<xsl:template name="number-to-words">
|
11552
11994
|
<xsl:param name="number"/>
|
11553
11995
|
<xsl:param name="first"/>
|