metanorma-bipm 2.0.8 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/bipm/base_convert.rb +11 -2
- data/lib/isodoc/bipm/bipm.brochure.xsl +1657 -484
- data/lib/isodoc/bipm/bipm.guide.xsl +1657 -484
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +1657 -484
- data/lib/isodoc/bipm/bipm.rapport.xsl +1657 -484
- data/lib/isodoc/bipm/doccontrol.rb +101 -0
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +1 -0
- data/lib/isodoc/bipm/html/htmlstyle.css +6 -0
- data/lib/isodoc/bipm/html/htmlstyle.scss +1 -0
- data/lib/isodoc/bipm/init.rb +1 -1
- data/lib/isodoc/bipm/jcgm.standard.xsl +1696 -440
- data/lib/isodoc/bipm/presentation_xml_convert.rb +18 -93
- data/lib/isodoc/bipm/xref.rb +8 -4
- data/lib/metanorma/bipm/biblio.rng +69 -42
- data/lib/metanorma/bipm/bipm.rng +3 -0
- data/lib/metanorma/bipm/converter.rb +41 -108
- data/lib/metanorma/bipm/front.rb +113 -0
- data/lib/metanorma/bipm/isodoc.rng +65 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +2 -2
- metadata +9 -7
@@ -5,8 +5,6 @@
|
|
5
5
|
<xsl:param name="initial_page_number"/>
|
6
6
|
<xsl:param name="doc_split_by_language"/>
|
7
7
|
|
8
|
-
<xsl:param name="add_math_as_text">true</xsl:param>
|
9
|
-
|
10
8
|
<xsl:param name="add_math_as_attachment">true</xsl:param>
|
11
9
|
|
12
10
|
<xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
|
@@ -169,7 +167,7 @@
|
|
169
167
|
<xsl:template name="generateContents">
|
170
168
|
<contents>
|
171
169
|
|
172
|
-
<xsl:apply-templates select="/*/bipm:preface/*[position() > 1]" mode="contents"/>
|
170
|
+
<xsl:apply-templates select="/*/bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][position() > 1]" mode="contents"/>
|
173
171
|
|
174
172
|
<xsl:apply-templates select="/*/bipm:sections/*" mode="contents"/>
|
175
173
|
<xsl:apply-templates select="/*/bipm:bibliography/bipm:references[@normative='true']" mode="contents"/>
|
@@ -633,7 +631,7 @@
|
|
633
631
|
</xsl:template>
|
634
632
|
|
635
633
|
|
636
|
-
<xsl:template match="bipm:note" name="change_note_kind" mode="flatxml">
|
634
|
+
<xsl:template match="bipm:note[not(parent::bipm:preface)]" name="change_note_kind" mode="flatxml">
|
637
635
|
<xsl:variable name="element">
|
638
636
|
<xsl:choose>
|
639
637
|
<xsl:when test="ancestor::bipm:quote">note</xsl:when>
|
@@ -985,7 +983,7 @@
|
|
985
983
|
<fo:block-container font-size="9pt" border-bottom="1pt solid black" width="68mm" text-align="center" margin-bottom="14pt">
|
986
984
|
<fo:block font-weight="bold" margin-bottom="2.5mm">
|
987
985
|
<fo:inline padding-right="10mm">
|
988
|
-
<xsl:apply-templates select="bipm:bibdata/bipm:edition">
|
986
|
+
<xsl:apply-templates select="bipm:bibdata/bipm:edition[normalize-space(@language) = '']">
|
989
987
|
<xsl:with-param name="font-size" select="'70%'"/>
|
990
988
|
<xsl:with-param name="baseline-shift" select="'45%'"/>
|
991
989
|
<xsl:with-param name="curr_lang" select="$curr_lang"/>
|
@@ -1022,17 +1020,17 @@
|
|
1022
1020
|
</fo:page-sequence>
|
1023
1021
|
|
1024
1022
|
|
1025
|
-
<xsl:if test="bipm:preface/*">
|
1023
|
+
<xsl:if test="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
1026
1024
|
<fo:page-sequence master-reference="document" force-page-count="no-force">
|
1027
1025
|
<xsl:call-template name="insertFootnoteSeparator"/>
|
1028
1026
|
|
1029
1027
|
<xsl:variable name="header-title">
|
1030
1028
|
<xsl:choose>
|
1031
|
-
<xsl:when test="bipm:preface/*[1]/bipm:title[1]/*[local-name() = 'tab']">
|
1032
|
-
<xsl:apply-templates select="bipm:preface/*[1]/bipm:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
|
1029
|
+
<xsl:when test="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/bipm:title[1]/*[local-name() = 'tab']">
|
1030
|
+
<xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/bipm:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
|
1033
1031
|
</xsl:when>
|
1034
1032
|
<xsl:otherwise>
|
1035
|
-
<xsl:apply-templates select="bipm:preface/*[1]/bipm:title[1]" mode="header"/>
|
1033
|
+
<xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/bipm:title[1]" mode="header"/>
|
1036
1034
|
</xsl:otherwise>
|
1037
1035
|
</xsl:choose>
|
1038
1036
|
</xsl:variable>
|
@@ -1042,7 +1040,7 @@
|
|
1042
1040
|
|
1043
1041
|
<fo:flow flow-name="xsl-region-body">
|
1044
1042
|
<fo:block line-height="135%">
|
1045
|
-
<xsl:apply-templates select="bipm:preface/*[1]"/>
|
1043
|
+
<xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]"/>
|
1046
1044
|
</fo:block>
|
1047
1045
|
</fo:flow>
|
1048
1046
|
</fo:page-sequence>
|
@@ -1141,7 +1139,7 @@
|
|
1141
1139
|
</fo:page-sequence>
|
1142
1140
|
|
1143
1141
|
|
1144
|
-
<xsl:apply-templates select="bipm:preface/*[position() > 1]" mode="sections"/> <!-- bipm:clause -->
|
1142
|
+
<xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][position() > 1]" mode="sections"/> <!-- bipm:clause -->
|
1145
1143
|
|
1146
1144
|
|
1147
1145
|
|
@@ -1265,7 +1263,7 @@
|
|
1265
1263
|
<fo:block-container font-size="9pt" border-bottom="1pt solid black" width="68mm" text-align="center" margin-bottom="14pt">
|
1266
1264
|
<fo:block font-weight="bold" margin-bottom="2.5mm">
|
1267
1265
|
<fo:inline padding-right="10mm">
|
1268
|
-
<xsl:apply-templates select="bipm:bibdata/bipm:edition">
|
1266
|
+
<xsl:apply-templates select="bipm:bibdata/bipm:edition[normalize-space(@language) = '']">
|
1269
1267
|
<xsl:with-param name="font-size" select="'70%'"/>
|
1270
1268
|
<xsl:with-param name="baseline-shift" select="'45%'"/>
|
1271
1269
|
<xsl:with-param name="curr_lang" select="$curr_lang"/>
|
@@ -1306,7 +1304,7 @@
|
|
1306
1304
|
</fo:page-sequence>
|
1307
1305
|
|
1308
1306
|
|
1309
|
-
<xsl:apply-templates select="bipm:preface/*" mode="sections"/>
|
1307
|
+
<xsl:apply-templates select="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')]" mode="sections"/>
|
1310
1308
|
|
1311
1309
|
<!-- Document Pages -->
|
1312
1310
|
<xsl:apply-templates select="bipm:sections/*" mode="sections"/>
|
@@ -1353,7 +1351,7 @@
|
|
1353
1351
|
<xsl:call-template name="getLanguages"/>
|
1354
1352
|
</xsl:variable>
|
1355
1353
|
<xsl:variable name="editionFO">
|
1356
|
-
<xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:edition">
|
1354
|
+
<xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:edition[normalize-space(@language) = '']">
|
1357
1355
|
<xsl:with-param name="curr_lang" select="xalan:nodeset($languages)/lang[1]"/>
|
1358
1356
|
</xsl:apply-templates>
|
1359
1357
|
</xsl:variable>
|
@@ -1432,7 +1430,7 @@
|
|
1432
1430
|
|
1433
1431
|
<xsl:variable name="edition_str">édition</xsl:variable>
|
1434
1432
|
|
1435
|
-
<fo:block font-size="14pt" font-weight="{$weight-bold}" margin-top="4mm"><xsl:value-of select="concat((//bipm:bipm-standard)[1]/bipm:bibdata/bipm:edition, ' ', $edition_str, ' ', $copyrightYear)"/></fo:block>
|
1433
|
+
<fo:block font-size="14pt" font-weight="{$weight-bold}" margin-top="4mm"><xsl:value-of select="concat((//bipm:bipm-standard)[1]/bipm:bibdata/bipm:edition[normalize-space(@language) = ''], ' ', $edition_str, ' ', $copyrightYear)"/></fo:block>
|
1436
1434
|
</fo:block-container>
|
1437
1435
|
|
1438
1436
|
<fo:block-container absolute-position="fixed" left="12.5mm" top="92mm" height="170mm" width="144mm" display-align="center">
|
@@ -2109,12 +2107,6 @@
|
|
2109
2107
|
<xsl:param name="baseline-shift" select="'30%'"/>
|
2110
2108
|
<xsl:param name="curr_lang" select="'fr'"/>
|
2111
2109
|
<fo:inline>
|
2112
|
-
<xsl:variable name="title-edition">
|
2113
|
-
<xsl:call-template name="getTitle">
|
2114
|
-
<xsl:with-param name="name" select="'title-edition'"/>
|
2115
|
-
<xsl:with-param name="lang" select="$curr_lang"/>
|
2116
|
-
</xsl:call-template>
|
2117
|
-
</xsl:variable>
|
2118
2110
|
<xsl:value-of select="."/>
|
2119
2111
|
<fo:inline font-size="{$font-size}" baseline-shift="{$baseline-shift}">
|
2120
2112
|
<xsl:call-template name="number-to-ordinal">
|
@@ -2123,7 +2115,9 @@
|
|
2123
2115
|
</xsl:call-template>
|
2124
2116
|
</fo:inline>
|
2125
2117
|
<xsl:text> </xsl:text>
|
2126
|
-
<xsl:
|
2118
|
+
<xsl:call-template name="getLocalizedString">
|
2119
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
2120
|
+
</xsl:call-template>
|
2127
2121
|
<xsl:text/>
|
2128
2122
|
</fo:inline>
|
2129
2123
|
</xsl:template>
|
@@ -2286,7 +2280,7 @@
|
|
2286
2280
|
<!-- ====== -->
|
2287
2281
|
|
2288
2282
|
|
2289
|
-
<xsl:template match="bipm:preface/*[1]" priority="3">
|
2283
|
+
<xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]" priority="3">
|
2290
2284
|
<fo:table table-layout="fixed" width="173.5mm">
|
2291
2285
|
<xsl:call-template name="setId"/>
|
2292
2286
|
<fo:table-column column-width="137mm"/>
|
@@ -2377,7 +2371,7 @@
|
|
2377
2371
|
</xsl:template>
|
2378
2372
|
|
2379
2373
|
|
2380
|
-
<xsl:template match="bipm:preface/*[1]/*" mode="clause_table">
|
2374
|
+
<xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/*" mode="clause_table">
|
2381
2375
|
<xsl:param name="rows"/>
|
2382
2376
|
|
2383
2377
|
<xsl:variable name="current_row"><xsl:number count="*"/></xsl:variable>
|
@@ -2409,7 +2403,7 @@
|
|
2409
2403
|
<xsl:variable name="end_row" select="$current_row + $number-rows-spanned"/>
|
2410
2404
|
<fo:block>
|
2411
2405
|
|
2412
|
-
<xsl:for-each select="ancestor::bipm:preface/*[1]/*[position() >= $start_row and position() < $end_row]//bipm:note_side">
|
2406
|
+
<xsl:for-each select="ancestor::bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]/*[position() >= $start_row and position() < $end_row]//bipm:note_side">
|
2413
2407
|
<xsl:apply-templates select="." mode="note_side"/>
|
2414
2408
|
</xsl:for-each>
|
2415
2409
|
</fo:block>
|
@@ -2669,7 +2663,7 @@
|
|
2669
2663
|
|
2670
2664
|
|
2671
2665
|
<!-- skip, because it process in note_side template -->
|
2672
|
-
<xsl:template match="bipm:preface/*[1]//bipm:note_side" priority="3"/>
|
2666
|
+
<xsl:template match="bipm:preface/*[not(local-name() = 'note' or local-name() = 'admonition')][1]//bipm:note_side" priority="3"/>
|
2673
2667
|
|
2674
2668
|
|
2675
2669
|
<xsl:template match="bipm:sections//bipm:note_side | bipm:annex//bipm:note_side" priority="3">
|
@@ -2733,6 +2727,7 @@
|
|
2733
2727
|
|
2734
2728
|
<xsl:template match="bipm:p" name="paragraph">
|
2735
2729
|
<xsl:param name="inline" select="'false'"/>
|
2730
|
+
<xsl:param name="split_keep-within-line"/>
|
2736
2731
|
|
2737
2732
|
<xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
|
2738
2733
|
<xsl:variable name="element-name">
|
@@ -2779,7 +2774,9 @@
|
|
2779
2774
|
<xsl:attribute name="role">BlockQuote</xsl:attribute>
|
2780
2775
|
</xsl:if>
|
2781
2776
|
<xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
|
2782
|
-
<xsl:apply-templates
|
2777
|
+
<xsl:apply-templates>
|
2778
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
2779
|
+
</xsl:apply-templates>
|
2783
2780
|
</xsl:element>
|
2784
2781
|
<xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
|
2785
2782
|
<fo:block margin-bottom="6pt">
|
@@ -3207,112 +3204,6 @@
|
|
3207
3204
|
<xsl:value-of select="translate(., ' ', ' ')"/>
|
3208
3205
|
</xsl:template>
|
3209
3206
|
|
3210
|
-
<xsl:template match="mathml:math" priority="2">
|
3211
|
-
<xsl:variable name="isAdded" select="@added"/>
|
3212
|
-
<xsl:variable name="isDeleted" select="@deleted"/>
|
3213
|
-
|
3214
|
-
<fo:inline xsl:use-attribute-sets="mathml-style">
|
3215
|
-
|
3216
|
-
<xsl:if test="ancestor::*[local-name()='table']">
|
3217
|
-
<xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
|
3218
|
-
</xsl:if>
|
3219
|
-
|
3220
|
-
<xsl:call-template name="setTrackChangesStyles">
|
3221
|
-
<xsl:with-param name="isAdded" select="$isAdded"/>
|
3222
|
-
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
3223
|
-
</xsl:call-template>
|
3224
|
-
|
3225
|
-
<xsl:if test="$add_math_as_text = 'true'">
|
3226
|
-
<!-- set unique font-size (fiction) -->
|
3227
|
-
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
3228
|
-
<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 -->
|
3229
|
-
</xsl:if>
|
3230
|
-
|
3231
|
-
<!-- <fo:wrapper role="artifact"> -->
|
3232
|
-
|
3233
|
-
<xsl:variable name="mathml_content">
|
3234
|
-
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
3235
|
-
</xsl:variable>
|
3236
|
-
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
3237
|
-
|
3238
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
3239
|
-
<xsl:variable name="comment_text_">
|
3240
|
-
<xsl:choose>
|
3241
|
-
<xsl:when test="normalize-space($comment_text_following) != ''">
|
3242
|
-
<xsl:value-of select="$comment_text_following"/>
|
3243
|
-
</xsl:when>
|
3244
|
-
<xsl:otherwise>
|
3245
|
-
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
3246
|
-
</xsl:otherwise>
|
3247
|
-
</xsl:choose>
|
3248
|
-
</xsl:variable>
|
3249
|
-
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
3250
|
-
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
3251
|
-
|
3252
|
-
<xsl:variable name="filename" select="xalan:nodeset($mathml_attachments)//attachment[. = $mathml_content]/@filename"/>
|
3253
|
-
<xsl:choose>
|
3254
|
-
<xsl:when test="$add_math_as_attachment = 'true' and normalize-space($filename) != ''">
|
3255
|
-
<xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
|
3256
|
-
<fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
|
3257
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
3258
|
-
<!-- put Mathin Alternate Text -->
|
3259
|
-
<xsl:attribute name="fox:alt-text">
|
3260
|
-
<xsl:value-of select="$comment_text"/>
|
3261
|
-
</xsl:attribute>
|
3262
|
-
</xsl:if>
|
3263
|
-
<xsl:call-template name="mathml_instream_object">
|
3264
|
-
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
3265
|
-
<xsl:with-param name="comment_text" select="$comment_text"/>
|
3266
|
-
</xsl:call-template>
|
3267
|
-
</fo:basic-link>
|
3268
|
-
<!-- </xsl:if> -->
|
3269
|
-
</xsl:when>
|
3270
|
-
<xsl:otherwise>
|
3271
|
-
<xsl:call-template name="mathml_instream_object">
|
3272
|
-
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
3273
|
-
<xsl:with-param name="comment_text" select="$comment_text"/>
|
3274
|
-
</xsl:call-template>
|
3275
|
-
</xsl:otherwise>
|
3276
|
-
</xsl:choose>
|
3277
|
-
<!-- </fo:wrapper> -->
|
3278
|
-
</fo:inline>
|
3279
|
-
</xsl:template>
|
3280
|
-
|
3281
|
-
<xsl:template name="mathml_instream_object">
|
3282
|
-
<xsl:param name="mathml_content"/>
|
3283
|
-
<xsl:param name="comment_text"/>
|
3284
|
-
|
3285
|
-
<xsl:variable name="mathml">
|
3286
|
-
<xsl:apply-templates select="." mode="mathml"/>
|
3287
|
-
</xsl:variable>
|
3288
|
-
|
3289
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
3290
|
-
|
3291
|
-
<xsl:if test="local-name(../..) = 'formula'">
|
3292
|
-
<xsl:attribute name="width">95%</xsl:attribute>
|
3293
|
-
<xsl:attribute name="content-height">100%</xsl:attribute>
|
3294
|
-
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
3295
|
-
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
3296
|
-
</xsl:if>
|
3297
|
-
|
3298
|
-
<!-- put MathML in Actual Text -->
|
3299
|
-
<xsl:attribute name="fox:actual-text">
|
3300
|
-
<xsl:value-of select="$mathml_content"/>
|
3301
|
-
</xsl:attribute>
|
3302
|
-
|
3303
|
-
<xsl:if test="$add_math_as_text = 'true'">
|
3304
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
3305
|
-
<!-- put Mathin Alternate Text -->
|
3306
|
-
<xsl:attribute name="fox:alt-text">
|
3307
|
-
<xsl:value-of select="$comment_text"/>
|
3308
|
-
</xsl:attribute>
|
3309
|
-
</xsl:if>
|
3310
|
-
</xsl:if>
|
3311
|
-
|
3312
|
-
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
3313
|
-
</fo:instream-foreign-object>
|
3314
|
-
</xsl:template>
|
3315
|
-
|
3316
3207
|
|
3317
3208
|
<!-- =================== -->
|
3318
3209
|
<!-- Table of Contents (ToC) processing -->
|
@@ -3922,12 +3813,41 @@
|
|
3922
3813
|
</xsl:template>
|
3923
3814
|
|
3924
3815
|
|
3925
|
-
<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="
|
3816
|
+
<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:param name="table_if">false</xsl:param><xsl:param name="table_widths"/><xsl:variable name="table_widths_from_if" select="xalan:nodeset($table_widths)"/><xsl:variable name="table_widths_from_if_calculated_">
|
3817
|
+
<xsl:for-each select="$table_widths_from_if//table">
|
3818
|
+
<xsl:copy>
|
3819
|
+
<xsl:copy-of select="@*"/>
|
3820
|
+
<xsl:call-template name="calculate-column-widths-autolayout-algorithm"/>
|
3821
|
+
</xsl:copy>
|
3822
|
+
</xsl:for-each>
|
3823
|
+
</xsl:variable><xsl:variable name="table_widths_from_if_calculated" select="xalan:nodeset($table_widths_from_if_calculated_)"/><xsl:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
|
3824
|
+
false
|
3825
|
+
</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
|
3926
3826
|
<xsl:call-template name="getLang"/>
|
3927
|
-
</xsl:variable><xsl:variable name="
|
3928
|
-
|
3827
|
+
</xsl:variable><xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/><xsl:variable name="papersize_width_">
|
3828
|
+
<xsl:choose>
|
3829
|
+
<xsl:when test="$papersize = 'letter'">215.9</xsl:when>
|
3830
|
+
<xsl:when test="$papersize = 'a4'">210</xsl:when>
|
3831
|
+
</xsl:choose>
|
3832
|
+
</xsl:variable><xsl:variable name="papersize_width" select="normalize-space($papersize_width_)"/><xsl:variable name="papersize_height_">
|
3833
|
+
<xsl:choose>
|
3834
|
+
<xsl:when test="$papersize = 'letter'">279.4</xsl:when>
|
3835
|
+
<xsl:when test="$papersize = 'a4'">297</xsl:when>
|
3836
|
+
</xsl:choose>
|
3837
|
+
</xsl:variable><xsl:variable name="papersize_height" select="normalize-space($papersize_height_)"/><xsl:variable name="pageWidth_">
|
3838
|
+
<xsl:choose>
|
3839
|
+
<xsl:when test="$papersize_width != ''"><xsl:value-of select="$papersize_width"/></xsl:when>
|
3840
|
+
<xsl:otherwise>
|
3841
|
+
210
|
3842
|
+
</xsl:otherwise>
|
3843
|
+
</xsl:choose>
|
3929
3844
|
</xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
|
3930
|
-
|
3845
|
+
<xsl:choose>
|
3846
|
+
<xsl:when test="$papersize_height != ''"><xsl:value-of select="$papersize_height"/></xsl:when>
|
3847
|
+
<xsl:otherwise>
|
3848
|
+
297
|
3849
|
+
</xsl:otherwise>
|
3850
|
+
</xsl:choose>
|
3931
3851
|
</xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
|
3932
3852
|
31.7
|
3933
3853
|
</xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
|
@@ -3937,20 +3857,7 @@
|
|
3937
3857
|
</xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
|
3938
3858
|
22
|
3939
3859
|
</xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
|
3940
|
-
|
3941
|
-
<title-edition lang="en">
|
3942
|
-
|
3943
|
-
<xsl:text>Edition </xsl:text>
|
3944
|
-
|
3945
|
-
</title-edition>
|
3946
3860
|
|
3947
|
-
<title-edition lang="fr">
|
3948
|
-
<xsl:text>Édition </xsl:text>
|
3949
|
-
</title-edition>
|
3950
|
-
|
3951
|
-
<title-edition lang="ru">
|
3952
|
-
<xsl:text>Издание </xsl:text>
|
3953
|
-
</title-edition>
|
3954
3861
|
|
3955
3862
|
<!-- These titles of Table of contents renders different than determined in localized-strings -->
|
3956
3863
|
<title-toc lang="en">
|
@@ -4033,7 +3940,7 @@
|
|
4033
3940
|
</xsl:variable><xsl:variable name="bibdata">
|
4034
3941
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
|
4035
3942
|
<xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
|
4036
|
-
</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">
|
3943
|
+
</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">
|
4037
3944
|
<xsl:param name="name"/>
|
4038
3945
|
<xsl:param name="lang"/>
|
4039
3946
|
<xsl:variable name="lang_">
|
@@ -4081,7 +3988,7 @@
|
|
4081
3988
|
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
4082
3989
|
|
4083
3990
|
<xsl:variable name="additional_fonts_">
|
4084
|
-
<xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
|
3991
|
+
<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']">
|
4085
3992
|
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
4086
3993
|
</xsl:for-each>
|
4087
3994
|
</xsl:variable>
|
@@ -4168,7 +4075,6 @@
|
|
4168
4075
|
|
4169
4076
|
|
4170
4077
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-container-style">
|
4171
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
4172
4078
|
|
4173
4079
|
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
|
4174
4080
|
<xsl:attribute name="white-space">pre</xsl:attribute>
|
@@ -4247,6 +4153,7 @@
|
|
4247
4153
|
|
4248
4154
|
|
4249
4155
|
|
4156
|
+
|
4250
4157
|
</xsl:attribute-set><xsl:attribute-set name="example-name-style">
|
4251
4158
|
|
4252
4159
|
|
@@ -4396,6 +4303,7 @@
|
|
4396
4303
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
4397
4304
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
4398
4305
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
4306
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
4399
4307
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
4400
4308
|
|
4401
4309
|
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
@@ -4420,6 +4328,7 @@
|
|
4420
4328
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
4421
4329
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
4422
4330
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
4331
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
4423
4332
|
|
4424
4333
|
|
4425
4334
|
<xsl:attribute name="border">solid 0pt white</xsl:attribute>
|
@@ -4517,7 +4426,8 @@
|
|
4517
4426
|
</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
|
4518
4427
|
|
4519
4428
|
|
4520
|
-
</xsl:attribute-set><xsl:attribute-set name="dt-style">
|
4429
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
|
4430
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
|
4521
4431
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
4522
4432
|
|
4523
4433
|
|
@@ -4532,6 +4442,27 @@
|
|
4532
4442
|
|
4533
4443
|
|
4534
4444
|
|
4445
|
+
</xsl:attribute-set><xsl:attribute-set name="dl-name-style">
|
4446
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
4447
|
+
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
|
4448
|
+
|
4449
|
+
|
4450
|
+
|
4451
|
+
|
4452
|
+
|
4453
|
+
|
4454
|
+
|
4455
|
+
|
4456
|
+
|
4457
|
+
|
4458
|
+
|
4459
|
+
|
4460
|
+
|
4461
|
+
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
4462
|
+
|
4463
|
+
|
4464
|
+
</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
|
4465
|
+
<xsl:attribute name="padding-left">2mm</xsl:attribute>
|
4535
4466
|
</xsl:attribute-set><xsl:attribute-set name="appendix-style">
|
4536
4467
|
|
4537
4468
|
|
@@ -4819,6 +4750,24 @@
|
|
4819
4750
|
|
4820
4751
|
|
4821
4752
|
|
4753
|
+
</xsl:attribute-set><xsl:attribute-set name="list-name-style">
|
4754
|
+
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
4755
|
+
|
4756
|
+
|
4757
|
+
|
4758
|
+
|
4759
|
+
|
4760
|
+
|
4761
|
+
|
4762
|
+
|
4763
|
+
|
4764
|
+
|
4765
|
+
|
4766
|
+
|
4767
|
+
|
4768
|
+
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
4769
|
+
|
4770
|
+
|
4822
4771
|
</xsl:attribute-set><xsl:attribute-set name="list-item-style">
|
4823
4772
|
|
4824
4773
|
|
@@ -5239,13 +5188,13 @@
|
|
5239
5188
|
|
5240
5189
|
</xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
|
5241
5190
|
<xsl:variable name="nodes_preface_">
|
5242
|
-
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
5191
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
5243
5192
|
<node id="{@id}"/>
|
5244
5193
|
</xsl:for-each>
|
5245
5194
|
</xsl:variable>
|
5246
5195
|
<xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
|
5247
5196
|
|
5248
|
-
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
5197
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
5249
5198
|
<xsl:sort select="@displayorder" data-type="number"/>
|
5250
5199
|
|
5251
5200
|
<!-- process Section's title -->
|
@@ -5311,7 +5260,7 @@
|
|
5311
5260
|
</xsl:for-each>
|
5312
5261
|
</figures>
|
5313
5262
|
</xsl:template><xsl:template name="processPrefaceSectionsDefault">
|
5314
|
-
<xsl:for-each select="/*/*[local-name()='preface']/*">
|
5263
|
+
<xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
|
5315
5264
|
<xsl:sort select="@displayorder" data-type="number"/>
|
5316
5265
|
<xsl:apply-templates select="."/>
|
5317
5266
|
</xsl:for-each>
|
@@ -5331,22 +5280,32 @@
|
|
5331
5280
|
<xsl:sort select="@displayorder" data-type="number"/>
|
5332
5281
|
<xsl:apply-templates select="."/>
|
5333
5282
|
</xsl:for-each>
|
5334
|
-
</xsl:template><xsl:variable name="
|
5335
|
-
|
5336
|
-
|
5337
|
-
|
5338
|
-
|
5339
|
-
|
5340
|
-
|
5283
|
+
</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">
|
5284
|
+
|
5285
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
5286
|
+
<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))"/>
|
5287
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
5288
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
5289
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
5290
|
+
<xsl:with-param name="text" select="$text"/>
|
5291
|
+
</xsl:call-template>
|
5292
|
+
|
5293
|
+
</xsl:template><xsl:template name="replace_fo_inline_tags">
|
5294
|
+
<xsl:param name="tag_open"/>
|
5295
|
+
<xsl:param name="tag_close"/>
|
5341
5296
|
<xsl:param name="text"/>
|
5342
5297
|
<xsl:choose>
|
5343
5298
|
<xsl:when test="contains($text, $tag_open)">
|
5344
5299
|
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
5345
|
-
<xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text>
|
5300
|
+
<!-- <xsl:text disable-output-escaping="yes"><fo:inline keep-together.within-line="always"></xsl:text> -->
|
5346
5301
|
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
5347
|
-
<
|
5348
|
-
|
5349
|
-
|
5302
|
+
<fo:inline keep-together.within-line="always">
|
5303
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
5304
|
+
</fo:inline>
|
5305
|
+
<!-- <xsl:text disable-output-escaping="yes"></fo:inline></xsl:text> -->
|
5306
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
5307
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
5308
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
5350
5309
|
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
5351
5310
|
</xsl:call-template>
|
5352
5311
|
</xsl:when>
|
@@ -5354,6 +5313,39 @@
|
|
5354
5313
|
</xsl:choose>
|
5355
5314
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
5356
5315
|
<xsl:value-of select="$linebreak"/>
|
5316
|
+
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
5317
|
+
<xsl:param name="split_keep-within-line"/>
|
5318
|
+
|
5319
|
+
<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
|
5320
|
+
<xsl:choose>
|
5321
|
+
|
5322
|
+
<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
|
5323
|
+
<xsl:variable name="sep">_</xsl:variable>
|
5324
|
+
<xsl:variable name="items">
|
5325
|
+
<xsl:call-template name="split">
|
5326
|
+
<xsl:with-param name="pText" select="."/>
|
5327
|
+
<xsl:with-param name="sep" select="$sep"/>
|
5328
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
5329
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
5330
|
+
</xsl:call-template>
|
5331
|
+
</xsl:variable>
|
5332
|
+
<xsl:for-each select="xalan:nodeset($items)/item">
|
5333
|
+
<xsl:choose>
|
5334
|
+
<xsl:when test=". = $sep">
|
5335
|
+
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
|
5336
|
+
</xsl:when>
|
5337
|
+
<xsl:otherwise>
|
5338
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
5339
|
+
</xsl:otherwise>
|
5340
|
+
</xsl:choose>
|
5341
|
+
</xsl:for-each>
|
5342
|
+
</xsl:when>
|
5343
|
+
|
5344
|
+
<xsl:otherwise>
|
5345
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
5346
|
+
</xsl:otherwise>
|
5347
|
+
|
5348
|
+
</xsl:choose>
|
5357
5349
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
5358
5350
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
5359
5351
|
<xsl:apply-templates/>
|
@@ -5429,8 +5421,23 @@
|
|
5429
5421
|
</xsl:call-template>
|
5430
5422
|
|
5431
5423
|
</xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
5432
|
-
|
5433
|
-
|
5424
|
+
<xsl:choose>
|
5425
|
+
<xsl:when test="parent::*[local-name() = 'keep-together_within-line']">
|
5426
|
+
<xsl:value-of select="."/>
|
5427
|
+
</xsl:when>
|
5428
|
+
<xsl:otherwise>
|
5429
|
+
<xsl:call-template name="addZeroWidthSpacesToTextNodes"/>
|
5430
|
+
</xsl:otherwise>
|
5431
|
+
</xsl:choose>
|
5432
|
+
</xsl:template><xsl:template name="addZeroWidthSpacesToTextNodes">
|
5433
|
+
<xsl:variable name="text"><text><xsl:call-template name="text"/></text></xsl:variable>
|
5434
|
+
<!-- <xsl:copy-of select="$text"/> -->
|
5435
|
+
<xsl:for-each select="xalan:nodeset($text)/text/node()">
|
5436
|
+
<xsl:choose>
|
5437
|
+
<xsl:when test="self::text()"><xsl:call-template name="add-zero-spaces-java"/></xsl:when>
|
5438
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
5439
|
+
</xsl:choose>
|
5440
|
+
</xsl:for-each>
|
5434
5441
|
</xsl:template><xsl:template match="*[local-name()='table']" name="table">
|
5435
5442
|
|
5436
5443
|
<xsl:variable name="table-preamble">
|
@@ -5440,9 +5447,14 @@
|
|
5440
5447
|
|
5441
5448
|
<xsl:variable name="table">
|
5442
5449
|
|
5443
|
-
<xsl:variable name="simple-table">
|
5444
|
-
<xsl:call-template name="getSimpleTable"
|
5450
|
+
<xsl:variable name="simple-table">
|
5451
|
+
<xsl:call-template name="getSimpleTable">
|
5452
|
+
<xsl:with-param name="id" select="@id"/>
|
5453
|
+
</xsl:call-template>
|
5445
5454
|
</xsl:variable>
|
5455
|
+
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
5456
|
+
|
5457
|
+
<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
|
5446
5458
|
|
5447
5459
|
|
5448
5460
|
<!-- Display table's name before table as standalone block -->
|
@@ -5465,7 +5477,23 @@
|
|
5465
5477
|
</xsl:call-template>
|
5466
5478
|
</xsl:if>
|
5467
5479
|
</xsl:variable>
|
5468
|
-
<!--
|
5480
|
+
<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
|
5481
|
+
|
5482
|
+
<!-- DEBUG -->
|
5483
|
+
<xsl:if test="$table_if_debug = 'true'">
|
5484
|
+
<fo:block font-size="60%">
|
5485
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
5486
|
+
</fo:block>
|
5487
|
+
</xsl:if>
|
5488
|
+
|
5489
|
+
|
5490
|
+
<!-- <xsl:copy-of select="$colwidths"/> -->
|
5491
|
+
|
5492
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
5493
|
+
DEBUG
|
5494
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
5495
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
5496
|
+
|
5469
5497
|
|
5470
5498
|
|
5471
5499
|
<xsl:variable name="margin-side">
|
@@ -5544,9 +5572,17 @@
|
|
5544
5572
|
</xsl:element>
|
5545
5573
|
</xsl:variable>
|
5546
5574
|
|
5575
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5576
|
+
<!-- to determine start of table -->
|
5577
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
5578
|
+
</xsl:if>
|
5547
5579
|
|
5548
5580
|
<fo:table id="{@id}">
|
5549
5581
|
|
5582
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5583
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
5584
|
+
</xsl:if>
|
5585
|
+
|
5550
5586
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
5551
5587
|
<xsl:attribute name="{local-name()}">
|
5552
5588
|
<xsl:value-of select="."/>
|
@@ -5560,31 +5596,47 @@
|
|
5560
5596
|
|
5561
5597
|
|
5562
5598
|
<xsl:choose>
|
5563
|
-
<xsl:when test="
|
5564
|
-
|
5565
|
-
|
5566
|
-
|
5599
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
5600
|
+
<!-- generate IF for table widths -->
|
5601
|
+
<!-- example:
|
5602
|
+
<tr>
|
5603
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
5604
|
+
<p>Symbol</p>
|
5605
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
5606
|
+
</td>
|
5607
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
5608
|
+
<p>Description</p>
|
5609
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
5610
|
+
</td>
|
5611
|
+
</tr>
|
5612
|
+
-->
|
5613
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
|
5614
|
+
|
5567
5615
|
</xsl:when>
|
5568
5616
|
<xsl:otherwise>
|
5569
|
-
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
5570
|
-
<xsl:choose>
|
5571
|
-
<xsl:when test=". = 1 or . = 0">
|
5572
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
5573
|
-
</xsl:when>
|
5574
|
-
<xsl:otherwise>
|
5575
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
5576
|
-
</xsl:otherwise>
|
5577
|
-
</xsl:choose>
|
5578
|
-
</xsl:for-each>
|
5579
|
-
</xsl:otherwise>
|
5580
|
-
</xsl:choose>
|
5581
5617
|
|
5582
|
-
|
5583
|
-
|
5584
|
-
|
5585
|
-
|
5586
|
-
|
5587
|
-
|
5618
|
+
<xsl:choose>
|
5619
|
+
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
|
5620
|
+
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
|
5621
|
+
<fo:table-column column-width="{@width}"/>
|
5622
|
+
</xsl:for-each>
|
5623
|
+
</xsl:when>
|
5624
|
+
<xsl:otherwise>
|
5625
|
+
<xsl:call-template name="insertTableColumnWidth">
|
5626
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5627
|
+
</xsl:call-template>
|
5628
|
+
</xsl:otherwise>
|
5629
|
+
</xsl:choose>
|
5630
|
+
|
5631
|
+
<xsl:choose>
|
5632
|
+
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
|
5633
|
+
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
5634
|
+
</xsl:when>
|
5635
|
+
<xsl:otherwise>
|
5636
|
+
<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 -->
|
5637
|
+
</xsl:otherwise>
|
5638
|
+
</xsl:choose>
|
5639
|
+
|
5588
5640
|
</xsl:otherwise>
|
5589
5641
|
</xsl:choose>
|
5590
5642
|
|
@@ -5691,11 +5743,22 @@
|
|
5691
5743
|
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
|
5692
5744
|
<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
|
5693
5745
|
</xsl:template><xsl:template name="calculate-column-widths">
|
5746
|
+
<xsl:param name="table"/>
|
5747
|
+
<xsl:param name="cols-count"/>
|
5748
|
+
|
5749
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
5750
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
5751
|
+
<xsl:with-param name="table" select="$table"/>
|
5752
|
+
</xsl:call-template>
|
5753
|
+
|
5754
|
+
</xsl:template><xsl:template name="calculate-column-widths-proportional">
|
5694
5755
|
<xsl:param name="table"/>
|
5695
5756
|
<xsl:param name="cols-count"/>
|
5696
5757
|
<xsl:param name="curr-col" select="1"/>
|
5697
5758
|
<xsl:param name="width" select="0"/>
|
5698
5759
|
|
5760
|
+
<!-- table=<xsl:copy-of select="$table"/> -->
|
5761
|
+
|
5699
5762
|
<xsl:if test="$curr-col <= $cols-count">
|
5700
5763
|
<xsl:variable name="widths">
|
5701
5764
|
<xsl:choose>
|
@@ -5733,16 +5796,22 @@
|
|
5733
5796
|
</xsl:for-each>
|
5734
5797
|
</xsl:when>
|
5735
5798
|
<xsl:otherwise>
|
5736
|
-
<xsl:
|
5799
|
+
<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
|
5800
|
+
|
5801
|
+
<!-- <table><xsl:copy-of select="$table"/></table>
|
5802
|
+
-->
|
5803
|
+
<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
|
5737
5804
|
<xsl:variable name="td_text">
|
5738
5805
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
5739
5806
|
</xsl:variable>
|
5807
|
+
<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
|
5740
5808
|
<xsl:variable name="words">
|
5741
5809
|
<xsl:variable name="string_with_added_zerospaces">
|
5742
5810
|
<xsl:call-template name="add-zero-spaces-java">
|
5743
5811
|
<xsl:with-param name="text" select="$td_text"/>
|
5744
5812
|
</xsl:call-template>
|
5745
5813
|
</xsl:variable>
|
5814
|
+
<!-- <xsl:message>string_with_added_zerospaces=<xsl:value-of select="$string_with_added_zerospaces"/></xsl:message> -->
|
5746
5815
|
<xsl:call-template name="tokenize">
|
5747
5816
|
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
5748
5817
|
<!-- 2009 thinspace -->
|
@@ -5750,11 +5819,13 @@
|
|
5750
5819
|
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
5751
5820
|
</xsl:call-template>
|
5752
5821
|
</xsl:variable>
|
5822
|
+
<!-- words=<xsl:copy-of select="$words"/> -->
|
5753
5823
|
<xsl:variable name="max_length">
|
5754
5824
|
<xsl:call-template name="max_length">
|
5755
5825
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
5756
5826
|
</xsl:call-template>
|
5757
5827
|
</xsl:variable>
|
5828
|
+
<!-- <xsl:message>max_length=<xsl:value-of select="$max_length"/></xsl:message> -->
|
5758
5829
|
<width>
|
5759
5830
|
<xsl:variable name="divider">
|
5760
5831
|
<xsl:choose>
|
@@ -5773,6 +5844,8 @@
|
|
5773
5844
|
</xsl:choose>
|
5774
5845
|
</xsl:variable>
|
5775
5846
|
|
5847
|
+
<!-- widths=<xsl:copy-of select="$widths"/> -->
|
5848
|
+
|
5776
5849
|
<column>
|
5777
5850
|
<xsl:for-each select="xalan:nodeset($widths)//width">
|
5778
5851
|
<xsl:sort select="." data-type="number" order="descending"/>
|
@@ -5781,43 +5854,285 @@
|
|
5781
5854
|
</xsl:if>
|
5782
5855
|
</xsl:for-each>
|
5783
5856
|
</column>
|
5784
|
-
<xsl:call-template name="calculate-column-widths">
|
5857
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
5785
5858
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
5786
5859
|
<xsl:with-param name="curr-col" select="$curr-col +1"/>
|
5787
5860
|
<xsl:with-param name="table" select="$table"/>
|
5788
5861
|
</xsl:call-template>
|
5789
5862
|
</xsl:if>
|
5863
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
|
5864
|
+
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
5865
|
+
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
5866
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
5867
|
+
|
5868
|
+
<!-- if all capitals english letters or digits -->
|
5869
|
+
<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
|
5870
|
+
<xsl:call-template name="repeat">
|
5871
|
+
<xsl:with-param name="char" select="'X'"/>
|
5872
|
+
<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
|
5873
|
+
</xsl:call-template>
|
5874
|
+
</xsl:if>
|
5790
5875
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
5791
5876
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
5792
5877
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
5793
5878
|
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
|
5794
5879
|
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
|
5795
5880
|
<xsl:value-of select="@target"/>
|
5796
|
-
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
|
5797
|
-
<xsl:
|
5798
|
-
<xsl:
|
5799
|
-
<xsl:
|
5800
|
-
<xsl:
|
5801
|
-
|
5881
|
+
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
|
5882
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
5883
|
+
<xsl:variable name="mathml_">
|
5884
|
+
<xsl:for-each select="*">
|
5885
|
+
<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
|
5886
|
+
<xsl:copy-of select="."/>
|
5887
|
+
</xsl:if>
|
5888
|
+
</xsl:for-each>
|
5889
|
+
</xsl:variable>
|
5890
|
+
<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
|
5891
|
+
|
5892
|
+
<xsl:variable name="math_text">
|
5893
|
+
<xsl:value-of select="normalize-space($mathml)"/>
|
5894
|
+
<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
|
5895
|
+
<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
|
5896
|
+
</xsl:variable>
|
5897
|
+
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
|
5898
|
+
</xsl:if>
|
5899
|
+
</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
|
5900
|
+
<xsl:param name="parent_table_page-width"/> <!-- for nested tables, in re-calculate step -->
|
5901
|
+
|
5902
|
+
<!-- via intermediate format -->
|
5903
|
+
|
5904
|
+
<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
|
5905
|
+
|
5906
|
+
<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
|
5907
|
+
|
5908
|
+
<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
|
5909
|
+
|
5910
|
+
<!-- get current table id -->
|
5911
|
+
<xsl:variable name="table_id" select="@id"/>
|
5912
|
+
<!-- find table by id in the file 'table_widths' -->
|
5913
|
+
<!-- <xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
|
5914
|
+
<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/> -->
|
5915
|
+
|
5916
|
+
<!-- table='<xsl:copy-of select="$table"/>' -->
|
5917
|
+
<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
|
5918
|
+
<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
|
5919
|
+
<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
|
5920
|
+
|
5921
|
+
<xsl:variable name="table_with_cell_widths_">
|
5922
|
+
<xsl:apply-templates select="." mode="determine_cell_widths-if"/> <!-- read column's width from IF -->
|
5923
|
+
</xsl:variable>
|
5924
|
+
<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
|
5925
|
+
|
5926
|
+
<!-- <xsl:if test="$table_if_debug = 'true'">
|
5927
|
+
<xsl:copy-of select="$table_with_cell_widths"/>
|
5928
|
+
</xsl:if> -->
|
5929
|
+
|
5930
|
+
|
5931
|
+
<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
|
5932
|
+
|
5933
|
+
<xsl:variable name="column_widths_">
|
5934
|
+
<!-- iteration of columns -->
|
5935
|
+
<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
|
5936
|
+
<xsl:variable name="pos" select="position()"/>
|
5937
|
+
<column>
|
5938
|
+
<xsl:attribute name="width_max">
|
5939
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
|
5940
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
5941
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
5942
|
+
</xsl:for-each>
|
5943
|
+
</xsl:attribute>
|
5944
|
+
<xsl:attribute name="width_min">
|
5945
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
|
5946
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
5947
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
5948
|
+
</xsl:for-each>
|
5949
|
+
</xsl:attribute>
|
5950
|
+
</column>
|
5802
5951
|
</xsl:for-each>
|
5803
5952
|
</xsl:variable>
|
5953
|
+
<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
|
5804
5954
|
|
5805
|
-
<
|
5806
|
-
|
5807
|
-
|
5808
|
-
|
5809
|
-
|
5810
|
-
|
5811
|
-
|
5812
|
-
|
5813
|
-
|
5814
|
-
|
5815
|
-
|
5816
|
-
|
5817
|
-
|
5818
|
-
|
5819
|
-
|
5820
|
-
|
5955
|
+
<!-- <column_widths>
|
5956
|
+
<xsl:copy-of select="$column_widths"/>
|
5957
|
+
</column_widths> -->
|
5958
|
+
|
5959
|
+
<!-- These in turn, are used to find the minimum and maximum width for the table. -->
|
5960
|
+
<xsl:variable name="table_widths_">
|
5961
|
+
<table>
|
5962
|
+
<xsl:attribute name="width_max">
|
5963
|
+
<xsl:value-of select="sum($column_widths/column/@width_max)"/>
|
5964
|
+
</xsl:attribute>
|
5965
|
+
<xsl:attribute name="width_min">
|
5966
|
+
<xsl:value-of select="sum($column_widths/column/@width_min)"/>
|
5967
|
+
</xsl:attribute>
|
5968
|
+
</table>
|
5969
|
+
</xsl:variable>
|
5970
|
+
<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
|
5971
|
+
|
5972
|
+
<xsl:variable name="page_width">
|
5973
|
+
<xsl:choose>
|
5974
|
+
<xsl:when test="$parent_table_page-width != ''">
|
5975
|
+
<xsl:value-of select="$parent_table_page-width"/>
|
5976
|
+
</xsl:when>
|
5977
|
+
<xsl:otherwise>
|
5978
|
+
<xsl:value-of select="@page-width"/>
|
5979
|
+
</xsl:otherwise>
|
5980
|
+
</xsl:choose>
|
5981
|
+
</xsl:variable>
|
5982
|
+
|
5983
|
+
<xsl:if test="$table_if_debug = 'true'">
|
5984
|
+
<table_width>
|
5985
|
+
<xsl:copy-of select="$table_widths"/>
|
5986
|
+
</table_width>
|
5987
|
+
<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
|
5988
|
+
</xsl:if>
|
5989
|
+
|
5990
|
+
|
5991
|
+
<!-- There are three cases: -->
|
5992
|
+
<xsl:choose>
|
5993
|
+
<!-- 1. The minimum table width is equal to or wider than the available space -->
|
5994
|
+
<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
|
5995
|
+
<!-- call old algorithm -->
|
5996
|
+
<case1/>
|
5997
|
+
<!-- <xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
|
5998
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
5999
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
6000
|
+
<xsl:with-param name="table" select="$table"/>
|
6001
|
+
</xsl:call-template> -->
|
6002
|
+
</xsl:when>
|
6003
|
+
<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
|
6004
|
+
<xsl:when test="$table_widths/table/@width_max <= $page_width">
|
6005
|
+
<case2/>
|
6006
|
+
<autolayout/>
|
6007
|
+
<xsl:for-each select="$column_widths/column/@width_max">
|
6008
|
+
<column divider="100"><xsl:value-of select="."/></column>
|
6009
|
+
</xsl:for-each>
|
6010
|
+
</xsl:when>
|
6011
|
+
<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
|
6012
|
+
In this case, find the difference between the available space and the minimum table width, lets call it W.
|
6013
|
+
Lets also call D the difference between maximum and minimum width of the table.
|
6014
|
+
For each column, let d be the difference between maximum and minimum width of that column.
|
6015
|
+
Now set the column's width to the minimum width plus d times W over D.
|
6016
|
+
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
6017
|
+
<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)">
|
6018
|
+
<!-- difference between the available space and the minimum table width -->
|
6019
|
+
<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
|
6020
|
+
<W><xsl:value-of select="$W"/></W>
|
6021
|
+
<!-- difference between maximum and minimum width of the table -->
|
6022
|
+
<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
|
6023
|
+
<D><xsl:value-of select="$D"/></D>
|
6024
|
+
<case3/>
|
6025
|
+
<autolayout/>
|
6026
|
+
<xsl:if test="$table_widths/table/@width_min >= $page_width">
|
6027
|
+
<split_keep-within-line>true</split_keep-within-line>
|
6028
|
+
</xsl:if>
|
6029
|
+
<xsl:for-each select="$column_widths/column">
|
6030
|
+
<!-- difference between maximum and minimum width of that column. -->
|
6031
|
+
<xsl:variable name="d" select="@width_max - @width_min"/>
|
6032
|
+
<d><xsl:value-of select="$d"/></d>
|
6033
|
+
<width_min><xsl:value-of select="@width_min"/></width_min>
|
6034
|
+
<e><xsl:value-of select="$d * $W div $D"/></e>
|
6035
|
+
<!-- set the column's width to the minimum width plus d times W over D. -->
|
6036
|
+
<column divider="100">
|
6037
|
+
<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
|
6038
|
+
</column>
|
6039
|
+
</xsl:for-each>
|
6040
|
+
|
6041
|
+
</xsl:when>
|
6042
|
+
<xsl:otherwise><unknown_case/></xsl:otherwise>
|
6043
|
+
</xsl:choose>
|
6044
|
+
|
6045
|
+
</xsl:template><xsl:template name="get-calculated-column-widths-autolayout-algorithm">
|
6046
|
+
|
6047
|
+
<!-- if nested 'dl' or 'table' -->
|
6048
|
+
<xsl:variable name="parent_table_id" select="normalize-space(ancestor::*[local-name() = 'table' or local-name() = 'dl'][1]/@id)"/>
|
6049
|
+
<parent_table_id><xsl:value-of select="$parent_table_id"/></parent_table_id>
|
6050
|
+
|
6051
|
+
<parent_element><xsl:value-of select="local-name(..)"/></parent_element>
|
6052
|
+
|
6053
|
+
<xsl:variable name="parent_table_page-width_">
|
6054
|
+
<xsl:if test="$parent_table_id != ''">
|
6055
|
+
<!-- determine column number in the parent table -->
|
6056
|
+
<xsl:variable name="parent_table_column_number">
|
6057
|
+
<xsl:choose>
|
6058
|
+
<xsl:when test="parent::*[local-name() = 'dd']">2</xsl:when>
|
6059
|
+
<xsl:otherwise> <!-- parent is table -->
|
6060
|
+
<xsl:value-of select="count(ancestor::*[local-name() = 'td'][1]/preceding-sibling::*[local-name() = 'td']) + 1"/>
|
6061
|
+
</xsl:otherwise>
|
6062
|
+
</xsl:choose>
|
6063
|
+
</xsl:variable>
|
6064
|
+
<!-- find table by id in the file 'table_widths' and get all Nth `<column>...</column> -->
|
6065
|
+
<xsl:value-of select="$table_widths_from_if_calculated//table[@id = $parent_table_id]/column[number($parent_table_column_number)]"/>
|
6066
|
+
</xsl:if>
|
6067
|
+
</xsl:variable>
|
6068
|
+
<xsl:variable name="parent_table_page-width" select="normalize-space($parent_table_page-width_)"/>
|
6069
|
+
|
6070
|
+
<!-- get current table id -->
|
6071
|
+
<xsl:variable name="table_id" select="@id"/>
|
6072
|
+
|
6073
|
+
<xsl:choose>
|
6074
|
+
<xsl:when test="$parent_table_id = '' or $parent_table_page-width = ''">
|
6075
|
+
<!-- find table by id in the file 'table_widths' and get all `<column>...</column> -->
|
6076
|
+
<xsl:copy-of select="$table_widths_from_if_calculated//table[@id = $table_id]/node()"/>
|
6077
|
+
</xsl:when>
|
6078
|
+
<xsl:otherwise>
|
6079
|
+
<!-- recalculate columns width based on parent table width -->
|
6080
|
+
<xsl:for-each select="$table_widths_from_if//table[@id = $table_id]">
|
6081
|
+
<xsl:call-template name="calculate-column-widths-autolayout-algorithm">
|
6082
|
+
<xsl:with-param name="parent_table_page-width" select="$parent_table_page-width"/> <!-- padding-left = 2mm = 50000-->
|
6083
|
+
</xsl:call-template>
|
6084
|
+
</xsl:for-each>
|
6085
|
+
</xsl:otherwise>
|
6086
|
+
</xsl:choose>
|
6087
|
+
|
6088
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
|
6089
|
+
<xsl:copy>
|
6090
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
|
6091
|
+
</xsl:copy>
|
6092
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
|
6093
|
+
<xsl:copy>
|
6094
|
+
<xsl:copy-of select="@*"/>
|
6095
|
+
|
6096
|
+
<!-- The maximum width is given by the widest line. -->
|
6097
|
+
<xsl:attribute name="width_max">
|
6098
|
+
<xsl:for-each select="p_len">
|
6099
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
6100
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
6101
|
+
</xsl:for-each>
|
6102
|
+
</xsl:attribute>
|
6103
|
+
|
6104
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
6105
|
+
<xsl:variable name="width_min">
|
6106
|
+
<xsl:for-each select="word_len">
|
6107
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
6108
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
6109
|
+
</xsl:for-each>
|
6110
|
+
</xsl:variable>
|
6111
|
+
<xsl:attribute name="width_min">
|
6112
|
+
<xsl:value-of select="$width_min"/>
|
6113
|
+
</xsl:attribute>
|
6114
|
+
|
6115
|
+
<xsl:if test="$width_min = 0">
|
6116
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
6117
|
+
</xsl:if>
|
6118
|
+
|
6119
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
|
6120
|
+
|
6121
|
+
</xsl:copy>
|
6122
|
+
</xsl:template><xsl:template match="*[local-name()='thead']">
|
6123
|
+
<xsl:param name="cols-count"/>
|
6124
|
+
<fo:table-header>
|
6125
|
+
|
6126
|
+
|
6127
|
+
<xsl:apply-templates/>
|
6128
|
+
</fo:table-header>
|
6129
|
+
</xsl:template><xsl:template name="table-header-title">
|
6130
|
+
<xsl:param name="cols-count"/>
|
6131
|
+
<!-- row for title -->
|
6132
|
+
<fo:table-row>
|
6133
|
+
<fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
|
6134
|
+
|
6135
|
+
<xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
|
5821
6136
|
<xsl:with-param name="continued">true</xsl:with-param>
|
5822
6137
|
</xsl:apply-templates>
|
5823
6138
|
|
@@ -5888,16 +6203,10 @@
|
|
5888
6203
|
</xsl:for-each>
|
5889
6204
|
</xsl:when>
|
5890
6205
|
<xsl:otherwise>
|
5891
|
-
|
5892
|
-
|
5893
|
-
|
5894
|
-
|
5895
|
-
</xsl:when>
|
5896
|
-
<xsl:otherwise>
|
5897
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
5898
|
-
</xsl:otherwise>
|
5899
|
-
</xsl:choose>
|
5900
|
-
</xsl:for-each>
|
6206
|
+
<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
|
6207
|
+
<xsl:call-template name="insertTableColumnWidth">
|
6208
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
6209
|
+
</xsl:call-template>
|
5901
6210
|
</xsl:otherwise>
|
5902
6211
|
</xsl:choose>
|
5903
6212
|
|
@@ -5984,6 +6293,52 @@
|
|
5984
6293
|
|
5985
6294
|
</fo:table-body>
|
5986
6295
|
|
6296
|
+
</xsl:template><xsl:template match="/" mode="process_table-if">
|
6297
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
6298
|
+
<xsl:apply-templates mode="process_table-if">
|
6299
|
+
<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
|
6300
|
+
</xsl:apply-templates>
|
6301
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
|
6302
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
6303
|
+
|
6304
|
+
<fo:table-body>
|
6305
|
+
<xsl:for-each select="*[local-name() = 'tr']">
|
6306
|
+
<xsl:variable name="col_count" select="count(*)"/>
|
6307
|
+
|
6308
|
+
<!-- iteration for each tr/td -->
|
6309
|
+
|
6310
|
+
<xsl:choose>
|
6311
|
+
<xsl:when test="$table_or_dl = 'table'">
|
6312
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
|
6313
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
6314
|
+
<!-- <test_table><xsl:copy-of select="."/></test_table> -->
|
6315
|
+
<xsl:call-template name="td"/>
|
6316
|
+
</fo:table-row>
|
6317
|
+
</xsl:for-each>
|
6318
|
+
</xsl:when>
|
6319
|
+
<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
|
6320
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
|
6321
|
+
<xsl:variable name="is_dt" select="position() = 1"/>
|
6322
|
+
|
6323
|
+
<xsl:for-each select="*">
|
6324
|
+
<!-- <test><xsl:copy-of select="."/></test> -->
|
6325
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
6326
|
+
<xsl:choose>
|
6327
|
+
<xsl:when test="$is_dt">
|
6328
|
+
<xsl:call-template name="insert_dt_cell"/>
|
6329
|
+
</xsl:when>
|
6330
|
+
<xsl:otherwise>
|
6331
|
+
<xsl:call-template name="insert_dd_cell"/>
|
6332
|
+
</xsl:otherwise>
|
6333
|
+
</xsl:choose>
|
6334
|
+
</fo:table-row>
|
6335
|
+
</xsl:for-each>
|
6336
|
+
</xsl:for-each>
|
6337
|
+
</xsl:otherwise>
|
6338
|
+
</xsl:choose>
|
6339
|
+
|
6340
|
+
</xsl:for-each>
|
6341
|
+
</fo:table-body>
|
5987
6342
|
</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
5988
6343
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
5989
6344
|
|
@@ -6088,7 +6443,7 @@
|
|
6088
6443
|
</xsl:choose>
|
6089
6444
|
</xsl:attribute>
|
6090
6445
|
</xsl:if>
|
6091
|
-
</xsl:template><xsl:template match="*[local-name()='td']">
|
6446
|
+
</xsl:template><xsl:template match="*[local-name()='td']" name="td">
|
6092
6447
|
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
|
6093
6448
|
<xsl:call-template name="setTextAlignment">
|
6094
6449
|
<xsl:with-param name="default">left</xsl:with-param>
|
@@ -6133,8 +6488,18 @@
|
|
6133
6488
|
|
6134
6489
|
<xsl:call-template name="setTableCellAttributes"/>
|
6135
6490
|
|
6491
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
6492
|
+
<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
|
6493
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
6494
|
+
</xsl:if>
|
6495
|
+
|
6136
6496
|
<fo:block>
|
6137
6497
|
|
6498
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
6499
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
6500
|
+
</xsl:if>
|
6501
|
+
|
6502
|
+
|
6138
6503
|
|
6139
6504
|
<xsl:if test="not(.//bipm:image)">
|
6140
6505
|
<xsl:attribute name="line-stacking-strategy">font-height</xsl:attribute>
|
@@ -6147,6 +6512,9 @@
|
|
6147
6512
|
|
6148
6513
|
|
6149
6514
|
<xsl:apply-templates/>
|
6515
|
+
|
6516
|
+
<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"/> -->
|
6517
|
+
|
6150
6518
|
</fo:block>
|
6151
6519
|
</fo:table-cell>
|
6152
6520
|
</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
|
@@ -6360,9 +6728,9 @@
|
|
6360
6728
|
<!-- current hierarchy is 'figure' element -->
|
6361
6729
|
<xsl:variable name="following_dl_colwidths">
|
6362
6730
|
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
6363
|
-
<xsl:variable name="
|
6364
|
-
<xsl:variable name="doc_ns">
|
6365
|
-
bipm
|
6731
|
+
<xsl:variable name="simple-table">
|
6732
|
+
<!-- <xsl:variable name="doc_ns">
|
6733
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
6366
6734
|
</xsl:variable>
|
6367
6735
|
<xsl:variable name="ns">
|
6368
6736
|
<xsl:choose>
|
@@ -6373,7 +6741,7 @@
|
|
6373
6741
|
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
6374
6742
|
</xsl:otherwise>
|
6375
6743
|
</xsl:choose>
|
6376
|
-
</xsl:variable>
|
6744
|
+
</xsl:variable> -->
|
6377
6745
|
|
6378
6746
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
6379
6747
|
<tbody>
|
@@ -6384,7 +6752,7 @@
|
|
6384
6752
|
|
6385
6753
|
<xsl:call-template name="calculate-column-widths">
|
6386
6754
|
<xsl:with-param name="cols-count" select="2"/>
|
6387
|
-
<xsl:with-param name="table" select="$
|
6755
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
6388
6756
|
</xsl:call-template>
|
6389
6757
|
|
6390
6758
|
</xsl:if>
|
@@ -6508,8 +6876,10 @@
|
|
6508
6876
|
<!-- and (not(../@class) or ../@class !='pseudocode') -->
|
6509
6877
|
</xsl:variable>
|
6510
6878
|
|
6879
|
+
<xsl:variable name="onlyOneComponent" select="normalize-space($parent = 'formula' and count(*[local-name()='dt']) = 1)"/>
|
6880
|
+
|
6511
6881
|
<xsl:choose>
|
6512
|
-
<xsl:when test="$
|
6882
|
+
<xsl:when test="$onlyOneComponent = 'true'"> <!-- only one component -->
|
6513
6883
|
|
6514
6884
|
<fo:block margin-bottom="12pt" text-align="left">
|
6515
6885
|
|
@@ -6524,7 +6894,7 @@
|
|
6524
6894
|
<xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
|
6525
6895
|
</fo:block>
|
6526
6896
|
|
6527
|
-
</xsl:when>
|
6897
|
+
</xsl:when> <!-- END: only one component -->
|
6528
6898
|
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
|
6529
6899
|
<fo:block margin-bottom="12pt" text-align="left">
|
6530
6900
|
|
@@ -6538,8 +6908,8 @@
|
|
6538
6908
|
</xsl:variable>
|
6539
6909
|
<xsl:value-of select="$title-where"/>
|
6540
6910
|
</fo:block>
|
6541
|
-
</xsl:when>
|
6542
|
-
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
6911
|
+
</xsl:when> <!-- END: a few components -->
|
6912
|
+
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
|
6543
6913
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
|
6544
6914
|
|
6545
6915
|
|
@@ -6552,22 +6922,41 @@
|
|
6552
6922
|
</xsl:variable>
|
6553
6923
|
<xsl:value-of select="$title-key"/>
|
6554
6924
|
</fo:block>
|
6555
|
-
</xsl:when>
|
6925
|
+
</xsl:when> <!-- END: definition list in a figure -->
|
6556
6926
|
</xsl:choose>
|
6557
6927
|
|
6558
6928
|
<!-- a few components -->
|
6559
|
-
<xsl:if test="
|
6929
|
+
<xsl:if test="$onlyOneComponent = 'false'">
|
6560
6930
|
<fo:block>
|
6561
6931
|
|
6562
6932
|
|
6563
6933
|
|
6564
6934
|
|
6935
|
+
|
6936
|
+
<xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
|
6937
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
6938
|
+
</xsl:if>
|
6939
|
+
|
6565
6940
|
<fo:block>
|
6566
6941
|
|
6567
6942
|
|
6568
6943
|
|
6569
6944
|
|
6945
|
+
<xsl:apply-templates select="*[local-name() = 'name']">
|
6946
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
6947
|
+
</xsl:apply-templates>
|
6948
|
+
|
6949
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
6950
|
+
<!-- to determine start of table -->
|
6951
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
6952
|
+
</xsl:if>
|
6953
|
+
|
6570
6954
|
<fo:table width="95%" table-layout="fixed">
|
6955
|
+
|
6956
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
6957
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
6958
|
+
</xsl:if>
|
6959
|
+
|
6571
6960
|
|
6572
6961
|
<xsl:choose>
|
6573
6962
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
|
@@ -6576,61 +6965,178 @@
|
|
6576
6965
|
|
6577
6966
|
</xsl:when>
|
6578
6967
|
</xsl:choose>
|
6579
|
-
|
6580
|
-
|
6581
|
-
|
6582
|
-
|
6583
|
-
|
6584
|
-
|
6585
|
-
|
6586
|
-
<
|
6587
|
-
<
|
6588
|
-
|
6589
|
-
|
6590
|
-
|
6591
|
-
|
6592
|
-
|
6593
|
-
|
6594
|
-
|
6595
|
-
|
6596
|
-
|
6597
|
-
|
6598
|
-
|
6599
|
-
|
6600
|
-
|
6601
|
-
|
6602
|
-
|
6603
|
-
|
6604
|
-
|
6605
|
-
|
6606
|
-
|
6607
|
-
|
6608
|
-
|
6609
|
-
|
6610
|
-
|
6611
|
-
|
6612
|
-
|
6613
|
-
|
6614
|
-
|
6615
|
-
|
6616
|
-
|
6617
|
-
|
6968
|
+
|
6969
|
+
|
6970
|
+
|
6971
|
+
<xsl:choose>
|
6972
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
6973
|
+
<!-- generate IF for table widths -->
|
6974
|
+
<!-- example:
|
6975
|
+
<tr>
|
6976
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
6977
|
+
<p>Symbol</p>
|
6978
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
6979
|
+
</td>
|
6980
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
6981
|
+
<p>Description</p>
|
6982
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
6983
|
+
</td>
|
6984
|
+
</tr>
|
6985
|
+
-->
|
6986
|
+
|
6987
|
+
<!-- create virtual html table for dl/[dt and dd] -->
|
6988
|
+
<xsl:variable name="simple-table">
|
6989
|
+
|
6990
|
+
<xsl:variable name="dl_table">
|
6991
|
+
<tbody>
|
6992
|
+
<xsl:apply-templates mode="dl_if">
|
6993
|
+
<xsl:with-param name="id" select="@id"/>
|
6994
|
+
</xsl:apply-templates>
|
6995
|
+
</tbody>
|
6996
|
+
</xsl:variable>
|
6997
|
+
|
6998
|
+
<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
|
6999
|
+
|
7000
|
+
<!-- Step: replace <br/> to <p>...</p> -->
|
7001
|
+
<xsl:variable name="table_without_br">
|
7002
|
+
<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
|
7003
|
+
</xsl:variable>
|
7004
|
+
|
7005
|
+
<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
|
7006
|
+
|
7007
|
+
<!-- Step: add id to each cell -->
|
7008
|
+
<!-- add <word>...</word> for each word, image, math -->
|
7009
|
+
<xsl:variable name="simple-table-id">
|
7010
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
|
7011
|
+
<xsl:with-param name="id" select="@id"/>
|
7012
|
+
</xsl:apply-templates>
|
7013
|
+
</xsl:variable>
|
7014
|
+
|
7015
|
+
<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
|
7016
|
+
|
7017
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
7018
|
+
|
7019
|
+
</xsl:variable>
|
7020
|
+
|
7021
|
+
<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
|
7022
|
+
|
7023
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
|
7024
|
+
<xsl:with-param name="table_or_dl">dl</xsl:with-param>
|
7025
|
+
</xsl:apply-templates>
|
7026
|
+
|
7027
|
+
</xsl:when>
|
7028
|
+
<xsl:otherwise>
|
7029
|
+
|
7030
|
+
<xsl:variable name="simple-table">
|
7031
|
+
|
7032
|
+
<xsl:variable name="dl_table">
|
7033
|
+
<tbody>
|
7034
|
+
<xsl:apply-templates mode="dl">
|
7035
|
+
<xsl:with-param name="id" select="@id"/>
|
7036
|
+
</xsl:apply-templates>
|
7037
|
+
</tbody>
|
7038
|
+
</xsl:variable>
|
7039
|
+
|
7040
|
+
<xsl:copy-of select="$dl_table"/>
|
7041
|
+
</xsl:variable>
|
7042
|
+
|
7043
|
+
<xsl:variable name="colwidths">
|
7044
|
+
<xsl:call-template name="calculate-column-widths">
|
7045
|
+
<xsl:with-param name="cols-count" select="2"/>
|
7046
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
7047
|
+
</xsl:call-template>
|
7048
|
+
</xsl:variable>
|
7049
|
+
|
7050
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
7051
|
+
DEBUG
|
7052
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
7053
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
7054
|
+
|
7055
|
+
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
7056
|
+
|
7057
|
+
<xsl:variable name="maxlength_dt">
|
7058
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
7059
|
+
</xsl:variable>
|
7060
|
+
|
7061
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
7062
|
+
false
|
7063
|
+
</xsl:variable>
|
7064
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
7065
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
7066
|
+
|
7067
|
+
|
7068
|
+
<xsl:call-template name="setColumnWidth_dl">
|
7069
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
7070
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
7071
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
7072
|
+
</xsl:call-template>
|
7073
|
+
|
7074
|
+
<fo:table-body>
|
7075
|
+
|
7076
|
+
<!-- DEBUG -->
|
7077
|
+
<xsl:if test="$table_if_debug = 'true'">
|
7078
|
+
<fo:table-row>
|
7079
|
+
<fo:table-cell number-columns-spanned="2" font-size="60%">
|
7080
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
7081
|
+
</fo:table-cell>
|
7082
|
+
</fo:table-row>
|
7083
|
+
</xsl:if>
|
7084
|
+
|
7085
|
+
<xsl:apply-templates>
|
7086
|
+
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
7087
|
+
<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
|
7088
|
+
</xsl:apply-templates>
|
7089
|
+
|
7090
|
+
</fo:table-body>
|
7091
|
+
</xsl:otherwise>
|
7092
|
+
</xsl:choose>
|
6618
7093
|
</fo:table>
|
6619
7094
|
</fo:block>
|
6620
7095
|
</fo:block>
|
6621
|
-
</xsl:if>
|
7096
|
+
</xsl:if> <!-- END: a few components -->
|
6622
7097
|
</fo:block-container>
|
6623
7098
|
</fo:block-container>
|
7099
|
+
|
7100
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- process nested 'dl' -->
|
7101
|
+
<xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
|
7102
|
+
</xsl:if>
|
7103
|
+
|
7104
|
+
</xsl:template><xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
|
7105
|
+
<xsl:param name="process">false</xsl:param>
|
7106
|
+
<xsl:if test="$process = 'true'">
|
7107
|
+
<fo:block xsl:use-attribute-sets="dl-name-style">
|
7108
|
+
<xsl:apply-templates/>
|
7109
|
+
</fo:block>
|
7110
|
+
</xsl:if>
|
6624
7111
|
</xsl:template><xsl:template name="setColumnWidth_dl">
|
6625
7112
|
<xsl:param name="colwidths"/>
|
6626
7113
|
<xsl:param name="maxlength_dt"/>
|
7114
|
+
<xsl:param name="isContainsKeepTogetherTag"/>
|
7115
|
+
|
7116
|
+
<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
|
7117
|
+
|
6627
7118
|
<xsl:choose>
|
7119
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
7120
|
+
<xsl:call-template name="insertTableColumnWidth">
|
7121
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
7122
|
+
</xsl:call-template>
|
7123
|
+
</xsl:when>
|
6628
7124
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
6629
7125
|
<fo:table-column column-width="50%"/>
|
6630
7126
|
<fo:table-column column-width="50%"/>
|
6631
7127
|
</xsl:when>
|
6632
7128
|
<xsl:otherwise>
|
6633
7129
|
<xsl:choose>
|
7130
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
7131
|
+
<xsl:call-template name="insertTableColumnWidth">
|
7132
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
7133
|
+
</xsl:call-template>
|
7134
|
+
</xsl:when>
|
7135
|
+
<xsl:when test="$isContainsKeepTogetherTag">
|
7136
|
+
<xsl:call-template name="insertTableColumnWidth">
|
7137
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
7138
|
+
</xsl:call-template>
|
7139
|
+
</xsl:when>
|
6634
7140
|
<!-- to set width check most wide chars like `W` -->
|
6635
7141
|
<xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) <= 2"> <!-- if dt contains short text like t90, a, etc -->
|
6636
7142
|
<fo:table-column column-width="7%"/>
|
@@ -6661,20 +7167,31 @@
|
|
6661
7167
|
<fo:table-column column-width="60%"/>
|
6662
7168
|
</xsl:when>
|
6663
7169
|
<xsl:otherwise>
|
6664
|
-
<xsl:
|
6665
|
-
<xsl:
|
6666
|
-
|
6667
|
-
<fo:table-column column-width="proportional-column-width(2)"/>
|
6668
|
-
</xsl:when>
|
6669
|
-
<xsl:otherwise>
|
6670
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
6671
|
-
</xsl:otherwise>
|
6672
|
-
</xsl:choose>
|
6673
|
-
</xsl:for-each>
|
7170
|
+
<xsl:call-template name="insertTableColumnWidth">
|
7171
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
7172
|
+
</xsl:call-template>
|
6674
7173
|
</xsl:otherwise>
|
6675
7174
|
</xsl:choose>
|
6676
7175
|
</xsl:otherwise>
|
6677
7176
|
</xsl:choose>
|
7177
|
+
</xsl:template><xsl:template name="insertTableColumnWidth">
|
7178
|
+
<xsl:param name="colwidths"/>
|
7179
|
+
|
7180
|
+
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
7181
|
+
<xsl:choose>
|
7182
|
+
<xsl:when test=". = 1 or . = 0">
|
7183
|
+
<fo:table-column column-width="proportional-column-width(2)"/>
|
7184
|
+
</xsl:when>
|
7185
|
+
<xsl:otherwise>
|
7186
|
+
<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
|
7187
|
+
<xsl:variable name="divider">
|
7188
|
+
<xsl:value-of select="@divider"/>
|
7189
|
+
<xsl:if test="not(@divider)">1</xsl:if>
|
7190
|
+
</xsl:variable>
|
7191
|
+
<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
|
7192
|
+
</xsl:otherwise>
|
7193
|
+
</xsl:choose>
|
7194
|
+
</xsl:for-each>
|
6678
7195
|
</xsl:template><xsl:template name="getMaxLength_dt">
|
6679
7196
|
<xsl:variable name="lengths">
|
6680
7197
|
<xsl:for-each select="*[local-name()='dt']">
|
@@ -6698,7 +7215,6 @@
|
|
6698
7215
|
<xsl:value-of select="$maxLength"/>
|
6699
7216
|
</xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
|
6700
7217
|
<xsl:param name="key_iso"/>
|
6701
|
-
|
6702
7218
|
<!-- <tr>
|
6703
7219
|
<td>NOTE</td>
|
6704
7220
|
<td>
|
@@ -6706,27 +7222,47 @@
|
|
6706
7222
|
</td>
|
6707
7223
|
</tr>
|
6708
7224
|
-->
|
6709
|
-
|
7225
|
+
<!-- OLD Variant -->
|
7226
|
+
<!-- <fo:table-row>
|
6710
7227
|
<fo:table-cell>
|
6711
7228
|
<fo:block margin-top="6pt">
|
6712
7229
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
6713
7230
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
6714
7231
|
</xsl:if>
|
6715
|
-
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
7232
|
+
<xsl:apply-templates select="*[local-name() = 'name']" />
|
6716
7233
|
</fo:block>
|
6717
7234
|
</fo:table-cell>
|
6718
7235
|
<fo:table-cell>
|
6719
7236
|
<fo:block>
|
6720
|
-
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
7237
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]" />
|
7238
|
+
</fo:block>
|
7239
|
+
</fo:table-cell>
|
7240
|
+
</fo:table-row> -->
|
7241
|
+
<!-- <tr>
|
7242
|
+
<td number-columns-spanned="2">NOTE <xsl:apply-templates /> </td>
|
7243
|
+
</tr>
|
7244
|
+
-->
|
7245
|
+
<fo:table-row>
|
7246
|
+
<fo:table-cell number-columns-spanned="2">
|
7247
|
+
<fo:block>
|
7248
|
+
<xsl:call-template name="note"/>
|
6721
7249
|
</fo:block>
|
6722
7250
|
</fo:table-cell>
|
6723
7251
|
</fo:table-row>
|
6724
7252
|
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
|
7253
|
+
<xsl:param name="id"/>
|
7254
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
6725
7255
|
<tr>
|
6726
7256
|
<td>
|
7257
|
+
<xsl:attribute name="id">
|
7258
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
|
7259
|
+
</xsl:attribute>
|
6727
7260
|
<xsl:apply-templates/>
|
6728
7261
|
</td>
|
6729
7262
|
<td>
|
7263
|
+
<xsl:attribute name="id">
|
7264
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
|
7265
|
+
</xsl:attribute>
|
6730
7266
|
|
6731
7267
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
6732
7268
|
<xsl:with-param name="process">true</xsl:with-param>
|
@@ -6737,50 +7273,134 @@
|
|
6737
7273
|
|
6738
7274
|
</xsl:template><xsl:template match="*[local-name()='dt']">
|
6739
7275
|
<xsl:param name="key_iso"/>
|
7276
|
+
<xsl:param name="split_keep-within-line"/>
|
6740
7277
|
|
6741
7278
|
<fo:table-row xsl:use-attribute-sets="dt-row-style">
|
6742
|
-
<
|
7279
|
+
<xsl:call-template name="insert_dt_cell">
|
7280
|
+
<xsl:with-param name="key_iso" select="$key_iso"/>
|
7281
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7282
|
+
</xsl:call-template>
|
7283
|
+
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
|
7284
|
+
<xsl:call-template name="insert_dd_cell">
|
7285
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7286
|
+
</xsl:call-template>
|
7287
|
+
</xsl:for-each>
|
7288
|
+
</fo:table-row>
|
7289
|
+
</xsl:template><xsl:template name="insert_dt_cell">
|
7290
|
+
<xsl:param name="key_iso"/>
|
7291
|
+
<xsl:param name="split_keep-within-line"/>
|
7292
|
+
<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
|
7293
|
+
|
7294
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
7295
|
+
<!-- border is mandatory, to calculate real width -->
|
7296
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
7297
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
7298
|
+
</xsl:if>
|
7299
|
+
|
7300
|
+
|
7301
|
+
<fo:block xsl:use-attribute-sets="dt-block-style">
|
7302
|
+
<xsl:copy-of select="@id"/>
|
7303
|
+
|
7304
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
7305
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
7306
|
+
</xsl:if>
|
7307
|
+
|
7308
|
+
|
7309
|
+
|
7310
|
+
<xsl:apply-templates>
|
7311
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7312
|
+
</xsl:apply-templates>
|
7313
|
+
|
7314
|
+
<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"/> -->
|
7315
|
+
|
7316
|
+
</fo:block>
|
7317
|
+
</fo:table-cell>
|
7318
|
+
</xsl:template><xsl:template name="insert_dd_cell">
|
7319
|
+
<xsl:param name="split_keep-within-line"/>
|
7320
|
+
<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
|
7321
|
+
|
7322
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
7323
|
+
<!-- border is mandatory, to calculate real width -->
|
7324
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
7325
|
+
</xsl:if>
|
7326
|
+
|
7327
|
+
<fo:block>
|
7328
|
+
|
7329
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
7330
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
7331
|
+
</xsl:if>
|
7332
|
+
|
6743
7333
|
|
6744
|
-
<fo:block xsl:use-attribute-sets="dt-style">
|
6745
|
-
<xsl:copy-of select="@id"/>
|
6746
|
-
|
6747
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
6748
|
-
<xsl:attribute name="margin-top">0</xsl:attribute>
|
6749
|
-
</xsl:if>
|
6750
|
-
|
6751
|
-
|
6752
|
-
|
6753
|
-
<xsl:apply-templates/>
|
6754
|
-
</fo:block>
|
6755
|
-
</fo:table-cell>
|
6756
|
-
<fo:table-cell>
|
6757
|
-
<fo:block>
|
6758
|
-
|
6759
7334
|
|
6760
|
-
|
6761
|
-
|
6762
|
-
|
6763
|
-
|
6764
|
-
|
6765
|
-
|
7335
|
+
<xsl:choose>
|
7336
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
7337
|
+
<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
|
7338
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
7339
|
+
</xsl:apply-templates>
|
7340
|
+
</xsl:when>
|
7341
|
+
<xsl:otherwise>
|
7342
|
+
<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
|
7343
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
7344
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7345
|
+
</xsl:apply-templates>
|
7346
|
+
</xsl:otherwise>
|
7347
|
+
|
7348
|
+
</xsl:choose>
|
7349
|
+
|
7350
|
+
<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"/> -->
|
7351
|
+
|
7352
|
+
</fo:block>
|
7353
|
+
</fo:table-cell>
|
6766
7354
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
6767
7355
|
<xsl:apply-templates/>
|
6768
7356
|
</xsl:template><xsl:template match="*[local-name()='dd']">
|
6769
7357
|
<xsl:param name="process">false</xsl:param>
|
7358
|
+
<xsl:param name="split_keep-within-line"/>
|
6770
7359
|
<xsl:if test="$process = 'true'">
|
6771
7360
|
<xsl:apply-templates select="@language"/>
|
6772
|
-
<xsl:apply-templates
|
7361
|
+
<xsl:apply-templates>
|
7362
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7363
|
+
</xsl:apply-templates>
|
6773
7364
|
</xsl:if>
|
6774
7365
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
6775
7366
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
6776
|
-
</xsl:template><xsl:template match="*[local-name()='
|
7367
|
+
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
|
7368
|
+
<xsl:param name="id"/>
|
7369
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
7370
|
+
<tr>
|
7371
|
+
<td>
|
7372
|
+
<xsl:copy-of select="node()"/>
|
7373
|
+
</td>
|
7374
|
+
<td>
|
7375
|
+
|
7376
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
|
7377
|
+
|
7378
|
+
<!-- get paragraphs from nested 'dl' -->
|
7379
|
+
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
|
7380
|
+
|
7381
|
+
|
7382
|
+
</td>
|
7383
|
+
</tr>
|
7384
|
+
|
7385
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
|
7386
|
+
<xsl:for-each select="*[local-name() = 'dt']">
|
7387
|
+
<p>
|
7388
|
+
<xsl:copy-of select="node()"/>
|
7389
|
+
<xsl:text> </xsl:text>
|
7390
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'p']/node()"/>
|
7391
|
+
</p>
|
7392
|
+
</xsl:for-each>
|
7393
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if_nested"/><xsl:template match="*[local-name()='em']">
|
6777
7394
|
<fo:inline font-style="italic">
|
6778
7395
|
<xsl:apply-templates/>
|
6779
7396
|
</fo:inline>
|
6780
7397
|
</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
|
7398
|
+
<xsl:param name="split_keep-within-line"/>
|
6781
7399
|
<fo:inline font-weight="bold">
|
6782
7400
|
|
6783
|
-
<xsl:apply-templates
|
7401
|
+
<xsl:apply-templates>
|
7402
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7403
|
+
</xsl:apply-templates>
|
6784
7404
|
</fo:inline>
|
6785
7405
|
</xsl:template><xsl:template match="*[local-name()='padding']">
|
6786
7406
|
<fo:inline padding-right="{@value}"> </fo:inline>
|
@@ -6801,7 +7421,7 @@
|
|
6801
7421
|
|
6802
7422
|
|
6803
7423
|
|
6804
|
-
|
7424
|
+
<!-- 10 -->
|
6805
7425
|
|
6806
7426
|
|
6807
7427
|
|
@@ -6819,13 +7439,15 @@
|
|
6819
7439
|
<xsl:choose>
|
6820
7440
|
<xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
|
6821
7441
|
<xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
|
6822
|
-
<xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
7442
|
+
<xsl:when test="ancestor::*[local-name()='note'] or ancestor::*[local-name()='example']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
|
6823
7443
|
<xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
|
6824
7444
|
</xsl:choose>
|
6825
7445
|
</xsl:attribute>
|
6826
7446
|
</xsl:if>
|
6827
7447
|
<xsl:apply-templates/>
|
6828
7448
|
</fo:inline>
|
7449
|
+
</xsl:template><xsl:template match="*[local-name()='tt']/text()" priority="2">
|
7450
|
+
<xsl:call-template name="add_spaces_to_sourcecode"/>
|
6829
7451
|
</xsl:template><xsl:template match="*[local-name()='underline']">
|
6830
7452
|
<fo:inline text-decoration="underline">
|
6831
7453
|
<xsl:apply-templates/>
|
@@ -6973,54 +7595,120 @@
|
|
6973
7595
|
<fo:block break-after="page"/>
|
6974
7596
|
<fo:block> </fo:block>
|
6975
7597
|
<fo:block break-after="page"/>
|
7598
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']">
|
7599
|
+
<xsl:apply-templates/>
|
6976
7600
|
</xsl:template><xsl:template name="tokenize">
|
6977
7601
|
<xsl:param name="text"/>
|
6978
7602
|
<xsl:param name="separator" select="' '"/>
|
6979
7603
|
<xsl:choose>
|
7604
|
+
|
7605
|
+
<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
|
7606
|
+
<word><xsl:value-of select="normalize-space($text)"/></word>
|
7607
|
+
</xsl:when>
|
6980
7608
|
<xsl:when test="not(contains($text, $separator))">
|
6981
7609
|
<word>
|
6982
|
-
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
6983
|
-
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
6984
7610
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
6985
|
-
<xsl:variable name="len_str">
|
6986
|
-
<xsl:choose>
|
6987
|
-
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
6988
|
-
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
6989
|
-
</xsl:when>
|
6990
|
-
<xsl:otherwise>
|
6991
|
-
<xsl:value-of select="$len_str_tmp"/>
|
6992
|
-
</xsl:otherwise>
|
6993
|
-
</xsl:choose>
|
6994
|
-
</xsl:variable>
|
6995
|
-
|
6996
|
-
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
6997
|
-
<xsl:message>
|
6998
|
-
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
6999
|
-
len_str=<xsl:value-of select="$len_str"/>
|
7000
|
-
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
7001
|
-
</xsl:message>
|
7002
|
-
</xsl:if> -->
|
7003
|
-
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
7004
|
-
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
7005
7611
|
<xsl:choose>
|
7006
|
-
<xsl:when test="$
|
7007
|
-
<xsl:value-of select="$
|
7612
|
+
<xsl:when test="normalize-space(translate($text, 'X', '')) = ''"> <!-- special case for keep-together.within-line -->
|
7613
|
+
<xsl:value-of select="$len_str_tmp"/>
|
7008
7614
|
</xsl:when>
|
7009
7615
|
<xsl:otherwise>
|
7010
|
-
<xsl:
|
7616
|
+
<xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
|
7617
|
+
<xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
|
7618
|
+
<xsl:variable name="len_str">
|
7619
|
+
<xsl:choose>
|
7620
|
+
<xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
|
7621
|
+
<xsl:value-of select="$len_str_tmp * 1.5"/>
|
7622
|
+
</xsl:when>
|
7623
|
+
<xsl:otherwise>
|
7624
|
+
<xsl:value-of select="$len_str_tmp"/>
|
7625
|
+
</xsl:otherwise>
|
7626
|
+
</xsl:choose>
|
7627
|
+
</xsl:variable>
|
7628
|
+
|
7629
|
+
<!-- <xsl:if test="$len_str_no_en_chars div $len_str > 0.8">
|
7630
|
+
<xsl:message>
|
7631
|
+
div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
|
7632
|
+
len_str=<xsl:value-of select="$len_str"/>
|
7633
|
+
len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
|
7634
|
+
</xsl:message>
|
7635
|
+
</xsl:if> -->
|
7636
|
+
<!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
|
7637
|
+
<len_str><xsl:value-of select="$len_str"/></len_str> -->
|
7638
|
+
<xsl:choose>
|
7639
|
+
<xsl:when test="$len_str_no_en_chars div $len_str > 0.8"> <!-- means non-english string -->
|
7640
|
+
<xsl:value-of select="$len_str - $len_str_no_en_chars"/>
|
7641
|
+
</xsl:when>
|
7642
|
+
<xsl:otherwise>
|
7643
|
+
<xsl:value-of select="$len_str"/>
|
7644
|
+
</xsl:otherwise>
|
7645
|
+
</xsl:choose>
|
7011
7646
|
</xsl:otherwise>
|
7012
7647
|
</xsl:choose>
|
7013
7648
|
</word>
|
7014
7649
|
</xsl:when>
|
7015
7650
|
<xsl:otherwise>
|
7016
7651
|
<word>
|
7017
|
-
<xsl:
|
7652
|
+
<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
|
7653
|
+
<xsl:choose>
|
7654
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
7655
|
+
<xsl:value-of select="$word"/>
|
7656
|
+
</xsl:when>
|
7657
|
+
<xsl:otherwise>
|
7658
|
+
<xsl:value-of select="string-length($word)"/>
|
7659
|
+
</xsl:otherwise>
|
7660
|
+
</xsl:choose>
|
7018
7661
|
</word>
|
7019
7662
|
<xsl:call-template name="tokenize">
|
7020
7663
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
7021
7664
|
</xsl:call-template>
|
7022
7665
|
</xsl:otherwise>
|
7023
7666
|
</xsl:choose>
|
7667
|
+
</xsl:template><xsl:template name="tokenize_with_tags">
|
7668
|
+
<xsl:param name="tags"/>
|
7669
|
+
<xsl:param name="text"/>
|
7670
|
+
<xsl:param name="separator" select="' '"/>
|
7671
|
+
<xsl:choose>
|
7672
|
+
|
7673
|
+
<xsl:when test="not(contains($text, $separator))">
|
7674
|
+
<word>
|
7675
|
+
<xsl:call-template name="enclose_text_in_tags">
|
7676
|
+
<xsl:with-param name="text" select="normalize-space($text)"/>
|
7677
|
+
<xsl:with-param name="tags" select="$tags"/>
|
7678
|
+
</xsl:call-template>
|
7679
|
+
</word>
|
7680
|
+
</xsl:when>
|
7681
|
+
<xsl:otherwise>
|
7682
|
+
<word>
|
7683
|
+
<xsl:call-template name="enclose_text_in_tags">
|
7684
|
+
<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
|
7685
|
+
<xsl:with-param name="tags" select="$tags"/>
|
7686
|
+
</xsl:call-template>
|
7687
|
+
</word>
|
7688
|
+
<xsl:call-template name="tokenize_with_tags">
|
7689
|
+
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
7690
|
+
</xsl:call-template>
|
7691
|
+
</xsl:otherwise>
|
7692
|
+
</xsl:choose>
|
7693
|
+
</xsl:template><xsl:template name="enclose_text_in_tags">
|
7694
|
+
<xsl:param name="text"/>
|
7695
|
+
<xsl:param name="tags"/>
|
7696
|
+
<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
|
7697
|
+
|
7698
|
+
<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
|
7699
|
+
|
7700
|
+
<xsl:choose>
|
7701
|
+
<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
|
7702
|
+
<xsl:otherwise>
|
7703
|
+
<xsl:element name="{$tag_name}">
|
7704
|
+
<xsl:call-template name="enclose_text_in_tags">
|
7705
|
+
<xsl:with-param name="text" select="$text"/>
|
7706
|
+
<xsl:with-param name="tags" select="$tags"/>
|
7707
|
+
<xsl:with-param name="num" select="$num + 1"/>
|
7708
|
+
</xsl:call-template>
|
7709
|
+
</xsl:element>
|
7710
|
+
</xsl:otherwise>
|
7711
|
+
</xsl:choose>
|
7024
7712
|
</xsl:template><xsl:template name="max_length">
|
7025
7713
|
<xsl:param name="words"/>
|
7026
7714
|
<xsl:for-each select="$words//word">
|
@@ -7121,12 +7809,19 @@
|
|
7121
7809
|
</xsl:otherwise>
|
7122
7810
|
</xsl:choose>
|
7123
7811
|
</xsl:template><xsl:template name="getSimpleTable">
|
7812
|
+
<xsl:param name="id"/>
|
7813
|
+
|
7124
7814
|
<xsl:variable name="simple-table">
|
7125
7815
|
|
7816
|
+
<!-- Step 0. replace <br/> to <p>...</p> -->
|
7817
|
+
<xsl:variable name="table_without_br">
|
7818
|
+
<xsl:apply-templates mode="table-without-br"/>
|
7819
|
+
</xsl:variable>
|
7820
|
+
|
7126
7821
|
<!-- Step 1. colspan processing -->
|
7127
7822
|
<xsl:variable name="simple-table-colspan">
|
7128
7823
|
<tbody>
|
7129
|
-
<xsl:apply-templates mode="simple-table-colspan"/>
|
7824
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
|
7130
7825
|
</tbody>
|
7131
7826
|
</xsl:variable>
|
7132
7827
|
|
@@ -7135,10 +7830,67 @@
|
|
7135
7830
|
<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
|
7136
7831
|
</xsl:variable>
|
7137
7832
|
|
7138
|
-
|
7139
|
-
|
7833
|
+
<!-- Step 3: add id to each cell -->
|
7834
|
+
<!-- add <word>...</word> for each word, image, math -->
|
7835
|
+
<xsl:variable name="simple-table-id">
|
7836
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
|
7837
|
+
<xsl:with-param name="id" select="$id"/>
|
7838
|
+
</xsl:apply-templates>
|
7839
|
+
</xsl:variable>
|
7840
|
+
|
7841
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
7842
|
+
|
7140
7843
|
</xsl:variable>
|
7141
7844
|
<xsl:copy-of select="$simple-table"/>
|
7845
|
+
</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
|
7846
|
+
<xsl:copy>
|
7847
|
+
<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
|
7848
|
+
</xsl:copy>
|
7849
|
+
</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">
|
7850
|
+
<xsl:copy>
|
7851
|
+
<xsl:copy-of select="@*"/>
|
7852
|
+
<p>
|
7853
|
+
<xsl:copy-of select="node()"/>
|
7854
|
+
</p>
|
7855
|
+
</xsl:copy>
|
7856
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
|
7857
|
+
<xsl:copy>
|
7858
|
+
<xsl:copy-of select="@*"/>
|
7859
|
+
<xsl:for-each select="*[local-name()='br']">
|
7860
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
7861
|
+
<p>
|
7862
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
7863
|
+
<xsl:copy-of select="."/>
|
7864
|
+
</xsl:for-each>
|
7865
|
+
</p>
|
7866
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
7867
|
+
<p>
|
7868
|
+
<xsl:for-each select="following-sibling::node()">
|
7869
|
+
<xsl:copy-of select="."/>
|
7870
|
+
</xsl:for-each>
|
7871
|
+
</p>
|
7872
|
+
</xsl:if>
|
7873
|
+
</xsl:for-each>
|
7874
|
+
</xsl:copy>
|
7875
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
|
7876
|
+
<xsl:for-each select="*[local-name()='br']">
|
7877
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
7878
|
+
<p>
|
7879
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
7880
|
+
<xsl:copy-of select="."/>
|
7881
|
+
</xsl:for-each>
|
7882
|
+
</p>
|
7883
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
7884
|
+
<p>
|
7885
|
+
<xsl:for-each select="following-sibling::node()">
|
7886
|
+
<xsl:copy-of select="."/>
|
7887
|
+
</xsl:for-each>
|
7888
|
+
</p>
|
7889
|
+
</xsl:if>
|
7890
|
+
</xsl:for-each>
|
7891
|
+
</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
7892
|
+
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
7893
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
7142
7894
|
</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
|
7143
7895
|
<xsl:apply-templates mode="simple-table-colspan"/>
|
7144
7896
|
</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">
|
@@ -7228,6 +7980,126 @@
|
|
7228
7980
|
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
7229
7981
|
<xsl:with-param name="previousRow" select="$newRow"/>
|
7230
7982
|
</xsl:apply-templates>
|
7983
|
+
</xsl:template><xsl:template match="/" mode="simple-table-id">
|
7984
|
+
<xsl:param name="id"/>
|
7985
|
+
<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
|
7986
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
7987
|
+
<xsl:with-param name="id" select="$id_prefixed"/>
|
7988
|
+
</xsl:apply-templates>
|
7989
|
+
</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
|
7990
|
+
<xsl:param name="id"/>
|
7991
|
+
<xsl:copy>
|
7992
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
7993
|
+
<xsl:with-param name="id" select="$id"/>
|
7994
|
+
</xsl:apply-templates>
|
7995
|
+
</xsl:copy>
|
7996
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
|
7997
|
+
<xsl:param name="id"/>
|
7998
|
+
<xsl:copy>
|
7999
|
+
<xsl:copy-of select="@*"/>
|
8000
|
+
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
|
8001
|
+
<xsl:apply-templates select="node()" mode="simple-table-id">
|
8002
|
+
<xsl:with-param name="id" select="$id"/>
|
8003
|
+
</xsl:apply-templates>
|
8004
|
+
</xsl:copy>
|
8005
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
|
8006
|
+
<xsl:param name="id"/>
|
8007
|
+
<xsl:copy>
|
8008
|
+
<xsl:copy-of select="@*"/>
|
8009
|
+
<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
|
8010
|
+
<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
|
8011
|
+
<xsl:attribute name="id">
|
8012
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
|
8013
|
+
</xsl:attribute>
|
8014
|
+
|
8015
|
+
<xsl:for-each select="*[local-name() = 'p']">
|
8016
|
+
<xsl:copy>
|
8017
|
+
<xsl:copy-of select="@*"/>
|
8018
|
+
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
8019
|
+
<xsl:attribute name="id">
|
8020
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
|
8021
|
+
</xsl:attribute>
|
8022
|
+
|
8023
|
+
<xsl:copy-of select="node()"/>
|
8024
|
+
</xsl:copy>
|
8025
|
+
</xsl:for-each>
|
8026
|
+
|
8027
|
+
|
8028
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
|
8029
|
+
|
8030
|
+
<xsl:variable name="td_text">
|
8031
|
+
<xsl:apply-templates select="." mode="td_text_with_formatting"/>
|
8032
|
+
</xsl:variable>
|
8033
|
+
|
8034
|
+
<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
|
8035
|
+
|
8036
|
+
<xsl:variable name="words">
|
8037
|
+
<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
|
8038
|
+
<word>
|
8039
|
+
<xsl:copy-of select="."/>
|
8040
|
+
</word>
|
8041
|
+
</xsl:for-each>
|
8042
|
+
|
8043
|
+
<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
|
8044
|
+
<xsl:copy-of select="."/>
|
8045
|
+
</xsl:for-each>
|
8046
|
+
|
8047
|
+
</xsl:variable>
|
8048
|
+
|
8049
|
+
<xsl:for-each select="xalan:nodeset($words)/word">
|
8050
|
+
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
8051
|
+
<xsl:copy>
|
8052
|
+
<xsl:attribute name="id">
|
8053
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
|
8054
|
+
</xsl:attribute>
|
8055
|
+
<xsl:copy-of select="node()"/>
|
8056
|
+
</xsl:copy>
|
8057
|
+
</xsl:for-each>
|
8058
|
+
</xsl:if>
|
8059
|
+
</xsl:copy>
|
8060
|
+
|
8061
|
+
</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
|
8062
|
+
<xsl:copy>
|
8063
|
+
<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
|
8064
|
+
</xsl:copy>
|
8065
|
+
</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">
|
8066
|
+
<xsl:variable name="formatting_tags">
|
8067
|
+
<xsl:call-template name="getFormattingTags"/>
|
8068
|
+
</xsl:variable>
|
8069
|
+
<word>
|
8070
|
+
<xsl:call-template name="enclose_text_in_tags">
|
8071
|
+
<xsl:with-param name="text" select="normalize-space(.)"/>
|
8072
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
8073
|
+
</xsl:call-template>
|
8074
|
+
</word>
|
8075
|
+
</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
8076
|
+
|
8077
|
+
<xsl:variable name="td_text" select="."/>
|
8078
|
+
|
8079
|
+
<xsl:variable name="string_with_added_zerospaces">
|
8080
|
+
<xsl:call-template name="add-zero-spaces-java">
|
8081
|
+
<xsl:with-param name="text" select="$td_text"/>
|
8082
|
+
</xsl:call-template>
|
8083
|
+
</xsl:variable>
|
8084
|
+
|
8085
|
+
<xsl:variable name="formatting_tags">
|
8086
|
+
<xsl:call-template name="getFormattingTags"/>
|
8087
|
+
</xsl:variable>
|
8088
|
+
|
8089
|
+
<!-- <word>text</word> -->
|
8090
|
+
<xsl:call-template name="tokenize_with_tags">
|
8091
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
8092
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
8093
|
+
</xsl:call-template>
|
8094
|
+
</xsl:template><xsl:template name="getFormattingTags">
|
8095
|
+
<tags>
|
8096
|
+
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
8097
|
+
<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
|
8098
|
+
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
8099
|
+
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
8100
|
+
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
8101
|
+
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
8102
|
+
</tags>
|
7231
8103
|
</xsl:template><xsl:template name="getLang">
|
7232
8104
|
<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
|
7233
8105
|
<xsl:variable name="language">
|
@@ -7282,81 +8154,125 @@
|
|
7282
8154
|
<xsl:variable name="isDeleted" select="@deleted"/>
|
7283
8155
|
|
7284
8156
|
<fo:inline xsl:use-attribute-sets="mathml-style">
|
8157
|
+
|
7285
8158
|
|
7286
8159
|
<xsl:if test="ancestor::*[local-name()='table']">
|
7287
8160
|
<xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
|
7288
8161
|
</xsl:if>
|
7289
8162
|
|
7290
8163
|
|
8164
|
+
|
8165
|
+
|
7291
8166
|
<xsl:call-template name="setTrackChangesStyles">
|
7292
8167
|
<xsl:with-param name="isAdded" select="$isAdded"/>
|
7293
8168
|
<xsl:with-param name="isDeleted" select="$isDeleted"/>
|
7294
|
-
</xsl:call-template>
|
7295
|
-
|
7296
|
-
<!-- insert helper tag -->
|
7297
|
-
<xsl:if test="$add_math_as_text = 'true'">
|
7298
|
-
<fo:inline color="white" font-size="1pt" font-style="normal" font-weight="normal"></fo:inline> <!-- zero width space -->
|
7299
|
-
</xsl:if>
|
8169
|
+
</xsl:call-template>
|
7300
8170
|
|
8171
|
+
<xsl:if test="$add_math_as_text = 'true'">
|
8172
|
+
<!-- insert helper tag -->
|
8173
|
+
<!-- set unique font-size (fiction) -->
|
8174
|
+
<xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
|
8175
|
+
<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 -->
|
8176
|
+
</xsl:if>
|
7301
8177
|
|
7302
|
-
<xsl:variable name="
|
7303
|
-
<xsl:apply-templates select="." mode="
|
8178
|
+
<xsl:variable name="mathml_content">
|
8179
|
+
<xsl:apply-templates select="." mode="mathml_actual_text"/>
|
7304
8180
|
</xsl:variable>
|
7305
|
-
<fo:instream-foreign-object fox:alt-text="Math">
|
7306
8181
|
|
7307
|
-
|
7308
|
-
<xsl:
|
7309
|
-
<xsl:attribute name="width">95%</xsl:attribute>
|
7310
|
-
<xsl:attribute name="content-height">100%</xsl:attribute>
|
7311
|
-
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
7312
|
-
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
7313
|
-
</xsl:if>
|
7314
|
-
|
7315
|
-
<xsl:if test="$add_math_as_text = 'true'">
|
7316
|
-
<!-- <xsl:variable name="comment_text" select="following-sibling::node()[1][self::comment()]"/> -->
|
7317
|
-
<xsl:variable name="comment_text" select="normalize-space(translate(.,' ',' '))"/>
|
7318
|
-
<xsl:if test="normalize-space($comment_text) != ''">
|
7319
|
-
<!-- put Mathin Alternate Text -->
|
7320
|
-
<xsl:attribute name="fox:alt-text">
|
7321
|
-
<xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
|
7322
|
-
</xsl:attribute>
|
7323
|
-
</xsl:if>
|
7324
|
-
</xsl:if>
|
7325
|
-
|
7326
|
-
|
7327
|
-
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
7328
|
-
<xsl:variable name="comment_text_">
|
8182
|
+
|
8183
|
+
<xsl:variable name="filename" select="xalan:nodeset($mathml_attachments)//attachment[. = $mathml_content]/@filename"/>
|
7329
8184
|
<xsl:choose>
|
7330
|
-
<xsl:when test="normalize-space($
|
7331
|
-
<xsl:
|
8185
|
+
<xsl:when test="$add_math_as_attachment = 'true' and normalize-space($filename) != ''">
|
8186
|
+
<xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
|
8187
|
+
<fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
|
8188
|
+
<xsl:variable name="comment_text">
|
8189
|
+
<xsl:call-template name="getMathml_comment_text"/>
|
8190
|
+
</xsl:variable>
|
8191
|
+
<xsl:if test="normalize-space($comment_text) != ''">
|
8192
|
+
<!-- put Mathin Alternate Text -->
|
8193
|
+
<xsl:attribute name="fox:alt-text">
|
8194
|
+
<xsl:value-of select="$comment_text"/>
|
8195
|
+
</xsl:attribute>
|
8196
|
+
</xsl:if>
|
8197
|
+
<xsl:call-template name="mathml_instream_object">
|
8198
|
+
<xsl:with-param name="comment_text" select="$comment_text"/>
|
8199
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
8200
|
+
</xsl:call-template>
|
8201
|
+
</fo:basic-link>
|
7332
8202
|
</xsl:when>
|
7333
8203
|
<xsl:otherwise>
|
7334
|
-
<xsl:
|
8204
|
+
<xsl:call-template name="mathml_instream_object">
|
8205
|
+
<xsl:with-param name="mathml_content" select="$mathml_content"/>
|
8206
|
+
</xsl:call-template>
|
7335
8207
|
</xsl:otherwise>
|
7336
8208
|
</xsl:choose>
|
7337
|
-
|
7338
|
-
<xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
8209
|
+
<!-- end BSI -->
|
7339
8210
|
|
7340
|
-
|
7341
|
-
|
7342
|
-
|
7343
|
-
|
7344
|
-
|
8211
|
+
|
8212
|
+
</fo:inline>
|
8213
|
+
</xsl:template><xsl:template name="getMathml_comment_text">
|
8214
|
+
<xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
|
8215
|
+
<xsl:variable name="comment_text_">
|
8216
|
+
<xsl:choose>
|
8217
|
+
<xsl:when test="normalize-space($comment_text_following) != ''">
|
8218
|
+
<xsl:value-of select="$comment_text_following"/>
|
8219
|
+
</xsl:when>
|
8220
|
+
<xsl:otherwise>
|
8221
|
+
<xsl:value-of select="normalize-space(translate(.,' ',' '))"/>
|
8222
|
+
</xsl:otherwise>
|
8223
|
+
</xsl:choose>
|
8224
|
+
</xsl:variable>
|
8225
|
+
<xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
|
8226
|
+
<xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
|
8227
|
+
<xsl:value-of select="$comment_text"/>
|
8228
|
+
</xsl:template><xsl:template name="mathml_instream_object">
|
8229
|
+
<xsl:param name="comment_text"/>
|
8230
|
+
<xsl:param name="mathml_content"/>
|
8231
|
+
|
8232
|
+
<xsl:variable name="comment_text_">
|
8233
|
+
<xsl:choose>
|
8234
|
+
<xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
|
8235
|
+
<xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
|
8236
|
+
</xsl:choose>
|
8237
|
+
</xsl:variable>
|
8238
|
+
|
8239
|
+
<xsl:variable name="mathml">
|
8240
|
+
<xsl:apply-templates select="." mode="mathml"/>
|
8241
|
+
</xsl:variable>
|
8242
|
+
|
8243
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
8244
|
+
|
8245
|
+
|
8246
|
+
<xsl:if test="local-name(../..) = 'formula'">
|
8247
|
+
<xsl:attribute name="width">95%</xsl:attribute>
|
8248
|
+
<xsl:attribute name="content-height">100%</xsl:attribute>
|
8249
|
+
<xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
|
8250
|
+
<xsl:attribute name="scaling">uniform</xsl:attribute>
|
7345
8251
|
</xsl:if>
|
7346
|
-
|
7347
|
-
|
7348
|
-
|
7349
|
-
|
7350
|
-
|
7351
|
-
|
7352
|
-
|
8252
|
+
|
8253
|
+
|
8254
|
+
|
8255
|
+
|
8256
|
+
|
8257
|
+
|
8258
|
+
<!-- put MathML in Actual Text -->
|
8259
|
+
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
|
8260
|
+
<xsl:attribute name="fox:actual-text">
|
8261
|
+
<xsl:value-of select="$mathml_content"/>
|
8262
|
+
</xsl:attribute>
|
8263
|
+
|
8264
|
+
<!-- <xsl:if test="$add_math_as_text = 'true'"> -->
|
8265
|
+
<xsl:if test="normalize-space($comment_text_) != ''">
|
8266
|
+
<!-- put Mathin Alternate Text -->
|
8267
|
+
<xsl:attribute name="fox:alt-text">
|
8268
|
+
<xsl:value-of select="$comment_text_"/>
|
7353
8269
|
</xsl:attribute>
|
7354
|
-
|
7355
|
-
|
7356
|
-
|
7357
|
-
|
7358
|
-
|
7359
|
-
</fo:
|
8270
|
+
</xsl:if>
|
8271
|
+
<!-- </xsl:if> -->
|
8272
|
+
|
8273
|
+
<xsl:copy-of select="xalan:nodeset($mathml)"/>
|
8274
|
+
|
8275
|
+
</fo:instream-foreign-object>
|
7360
8276
|
</xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
|
7361
8277
|
<!-- <xsl:text>a+b</xsl:text> -->
|
7362
8278
|
<xsl:text><</xsl:text>
|
@@ -7387,7 +8303,9 @@
|
|
7387
8303
|
<!-- replace start and end spaces to non-break space -->
|
7388
8304
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
|
7389
8305
|
</xsl:copy>
|
7390
|
-
</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="
|
8306
|
+
</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">
|
8307
|
+
<xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
|
8308
|
+
</xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
|
7391
8309
|
<xsl:variable name="target">
|
7392
8310
|
<xsl:choose>
|
7393
8311
|
<xsl:when test="@updatetype = 'true'">
|
@@ -7998,18 +8916,33 @@
|
|
7998
8916
|
</xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
|
7999
8917
|
<xsl:copy>
|
8000
8918
|
<xsl:apply-templates select="@*" mode="svg_update"/>
|
8001
|
-
<xsl:variable name="
|
8919
|
+
<xsl:variable name="viewbox_">
|
8002
8920
|
<xsl:call-template name="split">
|
8003
8921
|
<xsl:with-param name="pText" select="@viewBox"/>
|
8004
8922
|
<xsl:with-param name="sep" select="' '"/>
|
8005
8923
|
</xsl:call-template>
|
8006
8924
|
</xsl:variable>
|
8925
|
+
<xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
|
8926
|
+
<xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
|
8927
|
+
<xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
|
8928
|
+
|
8007
8929
|
<xsl:attribute name="width">
|
8008
|
-
<xsl:
|
8930
|
+
<xsl:choose>
|
8931
|
+
<xsl:when test="$width != ''">
|
8932
|
+
<xsl:value-of select="round($width)"/>
|
8933
|
+
</xsl:when>
|
8934
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default width -->
|
8935
|
+
</xsl:choose>
|
8009
8936
|
</xsl:attribute>
|
8010
8937
|
<xsl:attribute name="height">
|
8011
|
-
<xsl:
|
8938
|
+
<xsl:choose>
|
8939
|
+
<xsl:when test="$height != ''">
|
8940
|
+
<xsl:value-of select="round($height)"/>
|
8941
|
+
</xsl:when>
|
8942
|
+
<xsl:otherwise>400</xsl:otherwise> <!-- default height -->
|
8943
|
+
</xsl:choose>
|
8012
8944
|
</xsl:attribute>
|
8945
|
+
|
8013
8946
|
<xsl:apply-templates mode="svg_update"/>
|
8014
8947
|
</xsl:copy>
|
8015
8948
|
</xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
|
@@ -8204,7 +9137,11 @@
|
|
8204
9137
|
<xsl:apply-templates mode="bookmarks"/>
|
8205
9138
|
</xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
|
8206
9139
|
<xsl:apply-templates select="."/>
|
8207
|
-
</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() = '
|
9140
|
+
</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">
|
9141
|
+
<xsl:apply-templates mode="contents"/>
|
9142
|
+
</xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
|
9143
|
+
<xsl:apply-templates mode="bookmarks"/>
|
9144
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="bookmarks">
|
8208
9145
|
<xsl:apply-templates mode="bookmarks"/>
|
8209
9146
|
</xsl:template><xsl:template name="addBookmarks">
|
8210
9147
|
<xsl:param name="contents"/>
|
@@ -8500,7 +9437,9 @@
|
|
8500
9437
|
<xsl:apply-templates/>
|
8501
9438
|
</xsl:otherwise>
|
8502
9439
|
</xsl:choose>
|
8503
|
-
</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() = '
|
9440
|
+
</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">
|
9441
|
+
<xsl:value-of select="."/>
|
9442
|
+
</xsl:template><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
|
8504
9443
|
<xsl:text> </xsl:text>
|
8505
9444
|
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
|
8506
9445
|
<xsl:copy>
|
@@ -8531,9 +9470,22 @@
|
|
8531
9470
|
</xsl:when>
|
8532
9471
|
<xsl:otherwise><xsl:apply-templates mode="contents_item"/></xsl:otherwise>
|
8533
9472
|
</xsl:choose>
|
9473
|
+
</xsl:template><xsl:template match="text()" mode="contents_item">
|
9474
|
+
<xsl:call-template name="keep_together_standard_number"/>
|
9475
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="contents_item">
|
9476
|
+
<xsl:apply-templates mode="contents_item"/>
|
8534
9477
|
</xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
8535
9478
|
|
8536
9479
|
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
9480
|
+
|
9481
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
9482
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
9483
|
+
</xsl:if>
|
9484
|
+
|
9485
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
9486
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
9487
|
+
</xsl:if>
|
9488
|
+
|
8537
9489
|
<xsl:copy-of select="@id"/>
|
8538
9490
|
|
8539
9491
|
<xsl:if test="parent::*[local-name() = 'note']">
|
@@ -8558,7 +9510,7 @@
|
|
8558
9510
|
|
8559
9511
|
|
8560
9512
|
|
8561
|
-
|
9513
|
+
<!-- 9 -->
|
8562
9514
|
|
8563
9515
|
|
8564
9516
|
|
@@ -8642,7 +9594,7 @@
|
|
8642
9594
|
<xsl:for-each select="xalan:nodeset($text_step4)/node()">
|
8643
9595
|
<xsl:choose>
|
8644
9596
|
<xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
|
8645
|
-
<xsl:call-template name="interspers">
|
9597
|
+
<xsl:call-template name="interspers-java">
|
8646
9598
|
<xsl:with-param name="str" select="."/>
|
8647
9599
|
</xsl:call-template>
|
8648
9600
|
</xsl:when>
|
@@ -8692,6 +9644,10 @@
|
|
8692
9644
|
<xsl:with-param name="char" select="$char"/>
|
8693
9645
|
</xsl:call-template>
|
8694
9646
|
</xsl:if>
|
9647
|
+
</xsl:template><xsl:template name="interspers-java">
|
9648
|
+
<xsl:param name="str"/>
|
9649
|
+
<xsl:param name="char" select="$zero_width_space"/>
|
9650
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($str),'([^ -.:=_—])',concat('$1', $char))"/> <!-- insert $char after each char excep space, - . : = _ etc. -->
|
8695
9651
|
</xsl:template><xsl:template match="*" mode="syntax_highlight">
|
8696
9652
|
<xsl:apply-templates mode="syntax_highlight"/>
|
8697
9653
|
</xsl:template><xsl:variable name="syntax_highlight_styles_">
|
@@ -8904,7 +9860,9 @@
|
|
8904
9860
|
<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
|
8905
9861
|
</xsl:if>
|
8906
9862
|
<xsl:variable name="simple-table">
|
8907
|
-
<xsl:call-template name="getSimpleTable"
|
9863
|
+
<xsl:call-template name="getSimpleTable">
|
9864
|
+
<xsl:with-param name="id" select="@id"/>
|
9865
|
+
</xsl:call-template>
|
8908
9866
|
</xsl:variable>
|
8909
9867
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
|
8910
9868
|
<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
|
@@ -9011,39 +9969,67 @@
|
|
9011
9969
|
</xsl:otherwise>
|
9012
9970
|
</xsl:choose>
|
9013
9971
|
</xsl:template><xsl:template match="*[local-name() = 'example']">
|
9014
|
-
|
9015
|
-
|
9972
|
+
|
9973
|
+
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
|
9974
|
+
|
9016
9975
|
|
9976
|
+
|
9017
9977
|
<xsl:variable name="fo_element">
|
9018
|
-
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl']">block</xsl:if>
|
9978
|
+
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
|
9019
9979
|
block
|
9020
9980
|
</xsl:variable>
|
9021
9981
|
|
9022
|
-
|
9023
|
-
<xsl:apply-templates select="*[local-name()='name']">
|
9024
|
-
<xsl:with-param name="fo_element" select="$fo_element"/>
|
9025
|
-
</xsl:apply-templates>
|
9982
|
+
<fo:block-container margin-left="0mm">
|
9026
9983
|
|
9027
|
-
|
9028
|
-
|
9029
|
-
<
|
9030
|
-
|
9031
|
-
|
9984
|
+
<xsl:choose>
|
9985
|
+
|
9986
|
+
<xsl:when test="contains(normalize-space($fo_element), 'block')">
|
9987
|
+
|
9988
|
+
<!-- display name 'EXAMPLE' in a separate block -->
|
9989
|
+
<fo:block>
|
9990
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
9032
9991
|
<xsl:with-param name="fo_element" select="$fo_element"/>
|
9033
9992
|
</xsl:apply-templates>
|
9993
|
+
</fo:block>
|
9994
|
+
|
9995
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
9996
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
9997
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]">
|
9998
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
9999
|
+
</xsl:apply-templates>
|
10000
|
+
</fo:block-container>
|
9034
10001
|
</fo:block-container>
|
9035
|
-
</
|
9036
|
-
|
9037
|
-
|
9038
|
-
|
9039
|
-
|
9040
|
-
|
9041
|
-
|
9042
|
-
|
9043
|
-
|
9044
|
-
|
9045
|
-
|
9046
|
-
|
10002
|
+
</xsl:when> <!-- end block -->
|
10003
|
+
|
10004
|
+
<xsl:otherwise> <!-- inline -->
|
10005
|
+
|
10006
|
+
<!-- display 'EXAMPLE' and first element in the same line -->
|
10007
|
+
<fo:block>
|
10008
|
+
<xsl:apply-templates select="*[local-name()='name']">
|
10009
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
10010
|
+
</xsl:apply-templates>
|
10011
|
+
<fo:inline>
|
10012
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][1]">
|
10013
|
+
<xsl:with-param name="fo_element" select="$fo_element"/>
|
10014
|
+
</xsl:apply-templates>
|
10015
|
+
</fo:inline>
|
10016
|
+
</fo:block>
|
10017
|
+
|
10018
|
+
<xsl:if test="*[not(local-name() = 'name')][position() > 1]">
|
10019
|
+
<!-- display further elements in blocks -->
|
10020
|
+
<fo:block-container xsl:use-attribute-sets="example-body-style">
|
10021
|
+
<fo:block-container margin-left="0mm" margin-right="0mm">
|
10022
|
+
<xsl:apply-templates select="*[not(local-name() = 'name')][position() > 1]">
|
10023
|
+
<xsl:with-param name="fo_element" select="'block'"/>
|
10024
|
+
</xsl:apply-templates>
|
10025
|
+
</fo:block-container>
|
10026
|
+
</fo:block-container>
|
10027
|
+
</xsl:if>
|
10028
|
+
</xsl:otherwise> <!-- end inline -->
|
10029
|
+
|
10030
|
+
</xsl:choose>
|
10031
|
+
</fo:block-container>
|
10032
|
+
</fo:block-container>
|
9047
10033
|
</xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
|
9048
10034
|
<xsl:param name="fo_element">block</xsl:param>
|
9049
10035
|
|
@@ -9075,10 +10061,16 @@
|
|
9075
10061
|
</xsl:variable>
|
9076
10062
|
<xsl:choose>
|
9077
10063
|
<xsl:when test="starts-with(normalize-space($element), 'block')">
|
9078
|
-
<fo:block
|
9079
|
-
|
9080
|
-
|
9081
|
-
|
10064
|
+
<fo:block-container>
|
10065
|
+
<xsl:if test="ancestor::*[local-name() = 'li'] and contains(normalize-space($fo_element), 'block')">
|
10066
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
10067
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
10068
|
+
</xsl:if>
|
10069
|
+
<fo:block xsl:use-attribute-sets="example-p-style">
|
10070
|
+
|
10071
|
+
<xsl:apply-templates/>
|
10072
|
+
</fo:block>
|
10073
|
+
</fo:block-container>
|
9082
10074
|
</xsl:when>
|
9083
10075
|
<xsl:otherwise>
|
9084
10076
|
<fo:inline xsl:use-attribute-sets="example-p-style">
|
@@ -9266,7 +10258,16 @@
|
|
9266
10258
|
</fo:inline>
|
9267
10259
|
</xsl:when>
|
9268
10260
|
<xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
|
9269
|
-
|
10261
|
+
|
10262
|
+
<!-- if in bibitem[@hidden='true'] there is url[@type='src'], then create hyperlink -->
|
10263
|
+
<xsl:variable name="uri_src" select="normalize-space($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'src'])"/>
|
10264
|
+
<xsl:choose>
|
10265
|
+
<xsl:when test="$uri_src != ''">
|
10266
|
+
<fo:basic-link external-destination="{$uri_src}" fox:alt-text="{$uri_src}"><xsl:apply-templates/></fo:basic-link>
|
10267
|
+
</xsl:when>
|
10268
|
+
<xsl:otherwise><fo:inline><xsl:apply-templates/></fo:inline></xsl:otherwise>
|
10269
|
+
</xsl:choose>
|
10270
|
+
|
9270
10271
|
</xsl:otherwise>
|
9271
10272
|
</xsl:choose>
|
9272
10273
|
</xsl:template><xsl:template match="*[local-name() = 'tab']">
|
@@ -9439,10 +10440,24 @@
|
|
9439
10440
|
|
9440
10441
|
</fo:block>
|
9441
10442
|
<xsl:apply-templates/>
|
9442
|
-
</xsl:template><xsl:template match="*[local-name() = 'review']">
|
10443
|
+
</xsl:template><xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
|
9443
10444
|
<!-- comment 2019-11-29 -->
|
9444
10445
|
<!-- <fo:block font-weight="bold">Review:</fo:block>
|
9445
10446
|
<xsl:apply-templates /> -->
|
10447
|
+
|
10448
|
+
<xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
|
10449
|
+
|
10450
|
+
<xsl:choose>
|
10451
|
+
<!-- if there isn't the attribute '@from', then -->
|
10452
|
+
<xsl:when test="$id_from = ''">
|
10453
|
+
<fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
10454
|
+
</xsl:when>
|
10455
|
+
<!-- if there isn't element with id 'from', then create 'bookmark' here -->
|
10456
|
+
<xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
|
10457
|
+
<fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
|
10458
|
+
</xsl:when>
|
10459
|
+
</xsl:choose>
|
10460
|
+
|
9446
10461
|
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
|
9447
10462
|
<!-- 0xA0 to space replacement -->
|
9448
10463
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
|
@@ -9591,6 +10606,11 @@
|
|
9591
10606
|
</xsl:otherwise>
|
9592
10607
|
</xsl:choose>
|
9593
10608
|
</xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
|
10609
|
+
|
10610
|
+
<xsl:apply-templates select="*[local-name() = 'name']">
|
10611
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
10612
|
+
</xsl:apply-templates>
|
10613
|
+
|
9594
10614
|
<fo:list-block xsl:use-attribute-sets="list-style">
|
9595
10615
|
|
9596
10616
|
|
@@ -9601,12 +10621,23 @@
|
|
9601
10621
|
|
9602
10622
|
|
9603
10623
|
|
10624
|
+
<xsl:if test="*[local-name() = 'name']">
|
10625
|
+
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
10626
|
+
</xsl:if>
|
10627
|
+
|
9604
10628
|
<xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
|
9605
10629
|
</fo:list-block>
|
9606
10630
|
<!-- <xsl:for-each select="./iho:note">
|
9607
10631
|
<xsl:call-template name="note"/>
|
9608
10632
|
</xsl:for-each> -->
|
9609
10633
|
<xsl:apply-templates select="./*[local-name() = 'note']"/>
|
10634
|
+
</xsl:template><xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
|
10635
|
+
<xsl:param name="process">false</xsl:param>
|
10636
|
+
<xsl:if test="$process = 'true'">
|
10637
|
+
<fo:block xsl:use-attribute-sets="list-name-style">
|
10638
|
+
<xsl:apply-templates/>
|
10639
|
+
</fo:block>
|
10640
|
+
</xsl:if>
|
9610
10641
|
</xsl:template><xsl:template match="*[local-name()='li']">
|
9611
10642
|
<fo:list-item xsl:use-attribute-sets="list-item-style">
|
9612
10643
|
<xsl:copy-of select="@id"/>
|
@@ -9803,7 +10834,10 @@
|
|
9803
10834
|
<!-- to split by '_' and other chars -->
|
9804
10835
|
<xsl:call-template name="add-zero-spaces-java"/>
|
9805
10836
|
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
9806
|
-
<fo:inline id="{@id}" font-size="1pt"/>
|
10837
|
+
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
10838
|
+
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
10839
|
+
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
10840
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
|
9807
10841
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
9808
10842
|
<!-- <row>
|
9809
10843
|
<date>05-07-2013</date>
|
@@ -9875,6 +10909,7 @@
|
|
9875
10909
|
</xsl:template><xsl:template match="*[local-name() = 'references'][not(@normative='true')]/*[local-name() = 'bibitem']" priority="2">
|
9876
10910
|
|
9877
10911
|
|
10912
|
+
<!-- start BIPM bibitem processing -->
|
9878
10913
|
<fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
|
9879
10914
|
<fo:list-item>
|
9880
10915
|
<fo:list-item-label end-indent="label-end()">
|
@@ -9901,6 +10936,7 @@
|
|
9901
10936
|
</fo:list-item-body>
|
9902
10937
|
</fo:list-item>
|
9903
10938
|
</fo:list-block>
|
10939
|
+
<!-- END BIPM bibitem processing -->
|
9904
10940
|
|
9905
10941
|
|
9906
10942
|
</xsl:template><xsl:template name="processBibitem">
|
@@ -9910,32 +10946,12 @@
|
|
9910
10946
|
<xsl:if test=".//bipm:fn">
|
9911
10947
|
<xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
|
9912
10948
|
</xsl:if>
|
9913
|
-
|
9914
|
-
|
9915
|
-
|
9916
|
-
|
9917
|
-
|
9918
|
-
|
9919
|
-
|
9920
|
-
<xsl:value-of select="$docidentifier"/>
|
9921
|
-
<xsl:if test="$docidentifier != '' and *[local-name() = 'title']">, </xsl:if>
|
9922
|
-
|
9923
|
-
<xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
|
9924
|
-
|
9925
|
-
<xsl:choose>
|
9926
|
-
<xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = $curr_lang]">
|
9927
|
-
<xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = $curr_lang]"/>
|
9928
|
-
</xsl:when>
|
9929
|
-
<xsl:when test="*[local-name() = 'title'][@type = 'main' and @language = 'en']">
|
9930
|
-
<xsl:apply-templates select="*[local-name() = 'title'][@type = 'main' and @language = 'en']"/>
|
9931
|
-
</xsl:when>
|
9932
|
-
<xsl:otherwise>
|
9933
|
-
<xsl:apply-templates select="*[local-name() = 'title']"/>
|
9934
|
-
</xsl:otherwise>
|
9935
|
-
</xsl:choose>
|
9936
|
-
|
9937
|
-
</xsl:otherwise>
|
9938
|
-
</xsl:choose>
|
10949
|
+
|
10950
|
+
<xsl:variable name="docidentifier" select="*[local-name() = 'docidentifier'][not(@type = 'URN' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'BIPM' or @type = 'ISBN' or @type = 'ISSN')]"/>
|
10951
|
+
<xsl:value-of select="$docidentifier"/>
|
10952
|
+
|
10953
|
+
<xsl:if test="$docidentifier != '' and *[local-name() = 'formattedref']">, </xsl:if>
|
10954
|
+
<xsl:apply-templates select="*[local-name() = 'formattedref']"/>
|
9939
10955
|
<!-- end BIPM bibitem processing-->
|
9940
10956
|
|
9941
10957
|
</xsl:template><xsl:template name="processBibitemDocId">
|
@@ -10263,25 +11279,32 @@
|
|
10263
11279
|
</fo:block-container>
|
10264
11280
|
|
10265
11281
|
</xsl:template><xsl:template name="displayAdmonitionName">
|
10266
|
-
|
11282
|
+
<xsl:param name="sep"/> <!-- Example: ' - ' -->
|
11283
|
+
<!-- <xsl:choose>
|
11284
|
+
<xsl:when test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
|
11285
|
+
<xsl:choose>
|
11286
|
+
<xsl:when test="@type='important'"><xsl:apply-templates select="@type"/></xsl:when>
|
11287
|
+
<xsl:otherwise>
|
11288
|
+
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
11289
|
+
</xsl:otherwise>
|
11290
|
+
</xsl:choose>
|
11291
|
+
</xsl:when>
|
11292
|
+
<xsl:otherwise>
|
10267
11293
|
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
10268
11294
|
<xsl:if test="not(*[local-name() = 'name'])">
|
10269
11295
|
<xsl:apply-templates select="@type"/>
|
10270
11296
|
</xsl:if>
|
10271
|
-
|
10272
|
-
|
10273
|
-
<xsl:
|
10274
|
-
|
10275
|
-
<xsl:variable name="admonition_type_">
|
10276
|
-
<xsl:call-template name="getLocalizedString">
|
10277
|
-
<xsl:with-param name="key">admonition.<xsl:value-of select="."/></xsl:with-param>
|
10278
|
-
</xsl:call-template>
|
11297
|
+
</xsl:otherwise>
|
11298
|
+
</xsl:choose> -->
|
11299
|
+
<xsl:variable name="name">
|
11300
|
+
<xsl:apply-templates select="*[local-name() = 'name']"/>
|
10279
11301
|
</xsl:variable>
|
10280
|
-
<xsl:
|
10281
|
-
<xsl:
|
10282
|
-
|
10283
|
-
<xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
|
11302
|
+
<xsl:copy-of select="$name"/>
|
11303
|
+
<xsl:if test="normalize-space($name) != ''">
|
11304
|
+
<xsl:value-of select="$sep"/>
|
10284
11305
|
</xsl:if>
|
11306
|
+
</xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'name']">
|
11307
|
+
<xsl:apply-templates/>
|
10285
11308
|
</xsl:template><xsl:template match="*[local-name() = 'admonition']/*[local-name() = 'p']">
|
10286
11309
|
|
10287
11310
|
<fo:block xsl:use-attribute-sets="admonition-p-style">
|
@@ -10363,6 +11386,120 @@
|
|
10363
11386
|
<xsl:apply-templates select="." mode="update_xml_step1"/>
|
10364
11387
|
</xsl:for-each>
|
10365
11388
|
</xsl:copy>
|
11389
|
+
</xsl:template><xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
11390
|
+
<xsl:apply-templates mode="update_xml_step1"/>
|
11391
|
+
</xsl:template><xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
11392
|
+
<xsl:copy>
|
11393
|
+
<xsl:apply-templates select="@*|node()" mode="update_xml_enclose_keep-together_within-line"/>
|
11394
|
+
</xsl:copy>
|
11395
|
+
</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">
|
11396
|
+
|
11397
|
+
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
11398
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
11399
|
+
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
11400
|
+
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
11401
|
+
<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))"/>
|
11402
|
+
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
11403
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
11404
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
11405
|
+
<xsl:with-param name="text" select="$text_"/>
|
11406
|
+
</xsl:call-template></text></xsl:variable>
|
11407
|
+
|
11408
|
+
<xsl:variable name="parent" select="local-name(..)"/>
|
11409
|
+
|
11410
|
+
<xsl:variable name="text2">
|
11411
|
+
<text><xsl:for-each select="xalan:nodeset($text)/text/node()">
|
11412
|
+
<xsl:copy-of select="."/>
|
11413
|
+
</xsl:for-each></text>
|
11414
|
+
</xsl:variable>
|
11415
|
+
|
11416
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
11417
|
+
<xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
|
11418
|
+
<xsl:variable name="text3">
|
11419
|
+
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
11420
|
+
<xsl:choose>
|
11421
|
+
<xsl:when test="self::text()">
|
11422
|
+
<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))"/>
|
11423
|
+
<xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
|
11424
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
11425
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
11426
|
+
<xsl:with-param name="text" select="$text_units_"/>
|
11427
|
+
</xsl:call-template></text></xsl:variable>
|
11428
|
+
<xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
|
11429
|
+
</xsl:when>
|
11430
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
11431
|
+
</xsl:choose>
|
11432
|
+
</xsl:for-each></text>
|
11433
|
+
</xsl:variable>
|
11434
|
+
|
11435
|
+
<xsl:choose>
|
11436
|
+
<xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
|
11437
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
11438
|
+
<xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
|
11439
|
+
<xsl:for-each select="xalan:nodeset($text3)/text/node()">
|
11440
|
+
<xsl:choose>
|
11441
|
+
<xsl:when test="self::text()">
|
11442
|
+
<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))"/>
|
11443
|
+
<xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
|
11444
|
+
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
11445
|
+
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
11446
|
+
<xsl:with-param name="text" select="$text_dots_"/>
|
11447
|
+
</xsl:call-template></text></xsl:variable>
|
11448
|
+
<xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
|
11449
|
+
</xsl:when>
|
11450
|
+
<xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
|
11451
|
+
</xsl:choose>
|
11452
|
+
</xsl:for-each>
|
11453
|
+
</xsl:when>
|
11454
|
+
<xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
|
11455
|
+
</xsl:choose>
|
11456
|
+
|
11457
|
+
</xsl:template><xsl:template name="replace_text_tags">
|
11458
|
+
<xsl:param name="tag_open"/>
|
11459
|
+
<xsl:param name="tag_close"/>
|
11460
|
+
<xsl:param name="text"/>
|
11461
|
+
<xsl:choose>
|
11462
|
+
<xsl:when test="contains($text, $tag_open)">
|
11463
|
+
<xsl:value-of select="substring-before($text, $tag_open)"/>
|
11464
|
+
<xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
|
11465
|
+
|
11466
|
+
<xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
|
11467
|
+
<xsl:value-of select="substring-before($text_after, $tag_close)"/>
|
11468
|
+
</xsl:element>
|
11469
|
+
|
11470
|
+
<xsl:call-template name="replace_text_tags">
|
11471
|
+
<xsl:with-param name="tag_open" select="$tag_open"/>
|
11472
|
+
<xsl:with-param name="tag_close" select="$tag_close"/>
|
11473
|
+
<xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
|
11474
|
+
</xsl:call-template>
|
11475
|
+
</xsl:when>
|
11476
|
+
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
11477
|
+
</xsl:choose>
|
11478
|
+
</xsl:template><xsl:template name="printEdition">
|
11479
|
+
<xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
|
11480
|
+
<xsl:text> </xsl:text>
|
11481
|
+
<xsl:choose>
|
11482
|
+
<xsl:when test="$edition_i18n != ''">
|
11483
|
+
<!-- Example: <edition language="fr">deuxième édition</edition> -->
|
11484
|
+
<xsl:call-template name="capitalize">
|
11485
|
+
<xsl:with-param name="str" select="$edition_i18n"/>
|
11486
|
+
</xsl:call-template>
|
11487
|
+
</xsl:when>
|
11488
|
+
<xsl:otherwise>
|
11489
|
+
<xsl:variable name="edition" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'])"/>
|
11490
|
+
<xsl:if test="$edition != ''"> <!-- Example: 1.3 -->
|
11491
|
+
<xsl:call-template name="capitalize">
|
11492
|
+
<xsl:with-param name="str">
|
11493
|
+
<xsl:call-template name="getLocalizedString">
|
11494
|
+
<xsl:with-param name="key">edition</xsl:with-param>
|
11495
|
+
</xsl:call-template>
|
11496
|
+
</xsl:with-param>
|
11497
|
+
</xsl:call-template>
|
11498
|
+
<xsl:text> </xsl:text>
|
11499
|
+
<xsl:value-of select="$edition"/>
|
11500
|
+
</xsl:if>
|
11501
|
+
</xsl:otherwise>
|
11502
|
+
</xsl:choose>
|
10366
11503
|
</xsl:template><xsl:template name="convertDate">
|
10367
11504
|
<xsl:param name="date"/>
|
10368
11505
|
<xsl:param name="format" select="'short'"/>
|
@@ -11050,4 +12187,40 @@
|
|
11050
12187
|
<xsl:value-of select="$value"/>
|
11051
12188
|
</xsl:otherwise>
|
11052
12189
|
</xsl:choose>
|
12190
|
+
</xsl:template><xsl:template match="*" mode="print_as_xml">
|
12191
|
+
<xsl:param name="level">0</xsl:param>
|
12192
|
+
|
12193
|
+
<fo:block margin-left="{2*$level}mm">
|
12194
|
+
<xsl:text>
|
12195
|
+
<</xsl:text>
|
12196
|
+
<xsl:value-of select="local-name()"/>
|
12197
|
+
<xsl:for-each select="@*">
|
12198
|
+
<xsl:text> </xsl:text>
|
12199
|
+
<xsl:value-of select="local-name()"/>
|
12200
|
+
<xsl:text>="</xsl:text>
|
12201
|
+
<xsl:value-of select="."/>
|
12202
|
+
<xsl:text>"</xsl:text>
|
12203
|
+
</xsl:for-each>
|
12204
|
+
<xsl:text>></xsl:text>
|
12205
|
+
|
12206
|
+
<xsl:if test="not(*)">
|
12207
|
+
<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
|
12208
|
+
<xsl:text></</xsl:text>
|
12209
|
+
<xsl:value-of select="local-name()"/>
|
12210
|
+
<xsl:text>></xsl:text>
|
12211
|
+
</xsl:if>
|
12212
|
+
</fo:block>
|
12213
|
+
|
12214
|
+
<xsl:if test="*">
|
12215
|
+
<fo:block>
|
12216
|
+
<xsl:apply-templates mode="print_as_xml">
|
12217
|
+
<xsl:with-param name="level" select="$level + 1"/>
|
12218
|
+
</xsl:apply-templates>
|
12219
|
+
</fo:block>
|
12220
|
+
<fo:block margin-left="{2*$level}mm">
|
12221
|
+
<xsl:text></</xsl:text>
|
12222
|
+
<xsl:value-of select="local-name()"/>
|
12223
|
+
<xsl:text>></xsl:text>
|
12224
|
+
</fo:block>
|
12225
|
+
</xsl:if>
|
11053
12226
|
</xsl:template></xsl:stylesheet>
|