metanorma-ogc 2.0.8 → 2.1.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/ogc/biblio.rb +1 -134
- data/lib/isodoc/ogc/html/html_ogc_titlepage.html +2 -0
- data/lib/isodoc/ogc/html/word_ogc_intro.html +2 -3
- data/lib/isodoc/ogc/html/word_ogc_intro_wp.html +1 -2
- data/lib/isodoc/ogc/html/word_ogc_titlepage.html +20 -17
- data/lib/isodoc/ogc/html/word_ogc_titlepage_wp.html +3 -0
- data/lib/isodoc/ogc/init.rb +5 -6
- data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.best-practice.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.community-practice.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.community-standard.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.other.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.policy.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.reference-model.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.release-notes.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.standard.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.test-suite.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.user-guide.xsl +1501 -276
- data/lib/isodoc/ogc/ogc.white-paper.xsl +1506 -283
- data/lib/isodoc/ogc/presentation_xml_convert.rb +14 -10
- data/lib/isodoc/ogc/word_convert.rb +4 -4
- data/lib/isodoc/ogc/xref.rb +6 -2
- data/lib/metanorma/ogc/biblio.rng +37 -8
- data/lib/metanorma/ogc/isodoc.rng +56 -0
- data/lib/metanorma/ogc/version.rb +1 -1
- data/lib/relaton/render/config.yml +10 -0
- data/lib/relaton/render/date.rb +9 -0
- data/lib/relaton/render/fields.rb +23 -0
- data/lib/relaton/render/general.rb +25 -0
- data/lib/relaton/render/parse.rb +11 -0
- data/metanorma-ogc.gemspec +1 -1
- metadata +9 -4
@@ -144,10 +144,7 @@
|
|
144
144
|
<fo:block margin-top="6pt">URL for this OGC® document: <xsl:value-of select="$url"/></fo:block>
|
145
145
|
</xsl:if>
|
146
146
|
|
147
|
-
<xsl:
|
148
|
-
<xsl:if test="normalize-space($edition) != ''">
|
149
|
-
<fo:block margin-top="6pt">Version: <xsl:value-of select="$edition"/></fo:block>
|
150
|
-
</xsl:if>
|
147
|
+
<xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:edition[normalize-space(@language) = '']"/>
|
151
148
|
|
152
149
|
<fo:block margin-top="6pt"><xsl:text>Category: </xsl:text>
|
153
150
|
<xsl:call-template name="capitalizeWords">
|
@@ -371,16 +368,21 @@
|
|
371
368
|
</fo:block>
|
372
369
|
</xsl:template>
|
373
370
|
|
371
|
+
|
374
372
|
<xsl:template match="/ogc:ogc-standard/ogc:bibdata/ogc:edition">
|
375
|
-
<
|
376
|
-
|
377
|
-
|
378
|
-
|
373
|
+
<xsl:variable name="edition" select="."/>
|
374
|
+
<xsl:if test="normalize-space($edition) != ''">
|
375
|
+
<fo:block margin-top="6pt">
|
376
|
+
<xsl:call-template name="capitalize">
|
377
|
+
<xsl:with-param name="str">
|
378
|
+
<xsl:call-template name="getLocalizedString">
|
379
|
+
<xsl:with-param name="key">version</xsl:with-param>
|
380
|
+
</xsl:call-template>
|
381
|
+
</xsl:with-param>
|
379
382
|
</xsl:call-template>
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
</fo:block>
|
383
|
+
<xsl:text>: </xsl:text><xsl:value-of select="$edition"/>
|
384
|
+
</fo:block>
|
385
|
+
</xsl:if>
|
384
386
|
</xsl:template>
|
385
387
|
|
386
388
|
|
@@ -486,6 +488,7 @@
|
|
486
488
|
|
487
489
|
<xsl:template match="ogc:p" name="paragraph">
|
488
490
|
<xsl:param name="inline" select="'false'"/>
|
491
|
+
<xsl:param name="split_keep-within-line"/>
|
489
492
|
<xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
|
490
493
|
<xsl:variable name="element-name">
|
491
494
|
<xsl:choose>
|
@@ -516,7 +519,9 @@
|
|
516
519
|
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
517
520
|
</xsl:if>
|
518
521
|
<xsl:attribute name="line-height">115%</xsl:attribute>
|
519
|
-
<xsl:apply-templates
|
522
|
+
<xsl:apply-templates>
|
523
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
524
|
+
</xsl:apply-templates>
|
520
525
|
</xsl:element>
|
521
526
|
<xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
|
522
527
|
<fo:block margin-bottom="12pt">
|
@@ -638,7 +643,9 @@
|
|
638
643
|
</xsl:choose>
|
639
644
|
</xsl:template>
|
640
645
|
|
641
|
-
<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="
|
646
|
+
<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_">
|
647
|
+
false
|
648
|
+
</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
|
642
649
|
<xsl:call-template name="getLang"/>
|
643
650
|
</xsl:variable><xsl:variable name="pageWidth_">
|
644
651
|
215.9
|
@@ -653,20 +660,7 @@
|
|
653
660
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
654
661
|
25.4
|
655
662
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
656
|
-
|
657
|
-
<title-edition lang="en">
|
658
|
-
|
659
|
-
<xsl:text>Version</xsl:text>
|
660
|
-
|
661
|
-
</title-edition>
|
662
|
-
|
663
|
-
<title-edition lang="fr">
|
664
|
-
<xsl:text>Édition </xsl:text>
|
665
|
-
</title-edition>
|
666
663
|
|
667
|
-
<title-edition lang="ru">
|
668
|
-
<xsl:text>Издание </xsl:text>
|
669
|
-
</title-edition>
|
670
664
|
|
671
665
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
672
666
|
<title-toc lang="en">
|
@@ -747,7 +741,7 @@
|
|
747
741
|
</xsl:variable><xsl:variable name="bibdata">
|
748
742
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
749
743
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
750
|
-
</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">
|
744
|
+
</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">
|
751
745
|
<xsl:param name="name"/>
|
752
746
|
<xsl:param name="lang"/>
|
753
747
|
<xsl:variable name="lang_">
|
@@ -795,7 +789,7 @@
|
|
795
789
|
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
796
790
|
|
797
791
|
<xsl:variable name="additional_fonts_">
|
798
|
-
<xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
|
792
|
+
<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']">
|
799
793
|
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
800
794
|
</xsl:for-each>
|
801
795
|
</xsl:variable>
|
@@ -892,7 +886,6 @@
|
|
892
886
|
|
893
887
|
|
894
888
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
895
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
896
889
|
|
897
890
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
898
891
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -1019,6 +1012,7 @@
|
|
1019
1012
|
|
1020
1013
|
|
1021
1014
|
|
1015
|
+
|
1022
1016
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
1023
1017
|
|
1024
1018
|
|
@@ -1178,6 +1172,7 @@
|
|
1178
1172
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
1179
1173
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1180
1174
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1175
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1181
1176
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
1182
1177
|
|
1183
1178
|
|
@@ -1202,6 +1197,7 @@
|
|
1202
1197
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
1203
1198
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
1204
1199
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
1200
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
1205
1201
|
|
1206
1202
|
|
1207
1203
|
|
@@ -1290,7 +1286,8 @@
|
|
1290
1286
|
</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
|
1291
1287
|
|
1292
1288
|
|
1293
|
-
</xsl:attribute-set><xsl:attribute-set name="dt-style">
|
1289
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
|
1290
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
|
1294
1291
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
1295
1292
|
|
1296
1293
|
|
@@ -1305,6 +1302,8 @@
|
|
1305
1302
|
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
1306
1303
|
|
1307
1304
|
|
1305
|
+
</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
|
1306
|
+
<xsl:attribute name="padding-left">2mm</xsl:attribute>
|
1308
1307
|
</xsl:attribute-set><xsl:attribute-set name="appendix-style">
|
1309
1308
|
|
1310
1309
|
<xsl:attribute name="font-size">12pt</xsl:attribute>
|
@@ -2148,22 +2147,32 @@
|
|
2148
2147
|
<xsl:sort select="@displayorder" data-type="number"/>
|
2149
2148
|
<xsl:apply-templates select="."/>
|
2150
2149
|
</xsl:for-each>
|
2151
|
-
</xsl:template><xsl:variable name="
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2150
|
+
</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">
|
2151
|
+
|
2152
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
2153
|
+
<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))"/>
|
2154
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
2155
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
2156
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
2157
|
+
<xsl:with-param name="text" select="$text"/>
|
2158
|
+
</xsl:call-template>
|
2159
|
+
|
2160
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
2161
|
+
<xsl:param name="tag_open"/>
|
2162
|
+
<xsl:param name="tag_close"/>
|
2158
2163
|
<xsl:param name="text"/>
|
2159
2164
|
<xsl:choose>
|
2160
2165
|
<xsl:when test="contains($text, $tag_open)">
|
2161
2166
|
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
2162
|
-
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
2167
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
2163
2168
|
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
2164
|
-
<
|
2165
|
-
|
2166
|
-
|
2169
|
+
<fo:inline keep-together.within-line="always">
|
2170
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
2171
|
+
</fo:inline>
|
2172
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
2173
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
2174
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
2175
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
2167
2176
|
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
2168
2177
|
</xsl:call-template>
|
2169
2178
|
</xsl:when>
|
@@ -2171,6 +2180,39 @@
|
|
2171
2180
|
</xsl:choose>
|
2172
2181
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
2173
2182
|
<xsl:value-of select="$linebreak"/>
|
2183
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
2184
|
+
<xsl:param name="split_keep-within-line"/>
|
2185
|
+
|
2186
|
+
<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
|
2187
|
+
<xsl:choose>
|
2188
|
+
|
2189
|
+
<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
|
2190
|
+
<xsl:variable name="sep">_</xsl:variable>
|
2191
|
+
<xsl:variable name="items">
|
2192
|
+
<xsl:call-template name="split">
|
2193
|
+
<xsl:with-param name="pText" select="."/>
|
2194
|
+
<xsl:with-param name="sep" select="$sep"/>
|
2195
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
2196
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
2197
|
+
</xsl:call-template>
|
2198
|
+
</xsl:variable>
|
2199
|
+
<xsl:for-each select="xalan:nodeset($items)/item">
|
2200
|
+
<xsl:choose>
|
2201
|
+
<xsl:when test=". = $sep">
|
2202
|
+
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
|
2203
|
+
</xsl:when>
|
2204
|
+
<xsl:otherwise>
|
2205
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
2206
|
+
</xsl:otherwise>
|
2207
|
+
</xsl:choose>
|
2208
|
+
</xsl:for-each>
|
2209
|
+
</xsl:when>
|
2210
|
+
|
2211
|
+
<xsl:otherwise>
|
2212
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
2213
|
+
</xsl:otherwise>
|
2214
|
+
|
2215
|
+
</xsl:choose>
|
2174
2216
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
2175
2217
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
2176
2218
|
<xsl:apply-templates/>
|
@@ -2279,8 +2321,23 @@
|
|
2279
2321
|
</xsl:call-template>
|
2280
2322
|
|
2281
2323
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
2282
|
-
|
2283
|
-
|
2324
|
+
<xsl:choose>
|
2325
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
2326
|
+
<xsl:value-of select="."/>
|
2327
|
+
</xsl:when>
|
2328
|
+
<xsl:otherwise>
|
2329
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
2330
|
+
</xsl:otherwise>
|
2331
|
+
</xsl:choose>
|
2332
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
2333
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
2334
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
2335
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
2336
|
+
<xsl:choose>
|
2337
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
2338
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
2339
|
+
</xsl:choose>
|
2340
|
+
</xsl:for-each>
|
2284
2341
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
2285
2342
|
|
2286
2343
|
<xsl:variable name="table-preamble">
|
@@ -2290,9 +2347,14 @@
|
|
2290
2347
|
|
2291
2348
|
<xsl:variable name="table">
|
2292
2349
|
|
2293
|
-
<xsl:variable name="simple-table">
|
2294
|
-
<xsl:call-template name="getSimpleTable"
|
2350
|
+
<xsl:variable name="simple-table">
|
2351
|
+
<xsl:call-template name="getSimpleTable">
|
2352
|
+
<xsl:with-param name="id" select="@id"/>
|
2353
|
+
</xsl:call-template>
|
2295
2354
|
</xsl:variable>
|
2355
|
+
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
2356
|
+
|
2357
|
+
<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
|
2296
2358
|
|
2297
2359
|
|
2298
2360
|
<!-- Display table's name before table as standalone block -->
|
@@ -2313,7 +2375,23 @@
|
|
2313
2375
|
</xsl:call-template>
|
2314
2376
|
</xsl:if>
|
2315
2377
|
</xsl:variable>
|
2316
|
-
<!--
|
2378
|
+
<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
|
2379
|
+
|
2380
|
+
<!-- DEBUG -->
|
2381
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2382
|
+
<fo:block font-size="60%">
|
2383
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
2384
|
+
</fo:block>
|
2385
|
+
</xsl:if>
|
2386
|
+
|
2387
|
+
|
2388
|
+
<!-- <xsl:copy-of select="$colwidths"/> -->
|
2389
|
+
|
2390
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
2391
|
+
DEBUG
|
2392
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
2393
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
2394
|
+
|
2317
2395
|
|
2318
2396
|
|
2319
2397
|
<xsl:variable name="margin-side">
|
@@ -2379,9 +2457,17 @@
|
|
2379
2457
|
</xsl:element>
|
2380
2458
|
</xsl:variable>
|
2381
2459
|
|
2460
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
2461
|
+
<!-- to determine start of table -->
|
2462
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
2463
|
+
</xsl:if>
|
2382
2464
|
|
2383
2465
|
<fo:table id="{@id}">
|
2384
2466
|
|
2467
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
2468
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
2469
|
+
</xsl:if>
|
2470
|
+
|
2385
2471
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
2386
2472
|
<xsl:attribute name="{local-name()}">
|
2387
2473
|
<xsl:value-of select="."/>
|
@@ -2395,31 +2481,47 @@
|
|
2395
2481
|
|
2396
2482
|
|
2397
2483
|
<xsl:choose>
|
2398
|
-
<xsl:when test="
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2484
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
2485
|
+
<!-- generate IF for table widths -->
|
2486
|
+
<!-- example:
|
2487
|
+
<tr>
|
2488
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
2489
|
+
<p>Symbol</p>
|
2490
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
2491
|
+
</td>
|
2492
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
2493
|
+
<p>Description</p>
|
2494
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
2495
|
+
</td>
|
2496
|
+
</tr>
|
2497
|
+
-->
|
2498
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
|
2499
|
+
|
2402
2500
|
</xsl:when>
|
2403
2501
|
<xsl:otherwise>
|
2404
|
-
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
2405
|
-
<xsl:choose>
|
2406
|
-
<xsl:when test=". = 1 or . = 0">
|
2407
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
2408
|
-
</xsl:when>
|
2409
|
-
<xsl:otherwise>
|
2410
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
2411
|
-
</xsl:otherwise>
|
2412
|
-
</xsl:choose>
|
2413
|
-
</xsl:for-each>
|
2414
|
-
</xsl:otherwise>
|
2415
|
-
</xsl:choose>
|
2416
2502
|
|
2417
|
-
|
2418
|
-
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2503
|
+
<xsl:choose>
|
2504
|
+
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
|
2505
|
+
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
|
2506
|
+
<fo:table-column column-width="{@width}"/>
|
2507
|
+
</xsl:for-each>
|
2508
|
+
</xsl:when>
|
2509
|
+
<xsl:otherwise>
|
2510
|
+
<xsl:call-template name="insertTableColumnWidth">
|
2511
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
2512
|
+
</xsl:call-template>
|
2513
|
+
</xsl:otherwise>
|
2514
|
+
</xsl:choose>
|
2515
|
+
|
2516
|
+
<xsl:choose>
|
2517
|
+
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
|
2518
|
+
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
2519
|
+
</xsl:when>
|
2520
|
+
<xsl:otherwise>
|
2521
|
+
<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 -->
|
2522
|
+
</xsl:otherwise>
|
2523
|
+
</xsl:choose>
|
2524
|
+
|
2423
2525
|
</xsl:otherwise>
|
2424
2526
|
</xsl:choose>
|
2425
2527
|
|
@@ -2521,11 +2623,22 @@
|
|
2521
2623
|
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
|
2522
2624
|
<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
|
2523
2625
|
</xsl:template><xsl:template name="calculate-column-widths">
|
2626
|
+
<xsl:param name="table"/>
|
2627
|
+
<xsl:param name="cols-count"/>
|
2628
|
+
|
2629
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2630
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2631
|
+
<xsl:with-param name="table" select="$table"/>
|
2632
|
+
</xsl:call-template>
|
2633
|
+
|
2634
|
+
</xsl:template><xsl:template name="calculate-column-widths-proportional">
|
2524
2635
|
<xsl:param name="table"/>
|
2525
2636
|
<xsl:param name="cols-count"/>
|
2526
2637
|
<xsl:param name="curr-col" select="1"/>
|
2527
2638
|
<xsl:param name="width" select="0"/>
|
2528
2639
|
|
2640
|
+
<!-- table=<xsl:copy-of select="$table"/> -->
|
2641
|
+
|
2529
2642
|
<xsl:if test="$curr-col <= $cols-count">
|
2530
2643
|
<xsl:variable name="widths">
|
2531
2644
|
<xsl:choose>
|
@@ -2563,16 +2676,22 @@
|
|
2563
2676
|
</xsl:for-each>
|
2564
2677
|
</xsl:when>
|
2565
2678
|
<xsl:otherwise>
|
2566
|
-
<xsl:
|
2679
|
+
<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
|
2680
|
+
|
2681
|
+
<!-- <table><xsl:copy-of select="$table"/></table>
|
2682
|
+
-->
|
2683
|
+
<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
|
2567
2684
|
<xsl:variable name="td_text">
|
2568
2685
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
2569
2686
|
</xsl:variable>
|
2687
|
+
<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
|
2570
2688
|
<xsl:variable name="words">
|
2571
2689
|
<xsl:variable name="string_with_added_zerospaces">
|
2572
2690
|
<xsl:call-template name="add-zero-spaces-java">
|
2573
2691
|
<xsl:with-param name="text" select="$td_text"/>
|
2574
2692
|
</xsl:call-template>
|
2575
2693
|
</xsl:variable>
|
2694
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
2576
2695
|
<xsl:call-template name="tokenize">
|
2577
2696
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
2578
2697
|
<!-- 2009 thinspace -->
|
@@ -2580,11 +2699,13 @@
|
|
2580
2699
|
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
2581
2700
|
</xsl:call-template>
|
2582
2701
|
</xsl:variable>
|
2702
|
+
<!-- words=<xsl:copy-of select="$words"/> -->
|
2583
2703
|
<xsl:variable name="max_length">
|
2584
2704
|
<xsl:call-template name="max_length">
|
2585
2705
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
2586
2706
|
</xsl:call-template>
|
2587
2707
|
</xsl:variable>
|
2708
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
2588
2709
|
<width>
|
2589
2710
|
<xsl:variable name="divider">
|
2590
2711
|
<xsl:choose>
|
@@ -2603,6 +2724,8 @@
|
|
2603
2724
|
</xsl:choose>
|
2604
2725
|
</xsl:variable>
|
2605
2726
|
|
2727
|
+
<!-- widths=<xsl:copy-of select="$widths"/> -->
|
2728
|
+
|
2606
2729
|
<column>
|
2607
2730
|
<xsl:for-each select="xalan:nodeset($widths)//width">
|
2608
2731
|
<xsl:sort select="." data-type="number" order="descending"/>
|
@@ -2611,29 +2734,327 @@
|
|
2611
2734
|
</xsl:if>
|
2612
2735
|
</xsl:for-each>
|
2613
2736
|
</column>
|
2614
|
-
<xsl:call-template name="calculate-column-widths">
|
2737
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2615
2738
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2616
2739
|
<xsl:with-param name="curr-col" select="$curr-col +1"/>
|
2617
2740
|
<xsl:with-param name="table" select="$table"/>
|
2618
2741
|
</xsl:call-template>
|
2619
2742
|
</xsl:if>
|
2743
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
|
2744
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
2745
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
2746
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
2747
|
+
|
2748
|
+
<!-- if all capitals english letters or digits -->
|
2749
|
+
<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
|
2750
|
+
<xsl:call-template name="repeat">
|
2751
|
+
<xsl:with-param name="char" select="'X'"/>
|
2752
|
+
<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
|
2753
|
+
</xsl:call-template>
|
2754
|
+
</xsl:if>
|
2620
2755
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
2621
2756
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
2622
2757
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
2623
2758
|
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
|
2624
2759
|
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
|
2625
2760
|
<xsl:value-of select="@target"/>
|
2626
|
-
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
|
2627
|
-
<xsl:
|
2628
|
-
<xsl:
|
2629
|
-
<xsl:
|
2630
|
-
<xsl:
|
2761
|
+
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
|
2762
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
2763
|
+
<xsl:variable name="mathml_">
|
2764
|
+
<xsl:for-each select="*">
|
2765
|
+
<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
|
2766
|
+
<xsl:copy-of select="."/>
|
2767
|
+
</xsl:if>
|
2768
|
+
</xsl:for-each>
|
2769
|
+
</xsl:variable>
|
2770
|
+
<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
|
2771
|
+
|
2772
|
+
<xsl:variable name="math_text">
|
2773
|
+
<xsl:value-of select="normalize-space($mathml)"/>
|
2774
|
+
<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
|
2775
|
+
<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
|
2776
|
+
</xsl:variable>
|
2777
|
+
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
|
2778
|
+
</xsl:if>
|
2779
|
+
</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
|
2780
|
+
<xsl:param name="table"/>
|
2781
|
+
<xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
|
2782
|
+
|
2783
|
+
<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
|
2784
|
+
|
2785
|
+
<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
|
2786
|
+
|
2787
|
+
<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
|
2788
|
+
|
2789
|
+
<!-- get current table id -->
|
2790
|
+
<xsl:variable name="table_id" select="@id"/>
|
2791
|
+
<!-- find table by id in the file 'table_widths' -->
|
2792
|
+
<xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
|
2793
|
+
<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
|
2794
|
+
|
2795
|
+
|
2796
|
+
<!-- table='<xsl:copy-of select="$table"/>' -->
|
2797
|
+
<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
|
2798
|
+
<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
|
2799
|
+
<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
|
2800
|
+
|
2801
|
+
<xsl:variable name="table_with_cell_widths_">
|
2802
|
+
<xsl:choose>
|
2803
|
+
<xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
|
2804
|
+
|
2805
|
+
<!-- Example: <column>10</column>
|
2806
|
+
<column>11</column>
|
2807
|
+
-->
|
2808
|
+
<xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
|
2809
|
+
</xsl:when>
|
2810
|
+
<xsl:otherwise>
|
2811
|
+
<xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
|
2812
|
+
</xsl:otherwise>
|
2813
|
+
</xsl:choose>
|
2814
|
+
</xsl:variable>
|
2815
|
+
<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
|
2816
|
+
|
2817
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2818
|
+
<xsl:copy-of select="$table_with_cell_widths"/>
|
2819
|
+
</xsl:if>
|
2820
|
+
|
2821
|
+
|
2822
|
+
<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
|
2823
|
+
|
2824
|
+
<xsl:variable name="column_widths_">
|
2825
|
+
<!-- iteration of columns -->
|
2826
|
+
<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
|
2827
|
+
<xsl:variable name="pos" select="position()"/>
|
2828
|
+
<column>
|
2829
|
+
<xsl:attribute name="width_max">
|
2830
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
|
2831
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2832
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2833
|
+
</xsl:for-each>
|
2834
|
+
</xsl:attribute>
|
2835
|
+
<xsl:attribute name="width_min">
|
2836
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
|
2837
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2838
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2839
|
+
</xsl:for-each>
|
2840
|
+
</xsl:attribute>
|
2841
|
+
</column>
|
2842
|
+
</xsl:for-each>
|
2843
|
+
</xsl:variable>
|
2844
|
+
<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
|
2845
|
+
|
2846
|
+
<!-- <column_widths>
|
2847
|
+
<xsl:copy-of select="$column_widths"/>
|
2848
|
+
</column_widths> -->
|
2849
|
+
|
2850
|
+
<!-- These in turn, are used to find the minimum and maximum width for the table. -->
|
2851
|
+
<xsl:variable name="table_widths_">
|
2852
|
+
<table>
|
2853
|
+
<xsl:attribute name="width_max">
|
2854
|
+
<xsl:value-of select="sum($column_widths/column/@width_max)"/>
|
2855
|
+
</xsl:attribute>
|
2856
|
+
<xsl:attribute name="width_min">
|
2857
|
+
<xsl:value-of select="sum($column_widths/column/@width_min)"/>
|
2858
|
+
</xsl:attribute>
|
2859
|
+
</table>
|
2860
|
+
</xsl:variable>
|
2861
|
+
<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
|
2862
|
+
|
2863
|
+
<xsl:variable name="page_width">
|
2864
|
+
<xsl:choose>
|
2865
|
+
<xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
|
2866
|
+
<xsl:otherwise>75</xsl:otherwise>
|
2867
|
+
</xsl:choose>
|
2868
|
+
</xsl:variable>
|
2869
|
+
|
2870
|
+
<xsl:if test="$table_if_debug = 'true'">
|
2871
|
+
<table_width>
|
2872
|
+
<xsl:copy-of select="$table_widths"/>
|
2873
|
+
</table_width>
|
2874
|
+
<!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
|
2875
|
+
<debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
|
2876
|
+
-->
|
2877
|
+
<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
|
2878
|
+
</xsl:if>
|
2879
|
+
|
2880
|
+
|
2881
|
+
<!-- There are three cases: -->
|
2882
|
+
<xsl:choose>
|
2883
|
+
<!-- 1. The minimum table width is equal to or wider than the available space -->
|
2884
|
+
<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
|
2885
|
+
<!-- call old algorithm -->
|
2886
|
+
<case1/>
|
2887
|
+
<xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
|
2888
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
2889
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2890
|
+
<xsl:with-param name="table" select="$table"/>
|
2891
|
+
</xsl:call-template>
|
2892
|
+
</xsl:when>
|
2893
|
+
<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
|
2894
|
+
<xsl:when test="$table_widths/table/@width_max <= $page_width">
|
2895
|
+
<case2/>
|
2896
|
+
<autolayout/>
|
2897
|
+
<xsl:for-each select="$column_widths/column/@width_max">
|
2898
|
+
<column divider="100"><xsl:value-of select="."/></column>
|
2899
|
+
</xsl:for-each>
|
2900
|
+
</xsl:when>
|
2901
|
+
<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
|
2902
|
+
In this case, find the difference between the available space and the minimum table width, lets call it W.
|
2903
|
+
Lets also call D the difference between maximum and minimum width of the table.
|
2904
|
+
For each column, let d be the difference between maximum and minimum width of that column.
|
2905
|
+
Now set the column's width to the minimum width plus d times W over D.
|
2906
|
+
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
2907
|
+
<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)">
|
2908
|
+
<!-- difference between the available space and the minimum table width -->
|
2909
|
+
<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
|
2910
|
+
<W><xsl:value-of select="$W"/></W>
|
2911
|
+
<!-- difference between maximum and minimum width of the table -->
|
2912
|
+
<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
|
2913
|
+
<D><xsl:value-of select="$D"/></D>
|
2914
|
+
<case3/>
|
2915
|
+
<autolayout/>
|
2916
|
+
<xsl:if test="$table_widths/table/@width_min >= $page_width">
|
2917
|
+
<split_keep-within-line>true</split_keep-within-line>
|
2631
2918
|
</xsl:if>
|
2919
|
+
<xsl:for-each select="$column_widths/column">
|
2920
|
+
<!-- difference between maximum and minimum width of that column. -->
|
2921
|
+
<xsl:variable name="d" select="@width_max - @width_min"/>
|
2922
|
+
<d><xsl:value-of select="$d"/></d>
|
2923
|
+
<width_min><xsl:value-of select="@width_min"/></width_min>
|
2924
|
+
<e><xsl:value-of select="$d * $W div $D"/></e>
|
2925
|
+
<!-- set the column's width to the minimum width plus d times W over D. -->
|
2926
|
+
<column divider="100">
|
2927
|
+
<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
|
2928
|
+
</column>
|
2929
|
+
</xsl:for-each>
|
2930
|
+
|
2931
|
+
</xsl:when>
|
2932
|
+
<xsl:otherwise><unknown_case/></xsl:otherwise>
|
2933
|
+
</xsl:choose>
|
2934
|
+
|
2935
|
+
|
2936
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
|
2937
|
+
<xsl:copy>
|
2938
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
|
2939
|
+
</xsl:copy>
|
2940
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
|
2941
|
+
<xsl:copy>
|
2942
|
+
<xsl:copy-of select="@*"/>
|
2943
|
+
|
2944
|
+
<!-- The maximum width is given by the widest line. -->
|
2945
|
+
<xsl:variable name="widths_max">
|
2946
|
+
<xsl:for-each select=".//*[local-name() = 'p']">
|
2947
|
+
<xsl:call-template name="add_width"/>
|
2948
|
+
</xsl:for-each>
|
2949
|
+
<xsl:if test="not(*[local-name() = 'p'])">
|
2950
|
+
<xsl:call-template name="add_width"/>
|
2951
|
+
</xsl:if>
|
2952
|
+
</xsl:variable>
|
2953
|
+
<xsl:variable name="width_max">
|
2954
|
+
<xsl:for-each select="xalan:nodeset($widths_max)//width">
|
2955
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
2956
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
2957
|
+
</xsl:for-each>
|
2958
|
+
</xsl:variable>
|
2959
|
+
<xsl:attribute name="width_max">
|
2960
|
+
<xsl:value-of select="$width_max"/>
|
2961
|
+
</xsl:attribute>
|
2962
|
+
|
2963
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
2964
|
+
<!-- To do: image width -->
|
2965
|
+
<xsl:variable name="td_text">
|
2966
|
+
<xsl:apply-templates select="." mode="td_text"/>
|
2967
|
+
</xsl:variable>
|
2968
|
+
<xsl:variable name="words">
|
2969
|
+
<xsl:variable name="string_with_added_zerospaces">
|
2970
|
+
<xsl:call-template name="add-zero-spaces-java">
|
2971
|
+
<xsl:with-param name="text" select="$td_text"/>
|
2972
|
+
</xsl:call-template>
|
2973
|
+
</xsl:variable>
|
2974
|
+
<xsl:call-template name="tokenize">
|
2975
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
2976
|
+
</xsl:call-template>
|
2977
|
+
</xsl:variable>
|
2978
|
+
|
2979
|
+
<xsl:variable name="max_word_length">
|
2980
|
+
<xsl:call-template name="max_length">
|
2981
|
+
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
2982
|
+
</xsl:call-template>
|
2983
|
+
</xsl:variable>
|
2984
|
+
<xsl:variable name="width_min">
|
2985
|
+
<xsl:value-of select="$max_word_length"/>
|
2986
|
+
</xsl:variable>
|
2987
|
+
<xsl:attribute name="width_min">
|
2988
|
+
<xsl:value-of select="$width_min"/>
|
2989
|
+
</xsl:attribute>
|
2990
|
+
<!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
|
2991
|
+
<xsl:if test="$width_min > $width_max">
|
2992
|
+
<xsl:attribute name="width_max">
|
2993
|
+
<xsl:value-of select="$width_min"/>
|
2994
|
+
</xsl:attribute>
|
2995
|
+
</xsl:if>
|
2996
|
+
<xsl:if test="$width_min = 0">
|
2997
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
2998
|
+
</xsl:if>
|
2999
|
+
|
3000
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths"/>
|
3001
|
+
|
3002
|
+
</xsl:copy>
|
3003
|
+
</xsl:template><xsl:template name="add_width">
|
3004
|
+
<xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
|
3005
|
+
<xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
|
3006
|
+
|
3007
|
+
<xsl:variable name="p_text_len">
|
3008
|
+
<xsl:choose>
|
3009
|
+
<xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
|
3010
|
+
<xsl:value-of select="$p_text_len_ * 1.5"/>
|
3011
|
+
</xsl:when>
|
3012
|
+
<xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
|
3013
|
+
</xsl:choose>
|
3014
|
+
</xsl:variable>
|
3015
|
+
|
3016
|
+
<xsl:variable name="math_addon_text">
|
3017
|
+
<xsl:for-each select=".//*[local-name() = 'math']">
|
3018
|
+
<xsl:apply-templates mode="td_text"/>
|
2632
3019
|
</xsl:for-each>
|
2633
3020
|
</xsl:variable>
|
3021
|
+
<xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
|
2634
3022
|
|
2635
|
-
<xsl:
|
2636
|
-
|
3023
|
+
<width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
|
3024
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
|
3025
|
+
<xsl:copy>
|
3026
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
|
3027
|
+
</xsl:copy>
|
3028
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
|
3029
|
+
<xsl:copy>
|
3030
|
+
<xsl:copy-of select="@*"/>
|
3031
|
+
|
3032
|
+
<!-- The maximum width is given by the widest line. -->
|
3033
|
+
<xsl:attribute name="width_max">
|
3034
|
+
<xsl:for-each select="p_len">
|
3035
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
3036
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
3037
|
+
</xsl:for-each>
|
3038
|
+
</xsl:attribute>
|
3039
|
+
|
3040
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
3041
|
+
<xsl:variable name="width_min">
|
3042
|
+
<xsl:for-each select="word_len">
|
3043
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
3044
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
3045
|
+
</xsl:for-each>
|
3046
|
+
</xsl:variable>
|
3047
|
+
<xsl:attribute name="width_min">
|
3048
|
+
<xsl:value-of select="$width_min"/>
|
3049
|
+
</xsl:attribute>
|
3050
|
+
|
3051
|
+
<xsl:if test="$width_min = 0">
|
3052
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
3053
|
+
</xsl:if>
|
3054
|
+
|
3055
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
|
3056
|
+
|
3057
|
+
</xsl:copy>
|
2637
3058
|
</xsl:template><xsl:template match="*[local-name()='thead']">
|
2638
3059
|
<xsl:param name="cols-count"/>
|
2639
3060
|
<fo:table-header>
|
@@ -2718,16 +3139,10 @@
|
|
2718
3139
|
</xsl:for-each>
|
2719
3140
|
</xsl:when>
|
2720
3141
|
<xsl:otherwise>
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2725
|
-
</xsl:when>
|
2726
|
-
<xsl:otherwise>
|
2727
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
2728
|
-
</xsl:otherwise>
|
2729
|
-
</xsl:choose>
|
2730
|
-
</xsl:for-each>
|
3142
|
+
<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
|
3143
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3144
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3145
|
+
</xsl:call-template>
|
2731
3146
|
</xsl:otherwise>
|
2732
3147
|
</xsl:choose>
|
2733
3148
|
|
@@ -2804,6 +3219,52 @@
|
|
2804
3219
|
|
2805
3220
|
</fo:table-body>
|
2806
3221
|
|
3222
|
+
</xsl:template><xsl:template match="/" mode="process_table-if">
|
3223
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
3224
|
+
<xsl:apply-templates mode="process_table-if">
|
3225
|
+
<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
|
3226
|
+
</xsl:apply-templates>
|
3227
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
|
3228
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
3229
|
+
|
3230
|
+
<fo:table-body>
|
3231
|
+
<xsl:for-each select="*[local-name() = 'tr']">
|
3232
|
+
<xsl:variable name="col_count" select="count(*)"/>
|
3233
|
+
|
3234
|
+
<!-- iteration for each tr/td -->
|
3235
|
+
|
3236
|
+
<xsl:choose>
|
3237
|
+
<xsl:when test="$table_or_dl = 'table'">
|
3238
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
|
3239
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
3240
|
+
<!-- <test_table><xsl:copy-of select="."/></test_table> -->
|
3241
|
+
<xsl:call-template name="td"/>
|
3242
|
+
</fo:table-row>
|
3243
|
+
</xsl:for-each>
|
3244
|
+
</xsl:when>
|
3245
|
+
<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
|
3246
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
|
3247
|
+
<xsl:variable name="is_dt" select="position() = 1"/>
|
3248
|
+
|
3249
|
+
<xsl:for-each select="*">
|
3250
|
+
<!-- <test><xsl:copy-of select="."/></test> -->
|
3251
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
3252
|
+
<xsl:choose>
|
3253
|
+
<xsl:when test="$is_dt">
|
3254
|
+
<xsl:call-template name="insert_dt_cell"/>
|
3255
|
+
</xsl:when>
|
3256
|
+
<xsl:otherwise>
|
3257
|
+
<xsl:call-template name="insert_dd_cell"/>
|
3258
|
+
</xsl:otherwise>
|
3259
|
+
</xsl:choose>
|
3260
|
+
</fo:table-row>
|
3261
|
+
</xsl:for-each>
|
3262
|
+
</xsl:for-each>
|
3263
|
+
</xsl:otherwise>
|
3264
|
+
</xsl:choose>
|
3265
|
+
|
3266
|
+
</xsl:for-each>
|
3267
|
+
</fo:table-body>
|
2807
3268
|
</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
2808
3269
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
2809
3270
|
|
@@ -2890,7 +3351,7 @@
|
|
2890
3351
|
</xsl:choose>
|
2891
3352
|
</xsl:attribute>
|
2892
3353
|
</xsl:if>
|
2893
|
-
</xsl:template><xsl:template match="*[local-name()='td']">
|
3354
|
+
</xsl:template><xsl:template match="*[local-name()='td']" name="td">
|
2894
3355
|
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
|
2895
3356
|
<xsl:call-template name="setTextAlignment">
|
2896
3357
|
<xsl:with-param name="default">left</xsl:with-param>
|
@@ -2924,11 +3385,24 @@
|
|
2924
3385
|
|
2925
3386
|
<xsl:call-template name="setTableCellAttributes"/>
|
2926
3387
|
|
3388
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3389
|
+
<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
|
3390
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
3391
|
+
</xsl:if>
|
3392
|
+
|
2927
3393
|
<fo:block>
|
2928
3394
|
|
3395
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3396
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
3397
|
+
</xsl:if>
|
3398
|
+
|
3399
|
+
|
2929
3400
|
|
2930
3401
|
|
2931
3402
|
<xsl:apply-templates/>
|
3403
|
+
|
3404
|
+
<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"/> -->
|
3405
|
+
|
2932
3406
|
</fo:block>
|
2933
3407
|
</fo:table-cell>
|
2934
3408
|
</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
|
@@ -3131,9 +3605,9 @@
|
|
3131
3605
|
<!-- current hierarchy is 'figure' element -->
|
3132
3606
|
<xsl:variable name="following_dl_colwidths">
|
3133
3607
|
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
3134
|
-
<xsl:variable name="
|
3135
|
-
<xsl:variable name="doc_ns">
|
3136
|
-
|
3608
|
+
<xsl:variable name="simple-table">
|
3609
|
+
<!-- <xsl:variable name="doc_ns">
|
3610
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
3137
3611
|
</xsl:variable>
|
3138
3612
|
<xsl:variable name="ns">
|
3139
3613
|
<xsl:choose>
|
@@ -3144,7 +3618,7 @@
|
|
3144
3618
|
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
3145
3619
|
</xsl:otherwise>
|
3146
3620
|
</xsl:choose>
|
3147
|
-
</xsl:variable>
|
3621
|
+
</xsl:variable> -->
|
3148
3622
|
|
3149
3623
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
3150
3624
|
<tbody>
|
@@ -3155,7 +3629,7 @@
|
|
3155
3629
|
|
3156
3630
|
<xsl:call-template name="calculate-column-widths">
|
3157
3631
|
<xsl:with-param name="cols-count" select="2"/>
|
3158
|
-
<xsl:with-param name="table" select="$
|
3632
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
3159
3633
|
</xsl:call-template>
|
3160
3634
|
|
3161
3635
|
</xsl:if>
|
@@ -3279,8 +3753,10 @@
|
|
3279
3753
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
3280
3754
|
</xsl:variable>
|
3281
3755
|
|
3756
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
3757
|
+
|
3282
3758
|
<xsl:choose>
|
3283
|
-
<xsl:when test="$
|
3759
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
3284
3760
|
|
3285
3761
|
<fo:block margin-bottom="12pt" text-align="left">
|
3286
3762
|
|
@@ -3295,7 +3771,7 @@
|
|
3295
3771
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
3296
3772
|
</fo:block>
|
3297
3773
|
|
3298
|
-
</xsl:when>
|
3774
|
+
</xsl:when> <!-- END: only one component -->
|
3299
3775
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
3300
3776
|
<fo:block margin-bottom="12pt" text-align="left">
|
3301
3777
|
|
@@ -3309,8 +3785,8 @@
|
|
3309
3785
|
</xsl:variable>
|
3310
3786
|
<xsl:value-of select="$title-where"/>
|
3311
3787
|
</fo:block>
|
3312
|
-
</xsl:when>
|
3313
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
3788
|
+
</xsl:when> <!-- END: a few components -->
|
3789
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
3314
3790
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
3315
3791
|
|
3316
3792
|
|
@@ -3323,11 +3799,11 @@
|
|
3323
3799
|
</xsl:variable>
|
3324
3800
|
<xsl:value-of select="$title-key"/>
|
3325
3801
|
</fo:block>
|
3326
|
-
</xsl:when>
|
3802
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
3327
3803
|
</xsl:choose>
|
3328
3804
|
|
3329
3805
|
<!-- a few components -->
|
3330
|
-
<xsl:if test="
|
3806
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
3331
3807
|
<fo:block>
|
3332
3808
|
|
3333
3809
|
|
@@ -3338,7 +3814,18 @@
|
|
3338
3814
|
|
3339
3815
|
|
3340
3816
|
|
3817
|
+
|
3818
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3819
|
+
<!-- to determine start of table -->
|
3820
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
3821
|
+
</xsl:if>
|
3822
|
+
|
3341
3823
|
<fo:table width="95%" table-layout="fixed">
|
3824
|
+
|
3825
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
3826
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
3827
|
+
</xsl:if>
|
3828
|
+
|
3342
3829
|
|
3343
3830
|
<xsl:choose>
|
3344
3831
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
|
@@ -3347,54 +3834,143 @@
|
|
3347
3834
|
|
3348
3835
|
</xsl:when>
|
3349
3836
|
</xsl:choose>
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3837
|
+
|
3838
|
+
|
3839
|
+
<xsl:choose>
|
3840
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
3841
|
+
<!-- generate IF for table widths -->
|
3842
|
+
<!-- example:
|
3843
|
+
<tr>
|
3844
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
3845
|
+
<p>Symbol</p>
|
3846
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
3847
|
+
</td>
|
3848
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
3849
|
+
<p>Description</p>
|
3850
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
3851
|
+
</td>
|
3852
|
+
</tr>
|
3853
|
+
-->
|
3353
3854
|
|
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
|
-
|
3855
|
+
<!-- create virtual html table for dl/[dt and dd] -->
|
3856
|
+
<xsl:variable name="simple-table">
|
3857
|
+
|
3858
|
+
<xsl:variable name="dl_table">
|
3859
|
+
<tbody>
|
3860
|
+
<xsl:apply-templates mode="dl_if">
|
3861
|
+
<xsl:with-param name="id" select="@id"/>
|
3862
|
+
</xsl:apply-templates>
|
3863
|
+
</tbody>
|
3864
|
+
</xsl:variable>
|
3865
|
+
|
3866
|
+
<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
|
3867
|
+
|
3868
|
+
<!-- Step: replace <br/> to <p>...</p> -->
|
3869
|
+
<xsl:variable name="table_without_br">
|
3870
|
+
<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
|
3871
|
+
</xsl:variable>
|
3872
|
+
|
3873
|
+
<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
|
3874
|
+
|
3875
|
+
<!-- Step: add id to each cell -->
|
3876
|
+
<!-- add <word>...</word> for each word, image, math -->
|
3877
|
+
<xsl:variable name="simple-table-id">
|
3878
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
|
3879
|
+
<xsl:with-param name="id" select="@id"/>
|
3880
|
+
</xsl:apply-templates>
|
3881
|
+
</xsl:variable>
|
3882
|
+
|
3883
|
+
<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
|
3884
|
+
|
3885
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
3886
|
+
|
3887
|
+
</xsl:variable>
|
3888
|
+
|
3889
|
+
<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
|
3890
|
+
|
3891
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
|
3892
|
+
<xsl:with-param name="table_or_dl">dl</xsl:with-param>
|
3893
|
+
</xsl:apply-templates>
|
3894
|
+
|
3895
|
+
</xsl:when>
|
3896
|
+
<xsl:otherwise>
|
3897
|
+
|
3898
|
+
<xsl:variable name="simple-table">
|
3899
|
+
|
3900
|
+
<xsl:variable name="dl_table">
|
3901
|
+
<tbody>
|
3902
|
+
<xsl:apply-templates mode="dl">
|
3903
|
+
<xsl:with-param name="id" select="@id"/>
|
3904
|
+
</xsl:apply-templates>
|
3905
|
+
</tbody>
|
3906
|
+
</xsl:variable>
|
3907
|
+
|
3908
|
+
<xsl:copy-of select="$dl_table"/>
|
3909
|
+
</xsl:variable>
|
3910
|
+
|
3911
|
+
<xsl:variable name="colwidths">
|
3912
|
+
<xsl:call-template name="calculate-column-widths">
|
3913
|
+
<xsl:with-param name="cols-count" select="2"/>
|
3914
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
3915
|
+
</xsl:call-template>
|
3916
|
+
</xsl:variable>
|
3917
|
+
|
3918
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
3919
|
+
DEBUG
|
3920
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
3921
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
3922
|
+
|
3923
|
+
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
3924
|
+
|
3925
|
+
<xsl:variable name="maxlength_dt">
|
3926
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
3927
|
+
</xsl:variable>
|
3928
|
+
|
3929
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
3930
|
+
false
|
3931
|
+
</xsl:variable>
|
3932
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
3933
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
3934
|
+
|
3935
|
+
|
3936
|
+
<xsl:call-template name="setColumnWidth_dl">
|
3937
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3938
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
3939
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
3940
|
+
</xsl:call-template>
|
3941
|
+
|
3942
|
+
<fo:table-body>
|
3943
|
+
|
3944
|
+
<!-- DEBUG -->
|
3945
|
+
<xsl:if test="$table_if_debug = 'true'">
|
3946
|
+
<fo:table-row>
|
3947
|
+
<fo:table-cell number-columns-spanned="2" font-size="60%">
|
3948
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
3949
|
+
</fo:table-cell>
|
3950
|
+
</fo:table-row>
|
3951
|
+
</xsl:if>
|
3952
|
+
|
3953
|
+
<xsl:apply-templates>
|
3954
|
+
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
3955
|
+
<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
|
3956
|
+
</xsl:apply-templates>
|
3957
|
+
|
3958
|
+
</fo:table-body>
|
3959
|
+
</xsl:otherwise>
|
3960
|
+
</xsl:choose>
|
3389
3961
|
</fo:table>
|
3390
3962
|
</fo:block>
|
3391
3963
|
</fo:block>
|
3392
|
-
</xsl:if>
|
3964
|
+
</xsl:if> <!-- END: a few components -->
|
3393
3965
|
</fo:block-container>
|
3394
3966
|
</fo:block-container>
|
3395
3967
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
3396
3968
|
<xsl:param name="colwidths"/>
|
3397
3969
|
<xsl:param name="maxlength_dt"/>
|
3970
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
3971
|
+
|
3972
|
+
<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
|
3973
|
+
|
3398
3974
|
<xsl:choose>
|
3399
3975
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
3400
3976
|
<fo:table-column column-width="50%"/>
|
@@ -3402,6 +3978,16 @@
|
|
3402
3978
|
</xsl:when>
|
3403
3979
|
<xsl:otherwise>
|
3404
3980
|
<xsl:choose>
|
3981
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
3982
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3983
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3984
|
+
</xsl:call-template>
|
3985
|
+
</xsl:when>
|
3986
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
3987
|
+
<xsl:call-template name="insertTableColumnWidth">
|
3988
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
3989
|
+
</xsl:call-template>
|
3990
|
+
</xsl:when>
|
3405
3991
|
<!-- to set width check most wide chars like `W` -->
|
3406
3992
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
3407
3993
|
<fo:table-column column-width="7%"/>
|
@@ -3432,20 +4018,31 @@
|
|
3432
4018
|
<fo:table-column column-width="60%"/>
|
3433
4019
|
</xsl:when>
|
3434
4020
|
<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>
|
4021
|
+
<xsl:call-template name="insertTableColumnWidth">
|
4022
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
4023
|
+
</xsl:call-template>
|
3445
4024
|
</xsl:otherwise>
|
3446
4025
|
</xsl:choose>
|
3447
4026
|
</xsl:otherwise>
|
3448
4027
|
</xsl:choose>
|
4028
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
4029
|
+
<xsl:param name="colwidths"/>
|
4030
|
+
|
4031
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
4032
|
+
<xsl:choose>
|
4033
|
+
<xsl:when test=". = 1 or . = 0">
|
4034
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
4035
|
+
</xsl:when>
|
4036
|
+
<xsl:otherwise>
|
4037
|
+
<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
|
4038
|
+
<xsl:variable name="divider">
|
4039
|
+
<xsl:value-of select="@divider"/>
|
4040
|
+
<xsl:if test="not(@divider)">1</xsl:if>
|
4041
|
+
</xsl:variable>
|
4042
|
+
<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
|
4043
|
+
</xsl:otherwise>
|
4044
|
+
</xsl:choose>
|
4045
|
+
</xsl:for-each>
|
3449
4046
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
3450
4047
|
<xsl:variable name="lengths">
|
3451
4048
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -3469,7 +4066,6 @@
|
|
3469
4066
|
<xsl:value-of select="$maxLength"/>
|
3470
4067
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
3471
4068
|
<xsl:param name="key_iso"/>
|
3472
|
-
|
3473
4069
|
<!-- <tr>
|
3474
4070
|
<td>NOTE</td>
|
3475
4071
|
<td>
|
@@ -3477,27 +4073,47 @@
|
|
3477
4073
|
</td>
|
3478
4074
|
</tr>
|
3479
4075
|
-->
|
3480
|
-
|
4076
|
+
<!-- OLD Variant -->
|
4077
|
+
<!-- <fo:table-row>
|
3481
4078
|
<fo:table-cell>
|
3482
4079
|
<fo:block margin-top="6pt">
|
3483
4080
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3484
4081
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3485
4082
|
</xsl:if>
|
3486
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
4083
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
3487
4084
|
</fo:block>
|
3488
4085
|
</fo:table-cell>
|
3489
4086
|
<fo:table-cell>
|
3490
4087
|
<fo:block>
|
3491
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
4088
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
4089
|
+
</fo:block>
|
4090
|
+
</fo:table-cell>
|
4091
|
+
</fo:table-row> -->
|
4092
|
+
<!-- <tr>
|
4093
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
4094
|
+
</tr>
|
4095
|
+
-->
|
4096
|
+
<fo:table-row>
|
4097
|
+
<fo:table-cell number-columns-spanned="2">
|
4098
|
+
<fo:block>
|
4099
|
+
<xsl:call-template name="note"/>
|
3492
4100
|
</fo:block>
|
3493
4101
|
</fo:table-cell>
|
3494
4102
|
</fo:table-row>
|
3495
4103
|
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
|
4104
|
+
<xsl:param name="id"/>
|
4105
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
3496
4106
|
<tr>
|
3497
4107
|
<td>
|
4108
|
+
<xsl:attribute name="id">
|
4109
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
|
4110
|
+
</xsl:attribute>
|
3498
4111
|
<xsl:apply-templates/>
|
3499
4112
|
</td>
|
3500
4113
|
<td>
|
4114
|
+
<xsl:attribute name="id">
|
4115
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
|
4116
|
+
</xsl:attribute>
|
3501
4117
|
|
3502
4118
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
3503
4119
|
<xsl:with-param name="process">true</xsl:with-param>
|
@@ -3508,50 +4124,122 @@
|
|
3508
4124
|
|
3509
4125
|
</xsl:template><xsl:template match="*[local-name()='dt']">
|
3510
4126
|
<xsl:param name="key_iso"/>
|
4127
|
+
<xsl:param name="split_keep-within-line"/>
|
3511
4128
|
|
3512
4129
|
<fo:table-row xsl:use-attribute-sets="dt-row-style">
|
3513
|
-
<
|
4130
|
+
<xsl:call-template name="insert_dt_cell">
|
4131
|
+
<xsl:with-param name="key_iso" select="$key_iso"/>
|
4132
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4133
|
+
</xsl:call-template>
|
4134
|
+
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
|
4135
|
+
<xsl:call-template name="insert_dd_cell">
|
4136
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4137
|
+
</xsl:call-template>
|
4138
|
+
</xsl:for-each>
|
4139
|
+
</fo:table-row>
|
4140
|
+
</xsl:template><xsl:template name="insert_dt_cell">
|
4141
|
+
<xsl:param name="key_iso"/>
|
4142
|
+
<xsl:param name="split_keep-within-line"/>
|
4143
|
+
<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
|
4144
|
+
|
4145
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4146
|
+
<!-- border is mandatory, to calculate real width -->
|
4147
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
4148
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
4149
|
+
</xsl:if>
|
4150
|
+
|
4151
|
+
|
4152
|
+
<fo:block xsl:use-attribute-sets="dt-block-style">
|
4153
|
+
<xsl:copy-of select="@id"/>
|
4154
|
+
|
4155
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
4156
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
4157
|
+
</xsl:if>
|
4158
|
+
|
4159
|
+
|
4160
|
+
|
4161
|
+
<xsl:apply-templates>
|
4162
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4163
|
+
</xsl:apply-templates>
|
4164
|
+
|
4165
|
+
<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"/> -->
|
4166
|
+
|
4167
|
+
</fo:block>
|
4168
|
+
</fo:table-cell>
|
4169
|
+
</xsl:template><xsl:template name="insert_dd_cell">
|
4170
|
+
<xsl:param name="split_keep-within-line"/>
|
4171
|
+
<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
|
4172
|
+
|
4173
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4174
|
+
<!-- border is mandatory, to calculate real width -->
|
4175
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
4176
|
+
</xsl:if>
|
4177
|
+
|
4178
|
+
<fo:block>
|
4179
|
+
|
4180
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
4181
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
4182
|
+
</xsl:if>
|
4183
|
+
|
3514
4184
|
|
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
4185
|
|
3531
|
-
|
3532
|
-
|
3533
|
-
|
3534
|
-
|
3535
|
-
|
3536
|
-
|
4186
|
+
<xsl:choose>
|
4187
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
4188
|
+
<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
|
4189
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
4190
|
+
</xsl:apply-templates>
|
4191
|
+
</xsl:when>
|
4192
|
+
<xsl:otherwise>
|
4193
|
+
<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
|
4194
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
4195
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4196
|
+
</xsl:apply-templates>
|
4197
|
+
</xsl:otherwise>
|
4198
|
+
|
4199
|
+
</xsl:choose>
|
4200
|
+
|
4201
|
+
<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"/> -->
|
4202
|
+
|
4203
|
+
</fo:block>
|
4204
|
+
</fo:table-cell>
|
3537
4205
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
3538
4206
|
<xsl:apply-templates/>
|
3539
4207
|
</xsl:template><xsl:template match="*[local-name()='dd']">
|
3540
4208
|
<xsl:param name="process">false</xsl:param>
|
4209
|
+
<xsl:param name="split_keep-within-line"/>
|
3541
4210
|
<xsl:if test="$process = 'true'">
|
3542
4211
|
<xsl:apply-templates select="@language"/>
|
3543
|
-
<xsl:apply-templates
|
4212
|
+
<xsl:apply-templates>
|
4213
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4214
|
+
</xsl:apply-templates>
|
3544
4215
|
</xsl:if>
|
3545
4216
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
3546
4217
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
3547
|
-
</xsl:template><xsl:template match="*[local-name()='
|
4218
|
+
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
|
4219
|
+
<xsl:param name="id"/>
|
4220
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
4221
|
+
<tr>
|
4222
|
+
<td>
|
4223
|
+
<xsl:copy-of select="node()"/>
|
4224
|
+
</td>
|
4225
|
+
<td>
|
4226
|
+
|
4227
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
|
4228
|
+
|
4229
|
+
</td>
|
4230
|
+
</tr>
|
4231
|
+
|
4232
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
|
3548
4233
|
<fo:inline font-style="italic">
|
3549
4234
|
<xsl:apply-templates/>
|
3550
4235
|
</fo:inline>
|
3551
4236
|
</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
|
4237
|
+
<xsl:param name="split_keep-within-line"/>
|
3552
4238
|
<fo:inline font-weight="bold">
|
3553
4239
|
|
3554
|
-
<xsl:apply-templates
|
4240
|
+
<xsl:apply-templates>
|
4241
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
4242
|
+
</xsl:apply-templates>
|
3555
4243
|
</fo:inline>
|
3556
4244
|
</xsl:template><xsl:template match="*[local-name()='padding']">
|
3557
4245
|
<fo:inline padding-right="{@value}"> </fo:inline>
|
@@ -3590,13 +4278,15 @@
|
|
3590
4278
|
<xsl:choose>
|
3591
4279
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
3592
4280
|
<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>
|
4281
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
3594
4282
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
3595
4283
|
</xsl:choose>
|
3596
4284
|
</xsl:attribute>
|
3597
4285
|
</xsl:if>
|
3598
4286
|
<xsl:apply-templates/>
|
3599
4287
|
</fo:inline>
|
4288
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
4289
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
3600
4290
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
3601
4291
|
<fo:inline text-decoration="underline">
|
3602
4292
|
<xsl:apply-templates/>
|
@@ -3744,54 +4434,120 @@
|
|
3744
4434
|
<fo:block break-after="page"/>
|
3745
4435
|
<fo:block> </fo:block>
|
3746
4436
|
<fo:block break-after="page"/>
|
4437
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
4438
|
+
<xsl:apply-templates/>
|
3747
4439
|
</xsl:template><xsl:template name="tokenize">
|
3748
4440
|
<xsl:param name="text"/>
|
3749
4441
|
<xsl:param name="separator" select="' '"/>
|
3750
4442
|
<xsl:choose>
|
4443
|
+
|
4444
|
+
<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
|
4445
|
+
<word><xsl:value-of select="normalize-space($text)"/></word>
|
4446
|
+
</xsl:when>
|
3751
4447
|
<xsl:when test="not(contains($text, $separator))">
|
3752
4448
|
<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
4449
|
<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
4450
|
<xsl:choose>
|
3777
|
-
<xsl:when test="$
|
3778
|
-
<xsl:value-of select="$
|
4451
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
4452
|
+
<xsl:value-of select="$len_str_tmp"/>
|
3779
4453
|
</xsl:when>
|
3780
4454
|
<xsl:otherwise>
|
3781
|
-
<xsl:
|
4455
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
4456
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
4457
|
+
<xsl:variable name="len_str">
|
4458
|
+
<xsl:choose>
|
4459
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
4460
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
4461
|
+
</xsl:when>
|
4462
|
+
<xsl:otherwise>
|
4463
|
+
<xsl:value-of select="$len_str_tmp"/>
|
4464
|
+
</xsl:otherwise>
|
4465
|
+
</xsl:choose>
|
4466
|
+
</xsl:variable>
|
4467
|
+
|
4468
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
4469
|
+
<xsl:message>
|
4470
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
4471
|
+
len_str=<xsl:value-of select="$len_str"/>
|
4472
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
4473
|
+
</xsl:message>
|
4474
|
+
</xsl:if> -->
|
4475
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
4476
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
4477
|
+
<xsl:choose>
|
4478
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
4479
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
4480
|
+
</xsl:when>
|
4481
|
+
<xsl:otherwise>
|
4482
|
+
<xsl:value-of select="$len_str"/>
|
4483
|
+
</xsl:otherwise>
|
4484
|
+
</xsl:choose>
|
3782
4485
|
</xsl:otherwise>
|
3783
4486
|
</xsl:choose>
|
3784
4487
|
</word>
|
3785
4488
|
</xsl:when>
|
3786
4489
|
<xsl:otherwise>
|
3787
4490
|
<word>
|
3788
|
-
<xsl:
|
4491
|
+
<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
|
4492
|
+
<xsl:choose>
|
4493
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
4494
|
+
<xsl:value-of select="$word"/>
|
4495
|
+
</xsl:when>
|
4496
|
+
<xsl:otherwise>
|
4497
|
+
<xsl:value-of select="string-length($word)"/>
|
4498
|
+
</xsl:otherwise>
|
4499
|
+
</xsl:choose>
|
3789
4500
|
</word>
|
3790
4501
|
<xsl:call-template name="tokenize">
|
3791
4502
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
3792
4503
|
</xsl:call-template>
|
3793
4504
|
</xsl:otherwise>
|
3794
4505
|
</xsl:choose>
|
4506
|
+
</xsl:template><xsl:template name="tokenize_with_tags">
|
4507
|
+
<xsl:param name="tags"/>
|
4508
|
+
<xsl:param name="text"/>
|
4509
|
+
<xsl:param name="separator" select="' '"/>
|
4510
|
+
<xsl:choose>
|
4511
|
+
|
4512
|
+
<xsl:when test="not(contains($text, $separator))">
|
4513
|
+
<word>
|
4514
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4515
|
+
<xsl:with-param name="text" select="normalize-space($text)"/>
|
4516
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4517
|
+
</xsl:call-template>
|
4518
|
+
</word>
|
4519
|
+
</xsl:when>
|
4520
|
+
<xsl:otherwise>
|
4521
|
+
<word>
|
4522
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4523
|
+
<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
|
4524
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4525
|
+
</xsl:call-template>
|
4526
|
+
</word>
|
4527
|
+
<xsl:call-template name="tokenize_with_tags">
|
4528
|
+
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
4529
|
+
</xsl:call-template>
|
4530
|
+
</xsl:otherwise>
|
4531
|
+
</xsl:choose>
|
4532
|
+
</xsl:template><xsl:template name="enclose_text_in_tags">
|
4533
|
+
<xsl:param name="text"/>
|
4534
|
+
<xsl:param name="tags"/>
|
4535
|
+
<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
|
4536
|
+
|
4537
|
+
<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
|
4538
|
+
|
4539
|
+
<xsl:choose>
|
4540
|
+
<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
|
4541
|
+
<xsl:otherwise>
|
4542
|
+
<xsl:element name="{$tag_name}">
|
4543
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4544
|
+
<xsl:with-param name="text" select="$text"/>
|
4545
|
+
<xsl:with-param name="tags" select="$tags"/>
|
4546
|
+
<xsl:with-param name="num" select="$num + 1"/>
|
4547
|
+
</xsl:call-template>
|
4548
|
+
</xsl:element>
|
4549
|
+
</xsl:otherwise>
|
4550
|
+
</xsl:choose>
|
3795
4551
|
</xsl:template><xsl:template name="max_length">
|
3796
4552
|
<xsl:param name="words"/>
|
3797
4553
|
<xsl:for-each select="$words//word">
|
@@ -3892,12 +4648,19 @@
|
|
3892
4648
|
</xsl:otherwise>
|
3893
4649
|
</xsl:choose>
|
3894
4650
|
</xsl:template><xsl:template name="getSimpleTable">
|
4651
|
+
<xsl:param name="id"/>
|
4652
|
+
|
3895
4653
|
<xsl:variable name="simple-table">
|
3896
4654
|
|
4655
|
+
<!-- Step 0. replace <br/> to <p>...</p> -->
|
4656
|
+
<xsl:variable name="table_without_br">
|
4657
|
+
<xsl:apply-templates mode="table-without-br"/>
|
4658
|
+
</xsl:variable>
|
4659
|
+
|
3897
4660
|
<!-- Step 1. colspan processing -->
|
3898
4661
|
<xsl:variable name="simple-table-colspan">
|
3899
4662
|
<tbody>
|
3900
|
-
<xsl:apply-templates mode="simple-table-colspan"/>
|
4663
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
|
3901
4664
|
</tbody>
|
3902
4665
|
</xsl:variable>
|
3903
4666
|
|
@@ -3906,10 +4669,67 @@
|
|
3906
4669
|
<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
|
3907
4670
|
</xsl:variable>
|
3908
4671
|
|
3909
|
-
|
3910
|
-
|
4672
|
+
<!-- Step 3: add id to each cell -->
|
4673
|
+
<!-- add <word>...</word> for each word, image, math -->
|
4674
|
+
<xsl:variable name="simple-table-id">
|
4675
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
|
4676
|
+
<xsl:with-param name="id" select="$id"/>
|
4677
|
+
</xsl:apply-templates>
|
4678
|
+
</xsl:variable>
|
4679
|
+
|
4680
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
4681
|
+
|
3911
4682
|
</xsl:variable>
|
3912
4683
|
<xsl:copy-of select="$simple-table"/>
|
4684
|
+
</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
|
4685
|
+
<xsl:copy>
|
4686
|
+
<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
|
4687
|
+
</xsl:copy>
|
4688
|
+
</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">
|
4689
|
+
<xsl:copy>
|
4690
|
+
<xsl:copy-of select="@*"/>
|
4691
|
+
<p>
|
4692
|
+
<xsl:copy-of select="node()"/>
|
4693
|
+
</p>
|
4694
|
+
</xsl:copy>
|
4695
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
|
4696
|
+
<xsl:copy>
|
4697
|
+
<xsl:copy-of select="@*"/>
|
4698
|
+
<xsl:for-each select="*[local-name()='br']">
|
4699
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
4700
|
+
<p>
|
4701
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
4702
|
+
<xsl:copy-of select="."/>
|
4703
|
+
</xsl:for-each>
|
4704
|
+
</p>
|
4705
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
4706
|
+
<p>
|
4707
|
+
<xsl:for-each select="following-sibling::node()">
|
4708
|
+
<xsl:copy-of select="."/>
|
4709
|
+
</xsl:for-each>
|
4710
|
+
</p>
|
4711
|
+
</xsl:if>
|
4712
|
+
</xsl:for-each>
|
4713
|
+
</xsl:copy>
|
4714
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
|
4715
|
+
<xsl:for-each select="*[local-name()='br']">
|
4716
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
4717
|
+
<p>
|
4718
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
4719
|
+
<xsl:copy-of select="."/>
|
4720
|
+
</xsl:for-each>
|
4721
|
+
</p>
|
4722
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
4723
|
+
<p>
|
4724
|
+
<xsl:for-each select="following-sibling::node()">
|
4725
|
+
<xsl:copy-of select="."/>
|
4726
|
+
</xsl:for-each>
|
4727
|
+
</p>
|
4728
|
+
</xsl:if>
|
4729
|
+
</xsl:for-each>
|
4730
|
+
</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
4731
|
+
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
4732
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
3913
4733
|
</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
|
3914
4734
|
<xsl:apply-templates mode="simple-table-colspan"/>
|
3915
4735
|
</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">
|
@@ -3999,6 +4819,126 @@
|
|
3999
4819
|
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
4000
4820
|
<xsl:with-param name="previousRow" select="$newRow"/>
|
4001
4821
|
</xsl:apply-templates>
|
4822
|
+
</xsl:template><xsl:template match="/" mode="simple-table-id">
|
4823
|
+
<xsl:param name="id"/>
|
4824
|
+
<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
|
4825
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
4826
|
+
<xsl:with-param name="id" select="$id_prefixed"/>
|
4827
|
+
</xsl:apply-templates>
|
4828
|
+
</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
|
4829
|
+
<xsl:param name="id"/>
|
4830
|
+
<xsl:copy>
|
4831
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
4832
|
+
<xsl:with-param name="id" select="$id"/>
|
4833
|
+
</xsl:apply-templates>
|
4834
|
+
</xsl:copy>
|
4835
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
|
4836
|
+
<xsl:param name="id"/>
|
4837
|
+
<xsl:copy>
|
4838
|
+
<xsl:copy-of select="@*"/>
|
4839
|
+
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
|
4840
|
+
<xsl:apply-templates select="node()" mode="simple-table-id">
|
4841
|
+
<xsl:with-param name="id" select="$id"/>
|
4842
|
+
</xsl:apply-templates>
|
4843
|
+
</xsl:copy>
|
4844
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
|
4845
|
+
<xsl:param name="id"/>
|
4846
|
+
<xsl:copy>
|
4847
|
+
<xsl:copy-of select="@*"/>
|
4848
|
+
<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
|
4849
|
+
<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
|
4850
|
+
<xsl:attribute name="id">
|
4851
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
|
4852
|
+
</xsl:attribute>
|
4853
|
+
|
4854
|
+
<xsl:for-each select="*[local-name() = 'p']">
|
4855
|
+
<xsl:copy>
|
4856
|
+
<xsl:copy-of select="@*"/>
|
4857
|
+
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
4858
|
+
<xsl:attribute name="id">
|
4859
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
|
4860
|
+
</xsl:attribute>
|
4861
|
+
|
4862
|
+
<xsl:copy-of select="node()"/>
|
4863
|
+
</xsl:copy>
|
4864
|
+
</xsl:for-each>
|
4865
|
+
|
4866
|
+
|
4867
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
|
4868
|
+
|
4869
|
+
<xsl:variable name="td_text">
|
4870
|
+
<xsl:apply-templates select="." mode="td_text_with_formatting"/>
|
4871
|
+
</xsl:variable>
|
4872
|
+
|
4873
|
+
<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
|
4874
|
+
|
4875
|
+
<xsl:variable name="words">
|
4876
|
+
<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
|
4877
|
+
<word>
|
4878
|
+
<xsl:copy-of select="."/>
|
4879
|
+
</word>
|
4880
|
+
</xsl:for-each>
|
4881
|
+
|
4882
|
+
<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
|
4883
|
+
<xsl:copy-of select="."/>
|
4884
|
+
</xsl:for-each>
|
4885
|
+
|
4886
|
+
</xsl:variable>
|
4887
|
+
|
4888
|
+
<xsl:for-each select="xalan:nodeset($words)/word">
|
4889
|
+
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
4890
|
+
<xsl:copy>
|
4891
|
+
<xsl:attribute name="id">
|
4892
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
|
4893
|
+
</xsl:attribute>
|
4894
|
+
<xsl:copy-of select="node()"/>
|
4895
|
+
</xsl:copy>
|
4896
|
+
</xsl:for-each>
|
4897
|
+
</xsl:if>
|
4898
|
+
</xsl:copy>
|
4899
|
+
|
4900
|
+
</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
|
4901
|
+
<xsl:copy>
|
4902
|
+
<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
|
4903
|
+
</xsl:copy>
|
4904
|
+
</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">
|
4905
|
+
<xsl:variable name="formatting_tags">
|
4906
|
+
<xsl:call-template name="getFormattingTags"/>
|
4907
|
+
</xsl:variable>
|
4908
|
+
<word>
|
4909
|
+
<xsl:call-template name="enclose_text_in_tags">
|
4910
|
+
<xsl:with-param name="text" select="normalize-space(.)"/>
|
4911
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
4912
|
+
</xsl:call-template>
|
4913
|
+
</word>
|
4914
|
+
</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
4915
|
+
|
4916
|
+
<xsl:variable name="td_text" select="."/>
|
4917
|
+
|
4918
|
+
<xsl:variable name="string_with_added_zerospaces">
|
4919
|
+
<xsl:call-template name="add-zero-spaces-java">
|
4920
|
+
<xsl:with-param name="text" select="$td_text"/>
|
4921
|
+
</xsl:call-template>
|
4922
|
+
</xsl:variable>
|
4923
|
+
|
4924
|
+
<xsl:variable name="formatting_tags">
|
4925
|
+
<xsl:call-template name="getFormattingTags"/>
|
4926
|
+
</xsl:variable>
|
4927
|
+
|
4928
|
+
<!-- <word>text</word> -->
|
4929
|
+
<xsl:call-template name="tokenize_with_tags">
|
4930
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
4931
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
4932
|
+
</xsl:call-template>
|
4933
|
+
</xsl:template><xsl:template name="getFormattingTags">
|
4934
|
+
<tags>
|
4935
|
+
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
4936
|
+
<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
|
4937
|
+
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
4938
|
+
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
4939
|
+
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
4940
|
+
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
4941
|
+
</tags>
|
4002
4942
|
</xsl:template><xsl:template name="getLang">
|
4003
4943
|
<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
|
4004
4944
|
<xsl:variable name="language">
|
@@ -4053,6 +4993,9 @@
|
|
4053
4993
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
4054
4994
|
|
4055
4995
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
4996
|
+
|
4997
|
+
|
4998
|
+
|
4056
4999
|
|
4057
5000
|
|
4058
5001
|
<xsl:call-template name="setTrackChangesStyles">
|
@@ -4060,48 +5003,80 @@
|
|
4060
5003
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
4061
5004
|
</xsl:call-template>
|
4062
5005
|
|
5006
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
5007
|
+
<!-- insert helper tag -->
|
5008
|
+
<!-- set unique font-size (fiction) -->
|
5009
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
5010
|
+
<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 -->
|
5011
|
+
</xsl:if>
|
4063
5012
|
|
4064
|
-
|
4065
|
-
|
4066
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
5013
|
+
<xsl:variable name="mathml_content">
|
5014
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
4067
5015
|
</xsl:variable>
|
4068
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
4069
5016
|
|
5017
|
+
|
5018
|
+
<xsl:call-template name="mathml_instream_object">
|
5019
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
5020
|
+
</xsl:call-template>
|
4070
5021
|
|
4071
|
-
|
4072
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
4073
|
-
<xsl:variable name="comment_text_">
|
4074
|
-
<xsl:choose>
|
4075
|
-
<xsl:when test="normalize-space($comment_text_following) != ''">
|
4076
|
-
<xsl:value-of select="$comment_text_following"/>
|
4077
|
-
</xsl:when>
|
4078
|
-
<xsl:otherwise>
|
4079
|
-
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
4080
|
-
</xsl:otherwise>
|
4081
|
-
</xsl:choose>
|
4082
|
-
</xsl:variable>
|
4083
|
-
<xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
4084
|
-
|
4085
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
4086
|
-
<!-- put Mathin Alternate Text -->
|
4087
|
-
<xsl:attribute name="fox:alt-text">
|
4088
|
-
<xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
|
4089
|
-
</xsl:attribute>
|
4090
|
-
</xsl:if>
|
4091
|
-
|
4092
|
-
<xsl:variable name="mathml_content">
|
4093
|
-
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
4094
|
-
</xsl:variable>
|
4095
|
-
<!-- put MathML in Actual Text -->
|
4096
|
-
<xsl:attribute name="fox:actual-text">
|
4097
|
-
<xsl:value-of select="$mathml_content"/>
|
4098
|
-
</xsl:attribute>
|
4099
|
-
|
4100
|
-
|
4101
|
-
|
4102
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
4103
|
-
</fo:instream-foreign-object>
|
5022
|
+
|
4104
5023
|
</fo:inline>
|
5024
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
5025
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
5026
|
+
<xsl:variable name="comment_text_">
|
5027
|
+
<xsl:choose>
|
5028
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
5029
|
+
<xsl:value-of select="$comment_text_following"/>
|
5030
|
+
</xsl:when>
|
5031
|
+
<xsl:otherwise>
|
5032
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
5033
|
+
</xsl:otherwise>
|
5034
|
+
</xsl:choose>
|
5035
|
+
</xsl:variable>
|
5036
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
5037
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
5038
|
+
<xsl:value-of select="$comment_text"/>
|
5039
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
5040
|
+
<xsl:param name="comment_text"/>
|
5041
|
+
<xsl:param name="mathml_content"/>
|
5042
|
+
|
5043
|
+
<xsl:variable name="comment_text_">
|
5044
|
+
<xsl:choose>
|
5045
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
5046
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
5047
|
+
</xsl:choose>
|
5048
|
+
</xsl:variable>
|
5049
|
+
|
5050
|
+
<xsl:variable name="mathml">
|
5051
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
5052
|
+
</xsl:variable>
|
5053
|
+
|
5054
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
5055
|
+
|
5056
|
+
|
5057
|
+
|
5058
|
+
|
5059
|
+
|
5060
|
+
|
5061
|
+
|
5062
|
+
<!-- put MathML in Actual Text -->
|
5063
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
5064
|
+
<xsl:attribute name="fox:actual-text">
|
5065
|
+
<xsl:value-of select="$mathml_content"/>
|
5066
|
+
</xsl:attribute>
|
5067
|
+
|
5068
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
5069
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
5070
|
+
<!-- put Mathin Alternate Text -->
|
5071
|
+
<xsl:attribute name="fox:alt-text">
|
5072
|
+
<xsl:value-of select="$comment_text_"/>
|
5073
|
+
</xsl:attribute>
|
5074
|
+
</xsl:if>
|
5075
|
+
<!-- </xsl:if> -->
|
5076
|
+
|
5077
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
5078
|
+
|
5079
|
+
</fo:instream-foreign-object>
|
4105
5080
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
4106
5081
|
<!-- <xsl:text>a+b</xsl:text> -->
|
4107
5082
|
<xsl:text><</xsl:text>
|
@@ -4132,7 +5107,9 @@
|
|
4132
5107
|
<!-- replace start and end spaces to non-break space -->
|
4133
5108
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
4134
5109
|
</xsl:copy>
|
4135
|
-
</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="
|
5110
|
+
</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">
|
5111
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
5112
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
4136
5113
|
<xsl:variable name="target">
|
4137
5114
|
<xsl:choose>
|
4138
5115
|
<xsl:when test="@updatetype = 'true'">
|
@@ -4729,18 +5706,33 @@
|
|
4729
5706
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
4730
5707
|
<xsl:copy>
|
4731
5708
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
4732
|
-
<xsl:variable name="
|
5709
|
+
<xsl:variable name="viewbox_">
|
4733
5710
|
<xsl:call-template name="split">
|
4734
5711
|
<xsl:with-param name="pText" select="@viewBox"/>
|
4735
5712
|
<xsl:with-param name="sep" select="' '"/>
|
4736
5713
|
</xsl:call-template>
|
4737
5714
|
</xsl:variable>
|
5715
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
5716
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
5717
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
5718
|
+
|
4738
5719
|
<xsl:attribute name="width">
|
4739
|
-
<xsl:
|
5720
|
+
<xsl:choose>
|
5721
|
+
<xsl:when test="$width != ''">
|
5722
|
+
<xsl:value-of select="round($width)"/>
|
5723
|
+
</xsl:when>
|
5724
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
5725
|
+
</xsl:choose>
|
4740
5726
|
</xsl:attribute>
|
4741
5727
|
<xsl:attribute name="height">
|
4742
|
-
<xsl:
|
5728
|
+
<xsl:choose>
|
5729
|
+
<xsl:when test="$height != ''">
|
5730
|
+
<xsl:value-of select="round($height)"/>
|
5731
|
+
</xsl:when>
|
5732
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
5733
|
+
</xsl:choose>
|
4743
5734
|
</xsl:attribute>
|
5735
|
+
|
4744
5736
|
<xsl:apply-templates mode="svg_update"/>
|
4745
5737
|
</xsl:copy>
|
4746
5738
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -4935,7 +5927,11 @@
|
|
4935
5927
|
<xsl:apply-templates mode="bookmarks"/>
|
4936
5928
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
4937
5929
|
<xsl:apply-templates select="."/>
|
4938
|
-
</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() = '
|
5930
|
+
</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">
|
5931
|
+
<xsl:apply-templates mode="contents"/>
|
5932
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
5933
|
+
<xsl:apply-templates mode="bookmarks"/>
|
5934
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
4939
5935
|
<xsl:apply-templates mode="bookmarks"/>
|
4940
5936
|
</xsl:template><xsl:template name="addBookmarks">
|
4941
5937
|
<xsl:param name="contents"/>
|
@@ -5206,7 +6202,9 @@
|
|
5206
6202
|
<xsl:apply-templates/>
|
5207
6203
|
</xsl:otherwise>
|
5208
6204
|
</xsl:choose>
|
5209
|
-
</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() = '
|
6205
|
+
</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">
|
6206
|
+
<xsl:value-of select="."/>
|
6207
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
5210
6208
|
<xsl:text> </xsl:text>
|
5211
6209
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
5212
6210
|
<xsl:copy>
|
@@ -5237,9 +6235,22 @@
|
|
5237
6235
|
</xsl:when>
|
5238
6236
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
5239
6237
|
</xsl:choose>
|
6238
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
6239
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
6240
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
6241
|
+
<xsl:apply-templates mode="contents_item"/>
|
5240
6242
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
5241
6243
|
|
5242
6244
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
6245
|
+
|
6246
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
6247
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6248
|
+
</xsl:if>
|
6249
|
+
|
6250
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
6251
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6252
|
+
</xsl:if>
|
6253
|
+
|
5243
6254
|
<xsl:copy-of select="@id"/>
|
5244
6255
|
|
5245
6256
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -5618,7 +6629,9 @@
|
|
5618
6629
|
<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
|
5619
6630
|
</xsl:if>
|
5620
6631
|
<xsl:variable name="simple-table">
|
5621
|
-
<xsl:call-template name="getSimpleTable"
|
6632
|
+
<xsl:call-template name="getSimpleTable">
|
6633
|
+
<xsl:with-param name="id" select="@id"/>
|
6634
|
+
</xsl:call-template>
|
5622
6635
|
</xsl:variable>
|
5623
6636
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
|
5624
6637
|
<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
|
@@ -5727,39 +6740,67 @@
|
|
5727
6740
|
</xsl:otherwise>
|
5728
6741
|
</xsl:choose>
|
5729
6742
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
5730
|
-
|
5731
|
-
|
6743
|
+
|
6744
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
6745
|
+
|
5732
6746
|
|
6747
|
+
|
5733
6748
|
<xsl:variable name="fo_element">
|
5734
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
6749
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
5735
6750
|
block
|
5736
6751
|
</xsl:variable>
|
5737
6752
|
|
5738
|
-
|
5739
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
5740
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
5741
|
-
</xsl:apply-templates>
|
6753
|
+
<fo:block-container margin-left="0mm">
|
5742
6754
|
|
5743
|
-
|
5744
|
-
|
5745
|
-
<
|
5746
|
-
|
5747
|
-
|
6755
|
+
<xsl:choose>
|
6756
|
+
|
6757
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
6758
|
+
|
6759
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
6760
|
+
<fo:block>
|
6761
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
5748
6762
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
5749
6763
|
</xsl:apply-templates>
|
6764
|
+
</fo:block>
|
6765
|
+
|
6766
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6767
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6768
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
6769
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6770
|
+
</xsl:apply-templates>
|
6771
|
+
</fo:block-container>
|
5750
6772
|
</fo:block-container>
|
5751
|
-
</
|
5752
|
-
|
5753
|
-
|
5754
|
-
|
5755
|
-
|
5756
|
-
|
5757
|
-
|
5758
|
-
|
5759
|
-
|
5760
|
-
|
5761
|
-
|
5762
|
-
|
6773
|
+
</xsl:when> <!-- end block -->
|
6774
|
+
|
6775
|
+
<xsl:otherwise> <!-- inline -->
|
6776
|
+
|
6777
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
6778
|
+
<fo:block>
|
6779
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
6780
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6781
|
+
</xsl:apply-templates>
|
6782
|
+
<fo:inline>
|
6783
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
6784
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
6785
|
+
</xsl:apply-templates>
|
6786
|
+
</fo:inline>
|
6787
|
+
</fo:block>
|
6788
|
+
|
6789
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
6790
|
+
<!-- display further elements in blocks -->
|
6791
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
6792
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
6793
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
6794
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
6795
|
+
</xsl:apply-templates>
|
6796
|
+
</fo:block-container>
|
6797
|
+
</fo:block-container>
|
6798
|
+
</xsl:if>
|
6799
|
+
</xsl:otherwise> <!-- end inline -->
|
6800
|
+
|
6801
|
+
</xsl:choose>
|
6802
|
+
</fo:block-container>
|
6803
|
+
</fo:block-container>
|
5763
6804
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
5764
6805
|
<xsl:param name="fo_element">block</xsl:param>
|
5765
6806
|
|
@@ -5791,10 +6832,16 @@
|
|
5791
6832
|
</xsl:variable>
|
5792
6833
|
<xsl:choose>
|
5793
6834
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
5794
|
-
<fo:block
|
5795
|
-
|
5796
|
-
|
5797
|
-
|
6835
|
+
<fo:block-container>
|
6836
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
6837
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
6838
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
6839
|
+
</xsl:if>
|
6840
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
6841
|
+
|
6842
|
+
<xsl:apply-templates/>
|
6843
|
+
</fo:block>
|
6844
|
+
</fo:block-container>
|
5798
6845
|
</xsl:when>
|
5799
6846
|
<xsl:otherwise>
|
5800
6847
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -5976,7 +7023,16 @@
|
|
5976
7023
|
</fo:inline>
|
5977
7024
|
</xsl:when>
|
5978
7025
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
5979
|
-
|
7026
|
+
|
7027
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
7028
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
7029
|
+
<xsl:choose>
|
7030
|
+
<xsl:when test="$uri_src != ''">
|
7031
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
7032
|
+
</xsl:when>
|
7033
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
7034
|
+
</xsl:choose>
|
7035
|
+
|
5980
7036
|
</xsl:otherwise>
|
5981
7037
|
</xsl:choose>
|
5982
7038
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -6161,10 +7217,24 @@
|
|
6161
7217
|
|
6162
7218
|
</fo:block>
|
6163
7219
|
<xsl:apply-templates/>
|
6164
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
7220
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
6165
7221
|
<!-- comment 2019-11-29 -->
|
6166
7222
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
6167
7223
|
<xsl:apply-templates /> -->
|
7224
|
+
|
7225
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
7226
|
+
|
7227
|
+
<xsl:choose>
|
7228
|
+
<!-- if there isn't the attribute '@from', then -->
|
7229
|
+
<xsl:when test="$id_from = ''">
|
7230
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7231
|
+
</xsl:when>
|
7232
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
7233
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
7234
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
7235
|
+
</xsl:when>
|
7236
|
+
</xsl:choose>
|
7237
|
+
|
6168
7238
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
6169
7239
|
<!-- 0xA0 to space replacement -->
|
6170
7240
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -6521,7 +7591,10 @@
|
|
6521
7591
|
<!-- to split by '_' and other chars -->
|
6522
7592
|
<xsl:call-template name="add-zero-spaces-java"/>
|
6523
7593
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
6524
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
7594
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
7595
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
7596
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
7597
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
|
6525
7598
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
6526
7599
|
<!-- <row>
|
6527
7600
|
<date>05-07-2013</date>
|
@@ -7189,6 +8262,120 @@
|
|
7189
8262
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
7190
8263
|
</xsl:for-each>
|
7191
8264
|
</xsl:copy>
|
8265
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
8266
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
8267
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
8268
|
+
<xsl:copy>
|
8269
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
8270
|
+
</xsl:copy>
|
8271
|
+
</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">
|
8272
|
+
|
8273
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
8274
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
8275
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8276
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
8277
|
+
<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))"/>
|
8278
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
8279
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8280
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8281
|
+
<xsl:with-param name="text" select="$text_"/>
|
8282
|
+
</xsl:call-template></text></xsl:variable>
|
8283
|
+
|
8284
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
8285
|
+
|
8286
|
+
<xsl:variable name="text2">
|
8287
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
8288
|
+
<xsl:copy-of select="."/>
|
8289
|
+
</xsl:for-each></text>
|
8290
|
+
</xsl:variable>
|
8291
|
+
|
8292
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
8293
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
8294
|
+
<xsl:variable name="text3">
|
8295
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
8296
|
+
<xsl:choose>
|
8297
|
+
<xsl:when test="self::text()">
|
8298
|
+
<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))"/>
|
8299
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
8300
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8301
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8302
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
8303
|
+
</xsl:call-template></text></xsl:variable>
|
8304
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
8305
|
+
</xsl:when>
|
8306
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8307
|
+
</xsl:choose>
|
8308
|
+
</xsl:for-each></text>
|
8309
|
+
</xsl:variable>
|
8310
|
+
|
8311
|
+
<xsl:choose>
|
8312
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
8313
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
8314
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
8315
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
8316
|
+
<xsl:choose>
|
8317
|
+
<xsl:when test="self::text()">
|
8318
|
+
<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))"/>
|
8319
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
8320
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
8321
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
8322
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
8323
|
+
</xsl:call-template></text></xsl:variable>
|
8324
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
8325
|
+
</xsl:when>
|
8326
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
8327
|
+
</xsl:choose>
|
8328
|
+
</xsl:for-each>
|
8329
|
+
</xsl:when>
|
8330
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
8331
|
+
</xsl:choose>
|
8332
|
+
|
8333
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
8334
|
+
<xsl:param name="tag_open"/>
|
8335
|
+
<xsl:param name="tag_close"/>
|
8336
|
+
<xsl:param name="text"/>
|
8337
|
+
<xsl:choose>
|
8338
|
+
<xsl:when test="contains($text, $tag_open)">
|
8339
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
8340
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
8341
|
+
|
8342
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
8343
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
8344
|
+
</xsl:element>
|
8345
|
+
|
8346
|
+
<xsl:call-template name="replace_text_tags">
|
8347
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
8348
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
8349
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
8350
|
+
</xsl:call-template>
|
8351
|
+
</xsl:when>
|
8352
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
8353
|
+
</xsl:choose>
|
8354
|
+
</xsl:template><xsl:template name="printEdition">
|
8355
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
8356
|
+
<xsl:text> </xsl:text>
|
8357
|
+
<xsl:choose>
|
8358
|
+
<xsl:when test="$edition_i18n != ''">
|
8359
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
8360
|
+
<xsl:call-template name="capitalize">
|
8361
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
8362
|
+
</xsl:call-template>
|
8363
|
+
</xsl:when>
|
8364
|
+
<xsl:otherwise>
|
8365
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
8366
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
8367
|
+
<xsl:call-template name="capitalize">
|
8368
|
+
<xsl:with-param name="str">
|
8369
|
+
<xsl:call-template name="getLocalizedString">
|
8370
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
8371
|
+
</xsl:call-template>
|
8372
|
+
</xsl:with-param>
|
8373
|
+
</xsl:call-template>
|
8374
|
+
<xsl:text> </xsl:text>
|
8375
|
+
<xsl:value-of select="$edition"/>
|
8376
|
+
</xsl:if>
|
8377
|
+
</xsl:otherwise>
|
8378
|
+
</xsl:choose>
|
7192
8379
|
</xsl:template><xsl:template name="convertDate">
|
7193
8380
|
<xsl:param name="date"/>
|
7194
8381
|
<xsl:param name="format" select="'short'"/>
|
@@ -7876,4 +9063,40 @@
|
|
7876
9063
|
<xsl:value-of select="$value"/>
|
7877
9064
|
</xsl:otherwise>
|
7878
9065
|
</xsl:choose>
|
9066
|
+
</xsl:template><xsl:template match="*" mode="print_as_xml">
|
9067
|
+
<xsl:param name="level">0</xsl:param>
|
9068
|
+
|
9069
|
+
<fo:block margin-left="{2*$level}mm">
|
9070
|
+
<xsl:text>
|
9071
|
+
<</xsl:text>
|
9072
|
+
<xsl:value-of select="local-name()"/>
|
9073
|
+
<xsl:for-each select="@*">
|
9074
|
+
<xsl:text> </xsl:text>
|
9075
|
+
<xsl:value-of select="local-name()"/>
|
9076
|
+
<xsl:text>="</xsl:text>
|
9077
|
+
<xsl:value-of select="."/>
|
9078
|
+
<xsl:text>"</xsl:text>
|
9079
|
+
</xsl:for-each>
|
9080
|
+
<xsl:text>></xsl:text>
|
9081
|
+
|
9082
|
+
<xsl:if test="not(*)">
|
9083
|
+
<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
|
9084
|
+
<xsl:text></</xsl:text>
|
9085
|
+
<xsl:value-of select="local-name()"/>
|
9086
|
+
<xsl:text>></xsl:text>
|
9087
|
+
</xsl:if>
|
9088
|
+
</fo:block>
|
9089
|
+
|
9090
|
+
<xsl:if test="*">
|
9091
|
+
<fo:block>
|
9092
|
+
<xsl:apply-templates mode="print_as_xml">
|
9093
|
+
<xsl:with-param name="level" select="$level + 1"/>
|
9094
|
+
</xsl:apply-templates>
|
9095
|
+
</fo:block>
|
9096
|
+
<fo:block margin-left="{2*$level}mm">
|
9097
|
+
<xsl:text></</xsl:text>
|
9098
|
+
<xsl:value-of select="local-name()"/>
|
9099
|
+
<xsl:text>></xsl:text>
|
9100
|
+
</fo:block>
|
9101
|
+
</xsl:if>
|
7879
9102
|
</xsl:template></xsl:stylesheet>
|