metanorma-un 0.8.7 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/un/html/html_unece_plenary_titlepage.html +3 -0
- data/lib/isodoc/un/html/html_unece_titlepage.html +1 -0
- data/lib/isodoc/un/html/word_unece_plenary_titlepage.html +4 -0
- data/lib/isodoc/un/html/word_unece_titlepage.html +7 -4
- data/lib/isodoc/un/init.rb +1 -1
- data/lib/isodoc/un/presentation_xml_convert.rb +15 -24
- data/lib/isodoc/un/un.plenary-attachment.xsl +1605 -324
- data/lib/isodoc/un/un.plenary.xsl +1605 -324
- data/lib/isodoc/un/un.recommendation.xsl +1605 -324
- data/lib/isodoc/un/word_convert.rb +27 -21
- data/lib/isodoc/un/xref.rb +21 -16
- data/lib/metanorma/un/biblio.rng +62 -10
- data/lib/metanorma/un/converter.rb +5 -5
- data/lib/metanorma/un/isodoc.rng +56 -0
- data/lib/metanorma/un/un.rng +10 -0
- data/lib/metanorma/un/version.rb +1 -1
- data/metanorma-unece.gemspec +1 -1
- metadata +4 -4
@@ -32,7 +32,13 @@
|
|
32
32
|
|
33
33
|
<xsl:template match="/">
|
34
34
|
<xsl:call-template name="namespaceCheck"/>
|
35
|
-
<fo:root
|
35
|
+
<fo:root xml:lang="{$lang}">
|
36
|
+
<xsl:variable name="root-style">
|
37
|
+
<root-style xsl:use-attribute-sets="root-style"/>
|
38
|
+
</xsl:variable>
|
39
|
+
<xsl:call-template name="insertRootStyle">
|
40
|
+
<xsl:with-param name="root-style" select="$root-style"/>
|
41
|
+
</xsl:call-template>
|
36
42
|
<fo:layout-master-set>
|
37
43
|
<!-- Cover page -->
|
38
44
|
<fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
|
@@ -475,6 +481,7 @@
|
|
475
481
|
</xsl:template>
|
476
482
|
|
477
483
|
<xsl:template match="un:p" name="paragraph">
|
484
|
+
<xsl:param name="split_keep-within-line"/>
|
478
485
|
<fo:block margin-bottom="6pt" line-height="122%">
|
479
486
|
<xsl:if test="following-sibling::*">
|
480
487
|
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
@@ -485,7 +492,9 @@
|
|
485
492
|
<xsl:otherwise>justify</xsl:otherwise>
|
486
493
|
</xsl:choose>
|
487
494
|
</xsl:attribute>
|
488
|
-
<xsl:apply-templates
|
495
|
+
<xsl:apply-templates>
|
496
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
497
|
+
</xsl:apply-templates>
|
489
498
|
</fo:block>
|
490
499
|
</xsl:template>
|
491
500
|
|
@@ -827,7 +836,9 @@
|
|
827
836
|
<xsl:text>iVBORw0KGgoAAAANSUhEUgAAAJkAAAAmCAYAAADXwDkaAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+lpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDE0IDc5LjE1Njc5NywgMjAxNC8wOC8yMC0wOTo1MzowMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJNaWNyb3NvZnTCriBXb3JkIDIwMTYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzM0NUVBQ0U2RUMzMTFFQUIzQjg4RDg3OEE1NEI2QzAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzM0NUVBQ0Y2RUMzMTFFQUIzQjg4RDg3OEE1NEI2QzAiPiA8ZGM6Y3JlYXRvcj4gPHJkZjpTZXE+IDxyZGY6bGk+RGhhbmplZTwvcmRmOmxpPiA8L3JkZjpTZXE+IDwvZGM6Y3JlYXRvcj4gPGRjOnRpdGxlPiA8cmRmOkFsdD4gPHJkZjpsaSB4bWw6bGFuZz0ieC1kZWZhdWx0Ij4xODAxNzYzPC9yZGY6bGk+IDwvcmRmOkFsdD4gPC9kYzp0aXRsZT4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVm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</xsl:text>
|
828
837
|
</xsl:variable>
|
829
838
|
|
830
|
-
<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="
|
839
|
+
<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:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
|
840
|
+
false
|
841
|
+
</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
|
831
842
|
<xsl:call-template name="getLang"/>
|
832
843
|
</xsl:variable><xsl:variable name="pageWidth_">
|
833
844
|
210
|
@@ -842,20 +853,7 @@
|
|
842
853
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
843
854
|
40
|
844
855
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
845
|
-
|
846
|
-
<title-edition lang="en">
|
847
|
-
|
848
|
-
<xsl:text>Edition </xsl:text>
|
849
|
-
|
850
|
-
</title-edition>
|
851
|
-
|
852
|
-
<title-edition lang="fr">
|
853
|
-
<xsl:text>Édition </xsl:text>
|
854
|
-
</title-edition>
|
855
856
|
|
856
|
-
<title-edition lang="ru">
|
857
|
-
<xsl:text>Издание </xsl:text>
|
858
|
-
</title-edition>
|
859
857
|
|
860
858
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
861
859
|
<title-toc lang="en">
|
@@ -934,7 +932,7 @@
|
|
934
932
|
</xsl:variable><xsl:variable name="bibdata">
|
935
933
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
936
934
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
937
|
-
</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">
|
935
|
+
</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">
|
938
936
|
<xsl:param name="name"/>
|
939
937
|
<xsl:param name="lang"/>
|
940
938
|
<xsl:variable name="lang_">
|
@@ -977,7 +975,30 @@
|
|
977
975
|
<xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
|
978
976
|
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
979
977
|
|
980
|
-
</xsl:attribute-set><xsl:
|
978
|
+
</xsl:attribute-set><xsl:template name="insertRootStyle">
|
979
|
+
<xsl:param name="root-style"/>
|
980
|
+
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
981
|
+
|
982
|
+
<xsl:variable name="additional_fonts_">
|
983
|
+
<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']">
|
984
|
+
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
985
|
+
</xsl:for-each>
|
986
|
+
</xsl:variable>
|
987
|
+
<xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
|
988
|
+
|
989
|
+
<xsl:for-each select="$root-style_/root-style/@*">
|
990
|
+
<xsl:choose>
|
991
|
+
<xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
|
992
|
+
<xsl:attribute name="{local-name()}">
|
993
|
+
<xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
|
994
|
+
</xsl:attribute>
|
995
|
+
</xsl:when>
|
996
|
+
<xsl:otherwise>
|
997
|
+
<xsl:copy-of select="."/>
|
998
|
+
</xsl:otherwise>
|
999
|
+
</xsl:choose>
|
1000
|
+
</xsl:for-each>
|
1001
|
+
</xsl:template><xsl:attribute-set name="copyright-statement-style">
|
981
1002
|
|
982
1003
|
</xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
|
983
1004
|
|
@@ -1031,7 +1052,6 @@
|
|
1031
1052
|
|
1032
1053
|
|
1033
1054
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
1034
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
1035
1055
|
|
1036
1056
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
1037
1057
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -1111,6 +1131,7 @@
|
|
1111
1131
|
|
1112
1132
|
|
1113
1133
|
|
1134
|
+
|
1114
1135
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
1115
1136
|
|
1116
1137
|
|
@@ -1268,6 +1289,7 @@
|
|
1268
1289
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
1269
1290
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1270
1291
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1292
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1271
1293
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
1272
1294
|
|
1273
1295
|
|
@@ -1296,6 +1318,7 @@
|
|
1296
1318
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
1297
1319
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1298
1320
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1321
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1299
1322
|
|
1300
1323
|
|
1301
1324
|
|
@@ -1390,7 +1413,8 @@
|
|
1390
1413
|
</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
|
1391
1414
|
|
1392
1415
|
|
1393
|
-
</xsl:attribute-set><xsl:attribute-set name="dt-style">
|
1416
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
|
1417
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
|
1394
1418
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
1395
1419
|
|
1396
1420
|
|
@@ -1402,6 +1426,8 @@
|
|
1402
1426
|
|
1403
1427
|
|
1404
1428
|
|
1429
|
+
</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
|
1430
|
+
<xsl:attribute name="padding-left">2mm</xsl:attribute>
|
1405
1431
|
</xsl:attribute-set><xsl:attribute-set name="appendix-style">
|
1406
1432
|
|
1407
1433
|
|
@@ -1493,7 +1519,7 @@
|
|
1493
1519
|
|
1494
1520
|
|
1495
1521
|
|
1496
|
-
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
1522
|
+
</xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
|
1497
1523
|
|
1498
1524
|
|
1499
1525
|
|
@@ -2188,22 +2214,32 @@
|
|
2188
2214
|
<xsl:sort select="@displayorder" data-type="number"/>
|
2189
2215
|
<xsl:apply-templates select="."/>
|
2190
2216
|
</xsl:for-each>
|
2191
|
-
</xsl:template><xsl:variable name="
|
2192
|
-
|
2193
|
-
|
2194
|
-
|
2195
|
-
|
2196
|
-
|
2197
|
-
|
2217
|
+
</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">
|
2218
|
+
|
2219
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
2220
|
+
<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))"/>
|
2221
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
2222
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
2223
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
2224
|
+
<xsl:with-param name="text" select="$text"/>
|
2225
|
+
</xsl:call-template>
|
2226
|
+
|
2227
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
2228
|
+
<xsl:param name="tag_open"/>
|
2229
|
+
<xsl:param name="tag_close"/>
|
2198
2230
|
<xsl:param name="text"/>
|
2199
2231
|
<xsl:choose>
|
2200
2232
|
<xsl:when test="contains($text, $tag_open)">
|
2201
2233
|
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
2202
|
-
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
2234
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
2203
2235
|
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
2204
|
-
<
|
2205
|
-
|
2206
|
-
|
2236
|
+
<fo:inline keep-together.within-line="always">
|
2237
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
2238
|
+
</fo:inline>
|
2239
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
2240
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
2241
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
2242
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
2207
2243
|
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
2208
2244
|
</xsl:call-template>
|
2209
2245
|
</xsl:when>
|
@@ -2211,6 +2247,39 @@
|
|
2211
2247
|
</xsl:choose>
|
2212
2248
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
2213
2249
|
<xsl:value-of select="$linebreak"/>
|
2250
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
2251
|
+
<xsl:param name="split_keep-within-line"/>
|
2252
|
+
|
2253
|
+
<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
|
2254
|
+
<xsl:choose>
|
2255
|
+
|
2256
|
+
<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
|
2257
|
+
<xsl:variable name="sep">_</xsl:variable>
|
2258
|
+
<xsl:variable name="items">
|
2259
|
+
<xsl:call-template name="split">
|
2260
|
+
<xsl:with-param name="pText" select="."/>
|
2261
|
+
<xsl:with-param name="sep" select="$sep"/>
|
2262
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
2263
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
2264
|
+
</xsl:call-template>
|
2265
|
+
</xsl:variable>
|
2266
|
+
<xsl:for-each select="xalan:nodeset($items)/item">
|
2267
|
+
<xsl:choose>
|
2268
|
+
<xsl:when test=". = $sep">
|
2269
|
+
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
|
2270
|
+
</xsl:when>
|
2271
|
+
<xsl:otherwise>
|
2272
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
2273
|
+
</xsl:otherwise>
|
2274
|
+
</xsl:choose>
|
2275
|
+
</xsl:for-each>
|
2276
|
+
</xsl:when>
|
2277
|
+
|
2278
|
+
<xsl:otherwise>
|
2279
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
2280
|
+
</xsl:otherwise>
|
2281
|
+
|
2282
|
+
</xsl:choose>
|
2214
2283
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
2215
2284
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
2216
2285
|
<xsl:apply-templates/>
|
@@ -2276,8 +2345,23 @@
|
|
2276
2345
|
</xsl:call-template>
|
2277
2346
|
|
2278
2347
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
2279
|
-
|
2280
|
-
|
2348
|
+
<xsl:choose>
|
2349
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
2350
|
+
<xsl:value-of select="."/>
|
2351
|
+
</xsl:when>
|
2352
|
+
<xsl:otherwise>
|
2353
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
2354
|
+
</xsl:otherwise>
|
2355
|
+
</xsl:choose>
|
2356
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
2357
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
2358
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
2359
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
2360
|
+
<xsl:choose>
|
2361
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
2362
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
2363
|
+
</xsl:choose>
|
2364
|
+
</xsl:for-each>
|
2281
2365
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
2282
2366
|
|
2283
2367
|
<xsl:variable name="table-preamble">
|
@@ -2287,9 +2371,14 @@
|
|
2287
2371
|
|
2288
2372
|
<xsl:variable name="table">
|
2289
2373
|
|
2290
|
-
<xsl:variable name="simple-table">
|
2291
|
-
<xsl:call-template name="getSimpleTable"
|
2374
|
+
<xsl:variable name="simple-table">
|
2375
|
+
<xsl:call-template name="getSimpleTable">
|
2376
|
+
<xsl:with-param name="id" select="@id"/>
|
2377
|
+
</xsl:call-template>
|
2292
2378
|
</xsl:variable>
|
2379
|
+
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
2380
|
+
|
2381
|
+
<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
|
2293
2382
|
|
2294
2383
|
|
2295
2384
|
<!-- Display table's name before table as standalone block -->
|
@@ -2312,7 +2401,23 @@
|
|
2312
2401
|
</xsl:call-template>
|
2313
2402
|
</xsl:if>
|
2314
2403
|
</xsl:variable>
|
2315
|
-
<!--
|
2404
|
+
<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
|
2405
|
+
|
2406
|
+
<!-- DEBUG -->
|
2407
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2408
|
+
<fo:block font-size="60%">
|
2409
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
2410
|
+
</fo:block>
|
2411
|
+
</xsl:if>
|
2412
|
+
|
2413
|
+
|
2414
|
+
<!-- <xsl:copy-of select="$colwidths"/> -->
|
2415
|
+
|
2416
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
2417
|
+
DEBUG
|
2418
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
2419
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
2420
|
+
|
2316
2421
|
|
2317
2422
|
|
2318
2423
|
<xsl:variable name="margin-side">
|
@@ -2384,9 +2489,17 @@
|
|
2384
2489
|
</xsl:element>
|
2385
2490
|
</xsl:variable>
|
2386
2491
|
|
2492
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
2493
|
+
<!-- to determine start of table -->
|
2494
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
2495
|
+
</xsl:if>
|
2387
2496
|
|
2388
2497
|
<fo:table id="{@id}">
|
2389
2498
|
|
2499
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
2500
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
2501
|
+
</xsl:if>
|
2502
|
+
|
2390
2503
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
2391
2504
|
<xsl:attribute name="{local-name()}">
|
2392
2505
|
<xsl:value-of select="."/>
|
@@ -2400,31 +2513,47 @@
|
|
2400
2513
|
|
2401
2514
|
|
2402
2515
|
<xsl:choose>
|
2403
|
-
<xsl:when test="
|
2404
|
-
|
2405
|
-
|
2406
|
-
|
2516
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
2517
|
+
<!-- generate IF for table widths -->
|
2518
|
+
<!-- example:
|
2519
|
+
<tr>
|
2520
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
2521
|
+
<p>Symbol</p>
|
2522
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
2523
|
+
</td>
|
2524
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
2525
|
+
<p>Description</p>
|
2526
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
2527
|
+
</td>
|
2528
|
+
</tr>
|
2529
|
+
-->
|
2530
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
|
2531
|
+
|
2407
2532
|
</xsl:when>
|
2408
2533
|
<xsl:otherwise>
|
2409
|
-
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
2410
|
-
<xsl:choose>
|
2411
|
-
<xsl:when test=". = 1 or . = 0">
|
2412
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
2413
|
-
</xsl:when>
|
2414
|
-
<xsl:otherwise>
|
2415
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
2416
|
-
</xsl:otherwise>
|
2417
|
-
</xsl:choose>
|
2418
|
-
</xsl:for-each>
|
2419
|
-
</xsl:otherwise>
|
2420
|
-
</xsl:choose>
|
2421
2534
|
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2535
|
+
<xsl:choose>
|
2536
|
+
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
|
2537
|
+
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
|
2538
|
+
<fo:table-column column-width="{@width}"/>
|
2539
|
+
</xsl:for-each>
|
2540
|
+
</xsl:when>
|
2541
|
+
<xsl:otherwise>
|
2542
|
+
<xsl:call-template name="insertTableColumnWidth">
|
2543
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
2544
|
+
</xsl:call-template>
|
2545
|
+
</xsl:otherwise>
|
2546
|
+
</xsl:choose>
|
2547
|
+
|
2548
|
+
<xsl:choose>
|
2549
|
+
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
|
2550
|
+
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
2551
|
+
</xsl:when>
|
2552
|
+
<xsl:otherwise>
|
2553
|
+
<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 -->
|
2554
|
+
</xsl:otherwise>
|
2555
|
+
</xsl:choose>
|
2556
|
+
|
2428
2557
|
</xsl:otherwise>
|
2429
2558
|
</xsl:choose>
|
2430
2559
|
|
@@ -2524,11 +2653,22 @@
|
|
2524
2653
|
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
|
2525
2654
|
<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
|
2526
2655
|
</xsl:template><xsl:template name="calculate-column-widths">
|
2656
|
+
<xsl:param name="table"/>
|
2657
|
+
<xsl:param name="cols-count"/>
|
2658
|
+
|
2659
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2660
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2661
|
+
<xsl:with-param name="table" select="$table"/>
|
2662
|
+
</xsl:call-template>
|
2663
|
+
|
2664
|
+
</xsl:template><xsl:template name="calculate-column-widths-proportional">
|
2527
2665
|
<xsl:param name="table"/>
|
2528
2666
|
<xsl:param name="cols-count"/>
|
2529
2667
|
<xsl:param name="curr-col" select="1"/>
|
2530
2668
|
<xsl:param name="width" select="0"/>
|
2531
2669
|
|
2670
|
+
<!-- table=<xsl:copy-of select="$table"/> -->
|
2671
|
+
|
2532
2672
|
<xsl:if test="$curr-col <= $cols-count">
|
2533
2673
|
<xsl:variable name="widths">
|
2534
2674
|
<xsl:choose>
|
@@ -2566,16 +2706,22 @@
|
|
2566
2706
|
</xsl:for-each>
|
2567
2707
|
</xsl:when>
|
2568
2708
|
<xsl:otherwise>
|
2569
|
-
<xsl:
|
2709
|
+
<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
|
2710
|
+
|
2711
|
+
<!-- <table><xsl:copy-of select="$table"/></table>
|
2712
|
+
-->
|
2713
|
+
<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
|
2570
2714
|
<xsl:variable name="td_text">
|
2571
2715
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
2572
2716
|
</xsl:variable>
|
2717
|
+
<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
|
2573
2718
|
<xsl:variable name="words">
|
2574
2719
|
<xsl:variable name="string_with_added_zerospaces">
|
2575
2720
|
<xsl:call-template name="add-zero-spaces-java">
|
2576
2721
|
<xsl:with-param name="text" select="$td_text"/>
|
2577
2722
|
</xsl:call-template>
|
2578
2723
|
</xsl:variable>
|
2724
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
2579
2725
|
<xsl:call-template name="tokenize">
|
2580
2726
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
2581
2727
|
<!-- 2009 thinspace -->
|
@@ -2583,11 +2729,13 @@
|
|
2583
2729
|
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
2584
2730
|
</xsl:call-template>
|
2585
2731
|
</xsl:variable>
|
2732
|
+
<!-- words=<xsl:copy-of select="$words"/> -->
|
2586
2733
|
<xsl:variable name="max_length">
|
2587
2734
|
<xsl:call-template name="max_length">
|
2588
2735
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
2589
2736
|
</xsl:call-template>
|
2590
2737
|
</xsl:variable>
|
2738
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
2591
2739
|
<width>
|
2592
2740
|
<xsl:variable name="divider">
|
2593
2741
|
<xsl:choose>
|
@@ -2606,6 +2754,8 @@
|
|
2606
2754
|
</xsl:choose>
|
2607
2755
|
</xsl:variable>
|
2608
2756
|
|
2757
|
+
<!-- widths=<xsl:copy-of select="$widths"/> -->
|
2758
|
+
|
2609
2759
|
<column>
|
2610
2760
|
<xsl:for-each select="xalan:nodeset($widths)//width">
|
2611
2761
|
<xsl:sort select="." data-type="number" order="descending"/>
|
@@ -2614,29 +2764,327 @@
|
|
2614
2764
|
</xsl:if>
|
2615
2765
|
</xsl:for-each>
|
2616
2766
|
</column>
|
2617
|
-
<xsl:call-template name="calculate-column-widths">
|
2767
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2618
2768
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2619
2769
|
<xsl:with-param name="curr-col" select="$curr-col +1"/>
|
2620
2770
|
<xsl:with-param name="table" select="$table"/>
|
2621
2771
|
</xsl:call-template>
|
2622
2772
|
</xsl:if>
|
2773
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
|
2774
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
2775
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
2776
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
2777
|
+
|
2778
|
+
<!-- if all capitals english letters or digits -->
|
2779
|
+
<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
|
2780
|
+
<xsl:call-template name="repeat">
|
2781
|
+
<xsl:with-param name="char" select="'X'"/>
|
2782
|
+
<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
|
2783
|
+
</xsl:call-template>
|
2784
|
+
</xsl:if>
|
2623
2785
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
2624
2786
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
2625
2787
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
2626
2788
|
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
|
2627
2789
|
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
|
2628
2790
|
<xsl:value-of select="@target"/>
|
2629
|
-
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
|
2630
|
-
<xsl:
|
2631
|
-
<xsl:
|
2632
|
-
<xsl:
|
2633
|
-
<xsl:
|
2791
|
+
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
|
2792
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
2793
|
+
<xsl:variable name="mathml_">
|
2794
|
+
<xsl:for-each select="*">
|
2795
|
+
<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
|
2796
|
+
<xsl:copy-of select="."/>
|
2797
|
+
</xsl:if>
|
2798
|
+
</xsl:for-each>
|
2799
|
+
</xsl:variable>
|
2800
|
+
<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
|
2801
|
+
|
2802
|
+
<xsl:variable name="math_text">
|
2803
|
+
<xsl:value-of select="normalize-space($mathml)"/>
|
2804
|
+
<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
|
2805
|
+
<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
|
2806
|
+
</xsl:variable>
|
2807
|
+
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
|
2808
|
+
</xsl:if>
|
2809
|
+
</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
|
2810
|
+
<xsl:param name="table"/>
|
2811
|
+
<xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
|
2812
|
+
|
2813
|
+
<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
|
2814
|
+
|
2815
|
+
<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
|
2816
|
+
|
2817
|
+
<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
|
2818
|
+
|
2819
|
+
<!-- get current table id -->
|
2820
|
+
<xsl:variable name="table_id" select="@id"/>
|
2821
|
+
<!-- find table by id in the file 'table_widths' -->
|
2822
|
+
<xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
|
2823
|
+
<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
|
2824
|
+
|
2825
|
+
|
2826
|
+
<!-- table='<xsl:copy-of select="$table"/>' -->
|
2827
|
+
<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
|
2828
|
+
<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
|
2829
|
+
<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
|
2830
|
+
|
2831
|
+
<xsl:variable name="table_with_cell_widths_">
|
2832
|
+
<xsl:choose>
|
2833
|
+
<xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
|
2834
|
+
|
2835
|
+
<!-- Example: <column>10</column>
|
2836
|
+
<column>11</column>
|
2837
|
+
-->
|
2838
|
+
<xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
|
2839
|
+
</xsl:when>
|
2840
|
+
<xsl:otherwise>
|
2841
|
+
<xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
|
2842
|
+
</xsl:otherwise>
|
2843
|
+
</xsl:choose>
|
2844
|
+
</xsl:variable>
|
2845
|
+
<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
|
2846
|
+
|
2847
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2848
|
+
<xsl:copy-of select="$table_with_cell_widths"/>
|
2849
|
+
</xsl:if>
|
2850
|
+
|
2851
|
+
|
2852
|
+
<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
|
2853
|
+
|
2854
|
+
<xsl:variable name="column_widths_">
|
2855
|
+
<!-- iteration of columns -->
|
2856
|
+
<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
|
2857
|
+
<xsl:variable name="pos" select="position()"/>
|
2858
|
+
<column>
|
2859
|
+
<xsl:attribute name="width_max">
|
2860
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
|
2861
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2862
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2863
|
+
</xsl:for-each>
|
2864
|
+
</xsl:attribute>
|
2865
|
+
<xsl:attribute name="width_min">
|
2866
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
|
2867
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2868
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2869
|
+
</xsl:for-each>
|
2870
|
+
</xsl:attribute>
|
2871
|
+
</column>
|
2872
|
+
</xsl:for-each>
|
2873
|
+
</xsl:variable>
|
2874
|
+
<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
|
2875
|
+
|
2876
|
+
<!-- <column_widths>
|
2877
|
+
<xsl:copy-of select="$column_widths"/>
|
2878
|
+
</column_widths> -->
|
2879
|
+
|
2880
|
+
<!-- These in turn, are used to find the minimum and maximum width for the table. -->
|
2881
|
+
<xsl:variable name="table_widths_">
|
2882
|
+
<table>
|
2883
|
+
<xsl:attribute name="width_max">
|
2884
|
+
<xsl:value-of select="sum($column_widths/column/@width_max)"/>
|
2885
|
+
</xsl:attribute>
|
2886
|
+
<xsl:attribute name="width_min">
|
2887
|
+
<xsl:value-of select="sum($column_widths/column/@width_min)"/>
|
2888
|
+
</xsl:attribute>
|
2889
|
+
</table>
|
2890
|
+
</xsl:variable>
|
2891
|
+
<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
|
2892
|
+
|
2893
|
+
<xsl:variable name="page_width">
|
2894
|
+
<xsl:choose>
|
2895
|
+
<xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
|
2896
|
+
<xsl:otherwise>75</xsl:otherwise>
|
2897
|
+
</xsl:choose>
|
2898
|
+
</xsl:variable>
|
2899
|
+
|
2900
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2901
|
+
<table_width>
|
2902
|
+
<xsl:copy-of select="$table_widths"/>
|
2903
|
+
</table_width>
|
2904
|
+
<!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
|
2905
|
+
<debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
|
2906
|
+
-->
|
2907
|
+
<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
|
2908
|
+
</xsl:if>
|
2909
|
+
|
2910
|
+
|
2911
|
+
<!-- There are three cases: -->
|
2912
|
+
<xsl:choose>
|
2913
|
+
<!-- 1. The minimum table width is equal to or wider than the available space -->
|
2914
|
+
<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
|
2915
|
+
<!-- call old algorithm -->
|
2916
|
+
<case1/>
|
2917
|
+
<xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
|
2918
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2919
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2920
|
+
<xsl:with-param name="table" select="$table"/>
|
2921
|
+
</xsl:call-template>
|
2922
|
+
</xsl:when>
|
2923
|
+
<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
|
2924
|
+
<xsl:when test="$table_widths/table/@width_max <= $page_width">
|
2925
|
+
<case2/>
|
2926
|
+
<autolayout/>
|
2927
|
+
<xsl:for-each select="$column_widths/column/@width_max">
|
2928
|
+
<column divider="100"><xsl:value-of select="."/></column>
|
2929
|
+
</xsl:for-each>
|
2930
|
+
</xsl:when>
|
2931
|
+
<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
|
2932
|
+
In this case, find the difference between the available space and the minimum table width, lets call it W.
|
2933
|
+
Lets also call D the difference between maximum and minimum width of the table.
|
2934
|
+
For each column, let d be the difference between maximum and minimum width of that column.
|
2935
|
+
Now set the column's width to the minimum width plus d times W over D.
|
2936
|
+
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
2937
|
+
<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)">
|
2938
|
+
<!-- difference between the available space and the minimum table width -->
|
2939
|
+
<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
|
2940
|
+
<W><xsl:value-of select="$W"/></W>
|
2941
|
+
<!-- difference between maximum and minimum width of the table -->
|
2942
|
+
<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
|
2943
|
+
<D><xsl:value-of select="$D"/></D>
|
2944
|
+
<case3/>
|
2945
|
+
<autolayout/>
|
2946
|
+
<xsl:if test="$table_widths/table/@width_min >= $page_width">
|
2947
|
+
<split_keep-within-line>true</split_keep-within-line>
|
2948
|
+
</xsl:if>
|
2949
|
+
<xsl:for-each select="$column_widths/column">
|
2950
|
+
<!-- difference between maximum and minimum width of that column. -->
|
2951
|
+
<xsl:variable name="d" select="@width_max - @width_min"/>
|
2952
|
+
<d><xsl:value-of select="$d"/></d>
|
2953
|
+
<width_min><xsl:value-of select="@width_min"/></width_min>
|
2954
|
+
<e><xsl:value-of select="$d * $W div $D"/></e>
|
2955
|
+
<!-- set the column's width to the minimum width plus d times W over D. -->
|
2956
|
+
<column divider="100">
|
2957
|
+
<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
|
2958
|
+
</column>
|
2959
|
+
</xsl:for-each>
|
2960
|
+
|
2961
|
+
</xsl:when>
|
2962
|
+
<xsl:otherwise><unknown_case/></xsl:otherwise>
|
2963
|
+
</xsl:choose>
|
2964
|
+
|
2965
|
+
|
2966
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
|
2967
|
+
<xsl:copy>
|
2968
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
|
2969
|
+
</xsl:copy>
|
2970
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
|
2971
|
+
<xsl:copy>
|
2972
|
+
<xsl:copy-of select="@*"/>
|
2973
|
+
|
2974
|
+
<!-- The maximum width is given by the widest line. -->
|
2975
|
+
<xsl:variable name="widths_max">
|
2976
|
+
<xsl:for-each select=".//*[local-name() = 'p']">
|
2977
|
+
<xsl:call-template name="add_width"/>
|
2978
|
+
</xsl:for-each>
|
2979
|
+
<xsl:if test="not(*[local-name() = 'p'])">
|
2980
|
+
<xsl:call-template name="add_width"/>
|
2634
2981
|
</xsl:if>
|
2982
|
+
</xsl:variable>
|
2983
|
+
<xsl:variable name="width_max">
|
2984
|
+
<xsl:for-each select="xalan:nodeset($widths_max)//width">
|
2985
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2986
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2987
|
+
</xsl:for-each>
|
2988
|
+
</xsl:variable>
|
2989
|
+
<xsl:attribute name="width_max">
|
2990
|
+
<xsl:value-of select="$width_max"/>
|
2991
|
+
</xsl:attribute>
|
2992
|
+
|
2993
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
2994
|
+
<!-- To do: image width -->
|
2995
|
+
<xsl:variable name="td_text">
|
2996
|
+
<xsl:apply-templates select="." mode="td_text"/>
|
2997
|
+
</xsl:variable>
|
2998
|
+
<xsl:variable name="words">
|
2999
|
+
<xsl:variable name="string_with_added_zerospaces">
|
3000
|
+
<xsl:call-template name="add-zero-spaces-java">
|
3001
|
+
<xsl:with-param name="text" select="$td_text"/>
|
3002
|
+
</xsl:call-template>
|
3003
|
+
</xsl:variable>
|
3004
|
+
<xsl:call-template name="tokenize">
|
3005
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
3006
|
+
</xsl:call-template>
|
3007
|
+
</xsl:variable>
|
3008
|
+
|
3009
|
+
<xsl:variable name="max_word_length">
|
3010
|
+
<xsl:call-template name="max_length">
|
3011
|
+
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
3012
|
+
</xsl:call-template>
|
3013
|
+
</xsl:variable>
|
3014
|
+
<xsl:variable name="width_min">
|
3015
|
+
<xsl:value-of select="$max_word_length"/>
|
3016
|
+
</xsl:variable>
|
3017
|
+
<xsl:attribute name="width_min">
|
3018
|
+
<xsl:value-of select="$width_min"/>
|
3019
|
+
</xsl:attribute>
|
3020
|
+
<!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
|
3021
|
+
<xsl:if test="$width_min > $width_max">
|
3022
|
+
<xsl:attribute name="width_max">
|
3023
|
+
<xsl:value-of select="$width_min"/>
|
3024
|
+
</xsl:attribute>
|
3025
|
+
</xsl:if>
|
3026
|
+
<xsl:if test="$width_min = 0">
|
3027
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
3028
|
+
</xsl:if>
|
3029
|
+
|
3030
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths"/>
|
3031
|
+
|
3032
|
+
</xsl:copy>
|
3033
|
+
</xsl:template><xsl:template name="add_width">
|
3034
|
+
<xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
|
3035
|
+
<xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
|
3036
|
+
|
3037
|
+
<xsl:variable name="p_text_len">
|
3038
|
+
<xsl:choose>
|
3039
|
+
<xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
|
3040
|
+
<xsl:value-of select="$p_text_len_ * 1.5"/>
|
3041
|
+
</xsl:when>
|
3042
|
+
<xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
|
3043
|
+
</xsl:choose>
|
3044
|
+
</xsl:variable>
|
3045
|
+
|
3046
|
+
<xsl:variable name="math_addon_text">
|
3047
|
+
<xsl:for-each select=".//*[local-name() = 'math']">
|
3048
|
+
<xsl:apply-templates mode="td_text"/>
|
2635
3049
|
</xsl:for-each>
|
2636
3050
|
</xsl:variable>
|
3051
|
+
<xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
|
2637
3052
|
|
2638
|
-
<xsl:
|
2639
|
-
|
3053
|
+
<width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
|
3054
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
|
3055
|
+
<xsl:copy>
|
3056
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
|
3057
|
+
</xsl:copy>
|
3058
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
|
3059
|
+
<xsl:copy>
|
3060
|
+
<xsl:copy-of select="@*"/>
|
3061
|
+
|
3062
|
+
<!-- The maximum width is given by the widest line. -->
|
3063
|
+
<xsl:attribute name="width_max">
|
3064
|
+
<xsl:for-each select="p_len">
|
3065
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
3066
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
3067
|
+
</xsl:for-each>
|
3068
|
+
</xsl:attribute>
|
3069
|
+
|
3070
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
3071
|
+
<xsl:variable name="width_min">
|
3072
|
+
<xsl:for-each select="word_len">
|
3073
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
3074
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
3075
|
+
</xsl:for-each>
|
3076
|
+
</xsl:variable>
|
3077
|
+
<xsl:attribute name="width_min">
|
3078
|
+
<xsl:value-of select="$width_min"/>
|
3079
|
+
</xsl:attribute>
|
3080
|
+
|
3081
|
+
<xsl:if test="$width_min = 0">
|
3082
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
3083
|
+
</xsl:if>
|
3084
|
+
|
3085
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
|
3086
|
+
|
3087
|
+
</xsl:copy>
|
2640
3088
|
</xsl:template><xsl:template match="*[local-name()='thead']">
|
2641
3089
|
<xsl:param name="cols-count"/>
|
2642
3090
|
<fo:table-header>
|
@@ -2721,16 +3169,10 @@
|
|
2721
3169
|
</xsl:for-each>
|
2722
3170
|
</xsl:when>
|
2723
3171
|
<xsl:otherwise>
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
</xsl:when>
|
2729
|
-
<xsl:otherwise>
|
2730
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
2731
|
-
</xsl:otherwise>
|
2732
|
-
</xsl:choose>
|
2733
|
-
</xsl:for-each>
|
3172
|
+
<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
|
3173
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3174
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3175
|
+
</xsl:call-template>
|
2734
3176
|
</xsl:otherwise>
|
2735
3177
|
</xsl:choose>
|
2736
3178
|
|
@@ -2807,6 +3249,52 @@
|
|
2807
3249
|
|
2808
3250
|
</fo:table-body>
|
2809
3251
|
|
3252
|
+
</xsl:template><xsl:template match="/" mode="process_table-if">
|
3253
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
3254
|
+
<xsl:apply-templates mode="process_table-if">
|
3255
|
+
<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
|
3256
|
+
</xsl:apply-templates>
|
3257
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
|
3258
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
3259
|
+
|
3260
|
+
<fo:table-body>
|
3261
|
+
<xsl:for-each select="*[local-name() = 'tr']">
|
3262
|
+
<xsl:variable name="col_count" select="count(*)"/>
|
3263
|
+
|
3264
|
+
<!-- iteration for each tr/td -->
|
3265
|
+
|
3266
|
+
<xsl:choose>
|
3267
|
+
<xsl:when test="$table_or_dl = 'table'">
|
3268
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
|
3269
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
3270
|
+
<!-- <test_table><xsl:copy-of select="."/></test_table> -->
|
3271
|
+
<xsl:call-template name="td"/>
|
3272
|
+
</fo:table-row>
|
3273
|
+
</xsl:for-each>
|
3274
|
+
</xsl:when>
|
3275
|
+
<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
|
3276
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
|
3277
|
+
<xsl:variable name="is_dt" select="position() = 1"/>
|
3278
|
+
|
3279
|
+
<xsl:for-each select="*">
|
3280
|
+
<!-- <test><xsl:copy-of select="."/></test> -->
|
3281
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
3282
|
+
<xsl:choose>
|
3283
|
+
<xsl:when test="$is_dt">
|
3284
|
+
<xsl:call-template name="insert_dt_cell"/>
|
3285
|
+
</xsl:when>
|
3286
|
+
<xsl:otherwise>
|
3287
|
+
<xsl:call-template name="insert_dd_cell"/>
|
3288
|
+
</xsl:otherwise>
|
3289
|
+
</xsl:choose>
|
3290
|
+
</fo:table-row>
|
3291
|
+
</xsl:for-each>
|
3292
|
+
</xsl:for-each>
|
3293
|
+
</xsl:otherwise>
|
3294
|
+
</xsl:choose>
|
3295
|
+
|
3296
|
+
</xsl:for-each>
|
3297
|
+
</fo:table-body>
|
2810
3298
|
</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
2811
3299
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
2812
3300
|
|
@@ -2897,7 +3385,7 @@
|
|
2897
3385
|
</xsl:choose>
|
2898
3386
|
</xsl:attribute>
|
2899
3387
|
</xsl:if>
|
2900
|
-
</xsl:template><xsl:template match="*[local-name()='td']">
|
3388
|
+
</xsl:template><xsl:template match="*[local-name()='td']" name="td">
|
2901
3389
|
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
|
2902
3390
|
<xsl:call-template name="setTextAlignment">
|
2903
3391
|
<xsl:with-param name="default">left</xsl:with-param>
|
@@ -2931,11 +3419,24 @@
|
|
2931
3419
|
|
2932
3420
|
<xsl:call-template name="setTableCellAttributes"/>
|
2933
3421
|
|
3422
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3423
|
+
<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
|
3424
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
3425
|
+
</xsl:if>
|
3426
|
+
|
2934
3427
|
<fo:block>
|
2935
3428
|
|
3429
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3430
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
3431
|
+
</xsl:if>
|
3432
|
+
|
3433
|
+
|
2936
3434
|
|
2937
3435
|
|
2938
3436
|
<xsl:apply-templates/>
|
3437
|
+
|
3438
|
+
<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"/> -->
|
3439
|
+
|
2939
3440
|
</fo:block>
|
2940
3441
|
</fo:table-cell>
|
2941
3442
|
</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
|
@@ -3136,9 +3637,9 @@
|
|
3136
3637
|
<!-- current hierarchy is 'figure' element -->
|
3137
3638
|
<xsl:variable name="following_dl_colwidths">
|
3138
3639
|
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
3139
|
-
<xsl:variable name="
|
3140
|
-
<xsl:variable name="doc_ns">
|
3141
|
-
|
3640
|
+
<xsl:variable name="simple-table">
|
3641
|
+
<!-- <xsl:variable name="doc_ns">
|
3642
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
3142
3643
|
</xsl:variable>
|
3143
3644
|
<xsl:variable name="ns">
|
3144
3645
|
<xsl:choose>
|
@@ -3149,7 +3650,7 @@
|
|
3149
3650
|
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
3150
3651
|
</xsl:otherwise>
|
3151
3652
|
</xsl:choose>
|
3152
|
-
</xsl:variable>
|
3653
|
+
</xsl:variable> -->
|
3153
3654
|
|
3154
3655
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
3155
3656
|
<tbody>
|
@@ -3160,7 +3661,7 @@
|
|
3160
3661
|
|
3161
3662
|
<xsl:call-template name="calculate-column-widths">
|
3162
3663
|
<xsl:with-param name="cols-count" select="2"/>
|
3163
|
-
<xsl:with-param name="table" select="$
|
3664
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
3164
3665
|
</xsl:call-template>
|
3165
3666
|
|
3166
3667
|
</xsl:if>
|
@@ -3279,8 +3780,10 @@
|
|
3279
3780
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
3280
3781
|
</xsl:variable>
|
3281
3782
|
|
3783
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
3784
|
+
|
3282
3785
|
<xsl:choose>
|
3283
|
-
<xsl:when test="$
|
3786
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
3284
3787
|
|
3285
3788
|
<fo:block margin-bottom="12pt" text-align="left">
|
3286
3789
|
|
@@ -3295,7 +3798,7 @@
|
|
3295
3798
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
3296
3799
|
</fo:block>
|
3297
3800
|
|
3298
|
-
</xsl:when>
|
3801
|
+
</xsl:when> <!-- END: only one component -->
|
3299
3802
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
3300
3803
|
<fo:block margin-bottom="12pt" text-align="left">
|
3301
3804
|
|
@@ -3309,8 +3812,8 @@
|
|
3309
3812
|
</xsl:variable>
|
3310
3813
|
<xsl:value-of select="$title-where"/>
|
3311
3814
|
</fo:block>
|
3312
|
-
</xsl:when>
|
3313
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
3815
|
+
</xsl:when> <!-- END: a few components -->
|
3816
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
3314
3817
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
3315
3818
|
|
3316
3819
|
|
@@ -3323,11 +3826,11 @@
|
|
3323
3826
|
</xsl:variable>
|
3324
3827
|
<xsl:value-of select="$title-key"/>
|
3325
3828
|
</fo:block>
|
3326
|
-
</xsl:when>
|
3829
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
3327
3830
|
</xsl:choose>
|
3328
3831
|
|
3329
3832
|
<!-- a few components -->
|
3330
|
-
<xsl:if test="
|
3833
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
3331
3834
|
<fo:block>
|
3332
3835
|
|
3333
3836
|
|
@@ -3338,7 +3841,18 @@
|
|
3338
3841
|
|
3339
3842
|
|
3340
3843
|
|
3844
|
+
|
3845
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3846
|
+
<!-- to determine start of table -->
|
3847
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
3848
|
+
</xsl:if>
|
3849
|
+
|
3341
3850
|
<fo:table width="95%" table-layout="fixed">
|
3851
|
+
|
3852
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3853
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
3854
|
+
</xsl:if>
|
3855
|
+
|
3342
3856
|
|
3343
3857
|
<xsl:choose>
|
3344
3858
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
|
@@ -3347,54 +3861,143 @@
|
|
3347
3861
|
|
3348
3862
|
</xsl:when>
|
3349
3863
|
</xsl:choose>
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3864
|
+
|
3865
|
+
|
3866
|
+
<xsl:choose>
|
3867
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
3868
|
+
<!-- generate IF for table widths -->
|
3869
|
+
<!-- example:
|
3870
|
+
<tr>
|
3871
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
3872
|
+
<p>Symbol</p>
|
3873
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
3874
|
+
</td>
|
3875
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
3876
|
+
<p>Description</p>
|
3877
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
3878
|
+
</td>
|
3879
|
+
</tr>
|
3880
|
+
-->
|
3353
3881
|
|
3354
|
-
|
3355
|
-
|
3356
|
-
|
3357
|
-
<xsl:
|
3358
|
-
<
|
3359
|
-
|
3360
|
-
|
3361
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
|
3365
|
-
|
3366
|
-
|
3367
|
-
|
3368
|
-
|
3369
|
-
|
3370
|
-
|
3371
|
-
|
3372
|
-
|
3373
|
-
|
3374
|
-
|
3375
|
-
|
3376
|
-
|
3377
|
-
|
3378
|
-
|
3379
|
-
|
3380
|
-
|
3381
|
-
|
3382
|
-
|
3383
|
-
|
3384
|
-
|
3385
|
-
|
3386
|
-
|
3387
|
-
|
3388
|
-
|
3882
|
+
<!-- create virtual html table for dl/[dt and dd] -->
|
3883
|
+
<xsl:variable name="simple-table">
|
3884
|
+
|
3885
|
+
<xsl:variable name="dl_table">
|
3886
|
+
<tbody>
|
3887
|
+
<xsl:apply-templates mode="dl_if">
|
3888
|
+
<xsl:with-param name="id" select="@id"/>
|
3889
|
+
</xsl:apply-templates>
|
3890
|
+
</tbody>
|
3891
|
+
</xsl:variable>
|
3892
|
+
|
3893
|
+
<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
|
3894
|
+
|
3895
|
+
<!-- Step: replace <br/> to <p>...</p> -->
|
3896
|
+
<xsl:variable name="table_without_br">
|
3897
|
+
<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
|
3898
|
+
</xsl:variable>
|
3899
|
+
|
3900
|
+
<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
|
3901
|
+
|
3902
|
+
<!-- Step: add id to each cell -->
|
3903
|
+
<!-- add <word>...</word> for each word, image, math -->
|
3904
|
+
<xsl:variable name="simple-table-id">
|
3905
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
|
3906
|
+
<xsl:with-param name="id" select="@id"/>
|
3907
|
+
</xsl:apply-templates>
|
3908
|
+
</xsl:variable>
|
3909
|
+
|
3910
|
+
<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
|
3911
|
+
|
3912
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
3913
|
+
|
3914
|
+
</xsl:variable>
|
3915
|
+
|
3916
|
+
<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
|
3917
|
+
|
3918
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
|
3919
|
+
<xsl:with-param name="table_or_dl">dl</xsl:with-param>
|
3920
|
+
</xsl:apply-templates>
|
3921
|
+
|
3922
|
+
</xsl:when>
|
3923
|
+
<xsl:otherwise>
|
3924
|
+
|
3925
|
+
<xsl:variable name="simple-table">
|
3926
|
+
|
3927
|
+
<xsl:variable name="dl_table">
|
3928
|
+
<tbody>
|
3929
|
+
<xsl:apply-templates mode="dl">
|
3930
|
+
<xsl:with-param name="id" select="@id"/>
|
3931
|
+
</xsl:apply-templates>
|
3932
|
+
</tbody>
|
3933
|
+
</xsl:variable>
|
3934
|
+
|
3935
|
+
<xsl:copy-of select="$dl_table"/>
|
3936
|
+
</xsl:variable>
|
3937
|
+
|
3938
|
+
<xsl:variable name="colwidths">
|
3939
|
+
<xsl:call-template name="calculate-column-widths">
|
3940
|
+
<xsl:with-param name="cols-count" select="2"/>
|
3941
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
3942
|
+
</xsl:call-template>
|
3943
|
+
</xsl:variable>
|
3944
|
+
|
3945
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
3946
|
+
DEBUG
|
3947
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
3948
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
3949
|
+
|
3950
|
+
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
3951
|
+
|
3952
|
+
<xsl:variable name="maxlength_dt">
|
3953
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
3954
|
+
</xsl:variable>
|
3955
|
+
|
3956
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
3957
|
+
false
|
3958
|
+
</xsl:variable>
|
3959
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
3960
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
3961
|
+
|
3962
|
+
|
3963
|
+
<xsl:call-template name="setColumnWidth_dl">
|
3964
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3965
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
3966
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
3967
|
+
</xsl:call-template>
|
3968
|
+
|
3969
|
+
<fo:table-body>
|
3970
|
+
|
3971
|
+
<!-- DEBUG -->
|
3972
|
+
<xsl:if test="$table_if_debug = 'true'">
|
3973
|
+
<fo:table-row>
|
3974
|
+
<fo:table-cell number-columns-spanned="2" font-size="60%">
|
3975
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
3976
|
+
</fo:table-cell>
|
3977
|
+
</fo:table-row>
|
3978
|
+
</xsl:if>
|
3979
|
+
|
3980
|
+
<xsl:apply-templates>
|
3981
|
+
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
3982
|
+
<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
|
3983
|
+
</xsl:apply-templates>
|
3984
|
+
|
3985
|
+
</fo:table-body>
|
3986
|
+
</xsl:otherwise>
|
3987
|
+
</xsl:choose>
|
3389
3988
|
</fo:table>
|
3390
3989
|
</fo:block>
|
3391
3990
|
</fo:block>
|
3392
|
-
</xsl:if>
|
3991
|
+
</xsl:if> <!-- END: a few components -->
|
3393
3992
|
</fo:block-container>
|
3394
3993
|
</fo:block-container>
|
3395
3994
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
3396
3995
|
<xsl:param name="colwidths"/>
|
3397
3996
|
<xsl:param name="maxlength_dt"/>
|
3997
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
3998
|
+
|
3999
|
+
<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
|
4000
|
+
|
3398
4001
|
<xsl:choose>
|
3399
4002
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
3400
4003
|
<fo:table-column column-width="50%"/>
|
@@ -3402,6 +4005,16 @@
|
|
3402
4005
|
</xsl:when>
|
3403
4006
|
<xsl:otherwise>
|
3404
4007
|
<xsl:choose>
|
4008
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
4009
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4010
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4011
|
+
</xsl:call-template>
|
4012
|
+
</xsl:when>
|
4013
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
4014
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4015
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4016
|
+
</xsl:call-template>
|
4017
|
+
</xsl:when>
|
3405
4018
|
<!-- to set width check most wide chars like `W` -->
|
3406
4019
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
3407
4020
|
<fo:table-column column-width="7%"/>
|
@@ -3432,20 +4045,31 @@
|
|
3432
4045
|
<fo:table-column column-width="60%"/>
|
3433
4046
|
</xsl:when>
|
3434
4047
|
<xsl:otherwise>
|
3435
|
-
<xsl:
|
3436
|
-
<xsl:
|
3437
|
-
|
3438
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
3439
|
-
</xsl:when>
|
3440
|
-
<xsl:otherwise>
|
3441
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
3442
|
-
</xsl:otherwise>
|
3443
|
-
</xsl:choose>
|
3444
|
-
</xsl:for-each>
|
4048
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4049
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4050
|
+
</xsl:call-template>
|
3445
4051
|
</xsl:otherwise>
|
3446
4052
|
</xsl:choose>
|
3447
4053
|
</xsl:otherwise>
|
3448
4054
|
</xsl:choose>
|
4055
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
4056
|
+
<xsl:param name="colwidths"/>
|
4057
|
+
|
4058
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
4059
|
+
<xsl:choose>
|
4060
|
+
<xsl:when test=". = 1 or . = 0">
|
4061
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
4062
|
+
</xsl:when>
|
4063
|
+
<xsl:otherwise>
|
4064
|
+
<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
|
4065
|
+
<xsl:variable name="divider">
|
4066
|
+
<xsl:value-of select="@divider"/>
|
4067
|
+
<xsl:if test="not(@divider)">1</xsl:if>
|
4068
|
+
</xsl:variable>
|
4069
|
+
<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
|
4070
|
+
</xsl:otherwise>
|
4071
|
+
</xsl:choose>
|
4072
|
+
</xsl:for-each>
|
3449
4073
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
3450
4074
|
<xsl:variable name="lengths">
|
3451
4075
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -3469,7 +4093,6 @@
|
|
3469
4093
|
<xsl:value-of select="$maxLength"/>
|
3470
4094
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
3471
4095
|
<xsl:param name="key_iso"/>
|
3472
|
-
|
3473
4096
|
<!-- <tr>
|
3474
4097
|
<td>NOTE</td>
|
3475
4098
|
<td>
|
@@ -3477,27 +4100,47 @@
|
|
3477
4100
|
</td>
|
3478
4101
|
</tr>
|
3479
4102
|
-->
|
3480
|
-
|
4103
|
+
<!-- OLD Variant -->
|
4104
|
+
<!-- <fo:table-row>
|
3481
4105
|
<fo:table-cell>
|
3482
4106
|
<fo:block margin-top="6pt">
|
3483
4107
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3484
4108
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3485
4109
|
</xsl:if>
|
3486
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
4110
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
3487
4111
|
</fo:block>
|
3488
4112
|
</fo:table-cell>
|
3489
4113
|
<fo:table-cell>
|
3490
4114
|
<fo:block>
|
3491
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
4115
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
4116
|
+
</fo:block>
|
4117
|
+
</fo:table-cell>
|
4118
|
+
</fo:table-row> -->
|
4119
|
+
<!-- <tr>
|
4120
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
4121
|
+
</tr>
|
4122
|
+
-->
|
4123
|
+
<fo:table-row>
|
4124
|
+
<fo:table-cell number-columns-spanned="2">
|
4125
|
+
<fo:block>
|
4126
|
+
<xsl:call-template name="note"/>
|
3492
4127
|
</fo:block>
|
3493
4128
|
</fo:table-cell>
|
3494
4129
|
</fo:table-row>
|
3495
4130
|
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
|
4131
|
+
<xsl:param name="id"/>
|
4132
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
3496
4133
|
<tr>
|
3497
4134
|
<td>
|
4135
|
+
<xsl:attribute name="id">
|
4136
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
|
4137
|
+
</xsl:attribute>
|
3498
4138
|
<xsl:apply-templates/>
|
3499
4139
|
</td>
|
3500
4140
|
<td>
|
4141
|
+
<xsl:attribute name="id">
|
4142
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
|
4143
|
+
</xsl:attribute>
|
3501
4144
|
|
3502
4145
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
3503
4146
|
<xsl:with-param name="process">true</xsl:with-param>
|
@@ -3508,50 +4151,122 @@
|
|
3508
4151
|
|
3509
4152
|
</xsl:template><xsl:template match="*[local-name()='dt']">
|
3510
4153
|
<xsl:param name="key_iso"/>
|
4154
|
+
<xsl:param name="split_keep-within-line"/>
|
3511
4155
|
|
3512
4156
|
<fo:table-row xsl:use-attribute-sets="dt-row-style">
|
3513
|
-
<
|
4157
|
+
<xsl:call-template name="insert_dt_cell">
|
4158
|
+
<xsl:with-param name="key_iso" select="$key_iso"/>
|
4159
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4160
|
+
</xsl:call-template>
|
4161
|
+
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
|
4162
|
+
<xsl:call-template name="insert_dd_cell">
|
4163
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4164
|
+
</xsl:call-template>
|
4165
|
+
</xsl:for-each>
|
4166
|
+
</fo:table-row>
|
4167
|
+
</xsl:template><xsl:template name="insert_dt_cell">
|
4168
|
+
<xsl:param name="key_iso"/>
|
4169
|
+
<xsl:param name="split_keep-within-line"/>
|
4170
|
+
<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
|
4171
|
+
|
4172
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4173
|
+
<!-- border is mandatory, to calculate real width -->
|
4174
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
4175
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
4176
|
+
</xsl:if>
|
4177
|
+
|
4178
|
+
|
4179
|
+
<fo:block xsl:use-attribute-sets="dt-block-style">
|
4180
|
+
<xsl:copy-of select="@id"/>
|
4181
|
+
|
4182
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4183
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
4184
|
+
</xsl:if>
|
4185
|
+
|
4186
|
+
|
4187
|
+
|
4188
|
+
<xsl:apply-templates>
|
4189
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4190
|
+
</xsl:apply-templates>
|
4191
|
+
|
4192
|
+
<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"/> -->
|
4193
|
+
|
4194
|
+
</fo:block>
|
4195
|
+
</fo:table-cell>
|
4196
|
+
</xsl:template><xsl:template name="insert_dd_cell">
|
4197
|
+
<xsl:param name="split_keep-within-line"/>
|
4198
|
+
<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
|
4199
|
+
|
4200
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4201
|
+
<!-- border is mandatory, to calculate real width -->
|
4202
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
4203
|
+
</xsl:if>
|
4204
|
+
|
4205
|
+
<fo:block>
|
4206
|
+
|
4207
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4208
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
4209
|
+
</xsl:if>
|
4210
|
+
|
3514
4211
|
|
3515
|
-
<fo:block xsl:use-attribute-sets="dt-style">
|
3516
|
-
<xsl:copy-of select="@id"/>
|
3517
|
-
|
3518
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3519
|
-
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3520
|
-
</xsl:if>
|
3521
|
-
|
3522
|
-
|
3523
|
-
|
3524
|
-
<xsl:apply-templates/>
|
3525
|
-
</fo:block>
|
3526
|
-
</fo:table-cell>
|
3527
|
-
<fo:table-cell>
|
3528
|
-
<fo:block>
|
3529
|
-
|
3530
4212
|
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3535
|
-
|
3536
|
-
|
4213
|
+
<xsl:choose>
|
4214
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
4215
|
+
<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
|
4216
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
4217
|
+
</xsl:apply-templates>
|
4218
|
+
</xsl:when>
|
4219
|
+
<xsl:otherwise>
|
4220
|
+
<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
|
4221
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
4222
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4223
|
+
</xsl:apply-templates>
|
4224
|
+
</xsl:otherwise>
|
4225
|
+
|
4226
|
+
</xsl:choose>
|
4227
|
+
|
4228
|
+
<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"/> -->
|
4229
|
+
|
4230
|
+
</fo:block>
|
4231
|
+
</fo:table-cell>
|
3537
4232
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
3538
4233
|
<xsl:apply-templates/>
|
3539
4234
|
</xsl:template><xsl:template match="*[local-name()='dd']">
|
3540
4235
|
<xsl:param name="process">false</xsl:param>
|
4236
|
+
<xsl:param name="split_keep-within-line"/>
|
3541
4237
|
<xsl:if test="$process = 'true'">
|
3542
4238
|
<xsl:apply-templates select="@language"/>
|
3543
|
-
<xsl:apply-templates
|
4239
|
+
<xsl:apply-templates>
|
4240
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4241
|
+
</xsl:apply-templates>
|
3544
4242
|
</xsl:if>
|
3545
4243
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
3546
4244
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
3547
|
-
</xsl:template><xsl:template match="*[local-name()='
|
4245
|
+
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
|
4246
|
+
<xsl:param name="id"/>
|
4247
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
4248
|
+
<tr>
|
4249
|
+
<td>
|
4250
|
+
<xsl:copy-of select="node()"/>
|
4251
|
+
</td>
|
4252
|
+
<td>
|
4253
|
+
|
4254
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
|
4255
|
+
|
4256
|
+
</td>
|
4257
|
+
</tr>
|
4258
|
+
|
4259
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
|
3548
4260
|
<fo:inline font-style="italic">
|
3549
4261
|
<xsl:apply-templates/>
|
3550
4262
|
</fo:inline>
|
3551
4263
|
</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
|
4264
|
+
<xsl:param name="split_keep-within-line"/>
|
3552
4265
|
<fo:inline font-weight="bold">
|
3553
4266
|
|
3554
|
-
<xsl:apply-templates
|
4267
|
+
<xsl:apply-templates>
|
4268
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4269
|
+
</xsl:apply-templates>
|
3555
4270
|
</fo:inline>
|
3556
4271
|
</xsl:template><xsl:template match="*[local-name()='padding']">
|
3557
4272
|
<fo:inline padding-right="{@value}"> </fo:inline>
|
@@ -3590,13 +4305,15 @@
|
|
3590
4305
|
<xsl:choose>
|
3591
4306
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
3592
4307
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
3593
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
4308
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
3594
4309
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
3595
4310
|
</xsl:choose>
|
3596
4311
|
</xsl:attribute>
|
3597
4312
|
</xsl:if>
|
3598
4313
|
<xsl:apply-templates/>
|
3599
4314
|
</fo:inline>
|
4315
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
4316
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
3600
4317
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
3601
4318
|
<fo:inline text-decoration="underline">
|
3602
4319
|
<xsl:apply-templates/>
|
@@ -3744,54 +4461,120 @@
|
|
3744
4461
|
<fo:block break-after="page"/>
|
3745
4462
|
<fo:block> </fo:block>
|
3746
4463
|
<fo:block break-after="page"/>
|
4464
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
4465
|
+
<xsl:apply-templates/>
|
3747
4466
|
</xsl:template><xsl:template name="tokenize">
|
3748
4467
|
<xsl:param name="text"/>
|
3749
4468
|
<xsl:param name="separator" select="' '"/>
|
3750
4469
|
<xsl:choose>
|
4470
|
+
|
4471
|
+
<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
|
4472
|
+
<word><xsl:value-of select="normalize-space($text)"/></word>
|
4473
|
+
</xsl:when>
|
3751
4474
|
<xsl:when test="not(contains($text, $separator))">
|
3752
4475
|
<word>
|
3753
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
3754
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
3755
4476
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
3756
|
-
<xsl:variable name="len_str">
|
3757
|
-
<xsl:choose>
|
3758
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
3759
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
3760
|
-
</xsl:when>
|
3761
|
-
<xsl:otherwise>
|
3762
|
-
<xsl:value-of select="$len_str_tmp"/>
|
3763
|
-
</xsl:otherwise>
|
3764
|
-
</xsl:choose>
|
3765
|
-
</xsl:variable>
|
3766
|
-
|
3767
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
3768
|
-
<xsl:message>
|
3769
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
3770
|
-
len_str=<xsl:value-of select="$len_str"/>
|
3771
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
3772
|
-
</xsl:message>
|
3773
|
-
</xsl:if> -->
|
3774
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
3775
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
3776
4477
|
<xsl:choose>
|
3777
|
-
<xsl:when test="$
|
3778
|
-
<xsl:value-of select="$
|
4478
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
4479
|
+
<xsl:value-of select="$len_str_tmp"/>
|
3779
4480
|
</xsl:when>
|
3780
4481
|
<xsl:otherwise>
|
3781
|
-
<xsl:
|
4482
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
4483
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
4484
|
+
<xsl:variable name="len_str">
|
4485
|
+
<xsl:choose>
|
4486
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
4487
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
4488
|
+
</xsl:when>
|
4489
|
+
<xsl:otherwise>
|
4490
|
+
<xsl:value-of select="$len_str_tmp"/>
|
4491
|
+
</xsl:otherwise>
|
4492
|
+
</xsl:choose>
|
4493
|
+
</xsl:variable>
|
4494
|
+
|
4495
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
4496
|
+
<xsl:message>
|
4497
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
4498
|
+
len_str=<xsl:value-of select="$len_str"/>
|
4499
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
4500
|
+
</xsl:message>
|
4501
|
+
</xsl:if> -->
|
4502
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
4503
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
4504
|
+
<xsl:choose>
|
4505
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
4506
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
4507
|
+
</xsl:when>
|
4508
|
+
<xsl:otherwise>
|
4509
|
+
<xsl:value-of select="$len_str"/>
|
4510
|
+
</xsl:otherwise>
|
4511
|
+
</xsl:choose>
|
3782
4512
|
</xsl:otherwise>
|
3783
4513
|
</xsl:choose>
|
3784
4514
|
</word>
|
3785
4515
|
</xsl:when>
|
3786
4516
|
<xsl:otherwise>
|
3787
4517
|
<word>
|
3788
|
-
<xsl:
|
4518
|
+
<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
|
4519
|
+
<xsl:choose>
|
4520
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
4521
|
+
<xsl:value-of select="$word"/>
|
4522
|
+
</xsl:when>
|
4523
|
+
<xsl:otherwise>
|
4524
|
+
<xsl:value-of select="string-length($word)"/>
|
4525
|
+
</xsl:otherwise>
|
4526
|
+
</xsl:choose>
|
3789
4527
|
</word>
|
3790
4528
|
<xsl:call-template name="tokenize">
|
3791
4529
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
3792
4530
|
</xsl:call-template>
|
3793
4531
|
</xsl:otherwise>
|
3794
4532
|
</xsl:choose>
|
4533
|
+
</xsl:template><xsl:template name="tokenize_with_tags">
|
4534
|
+
<xsl:param name="tags"/>
|
4535
|
+
<xsl:param name="text"/>
|
4536
|
+
<xsl:param name="separator" select="' '"/>
|
4537
|
+
<xsl:choose>
|
4538
|
+
|
4539
|
+
<xsl:when test="not(contains($text, $separator))">
|
4540
|
+
<word>
|
4541
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4542
|
+
<xsl:with-param name="text" select="normalize-space($text)"/>
|
4543
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4544
|
+
</xsl:call-template>
|
4545
|
+
</word>
|
4546
|
+
</xsl:when>
|
4547
|
+
<xsl:otherwise>
|
4548
|
+
<word>
|
4549
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4550
|
+
<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
|
4551
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4552
|
+
</xsl:call-template>
|
4553
|
+
</word>
|
4554
|
+
<xsl:call-template name="tokenize_with_tags">
|
4555
|
+
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
4556
|
+
</xsl:call-template>
|
4557
|
+
</xsl:otherwise>
|
4558
|
+
</xsl:choose>
|
4559
|
+
</xsl:template><xsl:template name="enclose_text_in_tags">
|
4560
|
+
<xsl:param name="text"/>
|
4561
|
+
<xsl:param name="tags"/>
|
4562
|
+
<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
|
4563
|
+
|
4564
|
+
<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
|
4565
|
+
|
4566
|
+
<xsl:choose>
|
4567
|
+
<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
|
4568
|
+
<xsl:otherwise>
|
4569
|
+
<xsl:element name="{$tag_name}">
|
4570
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4571
|
+
<xsl:with-param name="text" select="$text"/>
|
4572
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4573
|
+
<xsl:with-param name="num" select="$num + 1"/>
|
4574
|
+
</xsl:call-template>
|
4575
|
+
</xsl:element>
|
4576
|
+
</xsl:otherwise>
|
4577
|
+
</xsl:choose>
|
3795
4578
|
</xsl:template><xsl:template name="max_length">
|
3796
4579
|
<xsl:param name="words"/>
|
3797
4580
|
<xsl:for-each select="$words//word">
|
@@ -3864,36 +4647,47 @@
|
|
3864
4647
|
</xsl:template><xsl:template name="add-zero-spaces-equal">
|
3865
4648
|
<xsl:param name="text" select="."/>
|
3866
4649
|
<xsl:variable name="zero-space-after-equals">==========</xsl:variable>
|
4650
|
+
<xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
|
3867
4651
|
<xsl:variable name="zero-space-after-equal">=</xsl:variable>
|
4652
|
+
<xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
|
3868
4653
|
<xsl:variable name="zero-space"></xsl:variable>
|
3869
4654
|
<xsl:choose>
|
3870
4655
|
<xsl:when test="contains($text, $zero-space-after-equals)">
|
3871
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
4656
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
|
3872
4657
|
<xsl:value-of select="$zero-space-after-equals"/>
|
3873
4658
|
<xsl:value-of select="$zero-space"/>
|
3874
4659
|
<xsl:call-template name="add-zero-spaces-equal">
|
3875
4660
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
|
3876
|
-
</xsl:call-template>
|
4661
|
+
</xsl:call-template> -->
|
4662
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
|
3877
4663
|
</xsl:when>
|
3878
4664
|
<xsl:when test="contains($text, $zero-space-after-equal)">
|
3879
|
-
<xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
4665
|
+
<!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
|
3880
4666
|
<xsl:value-of select="$zero-space-after-equal"/>
|
3881
4667
|
<xsl:value-of select="$zero-space"/>
|
3882
4668
|
<xsl:call-template name="add-zero-spaces-equal">
|
3883
4669
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
|
3884
|
-
</xsl:call-template>
|
4670
|
+
</xsl:call-template> -->
|
4671
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
|
3885
4672
|
</xsl:when>
|
3886
4673
|
<xsl:otherwise>
|
3887
4674
|
<xsl:value-of select="$text"/>
|
3888
4675
|
</xsl:otherwise>
|
3889
4676
|
</xsl:choose>
|
3890
4677
|
</xsl:template><xsl:template name="getSimpleTable">
|
4678
|
+
<xsl:param name="id"/>
|
4679
|
+
|
3891
4680
|
<xsl:variable name="simple-table">
|
3892
4681
|
|
4682
|
+
<!-- Step 0. replace <br/> to <p>...</p> -->
|
4683
|
+
<xsl:variable name="table_without_br">
|
4684
|
+
<xsl:apply-templates mode="table-without-br"/>
|
4685
|
+
</xsl:variable>
|
4686
|
+
|
3893
4687
|
<!-- Step 1. colspan processing -->
|
3894
4688
|
<xsl:variable name="simple-table-colspan">
|
3895
4689
|
<tbody>
|
3896
|
-
<xsl:apply-templates mode="simple-table-colspan"/>
|
4690
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
|
3897
4691
|
</tbody>
|
3898
4692
|
</xsl:variable>
|
3899
4693
|
|
@@ -3902,10 +4696,67 @@
|
|
3902
4696
|
<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
|
3903
4697
|
</xsl:variable>
|
3904
4698
|
|
3905
|
-
|
3906
|
-
|
4699
|
+
<!-- Step 3: add id to each cell -->
|
4700
|
+
<!-- add <word>...</word> for each word, image, math -->
|
4701
|
+
<xsl:variable name="simple-table-id">
|
4702
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
|
4703
|
+
<xsl:with-param name="id" select="$id"/>
|
4704
|
+
</xsl:apply-templates>
|
4705
|
+
</xsl:variable>
|
4706
|
+
|
4707
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
4708
|
+
|
3907
4709
|
</xsl:variable>
|
3908
4710
|
<xsl:copy-of select="$simple-table"/>
|
4711
|
+
</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
|
4712
|
+
<xsl:copy>
|
4713
|
+
<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
|
4714
|
+
</xsl:copy>
|
4715
|
+
</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">
|
4716
|
+
<xsl:copy>
|
4717
|
+
<xsl:copy-of select="@*"/>
|
4718
|
+
<p>
|
4719
|
+
<xsl:copy-of select="node()"/>
|
4720
|
+
</p>
|
4721
|
+
</xsl:copy>
|
4722
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
|
4723
|
+
<xsl:copy>
|
4724
|
+
<xsl:copy-of select="@*"/>
|
4725
|
+
<xsl:for-each select="*[local-name()='br']">
|
4726
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
4727
|
+
<p>
|
4728
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
4729
|
+
<xsl:copy-of select="."/>
|
4730
|
+
</xsl:for-each>
|
4731
|
+
</p>
|
4732
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
4733
|
+
<p>
|
4734
|
+
<xsl:for-each select="following-sibling::node()">
|
4735
|
+
<xsl:copy-of select="."/>
|
4736
|
+
</xsl:for-each>
|
4737
|
+
</p>
|
4738
|
+
</xsl:if>
|
4739
|
+
</xsl:for-each>
|
4740
|
+
</xsl:copy>
|
4741
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
|
4742
|
+
<xsl:for-each select="*[local-name()='br']">
|
4743
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
4744
|
+
<p>
|
4745
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
4746
|
+
<xsl:copy-of select="."/>
|
4747
|
+
</xsl:for-each>
|
4748
|
+
</p>
|
4749
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
4750
|
+
<p>
|
4751
|
+
<xsl:for-each select="following-sibling::node()">
|
4752
|
+
<xsl:copy-of select="."/>
|
4753
|
+
</xsl:for-each>
|
4754
|
+
</p>
|
4755
|
+
</xsl:if>
|
4756
|
+
</xsl:for-each>
|
4757
|
+
</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
4758
|
+
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
4759
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
3909
4760
|
</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
|
3910
4761
|
<xsl:apply-templates mode="simple-table-colspan"/>
|
3911
4762
|
</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">
|
@@ -3954,47 +4805,167 @@
|
|
3954
4805
|
<xsl:copy>
|
3955
4806
|
<xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
|
3956
4807
|
</xsl:copy>
|
3957
|
-
</xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
|
4808
|
+
</xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
|
4809
|
+
<xsl:copy>
|
4810
|
+
<xsl:copy-of select="tr[1]"/>
|
4811
|
+
<xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
|
4812
|
+
<xsl:with-param name="previousRow" select="tr[1]"/>
|
4813
|
+
</xsl:apply-templates>
|
4814
|
+
</xsl:copy>
|
4815
|
+
</xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
|
4816
|
+
<xsl:param name="previousRow"/>
|
4817
|
+
<xsl:variable name="currentRow" select="."/>
|
4818
|
+
|
4819
|
+
<xsl:variable name="normalizedTDs">
|
4820
|
+
<xsl:for-each select="xalan:nodeset($previousRow)//td">
|
4821
|
+
<xsl:choose>
|
4822
|
+
<xsl:when test="@rowspan > 1">
|
4823
|
+
<xsl:copy>
|
4824
|
+
<xsl:attribute name="rowspan">
|
4825
|
+
<xsl:value-of select="@rowspan - 1"/>
|
4826
|
+
</xsl:attribute>
|
4827
|
+
<xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
|
4828
|
+
<xsl:copy-of select="node()"/>
|
4829
|
+
</xsl:copy>
|
4830
|
+
</xsl:when>
|
4831
|
+
<xsl:otherwise>
|
4832
|
+
<xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
|
4833
|
+
</xsl:otherwise>
|
4834
|
+
</xsl:choose>
|
4835
|
+
</xsl:for-each>
|
4836
|
+
</xsl:variable>
|
4837
|
+
|
4838
|
+
<xsl:variable name="newRow">
|
4839
|
+
<xsl:copy>
|
4840
|
+
<xsl:copy-of select="$currentRow/@*"/>
|
4841
|
+
<xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
|
4842
|
+
</xsl:copy>
|
4843
|
+
</xsl:variable>
|
4844
|
+
<xsl:copy-of select="$newRow"/>
|
4845
|
+
|
4846
|
+
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
4847
|
+
<xsl:with-param name="previousRow" select="$newRow"/>
|
4848
|
+
</xsl:apply-templates>
|
4849
|
+
</xsl:template><xsl:template match="/" mode="simple-table-id">
|
4850
|
+
<xsl:param name="id"/>
|
4851
|
+
<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
|
4852
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
4853
|
+
<xsl:with-param name="id" select="$id_prefixed"/>
|
4854
|
+
</xsl:apply-templates>
|
4855
|
+
</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
|
4856
|
+
<xsl:param name="id"/>
|
4857
|
+
<xsl:copy>
|
4858
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
4859
|
+
<xsl:with-param name="id" select="$id"/>
|
4860
|
+
</xsl:apply-templates>
|
4861
|
+
</xsl:copy>
|
4862
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
|
4863
|
+
<xsl:param name="id"/>
|
4864
|
+
<xsl:copy>
|
4865
|
+
<xsl:copy-of select="@*"/>
|
4866
|
+
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
|
4867
|
+
<xsl:apply-templates select="node()" mode="simple-table-id">
|
4868
|
+
<xsl:with-param name="id" select="$id"/>
|
4869
|
+
</xsl:apply-templates>
|
4870
|
+
</xsl:copy>
|
4871
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
|
4872
|
+
<xsl:param name="id"/>
|
4873
|
+
<xsl:copy>
|
4874
|
+
<xsl:copy-of select="@*"/>
|
4875
|
+
<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
|
4876
|
+
<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
|
4877
|
+
<xsl:attribute name="id">
|
4878
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
|
4879
|
+
</xsl:attribute>
|
4880
|
+
|
4881
|
+
<xsl:for-each select="*[local-name() = 'p']">
|
4882
|
+
<xsl:copy>
|
4883
|
+
<xsl:copy-of select="@*"/>
|
4884
|
+
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
4885
|
+
<xsl:attribute name="id">
|
4886
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
|
4887
|
+
</xsl:attribute>
|
4888
|
+
|
4889
|
+
<xsl:copy-of select="node()"/>
|
4890
|
+
</xsl:copy>
|
4891
|
+
</xsl:for-each>
|
4892
|
+
|
4893
|
+
|
4894
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
|
4895
|
+
|
4896
|
+
<xsl:variable name="td_text">
|
4897
|
+
<xsl:apply-templates select="." mode="td_text_with_formatting"/>
|
4898
|
+
</xsl:variable>
|
4899
|
+
|
4900
|
+
<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
|
4901
|
+
|
4902
|
+
<xsl:variable name="words">
|
4903
|
+
<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
|
4904
|
+
<word>
|
4905
|
+
<xsl:copy-of select="."/>
|
4906
|
+
</word>
|
4907
|
+
</xsl:for-each>
|
4908
|
+
|
4909
|
+
<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
|
4910
|
+
<xsl:copy-of select="."/>
|
4911
|
+
</xsl:for-each>
|
4912
|
+
|
4913
|
+
</xsl:variable>
|
4914
|
+
|
4915
|
+
<xsl:for-each select="xalan:nodeset($words)/word">
|
4916
|
+
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
4917
|
+
<xsl:copy>
|
4918
|
+
<xsl:attribute name="id">
|
4919
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
|
4920
|
+
</xsl:attribute>
|
4921
|
+
<xsl:copy-of select="node()"/>
|
4922
|
+
</xsl:copy>
|
4923
|
+
</xsl:for-each>
|
4924
|
+
</xsl:if>
|
4925
|
+
</xsl:copy>
|
4926
|
+
|
4927
|
+
</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
|
3958
4928
|
<xsl:copy>
|
3959
|
-
<xsl:
|
3960
|
-
<xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
|
3961
|
-
<xsl:with-param name="previousRow" select="tr[1]"/>
|
3962
|
-
</xsl:apply-templates>
|
4929
|
+
<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
|
3963
4930
|
</xsl:copy>
|
3964
|
-
</xsl:template><xsl:template match="
|
3965
|
-
<xsl:
|
3966
|
-
|
3967
|
-
|
3968
|
-
<xsl:variable name="normalizedTDs">
|
3969
|
-
<xsl:for-each select="xalan:nodeset($previousRow)//td">
|
3970
|
-
<xsl:choose>
|
3971
|
-
<xsl:when test="@rowspan > 1">
|
3972
|
-
<xsl:copy>
|
3973
|
-
<xsl:attribute name="rowspan">
|
3974
|
-
<xsl:value-of select="@rowspan - 1"/>
|
3975
|
-
</xsl:attribute>
|
3976
|
-
<xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
|
3977
|
-
<xsl:copy-of select="node()"/>
|
3978
|
-
</xsl:copy>
|
3979
|
-
</xsl:when>
|
3980
|
-
<xsl:otherwise>
|
3981
|
-
<xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
|
3982
|
-
</xsl:otherwise>
|
3983
|
-
</xsl:choose>
|
3984
|
-
</xsl:for-each>
|
4931
|
+
</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">
|
4932
|
+
<xsl:variable name="formatting_tags">
|
4933
|
+
<xsl:call-template name="getFormattingTags"/>
|
3985
4934
|
</xsl:variable>
|
3986
|
-
|
3987
|
-
|
3988
|
-
<xsl:
|
3989
|
-
|
3990
|
-
|
3991
|
-
|
4935
|
+
<word>
|
4936
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4937
|
+
<xsl:with-param name="text" select="normalize-space(.)"/>
|
4938
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
4939
|
+
</xsl:call-template>
|
4940
|
+
</word>
|
4941
|
+
</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
4942
|
+
|
4943
|
+
<xsl:variable name="td_text" select="."/>
|
4944
|
+
|
4945
|
+
<xsl:variable name="string_with_added_zerospaces">
|
4946
|
+
<xsl:call-template name="add-zero-spaces-java">
|
4947
|
+
<xsl:with-param name="text" select="$td_text"/>
|
4948
|
+
</xsl:call-template>
|
3992
4949
|
</xsl:variable>
|
3993
|
-
|
3994
|
-
|
3995
|
-
|
3996
|
-
|
3997
|
-
|
4950
|
+
|
4951
|
+
<xsl:variable name="formatting_tags">
|
4952
|
+
<xsl:call-template name="getFormattingTags"/>
|
4953
|
+
</xsl:variable>
|
4954
|
+
|
4955
|
+
<!-- <word>text</word> -->
|
4956
|
+
<xsl:call-template name="tokenize_with_tags">
|
4957
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
4958
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
4959
|
+
</xsl:call-template>
|
4960
|
+
</xsl:template><xsl:template name="getFormattingTags">
|
4961
|
+
<tags>
|
4962
|
+
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
4963
|
+
<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
|
4964
|
+
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
4965
|
+
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
4966
|
+
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
4967
|
+
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
4968
|
+
</tags>
|
3998
4969
|
</xsl:template><xsl:template name="getLang">
|
3999
4970
|
<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
|
4000
4971
|
<xsl:variable name="language">
|
@@ -4049,6 +5020,9 @@
|
|
4049
5020
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
4050
5021
|
|
4051
5022
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
5023
|
+
|
5024
|
+
|
5025
|
+
|
4052
5026
|
|
4053
5027
|
|
4054
5028
|
<xsl:call-template name="setTrackChangesStyles">
|
@@ -4056,48 +5030,80 @@
|
|
4056
5030
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
4057
5031
|
</xsl:call-template>
|
4058
5032
|
|
5033
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
5034
|
+
<!-- insert helper tag -->
|
5035
|
+
<!-- set unique font-size (fiction) -->
|
5036
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
5037
|
+
<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 -->
|
5038
|
+
</xsl:if>
|
4059
5039
|
|
4060
|
-
|
4061
|
-
|
4062
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
5040
|
+
<xsl:variable name="mathml_content">
|
5041
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
4063
5042
|
</xsl:variable>
|
4064
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
4065
5043
|
|
5044
|
+
|
5045
|
+
<xsl:call-template name="mathml_instream_object">
|
5046
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
5047
|
+
</xsl:call-template>
|
4066
5048
|
|
4067
|
-
|
4068
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
4069
|
-
<xsl:variable name="comment_text_">
|
4070
|
-
<xsl:choose>
|
4071
|
-
<xsl:when test="normalize-space($comment_text_following) != ''">
|
4072
|
-
<xsl:value-of select="$comment_text_following"/>
|
4073
|
-
</xsl:when>
|
4074
|
-
<xsl:otherwise>
|
4075
|
-
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
4076
|
-
</xsl:otherwise>
|
4077
|
-
</xsl:choose>
|
4078
|
-
</xsl:variable>
|
4079
|
-
<xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
4080
|
-
|
4081
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
4082
|
-
<!-- put Mathin Alternate Text -->
|
4083
|
-
<xsl:attribute name="fox:alt-text">
|
4084
|
-
<xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
|
4085
|
-
</xsl:attribute>
|
4086
|
-
</xsl:if>
|
4087
|
-
|
4088
|
-
<xsl:variable name="mathml_content">
|
4089
|
-
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
4090
|
-
</xsl:variable>
|
4091
|
-
<!-- put MathML in Actual Text -->
|
4092
|
-
<xsl:attribute name="fox:actual-text">
|
4093
|
-
<xsl:value-of select="$mathml_content"/>
|
4094
|
-
</xsl:attribute>
|
4095
|
-
|
4096
|
-
|
4097
|
-
|
4098
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
4099
|
-
</fo:instream-foreign-object>
|
5049
|
+
|
4100
5050
|
</fo:inline>
|
5051
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
5052
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
5053
|
+
<xsl:variable name="comment_text_">
|
5054
|
+
<xsl:choose>
|
5055
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
5056
|
+
<xsl:value-of select="$comment_text_following"/>
|
5057
|
+
</xsl:when>
|
5058
|
+
<xsl:otherwise>
|
5059
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
5060
|
+
</xsl:otherwise>
|
5061
|
+
</xsl:choose>
|
5062
|
+
</xsl:variable>
|
5063
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
5064
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
5065
|
+
<xsl:value-of select="$comment_text"/>
|
5066
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
5067
|
+
<xsl:param name="comment_text"/>
|
5068
|
+
<xsl:param name="mathml_content"/>
|
5069
|
+
|
5070
|
+
<xsl:variable name="comment_text_">
|
5071
|
+
<xsl:choose>
|
5072
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
5073
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
5074
|
+
</xsl:choose>
|
5075
|
+
</xsl:variable>
|
5076
|
+
|
5077
|
+
<xsl:variable name="mathml">
|
5078
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
5079
|
+
</xsl:variable>
|
5080
|
+
|
5081
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
5082
|
+
|
5083
|
+
|
5084
|
+
|
5085
|
+
|
5086
|
+
|
5087
|
+
|
5088
|
+
|
5089
|
+
<!-- put MathML in Actual Text -->
|
5090
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
5091
|
+
<xsl:attribute name="fox:actual-text">
|
5092
|
+
<xsl:value-of select="$mathml_content"/>
|
5093
|
+
</xsl:attribute>
|
5094
|
+
|
5095
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
5096
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
5097
|
+
<!-- put Mathin Alternate Text -->
|
5098
|
+
<xsl:attribute name="fox:alt-text">
|
5099
|
+
<xsl:value-of select="$comment_text_"/>
|
5100
|
+
</xsl:attribute>
|
5101
|
+
</xsl:if>
|
5102
|
+
<!-- </xsl:if> -->
|
5103
|
+
|
5104
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
5105
|
+
|
5106
|
+
</fo:instream-foreign-object>
|
4101
5107
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
4102
5108
|
<!-- <xsl:text>a+b</xsl:text> -->
|
4103
5109
|
<xsl:text><</xsl:text>
|
@@ -4128,7 +5134,9 @@
|
|
4128
5134
|
<!-- replace start and end spaces to non-break space -->
|
4129
5135
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
4130
5136
|
</xsl:copy>
|
4131
|
-
</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="
|
5137
|
+
</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">
|
5138
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
5139
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
4132
5140
|
<xsl:variable name="target">
|
4133
5141
|
<xsl:choose>
|
4134
5142
|
<xsl:when test="@updatetype = 'true'">
|
@@ -4371,7 +5379,12 @@
|
|
4371
5379
|
|
4372
5380
|
<fo:inline xsl:use-attribute-sets="termnote-name-style">
|
4373
5381
|
|
5382
|
+
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
|
5383
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
5384
|
+
</xsl:if>
|
5385
|
+
|
4374
5386
|
|
5387
|
+
|
4375
5388
|
|
4376
5389
|
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
|
4377
5390
|
<!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
|
@@ -4732,18 +5745,33 @@
|
|
4732
5745
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
4733
5746
|
<xsl:copy>
|
4734
5747
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
4735
|
-
<xsl:variable name="
|
5748
|
+
<xsl:variable name="viewbox_">
|
4736
5749
|
<xsl:call-template name="split">
|
4737
5750
|
<xsl:with-param name="pText" select="@viewBox"/>
|
4738
5751
|
<xsl:with-param name="sep" select="' '"/>
|
4739
5752
|
</xsl:call-template>
|
4740
5753
|
</xsl:variable>
|
5754
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
5755
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
5756
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
5757
|
+
|
4741
5758
|
<xsl:attribute name="width">
|
4742
|
-
<xsl:
|
5759
|
+
<xsl:choose>
|
5760
|
+
<xsl:when test="$width != ''">
|
5761
|
+
<xsl:value-of select="round($width)"/>
|
5762
|
+
</xsl:when>
|
5763
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
5764
|
+
</xsl:choose>
|
4743
5765
|
</xsl:attribute>
|
4744
5766
|
<xsl:attribute name="height">
|
4745
|
-
<xsl:
|
5767
|
+
<xsl:choose>
|
5768
|
+
<xsl:when test="$height != ''">
|
5769
|
+
<xsl:value-of select="round($height)"/>
|
5770
|
+
</xsl:when>
|
5771
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
5772
|
+
</xsl:choose>
|
4746
5773
|
</xsl:attribute>
|
5774
|
+
|
4747
5775
|
<xsl:apply-templates mode="svg_update"/>
|
4748
5776
|
</xsl:copy>
|
4749
5777
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -4938,7 +5966,11 @@
|
|
4938
5966
|
<xsl:apply-templates mode="bookmarks"/>
|
4939
5967
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
4940
5968
|
<xsl:apply-templates select="."/>
|
4941
|
-
</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() = '
|
5969
|
+
</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">
|
5970
|
+
<xsl:apply-templates mode="contents"/>
|
5971
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
5972
|
+
<xsl:apply-templates mode="bookmarks"/>
|
5973
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
4942
5974
|
<xsl:apply-templates mode="bookmarks"/>
|
4943
5975
|
</xsl:template><xsl:template name="addBookmarks">
|
4944
5976
|
<xsl:param name="contents"/>
|
@@ -5220,7 +6252,9 @@
|
|
5220
6252
|
<xsl:apply-templates/>
|
5221
6253
|
</xsl:otherwise>
|
5222
6254
|
</xsl:choose>
|
5223
|
-
</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() = '
|
6255
|
+
</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">
|
6256
|
+
<xsl:value-of select="."/>
|
6257
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
5224
6258
|
<xsl:text> </xsl:text>
|
5225
6259
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
5226
6260
|
<xsl:copy>
|
@@ -5251,9 +6285,22 @@
|
|
5251
6285
|
</xsl:when>
|
5252
6286
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
5253
6287
|
</xsl:choose>
|
6288
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
6289
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
6290
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
6291
|
+
<xsl:apply-templates mode="contents_item"/>
|
5254
6292
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
5255
6293
|
|
5256
6294
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
6295
|
+
|
6296
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
6297
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6298
|
+
</xsl:if>
|
6299
|
+
|
6300
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
6301
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6302
|
+
</xsl:if>
|
6303
|
+
|
5257
6304
|
<xsl:copy-of select="@id"/>
|
5258
6305
|
|
5259
6306
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -5353,17 +6400,15 @@
|
|
5353
6400
|
|
5354
6401
|
<!-- split text by zero-width space -->
|
5355
6402
|
<xsl:variable name="text_step4">
|
5356
|
-
<xsl:call-template name="
|
6403
|
+
<xsl:call-template name="split_for_interspers">
|
5357
6404
|
<xsl:with-param name="pText" select="$text_step3"/>
|
5358
6405
|
<xsl:with-param name="sep" select="$zero_width_space"/>
|
5359
|
-
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
5360
|
-
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
5361
6406
|
</xsl:call-template>
|
5362
6407
|
</xsl:variable>
|
5363
6408
|
|
5364
|
-
<xsl:for-each select="xalan:nodeset($text_step4)/
|
6409
|
+
<xsl:for-each select="xalan:nodeset($text_step4)/node()">
|
5365
6410
|
<xsl:choose>
|
5366
|
-
<xsl:when test="
|
6411
|
+
<xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
5367
6412
|
<xsl:call-template name="interspers">
|
5368
6413
|
<xsl:with-param name="str" select="."/>
|
5369
6414
|
</xsl:call-template>
|
@@ -5374,6 +6419,30 @@
|
|
5374
6419
|
</xsl:choose>
|
5375
6420
|
</xsl:for-each>
|
5376
6421
|
|
6422
|
+
</xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
|
6423
|
+
<xsl:param name="pText" select="."/>
|
6424
|
+
<xsl:param name="sep" select="','"/>
|
6425
|
+
<!-- word with length more than 30 will be interspersed with zero-width space -->
|
6426
|
+
<xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
|
6427
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
|
6428
|
+
<xsl:call-template name="replace_tag_interspers">
|
6429
|
+
<xsl:with-param name="text" select="$text"/>
|
6430
|
+
</xsl:call-template>
|
6431
|
+
</xsl:template><xsl:template name="replace_tag_interspers">
|
6432
|
+
<xsl:param name="text"/>
|
6433
|
+
<xsl:choose>
|
6434
|
+
<xsl:when test="contains($text, $interspers_tag_open)">
|
6435
|
+
<xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
|
6436
|
+
<xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
|
6437
|
+
<interspers>
|
6438
|
+
<xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
|
6439
|
+
</interspers>
|
6440
|
+
<xsl:call-template name="replace_tag_interspers">
|
6441
|
+
<xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
|
6442
|
+
</xsl:call-template>
|
6443
|
+
</xsl:when>
|
6444
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
6445
|
+
</xsl:choose>
|
5377
6446
|
</xsl:template><xsl:template name="interspers">
|
5378
6447
|
<xsl:param name="str"/>
|
5379
6448
|
<xsl:param name="char" select="$zero_width_space"/>
|
@@ -5602,7 +6671,9 @@
|
|
5602
6671
|
<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
|
5603
6672
|
</xsl:if>
|
5604
6673
|
<xsl:variable name="simple-table">
|
5605
|
-
<xsl:call-template name="getSimpleTable"
|
6674
|
+
<xsl:call-template name="getSimpleTable">
|
6675
|
+
<xsl:with-param name="id" select="@id"/>
|
6676
|
+
</xsl:call-template>
|
5606
6677
|
</xsl:variable>
|
5607
6678
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
|
5608
6679
|
<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
|
@@ -5709,39 +6780,67 @@
|
|
5709
6780
|
</xsl:otherwise>
|
5710
6781
|
</xsl:choose>
|
5711
6782
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
5712
|
-
|
5713
|
-
|
6783
|
+
|
6784
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
6785
|
+
|
5714
6786
|
|
6787
|
+
|
5715
6788
|
<xsl:variable name="fo_element">
|
5716
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
6789
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
5717
6790
|
block
|
5718
6791
|
</xsl:variable>
|
5719
6792
|
|
5720
|
-
|
5721
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
5722
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
5723
|
-
</xsl:apply-templates>
|
6793
|
+
<fo:block-container margin-left="0mm">
|
5724
6794
|
|
5725
|
-
|
5726
|
-
|
5727
|
-
<
|
5728
|
-
|
5729
|
-
|
6795
|
+
<xsl:choose>
|
6796
|
+
|
6797
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
6798
|
+
|
6799
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
6800
|
+
<fo:block>
|
6801
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
5730
6802
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
5731
6803
|
</xsl:apply-templates>
|
6804
|
+
</fo:block>
|
6805
|
+
|
6806
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6807
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6808
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
6809
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6810
|
+
</xsl:apply-templates>
|
6811
|
+
</fo:block-container>
|
5732
6812
|
</fo:block-container>
|
5733
|
-
</
|
5734
|
-
|
5735
|
-
|
5736
|
-
|
5737
|
-
|
5738
|
-
|
5739
|
-
|
5740
|
-
|
5741
|
-
|
5742
|
-
|
5743
|
-
|
5744
|
-
|
6813
|
+
</xsl:when> <!-- end block -->
|
6814
|
+
|
6815
|
+
<xsl:otherwise> <!-- inline -->
|
6816
|
+
|
6817
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
6818
|
+
<fo:block>
|
6819
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
6820
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6821
|
+
</xsl:apply-templates>
|
6822
|
+
<fo:inline>
|
6823
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
6824
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6825
|
+
</xsl:apply-templates>
|
6826
|
+
</fo:inline>
|
6827
|
+
</fo:block>
|
6828
|
+
|
6829
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
6830
|
+
<!-- display further elements in blocks -->
|
6831
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6832
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6833
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
6834
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
6835
|
+
</xsl:apply-templates>
|
6836
|
+
</fo:block-container>
|
6837
|
+
</fo:block-container>
|
6838
|
+
</xsl:if>
|
6839
|
+
</xsl:otherwise> <!-- end inline -->
|
6840
|
+
|
6841
|
+
</xsl:choose>
|
6842
|
+
</fo:block-container>
|
6843
|
+
</fo:block-container>
|
5745
6844
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
5746
6845
|
<xsl:param name="fo_element">block</xsl:param>
|
5747
6846
|
|
@@ -5773,14 +6872,20 @@
|
|
5773
6872
|
</xsl:variable>
|
5774
6873
|
<xsl:choose>
|
5775
6874
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
5776
|
-
<fo:block
|
5777
|
-
|
5778
|
-
<xsl:
|
5779
|
-
|
5780
|
-
|
5781
|
-
|
5782
|
-
|
5783
|
-
|
6875
|
+
<fo:block-container>
|
6876
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
6877
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6878
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6879
|
+
</xsl:if>
|
6880
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
6881
|
+
|
6882
|
+
<xsl:if test="$num = 1">
|
6883
|
+
<xsl:attribute name="margin-left">5mm</xsl:attribute>
|
6884
|
+
</xsl:if>
|
6885
|
+
|
6886
|
+
<xsl:apply-templates/>
|
6887
|
+
</fo:block>
|
6888
|
+
</fo:block-container>
|
5784
6889
|
</xsl:when>
|
5785
6890
|
<xsl:otherwise>
|
5786
6891
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -5825,7 +6930,7 @@
|
|
5825
6930
|
</xsl:otherwise>
|
5826
6931
|
</xsl:choose> -->
|
5827
6932
|
</fo:block>
|
5828
|
-
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
|
6933
|
+
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
|
5829
6934
|
<xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
|
5830
6935
|
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
|
5831
6936
|
<xsl:if test="normalize-space() != ''">
|
@@ -5961,7 +7066,16 @@
|
|
5961
7066
|
</fo:inline>
|
5962
7067
|
</xsl:when>
|
5963
7068
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
5964
|
-
|
7069
|
+
|
7070
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
7071
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
7072
|
+
<xsl:choose>
|
7073
|
+
<xsl:when test="$uri_src != ''">
|
7074
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
7075
|
+
</xsl:when>
|
7076
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
7077
|
+
</xsl:choose>
|
7078
|
+
|
5965
7079
|
</xsl:otherwise>
|
5966
7080
|
</xsl:choose>
|
5967
7081
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -6142,10 +7256,24 @@
|
|
6142
7256
|
|
6143
7257
|
</fo:block>
|
6144
7258
|
<xsl:apply-templates/>
|
6145
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
7259
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
6146
7260
|
<!-- comment 2019-11-29 -->
|
6147
7261
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
6148
7262
|
<xsl:apply-templates /> -->
|
7263
|
+
|
7264
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
7265
|
+
|
7266
|
+
<xsl:choose>
|
7267
|
+
<!-- if there isn't the attribute '@from', then -->
|
7268
|
+
<xsl:when test="$id_from = ''">
|
7269
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7270
|
+
</xsl:when>
|
7271
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
7272
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
7273
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7274
|
+
</xsl:when>
|
7275
|
+
</xsl:choose>
|
7276
|
+
|
6149
7277
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
6150
7278
|
<!-- 0xA0 to space replacement -->
|
6151
7279
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -6502,7 +7630,10 @@
|
|
6502
7630
|
<!-- to split by '_' and other chars -->
|
6503
7631
|
<xsl:call-template name="add-zero-spaces-java"/>
|
6504
7632
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
6505
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
7633
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
7634
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
7635
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
7636
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
|
6506
7637
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
6507
7638
|
<!-- <row>
|
6508
7639
|
<date>05-07-2013</date>
|
@@ -7020,6 +8151,120 @@
|
|
7020
8151
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
7021
8152
|
</xsl:for-each>
|
7022
8153
|
</xsl:copy>
|
8154
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
8155
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
8156
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
8157
|
+
<xsl:copy>
|
8158
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
8159
|
+
</xsl:copy>
|
8160
|
+
</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">
|
8161
|
+
|
8162
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
8163
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
8164
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8165
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8166
|
+
<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))"/>
|
8167
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
8168
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8169
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8170
|
+
<xsl:with-param name="text" select="$text_"/>
|
8171
|
+
</xsl:call-template></text></xsl:variable>
|
8172
|
+
|
8173
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
8174
|
+
|
8175
|
+
<xsl:variable name="text2">
|
8176
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
8177
|
+
<xsl:copy-of select="."/>
|
8178
|
+
</xsl:for-each></text>
|
8179
|
+
</xsl:variable>
|
8180
|
+
|
8181
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
8182
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
8183
|
+
<xsl:variable name="text3">
|
8184
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
8185
|
+
<xsl:choose>
|
8186
|
+
<xsl:when test="self::text()">
|
8187
|
+
<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))"/>
|
8188
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
8189
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8190
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8191
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
8192
|
+
</xsl:call-template></text></xsl:variable>
|
8193
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
8194
|
+
</xsl:when>
|
8195
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8196
|
+
</xsl:choose>
|
8197
|
+
</xsl:for-each></text>
|
8198
|
+
</xsl:variable>
|
8199
|
+
|
8200
|
+
<xsl:choose>
|
8201
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
8202
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
8203
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
8204
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
8205
|
+
<xsl:choose>
|
8206
|
+
<xsl:when test="self::text()">
|
8207
|
+
<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))"/>
|
8208
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
8209
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8210
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8211
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
8212
|
+
</xsl:call-template></text></xsl:variable>
|
8213
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
8214
|
+
</xsl:when>
|
8215
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8216
|
+
</xsl:choose>
|
8217
|
+
</xsl:for-each>
|
8218
|
+
</xsl:when>
|
8219
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
8220
|
+
</xsl:choose>
|
8221
|
+
|
8222
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
8223
|
+
<xsl:param name="tag_open"/>
|
8224
|
+
<xsl:param name="tag_close"/>
|
8225
|
+
<xsl:param name="text"/>
|
8226
|
+
<xsl:choose>
|
8227
|
+
<xsl:when test="contains($text, $tag_open)">
|
8228
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
8229
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
8230
|
+
|
8231
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
8232
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
8233
|
+
</xsl:element>
|
8234
|
+
|
8235
|
+
<xsl:call-template name="replace_text_tags">
|
8236
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
8237
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
8238
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
8239
|
+
</xsl:call-template>
|
8240
|
+
</xsl:when>
|
8241
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
8242
|
+
</xsl:choose>
|
8243
|
+
</xsl:template><xsl:template name="printEdition">
|
8244
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
8245
|
+
<xsl:text> </xsl:text>
|
8246
|
+
<xsl:choose>
|
8247
|
+
<xsl:when test="$edition_i18n != ''">
|
8248
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
8249
|
+
<xsl:call-template name="capitalize">
|
8250
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
8251
|
+
</xsl:call-template>
|
8252
|
+
</xsl:when>
|
8253
|
+
<xsl:otherwise>
|
8254
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
8255
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
8256
|
+
<xsl:call-template name="capitalize">
|
8257
|
+
<xsl:with-param name="str">
|
8258
|
+
<xsl:call-template name="getLocalizedString">
|
8259
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
8260
|
+
</xsl:call-template>
|
8261
|
+
</xsl:with-param>
|
8262
|
+
</xsl:call-template>
|
8263
|
+
<xsl:text> </xsl:text>
|
8264
|
+
<xsl:value-of select="$edition"/>
|
8265
|
+
</xsl:if>
|
8266
|
+
</xsl:otherwise>
|
8267
|
+
</xsl:choose>
|
7023
8268
|
</xsl:template><xsl:template name="convertDate">
|
7024
8269
|
<xsl:param name="date"/>
|
7025
8270
|
<xsl:param name="format" select="'short'"/>
|
@@ -7707,4 +8952,40 @@
|
|
7707
8952
|
<xsl:value-of select="$value"/>
|
7708
8953
|
</xsl:otherwise>
|
7709
8954
|
</xsl:choose>
|
8955
|
+
</xsl:template><xsl:template match="*" mode="print_as_xml">
|
8956
|
+
<xsl:param name="level">0</xsl:param>
|
8957
|
+
|
8958
|
+
<fo:block margin-left="{2*$level}mm">
|
8959
|
+
<xsl:text>
|
8960
|
+
<</xsl:text>
|
8961
|
+
<xsl:value-of select="local-name()"/>
|
8962
|
+
<xsl:for-each select="@*">
|
8963
|
+
<xsl:text> </xsl:text>
|
8964
|
+
<xsl:value-of select="local-name()"/>
|
8965
|
+
<xsl:text>="</xsl:text>
|
8966
|
+
<xsl:value-of select="."/>
|
8967
|
+
<xsl:text>"</xsl:text>
|
8968
|
+
</xsl:for-each>
|
8969
|
+
<xsl:text>></xsl:text>
|
8970
|
+
|
8971
|
+
<xsl:if test="not(*)">
|
8972
|
+
<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
|
8973
|
+
<xsl:text></</xsl:text>
|
8974
|
+
<xsl:value-of select="local-name()"/>
|
8975
|
+
<xsl:text>></xsl:text>
|
8976
|
+
</xsl:if>
|
8977
|
+
</fo:block>
|
8978
|
+
|
8979
|
+
<xsl:if test="*">
|
8980
|
+
<fo:block>
|
8981
|
+
<xsl:apply-templates mode="print_as_xml">
|
8982
|
+
<xsl:with-param name="level" select="$level + 1"/>
|
8983
|
+
</xsl:apply-templates>
|
8984
|
+
</fo:block>
|
8985
|
+
<fo:block margin-left="{2*$level}mm">
|
8986
|
+
<xsl:text></</xsl:text>
|
8987
|
+
<xsl:value-of select="local-name()"/>
|
8988
|
+
<xsl:text>></xsl:text>
|
8989
|
+
</fo:block>
|
8990
|
+
</xsl:if>
|
7710
8991
|
</xsl:template></xsl:stylesheet>
|