metanorma-ribose 2.2.4 → 2.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/ribose/base_convert.rb +2 -2
- data/lib/isodoc/ribose/html/htmlstyle.css +4 -0
- data/lib/isodoc/ribose/ribose.standard.xsl +545 -104
- data/lib/metanorma/ribose/isodoc.rng +46 -296
- data/lib/metanorma/ribose/version.rb +1 -1
- data/metanorma-ribose.gemspec +1 -1
- metadata +4 -4
@@ -1799,7 +1799,6 @@
|
|
1799
1799
|
|
1800
1800
|
<xsl:attribute-set name="table-header-cell-style">
|
1801
1801
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
1802
|
-
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1803
1802
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1804
1803
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1805
1804
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
@@ -1811,7 +1810,6 @@
|
|
1811
1810
|
|
1812
1811
|
<xsl:attribute-set name="table-cell-style">
|
1813
1812
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
1814
|
-
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1815
1813
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1816
1814
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1817
1815
|
|
@@ -2028,6 +2026,7 @@
|
|
2028
2026
|
<xsl:attribute-set name="term-name-style">
|
2029
2027
|
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
2030
2028
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
2029
|
+
|
2031
2030
|
</xsl:attribute-set>
|
2032
2031
|
|
2033
2032
|
<xsl:attribute-set name="figure-block-style">
|
@@ -2609,7 +2608,7 @@
|
|
2609
2608
|
<xsl:apply-templates select="." mode="contents"/>
|
2610
2609
|
</xsl:for-each>
|
2611
2610
|
|
2612
|
-
<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')]]">
|
2611
|
+
<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]">
|
2613
2612
|
<xsl:sort select="@displayorder" data-type="number"/>
|
2614
2613
|
<xsl:apply-templates select="." mode="contents"/>
|
2615
2614
|
</xsl:for-each>
|
@@ -3018,7 +3017,7 @@
|
|
3018
3017
|
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
3019
3018
|
</xsl:when>
|
3020
3019
|
<xsl:otherwise>
|
3021
|
-
<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
|
3020
|
+
<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 -->
|
3022
3021
|
</xsl:otherwise>
|
3023
3022
|
</xsl:choose>
|
3024
3023
|
|
@@ -3521,7 +3520,7 @@
|
|
3521
3520
|
<xsl:param name="colwidths"/>
|
3522
3521
|
<xsl:param name="colgroup"/>
|
3523
3522
|
|
3524
|
-
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
|
3523
|
+
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
|
3525
3524
|
|
3526
3525
|
<xsl:variable name="isNoteOrFnExistShowAfterTable">
|
3527
3526
|
|
@@ -3540,6 +3539,10 @@
|
|
3540
3539
|
</xsl:choose>
|
3541
3540
|
</xsl:variable>
|
3542
3541
|
|
3542
|
+
<xsl:variable name="table_fn_block">
|
3543
|
+
<xsl:call-template name="table_fn_display"/>
|
3544
|
+
</xsl:variable>
|
3545
|
+
|
3543
3546
|
<xsl:variable name="tableWithNotesAndFootnotes">
|
3544
3547
|
|
3545
3548
|
<fo:table keep-with-previous="always">
|
@@ -3585,13 +3588,28 @@
|
|
3585
3588
|
|
3586
3589
|
<!-- except gb and bsi -->
|
3587
3590
|
|
3591
|
+
<xsl:apply-templates select="../*[local-name()='dl']"/>
|
3588
3592
|
<xsl:apply-templates select="../*[local-name()='note']"/>
|
3589
3593
|
|
3594
|
+
<xsl:variable name="isDisplayRowSeparator">
|
3595
|
+
|
3596
|
+
</xsl:variable>
|
3597
|
+
|
3590
3598
|
<!-- horizontal row separator -->
|
3599
|
+
<xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
|
3600
|
+
<xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
|
3601
|
+
<fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
|
3602
|
+
|
3603
|
+
<xsl:call-template name="setBordersTableArray"/>
|
3604
|
+
<fo:block font-size="1pt"> </fo:block>
|
3605
|
+
</fo:block-container>
|
3606
|
+
</xsl:if>
|
3607
|
+
</xsl:if>
|
3591
3608
|
|
3592
3609
|
<!-- fn processing -->
|
3593
3610
|
|
3594
|
-
<xsl:call-template name="table_fn_display"/>
|
3611
|
+
<!-- <xsl:call-template name="table_fn_display" /> -->
|
3612
|
+
<xsl:copy-of select="$table_fn_block"/>
|
3595
3613
|
|
3596
3614
|
<!-- for PAS display Notes after footnotes -->
|
3597
3615
|
|
@@ -3696,7 +3714,7 @@
|
|
3696
3714
|
<!-- ===================== -->
|
3697
3715
|
<!-- Table's row processing -->
|
3698
3716
|
<!-- ===================== -->
|
3699
|
-
<!-- row in table header (thead) -->
|
3717
|
+
<!-- row in table header (thead) thead/tr -->
|
3700
3718
|
<xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
3701
3719
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
3702
3720
|
|
@@ -3708,7 +3726,29 @@
|
|
3708
3726
|
</fo:table-row>
|
3709
3727
|
</xsl:template>
|
3710
3728
|
|
3711
|
-
|
3729
|
+
<xsl:template name="setBorderUnderRow">
|
3730
|
+
<xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
|
3731
|
+
<xsl:choose>
|
3732
|
+
<xsl:when test="$border_under_row_ != ''">
|
3733
|
+
<xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
|
3734
|
+
<xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
|
3735
|
+
<xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
|
3736
|
+
<xsl:variable name="border_under_row">
|
3737
|
+
<xsl:call-template name="split">
|
3738
|
+
<xsl:with-param name="pText" select="$border_under_row_"/>
|
3739
|
+
</xsl:call-template>
|
3740
|
+
</xsl:variable>
|
3741
|
+
<xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
|
3742
|
+
<xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
|
3743
|
+
</xsl:if>
|
3744
|
+
</xsl:when>
|
3745
|
+
<xsl:otherwise>
|
3746
|
+
<xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
|
3747
|
+
</xsl:otherwise>
|
3748
|
+
</xsl:choose>
|
3749
|
+
</xsl:template>
|
3750
|
+
|
3751
|
+
<!-- row in table footer (tfoot), tfoot/tr -->
|
3712
3752
|
<xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
|
3713
3753
|
<fo:table-row xsl:use-attribute-sets="table-footer-row-style">
|
3714
3754
|
|
@@ -4041,8 +4081,16 @@
|
|
4041
4081
|
<!-- figure's footnotes rendering -->
|
4042
4082
|
<xsl:template name="fn_display_figure">
|
4043
4083
|
|
4084
|
+
<!-- current figure id -->
|
4085
|
+
<xsl:variable name="figure_id_">
|
4086
|
+
<xsl:value-of select="@id"/>
|
4087
|
+
<xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
|
4088
|
+
</xsl:variable>
|
4089
|
+
<xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
|
4090
|
+
|
4091
|
+
<!-- all footnotes relates to the current figure -->
|
4044
4092
|
<xsl:variable name="references">
|
4045
|
-
<xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
|
4093
|
+
<xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
|
4046
4094
|
<fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
|
4047
4095
|
<xsl:apply-templates/>
|
4048
4096
|
</fn>
|
@@ -4055,91 +4103,93 @@
|
|
4055
4103
|
|
4056
4104
|
</xsl:variable>
|
4057
4105
|
|
4058
|
-
|
4059
|
-
|
4060
|
-
|
4061
|
-
|
4062
|
-
|
4063
|
-
|
4106
|
+
<fo:block>
|
4107
|
+
|
4108
|
+
<!-- current hierarchy is 'figure' element -->
|
4109
|
+
<xsl:variable name="following_dl_colwidths">
|
4110
|
+
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
4111
|
+
<xsl:variable name="simple-table">
|
4112
|
+
<!-- <xsl:variable name="doc_ns">
|
4113
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
4114
|
+
</xsl:variable>
|
4115
|
+
<xsl:variable name="ns">
|
4116
|
+
<xsl:choose>
|
4117
|
+
<xsl:when test="normalize-space($doc_ns) != ''">
|
4118
|
+
<xsl:value-of select="normalize-space($doc_ns)"/>
|
4119
|
+
</xsl:when>
|
4120
|
+
<xsl:otherwise>
|
4121
|
+
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
4122
|
+
</xsl:otherwise>
|
4123
|
+
</xsl:choose>
|
4124
|
+
</xsl:variable> -->
|
4125
|
+
|
4126
|
+
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
4127
|
+
<tbody>
|
4128
|
+
<xsl:apply-templates mode="dl"/>
|
4129
|
+
</tbody>
|
4130
|
+
</xsl:for-each>
|
4131
|
+
</xsl:variable>
|
4132
|
+
|
4133
|
+
<xsl:call-template name="calculate-column-widths">
|
4134
|
+
<xsl:with-param name="cols-count" select="2"/>
|
4135
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
4136
|
+
</xsl:call-template>
|
4137
|
+
|
4138
|
+
</xsl:if>
|
4064
4139
|
</xsl:variable>
|
4065
|
-
|
4140
|
+
|
4141
|
+
<xsl:variable name="maxlength_dt">
|
4142
|
+
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
4143
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
4144
|
+
</xsl:for-each>
|
4145
|
+
</xsl:variable>
|
4146
|
+
|
4147
|
+
<fo:table width="95%" table-layout="fixed">
|
4148
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4149
|
+
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
4150
|
+
|
4151
|
+
</xsl:if>
|
4066
4152
|
<xsl:choose>
|
4067
|
-
|
4068
|
-
|
4153
|
+
<!-- if there 'dl', then set same columns width -->
|
4154
|
+
<xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
|
4155
|
+
<xsl:call-template name="setColumnWidth_dl">
|
4156
|
+
<xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
|
4157
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
4158
|
+
</xsl:call-template>
|
4069
4159
|
</xsl:when>
|
4070
4160
|
<xsl:otherwise>
|
4071
|
-
<
|
4161
|
+
<fo:table-column column-width="5%"/>
|
4162
|
+
<fo:table-column column-width="95%"/>
|
4072
4163
|
</xsl:otherwise>
|
4073
4164
|
</xsl:choose>
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4077
|
-
|
4078
|
-
|
4079
|
-
|
4080
|
-
|
4081
|
-
|
4082
|
-
|
4083
|
-
|
4084
|
-
|
4085
|
-
|
4086
|
-
|
4087
|
-
|
4088
|
-
|
4089
|
-
</xsl:variable>
|
4165
|
+
<fo:table-body>
|
4166
|
+
<xsl:for-each select="xalan:nodeset($references)//fn">
|
4167
|
+
<xsl:variable name="reference" select="@reference"/>
|
4168
|
+
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
4169
|
+
<fo:table-row>
|
4170
|
+
<fo:table-cell>
|
4171
|
+
<fo:block>
|
4172
|
+
<fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
|
4173
|
+
<xsl:value-of select="@reference"/>
|
4174
|
+
</fo:inline>
|
4175
|
+
</fo:block>
|
4176
|
+
</fo:table-cell>
|
4177
|
+
<fo:table-cell>
|
4178
|
+
<fo:block xsl:use-attribute-sets="figure-fn-body-style">
|
4179
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4090
4180
|
|
4091
|
-
|
4092
|
-
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
4093
|
-
<xsl:call-template name="getMaxLength_dt"/>
|
4094
|
-
</xsl:for-each>
|
4095
|
-
</xsl:variable>
|
4181
|
+
<xsl:attribute name="margin-bottom">0</xsl:attribute>
|
4096
4182
|
|
4097
|
-
|
4098
|
-
|
4099
|
-
|
4100
|
-
|
4101
|
-
|
4102
|
-
|
4103
|
-
|
4104
|
-
|
4105
|
-
|
4106
|
-
<xsl:call-template name="setColumnWidth_dl">
|
4107
|
-
<xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
|
4108
|
-
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
4109
|
-
</xsl:call-template>
|
4110
|
-
</xsl:when>
|
4111
|
-
<xsl:otherwise>
|
4112
|
-
<fo:table-column column-width="15%"/>
|
4113
|
-
<fo:table-column column-width="85%"/>
|
4114
|
-
</xsl:otherwise>
|
4115
|
-
</xsl:choose>
|
4116
|
-
<fo:table-body>
|
4117
|
-
<xsl:for-each select="xalan:nodeset($references)//fn">
|
4118
|
-
<xsl:variable name="reference" select="@reference"/>
|
4119
|
-
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
4120
|
-
<fo:table-row>
|
4121
|
-
<fo:table-cell>
|
4122
|
-
<fo:block>
|
4123
|
-
<fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
|
4124
|
-
<xsl:value-of select="@reference"/>
|
4125
|
-
</fo:inline>
|
4126
|
-
</fo:block>
|
4127
|
-
</fo:table-cell>
|
4128
|
-
<fo:table-cell>
|
4129
|
-
<fo:block xsl:use-attribute-sets="figure-fn-body-style">
|
4130
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4131
|
-
|
4132
|
-
<xsl:attribute name="margin-bottom">0</xsl:attribute>
|
4183
|
+
</xsl:if>
|
4184
|
+
<xsl:copy-of select="./node()"/>
|
4185
|
+
</fo:block>
|
4186
|
+
</fo:table-cell>
|
4187
|
+
</fo:table-row>
|
4188
|
+
</xsl:if>
|
4189
|
+
</xsl:for-each>
|
4190
|
+
</fo:table-body>
|
4191
|
+
</fo:table>
|
4133
4192
|
|
4134
|
-
</xsl:if>
|
4135
|
-
<xsl:copy-of select="./node()"/>
|
4136
|
-
</fo:block>
|
4137
|
-
</fo:table-cell>
|
4138
|
-
</fo:table-row>
|
4139
|
-
</xsl:if>
|
4140
|
-
</xsl:for-each>
|
4141
|
-
</fo:table-body>
|
4142
|
-
</fo:table>
|
4143
4193
|
</fo:block>
|
4144
4194
|
</xsl:if>
|
4145
4195
|
|
@@ -4179,6 +4229,8 @@
|
|
4179
4229
|
<!-- <dl><xsl:copy-of select="."/></dl> -->
|
4180
4230
|
<fo:block-container>
|
4181
4231
|
|
4232
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
4233
|
+
|
4182
4234
|
<xsl:if test="not(ancestor::*[local-name() = 'quote'])">
|
4183
4235
|
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
4184
4236
|
</xsl:if>
|
@@ -4215,12 +4267,14 @@
|
|
4215
4267
|
|
4216
4268
|
<fo:block margin-bottom="12pt" text-align="left">
|
4217
4269
|
|
4218
|
-
<xsl:variable name="title-where">
|
4270
|
+
<!-- <xsl:variable name="title-where">
|
4219
4271
|
<xsl:call-template name="getLocalizedString">
|
4220
4272
|
<xsl:with-param name="key">where</xsl:with-param>
|
4221
4273
|
</xsl:call-template>
|
4222
4274
|
</xsl:variable>
|
4223
|
-
<xsl:value-of select="$title-where"
|
4275
|
+
<xsl:value-of select="$title-where"/> -->
|
4276
|
+
<xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
|
4277
|
+
<xsl:text> </xsl:text>
|
4224
4278
|
<xsl:apply-templates select="*[local-name()='dt']/*"/>
|
4225
4279
|
<xsl:text/>
|
4226
4280
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
@@ -4230,12 +4284,14 @@
|
|
4230
4284
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
4231
4285
|
<fo:block margin-bottom="12pt" text-align="left">
|
4232
4286
|
|
4233
|
-
<xsl:variable name="title-where">
|
4287
|
+
<!-- <xsl:variable name="title-where">
|
4234
4288
|
<xsl:call-template name="getLocalizedString">
|
4235
4289
|
<xsl:with-param name="key">where</xsl:with-param>
|
4236
4290
|
</xsl:call-template>
|
4237
4291
|
</xsl:variable>
|
4238
|
-
<xsl:value-of select="$title-where"
|
4292
|
+
<xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
|
4293
|
+
<!-- preceding 'p' with word 'where' -->
|
4294
|
+
<xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
|
4239
4295
|
</fo:block>
|
4240
4296
|
</xsl:when> <!-- END: a few components -->
|
4241
4297
|
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
@@ -4421,6 +4477,9 @@
|
|
4421
4477
|
|
4422
4478
|
</xsl:template> <!-- END: dl -->
|
4423
4479
|
|
4480
|
+
<!-- ignore 'p' with 'where' in formula, before 'dl' -->
|
4481
|
+
<xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
|
4482
|
+
|
4424
4483
|
<xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
|
4425
4484
|
<xsl:param name="process">false</xsl:param>
|
4426
4485
|
<xsl:if test="$process = 'true'">
|
@@ -5258,8 +5317,8 @@
|
|
5258
5317
|
|
5259
5318
|
<!-- add zero-width space (#x200B) after dot with next non-digit -->
|
5260
5319
|
<xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1$2')"/>
|
5261
|
-
<!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
|
5262
|
-
<xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—|
|
5320
|
+
<!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
|
5321
|
+
<xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1')"/>
|
5263
5322
|
<!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
|
5264
5323
|
<xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1$2')"/>
|
5265
5324
|
<!-- add zero-width space (#x200B) after characters: 'great than' -->
|
@@ -5270,8 +5329,19 @@
|
|
5270
5329
|
<xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?<!\W)(\{)', '$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
|
5271
5330
|
<!-- add zero-width space (#x200B) after character: , -->
|
5272
5331
|
<xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1')"/> <!-- negative lookahead: ',' not followed by digit -->
|
5332
|
+
<!-- add zero-width space (#x200B) after character: '/' -->
|
5333
|
+
<xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1')"/><!-- negative lookahead: '/' not followed by '/' -->
|
5273
5334
|
|
5274
|
-
<xsl:
|
5335
|
+
<xsl:variable name="text9">
|
5336
|
+
<xsl:choose>
|
5337
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
5338
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
|
5339
|
+
</xsl:when>
|
5340
|
+
<xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
|
5341
|
+
</xsl:choose>
|
5342
|
+
</xsl:variable>
|
5343
|
+
|
5344
|
+
<xsl:value-of select="$text9"/>
|
5275
5345
|
</xsl:template>
|
5276
5346
|
|
5277
5347
|
<xsl:template name="add-zero-spaces-link-java">
|
@@ -5279,8 +5349,8 @@
|
|
5279
5349
|
|
5280
5350
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
|
5281
5351
|
<xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
|
5282
|
-
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
|
5283
|
-
<xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—|
|
5352
|
+
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
|
5353
|
+
<xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1')"/>
|
5284
5354
|
<!-- remove zero-width space at the end -->
|
5285
5355
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '$', '')"/>
|
5286
5356
|
</xsl:template>
|
@@ -5635,9 +5705,28 @@
|
|
5635
5705
|
</xsl:variable>
|
5636
5706
|
<xsl:copy-of select="$newRow"/>
|
5637
5707
|
|
5638
|
-
|
5639
|
-
|
5640
|
-
|
5708
|
+
<!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
|
5709
|
+
<xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
|
5710
|
+
<xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
|
5711
|
+
<xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
|
5712
|
+
<xsl:choose>
|
5713
|
+
<xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan <= 0">
|
5714
|
+
<xsl:copy-of select="following-sibling::tr"/>
|
5715
|
+
</xsl:when>
|
5716
|
+
<!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan > 0">
|
5717
|
+
<xsl:copy-of select="following-sibling::tr[position() <= $nextrow_without_rowspan]"/>
|
5718
|
+
|
5719
|
+
<xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
|
5720
|
+
<xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
|
5721
|
+
<xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
|
5722
|
+
</xsl:apply-templates>
|
5723
|
+
</xsl:when> -->
|
5724
|
+
<xsl:otherwise>
|
5725
|
+
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
5726
|
+
<xsl:with-param name="previousRow" select="$newRow"/>
|
5727
|
+
</xsl:apply-templates>
|
5728
|
+
</xsl:otherwise>
|
5729
|
+
</xsl:choose>
|
5641
5730
|
</xsl:template>
|
5642
5731
|
<!-- End mode simple-table-rowspan -->
|
5643
5732
|
|
@@ -5800,6 +5889,27 @@
|
|
5800
5889
|
</xsl:call-template>
|
5801
5890
|
</xsl:template>
|
5802
5891
|
|
5892
|
+
<xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
|
5893
|
+
<xsl:variable name="link">
|
5894
|
+
<link_updated>
|
5895
|
+
<xsl:variable name="target_text">
|
5896
|
+
<xsl:choose>
|
5897
|
+
<xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
|
5898
|
+
<xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
|
5899
|
+
</xsl:when>
|
5900
|
+
<xsl:otherwise>
|
5901
|
+
<xsl:value-of select="normalize-space(@target)"/>
|
5902
|
+
</xsl:otherwise>
|
5903
|
+
</xsl:choose>
|
5904
|
+
</xsl:variable>
|
5905
|
+
<xsl:value-of select="$target_text"/>
|
5906
|
+
</link_updated>
|
5907
|
+
</xsl:variable>
|
5908
|
+
<xsl:for-each select="xalan:nodeset($link)/*">
|
5909
|
+
<xsl:apply-templates mode="td_text_with_formatting"/>
|
5910
|
+
</xsl:for-each>
|
5911
|
+
</xsl:template>
|
5912
|
+
|
5803
5913
|
<xsl:template name="getFormattingTags">
|
5804
5914
|
<tags>
|
5805
5915
|
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
@@ -6141,7 +6251,7 @@
|
|
6141
6251
|
</xsl:variable>
|
6142
6252
|
<fo:inline xsl:use-attribute-sets="link-style">
|
6143
6253
|
|
6144
|
-
<xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
|
6254
|
+
<xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
|
6145
6255
|
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
|
6146
6256
|
</xsl:if>
|
6147
6257
|
|
@@ -6202,13 +6312,17 @@
|
|
6202
6312
|
</xsl:template>
|
6203
6313
|
|
6204
6314
|
<xsl:template match="*[local-name() = 'callout']">
|
6205
|
-
<
|
6315
|
+
<xsl:choose>
|
6316
|
+
<xsl:when test="normalize-space(@target) = ''"><<xsl:apply-templates/>></xsl:when>
|
6317
|
+
<xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}"><<xsl:apply-templates/>></fo:basic-link></xsl:otherwise>
|
6318
|
+
</xsl:choose>
|
6206
6319
|
</xsl:template>
|
6207
6320
|
|
6208
6321
|
<xsl:template match="*[local-name() = 'annotation']">
|
6209
6322
|
<xsl:variable name="annotation-id" select="@id"/>
|
6210
6323
|
<xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
|
6211
6324
|
<fo:block id="{$annotation-id}" white-space="nowrap">
|
6325
|
+
|
6212
6326
|
<fo:inline>
|
6213
6327
|
<xsl:apply-templates>
|
6214
6328
|
<xsl:with-param name="callout" select="concat('<', $callout, '> ')"/>
|
@@ -6313,6 +6427,10 @@
|
|
6313
6427
|
<!-- ====== -->
|
6314
6428
|
<!-- ====== -->
|
6315
6429
|
|
6430
|
+
<xsl:template name="setBlockSpanAll">
|
6431
|
+
<xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
|
6432
|
+
</xsl:template>
|
6433
|
+
|
6316
6434
|
<!-- ====== -->
|
6317
6435
|
<!-- note -->
|
6318
6436
|
<!-- termnote -->
|
@@ -6322,6 +6440,8 @@
|
|
6322
6440
|
|
6323
6441
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
|
6324
6442
|
|
6443
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
6444
|
+
|
6325
6445
|
<xsl:if test="ancestor::rsd:ul or ancestor::rsd:ol and not(ancestor::rsd:note[1]/following-sibling::*)">
|
6326
6446
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
6327
6447
|
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
@@ -6377,6 +6497,8 @@
|
|
6377
6497
|
<xsl:template match="*[local-name() = 'termnote']">
|
6378
6498
|
<fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
|
6379
6499
|
|
6500
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
6501
|
+
|
6380
6502
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
6381
6503
|
|
6382
6504
|
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
@@ -6514,10 +6636,10 @@
|
|
6514
6636
|
<fo:block xsl:use-attribute-sets="figure-style">
|
6515
6637
|
<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
|
6516
6638
|
</fo:block>
|
6517
|
-
<xsl:call-template name="fn_display_figure"/>
|
6518
6639
|
<xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
|
6519
6640
|
<xsl:call-template name="note"/>
|
6520
6641
|
</xsl:for-each>
|
6642
|
+
<xsl:call-template name="fn_display_figure"/>
|
6521
6643
|
|
6522
6644
|
</fo:block-container>
|
6523
6645
|
</xsl:template>
|
@@ -6578,7 +6700,13 @@
|
|
6578
6700
|
</xsl:choose>
|
6579
6701
|
</xsl:variable>
|
6580
6702
|
|
6581
|
-
<xsl:variable name="
|
6703
|
+
<xsl:variable name="image_width_effective">
|
6704
|
+
|
6705
|
+
<xsl:value-of select="$width_effective"/>
|
6706
|
+
|
6707
|
+
</xsl:variable>
|
6708
|
+
|
6709
|
+
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
|
6582
6710
|
<xsl:if test="number($scale) < 100">
|
6583
6711
|
|
6584
6712
|
<xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
|
@@ -7165,6 +7293,13 @@
|
|
7165
7293
|
<xsl:when test="$contents_nodes/doc">
|
7166
7294
|
<xsl:choose>
|
7167
7295
|
<xsl:when test="count($contents_nodes/doc) > 1">
|
7296
|
+
|
7297
|
+
<xsl:if test="$contents_nodes/collection">
|
7298
|
+
<fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
|
7299
|
+
<fo:bookmark-title>collection.pdf</fo:bookmark-title>
|
7300
|
+
</fo:bookmark>
|
7301
|
+
</xsl:if>
|
7302
|
+
|
7168
7303
|
<xsl:for-each select="$contents_nodes/doc">
|
7169
7304
|
<fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
|
7170
7305
|
<xsl:if test="@bundle = 'true'">
|
@@ -8295,6 +8430,9 @@
|
|
8295
8430
|
<!-- ====== -->
|
8296
8431
|
<xsl:template match="*[local-name() = 'termexample']">
|
8297
8432
|
<fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
|
8433
|
+
|
8434
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
8435
|
+
|
8298
8436
|
<xsl:apply-templates select="*[local-name()='name']"/>
|
8299
8437
|
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
8300
8438
|
</fo:block>
|
@@ -8346,6 +8484,8 @@
|
|
8346
8484
|
|
8347
8485
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
8348
8486
|
|
8487
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
8488
|
+
|
8349
8489
|
<xsl:if test="ancestor::rsd:ul or ancestor::rsd:ol">
|
8350
8490
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
8351
8491
|
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
@@ -8378,6 +8518,35 @@
|
|
8378
8518
|
</fo:block-container>
|
8379
8519
|
</xsl:when> <!-- end block -->
|
8380
8520
|
|
8521
|
+
<xsl:when test="contains(normalize-space($fo_element), 'list')">
|
8522
|
+
|
8523
|
+
<xsl:variable name="provisional_distance_between_starts">
|
8524
|
+
7
|
8525
|
+
</xsl:variable>
|
8526
|
+
<xsl:variable name="indent">
|
8527
|
+
0
|
8528
|
+
</xsl:variable>
|
8529
|
+
|
8530
|
+
<fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
|
8531
|
+
<fo:list-item>
|
8532
|
+
<fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
|
8533
|
+
<fo:block>
|
8534
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
8535
|
+
<xsl:with-param name="fo_element">block</xsl:with-param>
|
8536
|
+
</xsl:apply-templates>
|
8537
|
+
</fo:block>
|
8538
|
+
</fo:list-item-label>
|
8539
|
+
<fo:list-item-body start-indent="body-start()">
|
8540
|
+
<fo:block>
|
8541
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
8542
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
8543
|
+
</xsl:apply-templates>
|
8544
|
+
</fo:block>
|
8545
|
+
</fo:list-item-body>
|
8546
|
+
</fo:list-item>
|
8547
|
+
</fo:list-block>
|
8548
|
+
</xsl:when> <!-- end list -->
|
8549
|
+
|
8381
8550
|
<xsl:otherwise> <!-- inline -->
|
8382
8551
|
|
8383
8552
|
<!-- display 'EXAMPLE' and first element in the same line -->
|
@@ -8458,6 +8627,11 @@
|
|
8458
8627
|
</fo:block>
|
8459
8628
|
</fo:block-container>
|
8460
8629
|
</xsl:when>
|
8630
|
+
<xsl:when test="starts-with(normalize-space($element), 'list')">
|
8631
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
8632
|
+
<xsl:apply-templates/>
|
8633
|
+
</fo:block>
|
8634
|
+
</xsl:when>
|
8461
8635
|
<xsl:otherwise>
|
8462
8636
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
8463
8637
|
<xsl:apply-templates/>
|
@@ -8575,6 +8749,9 @@
|
|
8575
8749
|
<!-- ====== -->
|
8576
8750
|
<xsl:template match="*[local-name() = 'quote']">
|
8577
8751
|
<fo:block-container margin-left="0mm">
|
8752
|
+
|
8753
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
8754
|
+
|
8578
8755
|
<xsl:if test="parent::*[local-name() = 'note']">
|
8579
8756
|
<xsl:if test="not(ancestor::*[local-name() = 'table'])">
|
8580
8757
|
<xsl:attribute name="margin-left">5mm</xsl:attribute>
|
@@ -8860,6 +9037,8 @@
|
|
8860
9037
|
<fo:block>
|
8861
9038
|
<xsl:call-template name="setId"/>
|
8862
9039
|
|
9040
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
9041
|
+
|
8863
9042
|
<xsl:apply-templates/>
|
8864
9043
|
</fo:block>
|
8865
9044
|
</xsl:template>
|
@@ -8874,6 +9053,8 @@
|
|
8874
9053
|
<fo:block break-after="page"/>
|
8875
9054
|
<fo:block id="{@id}">
|
8876
9055
|
|
9056
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
9057
|
+
|
8877
9058
|
</fo:block>
|
8878
9059
|
<xsl:apply-templates/>
|
8879
9060
|
</xsl:template>
|
@@ -9064,6 +9245,44 @@
|
|
9064
9245
|
|
9065
9246
|
<fo:list-block xsl:use-attribute-sets="list-style">
|
9066
9247
|
|
9248
|
+
<xsl:variable name="provisional_distance_between_starts_">
|
9249
|
+
<attributes xsl:use-attribute-sets="list-style">
|
9250
|
+
|
9251
|
+
</attributes>
|
9252
|
+
</xsl:variable>
|
9253
|
+
<xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
|
9254
|
+
<xsl:if test="$provisional_distance_between_starts != ''">
|
9255
|
+
<xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
|
9256
|
+
</xsl:if>
|
9257
|
+
<xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
|
9258
|
+
|
9259
|
+
<!-- increase provisional-distance-between-starts for long lists -->
|
9260
|
+
<xsl:if test="local-name() = 'ol'">
|
9261
|
+
<!-- Examples: xiii), xviii), xxviii) -->
|
9262
|
+
<xsl:variable name="item_numbers">
|
9263
|
+
<xsl:for-each select="*[local-name() = 'li']">
|
9264
|
+
<item><xsl:call-template name="getListItemFormat"/></item>
|
9265
|
+
</xsl:for-each>
|
9266
|
+
</xsl:variable>
|
9267
|
+
|
9268
|
+
<xsl:variable name="max_length">
|
9269
|
+
<xsl:for-each select="xalan:nodeset($item_numbers)/item">
|
9270
|
+
<xsl:sort select="string-length(.)" data-type="number" order="descending"/>
|
9271
|
+
<xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
|
9272
|
+
</xsl:for-each>
|
9273
|
+
</xsl:variable>
|
9274
|
+
|
9275
|
+
<!-- base width (provisional-distance-between-starts) for 4 chars -->
|
9276
|
+
<xsl:variable name="addon" select="$max_length - 4"/>
|
9277
|
+
<xsl:if test="$addon > 0">
|
9278
|
+
<xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
|
9279
|
+
</xsl:if>
|
9280
|
+
<!-- DEBUG -->
|
9281
|
+
<!-- <xsl:copy-of select="$item_numbers"/>
|
9282
|
+
<max_length><xsl:value-of select="$max_length"/></max_length>
|
9283
|
+
<addon><xsl:value-of select="$addon"/></addon> -->
|
9284
|
+
</xsl:if>
|
9285
|
+
|
9067
9286
|
<xsl:if test="*[local-name() = 'name']">
|
9068
9287
|
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
9069
9288
|
</xsl:if>
|
@@ -9784,6 +10003,8 @@
|
|
9784
10003
|
<!-- text in the box -->
|
9785
10004
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
|
9786
10005
|
|
10006
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
10007
|
+
|
9787
10008
|
<fo:block-container xsl:use-attribute-sets="admonition-container-style">
|
9788
10009
|
|
9789
10010
|
<fo:block xsl:use-attribute-sets="admonition-name-style">
|
@@ -9962,6 +10183,16 @@
|
|
9962
10183
|
<xsl:apply-templates mode="update_xml_step1"/>
|
9963
10184
|
</xsl:copy>
|
9964
10185
|
</xsl:template>
|
10186
|
+
|
10187
|
+
<!-- remove semantic xml -->
|
10188
|
+
<xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
|
10189
|
+
|
10190
|
+
<!-- remove image/emf -->
|
10191
|
+
<xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
|
10192
|
+
|
10193
|
+
<xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
|
10194
|
+
<xsl:copy-of select="."/>
|
10195
|
+
</xsl:template>
|
9965
10196
|
<!-- =========================================================================== -->
|
9966
10197
|
<!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
|
9967
10198
|
<!-- =========================================================================== -->
|
@@ -9983,7 +10214,7 @@
|
|
9983
10214
|
|
9984
10215
|
<xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
|
9985
10216
|
|
9986
|
-
<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">
|
10217
|
+
<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">
|
9987
10218
|
|
9988
10219
|
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
9989
10220
|
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
@@ -10013,7 +10244,7 @@
|
|
10013
10244
|
<!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
|
10014
10245
|
<!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
|
10015
10246
|
<!-- add < and > to \S -->
|
10016
|
-
<xsl:variable name="regex_S">[^\r\n\t\f\v \<>
|
10247
|
+
<xsl:variable name="regex_S">[^\r\n\t\f\v \<>\u3000-\u9FFF]</xsl:variable>
|
10017
10248
|
<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>
|
10018
10249
|
<xsl:variable name="text3">
|
10019
10250
|
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
@@ -10035,7 +10266,8 @@
|
|
10035
10266
|
<xsl:choose>
|
10036
10267
|
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
10037
10268
|
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
10038
|
-
<xsl:variable name="
|
10269
|
+
<xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
|
10270
|
+
<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>
|
10039
10271
|
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
10040
10272
|
<xsl:choose>
|
10041
10273
|
<xsl:when test="self::text()">
|
@@ -10056,6 +10288,10 @@
|
|
10056
10288
|
|
10057
10289
|
</xsl:template>
|
10058
10290
|
|
10291
|
+
<xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
|
10292
|
+
<xsl:copy-of select="."/>
|
10293
|
+
</xsl:template>
|
10294
|
+
|
10059
10295
|
<xsl:template name="replace_text_tags">
|
10060
10296
|
<xsl:param name="tag_open"/>
|
10061
10297
|
<xsl:param name="tag_close"/>
|
@@ -10082,6 +10318,194 @@
|
|
10082
10318
|
<!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
|
10083
10319
|
<!-- ===================================== -->
|
10084
10320
|
|
10321
|
+
<!-- ===================================== -->
|
10322
|
+
<!-- ===================================== -->
|
10323
|
+
<!-- Make linear XML (need for landscape orientation) -->
|
10324
|
+
<!-- ===================================== -->
|
10325
|
+
<!-- ===================================== -->
|
10326
|
+
<xsl:template match="@*|node()" mode="linear_xml">
|
10327
|
+
<xsl:copy>
|
10328
|
+
<xsl:apply-templates select="@*|node()" mode="linear_xml"/>
|
10329
|
+
</xsl:copy>
|
10330
|
+
</xsl:template>
|
10331
|
+
|
10332
|
+
<xsl:template match="processing-instruction()" mode="linear_xml">
|
10333
|
+
<xsl:copy-of select="."/>
|
10334
|
+
</xsl:template>
|
10335
|
+
|
10336
|
+
<!-- From:
|
10337
|
+
<clause>
|
10338
|
+
<title>...</title>
|
10339
|
+
<p>...</p>
|
10340
|
+
</clause>
|
10341
|
+
To:
|
10342
|
+
<clause/>
|
10343
|
+
<title>...</title>
|
10344
|
+
<p>...</p>
|
10345
|
+
-->
|
10346
|
+
<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">
|
10347
|
+
|
10348
|
+
<xsl:copy>
|
10349
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
10350
|
+
|
10351
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
10352
|
+
|
10353
|
+
<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'">
|
10354
|
+
<xsl:attribute name="mainsection">true</xsl:attribute>
|
10355
|
+
</xsl:if>
|
10356
|
+
</xsl:copy>
|
10357
|
+
|
10358
|
+
<xsl:apply-templates mode="linear_xml"/>
|
10359
|
+
</xsl:template>
|
10360
|
+
|
10361
|
+
<xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
|
10362
|
+
<xsl:copy>
|
10363
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
10364
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
10365
|
+
<xsl:variable name="level">
|
10366
|
+
<xsl:call-template name="getLevel"/>
|
10367
|
+
</xsl:variable>
|
10368
|
+
<xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
|
10369
|
+
<xsl:attribute name="ancestor">sections</xsl:attribute>
|
10370
|
+
<xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
|
10371
|
+
</xsl:copy>
|
10372
|
+
<xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
|
10373
|
+
</xsl:template>
|
10374
|
+
|
10375
|
+
<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">
|
10376
|
+
<xsl:copy>
|
10377
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
10378
|
+
|
10379
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
10380
|
+
|
10381
|
+
<xsl:variable name="level">
|
10382
|
+
<xsl:call-template name="getLevel"/>
|
10383
|
+
</xsl:variable>
|
10384
|
+
<xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
|
10385
|
+
|
10386
|
+
<xsl:if test="parent::*[local-name() = 'annex']">
|
10387
|
+
<xsl:attribute name="depth">1</xsl:attribute>
|
10388
|
+
</xsl:if>
|
10389
|
+
|
10390
|
+
<xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
|
10391
|
+
<xsl:copy-of select="../@inline-header"/>
|
10392
|
+
</xsl:if>
|
10393
|
+
|
10394
|
+
<xsl:attribute name="ancestor">
|
10395
|
+
<xsl:choose>
|
10396
|
+
<xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
|
10397
|
+
<xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
|
10398
|
+
<xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
|
10399
|
+
<xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
|
10400
|
+
<xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
|
10401
|
+
</xsl:choose>
|
10402
|
+
</xsl:attribute>
|
10403
|
+
|
10404
|
+
<xsl:apply-templates mode="linear_xml"/>
|
10405
|
+
</xsl:copy>
|
10406
|
+
</xsl:template>
|
10407
|
+
|
10408
|
+
<!-- add @to = figure, table, clause -->
|
10409
|
+
<!-- add @depth = from -->
|
10410
|
+
<xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
|
10411
|
+
<xsl:copy>
|
10412
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
10413
|
+
<xsl:variable name="target" select="@target"/>
|
10414
|
+
<xsl:attribute name="to">
|
10415
|
+
<xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
|
10416
|
+
</xsl:attribute>
|
10417
|
+
<xsl:attribute name="depth">
|
10418
|
+
<xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
|
10419
|
+
</xsl:attribute>
|
10420
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
10421
|
+
</xsl:copy>
|
10422
|
+
</xsl:template>
|
10423
|
+
|
10424
|
+
<xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
|
10425
|
+
<xsl:choose>
|
10426
|
+
<xsl:when test="contains(., $non_breaking_hyphen)">
|
10427
|
+
<xsl:call-template name="replaceChar">
|
10428
|
+
<xsl:with-param name="text" select="."/>
|
10429
|
+
<xsl:with-param name="replace" select="$non_breaking_hyphen"/>
|
10430
|
+
<xsl:with-param name="by" select="'-'"/>
|
10431
|
+
</xsl:call-template>
|
10432
|
+
</xsl:when>
|
10433
|
+
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
10434
|
+
</xsl:choose>
|
10435
|
+
</xsl:template>
|
10436
|
+
|
10437
|
+
<xsl:template name="replaceChar">
|
10438
|
+
<xsl:param name="text"/>
|
10439
|
+
<xsl:param name="replace"/>
|
10440
|
+
<xsl:param name="by"/>
|
10441
|
+
<xsl:choose>
|
10442
|
+
<xsl:when test="$text = '' or $replace = '' or not($replace)">
|
10443
|
+
<xsl:value-of select="$text"/>
|
10444
|
+
</xsl:when>
|
10445
|
+
<xsl:when test="contains($text, $replace)">
|
10446
|
+
<xsl:value-of select="substring-before($text,$replace)"/>
|
10447
|
+
<xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
|
10448
|
+
<xsl:call-template name="replaceChar">
|
10449
|
+
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
|
10450
|
+
<xsl:with-param name="replace" select="$replace"/>
|
10451
|
+
<xsl:with-param name="by" select="$by"/>
|
10452
|
+
</xsl:call-template>
|
10453
|
+
</xsl:when>
|
10454
|
+
<xsl:otherwise>
|
10455
|
+
<xsl:value-of select="$text"/>
|
10456
|
+
</xsl:otherwise>
|
10457
|
+
</xsl:choose>
|
10458
|
+
</xsl:template>
|
10459
|
+
|
10460
|
+
<xsl:template match="*[local-name() = 'inlineChar']">
|
10461
|
+
<fo:inline><xsl:value-of select="."/></fo:inline>
|
10462
|
+
</xsl:template>
|
10463
|
+
|
10464
|
+
<!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
|
10465
|
+
<!--
|
10466
|
+
<fn reference="1">
|
10467
|
+
<p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
|
10468
|
+
</fn>
|
10469
|
+
-->
|
10470
|
+
<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">
|
10471
|
+
<xsl:variable name="p_fn_">
|
10472
|
+
<xsl:call-template name="get_fn_list"/>
|
10473
|
+
</xsl:variable>
|
10474
|
+
<xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
|
10475
|
+
<xsl:variable name="gen_id" select="generate-id(.)"/>
|
10476
|
+
<xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
|
10477
|
+
<xsl:variable name="reference" select="@reference"/>
|
10478
|
+
<!-- fn sequence number in document -->
|
10479
|
+
<xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
|
10480
|
+
|
10481
|
+
<xsl:copy>
|
10482
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
10483
|
+
<!-- put actual reference number -->
|
10484
|
+
<xsl:attribute name="current_fn_number">
|
10485
|
+
<xsl:value-of select="$current_fn_number"/>
|
10486
|
+
</xsl:attribute>
|
10487
|
+
<xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
|
10488
|
+
<xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
|
10489
|
+
</xsl:attribute>
|
10490
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
10491
|
+
</xsl:copy>
|
10492
|
+
</xsl:template>
|
10493
|
+
|
10494
|
+
<xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
|
10495
|
+
<xsl:copy>
|
10496
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
10497
|
+
<xsl:if test="@depth = '1'">
|
10498
|
+
<xsl:attribute name="mainsection">true</xsl:attribute>
|
10499
|
+
</xsl:if>
|
10500
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
10501
|
+
</xsl:copy>
|
10502
|
+
</xsl:template>
|
10503
|
+
<!-- ===================================== -->
|
10504
|
+
<!-- ===================================== -->
|
10505
|
+
<!-- END: Make linear XML (need for landscape orientation) -->
|
10506
|
+
<!-- ===================================== -->
|
10507
|
+
<!-- ===================================== -->
|
10508
|
+
|
10085
10509
|
<!-- for correct rendering combining chars -->
|
10086
10510
|
<xsl:template match="*[local-name() = 'lang_none']">
|
10087
10511
|
<fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
|
@@ -10638,6 +11062,23 @@
|
|
10638
11062
|
</xsl:if>
|
10639
11063
|
</xsl:template>
|
10640
11064
|
|
11065
|
+
<xsl:template name="setBlockAttributes">
|
11066
|
+
<xsl:param name="text_align_default">left</xsl:param>
|
11067
|
+
<xsl:call-template name="setTextAlignment">
|
11068
|
+
<xsl:with-param name="default" select="$text_align_default"/>
|
11069
|
+
</xsl:call-template>
|
11070
|
+
|
11071
|
+
<!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
|
11072
|
+
<!-- Example: keep-lines-together="true" -->
|
11073
|
+
<xsl:if test="@keep-lines-together = 'true'">
|
11074
|
+
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
|
11075
|
+
</xsl:if>
|
11076
|
+
<!-- Example: keep-with-next="true" -->
|
11077
|
+
<xsl:if test="@keep-with-next = 'true'">
|
11078
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
11079
|
+
</xsl:if>
|
11080
|
+
</xsl:template>
|
11081
|
+
|
10641
11082
|
<xsl:template name="number-to-words">
|
10642
11083
|
<xsl:param name="number"/>
|
10643
11084
|
<xsl:param name="first"/>
|