metanorma-mpfa 0.8.8 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/mpfa/html/html_rsd_titlepage.html +2 -0
- data/lib/isodoc/mpfa/html/htmlstyle.css +6 -0
- data/lib/isodoc/mpfa/html/htmlstyle.scss +1 -0
- data/lib/isodoc/mpfa/html/rsd.css +16 -8
- data/lib/isodoc/mpfa/html/rsd.scss +16 -7
- data/lib/isodoc/mpfa/html/word_rsd_titlepage.html +4 -2
- data/lib/isodoc/mpfa/i18n.rb +1 -1
- data/lib/isodoc/mpfa/init.rb +1 -1
- data/lib/isodoc/mpfa/mpfa.circular.xsl +1633 -337
- data/lib/isodoc/mpfa/mpfa.compliance-standards-for-mpf-trustees.xsl +1633 -337
- data/lib/isodoc/mpfa/mpfa.guidelines.xsl +1633 -337
- data/lib/isodoc/mpfa/mpfa.standards.xsl +1633 -337
- data/lib/isodoc/mpfa/mpfa.supervision-of-mpf-intermediaries.xsl +1633 -337
- data/lib/isodoc/mpfa/word_convert.rb +1 -1
- data/lib/isodoc/mpfa/xref.rb +17 -10
- data/lib/metanorma/mpfa/biblio.rng +69 -42
- data/lib/metanorma/mpfa/isodoc.rng +65 -0
- data/lib/metanorma/mpfa/version.rb +1 -1
- data/metanorma-mpfd.gemspec +1 -1
- metadata +5 -5
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
-->
|
|
35
35
|
<xsl:variable name="contents_">
|
|
36
36
|
<contents>
|
|
37
|
-
<xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms')]" mode="contents"/>
|
|
37
|
+
<xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms' or local-name() = 'note' or local-name() = 'admonition')]" mode="contents"/>
|
|
38
38
|
<xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/mpfd:terms" mode="contents"/>
|
|
39
39
|
|
|
40
40
|
<xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:sections/*" mode="contents"/>
|
|
@@ -140,12 +140,19 @@
|
|
|
140
140
|
<fo:block margin-bottom="12pt"> </fo:block>
|
|
141
141
|
<fo:block-container text-align="center" border="0.5pt solid black" margin-bottom="12pt">
|
|
142
142
|
<fo:block font-size="16pt" margin-bottom="12pt" padding-top="1mm">
|
|
143
|
-
<xsl:
|
|
144
|
-
<xsl:
|
|
145
|
-
|
|
146
|
-
<xsl:
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
<xsl:variable name="edition" select="normalize-space(/mpfd:mpfd-standard/mpfd:bibdata/mpfd:edition[normalize-space(@language) = ''])"/>
|
|
144
|
+
<xsl:if test="$edition != ''">
|
|
145
|
+
<xsl:value-of select="$edition"/>
|
|
146
|
+
<xsl:text> </xsl:text>
|
|
147
|
+
<xsl:call-template name="capitalize">
|
|
148
|
+
<xsl:with-param name="str">
|
|
149
|
+
<xsl:call-template name="getLocalizedString">
|
|
150
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
|
151
|
+
</xsl:call-template>
|
|
152
|
+
</xsl:with-param>
|
|
153
|
+
</xsl:call-template>
|
|
154
|
+
<xsl:value-of select="$linebreak"/>
|
|
155
|
+
</xsl:if>
|
|
149
156
|
<xsl:call-template name="convertDate">
|
|
150
157
|
<xsl:with-param name="date" select="/mpfd:mpfd-standard/mpfd:bibdata/mpfd:version/mpfd:revision-date"/>
|
|
151
158
|
<xsl:with-param name="format">ddMMyyyy</xsl:with-param>
|
|
@@ -237,11 +244,11 @@
|
|
|
237
244
|
|
|
238
245
|
</fo:block>
|
|
239
246
|
</fo:block-container>
|
|
240
|
-
<xsl:if test="/mpfd:mpfd-standard/mpfd:preface/*">
|
|
247
|
+
<xsl:if test="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
|
241
248
|
<fo:block break-after="page"/>
|
|
242
249
|
<!-- Foreword, Introduction -->
|
|
243
250
|
<fo:block>
|
|
244
|
-
<xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms')]"/>
|
|
251
|
+
<xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms' or local-name() = 'note' or local-name() = 'admonition')]"/>
|
|
245
252
|
<xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/mpfd:terms"/>
|
|
246
253
|
</fo:block>
|
|
247
254
|
</xsl:if>
|
|
@@ -415,6 +422,7 @@
|
|
|
415
422
|
|
|
416
423
|
<xsl:template match="mpfd:p" name="paragraph">
|
|
417
424
|
<xsl:param name="inline" select="'false'"/>
|
|
425
|
+
<xsl:param name="split_keep-within-line"/>
|
|
418
426
|
<xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
|
|
419
427
|
<xsl:variable name="element-name">
|
|
420
428
|
<xsl:choose>
|
|
@@ -439,7 +447,9 @@
|
|
|
439
447
|
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
|
|
440
448
|
</xsl:if>
|
|
441
449
|
<xsl:attribute name="line-height">115%</xsl:attribute>
|
|
442
|
-
<xsl:apply-templates
|
|
450
|
+
<xsl:apply-templates>
|
|
451
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
|
452
|
+
</xsl:apply-templates>
|
|
443
453
|
</xsl:element>
|
|
444
454
|
<xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
|
|
445
455
|
<xsl:choose>
|
|
@@ -576,12 +586,41 @@
|
|
|
576
586
|
</xsl:template>
|
|
577
587
|
|
|
578
588
|
|
|
579
|
-
<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="
|
|
589
|
+
<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:variable name="table_widths_from_if_calculated_">
|
|
590
|
+
<xsl:for-each select="$table_widths_from_if//table">
|
|
591
|
+
<xsl:copy>
|
|
592
|
+
<xsl:copy-of select="@*"/>
|
|
593
|
+
<xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
|
|
594
|
+
</xsl:copy>
|
|
595
|
+
</xsl:for-each>
|
|
596
|
+
</xsl:variable><xsl:variable name="table_widths_from_if_calculated" select="xalan:nodeset($table_widths_from_if_calculated_)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
|
|
597
|
+
false
|
|
598
|
+
</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
|
|
580
599
|
<xsl:call-template name="getLang"/>
|
|
581
|
-
</xsl:variable><xsl:variable name="
|
|
582
|
-
|
|
600
|
+
</xsl:variable><xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/><xsl:variable name="papersize_width_">
|
|
601
|
+
<xsl:choose>
|
|
602
|
+
<xsl:when test="$papersize = 'letter'">215.9</xsl:when>
|
|
603
|
+
<xsl:when test="$papersize = 'a4'">210</xsl:when>
|
|
604
|
+
</xsl:choose>
|
|
605
|
+
</xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
|
|
606
|
+
<xsl:choose>
|
|
607
|
+
<xsl:when test="$papersize = 'letter'">279.4</xsl:when>
|
|
608
|
+
<xsl:when test="$papersize = 'a4'">297</xsl:when>
|
|
609
|
+
</xsl:choose>
|
|
610
|
+
</xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
|
|
611
|
+
<xsl:choose>
|
|
612
|
+
<xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
|
|
613
|
+
<xsl:otherwise>
|
|
614
|
+
210
|
|
615
|
+
</xsl:otherwise>
|
|
616
|
+
</xsl:choose>
|
|
583
617
|
</xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
|
|
584
|
-
|
|
618
|
+
<xsl:choose>
|
|
619
|
+
<xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
|
|
620
|
+
<xsl:otherwise>
|
|
621
|
+
297
|
|
622
|
+
</xsl:otherwise>
|
|
623
|
+
</xsl:choose>
|
|
585
624
|
</xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
|
|
586
625
|
19
|
|
587
626
|
</xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
|
|
@@ -591,20 +630,7 @@
|
|
|
591
630
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
|
592
631
|
10
|
|
593
632
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
|
594
|
-
|
|
595
|
-
<title-edition lang="en">
|
|
596
|
-
|
|
597
|
-
<xsl:text>Edition </xsl:text>
|
|
598
|
-
|
|
599
|
-
</title-edition>
|
|
600
|
-
|
|
601
|
-
<title-edition lang="fr">
|
|
602
|
-
<xsl:text>Édition </xsl:text>
|
|
603
|
-
</title-edition>
|
|
604
633
|
|
|
605
|
-
<title-edition lang="ru">
|
|
606
|
-
<xsl:text>Издание </xsl:text>
|
|
607
|
-
</title-edition>
|
|
608
634
|
|
|
609
635
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
|
610
636
|
<title-toc lang="en">
|
|
@@ -685,7 +711,7 @@
|
|
|
685
711
|
</xsl:variable><xsl:variable name="bibdata">
|
|
686
712
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
|
687
713
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
|
688
|
-
</xsl:variable><xsl:variable name="linebreak">
</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space"></xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
|
|
714
|
+
</xsl:variable><xsl:variable name="linebreak">
</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space"></xsl:variable><xsl:variable name="hair_space"> </xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
|
|
689
715
|
<xsl:param name="name"/>
|
|
690
716
|
<xsl:param name="lang"/>
|
|
691
717
|
<xsl:variable name="lang_">
|
|
@@ -733,7 +759,7 @@
|
|
|
733
759
|
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
|
734
760
|
|
|
735
761
|
<xsl:variable name="additional_fonts_">
|
|
736
|
-
<xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
|
|
762
|
+
<xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
|
|
737
763
|
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
|
738
764
|
</xsl:for-each>
|
|
739
765
|
</xsl:variable>
|
|
@@ -808,7 +834,6 @@
|
|
|
808
834
|
|
|
809
835
|
|
|
810
836
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
|
811
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
|
812
837
|
|
|
813
838
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
|
814
839
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
|
@@ -884,6 +909,7 @@
|
|
|
884
909
|
|
|
885
910
|
|
|
886
911
|
|
|
912
|
+
|
|
887
913
|
<xsl:attribute name="margin-left">12.5mm</xsl:attribute>
|
|
888
914
|
<xsl:attribute name="margin-bottom">18pt</xsl:attribute>
|
|
889
915
|
|
|
@@ -1039,6 +1065,7 @@
|
|
|
1039
1065
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
|
1040
1066
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
|
1041
1067
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
|
1068
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
|
1042
1069
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
|
1043
1070
|
|
|
1044
1071
|
|
|
@@ -1060,6 +1087,7 @@
|
|
|
1060
1087
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
|
1061
1088
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
|
1062
1089
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
|
1090
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
|
1063
1091
|
|
|
1064
1092
|
|
|
1065
1093
|
|
|
@@ -1142,7 +1170,8 @@
|
|
|
1142
1170
|
</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
|
|
1143
1171
|
|
|
1144
1172
|
|
|
1145
|
-
</xsl:attribute-set><xsl:attribute-set name="dt-style">
|
|
1173
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
|
|
1174
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
|
|
1146
1175
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
|
1147
1176
|
|
|
1148
1177
|
|
|
@@ -1154,6 +1183,26 @@
|
|
|
1154
1183
|
|
|
1155
1184
|
|
|
1156
1185
|
|
|
1186
|
+
</xsl:attribute-set><xsl:attribute-set name="dl-name-style">
|
|
1187
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
|
1188
|
+
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
|
|
1205
|
+
<xsl:attribute name="padding-left">2mm</xsl:attribute>
|
|
1157
1206
|
</xsl:attribute-set><xsl:attribute-set name="appendix-style">
|
|
1158
1207
|
|
|
1159
1208
|
|
|
@@ -1444,6 +1493,23 @@
|
|
|
1444
1493
|
|
|
1445
1494
|
|
|
1446
1495
|
|
|
1496
|
+
</xsl:attribute-set><xsl:attribute-set name="list-name-style">
|
|
1497
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
|
|
1447
1513
|
</xsl:attribute-set><xsl:attribute-set name="list-item-style">
|
|
1448
1514
|
|
|
1449
1515
|
|
|
@@ -1835,13 +1901,13 @@
|
|
|
1835
1901
|
|
|
1836
1902
|
</xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
|
|
1837
1903
|
<xsl:variable name="nodes_preface_">
|
|
1838
|
-
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
|
1904
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
|
1839
1905
|
<node id="{@id}"/>
|
|
1840
1906
|
</xsl:for-each>
|
|
1841
1907
|
</xsl:variable>
|
|
1842
1908
|
<xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
|
|
1843
1909
|
|
|
1844
|
-
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
|
1910
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
|
1845
1911
|
<xsl:sort select="@displayorder" data-type="number"/>
|
|
1846
1912
|
|
|
1847
1913
|
<!-- process Section's title -->
|
|
@@ -1907,7 +1973,7 @@
|
|
|
1907
1973
|
</xsl:for-each>
|
|
1908
1974
|
</figures>
|
|
1909
1975
|
</xsl:template><xsl:template name="processPrefaceSectionsDefault">
|
|
1910
|
-
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
|
1976
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
|
1911
1977
|
<xsl:sort select="@displayorder" data-type="number"/>
|
|
1912
1978
|
<xsl:apply-templates select="."/>
|
|
1913
1979
|
</xsl:for-each>
|
|
@@ -1927,22 +1993,32 @@
|
|
|
1927
1993
|
<xsl:sort select="@displayorder" data-type="number"/>
|
|
1928
1994
|
<xsl:apply-templates select="."/>
|
|
1929
1995
|
</xsl:for-each>
|
|
1930
|
-
</xsl:template><xsl:variable name="
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1996
|
+
</xsl:template><xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable><xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable><xsl:template match="text()" name="text">
|
|
1997
|
+
|
|
1998
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
|
1999
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
|
|
2000
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
|
2001
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
|
2002
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
|
2003
|
+
<xsl:with-param name="text" select="$text"/>
|
|
2004
|
+
</xsl:call-template>
|
|
2005
|
+
|
|
2006
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
|
2007
|
+
<xsl:param name="tag_open"/>
|
|
2008
|
+
<xsl:param name="tag_close"/>
|
|
1937
2009
|
<xsl:param name="text"/>
|
|
1938
2010
|
<xsl:choose>
|
|
1939
2011
|
<xsl:when test="contains($text, $tag_open)">
|
|
1940
2012
|
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
|
1941
|
-
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
|
2013
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
|
1942
2014
|
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
|
1943
|
-
<
|
|
1944
|
-
|
|
1945
|
-
|
|
2015
|
+
<fo:inline keep-together.within-line="always">
|
|
2016
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
|
2017
|
+
</fo:inline>
|
|
2018
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
|
2019
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
|
2020
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
|
2021
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
|
1946
2022
|
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
|
1947
2023
|
</xsl:call-template>
|
|
1948
2024
|
</xsl:when>
|
|
@@ -1950,6 +2026,39 @@
|
|
|
1950
2026
|
</xsl:choose>
|
|
1951
2027
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
|
1952
2028
|
<xsl:value-of select="$linebreak"/>
|
|
2029
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
|
2030
|
+
<xsl:param name="split_keep-within-line"/>
|
|
2031
|
+
|
|
2032
|
+
<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
|
|
2033
|
+
<xsl:choose>
|
|
2034
|
+
|
|
2035
|
+
<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
|
|
2036
|
+
<xsl:variable name="sep">_</xsl:variable>
|
|
2037
|
+
<xsl:variable name="items">
|
|
2038
|
+
<xsl:call-template name="split">
|
|
2039
|
+
<xsl:with-param name="pText" select="."/>
|
|
2040
|
+
<xsl:with-param name="sep" select="$sep"/>
|
|
2041
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
|
2042
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
|
2043
|
+
</xsl:call-template>
|
|
2044
|
+
</xsl:variable>
|
|
2045
|
+
<xsl:for-each select="xalan:nodeset($items)/item">
|
|
2046
|
+
<xsl:choose>
|
|
2047
|
+
<xsl:when test=". = $sep">
|
|
2048
|
+
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
|
|
2049
|
+
</xsl:when>
|
|
2050
|
+
<xsl:otherwise>
|
|
2051
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
|
2052
|
+
</xsl:otherwise>
|
|
2053
|
+
</xsl:choose>
|
|
2054
|
+
</xsl:for-each>
|
|
2055
|
+
</xsl:when>
|
|
2056
|
+
|
|
2057
|
+
<xsl:otherwise>
|
|
2058
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
|
2059
|
+
</xsl:otherwise>
|
|
2060
|
+
|
|
2061
|
+
</xsl:choose>
|
|
1953
2062
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
|
1954
2063
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
|
1955
2064
|
<xsl:apply-templates/>
|
|
@@ -2015,8 +2124,23 @@
|
|
|
2015
2124
|
</xsl:call-template>
|
|
2016
2125
|
|
|
2017
2126
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
|
2018
|
-
|
|
2019
|
-
|
|
2127
|
+
<xsl:choose>
|
|
2128
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
|
2129
|
+
<xsl:value-of select="."/>
|
|
2130
|
+
</xsl:when>
|
|
2131
|
+
<xsl:otherwise>
|
|
2132
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
|
2133
|
+
</xsl:otherwise>
|
|
2134
|
+
</xsl:choose>
|
|
2135
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
|
2136
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
|
2137
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
|
2138
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
|
2139
|
+
<xsl:choose>
|
|
2140
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
|
2141
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
|
2142
|
+
</xsl:choose>
|
|
2143
|
+
</xsl:for-each>
|
|
2020
2144
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
|
2021
2145
|
|
|
2022
2146
|
<xsl:variable name="table-preamble">
|
|
@@ -2026,9 +2150,14 @@
|
|
|
2026
2150
|
|
|
2027
2151
|
<xsl:variable name="table">
|
|
2028
2152
|
|
|
2029
|
-
<xsl:variable name="simple-table">
|
|
2030
|
-
<xsl:call-template name="getSimpleTable"
|
|
2153
|
+
<xsl:variable name="simple-table">
|
|
2154
|
+
<xsl:call-template name="getSimpleTable">
|
|
2155
|
+
<xsl:with-param name="id" select="@id"/>
|
|
2156
|
+
</xsl:call-template>
|
|
2031
2157
|
</xsl:variable>
|
|
2158
|
+
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
|
2159
|
+
|
|
2160
|
+
<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
|
|
2032
2161
|
|
|
2033
2162
|
|
|
2034
2163
|
<!-- Display table's name before table as standalone block -->
|
|
@@ -2051,7 +2180,23 @@
|
|
|
2051
2180
|
</xsl:call-template>
|
|
2052
2181
|
</xsl:if>
|
|
2053
2182
|
</xsl:variable>
|
|
2054
|
-
<!--
|
|
2183
|
+
<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
|
|
2184
|
+
|
|
2185
|
+
<!-- DEBUG -->
|
|
2186
|
+
<xsl:if test="$table_if_debug = 'true'">
|
|
2187
|
+
<fo:block font-size="60%">
|
|
2188
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
|
2189
|
+
</fo:block>
|
|
2190
|
+
</xsl:if>
|
|
2191
|
+
|
|
2192
|
+
|
|
2193
|
+
<!-- <xsl:copy-of select="$colwidths"/> -->
|
|
2194
|
+
|
|
2195
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
|
2196
|
+
DEBUG
|
|
2197
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
|
2198
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
|
2199
|
+
|
|
2055
2200
|
|
|
2056
2201
|
|
|
2057
2202
|
<xsl:variable name="margin-side">
|
|
@@ -2112,9 +2257,17 @@
|
|
|
2112
2257
|
</xsl:element>
|
|
2113
2258
|
</xsl:variable>
|
|
2114
2259
|
|
|
2260
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
|
2261
|
+
<!-- to determine start of table -->
|
|
2262
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
|
2263
|
+
</xsl:if>
|
|
2115
2264
|
|
|
2116
2265
|
<fo:table id="{@id}">
|
|
2117
2266
|
|
|
2267
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
|
2268
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
|
2269
|
+
</xsl:if>
|
|
2270
|
+
|
|
2118
2271
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
|
2119
2272
|
<xsl:attribute name="{local-name()}">
|
|
2120
2273
|
<xsl:value-of select="."/>
|
|
@@ -2128,31 +2281,47 @@
|
|
|
2128
2281
|
|
|
2129
2282
|
|
|
2130
2283
|
<xsl:choose>
|
|
2131
|
-
<xsl:when test="
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2284
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
|
2285
|
+
<!-- generate IF for table widths -->
|
|
2286
|
+
<!-- example:
|
|
2287
|
+
<tr>
|
|
2288
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
|
2289
|
+
<p>Symbol</p>
|
|
2290
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
|
2291
|
+
</td>
|
|
2292
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
|
2293
|
+
<p>Description</p>
|
|
2294
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
|
2295
|
+
</td>
|
|
2296
|
+
</tr>
|
|
2297
|
+
-->
|
|
2298
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
|
|
2299
|
+
|
|
2135
2300
|
</xsl:when>
|
|
2136
2301
|
<xsl:otherwise>
|
|
2137
|
-
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
|
2138
|
-
<xsl:choose>
|
|
2139
|
-
<xsl:when test=". = 1 or . = 0">
|
|
2140
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
|
2141
|
-
</xsl:when>
|
|
2142
|
-
<xsl:otherwise>
|
|
2143
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
|
2144
|
-
</xsl:otherwise>
|
|
2145
|
-
</xsl:choose>
|
|
2146
|
-
</xsl:for-each>
|
|
2147
|
-
</xsl:otherwise>
|
|
2148
|
-
</xsl:choose>
|
|
2149
2302
|
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2303
|
+
<xsl:choose>
|
|
2304
|
+
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
|
|
2305
|
+
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
|
|
2306
|
+
<fo:table-column column-width="{@width}"/>
|
|
2307
|
+
</xsl:for-each>
|
|
2308
|
+
</xsl:when>
|
|
2309
|
+
<xsl:otherwise>
|
|
2310
|
+
<xsl:call-template name="insertTableColumnWidth">
|
|
2311
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
|
2312
|
+
</xsl:call-template>
|
|
2313
|
+
</xsl:otherwise>
|
|
2314
|
+
</xsl:choose>
|
|
2315
|
+
|
|
2316
|
+
<xsl:choose>
|
|
2317
|
+
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
|
|
2318
|
+
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
|
2319
|
+
</xsl:when>
|
|
2320
|
+
<xsl:otherwise>
|
|
2321
|
+
<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 note that renders separaterely -->
|
|
2322
|
+
</xsl:otherwise>
|
|
2323
|
+
</xsl:choose>
|
|
2324
|
+
|
|
2156
2325
|
</xsl:otherwise>
|
|
2157
2326
|
</xsl:choose>
|
|
2158
2327
|
|
|
@@ -2255,11 +2424,22 @@
|
|
|
2255
2424
|
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
|
|
2256
2425
|
<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
|
|
2257
2426
|
</xsl:template><xsl:template name="calculate-column-widths">
|
|
2427
|
+
<xsl:param name="table"/>
|
|
2428
|
+
<xsl:param name="cols-count"/>
|
|
2429
|
+
|
|
2430
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
|
2431
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
|
2432
|
+
<xsl:with-param name="table" select="$table"/>
|
|
2433
|
+
</xsl:call-template>
|
|
2434
|
+
|
|
2435
|
+
</xsl:template><xsl:template name="calculate-column-widths-proportional">
|
|
2258
2436
|
<xsl:param name="table"/>
|
|
2259
2437
|
<xsl:param name="cols-count"/>
|
|
2260
2438
|
<xsl:param name="curr-col" select="1"/>
|
|
2261
2439
|
<xsl:param name="width" select="0"/>
|
|
2262
2440
|
|
|
2441
|
+
<!-- table=<xsl:copy-of select="$table"/> -->
|
|
2442
|
+
|
|
2263
2443
|
<xsl:if test="$curr-col <= $cols-count">
|
|
2264
2444
|
<xsl:variable name="widths">
|
|
2265
2445
|
<xsl:choose>
|
|
@@ -2297,16 +2477,22 @@
|
|
|
2297
2477
|
</xsl:for-each>
|
|
2298
2478
|
</xsl:when>
|
|
2299
2479
|
<xsl:otherwise>
|
|
2300
|
-
<xsl:
|
|
2480
|
+
<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
|
|
2481
|
+
|
|
2482
|
+
<!-- <table><xsl:copy-of select="$table"/></table>
|
|
2483
|
+
-->
|
|
2484
|
+
<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
|
|
2301
2485
|
<xsl:variable name="td_text">
|
|
2302
2486
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
|
2303
2487
|
</xsl:variable>
|
|
2488
|
+
<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
|
|
2304
2489
|
<xsl:variable name="words">
|
|
2305
2490
|
<xsl:variable name="string_with_added_zerospaces">
|
|
2306
2491
|
<xsl:call-template name="add-zero-spaces-java">
|
|
2307
2492
|
<xsl:with-param name="text" select="$td_text"/>
|
|
2308
2493
|
</xsl:call-template>
|
|
2309
2494
|
</xsl:variable>
|
|
2495
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
|
2310
2496
|
<xsl:call-template name="tokenize">
|
|
2311
2497
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
|
2312
2498
|
<!-- 2009 thinspace -->
|
|
@@ -2314,11 +2500,13 @@
|
|
|
2314
2500
|
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
|
2315
2501
|
</xsl:call-template>
|
|
2316
2502
|
</xsl:variable>
|
|
2503
|
+
<!-- words=<xsl:copy-of select="$words"/> -->
|
|
2317
2504
|
<xsl:variable name="max_length">
|
|
2318
2505
|
<xsl:call-template name="max_length">
|
|
2319
2506
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
|
2320
2507
|
</xsl:call-template>
|
|
2321
2508
|
</xsl:variable>
|
|
2509
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
|
2322
2510
|
<width>
|
|
2323
2511
|
<xsl:variable name="divider">
|
|
2324
2512
|
<xsl:choose>
|
|
@@ -2337,6 +2525,8 @@
|
|
|
2337
2525
|
</xsl:choose>
|
|
2338
2526
|
</xsl:variable>
|
|
2339
2527
|
|
|
2528
|
+
<!-- widths=<xsl:copy-of select="$widths"/> -->
|
|
2529
|
+
|
|
2340
2530
|
<column>
|
|
2341
2531
|
<xsl:for-each select="xalan:nodeset($widths)//width">
|
|
2342
2532
|
<xsl:sort select="." data-type="number" order="descending"/>
|
|
@@ -2345,29 +2535,271 @@
|
|
|
2345
2535
|
</xsl:if>
|
|
2346
2536
|
</xsl:for-each>
|
|
2347
2537
|
</column>
|
|
2348
|
-
<xsl:call-template name="calculate-column-widths">
|
|
2538
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
|
2349
2539
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
|
2350
2540
|
<xsl:with-param name="curr-col" select="$curr-col +1"/>
|
|
2351
2541
|
<xsl:with-param name="table" select="$table"/>
|
|
2352
2542
|
</xsl:call-template>
|
|
2353
2543
|
</xsl:if>
|
|
2544
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
|
|
2545
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
|
2546
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
|
2547
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
|
2548
|
+
|
|
2549
|
+
<!-- if all capitals english letters or digits -->
|
|
2550
|
+
<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
|
|
2551
|
+
<xsl:call-template name="repeat">
|
|
2552
|
+
<xsl:with-param name="char" select="'X'"/>
|
|
2553
|
+
<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
|
|
2554
|
+
</xsl:call-template>
|
|
2555
|
+
</xsl:if>
|
|
2354
2556
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
|
2355
2557
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
|
2356
2558
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
|
2357
2559
|
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
|
|
2358
2560
|
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
|
|
2359
2561
|
<xsl:value-of select="@target"/>
|
|
2360
|
-
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
|
|
2361
|
-
<xsl:
|
|
2362
|
-
<xsl:
|
|
2363
|
-
<xsl:
|
|
2364
|
-
<xsl:
|
|
2365
|
-
|
|
2562
|
+
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
|
|
2563
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
|
2564
|
+
<xsl:variable name="mathml_">
|
|
2565
|
+
<xsl:for-each select="*">
|
|
2566
|
+
<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
|
|
2567
|
+
<xsl:copy-of select="."/>
|
|
2568
|
+
</xsl:if>
|
|
2569
|
+
</xsl:for-each>
|
|
2570
|
+
</xsl:variable>
|
|
2571
|
+
<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
|
|
2572
|
+
|
|
2573
|
+
<xsl:variable name="math_text">
|
|
2574
|
+
<xsl:value-of select="normalize-space($mathml)"/>
|
|
2575
|
+
<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
|
|
2576
|
+
<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
|
|
2577
|
+
</xsl:variable>
|
|
2578
|
+
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
|
|
2579
|
+
</xsl:if>
|
|
2580
|
+
</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
|
|
2581
|
+
<xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
|
|
2582
|
+
|
|
2583
|
+
<!-- via intermediate format -->
|
|
2584
|
+
|
|
2585
|
+
<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
|
|
2586
|
+
|
|
2587
|
+
<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
|
|
2588
|
+
|
|
2589
|
+
<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
|
|
2590
|
+
|
|
2591
|
+
<!-- get current table id -->
|
|
2592
|
+
<xsl:variable name="table_id" select="@id"/>
|
|
2593
|
+
<!-- find table by id in the file 'table_widths' -->
|
|
2594
|
+
<!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
|
|
2595
|
+
<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
|
|
2596
|
+
|
|
2597
|
+
<!-- table='<xsl:copy-of select="$table"/>' -->
|
|
2598
|
+
<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
|
|
2599
|
+
<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
|
|
2600
|
+
<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
|
|
2601
|
+
|
|
2602
|
+
<xsl:variable name="table_with_cell_widths_">
|
|
2603
|
+
<xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
|
|
2604
|
+
</xsl:variable>
|
|
2605
|
+
<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
|
|
2606
|
+
|
|
2607
|
+
<!-- <xsl:if test="$table_if_debug = 'true'">
|
|
2608
|
+
<xsl:copy-of select="$table_with_cell_widths"/>
|
|
2609
|
+
</xsl:if> -->
|
|
2610
|
+
|
|
2611
|
+
|
|
2612
|
+
<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
|
|
2613
|
+
|
|
2614
|
+
<xsl:variable name="column_widths_">
|
|
2615
|
+
<!-- iteration of columns -->
|
|
2616
|
+
<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
|
|
2617
|
+
<xsl:variable name="pos" select="position()"/>
|
|
2618
|
+
<column>
|
|
2619
|
+
<xsl:attribute name="width_max">
|
|
2620
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
|
|
2621
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
|
2622
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
|
2623
|
+
</xsl:for-each>
|
|
2624
|
+
</xsl:attribute>
|
|
2625
|
+
<xsl:attribute name="width_min">
|
|
2626
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
|
|
2627
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
|
2628
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
|
2629
|
+
</xsl:for-each>
|
|
2630
|
+
</xsl:attribute>
|
|
2631
|
+
</column>
|
|
2366
2632
|
</xsl:for-each>
|
|
2367
2633
|
</xsl:variable>
|
|
2634
|
+
<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
|
|
2635
|
+
|
|
2636
|
+
<!-- <column_widths>
|
|
2637
|
+
<xsl:copy-of select="$column_widths"/>
|
|
2638
|
+
</column_widths> -->
|
|
2639
|
+
|
|
2640
|
+
<!-- These in turn, are used to find the minimum and maximum width for the table. -->
|
|
2641
|
+
<xsl:variable name="table_widths_">
|
|
2642
|
+
<table>
|
|
2643
|
+
<xsl:attribute name="width_max">
|
|
2644
|
+
<xsl:value-of select="sum($column_widths/column/@width_max)"/>
|
|
2645
|
+
</xsl:attribute>
|
|
2646
|
+
<xsl:attribute name="width_min">
|
|
2647
|
+
<xsl:value-of select="sum($column_widths/column/@width_min)"/>
|
|
2648
|
+
</xsl:attribute>
|
|
2649
|
+
</table>
|
|
2650
|
+
</xsl:variable>
|
|
2651
|
+
<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
|
|
2652
|
+
|
|
2653
|
+
<xsl:variable name="page_width">
|
|
2654
|
+
<xsl:choose>
|
|
2655
|
+
<xsl:when test="$parent_table_page-width != ''">
|
|
2656
|
+
<xsl:value-of select="$parent_table_page-width"/>
|
|
2657
|
+
</xsl:when>
|
|
2658
|
+
<xsl:otherwise>
|
|
2659
|
+
<xsl:value-of select="@page-width"/>
|
|
2660
|
+
</xsl:otherwise>
|
|
2661
|
+
</xsl:choose>
|
|
2662
|
+
</xsl:variable>
|
|
2663
|
+
|
|
2664
|
+
<xsl:if test="$table_if_debug = 'true'">
|
|
2665
|
+
<table_width>
|
|
2666
|
+
<xsl:copy-of select="$table_widths"/>
|
|
2667
|
+
</table_width>
|
|
2668
|
+
<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
|
|
2669
|
+
</xsl:if>
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
<!-- There are three cases: -->
|
|
2673
|
+
<xsl:choose>
|
|
2674
|
+
<!-- 1. The minimum table width is equal to or wider than the available space -->
|
|
2675
|
+
<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
|
|
2676
|
+
<!-- call old algorithm -->
|
|
2677
|
+
<case1/>
|
|
2678
|
+
<!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
|
|
2679
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
|
2680
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
|
2681
|
+
<xsl:with-param name="table" select="$table"/>
|
|
2682
|
+
</xsl:call-template> -->
|
|
2683
|
+
</xsl:when>
|
|
2684
|
+
<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
|
|
2685
|
+
<xsl:when test="$table_widths/table/@width_max <= $page_width">
|
|
2686
|
+
<case2/>
|
|
2687
|
+
<autolayout/>
|
|
2688
|
+
<xsl:for-each select="$column_widths/column/@width_max">
|
|
2689
|
+
<column divider="100"><xsl:value-of select="."/></column>
|
|
2690
|
+
</xsl:for-each>
|
|
2691
|
+
</xsl:when>
|
|
2692
|
+
<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
|
|
2693
|
+
In this case, find the difference between the available space and the minimum table width, lets call it W.
|
|
2694
|
+
Lets also call D the difference between maximum and minimum width of the table.
|
|
2695
|
+
For each column, let d be the difference between maximum and minimum width of that column.
|
|
2696
|
+
Now set the column's width to the minimum width plus d times W over D.
|
|
2697
|
+
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
|
2698
|
+
<xsl:when test="($table_widths/table/@width_max > $page_width and $table_widths/table/@width_min < $page_width) or ($table_widths/table/@width_min >= $page_width)">
|
|
2699
|
+
<!-- difference between the available space and the minimum table width -->
|
|
2700
|
+
<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
|
|
2701
|
+
<W><xsl:value-of select="$W"/></W>
|
|
2702
|
+
<!-- difference between maximum and minimum width of the table -->
|
|
2703
|
+
<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
|
|
2704
|
+
<D><xsl:value-of select="$D"/></D>
|
|
2705
|
+
<case3/>
|
|
2706
|
+
<autolayout/>
|
|
2707
|
+
<xsl:if test="$table_widths/table/@width_min >= $page_width">
|
|
2708
|
+
<split_keep-within-line>true</split_keep-within-line>
|
|
2709
|
+
</xsl:if>
|
|
2710
|
+
<xsl:for-each select="$column_widths/column">
|
|
2711
|
+
<!-- difference between maximum and minimum width of that column. -->
|
|
2712
|
+
<xsl:variable name="d" select="@width_max - @width_min"/>
|
|
2713
|
+
<d><xsl:value-of select="$d"/></d>
|
|
2714
|
+
<width_min><xsl:value-of select="@width_min"/></width_min>
|
|
2715
|
+
<e><xsl:value-of select="$d * $W div $D"/></e>
|
|
2716
|
+
<!-- set the column's width to the minimum width plus d times W over D. -->
|
|
2717
|
+
<column divider="100">
|
|
2718
|
+
<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
|
|
2719
|
+
</column>
|
|
2720
|
+
</xsl:for-each>
|
|
2721
|
+
|
|
2722
|
+
</xsl:when>
|
|
2723
|
+
<xsl:otherwise><unknown_case/></xsl:otherwise>
|
|
2724
|
+
</xsl:choose>
|
|
2725
|
+
|
|
2726
|
+
</xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
|
|
2727
|
+
|
|
2728
|
+
<!-- if nested 'dl' or 'table' -->
|
|
2729
|
+
<xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
|
|
2730
|
+
<parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
|
|
2731
|
+
|
|
2732
|
+
<parent_element><xsl:value-of select="local-name(..)"/></parent_element>
|
|
2733
|
+
|
|
2734
|
+
<xsl:variable name="parent_table_page-width_">
|
|
2735
|
+
<xsl:if test="$parent_table_id != ''">
|
|
2736
|
+
<!-- determine column number in the parent table -->
|
|
2737
|
+
<xsl:variable name="parent_table_column_number">
|
|
2738
|
+
<xsl:choose>
|
|
2739
|
+
<xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
|
|
2740
|
+
<xsl:otherwise> <!-- parent is table -->
|
|
2741
|
+
<xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
|
|
2742
|
+
</xsl:otherwise>
|
|
2743
|
+
</xsl:choose>
|
|
2744
|
+
</xsl:variable>
|
|
2745
|
+
<!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
|
|
2746
|
+
<xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
|
|
2747
|
+
</xsl:if>
|
|
2748
|
+
</xsl:variable>
|
|
2749
|
+
<xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
|
|
2750
|
+
|
|
2751
|
+
<!-- get current table id -->
|
|
2752
|
+
<xsl:variable name="table_id" select="@id"/>
|
|
2753
|
+
|
|
2754
|
+
<xsl:choose>
|
|
2755
|
+
<xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
|
|
2756
|
+
<!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
|
|
2757
|
+
<xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
|
|
2758
|
+
</xsl:when>
|
|
2759
|
+
<xsl:otherwise>
|
|
2760
|
+
<!-- recalculate columns width based on parent table width -->
|
|
2761
|
+
<xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
|
|
2762
|
+
<xsl:call-template name="calculate-column-widths-autolayout-algorithm">
|
|
2763
|
+
<xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
|
|
2764
|
+
</xsl:call-template>
|
|
2765
|
+
</xsl:for-each>
|
|
2766
|
+
</xsl:otherwise>
|
|
2767
|
+
</xsl:choose>
|
|
2368
2768
|
|
|
2369
|
-
|
|
2370
|
-
<xsl:
|
|
2769
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
|
|
2770
|
+
<xsl:copy>
|
|
2771
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
|
|
2772
|
+
</xsl:copy>
|
|
2773
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
|
|
2774
|
+
<xsl:copy>
|
|
2775
|
+
<xsl:copy-of select="@*"/>
|
|
2776
|
+
|
|
2777
|
+
<!-- The maximum width is given by the widest line. -->
|
|
2778
|
+
<xsl:attribute name="width_max">
|
|
2779
|
+
<xsl:for-each select="p_len">
|
|
2780
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
|
2781
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
|
2782
|
+
</xsl:for-each>
|
|
2783
|
+
</xsl:attribute>
|
|
2784
|
+
|
|
2785
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
|
2786
|
+
<xsl:variable name="width_min">
|
|
2787
|
+
<xsl:for-each select="word_len">
|
|
2788
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
|
2789
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
|
2790
|
+
</xsl:for-each>
|
|
2791
|
+
</xsl:variable>
|
|
2792
|
+
<xsl:attribute name="width_min">
|
|
2793
|
+
<xsl:value-of select="$width_min"/>
|
|
2794
|
+
</xsl:attribute>
|
|
2795
|
+
|
|
2796
|
+
<xsl:if test="$width_min = 0">
|
|
2797
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
|
2798
|
+
</xsl:if>
|
|
2799
|
+
|
|
2800
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
|
|
2801
|
+
|
|
2802
|
+
</xsl:copy>
|
|
2371
2803
|
</xsl:template><xsl:template match="*[local-name()='thead']">
|
|
2372
2804
|
<xsl:param name="cols-count"/>
|
|
2373
2805
|
<fo:table-header>
|
|
@@ -2452,16 +2884,10 @@
|
|
|
2452
2884
|
</xsl:for-each>
|
|
2453
2885
|
</xsl:when>
|
|
2454
2886
|
<xsl:otherwise>
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
</xsl:when>
|
|
2460
|
-
<xsl:otherwise>
|
|
2461
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
|
2462
|
-
</xsl:otherwise>
|
|
2463
|
-
</xsl:choose>
|
|
2464
|
-
</xsl:for-each>
|
|
2887
|
+
<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
|
|
2888
|
+
<xsl:call-template name="insertTableColumnWidth">
|
|
2889
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
|
2890
|
+
</xsl:call-template>
|
|
2465
2891
|
</xsl:otherwise>
|
|
2466
2892
|
</xsl:choose>
|
|
2467
2893
|
|
|
@@ -2538,18 +2964,64 @@
|
|
|
2538
2964
|
|
|
2539
2965
|
</fo:table-body>
|
|
2540
2966
|
|
|
2541
|
-
</xsl:template><xsl:template match="
|
|
2542
|
-
<
|
|
2967
|
+
</xsl:template><xsl:template match="/" mode="process_table-if">
|
|
2968
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
|
2969
|
+
<xsl:apply-templates mode="process_table-if">
|
|
2970
|
+
<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
|
|
2971
|
+
</xsl:apply-templates>
|
|
2972
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
|
|
2973
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
|
2543
2974
|
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2975
|
+
<fo:table-body>
|
|
2976
|
+
<xsl:for-each select="*[local-name() = 'tr']">
|
|
2977
|
+
<xsl:variable name="col_count" select="count(*)"/>
|
|
2547
2978
|
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2979
|
+
<!-- iteration for each tr/td -->
|
|
2980
|
+
|
|
2981
|
+
<xsl:choose>
|
|
2982
|
+
<xsl:when test="$table_or_dl = 'table'">
|
|
2983
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
|
|
2984
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
|
2985
|
+
<!-- <test_table><xsl:copy-of select="."/></test_table> -->
|
|
2986
|
+
<xsl:call-template name="td"/>
|
|
2987
|
+
</fo:table-row>
|
|
2988
|
+
</xsl:for-each>
|
|
2989
|
+
</xsl:when>
|
|
2990
|
+
<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
|
|
2991
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
|
|
2992
|
+
<xsl:variable name="is_dt" select="position() = 1"/>
|
|
2993
|
+
|
|
2994
|
+
<xsl:for-each select="*">
|
|
2995
|
+
<!-- <test><xsl:copy-of select="."/></test> -->
|
|
2996
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
|
2997
|
+
<xsl:choose>
|
|
2998
|
+
<xsl:when test="$is_dt">
|
|
2999
|
+
<xsl:call-template name="insert_dt_cell"/>
|
|
3000
|
+
</xsl:when>
|
|
3001
|
+
<xsl:otherwise>
|
|
3002
|
+
<xsl:call-template name="insert_dd_cell"/>
|
|
3003
|
+
</xsl:otherwise>
|
|
3004
|
+
</xsl:choose>
|
|
3005
|
+
</fo:table-row>
|
|
3006
|
+
</xsl:for-each>
|
|
3007
|
+
</xsl:for-each>
|
|
3008
|
+
</xsl:otherwise>
|
|
3009
|
+
</xsl:choose>
|
|
3010
|
+
|
|
3011
|
+
</xsl:for-each>
|
|
3012
|
+
</fo:table-body>
|
|
3013
|
+
</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
|
3014
|
+
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
|
3015
|
+
|
|
3016
|
+
|
|
3017
|
+
|
|
3018
|
+
|
|
3019
|
+
|
|
3020
|
+
|
|
3021
|
+
|
|
3022
|
+
<xsl:call-template name="setTableRowAttributes"/>
|
|
3023
|
+
|
|
3024
|
+
<xsl:apply-templates/>
|
|
2553
3025
|
</fo:table-row>
|
|
2554
3026
|
</xsl:template><xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
|
|
2555
3027
|
<fo:table-row xsl:use-attribute-sets="table-footer-row-style">
|
|
@@ -2624,7 +3096,7 @@
|
|
|
2624
3096
|
</xsl:choose>
|
|
2625
3097
|
</xsl:attribute>
|
|
2626
3098
|
</xsl:if>
|
|
2627
|
-
</xsl:template><xsl:template match="*[local-name()='td']">
|
|
3099
|
+
</xsl:template><xsl:template match="*[local-name()='td']" name="td">
|
|
2628
3100
|
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
|
|
2629
3101
|
<xsl:call-template name="setTextAlignment">
|
|
2630
3102
|
<xsl:with-param name="default">left</xsl:with-param>
|
|
@@ -2658,11 +3130,24 @@
|
|
|
2658
3130
|
|
|
2659
3131
|
<xsl:call-template name="setTableCellAttributes"/>
|
|
2660
3132
|
|
|
3133
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
|
3134
|
+
<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
|
|
3135
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
|
3136
|
+
</xsl:if>
|
|
3137
|
+
|
|
2661
3138
|
<fo:block>
|
|
2662
3139
|
|
|
3140
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
|
3141
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
|
3142
|
+
</xsl:if>
|
|
3143
|
+
|
|
3144
|
+
|
|
2663
3145
|
|
|
2664
3146
|
|
|
2665
3147
|
<xsl:apply-templates/>
|
|
3148
|
+
|
|
3149
|
+
<xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
|
|
3150
|
+
|
|
2666
3151
|
</fo:block>
|
|
2667
3152
|
</fo:table-cell>
|
|
2668
3153
|
</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
|
|
@@ -2859,9 +3344,9 @@
|
|
|
2859
3344
|
<!-- current hierarchy is 'figure' element -->
|
|
2860
3345
|
<xsl:variable name="following_dl_colwidths">
|
|
2861
3346
|
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
|
2862
|
-
<xsl:variable name="
|
|
2863
|
-
<xsl:variable name="doc_ns">
|
|
2864
|
-
|
|
3347
|
+
<xsl:variable name="simple-table">
|
|
3348
|
+
<!-- <xsl:variable name="doc_ns">
|
|
3349
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
|
2865
3350
|
</xsl:variable>
|
|
2866
3351
|
<xsl:variable name="ns">
|
|
2867
3352
|
<xsl:choose>
|
|
@@ -2872,7 +3357,7 @@
|
|
|
2872
3357
|
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
|
2873
3358
|
</xsl:otherwise>
|
|
2874
3359
|
</xsl:choose>
|
|
2875
|
-
</xsl:variable>
|
|
3360
|
+
</xsl:variable> -->
|
|
2876
3361
|
|
|
2877
3362
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
|
2878
3363
|
<tbody>
|
|
@@ -2883,7 +3368,7 @@
|
|
|
2883
3368
|
|
|
2884
3369
|
<xsl:call-template name="calculate-column-widths">
|
|
2885
3370
|
<xsl:with-param name="cols-count" select="2"/>
|
|
2886
|
-
<xsl:with-param name="table" select="$
|
|
3371
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
|
2887
3372
|
</xsl:call-template>
|
|
2888
3373
|
|
|
2889
3374
|
</xsl:if>
|
|
@@ -3002,8 +3487,10 @@
|
|
|
3002
3487
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
|
3003
3488
|
</xsl:variable>
|
|
3004
3489
|
|
|
3490
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
|
3491
|
+
|
|
3005
3492
|
<xsl:choose>
|
|
3006
|
-
<xsl:when test="$
|
|
3493
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
|
3007
3494
|
|
|
3008
3495
|
<fo:block margin-bottom="12pt" text-align="left">
|
|
3009
3496
|
|
|
@@ -3018,7 +3505,7 @@
|
|
|
3018
3505
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
|
3019
3506
|
</fo:block>
|
|
3020
3507
|
|
|
3021
|
-
</xsl:when>
|
|
3508
|
+
</xsl:when> <!-- END: only one component -->
|
|
3022
3509
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
|
3023
3510
|
<fo:block margin-bottom="12pt" text-align="left">
|
|
3024
3511
|
|
|
@@ -3032,8 +3519,8 @@
|
|
|
3032
3519
|
</xsl:variable>
|
|
3033
3520
|
<xsl:value-of select="$title-where"/>
|
|
3034
3521
|
</fo:block>
|
|
3035
|
-
</xsl:when>
|
|
3036
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
|
3522
|
+
</xsl:when> <!-- END: a few components -->
|
|
3523
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
|
3037
3524
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
|
3038
3525
|
|
|
3039
3526
|
|
|
@@ -3046,22 +3533,41 @@
|
|
|
3046
3533
|
</xsl:variable>
|
|
3047
3534
|
<xsl:value-of select="$title-key"/>
|
|
3048
3535
|
</fo:block>
|
|
3049
|
-
</xsl:when>
|
|
3536
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
|
3050
3537
|
</xsl:choose>
|
|
3051
3538
|
|
|
3052
3539
|
<!-- a few components -->
|
|
3053
|
-
<xsl:if test="
|
|
3540
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
|
3054
3541
|
<fo:block>
|
|
3055
3542
|
|
|
3056
3543
|
|
|
3057
3544
|
|
|
3058
3545
|
|
|
3546
|
+
|
|
3547
|
+
<xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
|
|
3548
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
|
3549
|
+
</xsl:if>
|
|
3550
|
+
|
|
3059
3551
|
<fo:block>
|
|
3060
3552
|
|
|
3061
3553
|
|
|
3062
3554
|
|
|
3063
3555
|
|
|
3556
|
+
<xsl:apply-templates select="*[local-name() = 'name']">
|
|
3557
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
|
3558
|
+
</xsl:apply-templates>
|
|
3559
|
+
|
|
3560
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
|
3561
|
+
<!-- to determine start of table -->
|
|
3562
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
|
3563
|
+
</xsl:if>
|
|
3564
|
+
|
|
3064
3565
|
<fo:table width="95%" table-layout="fixed">
|
|
3566
|
+
|
|
3567
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
|
3568
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
|
3569
|
+
</xsl:if>
|
|
3570
|
+
|
|
3065
3571
|
|
|
3066
3572
|
<xsl:choose>
|
|
3067
3573
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
|
|
@@ -3070,61 +3576,178 @@
|
|
|
3070
3576
|
|
|
3071
3577
|
</xsl:when>
|
|
3072
3578
|
</xsl:choose>
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3579
|
+
|
|
3580
|
+
|
|
3581
|
+
|
|
3582
|
+
<xsl:choose>
|
|
3583
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
|
3584
|
+
<!-- generate IF for table widths -->
|
|
3585
|
+
<!-- example:
|
|
3586
|
+
<tr>
|
|
3587
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
|
3588
|
+
<p>Symbol</p>
|
|
3589
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
|
3590
|
+
</td>
|
|
3591
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
|
3592
|
+
<p>Description</p>
|
|
3593
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
|
3594
|
+
</td>
|
|
3595
|
+
</tr>
|
|
3596
|
+
-->
|
|
3076
3597
|
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
<xsl:
|
|
3081
|
-
<
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3598
|
+
<!-- create virtual html table for dl/[dt and dd] -->
|
|
3599
|
+
<xsl:variable name="simple-table">
|
|
3600
|
+
|
|
3601
|
+
<xsl:variable name="dl_table">
|
|
3602
|
+
<tbody>
|
|
3603
|
+
<xsl:apply-templates mode="dl_if">
|
|
3604
|
+
<xsl:with-param name="id" select="@id"/>
|
|
3605
|
+
</xsl:apply-templates>
|
|
3606
|
+
</tbody>
|
|
3607
|
+
</xsl:variable>
|
|
3608
|
+
|
|
3609
|
+
<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
|
|
3610
|
+
|
|
3611
|
+
<!-- Step: replace <br/> to <p>...</p> -->
|
|
3612
|
+
<xsl:variable name="table_without_br">
|
|
3613
|
+
<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
|
|
3614
|
+
</xsl:variable>
|
|
3615
|
+
|
|
3616
|
+
<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
|
|
3617
|
+
|
|
3618
|
+
<!-- Step: add id to each cell -->
|
|
3619
|
+
<!-- add <word>...</word> for each word, image, math -->
|
|
3620
|
+
<xsl:variable name="simple-table-id">
|
|
3621
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
|
|
3622
|
+
<xsl:with-param name="id" select="@id"/>
|
|
3623
|
+
</xsl:apply-templates>
|
|
3624
|
+
</xsl:variable>
|
|
3625
|
+
|
|
3626
|
+
<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
|
|
3627
|
+
|
|
3628
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
|
3629
|
+
|
|
3630
|
+
</xsl:variable>
|
|
3631
|
+
|
|
3632
|
+
<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
|
|
3633
|
+
|
|
3634
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
|
|
3635
|
+
<xsl:with-param name="table_or_dl">dl</xsl:with-param>
|
|
3636
|
+
</xsl:apply-templates>
|
|
3637
|
+
|
|
3638
|
+
</xsl:when>
|
|
3639
|
+
<xsl:otherwise>
|
|
3640
|
+
|
|
3641
|
+
<xsl:variable name="simple-table">
|
|
3642
|
+
|
|
3643
|
+
<xsl:variable name="dl_table">
|
|
3644
|
+
<tbody>
|
|
3645
|
+
<xsl:apply-templates mode="dl">
|
|
3646
|
+
<xsl:with-param name="id" select="@id"/>
|
|
3647
|
+
</xsl:apply-templates>
|
|
3648
|
+
</tbody>
|
|
3649
|
+
</xsl:variable>
|
|
3650
|
+
|
|
3651
|
+
<xsl:copy-of select="$dl_table"/>
|
|
3652
|
+
</xsl:variable>
|
|
3653
|
+
|
|
3654
|
+
<xsl:variable name="colwidths">
|
|
3655
|
+
<xsl:call-template name="calculate-column-widths">
|
|
3656
|
+
<xsl:with-param name="cols-count" select="2"/>
|
|
3657
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
|
3658
|
+
</xsl:call-template>
|
|
3659
|
+
</xsl:variable>
|
|
3660
|
+
|
|
3661
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
|
3662
|
+
DEBUG
|
|
3663
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
|
3664
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
|
3665
|
+
|
|
3666
|
+
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
|
3667
|
+
|
|
3668
|
+
<xsl:variable name="maxlength_dt">
|
|
3669
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
|
3670
|
+
</xsl:variable>
|
|
3671
|
+
|
|
3672
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
|
3673
|
+
false
|
|
3674
|
+
</xsl:variable>
|
|
3675
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
|
3676
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
|
3677
|
+
|
|
3678
|
+
|
|
3679
|
+
<xsl:call-template name="setColumnWidth_dl">
|
|
3680
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
|
3681
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
|
3682
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
|
3683
|
+
</xsl:call-template>
|
|
3684
|
+
|
|
3685
|
+
<fo:table-body>
|
|
3686
|
+
|
|
3687
|
+
<!-- DEBUG -->
|
|
3688
|
+
<xsl:if test="$table_if_debug = 'true'">
|
|
3689
|
+
<fo:table-row>
|
|
3690
|
+
<fo:table-cell number-columns-spanned="2" font-size="60%">
|
|
3691
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
|
3692
|
+
</fo:table-cell>
|
|
3693
|
+
</fo:table-row>
|
|
3694
|
+
</xsl:if>
|
|
3695
|
+
|
|
3696
|
+
<xsl:apply-templates>
|
|
3697
|
+
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
|
3698
|
+
<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
|
|
3699
|
+
</xsl:apply-templates>
|
|
3700
|
+
|
|
3701
|
+
</fo:table-body>
|
|
3702
|
+
</xsl:otherwise>
|
|
3703
|
+
</xsl:choose>
|
|
3112
3704
|
</fo:table>
|
|
3113
3705
|
</fo:block>
|
|
3114
3706
|
</fo:block>
|
|
3115
|
-
</xsl:if>
|
|
3707
|
+
</xsl:if> <!-- END: a few components -->
|
|
3116
3708
|
</fo:block-container>
|
|
3117
3709
|
</fo:block-container>
|
|
3710
|
+
|
|
3711
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
|
|
3712
|
+
<xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
|
|
3713
|
+
</xsl:if>
|
|
3714
|
+
|
|
3715
|
+
</xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
|
|
3716
|
+
<xsl:param name="process">false</xsl:param>
|
|
3717
|
+
<xsl:if test="$process = 'true'">
|
|
3718
|
+
<fo:block xsl:use-attribute-sets="dl-name-style">
|
|
3719
|
+
<xsl:apply-templates/>
|
|
3720
|
+
</fo:block>
|
|
3721
|
+
</xsl:if>
|
|
3118
3722
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
|
3119
3723
|
<xsl:param name="colwidths"/>
|
|
3120
3724
|
<xsl:param name="maxlength_dt"/>
|
|
3725
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
|
3726
|
+
|
|
3727
|
+
<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
|
|
3728
|
+
|
|
3121
3729
|
<xsl:choose>
|
|
3730
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
|
3731
|
+
<xsl:call-template name="insertTableColumnWidth">
|
|
3732
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
|
3733
|
+
</xsl:call-template>
|
|
3734
|
+
</xsl:when>
|
|
3122
3735
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
|
3123
3736
|
<fo:table-column column-width="50%"/>
|
|
3124
3737
|
<fo:table-column column-width="50%"/>
|
|
3125
3738
|
</xsl:when>
|
|
3126
3739
|
<xsl:otherwise>
|
|
3127
3740
|
<xsl:choose>
|
|
3741
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
|
3742
|
+
<xsl:call-template name="insertTableColumnWidth">
|
|
3743
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
|
3744
|
+
</xsl:call-template>
|
|
3745
|
+
</xsl:when>
|
|
3746
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
|
3747
|
+
<xsl:call-template name="insertTableColumnWidth">
|
|
3748
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
|
3749
|
+
</xsl:call-template>
|
|
3750
|
+
</xsl:when>
|
|
3128
3751
|
<!-- to set width check most wide chars like `W` -->
|
|
3129
3752
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
|
3130
3753
|
<fo:table-column column-width="7%"/>
|
|
@@ -3155,20 +3778,31 @@
|
|
|
3155
3778
|
<fo:table-column column-width="60%"/>
|
|
3156
3779
|
</xsl:when>
|
|
3157
3780
|
<xsl:otherwise>
|
|
3158
|
-
<xsl:
|
|
3159
|
-
<xsl:
|
|
3160
|
-
|
|
3161
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
|
3162
|
-
</xsl:when>
|
|
3163
|
-
<xsl:otherwise>
|
|
3164
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
|
3165
|
-
</xsl:otherwise>
|
|
3166
|
-
</xsl:choose>
|
|
3167
|
-
</xsl:for-each>
|
|
3781
|
+
<xsl:call-template name="insertTableColumnWidth">
|
|
3782
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
|
3783
|
+
</xsl:call-template>
|
|
3168
3784
|
</xsl:otherwise>
|
|
3169
3785
|
</xsl:choose>
|
|
3170
3786
|
</xsl:otherwise>
|
|
3171
3787
|
</xsl:choose>
|
|
3788
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
|
3789
|
+
<xsl:param name="colwidths"/>
|
|
3790
|
+
|
|
3791
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
|
3792
|
+
<xsl:choose>
|
|
3793
|
+
<xsl:when test=". = 1 or . = 0">
|
|
3794
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
|
3795
|
+
</xsl:when>
|
|
3796
|
+
<xsl:otherwise>
|
|
3797
|
+
<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
|
|
3798
|
+
<xsl:variable name="divider">
|
|
3799
|
+
<xsl:value-of select="@divider"/>
|
|
3800
|
+
<xsl:if test="not(@divider)">1</xsl:if>
|
|
3801
|
+
</xsl:variable>
|
|
3802
|
+
<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
|
|
3803
|
+
</xsl:otherwise>
|
|
3804
|
+
</xsl:choose>
|
|
3805
|
+
</xsl:for-each>
|
|
3172
3806
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
|
3173
3807
|
<xsl:variable name="lengths">
|
|
3174
3808
|
<xsl:for-each select="*[local-name()='dt']">
|
|
@@ -3192,7 +3826,6 @@
|
|
|
3192
3826
|
<xsl:value-of select="$maxLength"/>
|
|
3193
3827
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
|
3194
3828
|
<xsl:param name="key_iso"/>
|
|
3195
|
-
|
|
3196
3829
|
<!-- <tr>
|
|
3197
3830
|
<td>NOTE</td>
|
|
3198
3831
|
<td>
|
|
@@ -3200,27 +3833,47 @@
|
|
|
3200
3833
|
</td>
|
|
3201
3834
|
</tr>
|
|
3202
3835
|
-->
|
|
3203
|
-
|
|
3836
|
+
<!-- OLD Variant -->
|
|
3837
|
+
<!-- <fo:table-row>
|
|
3204
3838
|
<fo:table-cell>
|
|
3205
3839
|
<fo:block margin-top="6pt">
|
|
3206
3840
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
|
3207
3841
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
|
3208
3842
|
</xsl:if>
|
|
3209
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
|
3843
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
|
3210
3844
|
</fo:block>
|
|
3211
3845
|
</fo:table-cell>
|
|
3212
3846
|
<fo:table-cell>
|
|
3213
3847
|
<fo:block>
|
|
3214
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
|
3848
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
|
3849
|
+
</fo:block>
|
|
3850
|
+
</fo:table-cell>
|
|
3851
|
+
</fo:table-row> -->
|
|
3852
|
+
<!-- <tr>
|
|
3853
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
|
3854
|
+
</tr>
|
|
3855
|
+
-->
|
|
3856
|
+
<fo:table-row>
|
|
3857
|
+
<fo:table-cell number-columns-spanned="2">
|
|
3858
|
+
<fo:block>
|
|
3859
|
+
<xsl:call-template name="note"/>
|
|
3215
3860
|
</fo:block>
|
|
3216
3861
|
</fo:table-cell>
|
|
3217
3862
|
</fo:table-row>
|
|
3218
3863
|
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
|
|
3864
|
+
<xsl:param name="id"/>
|
|
3865
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
|
3219
3866
|
<tr>
|
|
3220
3867
|
<td>
|
|
3868
|
+
<xsl:attribute name="id">
|
|
3869
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
|
|
3870
|
+
</xsl:attribute>
|
|
3221
3871
|
<xsl:apply-templates/>
|
|
3222
3872
|
</td>
|
|
3223
3873
|
<td>
|
|
3874
|
+
<xsl:attribute name="id">
|
|
3875
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
|
|
3876
|
+
</xsl:attribute>
|
|
3224
3877
|
|
|
3225
3878
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
|
3226
3879
|
<xsl:with-param name="process">true</xsl:with-param>
|
|
@@ -3231,50 +3884,134 @@
|
|
|
3231
3884
|
|
|
3232
3885
|
</xsl:template><xsl:template match="*[local-name()='dt']">
|
|
3233
3886
|
<xsl:param name="key_iso"/>
|
|
3887
|
+
<xsl:param name="split_keep-within-line"/>
|
|
3234
3888
|
|
|
3235
3889
|
<fo:table-row xsl:use-attribute-sets="dt-row-style">
|
|
3236
|
-
<
|
|
3890
|
+
<xsl:call-template name="insert_dt_cell">
|
|
3891
|
+
<xsl:with-param name="key_iso" select="$key_iso"/>
|
|
3892
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
|
3893
|
+
</xsl:call-template>
|
|
3894
|
+
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
|
|
3895
|
+
<xsl:call-template name="insert_dd_cell">
|
|
3896
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
|
3897
|
+
</xsl:call-template>
|
|
3898
|
+
</xsl:for-each>
|
|
3899
|
+
</fo:table-row>
|
|
3900
|
+
</xsl:template><xsl:template name="insert_dt_cell">
|
|
3901
|
+
<xsl:param name="key_iso"/>
|
|
3902
|
+
<xsl:param name="split_keep-within-line"/>
|
|
3903
|
+
<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
|
|
3904
|
+
|
|
3905
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
|
3906
|
+
<!-- border is mandatory, to calculate real width -->
|
|
3907
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
|
3908
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
|
3909
|
+
</xsl:if>
|
|
3910
|
+
|
|
3911
|
+
|
|
3912
|
+
<fo:block xsl:use-attribute-sets="dt-block-style">
|
|
3913
|
+
<xsl:copy-of select="@id"/>
|
|
3914
|
+
|
|
3915
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
|
3916
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
|
3917
|
+
</xsl:if>
|
|
3918
|
+
|
|
3919
|
+
|
|
3920
|
+
|
|
3921
|
+
<xsl:apply-templates>
|
|
3922
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
|
3923
|
+
</xsl:apply-templates>
|
|
3924
|
+
|
|
3925
|
+
<xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
|
|
3926
|
+
|
|
3927
|
+
</fo:block>
|
|
3928
|
+
</fo:table-cell>
|
|
3929
|
+
</xsl:template><xsl:template name="insert_dd_cell">
|
|
3930
|
+
<xsl:param name="split_keep-within-line"/>
|
|
3931
|
+
<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
|
|
3932
|
+
|
|
3933
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
|
3934
|
+
<!-- border is mandatory, to calculate real width -->
|
|
3935
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
|
3936
|
+
</xsl:if>
|
|
3937
|
+
|
|
3938
|
+
<fo:block>
|
|
3939
|
+
|
|
3940
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
|
3941
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
|
3942
|
+
</xsl:if>
|
|
3943
|
+
|
|
3237
3944
|
|
|
3238
|
-
<fo:block xsl:use-attribute-sets="dt-style">
|
|
3239
|
-
<xsl:copy-of select="@id"/>
|
|
3240
|
-
|
|
3241
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
|
3242
|
-
<xsl:attribute name="margin-top">0</xsl:attribute>
|
|
3243
|
-
</xsl:if>
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
<xsl:apply-templates/>
|
|
3248
|
-
</fo:block>
|
|
3249
|
-
</fo:table-cell>
|
|
3250
|
-
<fo:table-cell>
|
|
3251
|
-
<fo:block>
|
|
3252
|
-
|
|
3253
3945
|
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3946
|
+
<xsl:choose>
|
|
3947
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
|
3948
|
+
<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
|
|
3949
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
|
3950
|
+
</xsl:apply-templates>
|
|
3951
|
+
</xsl:when>
|
|
3952
|
+
<xsl:otherwise>
|
|
3953
|
+
<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
|
|
3954
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
|
3955
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
|
3956
|
+
</xsl:apply-templates>
|
|
3957
|
+
</xsl:otherwise>
|
|
3958
|
+
|
|
3959
|
+
</xsl:choose>
|
|
3960
|
+
|
|
3961
|
+
<xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
|
|
3962
|
+
|
|
3963
|
+
</fo:block>
|
|
3964
|
+
</fo:table-cell>
|
|
3260
3965
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
|
3261
3966
|
<xsl:apply-templates/>
|
|
3262
3967
|
</xsl:template><xsl:template match="*[local-name()='dd']">
|
|
3263
3968
|
<xsl:param name="process">false</xsl:param>
|
|
3969
|
+
<xsl:param name="split_keep-within-line"/>
|
|
3264
3970
|
<xsl:if test="$process = 'true'">
|
|
3265
3971
|
<xsl:apply-templates select="@language"/>
|
|
3266
|
-
<xsl:apply-templates
|
|
3972
|
+
<xsl:apply-templates>
|
|
3973
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
|
3974
|
+
</xsl:apply-templates>
|
|
3267
3975
|
</xsl:if>
|
|
3268
3976
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
|
3269
3977
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
|
3270
|
-
</xsl:template><xsl:template match="*[local-name()='
|
|
3978
|
+
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
|
|
3979
|
+
<xsl:param name="id"/>
|
|
3980
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
|
3981
|
+
<tr>
|
|
3982
|
+
<td>
|
|
3983
|
+
<xsl:copy-of select="node()"/>
|
|
3984
|
+
</td>
|
|
3985
|
+
<td>
|
|
3986
|
+
|
|
3987
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
|
|
3988
|
+
|
|
3989
|
+
<!-- get paragraphs from nested 'dl' -->
|
|
3990
|
+
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
|
|
3991
|
+
|
|
3992
|
+
|
|
3993
|
+
</td>
|
|
3994
|
+
</tr>
|
|
3995
|
+
|
|
3996
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
|
|
3997
|
+
<xsl:for-each select="*[local-name() = 'dt']">
|
|
3998
|
+
<p>
|
|
3999
|
+
<xsl:copy-of select="node()"/>
|
|
4000
|
+
<xsl:text> </xsl:text>
|
|
4001
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
|
|
4002
|
+
</p>
|
|
4003
|
+
</xsl:for-each>
|
|
4004
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
|
|
3271
4005
|
<fo:inline font-style="italic">
|
|
3272
4006
|
<xsl:apply-templates/>
|
|
3273
4007
|
</fo:inline>
|
|
3274
4008
|
</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
|
|
4009
|
+
<xsl:param name="split_keep-within-line"/>
|
|
3275
4010
|
<fo:inline font-weight="bold">
|
|
3276
4011
|
|
|
3277
|
-
<xsl:apply-templates
|
|
4012
|
+
<xsl:apply-templates>
|
|
4013
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
|
4014
|
+
</xsl:apply-templates>
|
|
3278
4015
|
</fo:inline>
|
|
3279
4016
|
</xsl:template><xsl:template match="*[local-name()='padding']">
|
|
3280
4017
|
<fo:inline padding-right="{@value}"> </fo:inline>
|
|
@@ -3295,7 +4032,7 @@
|
|
|
3295
4032
|
|
|
3296
4033
|
|
|
3297
4034
|
|
|
3298
|
-
|
|
4035
|
+
<!-- 10 -->
|
|
3299
4036
|
|
|
3300
4037
|
|
|
3301
4038
|
|
|
@@ -3313,13 +4050,15 @@
|
|
|
3313
4050
|
<xsl:choose>
|
|
3314
4051
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
|
3315
4052
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
|
3316
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
|
4053
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
|
3317
4054
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
|
3318
4055
|
</xsl:choose>
|
|
3319
4056
|
</xsl:attribute>
|
|
3320
4057
|
</xsl:if>
|
|
3321
4058
|
<xsl:apply-templates/>
|
|
3322
4059
|
</fo:inline>
|
|
4060
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
|
4061
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
|
3323
4062
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
|
3324
4063
|
<fo:inline text-decoration="underline">
|
|
3325
4064
|
<xsl:apply-templates/>
|
|
@@ -3467,54 +4206,120 @@
|
|
|
3467
4206
|
<fo:block break-after="page"/>
|
|
3468
4207
|
<fo:block> </fo:block>
|
|
3469
4208
|
<fo:block break-after="page"/>
|
|
4209
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
|
4210
|
+
<xsl:apply-templates/>
|
|
3470
4211
|
</xsl:template><xsl:template name="tokenize">
|
|
3471
4212
|
<xsl:param name="text"/>
|
|
3472
4213
|
<xsl:param name="separator" select="' '"/>
|
|
3473
4214
|
<xsl:choose>
|
|
4215
|
+
|
|
4216
|
+
<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
|
|
4217
|
+
<word><xsl:value-of select="normalize-space($text)"/></word>
|
|
4218
|
+
</xsl:when>
|
|
3474
4219
|
<xsl:when test="not(contains($text, $separator))">
|
|
3475
4220
|
<word>
|
|
3476
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
|
3477
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
|
3478
4221
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
|
3479
|
-
<xsl:variable name="len_str">
|
|
3480
|
-
<xsl:choose>
|
|
3481
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
|
3482
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
|
3483
|
-
</xsl:when>
|
|
3484
|
-
<xsl:otherwise>
|
|
3485
|
-
<xsl:value-of select="$len_str_tmp"/>
|
|
3486
|
-
</xsl:otherwise>
|
|
3487
|
-
</xsl:choose>
|
|
3488
|
-
</xsl:variable>
|
|
3489
|
-
|
|
3490
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
|
3491
|
-
<xsl:message>
|
|
3492
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
|
3493
|
-
len_str=<xsl:value-of select="$len_str"/>
|
|
3494
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
|
3495
|
-
</xsl:message>
|
|
3496
|
-
</xsl:if> -->
|
|
3497
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
|
3498
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
|
3499
4222
|
<xsl:choose>
|
|
3500
|
-
<xsl:when test="$
|
|
3501
|
-
<xsl:value-of select="$
|
|
4223
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
|
4224
|
+
<xsl:value-of select="$len_str_tmp"/>
|
|
3502
4225
|
</xsl:when>
|
|
3503
4226
|
<xsl:otherwise>
|
|
3504
|
-
<xsl:
|
|
4227
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
|
4228
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
|
4229
|
+
<xsl:variable name="len_str">
|
|
4230
|
+
<xsl:choose>
|
|
4231
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
|
4232
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
|
4233
|
+
</xsl:when>
|
|
4234
|
+
<xsl:otherwise>
|
|
4235
|
+
<xsl:value-of select="$len_str_tmp"/>
|
|
4236
|
+
</xsl:otherwise>
|
|
4237
|
+
</xsl:choose>
|
|
4238
|
+
</xsl:variable>
|
|
4239
|
+
|
|
4240
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
|
4241
|
+
<xsl:message>
|
|
4242
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
|
4243
|
+
len_str=<xsl:value-of select="$len_str"/>
|
|
4244
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
|
4245
|
+
</xsl:message>
|
|
4246
|
+
</xsl:if> -->
|
|
4247
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
|
4248
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
|
4249
|
+
<xsl:choose>
|
|
4250
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
|
4251
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
|
4252
|
+
</xsl:when>
|
|
4253
|
+
<xsl:otherwise>
|
|
4254
|
+
<xsl:value-of select="$len_str"/>
|
|
4255
|
+
</xsl:otherwise>
|
|
4256
|
+
</xsl:choose>
|
|
3505
4257
|
</xsl:otherwise>
|
|
3506
4258
|
</xsl:choose>
|
|
3507
4259
|
</word>
|
|
3508
4260
|
</xsl:when>
|
|
3509
4261
|
<xsl:otherwise>
|
|
3510
4262
|
<word>
|
|
3511
|
-
<xsl:
|
|
4263
|
+
<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
|
|
4264
|
+
<xsl:choose>
|
|
4265
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
|
4266
|
+
<xsl:value-of select="$word"/>
|
|
4267
|
+
</xsl:when>
|
|
4268
|
+
<xsl:otherwise>
|
|
4269
|
+
<xsl:value-of select="string-length($word)"/>
|
|
4270
|
+
</xsl:otherwise>
|
|
4271
|
+
</xsl:choose>
|
|
3512
4272
|
</word>
|
|
3513
4273
|
<xsl:call-template name="tokenize">
|
|
3514
4274
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
|
3515
4275
|
</xsl:call-template>
|
|
3516
4276
|
</xsl:otherwise>
|
|
3517
4277
|
</xsl:choose>
|
|
4278
|
+
</xsl:template><xsl:template name="tokenize_with_tags">
|
|
4279
|
+
<xsl:param name="tags"/>
|
|
4280
|
+
<xsl:param name="text"/>
|
|
4281
|
+
<xsl:param name="separator" select="' '"/>
|
|
4282
|
+
<xsl:choose>
|
|
4283
|
+
|
|
4284
|
+
<xsl:when test="not(contains($text, $separator))">
|
|
4285
|
+
<word>
|
|
4286
|
+
<xsl:call-template name="enclose_text_in_tags">
|
|
4287
|
+
<xsl:with-param name="text" select="normalize-space($text)"/>
|
|
4288
|
+
<xsl:with-param name="tags" select="$tags"/>
|
|
4289
|
+
</xsl:call-template>
|
|
4290
|
+
</word>
|
|
4291
|
+
</xsl:when>
|
|
4292
|
+
<xsl:otherwise>
|
|
4293
|
+
<word>
|
|
4294
|
+
<xsl:call-template name="enclose_text_in_tags">
|
|
4295
|
+
<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
|
|
4296
|
+
<xsl:with-param name="tags" select="$tags"/>
|
|
4297
|
+
</xsl:call-template>
|
|
4298
|
+
</word>
|
|
4299
|
+
<xsl:call-template name="tokenize_with_tags">
|
|
4300
|
+
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
|
4301
|
+
</xsl:call-template>
|
|
4302
|
+
</xsl:otherwise>
|
|
4303
|
+
</xsl:choose>
|
|
4304
|
+
</xsl:template><xsl:template name="enclose_text_in_tags">
|
|
4305
|
+
<xsl:param name="text"/>
|
|
4306
|
+
<xsl:param name="tags"/>
|
|
4307
|
+
<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
|
|
4308
|
+
|
|
4309
|
+
<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
|
|
4310
|
+
|
|
4311
|
+
<xsl:choose>
|
|
4312
|
+
<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
|
|
4313
|
+
<xsl:otherwise>
|
|
4314
|
+
<xsl:element name="{$tag_name}">
|
|
4315
|
+
<xsl:call-template name="enclose_text_in_tags">
|
|
4316
|
+
<xsl:with-param name="text" select="$text"/>
|
|
4317
|
+
<xsl:with-param name="tags" select="$tags"/>
|
|
4318
|
+
<xsl:with-param name="num" select="$num + 1"/>
|
|
4319
|
+
</xsl:call-template>
|
|
4320
|
+
</xsl:element>
|
|
4321
|
+
</xsl:otherwise>
|
|
4322
|
+
</xsl:choose>
|
|
3518
4323
|
</xsl:template><xsl:template name="max_length">
|
|
3519
4324
|
<xsl:param name="words"/>
|
|
3520
4325
|
<xsl:for-each select="$words//word">
|
|
@@ -3615,12 +4420,19 @@
|
|
|
3615
4420
|
</xsl:otherwise>
|
|
3616
4421
|
</xsl:choose>
|
|
3617
4422
|
</xsl:template><xsl:template name="getSimpleTable">
|
|
4423
|
+
<xsl:param name="id"/>
|
|
4424
|
+
|
|
3618
4425
|
<xsl:variable name="simple-table">
|
|
3619
4426
|
|
|
4427
|
+
<!-- Step 0. replace <br/> to <p>...</p> -->
|
|
4428
|
+
<xsl:variable name="table_without_br">
|
|
4429
|
+
<xsl:apply-templates mode="table-without-br"/>
|
|
4430
|
+
</xsl:variable>
|
|
4431
|
+
|
|
3620
4432
|
<!-- Step 1. colspan processing -->
|
|
3621
4433
|
<xsl:variable name="simple-table-colspan">
|
|
3622
4434
|
<tbody>
|
|
3623
|
-
<xsl:apply-templates mode="simple-table-colspan"/>
|
|
4435
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
|
|
3624
4436
|
</tbody>
|
|
3625
4437
|
</xsl:variable>
|
|
3626
4438
|
|
|
@@ -3629,10 +4441,67 @@
|
|
|
3629
4441
|
<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
|
|
3630
4442
|
</xsl:variable>
|
|
3631
4443
|
|
|
3632
|
-
|
|
3633
|
-
|
|
4444
|
+
<!-- Step 3: add id to each cell -->
|
|
4445
|
+
<!-- add <word>...</word> for each word, image, math -->
|
|
4446
|
+
<xsl:variable name="simple-table-id">
|
|
4447
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
|
|
4448
|
+
<xsl:with-param name="id" select="$id"/>
|
|
4449
|
+
</xsl:apply-templates>
|
|
4450
|
+
</xsl:variable>
|
|
4451
|
+
|
|
4452
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
|
4453
|
+
|
|
3634
4454
|
</xsl:variable>
|
|
3635
4455
|
<xsl:copy-of select="$simple-table"/>
|
|
4456
|
+
</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
|
|
4457
|
+
<xsl:copy>
|
|
4458
|
+
<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
|
|
4459
|
+
</xsl:copy>
|
|
4460
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
|
|
4461
|
+
<xsl:copy>
|
|
4462
|
+
<xsl:copy-of select="@*"/>
|
|
4463
|
+
<p>
|
|
4464
|
+
<xsl:copy-of select="node()"/>
|
|
4465
|
+
</p>
|
|
4466
|
+
</xsl:copy>
|
|
4467
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
|
|
4468
|
+
<xsl:copy>
|
|
4469
|
+
<xsl:copy-of select="@*"/>
|
|
4470
|
+
<xsl:for-each select="*[local-name()='br']">
|
|
4471
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
|
4472
|
+
<p>
|
|
4473
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
|
4474
|
+
<xsl:copy-of select="."/>
|
|
4475
|
+
</xsl:for-each>
|
|
4476
|
+
</p>
|
|
4477
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
|
4478
|
+
<p>
|
|
4479
|
+
<xsl:for-each select="following-sibling::node()">
|
|
4480
|
+
<xsl:copy-of select="."/>
|
|
4481
|
+
</xsl:for-each>
|
|
4482
|
+
</p>
|
|
4483
|
+
</xsl:if>
|
|
4484
|
+
</xsl:for-each>
|
|
4485
|
+
</xsl:copy>
|
|
4486
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
|
|
4487
|
+
<xsl:for-each select="*[local-name()='br']">
|
|
4488
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
|
4489
|
+
<p>
|
|
4490
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
|
4491
|
+
<xsl:copy-of select="."/>
|
|
4492
|
+
</xsl:for-each>
|
|
4493
|
+
</p>
|
|
4494
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
|
4495
|
+
<p>
|
|
4496
|
+
<xsl:for-each select="following-sibling::node()">
|
|
4497
|
+
<xsl:copy-of select="."/>
|
|
4498
|
+
</xsl:for-each>
|
|
4499
|
+
</p>
|
|
4500
|
+
</xsl:if>
|
|
4501
|
+
</xsl:for-each>
|
|
4502
|
+
</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
|
4503
|
+
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
|
4504
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
|
3636
4505
|
</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
|
|
3637
4506
|
<xsl:apply-templates mode="simple-table-colspan"/>
|
|
3638
4507
|
</xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
|
|
@@ -3710,18 +4579,138 @@
|
|
|
3710
4579
|
</xsl:choose>
|
|
3711
4580
|
</xsl:for-each>
|
|
3712
4581
|
</xsl:variable>
|
|
3713
|
-
|
|
3714
|
-
<xsl:variable name="newRow">
|
|
3715
|
-
<xsl:copy>
|
|
3716
|
-
<xsl:copy-of select="$currentRow/@*"/>
|
|
3717
|
-
<xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
|
|
3718
|
-
</xsl:copy>
|
|
4582
|
+
|
|
4583
|
+
<xsl:variable name="newRow">
|
|
4584
|
+
<xsl:copy>
|
|
4585
|
+
<xsl:copy-of select="$currentRow/@*"/>
|
|
4586
|
+
<xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
|
|
4587
|
+
</xsl:copy>
|
|
4588
|
+
</xsl:variable>
|
|
4589
|
+
<xsl:copy-of select="$newRow"/>
|
|
4590
|
+
|
|
4591
|
+
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
|
4592
|
+
<xsl:with-param name="previousRow" select="$newRow"/>
|
|
4593
|
+
</xsl:apply-templates>
|
|
4594
|
+
</xsl:template><xsl:template match="/" mode="simple-table-id">
|
|
4595
|
+
<xsl:param name="id"/>
|
|
4596
|
+
<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
|
|
4597
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
|
4598
|
+
<xsl:with-param name="id" select="$id_prefixed"/>
|
|
4599
|
+
</xsl:apply-templates>
|
|
4600
|
+
</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
|
|
4601
|
+
<xsl:param name="id"/>
|
|
4602
|
+
<xsl:copy>
|
|
4603
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
|
4604
|
+
<xsl:with-param name="id" select="$id"/>
|
|
4605
|
+
</xsl:apply-templates>
|
|
4606
|
+
</xsl:copy>
|
|
4607
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
|
|
4608
|
+
<xsl:param name="id"/>
|
|
4609
|
+
<xsl:copy>
|
|
4610
|
+
<xsl:copy-of select="@*"/>
|
|
4611
|
+
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
|
|
4612
|
+
<xsl:apply-templates select="node()" mode="simple-table-id">
|
|
4613
|
+
<xsl:with-param name="id" select="$id"/>
|
|
4614
|
+
</xsl:apply-templates>
|
|
4615
|
+
</xsl:copy>
|
|
4616
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
|
|
4617
|
+
<xsl:param name="id"/>
|
|
4618
|
+
<xsl:copy>
|
|
4619
|
+
<xsl:copy-of select="@*"/>
|
|
4620
|
+
<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
|
|
4621
|
+
<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
|
|
4622
|
+
<xsl:attribute name="id">
|
|
4623
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
|
|
4624
|
+
</xsl:attribute>
|
|
4625
|
+
|
|
4626
|
+
<xsl:for-each select="*[local-name() = 'p']">
|
|
4627
|
+
<xsl:copy>
|
|
4628
|
+
<xsl:copy-of select="@*"/>
|
|
4629
|
+
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
|
4630
|
+
<xsl:attribute name="id">
|
|
4631
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
|
|
4632
|
+
</xsl:attribute>
|
|
4633
|
+
|
|
4634
|
+
<xsl:copy-of select="node()"/>
|
|
4635
|
+
</xsl:copy>
|
|
4636
|
+
</xsl:for-each>
|
|
4637
|
+
|
|
4638
|
+
|
|
4639
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
|
|
4640
|
+
|
|
4641
|
+
<xsl:variable name="td_text">
|
|
4642
|
+
<xsl:apply-templates select="." mode="td_text_with_formatting"/>
|
|
4643
|
+
</xsl:variable>
|
|
4644
|
+
|
|
4645
|
+
<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
|
|
4646
|
+
|
|
4647
|
+
<xsl:variable name="words">
|
|
4648
|
+
<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
|
|
4649
|
+
<word>
|
|
4650
|
+
<xsl:copy-of select="."/>
|
|
4651
|
+
</word>
|
|
4652
|
+
</xsl:for-each>
|
|
4653
|
+
|
|
4654
|
+
<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
|
|
4655
|
+
<xsl:copy-of select="."/>
|
|
4656
|
+
</xsl:for-each>
|
|
4657
|
+
|
|
4658
|
+
</xsl:variable>
|
|
4659
|
+
|
|
4660
|
+
<xsl:for-each select="xalan:nodeset($words)/word">
|
|
4661
|
+
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
|
4662
|
+
<xsl:copy>
|
|
4663
|
+
<xsl:attribute name="id">
|
|
4664
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
|
|
4665
|
+
</xsl:attribute>
|
|
4666
|
+
<xsl:copy-of select="node()"/>
|
|
4667
|
+
</xsl:copy>
|
|
4668
|
+
</xsl:for-each>
|
|
4669
|
+
</xsl:if>
|
|
4670
|
+
</xsl:copy>
|
|
4671
|
+
|
|
4672
|
+
</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
|
|
4673
|
+
<xsl:copy>
|
|
4674
|
+
<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
|
|
4675
|
+
</xsl:copy>
|
|
4676
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem' or local-name() = 'image']" mode="td_text_with_formatting"/><xsl:template match="*[local-name() = 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
|
4677
|
+
<xsl:variable name="formatting_tags">
|
|
4678
|
+
<xsl:call-template name="getFormattingTags"/>
|
|
4679
|
+
</xsl:variable>
|
|
4680
|
+
<word>
|
|
4681
|
+
<xsl:call-template name="enclose_text_in_tags">
|
|
4682
|
+
<xsl:with-param name="text" select="normalize-space(.)"/>
|
|
4683
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
|
4684
|
+
</xsl:call-template>
|
|
4685
|
+
</word>
|
|
4686
|
+
</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
|
4687
|
+
|
|
4688
|
+
<xsl:variable name="td_text" select="."/>
|
|
4689
|
+
|
|
4690
|
+
<xsl:variable name="string_with_added_zerospaces">
|
|
4691
|
+
<xsl:call-template name="add-zero-spaces-java">
|
|
4692
|
+
<xsl:with-param name="text" select="$td_text"/>
|
|
4693
|
+
</xsl:call-template>
|
|
3719
4694
|
</xsl:variable>
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
4695
|
+
|
|
4696
|
+
<xsl:variable name="formatting_tags">
|
|
4697
|
+
<xsl:call-template name="getFormattingTags"/>
|
|
4698
|
+
</xsl:variable>
|
|
4699
|
+
|
|
4700
|
+
<!-- <word>text</word> -->
|
|
4701
|
+
<xsl:call-template name="tokenize_with_tags">
|
|
4702
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
|
4703
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
|
4704
|
+
</xsl:call-template>
|
|
4705
|
+
</xsl:template><xsl:template name="getFormattingTags">
|
|
4706
|
+
<tags>
|
|
4707
|
+
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
|
4708
|
+
<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
|
|
4709
|
+
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
|
4710
|
+
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
|
4711
|
+
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
|
4712
|
+
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
|
4713
|
+
</tags>
|
|
3725
4714
|
</xsl:template><xsl:template name="getLang">
|
|
3726
4715
|
<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
|
|
3727
4716
|
<xsl:variable name="language">
|
|
@@ -3776,6 +4765,9 @@
|
|
|
3776
4765
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
|
3777
4766
|
|
|
3778
4767
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
|
4768
|
+
|
|
4769
|
+
|
|
4770
|
+
|
|
3779
4771
|
|
|
3780
4772
|
|
|
3781
4773
|
<xsl:call-template name="setTrackChangesStyles">
|
|
@@ -3783,48 +4775,80 @@
|
|
|
3783
4775
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
|
3784
4776
|
</xsl:call-template>
|
|
3785
4777
|
|
|
4778
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
|
4779
|
+
<!-- insert helper tag -->
|
|
4780
|
+
<!-- set unique font-size (fiction) -->
|
|
4781
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
|
4782
|
+
<fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
|
|
4783
|
+
</xsl:if>
|
|
3786
4784
|
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
|
4785
|
+
<xsl:variable name="mathml_content">
|
|
4786
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
|
3790
4787
|
</xsl:variable>
|
|
3791
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
|
3792
4788
|
|
|
4789
|
+
|
|
4790
|
+
<xsl:call-template name="mathml_instream_object">
|
|
4791
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
|
4792
|
+
</xsl:call-template>
|
|
3793
4793
|
|
|
3794
|
-
|
|
3795
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
|
3796
|
-
<xsl:variable name="comment_text_">
|
|
3797
|
-
<xsl:choose>
|
|
3798
|
-
<xsl:when test="normalize-space($comment_text_following) != ''">
|
|
3799
|
-
<xsl:value-of select="$comment_text_following"/>
|
|
3800
|
-
</xsl:when>
|
|
3801
|
-
<xsl:otherwise>
|
|
3802
|
-
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
|
3803
|
-
</xsl:otherwise>
|
|
3804
|
-
</xsl:choose>
|
|
3805
|
-
</xsl:variable>
|
|
3806
|
-
<xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
|
3807
|
-
|
|
3808
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
|
3809
|
-
<!-- put Mathin Alternate Text -->
|
|
3810
|
-
<xsl:attribute name="fox:alt-text">
|
|
3811
|
-
<xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
|
|
3812
|
-
</xsl:attribute>
|
|
3813
|
-
</xsl:if>
|
|
3814
|
-
|
|
3815
|
-
<xsl:variable name="mathml_content">
|
|
3816
|
-
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
|
3817
|
-
</xsl:variable>
|
|
3818
|
-
<!-- put MathML in Actual Text -->
|
|
3819
|
-
<xsl:attribute name="fox:actual-text">
|
|
3820
|
-
<xsl:value-of select="$mathml_content"/>
|
|
3821
|
-
</xsl:attribute>
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
|
3826
|
-
</fo:instream-foreign-object>
|
|
4794
|
+
|
|
3827
4795
|
</fo:inline>
|
|
4796
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
|
4797
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
|
4798
|
+
<xsl:variable name="comment_text_">
|
|
4799
|
+
<xsl:choose>
|
|
4800
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
|
4801
|
+
<xsl:value-of select="$comment_text_following"/>
|
|
4802
|
+
</xsl:when>
|
|
4803
|
+
<xsl:otherwise>
|
|
4804
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
|
4805
|
+
</xsl:otherwise>
|
|
4806
|
+
</xsl:choose>
|
|
4807
|
+
</xsl:variable>
|
|
4808
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
|
4809
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
|
4810
|
+
<xsl:value-of select="$comment_text"/>
|
|
4811
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
|
4812
|
+
<xsl:param name="comment_text"/>
|
|
4813
|
+
<xsl:param name="mathml_content"/>
|
|
4814
|
+
|
|
4815
|
+
<xsl:variable name="comment_text_">
|
|
4816
|
+
<xsl:choose>
|
|
4817
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
|
4818
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
|
4819
|
+
</xsl:choose>
|
|
4820
|
+
</xsl:variable>
|
|
4821
|
+
|
|
4822
|
+
<xsl:variable name="mathml">
|
|
4823
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
|
4824
|
+
</xsl:variable>
|
|
4825
|
+
|
|
4826
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
|
4827
|
+
|
|
4828
|
+
|
|
4829
|
+
|
|
4830
|
+
|
|
4831
|
+
|
|
4832
|
+
|
|
4833
|
+
|
|
4834
|
+
<!-- put MathML in Actual Text -->
|
|
4835
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
|
4836
|
+
<xsl:attribute name="fox:actual-text">
|
|
4837
|
+
<xsl:value-of select="$mathml_content"/>
|
|
4838
|
+
</xsl:attribute>
|
|
4839
|
+
|
|
4840
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
|
4841
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
|
4842
|
+
<!-- put Mathin Alternate Text -->
|
|
4843
|
+
<xsl:attribute name="fox:alt-text">
|
|
4844
|
+
<xsl:value-of select="$comment_text_"/>
|
|
4845
|
+
</xsl:attribute>
|
|
4846
|
+
</xsl:if>
|
|
4847
|
+
<!-- </xsl:if> -->
|
|
4848
|
+
|
|
4849
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
|
4850
|
+
|
|
4851
|
+
</fo:instream-foreign-object>
|
|
3828
4852
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
|
3829
4853
|
<!-- <xsl:text>a+b</xsl:text> -->
|
|
3830
4854
|
<xsl:text><</xsl:text>
|
|
@@ -3855,7 +4879,9 @@
|
|
|
3855
4879
|
<!-- replace start and end spaces to non-break space -->
|
|
3856
4880
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
|
3857
4881
|
</xsl:copy>
|
|
3858
|
-
</xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="
|
|
4882
|
+
</xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="mathml:mtd/mathml:mo/text()[. = '/']" mode="mathml">
|
|
4883
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
|
4884
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
|
3859
4885
|
<xsl:variable name="target">
|
|
3860
4886
|
<xsl:choose>
|
|
3861
4887
|
<xsl:when test="@updatetype = 'true'">
|
|
@@ -4446,18 +5472,33 @@
|
|
|
4446
5472
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
|
4447
5473
|
<xsl:copy>
|
|
4448
5474
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
|
4449
|
-
<xsl:variable name="
|
|
5475
|
+
<xsl:variable name="viewbox_">
|
|
4450
5476
|
<xsl:call-template name="split">
|
|
4451
5477
|
<xsl:with-param name="pText" select="@viewBox"/>
|
|
4452
5478
|
<xsl:with-param name="sep" select="' '"/>
|
|
4453
5479
|
</xsl:call-template>
|
|
4454
5480
|
</xsl:variable>
|
|
5481
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
|
5482
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
|
5483
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
|
5484
|
+
|
|
4455
5485
|
<xsl:attribute name="width">
|
|
4456
|
-
<xsl:
|
|
5486
|
+
<xsl:choose>
|
|
5487
|
+
<xsl:when test="$width != ''">
|
|
5488
|
+
<xsl:value-of select="round($width)"/>
|
|
5489
|
+
</xsl:when>
|
|
5490
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
|
5491
|
+
</xsl:choose>
|
|
4457
5492
|
</xsl:attribute>
|
|
4458
5493
|
<xsl:attribute name="height">
|
|
4459
|
-
<xsl:
|
|
5494
|
+
<xsl:choose>
|
|
5495
|
+
<xsl:when test="$height != ''">
|
|
5496
|
+
<xsl:value-of select="round($height)"/>
|
|
5497
|
+
</xsl:when>
|
|
5498
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
|
5499
|
+
</xsl:choose>
|
|
4460
5500
|
</xsl:attribute>
|
|
5501
|
+
|
|
4461
5502
|
<xsl:apply-templates mode="svg_update"/>
|
|
4462
5503
|
</xsl:copy>
|
|
4463
5504
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
|
@@ -4652,7 +5693,11 @@
|
|
|
4652
5693
|
<xsl:apply-templates mode="bookmarks"/>
|
|
4653
5694
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
|
4654
5695
|
<xsl:apply-templates select="."/>
|
|
4655
|
-
</xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = '
|
|
5696
|
+
</xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/><xsl:template match="*[local-name() = 'span']" mode="contents">
|
|
5697
|
+
<xsl:apply-templates mode="contents"/>
|
|
5698
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
|
5699
|
+
<xsl:apply-templates mode="bookmarks"/>
|
|
5700
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
|
4656
5701
|
<xsl:apply-templates mode="bookmarks"/>
|
|
4657
5702
|
</xsl:template><xsl:template name="addBookmarks">
|
|
4658
5703
|
<xsl:param name="contents"/>
|
|
@@ -4934,7 +5979,9 @@
|
|
|
4934
5979
|
<xsl:apply-templates/>
|
|
4935
5980
|
</xsl:otherwise>
|
|
4936
5981
|
</xsl:choose>
|
|
4937
|
-
</xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = '
|
|
5982
|
+
</xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'xref']" mode="contents">
|
|
5983
|
+
<xsl:value-of select="."/>
|
|
5984
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
|
4938
5985
|
<xsl:text> </xsl:text>
|
|
4939
5986
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
|
4940
5987
|
<xsl:copy>
|
|
@@ -4965,9 +6012,22 @@
|
|
|
4965
6012
|
</xsl:when>
|
|
4966
6013
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
|
4967
6014
|
</xsl:choose>
|
|
6015
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
|
6016
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
|
6017
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
|
6018
|
+
<xsl:apply-templates mode="contents_item"/>
|
|
4968
6019
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
|
4969
6020
|
|
|
4970
6021
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
|
6022
|
+
|
|
6023
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
|
6024
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
|
6025
|
+
</xsl:if>
|
|
6026
|
+
|
|
6027
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
|
6028
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
|
6029
|
+
</xsl:if>
|
|
6030
|
+
|
|
4971
6031
|
<xsl:copy-of select="@id"/>
|
|
4972
6032
|
|
|
4973
6033
|
<xsl:if test="parent::*[local-name() = 'note']">
|
|
@@ -4992,7 +6052,7 @@
|
|
|
4992
6052
|
|
|
4993
6053
|
|
|
4994
6054
|
|
|
4995
|
-
|
|
6055
|
+
<!-- 9 -->
|
|
4996
6056
|
|
|
4997
6057
|
|
|
4998
6058
|
|
|
@@ -5076,7 +6136,7 @@
|
|
|
5076
6136
|
<xsl:for-each select="xalan:nodeset($text_step4)/node()">
|
|
5077
6137
|
<xsl:choose>
|
|
5078
6138
|
<xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
|
5079
|
-
<xsl:call-template name="interspers">
|
|
6139
|
+
<xsl:call-template name="interspers-java">
|
|
5080
6140
|
<xsl:with-param name="str" select="."/>
|
|
5081
6141
|
</xsl:call-template>
|
|
5082
6142
|
</xsl:when>
|
|
@@ -5126,6 +6186,10 @@
|
|
|
5126
6186
|
<xsl:with-param name="char" select="$char"/>
|
|
5127
6187
|
</xsl:call-template>
|
|
5128
6188
|
</xsl:if>
|
|
6189
|
+
</xsl:template><xsl:template name="interspers-java">
|
|
6190
|
+
<xsl:param name="str"/>
|
|
6191
|
+
<xsl:param name="char" select="$zero_width_space"/>
|
|
6192
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
|
|
5129
6193
|
</xsl:template><xsl:template match="*" mode="syntax_highlight">
|
|
5130
6194
|
<xsl:apply-templates mode="syntax_highlight"/>
|
|
5131
6195
|
</xsl:template><xsl:variable name="syntax_highlight_styles_">
|
|
@@ -5338,7 +6402,9 @@
|
|
|
5338
6402
|
<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
|
|
5339
6403
|
</xsl:if>
|
|
5340
6404
|
<xsl:variable name="simple-table">
|
|
5341
|
-
<xsl:call-template name="getSimpleTable"
|
|
6405
|
+
<xsl:call-template name="getSimpleTable">
|
|
6406
|
+
<xsl:with-param name="id" select="@id"/>
|
|
6407
|
+
</xsl:call-template>
|
|
5342
6408
|
</xsl:variable>
|
|
5343
6409
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
|
|
5344
6410
|
<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
|
|
@@ -5445,39 +6511,67 @@
|
|
|
5445
6511
|
</xsl:otherwise>
|
|
5446
6512
|
</xsl:choose>
|
|
5447
6513
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
|
5448
|
-
|
|
5449
|
-
|
|
6514
|
+
|
|
6515
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
|
6516
|
+
|
|
5450
6517
|
|
|
6518
|
+
|
|
5451
6519
|
<xsl:variable name="fo_element">
|
|
5452
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
|
6520
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
|
5453
6521
|
block
|
|
5454
6522
|
</xsl:variable>
|
|
5455
6523
|
|
|
5456
|
-
|
|
5457
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
|
5458
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
|
5459
|
-
</xsl:apply-templates>
|
|
6524
|
+
<fo:block-container margin-left="0mm">
|
|
5460
6525
|
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
<
|
|
5464
|
-
|
|
5465
|
-
|
|
6526
|
+
<xsl:choose>
|
|
6527
|
+
|
|
6528
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
|
6529
|
+
|
|
6530
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
|
6531
|
+
<fo:block>
|
|
6532
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
|
5466
6533
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
|
5467
6534
|
</xsl:apply-templates>
|
|
6535
|
+
</fo:block>
|
|
6536
|
+
|
|
6537
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
|
6538
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
|
6539
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
|
6540
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
|
6541
|
+
</xsl:apply-templates>
|
|
6542
|
+
</fo:block-container>
|
|
5468
6543
|
</fo:block-container>
|
|
5469
|
-
</
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
6544
|
+
</xsl:when> <!-- end block -->
|
|
6545
|
+
|
|
6546
|
+
<xsl:otherwise> <!-- inline -->
|
|
6547
|
+
|
|
6548
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
|
6549
|
+
<fo:block>
|
|
6550
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
|
6551
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
|
6552
|
+
</xsl:apply-templates>
|
|
6553
|
+
<fo:inline>
|
|
6554
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
|
6555
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
|
6556
|
+
</xsl:apply-templates>
|
|
6557
|
+
</fo:inline>
|
|
6558
|
+
</fo:block>
|
|
6559
|
+
|
|
6560
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
|
6561
|
+
<!-- display further elements in blocks -->
|
|
6562
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
|
6563
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
|
6564
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
|
6565
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
|
6566
|
+
</xsl:apply-templates>
|
|
6567
|
+
</fo:block-container>
|
|
6568
|
+
</fo:block-container>
|
|
6569
|
+
</xsl:if>
|
|
6570
|
+
</xsl:otherwise> <!-- end inline -->
|
|
6571
|
+
|
|
6572
|
+
</xsl:choose>
|
|
6573
|
+
</fo:block-container>
|
|
6574
|
+
</fo:block-container>
|
|
5481
6575
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
|
5482
6576
|
<xsl:param name="fo_element">block</xsl:param>
|
|
5483
6577
|
|
|
@@ -5509,10 +6603,16 @@
|
|
|
5509
6603
|
</xsl:variable>
|
|
5510
6604
|
<xsl:choose>
|
|
5511
6605
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
|
5512
|
-
<fo:block
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
6606
|
+
<fo:block-container>
|
|
6607
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
|
6608
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
|
6609
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
|
6610
|
+
</xsl:if>
|
|
6611
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
|
6612
|
+
|
|
6613
|
+
<xsl:apply-templates/>
|
|
6614
|
+
</fo:block>
|
|
6615
|
+
</fo:block-container>
|
|
5516
6616
|
</xsl:when>
|
|
5517
6617
|
<xsl:otherwise>
|
|
5518
6618
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
|
@@ -5694,7 +6794,16 @@
|
|
|
5694
6794
|
</fo:inline>
|
|
5695
6795
|
</xsl:when>
|
|
5696
6796
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
|
5697
|
-
|
|
6797
|
+
|
|
6798
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
|
6799
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
|
6800
|
+
<xsl:choose>
|
|
6801
|
+
<xsl:when test="$uri_src != ''">
|
|
6802
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
|
6803
|
+
</xsl:when>
|
|
6804
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
|
6805
|
+
</xsl:choose>
|
|
6806
|
+
|
|
5698
6807
|
</xsl:otherwise>
|
|
5699
6808
|
</xsl:choose>
|
|
5700
6809
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
|
@@ -5860,10 +6969,24 @@
|
|
|
5860
6969
|
|
|
5861
6970
|
</fo:block>
|
|
5862
6971
|
<xsl:apply-templates/>
|
|
5863
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
|
6972
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
|
5864
6973
|
<!-- comment 2019-11-29 -->
|
|
5865
6974
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
|
5866
6975
|
<xsl:apply-templates /> -->
|
|
6976
|
+
|
|
6977
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
|
6978
|
+
|
|
6979
|
+
<xsl:choose>
|
|
6980
|
+
<!-- if there isn't the attribute '@from', then -->
|
|
6981
|
+
<xsl:when test="$id_from = ''">
|
|
6982
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
|
6983
|
+
</xsl:when>
|
|
6984
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
|
6985
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
|
6986
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
|
6987
|
+
</xsl:when>
|
|
6988
|
+
</xsl:choose>
|
|
6989
|
+
|
|
5867
6990
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
|
5868
6991
|
<!-- 0xA0 to space replacement -->
|
|
5869
6992
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
|
@@ -6008,6 +7131,11 @@
|
|
|
6008
7131
|
</xsl:otherwise>
|
|
6009
7132
|
</xsl:choose>
|
|
6010
7133
|
</xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
|
|
7134
|
+
|
|
7135
|
+
<xsl:apply-templates select="*[local-name() = 'name']">
|
|
7136
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
|
7137
|
+
</xsl:apply-templates>
|
|
7138
|
+
|
|
6011
7139
|
<fo:list-block xsl:use-attribute-sets="list-style">
|
|
6012
7140
|
|
|
6013
7141
|
|
|
@@ -6022,12 +7150,23 @@
|
|
|
6022
7150
|
|
|
6023
7151
|
|
|
6024
7152
|
|
|
7153
|
+
<xsl:if test="*[local-name() = 'name']">
|
|
7154
|
+
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
|
7155
|
+
</xsl:if>
|
|
7156
|
+
|
|
6025
7157
|
<xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
|
|
6026
7158
|
</fo:list-block>
|
|
6027
7159
|
<!-- <xsl:for-each select="./iho:note">
|
|
6028
7160
|
<xsl:call-template name="note"/>
|
|
6029
7161
|
</xsl:for-each> -->
|
|
6030
7162
|
<xsl:apply-templates select="./*[local-name() = 'note']"/>
|
|
7163
|
+
</xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
|
|
7164
|
+
<xsl:param name="process">false</xsl:param>
|
|
7165
|
+
<xsl:if test="$process = 'true'">
|
|
7166
|
+
<fo:block xsl:use-attribute-sets="list-name-style">
|
|
7167
|
+
<xsl:apply-templates/>
|
|
7168
|
+
</fo:block>
|
|
7169
|
+
</xsl:if>
|
|
6031
7170
|
</xsl:template><xsl:template match="*[local-name()='li']">
|
|
6032
7171
|
<fo:list-item xsl:use-attribute-sets="list-item-style">
|
|
6033
7172
|
<xsl:copy-of select="@id"/>
|
|
@@ -6224,7 +7363,10 @@
|
|
|
6224
7363
|
<!-- to split by '_' and other chars -->
|
|
6225
7364
|
<xsl:call-template name="add-zero-spaces-java"/>
|
|
6226
7365
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
|
6227
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
|
7366
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
|
7367
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
|
7368
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
|
7369
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
|
|
6228
7370
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
|
6229
7371
|
<!-- <row>
|
|
6230
7372
|
<date>05-07-2013</date>
|
|
@@ -6328,26 +7470,23 @@
|
|
|
6328
7470
|
<xsl:if test=".//*[local-name() = 'fn']">
|
|
6329
7471
|
<xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
|
|
6330
7472
|
</xsl:if>
|
|
7473
|
+
|
|
7474
|
+
<!-- display document identifier, not number [1] -->
|
|
6331
7475
|
<xsl:variable name="docidentifier">
|
|
6332
7476
|
<xsl:choose>
|
|
6333
7477
|
<xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
|
|
6334
7478
|
<xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
|
|
6335
7479
|
</xsl:choose>
|
|
6336
7480
|
</xsl:variable>
|
|
6337
|
-
<
|
|
7481
|
+
<xsl:value-of select="$docidentifier"/>
|
|
7482
|
+
|
|
6338
7483
|
<xsl:apply-templates select="*[local-name() = 'note']"/>
|
|
6339
|
-
|
|
6340
|
-
<xsl:
|
|
6341
|
-
<xsl:
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
<xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
|
|
6346
|
-
</xsl:when>
|
|
6347
|
-
<xsl:otherwise>
|
|
6348
|
-
<xsl:apply-templates select="*[local-name() = 'title']"/>
|
|
6349
|
-
</xsl:otherwise>
|
|
6350
|
-
</xsl:choose>
|
|
7484
|
+
|
|
7485
|
+
<xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
|
|
7486
|
+
<xsl:text>,</xsl:text>
|
|
7487
|
+
<xsl:text> </xsl:text>
|
|
7488
|
+
</xsl:if>
|
|
7489
|
+
|
|
6351
7490
|
<xsl:apply-templates select="*[local-name() = 'formattedref']"/>
|
|
6352
7491
|
<!-- end bibitem processing -->
|
|
6353
7492
|
|
|
@@ -6669,25 +7808,32 @@
|
|
|
6669
7808
|
</fo:block-container>
|
|
6670
7809
|
|
|
6671
7810
|
</xsl:template><xsl:template name="displayAdmonitionName">
|
|
6672
|
-
|
|
7811
|
+
<xsl:param name="sep"/> <!-- Example: ' - ' -->
|
|
7812
|
+
<!-- <xsl:choose>
|
|
7813
|
+
<xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
|
|
7814
|
+
<xsl:choose>
|
|
7815
|
+
<xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
|
|
7816
|
+
<xsl:otherwise>
|
|
7817
|
+
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
|
7818
|
+
</xsl:otherwise>
|
|
7819
|
+
</xsl:choose>
|
|
7820
|
+
</xsl:when>
|
|
7821
|
+
<xsl:otherwise>
|
|
6673
7822
|
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
|
6674
7823
|
<xsl:if test="not(*[local-name() = 'name'])">
|
|
6675
7824
|
<xsl:apply-templates select="@type"/>
|
|
6676
7825
|
</xsl:if>
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
<xsl:
|
|
6680
|
-
|
|
6681
|
-
<xsl:variable name="admonition_type_">
|
|
6682
|
-
<xsl:call-template name="getLocalizedString">
|
|
6683
|
-
<xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
|
|
6684
|
-
</xsl:call-template>
|
|
7826
|
+
</xsl:otherwise>
|
|
7827
|
+
</xsl:choose> -->
|
|
7828
|
+
<xsl:variable name="name">
|
|
7829
|
+
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
|
6685
7830
|
</xsl:variable>
|
|
6686
|
-
<xsl:
|
|
6687
|
-
<xsl:
|
|
6688
|
-
|
|
6689
|
-
<xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
|
|
7831
|
+
<xsl:copy-of select="$name"/>
|
|
7832
|
+
<xsl:if test="normalize-space($name) != ''">
|
|
7833
|
+
<xsl:value-of select="$sep"/>
|
|
6690
7834
|
</xsl:if>
|
|
7835
|
+
</xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
|
|
7836
|
+
<xsl:apply-templates/>
|
|
6691
7837
|
</xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
|
|
6692
7838
|
<!-- processing for admonition/p found in the template for 'p' -->
|
|
6693
7839
|
<xsl:call-template name="paragraph"/>
|
|
@@ -6764,6 +7910,120 @@
|
|
|
6764
7910
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
|
6765
7911
|
</xsl:for-each>
|
|
6766
7912
|
</xsl:copy>
|
|
7913
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
|
7914
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
|
7915
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
|
7916
|
+
<xsl:copy>
|
|
7917
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
|
7918
|
+
</xsl:copy>
|
|
7919
|
+
</xsl:template><xsl:variable name="express_reference_separators">_.\</xsl:variable><xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/><xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable><xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
|
|
7920
|
+
|
|
7921
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
|
7922
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
|
7923
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
|
7924
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
|
7925
|
+
<xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
|
|
7926
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
|
7927
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
|
7928
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
|
7929
|
+
<xsl:with-param name="text" select="$text_"/>
|
|
7930
|
+
</xsl:call-template></text></xsl:variable>
|
|
7931
|
+
|
|
7932
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
|
7933
|
+
|
|
7934
|
+
<xsl:variable name="text2">
|
|
7935
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
|
7936
|
+
<xsl:copy-of select="."/>
|
|
7937
|
+
</xsl:for-each></text>
|
|
7938
|
+
</xsl:variable>
|
|
7939
|
+
|
|
7940
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
|
7941
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
|
7942
|
+
<xsl:variable name="text3">
|
|
7943
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
|
7944
|
+
<xsl:choose>
|
|
7945
|
+
<xsl:when test="self::text()">
|
|
7946
|
+
<xsl:variable name="text_units_" select="java:replaceAll(java:java.lang.String.new(.),$regex_solidus_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
|
|
7947
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
|
7948
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
|
7949
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
|
7950
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
|
7951
|
+
</xsl:call-template></text></xsl:variable>
|
|
7952
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
|
7953
|
+
</xsl:when>
|
|
7954
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
|
7955
|
+
</xsl:choose>
|
|
7956
|
+
</xsl:for-each></text>
|
|
7957
|
+
</xsl:variable>
|
|
7958
|
+
|
|
7959
|
+
<xsl:choose>
|
|
7960
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
|
7961
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
|
7962
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
|
7963
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
|
7964
|
+
<xsl:choose>
|
|
7965
|
+
<xsl:when test="self::text()">
|
|
7966
|
+
<xsl:variable name="text_dots_" select="java:replaceAll(java:java.lang.String.new(.),$regex_dots_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
|
|
7967
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
|
7968
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
|
7969
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
|
7970
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
|
7971
|
+
</xsl:call-template></text></xsl:variable>
|
|
7972
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
|
7973
|
+
</xsl:when>
|
|
7974
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
|
7975
|
+
</xsl:choose>
|
|
7976
|
+
</xsl:for-each>
|
|
7977
|
+
</xsl:when>
|
|
7978
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
|
7979
|
+
</xsl:choose>
|
|
7980
|
+
|
|
7981
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
|
7982
|
+
<xsl:param name="tag_open"/>
|
|
7983
|
+
<xsl:param name="tag_close"/>
|
|
7984
|
+
<xsl:param name="text"/>
|
|
7985
|
+
<xsl:choose>
|
|
7986
|
+
<xsl:when test="contains($text, $tag_open)">
|
|
7987
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
|
7988
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
|
7989
|
+
|
|
7990
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
|
7991
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
|
7992
|
+
</xsl:element>
|
|
7993
|
+
|
|
7994
|
+
<xsl:call-template name="replace_text_tags">
|
|
7995
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
|
7996
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
|
7997
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
|
7998
|
+
</xsl:call-template>
|
|
7999
|
+
</xsl:when>
|
|
8000
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
|
8001
|
+
</xsl:choose>
|
|
8002
|
+
</xsl:template><xsl:template name="printEdition">
|
|
8003
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
|
8004
|
+
<xsl:text> </xsl:text>
|
|
8005
|
+
<xsl:choose>
|
|
8006
|
+
<xsl:when test="$edition_i18n != ''">
|
|
8007
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
|
8008
|
+
<xsl:call-template name="capitalize">
|
|
8009
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
|
8010
|
+
</xsl:call-template>
|
|
8011
|
+
</xsl:when>
|
|
8012
|
+
<xsl:otherwise>
|
|
8013
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
|
8014
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
|
8015
|
+
<xsl:call-template name="capitalize">
|
|
8016
|
+
<xsl:with-param name="str">
|
|
8017
|
+
<xsl:call-template name="getLocalizedString">
|
|
8018
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
|
8019
|
+
</xsl:call-template>
|
|
8020
|
+
</xsl:with-param>
|
|
8021
|
+
</xsl:call-template>
|
|
8022
|
+
<xsl:text> </xsl:text>
|
|
8023
|
+
<xsl:value-of select="$edition"/>
|
|
8024
|
+
</xsl:if>
|
|
8025
|
+
</xsl:otherwise>
|
|
8026
|
+
</xsl:choose>
|
|
6767
8027
|
</xsl:template><xsl:template name="convertDate">
|
|
6768
8028
|
<xsl:param name="date"/>
|
|
6769
8029
|
<xsl:param name="format" select="'short'"/>
|
|
@@ -7451,4 +8711,40 @@
|
|
|
7451
8711
|
<xsl:value-of select="$value"/>
|
|
7452
8712
|
</xsl:otherwise>
|
|
7453
8713
|
</xsl:choose>
|
|
8714
|
+
</xsl:template><xsl:template match="*" mode="print_as_xml">
|
|
8715
|
+
<xsl:param name="level">0</xsl:param>
|
|
8716
|
+
|
|
8717
|
+
<fo:block margin-left="{2*$level}mm">
|
|
8718
|
+
<xsl:text>
|
|
8719
|
+
<</xsl:text>
|
|
8720
|
+
<xsl:value-of select="local-name()"/>
|
|
8721
|
+
<xsl:for-each select="@*">
|
|
8722
|
+
<xsl:text> </xsl:text>
|
|
8723
|
+
<xsl:value-of select="local-name()"/>
|
|
8724
|
+
<xsl:text>="</xsl:text>
|
|
8725
|
+
<xsl:value-of select="."/>
|
|
8726
|
+
<xsl:text>"</xsl:text>
|
|
8727
|
+
</xsl:for-each>
|
|
8728
|
+
<xsl:text>></xsl:text>
|
|
8729
|
+
|
|
8730
|
+
<xsl:if test="not(*)">
|
|
8731
|
+
<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
|
|
8732
|
+
<xsl:text></</xsl:text>
|
|
8733
|
+
<xsl:value-of select="local-name()"/>
|
|
8734
|
+
<xsl:text>></xsl:text>
|
|
8735
|
+
</xsl:if>
|
|
8736
|
+
</fo:block>
|
|
8737
|
+
|
|
8738
|
+
<xsl:if test="*">
|
|
8739
|
+
<fo:block>
|
|
8740
|
+
<xsl:apply-templates mode="print_as_xml">
|
|
8741
|
+
<xsl:with-param name="level" select="$level + 1"/>
|
|
8742
|
+
</xsl:apply-templates>
|
|
8743
|
+
</fo:block>
|
|
8744
|
+
<fo:block margin-left="{2*$level}mm">
|
|
8745
|
+
<xsl:text></</xsl:text>
|
|
8746
|
+
<xsl:value-of select="local-name()"/>
|
|
8747
|
+
<xsl:text>></xsl:text>
|
|
8748
|
+
</fo:block>
|
|
8749
|
+
</xsl:if>
|
|
7454
8750
|
</xsl:template></xsl:stylesheet>
|