metanorma-bipm 2.2.5 → 2.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/bipm/bipm.brochure.xsl +553 -109
- data/lib/isodoc/bipm/bipm.guide.xsl +553 -109
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +553 -109
- data/lib/isodoc/bipm/bipm.rapport.xsl +553 -109
- data/lib/isodoc/bipm/html/htmlstyle.css +4 -0
- data/lib/isodoc/bipm/jcgm.standard.xsl +571 -123
- data/lib/metanorma/bipm/bipm.rng +1 -18
- data/lib/metanorma/bipm/isodoc.rng +46 -296
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +2 -2
- metadata +6 -6
@@ -4420,7 +4420,6 @@
|
|
4420
4420
|
|
4421
4421
|
<xsl:attribute-set name="table-header-cell-style">
|
4422
4422
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
4423
|
-
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
4424
4423
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
4425
4424
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
4426
4425
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
@@ -4435,7 +4434,6 @@
|
|
4435
4434
|
|
4436
4435
|
<xsl:attribute-set name="table-cell-style">
|
4437
4436
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
4438
|
-
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
4439
4437
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
4440
4438
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
4441
4439
|
|
@@ -4632,6 +4630,7 @@
|
|
4632
4630
|
<xsl:attribute-set name="term-name-style">
|
4633
4631
|
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
4634
4632
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
4633
|
+
|
4635
4634
|
</xsl:attribute-set>
|
4636
4635
|
|
4637
4636
|
<xsl:attribute-set name="figure-block-style">
|
@@ -5180,7 +5179,7 @@
|
|
5180
5179
|
<xsl:apply-templates select="." mode="contents"/>
|
5181
5180
|
</xsl:for-each>
|
5182
5181
|
|
5183
|
-
<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')]]">
|
5182
|
+
<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]">
|
5184
5183
|
<xsl:sort select="@displayorder" data-type="number"/>
|
5185
5184
|
<xsl:apply-templates select="." mode="contents"/>
|
5186
5185
|
</xsl:for-each>
|
@@ -5611,7 +5610,7 @@
|
|
5611
5610
|
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
5612
5611
|
</xsl:when>
|
5613
5612
|
<xsl:otherwise>
|
5614
|
-
<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
|
5613
|
+
<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 -->
|
5615
5614
|
</xsl:otherwise>
|
5616
5615
|
</xsl:choose>
|
5617
5616
|
|
@@ -6131,7 +6130,7 @@
|
|
6131
6130
|
<xsl:param name="colwidths"/>
|
6132
6131
|
<xsl:param name="colgroup"/>
|
6133
6132
|
|
6134
|
-
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
|
6133
|
+
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
|
6135
6134
|
|
6136
6135
|
<xsl:variable name="isNoteOrFnExistShowAfterTable">
|
6137
6136
|
|
@@ -6150,6 +6149,10 @@
|
|
6150
6149
|
</xsl:choose>
|
6151
6150
|
</xsl:variable>
|
6152
6151
|
|
6152
|
+
<xsl:variable name="table_fn_block">
|
6153
|
+
<xsl:call-template name="table_fn_display"/>
|
6154
|
+
</xsl:variable>
|
6155
|
+
|
6153
6156
|
<xsl:variable name="tableWithNotesAndFootnotes">
|
6154
6157
|
|
6155
6158
|
<fo:table keep-with-previous="always">
|
@@ -6205,13 +6208,28 @@
|
|
6205
6208
|
|
6206
6209
|
<!-- except gb and bsi -->
|
6207
6210
|
|
6211
|
+
<xsl:apply-templates select="../*[local-name()='dl']"/>
|
6208
6212
|
<xsl:apply-templates select="../*[local-name()='note']"/>
|
6209
6213
|
|
6214
|
+
<xsl:variable name="isDisplayRowSeparator">
|
6215
|
+
|
6216
|
+
</xsl:variable>
|
6217
|
+
|
6210
6218
|
<!-- horizontal row separator -->
|
6219
|
+
<xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
|
6220
|
+
<xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
|
6221
|
+
<fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
|
6222
|
+
|
6223
|
+
<xsl:call-template name="setBordersTableArray"/>
|
6224
|
+
<fo:block font-size="1pt"> </fo:block>
|
6225
|
+
</fo:block-container>
|
6226
|
+
</xsl:if>
|
6227
|
+
</xsl:if>
|
6211
6228
|
|
6212
6229
|
<!-- fn processing -->
|
6213
6230
|
|
6214
|
-
<xsl:call-template name="table_fn_display"/>
|
6231
|
+
<!-- <xsl:call-template name="table_fn_display" /> -->
|
6232
|
+
<xsl:copy-of select="$table_fn_block"/>
|
6215
6233
|
|
6216
6234
|
<!-- for PAS display Notes after footnotes -->
|
6217
6235
|
|
@@ -6316,7 +6334,7 @@
|
|
6316
6334
|
<!-- ===================== -->
|
6317
6335
|
<!-- Table's row processing -->
|
6318
6336
|
<!-- ===================== -->
|
6319
|
-
<!-- row in table header (thead) -->
|
6337
|
+
<!-- row in table header (thead) thead/tr -->
|
6320
6338
|
<xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
6321
6339
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
6322
6340
|
|
@@ -6328,7 +6346,29 @@
|
|
6328
6346
|
</fo:table-row>
|
6329
6347
|
</xsl:template>
|
6330
6348
|
|
6331
|
-
|
6349
|
+
<xsl:template name="setBorderUnderRow">
|
6350
|
+
<xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
|
6351
|
+
<xsl:choose>
|
6352
|
+
<xsl:when test="$border_under_row_ != ''">
|
6353
|
+
<xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
|
6354
|
+
<xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
|
6355
|
+
<xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
|
6356
|
+
<xsl:variable name="border_under_row">
|
6357
|
+
<xsl:call-template name="split">
|
6358
|
+
<xsl:with-param name="pText" select="$border_under_row_"/>
|
6359
|
+
</xsl:call-template>
|
6360
|
+
</xsl:variable>
|
6361
|
+
<xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
|
6362
|
+
<xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
|
6363
|
+
</xsl:if>
|
6364
|
+
</xsl:when>
|
6365
|
+
<xsl:otherwise>
|
6366
|
+
<xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
|
6367
|
+
</xsl:otherwise>
|
6368
|
+
</xsl:choose>
|
6369
|
+
</xsl:template>
|
6370
|
+
|
6371
|
+
<!-- row in table footer (tfoot), tfoot/tr -->
|
6332
6372
|
<xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
|
6333
6373
|
<fo:table-row xsl:use-attribute-sets="table-footer-row-style">
|
6334
6374
|
|
@@ -6711,8 +6751,16 @@
|
|
6711
6751
|
<!-- figure's footnotes rendering -->
|
6712
6752
|
<xsl:template name="fn_display_figure">
|
6713
6753
|
|
6754
|
+
<!-- current figure id -->
|
6755
|
+
<xsl:variable name="figure_id_">
|
6756
|
+
<xsl:value-of select="@id"/>
|
6757
|
+
<xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
|
6758
|
+
</xsl:variable>
|
6759
|
+
<xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
|
6760
|
+
|
6761
|
+
<!-- all footnotes relates to the current figure -->
|
6714
6762
|
<xsl:variable name="references">
|
6715
|
-
<xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
|
6763
|
+
<xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
|
6716
6764
|
<fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
|
6717
6765
|
<xsl:apply-templates/>
|
6718
6766
|
</fn>
|
@@ -6725,91 +6773,93 @@
|
|
6725
6773
|
|
6726
6774
|
</xsl:variable>
|
6727
6775
|
|
6728
|
-
|
6729
|
-
|
6730
|
-
|
6731
|
-
|
6732
|
-
|
6733
|
-
|
6776
|
+
<fo:block>
|
6777
|
+
|
6778
|
+
<!-- current hierarchy is 'figure' element -->
|
6779
|
+
<xsl:variable name="following_dl_colwidths">
|
6780
|
+
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
6781
|
+
<xsl:variable name="simple-table">
|
6782
|
+
<!-- <xsl:variable name="doc_ns">
|
6783
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
6784
|
+
</xsl:variable>
|
6785
|
+
<xsl:variable name="ns">
|
6786
|
+
<xsl:choose>
|
6787
|
+
<xsl:when test="normalize-space($doc_ns) != ''">
|
6788
|
+
<xsl:value-of select="normalize-space($doc_ns)"/>
|
6789
|
+
</xsl:when>
|
6790
|
+
<xsl:otherwise>
|
6791
|
+
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
6792
|
+
</xsl:otherwise>
|
6793
|
+
</xsl:choose>
|
6794
|
+
</xsl:variable> -->
|
6795
|
+
|
6796
|
+
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
6797
|
+
<tbody>
|
6798
|
+
<xsl:apply-templates mode="dl"/>
|
6799
|
+
</tbody>
|
6800
|
+
</xsl:for-each>
|
6801
|
+
</xsl:variable>
|
6802
|
+
|
6803
|
+
<xsl:call-template name="calculate-column-widths">
|
6804
|
+
<xsl:with-param name="cols-count" select="2"/>
|
6805
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
6806
|
+
</xsl:call-template>
|
6807
|
+
|
6808
|
+
</xsl:if>
|
6809
|
+
</xsl:variable>
|
6810
|
+
|
6811
|
+
<xsl:variable name="maxlength_dt">
|
6812
|
+
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
6813
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
6814
|
+
</xsl:for-each>
|
6734
6815
|
</xsl:variable>
|
6735
|
-
|
6816
|
+
|
6817
|
+
<fo:table width="95%" table-layout="fixed">
|
6818
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
6819
|
+
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
6820
|
+
|
6821
|
+
</xsl:if>
|
6736
6822
|
<xsl:choose>
|
6737
|
-
|
6738
|
-
|
6823
|
+
<!-- if there 'dl', then set same columns width -->
|
6824
|
+
<xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
|
6825
|
+
<xsl:call-template name="setColumnWidth_dl">
|
6826
|
+
<xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
|
6827
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
6828
|
+
</xsl:call-template>
|
6739
6829
|
</xsl:when>
|
6740
6830
|
<xsl:otherwise>
|
6741
|
-
<
|
6831
|
+
<fo:table-column column-width="5%"/>
|
6832
|
+
<fo:table-column column-width="95%"/>
|
6742
6833
|
</xsl:otherwise>
|
6743
6834
|
</xsl:choose>
|
6744
|
-
|
6745
|
-
|
6746
|
-
|
6747
|
-
|
6748
|
-
|
6749
|
-
|
6750
|
-
|
6751
|
-
|
6752
|
-
|
6753
|
-
|
6754
|
-
|
6755
|
-
|
6756
|
-
|
6757
|
-
|
6758
|
-
|
6759
|
-
</xsl:variable>
|
6760
|
-
|
6761
|
-
<xsl:variable name="maxlength_dt">
|
6762
|
-
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
6763
|
-
<xsl:call-template name="getMaxLength_dt"/>
|
6764
|
-
</xsl:for-each>
|
6765
|
-
</xsl:variable>
|
6835
|
+
<fo:table-body>
|
6836
|
+
<xsl:for-each select="xalan:nodeset($references)//fn">
|
6837
|
+
<xsl:variable name="reference" select="@reference"/>
|
6838
|
+
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
6839
|
+
<fo:table-row>
|
6840
|
+
<fo:table-cell>
|
6841
|
+
<fo:block>
|
6842
|
+
<fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
|
6843
|
+
<xsl:value-of select="@reference"/>
|
6844
|
+
</fo:inline>
|
6845
|
+
</fo:block>
|
6846
|
+
</fo:table-cell>
|
6847
|
+
<fo:table-cell>
|
6848
|
+
<fo:block xsl:use-attribute-sets="figure-fn-body-style">
|
6849
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
6766
6850
|
|
6767
|
-
|
6768
|
-
<fo:table width="95%" table-layout="fixed">
|
6769
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
6770
|
-
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
6851
|
+
<xsl:attribute name="margin-bottom">0</xsl:attribute>
|
6771
6852
|
|
6772
|
-
|
6773
|
-
|
6774
|
-
|
6775
|
-
|
6776
|
-
|
6777
|
-
|
6778
|
-
|
6779
|
-
</
|
6780
|
-
</
|
6781
|
-
<xsl:otherwise>
|
6782
|
-
<fo:table-column column-width="15%"/>
|
6783
|
-
<fo:table-column column-width="85%"/>
|
6784
|
-
</xsl:otherwise>
|
6785
|
-
</xsl:choose>
|
6786
|
-
<fo:table-body>
|
6787
|
-
<xsl:for-each select="xalan:nodeset($references)//fn">
|
6788
|
-
<xsl:variable name="reference" select="@reference"/>
|
6789
|
-
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
6790
|
-
<fo:table-row>
|
6791
|
-
<fo:table-cell>
|
6792
|
-
<fo:block>
|
6793
|
-
<fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
|
6794
|
-
<xsl:value-of select="@reference"/>
|
6795
|
-
</fo:inline>
|
6796
|
-
</fo:block>
|
6797
|
-
</fo:table-cell>
|
6798
|
-
<fo:table-cell>
|
6799
|
-
<fo:block xsl:use-attribute-sets="figure-fn-body-style">
|
6800
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
6801
|
-
|
6802
|
-
<xsl:attribute name="margin-bottom">0</xsl:attribute>
|
6853
|
+
</xsl:if>
|
6854
|
+
<xsl:copy-of select="./node()"/>
|
6855
|
+
</fo:block>
|
6856
|
+
</fo:table-cell>
|
6857
|
+
</fo:table-row>
|
6858
|
+
</xsl:if>
|
6859
|
+
</xsl:for-each>
|
6860
|
+
</fo:table-body>
|
6861
|
+
</fo:table>
|
6803
6862
|
|
6804
|
-
</xsl:if>
|
6805
|
-
<xsl:copy-of select="./node()"/>
|
6806
|
-
</fo:block>
|
6807
|
-
</fo:table-cell>
|
6808
|
-
</fo:table-row>
|
6809
|
-
</xsl:if>
|
6810
|
-
</xsl:for-each>
|
6811
|
-
</fo:table-body>
|
6812
|
-
</fo:table>
|
6813
6863
|
</fo:block>
|
6814
6864
|
</xsl:if>
|
6815
6865
|
|
@@ -6853,6 +6903,8 @@
|
|
6853
6903
|
<!-- <dl><xsl:copy-of select="."/></dl> -->
|
6854
6904
|
<fo:block-container>
|
6855
6905
|
|
6906
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
6907
|
+
|
6856
6908
|
<xsl:if test="not(ancestor::*[local-name() = 'li'])">
|
6857
6909
|
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6858
6910
|
</xsl:if>
|
@@ -6890,12 +6942,14 @@
|
|
6890
6942
|
|
6891
6943
|
<fo:block margin-bottom="12pt" text-align="left">
|
6892
6944
|
|
6893
|
-
<xsl:variable name="title-where">
|
6945
|
+
<!-- <xsl:variable name="title-where">
|
6894
6946
|
<xsl:call-template name="getLocalizedString">
|
6895
6947
|
<xsl:with-param name="key">where</xsl:with-param>
|
6896
6948
|
</xsl:call-template>
|
6897
6949
|
</xsl:variable>
|
6898
|
-
<xsl:value-of select="$title-where"
|
6950
|
+
<xsl:value-of select="$title-where"/> -->
|
6951
|
+
<xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
|
6952
|
+
<xsl:text> </xsl:text>
|
6899
6953
|
<xsl:apply-templates select="*[local-name()='dt']/*"/>
|
6900
6954
|
<xsl:text/>
|
6901
6955
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
@@ -6905,12 +6959,14 @@
|
|
6905
6959
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
6906
6960
|
<fo:block margin-bottom="12pt" text-align="left">
|
6907
6961
|
|
6908
|
-
<xsl:variable name="title-where">
|
6962
|
+
<!-- <xsl:variable name="title-where">
|
6909
6963
|
<xsl:call-template name="getLocalizedString">
|
6910
6964
|
<xsl:with-param name="key">where</xsl:with-param>
|
6911
6965
|
</xsl:call-template>
|
6912
6966
|
</xsl:variable>
|
6913
|
-
<xsl:value-of select="$title-where"
|
6967
|
+
<xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
|
6968
|
+
<!-- preceding 'p' with word 'where' -->
|
6969
|
+
<xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
|
6914
6970
|
</fo:block>
|
6915
6971
|
</xsl:when> <!-- END: a few components -->
|
6916
6972
|
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
@@ -7093,6 +7149,9 @@
|
|
7093
7149
|
|
7094
7150
|
</xsl:template> <!-- END: dl -->
|
7095
7151
|
|
7152
|
+
<!-- ignore 'p' with 'where' in formula, before 'dl' -->
|
7153
|
+
<xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
|
7154
|
+
|
7096
7155
|
<xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
|
7097
7156
|
<xsl:param name="process">false</xsl:param>
|
7098
7157
|
<xsl:if test="$process = 'true'">
|
@@ -7917,20 +7976,34 @@
|
|
7917
7976
|
|
7918
7977
|
<xsl:template name="add-zero-spaces-java">
|
7919
7978
|
<xsl:param name="text" select="."/>
|
7920
|
-
|
7921
|
-
|
7979
|
+
|
7980
|
+
<!-- add zero-width space (#x200B) after dot with next non-digit -->
|
7981
|
+
<xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1$2')"/>
|
7982
|
+
<!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
|
7983
|
+
<xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1')"/>
|
7922
7984
|
<!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
|
7923
|
-
<xsl:variable name="
|
7985
|
+
<xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1$2')"/>
|
7924
7986
|
<!-- add zero-width space (#x200B) after characters: 'great than' -->
|
7925
|
-
<xsl:variable name="
|
7987
|
+
<xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(\u003e)(?!\u003e)', '$1')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
|
7926
7988
|
<!-- add zero-width space (#x200B) before characters: 'less than' -->
|
7927
|
-
<xsl:variable name="
|
7989
|
+
<xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?<!\u003c)(\u003c)', '$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
|
7928
7990
|
<!-- add zero-width space (#x200B) before character: { -->
|
7929
|
-
<xsl:variable name="
|
7991
|
+
<xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?<!\W)(\{)', '$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
|
7930
7992
|
<!-- add zero-width space (#x200B) after character: , -->
|
7931
|
-
<xsl:variable name="
|
7993
|
+
<xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1')"/> <!-- negative lookahead: ',' not followed by digit -->
|
7994
|
+
<!-- add zero-width space (#x200B) after character: '/' -->
|
7995
|
+
<xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1')"/><!-- negative lookahead: '/' not followed by '/' -->
|
7996
|
+
|
7997
|
+
<xsl:variable name="text9">
|
7998
|
+
<xsl:choose>
|
7999
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
8000
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
|
8001
|
+
</xsl:when>
|
8002
|
+
<xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
|
8003
|
+
</xsl:choose>
|
8004
|
+
</xsl:variable>
|
7932
8005
|
|
7933
|
-
<xsl:value-of select="$
|
8006
|
+
<xsl:value-of select="$text9"/>
|
7934
8007
|
</xsl:template>
|
7935
8008
|
|
7936
8009
|
<xsl:template name="add-zero-spaces-link-java">
|
@@ -7938,8 +8011,8 @@
|
|
7938
8011
|
|
7939
8012
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
|
7940
8013
|
<xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
|
7941
|
-
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
|
7942
|
-
<xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—|
|
8014
|
+
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
|
8015
|
+
<xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1')"/>
|
7943
8016
|
<!-- remove zero-width space at the end -->
|
7944
8017
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '$', '')"/>
|
7945
8018
|
</xsl:template>
|
@@ -8294,9 +8367,28 @@
|
|
8294
8367
|
</xsl:variable>
|
8295
8368
|
<xsl:copy-of select="$newRow"/>
|
8296
8369
|
|
8297
|
-
|
8298
|
-
|
8299
|
-
|
8370
|
+
<!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
|
8371
|
+
<xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
|
8372
|
+
<xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
|
8373
|
+
<xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
|
8374
|
+
<xsl:choose>
|
8375
|
+
<xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan <= 0">
|
8376
|
+
<xsl:copy-of select="following-sibling::tr"/>
|
8377
|
+
</xsl:when>
|
8378
|
+
<!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan > 0">
|
8379
|
+
<xsl:copy-of select="following-sibling::tr[position() <= $nextrow_without_rowspan]"/>
|
8380
|
+
|
8381
|
+
<xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
|
8382
|
+
<xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
|
8383
|
+
<xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
|
8384
|
+
</xsl:apply-templates>
|
8385
|
+
</xsl:when> -->
|
8386
|
+
<xsl:otherwise>
|
8387
|
+
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
8388
|
+
<xsl:with-param name="previousRow" select="$newRow"/>
|
8389
|
+
</xsl:apply-templates>
|
8390
|
+
</xsl:otherwise>
|
8391
|
+
</xsl:choose>
|
8300
8392
|
</xsl:template>
|
8301
8393
|
<!-- End mode simple-table-rowspan -->
|
8302
8394
|
|
@@ -8459,6 +8551,27 @@
|
|
8459
8551
|
</xsl:call-template>
|
8460
8552
|
</xsl:template>
|
8461
8553
|
|
8554
|
+
<xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
|
8555
|
+
<xsl:variable name="link">
|
8556
|
+
<link_updated>
|
8557
|
+
<xsl:variable name="target_text">
|
8558
|
+
<xsl:choose>
|
8559
|
+
<xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
|
8560
|
+
<xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
|
8561
|
+
</xsl:when>
|
8562
|
+
<xsl:otherwise>
|
8563
|
+
<xsl:value-of select="normalize-space(@target)"/>
|
8564
|
+
</xsl:otherwise>
|
8565
|
+
</xsl:choose>
|
8566
|
+
</xsl:variable>
|
8567
|
+
<xsl:value-of select="$target_text"/>
|
8568
|
+
</link_updated>
|
8569
|
+
</xsl:variable>
|
8570
|
+
<xsl:for-each select="xalan:nodeset($link)/*">
|
8571
|
+
<xsl:apply-templates mode="td_text_with_formatting"/>
|
8572
|
+
</xsl:for-each>
|
8573
|
+
</xsl:template>
|
8574
|
+
|
8462
8575
|
<xsl:template name="getFormattingTags">
|
8463
8576
|
<tags>
|
8464
8577
|
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
@@ -8840,7 +8953,7 @@
|
|
8840
8953
|
</xsl:variable>
|
8841
8954
|
<fo:inline xsl:use-attribute-sets="link-style">
|
8842
8955
|
|
8843
|
-
<xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
|
8956
|
+
<xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
|
8844
8957
|
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
|
8845
8958
|
</xsl:if>
|
8846
8959
|
|
@@ -8895,13 +9008,17 @@
|
|
8895
9008
|
</xsl:template>
|
8896
9009
|
|
8897
9010
|
<xsl:template match="*[local-name() = 'callout']">
|
8898
|
-
<
|
9011
|
+
<xsl:choose>
|
9012
|
+
<xsl:when test="normalize-space(@target) = ''"><<xsl:apply-templates/>></xsl:when>
|
9013
|
+
<xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}"><<xsl:apply-templates/>></fo:basic-link></xsl:otherwise>
|
9014
|
+
</xsl:choose>
|
8899
9015
|
</xsl:template>
|
8900
9016
|
|
8901
9017
|
<xsl:template match="*[local-name() = 'annotation']">
|
8902
9018
|
<xsl:variable name="annotation-id" select="@id"/>
|
8903
9019
|
<xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
|
8904
9020
|
<fo:block id="{$annotation-id}" white-space="nowrap">
|
9021
|
+
|
8905
9022
|
<fo:inline>
|
8906
9023
|
<xsl:apply-templates>
|
8907
9024
|
<xsl:with-param name="callout" select="concat('<', $callout, '> ')"/>
|
@@ -9006,6 +9123,10 @@
|
|
9006
9123
|
<!-- ====== -->
|
9007
9124
|
<!-- ====== -->
|
9008
9125
|
|
9126
|
+
<xsl:template name="setBlockSpanAll">
|
9127
|
+
<xsl:if test="@columns = 1 or (local-name() = 'p' and *[@columns = 1])"><xsl:attribute name="span">all</xsl:attribute></xsl:if>
|
9128
|
+
</xsl:template>
|
9129
|
+
|
9009
9130
|
<!-- ====== -->
|
9010
9131
|
<!-- note -->
|
9011
9132
|
<!-- termnote -->
|
@@ -9015,6 +9136,8 @@
|
|
9015
9136
|
|
9016
9137
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
|
9017
9138
|
|
9139
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
9140
|
+
|
9018
9141
|
<xsl:if test="parent::*[local-name() = 'li']">
|
9019
9142
|
<xsl:attribute name="margin-top">4pt</xsl:attribute>
|
9020
9143
|
<xsl:attribute name="margin-bottom">4pt</xsl:attribute>
|
@@ -9077,6 +9200,8 @@
|
|
9077
9200
|
<xsl:template match="*[local-name() = 'termnote']">
|
9078
9201
|
<fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
|
9079
9202
|
|
9203
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
9204
|
+
|
9080
9205
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
9081
9206
|
|
9082
9207
|
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
@@ -9225,10 +9350,10 @@
|
|
9225
9350
|
<fo:block xsl:use-attribute-sets="figure-style">
|
9226
9351
|
<xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
|
9227
9352
|
</fo:block>
|
9228
|
-
<xsl:call-template name="fn_display_figure"/>
|
9229
9353
|
<xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
|
9230
9354
|
<xsl:call-template name="note"/>
|
9231
9355
|
</xsl:for-each>
|
9356
|
+
<xsl:call-template name="fn_display_figure"/>
|
9232
9357
|
|
9233
9358
|
<xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
|
9234
9359
|
|
@@ -9291,7 +9416,13 @@
|
|
9291
9416
|
</xsl:choose>
|
9292
9417
|
</xsl:variable>
|
9293
9418
|
|
9294
|
-
<xsl:variable name="
|
9419
|
+
<xsl:variable name="image_width_effective">
|
9420
|
+
|
9421
|
+
<xsl:value-of select="$width_effective"/>
|
9422
|
+
|
9423
|
+
</xsl:variable>
|
9424
|
+
|
9425
|
+
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
|
9295
9426
|
<xsl:if test="number($scale) < 100">
|
9296
9427
|
|
9297
9428
|
<xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
|
@@ -9878,6 +10009,13 @@
|
|
9878
10009
|
<xsl:when test="$contents_nodes/doc">
|
9879
10010
|
<xsl:choose>
|
9880
10011
|
<xsl:when test="count($contents_nodes/doc) > 1">
|
10012
|
+
|
10013
|
+
<xsl:if test="$contents_nodes/collection">
|
10014
|
+
<fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
|
10015
|
+
<fo:bookmark-title>collection.pdf</fo:bookmark-title>
|
10016
|
+
</fo:bookmark>
|
10017
|
+
</xsl:if>
|
10018
|
+
|
9881
10019
|
<xsl:for-each select="$contents_nodes/doc">
|
9882
10020
|
<fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
|
9883
10021
|
<xsl:if test="@bundle = 'true'">
|
@@ -11003,6 +11141,9 @@
|
|
11003
11141
|
<!-- ====== -->
|
11004
11142
|
<xsl:template match="*[local-name() = 'termexample']">
|
11005
11143
|
<fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
|
11144
|
+
|
11145
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
11146
|
+
|
11006
11147
|
<xsl:apply-templates select="*[local-name()='name']"/>
|
11007
11148
|
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
11008
11149
|
</fo:block>
|
@@ -11054,6 +11195,8 @@
|
|
11054
11195
|
|
11055
11196
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
11056
11197
|
|
11198
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
11199
|
+
|
11057
11200
|
<xsl:variable name="fo_element">
|
11058
11201
|
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
11059
11202
|
block
|
@@ -11081,6 +11224,35 @@
|
|
11081
11224
|
</fo:block-container>
|
11082
11225
|
</xsl:when> <!-- end block -->
|
11083
11226
|
|
11227
|
+
<xsl:when test="contains(normalize-space($fo_element), 'list')">
|
11228
|
+
|
11229
|
+
<xsl:variable name="provisional_distance_between_starts">
|
11230
|
+
7
|
11231
|
+
</xsl:variable>
|
11232
|
+
<xsl:variable name="indent">
|
11233
|
+
0
|
11234
|
+
</xsl:variable>
|
11235
|
+
|
11236
|
+
<fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
|
11237
|
+
<fo:list-item>
|
11238
|
+
<fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
|
11239
|
+
<fo:block>
|
11240
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
11241
|
+
<xsl:with-param name="fo_element">block</xsl:with-param>
|
11242
|
+
</xsl:apply-templates>
|
11243
|
+
</fo:block>
|
11244
|
+
</fo:list-item-label>
|
11245
|
+
<fo:list-item-body start-indent="body-start()">
|
11246
|
+
<fo:block>
|
11247
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
11248
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
11249
|
+
</xsl:apply-templates>
|
11250
|
+
</fo:block>
|
11251
|
+
</fo:list-item-body>
|
11252
|
+
</fo:list-item>
|
11253
|
+
</fo:list-block>
|
11254
|
+
</xsl:when> <!-- end list -->
|
11255
|
+
|
11084
11256
|
<xsl:otherwise> <!-- inline -->
|
11085
11257
|
|
11086
11258
|
<!-- display 'EXAMPLE' and first element in the same line -->
|
@@ -11156,6 +11328,11 @@
|
|
11156
11328
|
</fo:block>
|
11157
11329
|
</fo:block-container>
|
11158
11330
|
</xsl:when>
|
11331
|
+
<xsl:when test="starts-with(normalize-space($element), 'list')">
|
11332
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
11333
|
+
<xsl:apply-templates/>
|
11334
|
+
</fo:block>
|
11335
|
+
</xsl:when>
|
11159
11336
|
<xsl:otherwise>
|
11160
11337
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
11161
11338
|
<xsl:apply-templates/>
|
@@ -11273,6 +11450,9 @@
|
|
11273
11450
|
<!-- ====== -->
|
11274
11451
|
<xsl:template match="*[local-name() = 'quote']">
|
11275
11452
|
<fo:block-container margin-left="0mm">
|
11453
|
+
|
11454
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
11455
|
+
|
11276
11456
|
<xsl:if test="parent::*[local-name() = 'note']">
|
11277
11457
|
<xsl:if test="not(ancestor::*[local-name() = 'table'])">
|
11278
11458
|
<xsl:attribute name="margin-left">5mm</xsl:attribute>
|
@@ -11564,6 +11744,8 @@
|
|
11564
11744
|
<fo:block>
|
11565
11745
|
<xsl:call-template name="setId"/>
|
11566
11746
|
|
11747
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
11748
|
+
|
11567
11749
|
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
11568
11750
|
|
11569
11751
|
<xsl:apply-templates/>
|
@@ -11580,6 +11762,8 @@
|
|
11580
11762
|
<fo:block break-after="page"/>
|
11581
11763
|
<fo:block id="{@id}">
|
11582
11764
|
|
11765
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
11766
|
+
|
11583
11767
|
</fo:block>
|
11584
11768
|
<xsl:apply-templates/>
|
11585
11769
|
</xsl:template>
|
@@ -11772,6 +11956,44 @@
|
|
11772
11956
|
|
11773
11957
|
<fo:list-block xsl:use-attribute-sets="list-style">
|
11774
11958
|
|
11959
|
+
<xsl:variable name="provisional_distance_between_starts_">
|
11960
|
+
<attributes xsl:use-attribute-sets="list-style">
|
11961
|
+
|
11962
|
+
</attributes>
|
11963
|
+
</xsl:variable>
|
11964
|
+
<xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
|
11965
|
+
<xsl:if test="$provisional_distance_between_starts != ''">
|
11966
|
+
<xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
|
11967
|
+
</xsl:if>
|
11968
|
+
<xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
|
11969
|
+
|
11970
|
+
<!-- increase provisional-distance-between-starts for long lists -->
|
11971
|
+
<xsl:if test="local-name() = 'ol'">
|
11972
|
+
<!-- Examples: xiii), xviii), xxviii) -->
|
11973
|
+
<xsl:variable name="item_numbers">
|
11974
|
+
<xsl:for-each select="*[local-name() = 'li']">
|
11975
|
+
<item><xsl:call-template name="getListItemFormat"/></item>
|
11976
|
+
</xsl:for-each>
|
11977
|
+
</xsl:variable>
|
11978
|
+
|
11979
|
+
<xsl:variable name="max_length">
|
11980
|
+
<xsl:for-each select="xalan:nodeset($item_numbers)/item">
|
11981
|
+
<xsl:sort select="string-length(.)" data-type="number" order="descending"/>
|
11982
|
+
<xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
|
11983
|
+
</xsl:for-each>
|
11984
|
+
</xsl:variable>
|
11985
|
+
|
11986
|
+
<!-- base width (provisional-distance-between-starts) for 4 chars -->
|
11987
|
+
<xsl:variable name="addon" select="$max_length - 4"/>
|
11988
|
+
<xsl:if test="$addon > 0">
|
11989
|
+
<xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
|
11990
|
+
</xsl:if>
|
11991
|
+
<!-- DEBUG -->
|
11992
|
+
<!-- <xsl:copy-of select="$item_numbers"/>
|
11993
|
+
<max_length><xsl:value-of select="$max_length"/></max_length>
|
11994
|
+
<addon><xsl:value-of select="$addon"/></addon> -->
|
11995
|
+
</xsl:if>
|
11996
|
+
|
11775
11997
|
<xsl:if test="*[local-name() = 'name']">
|
11776
11998
|
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
11777
11999
|
</xsl:if>
|
@@ -12494,6 +12716,8 @@
|
|
12494
12716
|
<!-- text in the box -->
|
12495
12717
|
<fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
|
12496
12718
|
|
12719
|
+
<xsl:call-template name="setBlockSpanAll"/>
|
12720
|
+
|
12497
12721
|
<fo:block-container xsl:use-attribute-sets="admonition-container-style">
|
12498
12722
|
|
12499
12723
|
<fo:block xsl:use-attribute-sets="admonition-name-style">
|
@@ -12672,6 +12896,16 @@
|
|
12672
12896
|
<xsl:apply-templates mode="update_xml_step1"/>
|
12673
12897
|
</xsl:copy>
|
12674
12898
|
</xsl:template>
|
12899
|
+
|
12900
|
+
<!-- remove semantic xml -->
|
12901
|
+
<xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
|
12902
|
+
|
12903
|
+
<!-- remove image/emf -->
|
12904
|
+
<xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
|
12905
|
+
|
12906
|
+
<xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
|
12907
|
+
<xsl:copy-of select="."/>
|
12908
|
+
</xsl:template>
|
12675
12909
|
<!-- =========================================================================== -->
|
12676
12910
|
<!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
|
12677
12911
|
<!-- =========================================================================== -->
|
@@ -12693,7 +12927,7 @@
|
|
12693
12927
|
|
12694
12928
|
<xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
|
12695
12929
|
|
12696
|
-
<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">
|
12930
|
+
<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">
|
12697
12931
|
|
12698
12932
|
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
12699
12933
|
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
@@ -12723,7 +12957,7 @@
|
|
12723
12957
|
<!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
|
12724
12958
|
<!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
|
12725
12959
|
<!-- add < and > to \S -->
|
12726
|
-
<xsl:variable name="regex_S">[^\r\n\t\f\v \<>
|
12960
|
+
<xsl:variable name="regex_S">[^\r\n\t\f\v \<>\u3000-\u9FFF]</xsl:variable>
|
12727
12961
|
<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>
|
12728
12962
|
<xsl:variable name="text3">
|
12729
12963
|
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
@@ -12745,7 +12979,8 @@
|
|
12745
12979
|
<xsl:choose>
|
12746
12980
|
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
12747
12981
|
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
12748
|
-
<xsl:variable name="
|
12982
|
+
<xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
|
12983
|
+
<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>
|
12749
12984
|
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
12750
12985
|
<xsl:choose>
|
12751
12986
|
<xsl:when test="self::text()">
|
@@ -12766,6 +13001,10 @@
|
|
12766
13001
|
|
12767
13002
|
</xsl:template>
|
12768
13003
|
|
13004
|
+
<xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
|
13005
|
+
<xsl:copy-of select="."/>
|
13006
|
+
</xsl:template>
|
13007
|
+
|
12769
13008
|
<xsl:template name="replace_text_tags">
|
12770
13009
|
<xsl:param name="tag_open"/>
|
12771
13010
|
<xsl:param name="tag_close"/>
|
@@ -12792,6 +13031,194 @@
|
|
12792
13031
|
<!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
|
12793
13032
|
<!-- ===================================== -->
|
12794
13033
|
|
13034
|
+
<!-- ===================================== -->
|
13035
|
+
<!-- ===================================== -->
|
13036
|
+
<!-- Make linear XML (need for landscape orientation) -->
|
13037
|
+
<!-- ===================================== -->
|
13038
|
+
<!-- ===================================== -->
|
13039
|
+
<xsl:template match="@*|node()" mode="linear_xml">
|
13040
|
+
<xsl:copy>
|
13041
|
+
<xsl:apply-templates select="@*|node()" mode="linear_xml"/>
|
13042
|
+
</xsl:copy>
|
13043
|
+
</xsl:template>
|
13044
|
+
|
13045
|
+
<xsl:template match="processing-instruction()" mode="linear_xml">
|
13046
|
+
<xsl:copy-of select="."/>
|
13047
|
+
</xsl:template>
|
13048
|
+
|
13049
|
+
<!-- From:
|
13050
|
+
<clause>
|
13051
|
+
<title>...</title>
|
13052
|
+
<p>...</p>
|
13053
|
+
</clause>
|
13054
|
+
To:
|
13055
|
+
<clause/>
|
13056
|
+
<title>...</title>
|
13057
|
+
<p>...</p>
|
13058
|
+
-->
|
13059
|
+
<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">
|
13060
|
+
|
13061
|
+
<xsl:copy>
|
13062
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
13063
|
+
|
13064
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
13065
|
+
|
13066
|
+
<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'">
|
13067
|
+
<xsl:attribute name="mainsection">true</xsl:attribute>
|
13068
|
+
</xsl:if>
|
13069
|
+
</xsl:copy>
|
13070
|
+
|
13071
|
+
<xsl:apply-templates mode="linear_xml"/>
|
13072
|
+
</xsl:template>
|
13073
|
+
|
13074
|
+
<xsl:template match="*[local-name() = 'term']" mode="linear_xml" priority="2">
|
13075
|
+
<xsl:copy>
|
13076
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
13077
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
13078
|
+
<xsl:variable name="level">
|
13079
|
+
<xsl:call-template name="getLevel"/>
|
13080
|
+
</xsl:variable>
|
13081
|
+
<xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
|
13082
|
+
<xsl:attribute name="ancestor">sections</xsl:attribute>
|
13083
|
+
<xsl:apply-templates select="node()[not(local-name() = 'term')]" mode="linear_xml"/>
|
13084
|
+
</xsl:copy>
|
13085
|
+
<xsl:apply-templates select="*[local-name() = 'term']" mode="linear_xml"/>
|
13086
|
+
</xsl:template>
|
13087
|
+
|
13088
|
+
<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">
|
13089
|
+
<xsl:copy>
|
13090
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
13091
|
+
|
13092
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
13093
|
+
|
13094
|
+
<xsl:variable name="level">
|
13095
|
+
<xsl:call-template name="getLevel"/>
|
13096
|
+
</xsl:variable>
|
13097
|
+
<xsl:attribute name="depth"><xsl:value-of select="$level"/></xsl:attribute>
|
13098
|
+
|
13099
|
+
<xsl:if test="parent::*[local-name() = 'annex']">
|
13100
|
+
<xsl:attribute name="depth">1</xsl:attribute>
|
13101
|
+
</xsl:if>
|
13102
|
+
|
13103
|
+
<xsl:if test="../@inline-header = 'true' and following-sibling::*[1][local-name() = 'p']">
|
13104
|
+
<xsl:copy-of select="../@inline-header"/>
|
13105
|
+
</xsl:if>
|
13106
|
+
|
13107
|
+
<xsl:attribute name="ancestor">
|
13108
|
+
<xsl:choose>
|
13109
|
+
<xsl:when test="ancestor::*[local-name() = 'foreword']">foreword</xsl:when>
|
13110
|
+
<xsl:when test="ancestor::*[local-name() = 'introduction']">introduction</xsl:when>
|
13111
|
+
<xsl:when test="ancestor::*[local-name() = 'sections']">sections</xsl:when>
|
13112
|
+
<xsl:when test="ancestor::*[local-name() = 'annex']">annex</xsl:when>
|
13113
|
+
<xsl:when test="ancestor::*[local-name() = 'bibliography']">bibliography</xsl:when>
|
13114
|
+
</xsl:choose>
|
13115
|
+
</xsl:attribute>
|
13116
|
+
|
13117
|
+
<xsl:apply-templates mode="linear_xml"/>
|
13118
|
+
</xsl:copy>
|
13119
|
+
</xsl:template>
|
13120
|
+
|
13121
|
+
<!-- add @to = figure, table, clause -->
|
13122
|
+
<!-- add @depth = from -->
|
13123
|
+
<xsl:template match="*[local-name() = 'xref']" mode="linear_xml">
|
13124
|
+
<xsl:copy>
|
13125
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
13126
|
+
<xsl:variable name="target" select="@target"/>
|
13127
|
+
<xsl:attribute name="to">
|
13128
|
+
<xsl:value-of select="local-name(//*[@id = current()/@target][1])"/>
|
13129
|
+
</xsl:attribute>
|
13130
|
+
<xsl:attribute name="depth">
|
13131
|
+
<xsl:value-of select="//*[@id = current()/@target][1]/*[local-name() = 'title']/@depth"/>
|
13132
|
+
</xsl:attribute>
|
13133
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
13134
|
+
</xsl:copy>
|
13135
|
+
</xsl:template>
|
13136
|
+
|
13137
|
+
<xsl:template match="*[not(ancestor::*[local-name() = 'sourcecode'])]/*[local-name() = 'p' or local-name() = 'strong' or local-name() = 'em']/text()" mode="linear_xml">
|
13138
|
+
<xsl:choose>
|
13139
|
+
<xsl:when test="contains(., $non_breaking_hyphen)">
|
13140
|
+
<xsl:call-template name="replaceChar">
|
13141
|
+
<xsl:with-param name="text" select="."/>
|
13142
|
+
<xsl:with-param name="replace" select="$non_breaking_hyphen"/>
|
13143
|
+
<xsl:with-param name="by" select="'-'"/>
|
13144
|
+
</xsl:call-template>
|
13145
|
+
</xsl:when>
|
13146
|
+
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
|
13147
|
+
</xsl:choose>
|
13148
|
+
</xsl:template>
|
13149
|
+
|
13150
|
+
<xsl:template name="replaceChar">
|
13151
|
+
<xsl:param name="text"/>
|
13152
|
+
<xsl:param name="replace"/>
|
13153
|
+
<xsl:param name="by"/>
|
13154
|
+
<xsl:choose>
|
13155
|
+
<xsl:when test="$text = '' or $replace = '' or not($replace)">
|
13156
|
+
<xsl:value-of select="$text"/>
|
13157
|
+
</xsl:when>
|
13158
|
+
<xsl:when test="contains($text, $replace)">
|
13159
|
+
<xsl:value-of select="substring-before($text,$replace)"/>
|
13160
|
+
<xsl:element name="inlineChar" namespace="https://www.metanorma.org/ns/jis"><xsl:value-of select="$by"/></xsl:element>
|
13161
|
+
<xsl:call-template name="replaceChar">
|
13162
|
+
<xsl:with-param name="text" select="substring-after($text,$replace)"/>
|
13163
|
+
<xsl:with-param name="replace" select="$replace"/>
|
13164
|
+
<xsl:with-param name="by" select="$by"/>
|
13165
|
+
</xsl:call-template>
|
13166
|
+
</xsl:when>
|
13167
|
+
<xsl:otherwise>
|
13168
|
+
<xsl:value-of select="$text"/>
|
13169
|
+
</xsl:otherwise>
|
13170
|
+
</xsl:choose>
|
13171
|
+
</xsl:template>
|
13172
|
+
|
13173
|
+
<xsl:template match="*[local-name() = 'inlineChar']">
|
13174
|
+
<fo:inline><xsl:value-of select="."/></fo:inline>
|
13175
|
+
</xsl:template>
|
13176
|
+
|
13177
|
+
<!-- change @reference to actual value, and add skip_footnote_body="true" for repeatable (2nd, 3rd, ...) -->
|
13178
|
+
<!--
|
13179
|
+
<fn reference="1">
|
13180
|
+
<p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
|
13181
|
+
</fn>
|
13182
|
+
-->
|
13183
|
+
<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">
|
13184
|
+
<xsl:variable name="p_fn_">
|
13185
|
+
<xsl:call-template name="get_fn_list"/>
|
13186
|
+
</xsl:variable>
|
13187
|
+
<xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
|
13188
|
+
<xsl:variable name="gen_id" select="generate-id(.)"/>
|
13189
|
+
<xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
|
13190
|
+
<xsl:variable name="reference" select="@reference"/>
|
13191
|
+
<!-- fn sequence number in document -->
|
13192
|
+
<xsl:variable name="current_fn_number" select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
|
13193
|
+
|
13194
|
+
<xsl:copy>
|
13195
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
13196
|
+
<!-- put actual reference number -->
|
13197
|
+
<xsl:attribute name="current_fn_number">
|
13198
|
+
<xsl:value-of select="$current_fn_number"/>
|
13199
|
+
</xsl:attribute>
|
13200
|
+
<xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
|
13201
|
+
<xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
|
13202
|
+
</xsl:attribute>
|
13203
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
13204
|
+
</xsl:copy>
|
13205
|
+
</xsl:template>
|
13206
|
+
|
13207
|
+
<xsl:template match="*[local-name() = 'p'][@type = 'section-title']" priority="3" mode="linear_xml">
|
13208
|
+
<xsl:copy>
|
13209
|
+
<xsl:apply-templates select="@*" mode="linear_xml"/>
|
13210
|
+
<xsl:if test="@depth = '1'">
|
13211
|
+
<xsl:attribute name="mainsection">true</xsl:attribute>
|
13212
|
+
</xsl:if>
|
13213
|
+
<xsl:apply-templates select="node()" mode="linear_xml"/>
|
13214
|
+
</xsl:copy>
|
13215
|
+
</xsl:template>
|
13216
|
+
<!-- ===================================== -->
|
13217
|
+
<!-- ===================================== -->
|
13218
|
+
<!-- END: Make linear XML (need for landscape orientation) -->
|
13219
|
+
<!-- ===================================== -->
|
13220
|
+
<!-- ===================================== -->
|
13221
|
+
|
12795
13222
|
<!-- for correct rendering combining chars -->
|
12796
13223
|
<xsl:template match="*[local-name() = 'lang_none']">
|
12797
13224
|
<fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
|
@@ -13348,6 +13775,23 @@
|
|
13348
13775
|
</xsl:if>
|
13349
13776
|
</xsl:template>
|
13350
13777
|
|
13778
|
+
<xsl:template name="setBlockAttributes">
|
13779
|
+
<xsl:param name="text_align_default">left</xsl:param>
|
13780
|
+
<xsl:call-template name="setTextAlignment">
|
13781
|
+
<xsl:with-param name="default" select="$text_align_default"/>
|
13782
|
+
</xsl:call-template>
|
13783
|
+
|
13784
|
+
<!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
|
13785
|
+
<!-- Example: keep-lines-together="true" -->
|
13786
|
+
<xsl:if test="@keep-lines-together = 'true'">
|
13787
|
+
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
|
13788
|
+
</xsl:if>
|
13789
|
+
<!-- Example: keep-with-next="true" -->
|
13790
|
+
<xsl:if test="@keep-with-next = 'true'">
|
13791
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
13792
|
+
</xsl:if>
|
13793
|
+
</xsl:template>
|
13794
|
+
|
13351
13795
|
<xsl:template name="number-to-words">
|
13352
13796
|
<xsl:param name="number"/>
|
13353
13797
|
<xsl:param name="first"/>
|