metanorma-bipm 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/bipm/base_convert.rb +7 -0
- data/lib/isodoc/bipm/bipm.brochure.xsl +1043 -115
- data/lib/isodoc/bipm/bipm.guide.xsl +1043 -115
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +1043 -115
- data/lib/isodoc/bipm/bipm.rapport.xsl +1043 -115
- data/lib/isodoc/bipm/jcgm.standard.xsl +1042 -114
- data/lib/isodoc/bipm/presentation_xml_convert.rb +17 -0
- data/lib/metanorma/bipm/converter.rb +38 -108
- data/lib/metanorma/bipm/front.rb +113 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- metadata +3 -2
@@ -2727,6 +2727,7 @@
|
|
2727
2727
|
|
2728
2728
|
<xsl:template match="bipm:p" name="paragraph">
|
2729
2729
|
<xsl:param name="inline" select="'false'"/>
|
2730
|
+
<xsl:param name="split_keep-within-line"/>
|
2730
2731
|
|
2731
2732
|
<xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
|
2732
2733
|
<xsl:variable name="element-name">
|
@@ -2773,7 +2774,9 @@
|
|
2773
2774
|
<xsl:attribute name="role">BlockQuote</xsl:attribute>
|
2774
2775
|
</xsl:if>
|
2775
2776
|
<xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
|
2776
|
-
<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>
|
2777
2780
|
</xsl:element>
|
2778
2781
|
<xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
|
2779
2782
|
<fo:block margin-bottom="6pt">
|
@@ -3810,7 +3813,9 @@
|
|
3810
3813
|
</xsl:template>
|
3811
3814
|
|
3812
3815
|
|
3813
|
-
<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: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:param name="table_if_debug">false</xsl:param><xsl:variable name="isGenerateTableIF_">
|
3817
|
+
false
|
3818
|
+
</xsl:variable><xsl:variable name="isGenerateTableIF" select="normalize-space($isGenerateTableIF_)"/><xsl:variable name="lang">
|
3814
3819
|
<xsl:call-template name="getLang"/>
|
3815
3820
|
</xsl:variable><xsl:variable name="pageWidth_">
|
3816
3821
|
210
|
@@ -4271,6 +4276,7 @@
|
|
4271
4276
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
4272
4277
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
4273
4278
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
4279
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
4274
4280
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
4275
4281
|
|
4276
4282
|
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
@@ -4295,6 +4301,7 @@
|
|
4295
4301
|
<xsl:attribute name="display-align">center</xsl:attribute>
|
4296
4302
|
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
|
4297
4303
|
<xsl:attribute name="padding-left">1mm</xsl:attribute>
|
4304
|
+
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
4298
4305
|
|
4299
4306
|
|
4300
4307
|
<xsl:attribute name="border">solid 0pt white</xsl:attribute>
|
@@ -4392,7 +4399,8 @@
|
|
4392
4399
|
</xsl:attribute-set><xsl:attribute-set name="dt-row-style">
|
4393
4400
|
|
4394
4401
|
|
4395
|
-
</xsl:attribute-set><xsl:attribute-set name="dt-style">
|
4402
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-cell-style">
|
4403
|
+
</xsl:attribute-set><xsl:attribute-set name="dt-block-style">
|
4396
4404
|
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
4397
4405
|
|
4398
4406
|
|
@@ -4407,6 +4415,8 @@
|
|
4407
4415
|
|
4408
4416
|
|
4409
4417
|
|
4418
|
+
</xsl:attribute-set><xsl:attribute-set name="dd-cell-style">
|
4419
|
+
<xsl:attribute name="padding-left">2mm</xsl:attribute>
|
4410
4420
|
</xsl:attribute-set><xsl:attribute-set name="appendix-style">
|
4411
4421
|
|
4412
4422
|
|
@@ -5240,7 +5250,38 @@
|
|
5240
5250
|
</xsl:template><xsl:template match="*[local-name()='br']">
|
5241
5251
|
<xsl:value-of select="$linebreak"/>
|
5242
5252
|
</xsl:template><xsl:template match="*[local-name() = 'keep-together_within-line']">
|
5243
|
-
<
|
5253
|
+
<xsl:param name="split_keep-within-line"/>
|
5254
|
+
|
5255
|
+
<!-- <fo:inline>split_keep-within-line='<xsl:value-of select="$split_keep-within-line"/>'</fo:inline> -->
|
5256
|
+
<xsl:choose>
|
5257
|
+
|
5258
|
+
<xsl:when test="normalize-space($split_keep-within-line) = 'true'">
|
5259
|
+
<xsl:variable name="sep">_</xsl:variable>
|
5260
|
+
<xsl:variable name="items">
|
5261
|
+
<xsl:call-template name="split">
|
5262
|
+
<xsl:with-param name="pText" select="."/>
|
5263
|
+
<xsl:with-param name="sep" select="$sep"/>
|
5264
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
5265
|
+
<xsl:with-param name="keep_sep">true</xsl:with-param>
|
5266
|
+
</xsl:call-template>
|
5267
|
+
</xsl:variable>
|
5268
|
+
<xsl:for-each select="xalan:nodeset($items)/item">
|
5269
|
+
<xsl:choose>
|
5270
|
+
<xsl:when test=". = $sep">
|
5271
|
+
<xsl:value-of select="$sep"/><xsl:value-of select="$zero_width_space"/>
|
5272
|
+
</xsl:when>
|
5273
|
+
<xsl:otherwise>
|
5274
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
5275
|
+
</xsl:otherwise>
|
5276
|
+
</xsl:choose>
|
5277
|
+
</xsl:for-each>
|
5278
|
+
</xsl:when>
|
5279
|
+
|
5280
|
+
<xsl:otherwise>
|
5281
|
+
<fo:inline keep-together.within-line="always"><xsl:apply-templates/></fo:inline>
|
5282
|
+
</xsl:otherwise>
|
5283
|
+
|
5284
|
+
</xsl:choose>
|
5244
5285
|
</xsl:template><xsl:template match="*[local-name()='copyright-statement']">
|
5245
5286
|
<fo:block xsl:use-attribute-sets="copyright-statement-style">
|
5246
5287
|
<xsl:apply-templates/>
|
@@ -5342,9 +5383,14 @@
|
|
5342
5383
|
|
5343
5384
|
<xsl:variable name="table">
|
5344
5385
|
|
5345
|
-
<xsl:variable name="simple-table">
|
5346
|
-
<xsl:call-template name="getSimpleTable"
|
5386
|
+
<xsl:variable name="simple-table">
|
5387
|
+
<xsl:call-template name="getSimpleTable">
|
5388
|
+
<xsl:with-param name="id" select="@id"/>
|
5389
|
+
</xsl:call-template>
|
5347
5390
|
</xsl:variable>
|
5391
|
+
<!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
|
5392
|
+
|
5393
|
+
<!-- simple-table=<xsl:copy-of select="$simple-table"/> -->
|
5348
5394
|
|
5349
5395
|
|
5350
5396
|
<!-- Display table's name before table as standalone block -->
|
@@ -5367,7 +5413,23 @@
|
|
5367
5413
|
</xsl:call-template>
|
5368
5414
|
</xsl:if>
|
5369
5415
|
</xsl:variable>
|
5370
|
-
<!--
|
5416
|
+
<!-- <xsl:variable name="colwidths" select="xalan:nodeset($colwidths_)"/> -->
|
5417
|
+
|
5418
|
+
<!-- DEBUG -->
|
5419
|
+
<xsl:if test="$table_if_debug = 'true'">
|
5420
|
+
<fo:block font-size="60%">
|
5421
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
5422
|
+
</fo:block>
|
5423
|
+
</xsl:if>
|
5424
|
+
|
5425
|
+
|
5426
|
+
<!-- <xsl:copy-of select="$colwidths"/> -->
|
5427
|
+
|
5428
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
5429
|
+
DEBUG
|
5430
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
5431
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
5432
|
+
|
5371
5433
|
|
5372
5434
|
|
5373
5435
|
<xsl:variable name="margin-side">
|
@@ -5446,9 +5508,17 @@
|
|
5446
5508
|
</xsl:element>
|
5447
5509
|
</xsl:variable>
|
5448
5510
|
|
5511
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5512
|
+
<!-- to determine start of table -->
|
5513
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
5514
|
+
</xsl:if>
|
5449
5515
|
|
5450
5516
|
<fo:table id="{@id}">
|
5451
5517
|
|
5518
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
5519
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
5520
|
+
</xsl:if>
|
5521
|
+
|
5452
5522
|
<xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
|
5453
5523
|
<xsl:attribute name="{local-name()}">
|
5454
5524
|
<xsl:value-of select="."/>
|
@@ -5462,24 +5532,47 @@
|
|
5462
5532
|
|
5463
5533
|
|
5464
5534
|
<xsl:choose>
|
5465
|
-
<xsl:when test="
|
5466
|
-
|
5467
|
-
|
5468
|
-
|
5535
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
5536
|
+
<!-- generate IF for table widths -->
|
5537
|
+
<!-- example:
|
5538
|
+
<tr>
|
5539
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
5540
|
+
<p>Symbol</p>
|
5541
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
5542
|
+
</td>
|
5543
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
5544
|
+
<p>Description</p>
|
5545
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
5546
|
+
</td>
|
5547
|
+
</tr>
|
5548
|
+
-->
|
5549
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if"/>
|
5550
|
+
|
5469
5551
|
</xsl:when>
|
5470
5552
|
<xsl:otherwise>
|
5471
|
-
<xsl:call-template name="insertTableColumnWidth">
|
5472
|
-
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5473
|
-
</xsl:call-template>
|
5474
|
-
</xsl:otherwise>
|
5475
|
-
</xsl:choose>
|
5476
5553
|
|
5477
|
-
|
5478
|
-
|
5479
|
-
|
5480
|
-
|
5481
|
-
|
5482
|
-
|
5554
|
+
<xsl:choose>
|
5555
|
+
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
|
5556
|
+
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
|
5557
|
+
<fo:table-column column-width="{@width}"/>
|
5558
|
+
</xsl:for-each>
|
5559
|
+
</xsl:when>
|
5560
|
+
<xsl:otherwise>
|
5561
|
+
<xsl:call-template name="insertTableColumnWidth">
|
5562
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5563
|
+
</xsl:call-template>
|
5564
|
+
</xsl:otherwise>
|
5565
|
+
</xsl:choose>
|
5566
|
+
|
5567
|
+
<xsl:choose>
|
5568
|
+
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
|
5569
|
+
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
|
5570
|
+
</xsl:when>
|
5571
|
+
<xsl:otherwise>
|
5572
|
+
<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 -->
|
5573
|
+
</xsl:otherwise>
|
5574
|
+
</xsl:choose>
|
5575
|
+
|
5483
5576
|
</xsl:otherwise>
|
5484
5577
|
</xsl:choose>
|
5485
5578
|
|
@@ -5586,11 +5679,22 @@
|
|
5586
5679
|
<xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
|
5587
5680
|
<xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
|
5588
5681
|
</xsl:template><xsl:template name="calculate-column-widths">
|
5682
|
+
<xsl:param name="table"/>
|
5683
|
+
<xsl:param name="cols-count"/>
|
5684
|
+
|
5685
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
5686
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
5687
|
+
<xsl:with-param name="table" select="$table"/>
|
5688
|
+
</xsl:call-template>
|
5689
|
+
|
5690
|
+
</xsl:template><xsl:template name="calculate-column-widths-proportional">
|
5589
5691
|
<xsl:param name="table"/>
|
5590
5692
|
<xsl:param name="cols-count"/>
|
5591
5693
|
<xsl:param name="curr-col" select="1"/>
|
5592
5694
|
<xsl:param name="width" select="0"/>
|
5593
5695
|
|
5696
|
+
<!-- table=<xsl:copy-of select="$table"/> -->
|
5697
|
+
|
5594
5698
|
<xsl:if test="$curr-col <= $cols-count">
|
5595
5699
|
<xsl:variable name="widths">
|
5596
5700
|
<xsl:choose>
|
@@ -5628,10 +5732,15 @@
|
|
5628
5732
|
</xsl:for-each>
|
5629
5733
|
</xsl:when>
|
5630
5734
|
<xsl:otherwise>
|
5631
|
-
<xsl:
|
5735
|
+
<!-- <curr_col><xsl:value-of select="$curr-col"/></curr_col> -->
|
5736
|
+
|
5737
|
+
<!-- <table><xsl:copy-of select="$table"/></table>
|
5738
|
+
-->
|
5739
|
+
<xsl:for-each select="xalan:nodeset($table)/*/*[local-name()='tr']">
|
5632
5740
|
<xsl:variable name="td_text">
|
5633
5741
|
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
5634
5742
|
</xsl:variable>
|
5743
|
+
<!-- <td_text><xsl:value-of select="$td_text"/></td_text> -->
|
5635
5744
|
<xsl:variable name="words">
|
5636
5745
|
<xsl:variable name="string_with_added_zerospaces">
|
5637
5746
|
<xsl:call-template name="add-zero-spaces-java">
|
@@ -5646,6 +5755,7 @@
|
|
5646
5755
|
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
5647
5756
|
</xsl:call-template>
|
5648
5757
|
</xsl:variable>
|
5758
|
+
<!-- words=<xsl:copy-of select="$words"/> -->
|
5649
5759
|
<xsl:variable name="max_length">
|
5650
5760
|
<xsl:call-template name="max_length">
|
5651
5761
|
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
@@ -5670,6 +5780,8 @@
|
|
5670
5780
|
</xsl:choose>
|
5671
5781
|
</xsl:variable>
|
5672
5782
|
|
5783
|
+
<!-- widths=<xsl:copy-of select="$widths"/> -->
|
5784
|
+
|
5673
5785
|
<column>
|
5674
5786
|
<xsl:for-each select="xalan:nodeset($widths)//width">
|
5675
5787
|
<xsl:sort select="." data-type="number" order="descending"/>
|
@@ -5678,33 +5790,327 @@
|
|
5678
5790
|
</xsl:if>
|
5679
5791
|
</xsl:for-each>
|
5680
5792
|
</column>
|
5681
|
-
<xsl:call-template name="calculate-column-widths">
|
5793
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
5682
5794
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
5683
5795
|
<xsl:with-param name="curr-col" select="$curr-col +1"/>
|
5684
5796
|
<xsl:with-param name="table" select="$table"/>
|
5685
5797
|
</xsl:call-template>
|
5686
5798
|
</xsl:if>
|
5687
|
-
</xsl:template><xsl:template match="*[@keep-together.within-line]/text()" priority="2" mode="td_text">
|
5799
|
+
</xsl:template><xsl:template match="*[@keep-together.within-line or local-name() = 'keep-together_within-line']/text()" priority="2" mode="td_text">
|
5688
5800
|
<!-- <xsl:message>DEBUG t1=<xsl:value-of select="."/></xsl:message>
|
5689
5801
|
<xsl:message>DEBUG t2=<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/></xsl:message> -->
|
5690
5802
|
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'.','X')"/>
|
5803
|
+
|
5804
|
+
<!-- if all capitals english letters or digits -->
|
5805
|
+
<xsl:if test="normalize-space(translate(., concat($upper,'0123456789'), '')) = ''">
|
5806
|
+
<xsl:call-template name="repeat">
|
5807
|
+
<xsl:with-param name="char" select="'X'"/>
|
5808
|
+
<xsl:with-param name="count" select="string-length(normalize-space(.)) * 0.5"/>
|
5809
|
+
</xsl:call-template>
|
5810
|
+
</xsl:if>
|
5691
5811
|
</xsl:template><xsl:template match="text()" mode="td_text">
|
5692
5812
|
<xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
|
5693
5813
|
</xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
|
5694
5814
|
<xsl:value-of select="*[local-name()='origin']/@citeas"/>
|
5695
5815
|
</xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
|
5696
5816
|
<xsl:value-of select="@target"/>
|
5697
|
-
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
|
5698
|
-
<xsl:
|
5699
|
-
<xsl:
|
5700
|
-
<xsl:
|
5701
|
-
<xsl:
|
5817
|
+
</xsl:template><xsl:template match="*[local-name()='math']" mode="td_text" name="math_length">
|
5818
|
+
<xsl:if test="$isGenerateTableIF = 'false'">
|
5819
|
+
<xsl:variable name="mathml_">
|
5820
|
+
<xsl:for-each select="*">
|
5821
|
+
<xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
|
5822
|
+
<xsl:copy-of select="."/>
|
5823
|
+
</xsl:if>
|
5824
|
+
</xsl:for-each>
|
5825
|
+
</xsl:variable>
|
5826
|
+
<xsl:variable name="mathml" select="xalan:nodeset($mathml_)"/>
|
5827
|
+
|
5828
|
+
<xsl:variable name="math_text">
|
5829
|
+
<xsl:value-of select="normalize-space($mathml)"/>
|
5830
|
+
<xsl:for-each select="$mathml//@open"><xsl:value-of select="."/></xsl:for-each>
|
5831
|
+
<xsl:for-each select="$mathml//@close"><xsl:value-of select="."/></xsl:for-each>
|
5832
|
+
</xsl:variable>
|
5833
|
+
<xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
|
5834
|
+
</xsl:if>
|
5835
|
+
</xsl:template><xsl:template name="calculate-column-widths-autolayout-algorithm">
|
5836
|
+
<xsl:param name="table"/>
|
5837
|
+
<xsl:param name="if">false</xsl:param> <!-- via intermediate format -->
|
5838
|
+
|
5839
|
+
<!-- The algorithm uses two passes through the table data and scales linearly with the size of the table -->
|
5840
|
+
|
5841
|
+
<!-- In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. -->
|
5842
|
+
|
5843
|
+
<!-- Since line wrap has been disabled, paragraphs are treated as long lines unless broken by BR elements. -->
|
5844
|
+
|
5845
|
+
<!-- get current table id -->
|
5846
|
+
<xsl:variable name="table_id" select="@id"/>
|
5847
|
+
<!-- find table by id in the file 'table_widths' -->
|
5848
|
+
<xsl:variable name="table-if_" select="$table_widths_from_if//table[@id = $table_id]"/>
|
5849
|
+
<xsl:variable name="table-if" select="xalan:nodeset($table-if_)"/>
|
5850
|
+
|
5851
|
+
|
5852
|
+
<!-- table='<xsl:copy-of select="$table"/>' -->
|
5853
|
+
<!-- table_id='<xsl:value-of select="$table_id"/>\ -->
|
5854
|
+
<!-- table-if='<xsl:copy-of select="$table-if"/>' -->
|
5855
|
+
<!-- table_widths_from_if='<xsl:copy-of select="$table_widths_from_if"/>' -->
|
5856
|
+
|
5857
|
+
<xsl:variable name="table_with_cell_widths_">
|
5858
|
+
<xsl:choose>
|
5859
|
+
<xsl:when test="$if = 'true' and normalize-space($table-if) != ''"> <!-- if we read column's width from IF and there is table in IF -->
|
5860
|
+
|
5861
|
+
<!-- Example: <column>10</column>
|
5862
|
+
<column>11</column>
|
5863
|
+
-->
|
5864
|
+
<xsl:apply-templates select="$table-if" mode="determine_cell_widths-if"/>
|
5865
|
+
</xsl:when>
|
5866
|
+
<xsl:otherwise>
|
5867
|
+
<xsl:apply-templates select="xalan:nodeset($table)" mode="determine_cell_widths"/>
|
5868
|
+
</xsl:otherwise>
|
5869
|
+
</xsl:choose>
|
5870
|
+
</xsl:variable>
|
5871
|
+
<xsl:variable name="table_with_cell_widths" select="xalan:nodeset($table_with_cell_widths_)"/>
|
5872
|
+
|
5873
|
+
<xsl:if test="$table_if_debug = 'true'">
|
5874
|
+
<xsl:copy-of select="$table_with_cell_widths"/>
|
5875
|
+
</xsl:if>
|
5876
|
+
|
5877
|
+
|
5878
|
+
<!-- The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. -->
|
5879
|
+
|
5880
|
+
<xsl:variable name="column_widths_">
|
5881
|
+
<!-- iteration of columns -->
|
5882
|
+
<xsl:for-each select="$table_with_cell_widths//tr[1]/td">
|
5883
|
+
<xsl:variable name="pos" select="position()"/>
|
5884
|
+
<column>
|
5885
|
+
<xsl:attribute name="width_max">
|
5886
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_max">
|
5887
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
5888
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
5889
|
+
</xsl:for-each>
|
5890
|
+
</xsl:attribute>
|
5891
|
+
<xsl:attribute name="width_min">
|
5892
|
+
<xsl:for-each select="ancestor::tbody//tr/td[$pos]/@width_min">
|
5893
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
5894
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
5895
|
+
</xsl:for-each>
|
5896
|
+
</xsl:attribute>
|
5897
|
+
</column>
|
5898
|
+
</xsl:for-each>
|
5899
|
+
</xsl:variable>
|
5900
|
+
<xsl:variable name="column_widths" select="xalan:nodeset($column_widths_)"/>
|
5901
|
+
|
5902
|
+
<!-- <column_widths>
|
5903
|
+
<xsl:copy-of select="$column_widths"/>
|
5904
|
+
</column_widths> -->
|
5905
|
+
|
5906
|
+
<!-- These in turn, are used to find the minimum and maximum width for the table. -->
|
5907
|
+
<xsl:variable name="table_widths_">
|
5908
|
+
<table>
|
5909
|
+
<xsl:attribute name="width_max">
|
5910
|
+
<xsl:value-of select="sum($column_widths/column/@width_max)"/>
|
5911
|
+
</xsl:attribute>
|
5912
|
+
<xsl:attribute name="width_min">
|
5913
|
+
<xsl:value-of select="sum($column_widths/column/@width_min)"/>
|
5914
|
+
</xsl:attribute>
|
5915
|
+
</table>
|
5916
|
+
</xsl:variable>
|
5917
|
+
<xsl:variable name="table_widths" select="xalan:nodeset($table_widths_)"/>
|
5918
|
+
|
5919
|
+
<xsl:variable name="page_width">
|
5920
|
+
<xsl:choose>
|
5921
|
+
<xsl:when test="$if = 'true'"><xsl:value-of select="$table-if/@page-width"/></xsl:when>
|
5922
|
+
<xsl:otherwise>75</xsl:otherwise>
|
5923
|
+
</xsl:choose>
|
5924
|
+
</xsl:variable>
|
5925
|
+
|
5926
|
+
<xsl:if test="$table_if_debug = 'true'">
|
5927
|
+
<table_width>
|
5928
|
+
<xsl:copy-of select="$table_widths"/>
|
5929
|
+
</table_width>
|
5930
|
+
<!-- <debug>$table_widths/@width_min=<xsl:value-of select="$table_widths/table/@width_min"/></debug>
|
5931
|
+
<debug>$table_widths/@width_max=<xsl:value-of select="$table_widths/table/@width_max"/></debug>
|
5932
|
+
-->
|
5933
|
+
<debug>$page_width=<xsl:value-of select="$page_width"/></debug>
|
5934
|
+
</xsl:if>
|
5935
|
+
|
5936
|
+
|
5937
|
+
<!-- There are three cases: -->
|
5938
|
+
<xsl:choose>
|
5939
|
+
<!-- 1. The minimum table width is equal to or wider than the available space -->
|
5940
|
+
<xsl:when test="$table_widths/table/@width_min >= $page_width and 1 = 2"> <!-- this condition isn't working see case 3 below -->
|
5941
|
+
<!-- call old algorithm -->
|
5942
|
+
<case1/>
|
5943
|
+
<xsl:variable name="cols-count" select="count(xalan:nodeset($table)/*/tr[1]/td)"/>
|
5944
|
+
<xsl:call-template name="calculate-column-widths-proportional">
|
5945
|
+
<xsl:with-param name="cols-count" select="$cols-count"/>
|
5946
|
+
<xsl:with-param name="table" select="$table"/>
|
5947
|
+
</xsl:call-template>
|
5948
|
+
</xsl:when>
|
5949
|
+
<!-- 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. -->
|
5950
|
+
<xsl:when test="$table_widths/table/@width_max <= $page_width">
|
5951
|
+
<case2/>
|
5952
|
+
<autolayout/>
|
5953
|
+
<xsl:for-each select="$column_widths/column/@width_max">
|
5954
|
+
<column divider="100"><xsl:value-of select="."/></column>
|
5955
|
+
</xsl:for-each>
|
5956
|
+
</xsl:when>
|
5957
|
+
<!-- 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller.
|
5958
|
+
In this case, find the difference between the available space and the minimum table width, lets call it W.
|
5959
|
+
Lets also call D the difference between maximum and minimum width of the table.
|
5960
|
+
For each column, let d be the difference between maximum and minimum width of that column.
|
5961
|
+
Now set the column's width to the minimum width plus d times W over D.
|
5962
|
+
This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
|
5963
|
+
<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)">
|
5964
|
+
<!-- difference between the available space and the minimum table width -->
|
5965
|
+
<xsl:variable name="W" select="$page_width - $table_widths/table/@width_min"/>
|
5966
|
+
<W><xsl:value-of select="$W"/></W>
|
5967
|
+
<!-- difference between maximum and minimum width of the table -->
|
5968
|
+
<xsl:variable name="D" select="$table_widths/table/@width_max - $table_widths/table/@width_min"/>
|
5969
|
+
<D><xsl:value-of select="$D"/></D>
|
5970
|
+
<case3/>
|
5971
|
+
<autolayout/>
|
5972
|
+
<xsl:if test="$table_widths/table/@width_min >= $page_width">
|
5973
|
+
<split_keep-within-line>true</split_keep-within-line>
|
5974
|
+
</xsl:if>
|
5975
|
+
<xsl:for-each select="$column_widths/column">
|
5976
|
+
<!-- difference between maximum and minimum width of that column. -->
|
5977
|
+
<xsl:variable name="d" select="@width_max - @width_min"/>
|
5978
|
+
<d><xsl:value-of select="$d"/></d>
|
5979
|
+
<width_min><xsl:value-of select="@width_min"/></width_min>
|
5980
|
+
<e><xsl:value-of select="$d * $W div $D"/></e>
|
5981
|
+
<!-- set the column's width to the minimum width plus d times W over D. -->
|
5982
|
+
<column divider="100">
|
5983
|
+
<xsl:value-of select="round(@width_min + $d * $W div $D)"/> <!-- * 10 -->
|
5984
|
+
</column>
|
5985
|
+
</xsl:for-each>
|
5986
|
+
|
5987
|
+
</xsl:when>
|
5988
|
+
<xsl:otherwise><unknown_case/></xsl:otherwise>
|
5989
|
+
</xsl:choose>
|
5990
|
+
|
5991
|
+
|
5992
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths">
|
5993
|
+
<xsl:copy>
|
5994
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths"/>
|
5995
|
+
</xsl:copy>
|
5996
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths">
|
5997
|
+
<xsl:copy>
|
5998
|
+
<xsl:copy-of select="@*"/>
|
5999
|
+
|
6000
|
+
<!-- The maximum width is given by the widest line. -->
|
6001
|
+
<xsl:variable name="widths_max">
|
6002
|
+
<xsl:for-each select=".//*[local-name() = 'p']">
|
6003
|
+
<xsl:call-template name="add_width"/>
|
6004
|
+
</xsl:for-each>
|
6005
|
+
<xsl:if test="not(*[local-name() = 'p'])">
|
6006
|
+
<xsl:call-template name="add_width"/>
|
5702
6007
|
</xsl:if>
|
6008
|
+
</xsl:variable>
|
6009
|
+
<xsl:variable name="width_max">
|
6010
|
+
<xsl:for-each select="xalan:nodeset($widths_max)//width">
|
6011
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
6012
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
6013
|
+
</xsl:for-each>
|
6014
|
+
</xsl:variable>
|
6015
|
+
<xsl:attribute name="width_max">
|
6016
|
+
<xsl:value-of select="$width_max"/>
|
6017
|
+
</xsl:attribute>
|
6018
|
+
|
6019
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
6020
|
+
<!-- To do: image width -->
|
6021
|
+
<xsl:variable name="td_text">
|
6022
|
+
<xsl:apply-templates select="." mode="td_text"/>
|
6023
|
+
</xsl:variable>
|
6024
|
+
<xsl:variable name="words">
|
6025
|
+
<xsl:variable name="string_with_added_zerospaces">
|
6026
|
+
<xsl:call-template name="add-zero-spaces-java">
|
6027
|
+
<xsl:with-param name="text" select="$td_text"/>
|
6028
|
+
</xsl:call-template>
|
6029
|
+
</xsl:variable>
|
6030
|
+
<xsl:call-template name="tokenize">
|
6031
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
6032
|
+
</xsl:call-template>
|
6033
|
+
</xsl:variable>
|
6034
|
+
|
6035
|
+
<xsl:variable name="max_word_length">
|
6036
|
+
<xsl:call-template name="max_length">
|
6037
|
+
<xsl:with-param name="words" select="xalan:nodeset($words)"/>
|
6038
|
+
</xsl:call-template>
|
6039
|
+
</xsl:variable>
|
6040
|
+
<xsl:variable name="width_min">
|
6041
|
+
<xsl:value-of select="$max_word_length"/>
|
6042
|
+
</xsl:variable>
|
6043
|
+
<xsl:attribute name="width_min">
|
6044
|
+
<xsl:value-of select="$width_min"/>
|
6045
|
+
</xsl:attribute>
|
6046
|
+
<!-- width_max="1" width_min="1.5"> --> <!-- see 'tokenize' template, multiply 1.5 for all latin capitals -->
|
6047
|
+
<xsl:if test="$width_min > $width_max">
|
6048
|
+
<xsl:attribute name="width_max">
|
6049
|
+
<xsl:value-of select="$width_min"/>
|
6050
|
+
</xsl:attribute>
|
6051
|
+
</xsl:if>
|
6052
|
+
<xsl:if test="$width_min = 0">
|
6053
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
6054
|
+
</xsl:if>
|
6055
|
+
|
6056
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths"/>
|
6057
|
+
|
6058
|
+
</xsl:copy>
|
6059
|
+
</xsl:template><xsl:template name="add_width">
|
6060
|
+
<xsl:variable name="p_text"><xsl:apply-templates select="." mode="td_text"/></xsl:variable>
|
6061
|
+
<xsl:variable name="p_text_len_" select="string-length(normalize-space($p_text))"/>
|
6062
|
+
|
6063
|
+
<xsl:variable name="p_text_len">
|
6064
|
+
<xsl:choose>
|
6065
|
+
<xsl:when test="normalize-space(translate($p_text, concat($upper,'0123456789'), '')) = ''"> <!-- english word in CAPITAL letters -->
|
6066
|
+
<xsl:value-of select="$p_text_len_ * 1.5"/>
|
6067
|
+
</xsl:when>
|
6068
|
+
<xsl:otherwise><xsl:value-of select="$p_text_len_"/></xsl:otherwise>
|
6069
|
+
</xsl:choose>
|
6070
|
+
</xsl:variable>
|
6071
|
+
|
6072
|
+
<xsl:variable name="math_addon_text">
|
6073
|
+
<xsl:for-each select=".//*[local-name() = 'math']">
|
6074
|
+
<xsl:apply-templates mode="td_text"/>
|
5703
6075
|
</xsl:for-each>
|
5704
6076
|
</xsl:variable>
|
6077
|
+
<xsl:variable name="math_addon_length" select="string-length(normalize-space($math_addon_text)) * 0.2"/> <!-- plus 20% -->
|
5705
6078
|
|
5706
|
-
<xsl:
|
5707
|
-
|
6079
|
+
<width><xsl:value-of select="$p_text_len + $math_addon_length"/></width>
|
6080
|
+
</xsl:template><xsl:template match="@*|node()" mode="determine_cell_widths-if">
|
6081
|
+
<xsl:copy>
|
6082
|
+
<xsl:apply-templates select="@*|node()" mode="determine_cell_widths-if"/>
|
6083
|
+
</xsl:copy>
|
6084
|
+
</xsl:template><xsl:template match="td | th" mode="determine_cell_widths-if">
|
6085
|
+
<xsl:copy>
|
6086
|
+
<xsl:copy-of select="@*"/>
|
6087
|
+
|
6088
|
+
<!-- The maximum width is given by the widest line. -->
|
6089
|
+
<xsl:attribute name="width_max">
|
6090
|
+
<xsl:for-each select="p_len">
|
6091
|
+
<xsl:sort select="." data-type="number" order="descending"/>
|
6092
|
+
<xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
|
6093
|
+
</xsl:for-each>
|
6094
|
+
</xsl:attribute>
|
6095
|
+
|
6096
|
+
<!-- The minimum width is given by the widest text element (word, image, etc.) -->
|
6097
|
+
<xsl:variable name="width_min">
|
6098
|
+
<xsl:for-each select="word_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:variable>
|
6103
|
+
<xsl:attribute name="width_min">
|
6104
|
+
<xsl:value-of select="$width_min"/>
|
6105
|
+
</xsl:attribute>
|
6106
|
+
|
6107
|
+
<xsl:if test="$width_min = 0">
|
6108
|
+
<xsl:attribute name="width_min">1</xsl:attribute>
|
6109
|
+
</xsl:if>
|
6110
|
+
|
6111
|
+
<xsl:apply-templates select="node()" mode="determine_cell_widths-if"/>
|
6112
|
+
|
6113
|
+
</xsl:copy>
|
5708
6114
|
</xsl:template><xsl:template match="*[local-name()='thead']">
|
5709
6115
|
<xsl:param name="cols-count"/>
|
5710
6116
|
<fo:table-header>
|
@@ -5789,6 +6195,7 @@
|
|
5789
6195
|
</xsl:for-each>
|
5790
6196
|
</xsl:when>
|
5791
6197
|
<xsl:otherwise>
|
6198
|
+
<!-- $colwidths=<xsl:copy-of select="$colwidths"/> -->
|
5792
6199
|
<xsl:call-template name="insertTableColumnWidth">
|
5793
6200
|
<xsl:with-param name="colwidths" select="$colwidths"/>
|
5794
6201
|
</xsl:call-template>
|
@@ -5878,6 +6285,52 @@
|
|
5878
6285
|
|
5879
6286
|
</fo:table-body>
|
5880
6287
|
|
6288
|
+
</xsl:template><xsl:template match="/" mode="process_table-if">
|
6289
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
6290
|
+
<xsl:apply-templates mode="process_table-if">
|
6291
|
+
<xsl:with-param name="table_or_dl" select="$table_or_dl"/>
|
6292
|
+
</xsl:apply-templates>
|
6293
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="process_table-if">
|
6294
|
+
<xsl:param name="table_or_dl">table</xsl:param>
|
6295
|
+
|
6296
|
+
<fo:table-body>
|
6297
|
+
<xsl:for-each select="*[local-name() = 'tr']">
|
6298
|
+
<xsl:variable name="col_count" select="count(*)"/>
|
6299
|
+
|
6300
|
+
<!-- iteration for each tr/td -->
|
6301
|
+
|
6302
|
+
<xsl:choose>
|
6303
|
+
<xsl:when test="$table_or_dl = 'table'">
|
6304
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']/*">
|
6305
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
6306
|
+
<!-- <test_table><xsl:copy-of select="."/></test_table> -->
|
6307
|
+
<xsl:call-template name="td"/>
|
6308
|
+
</fo:table-row>
|
6309
|
+
</xsl:for-each>
|
6310
|
+
</xsl:when>
|
6311
|
+
<xsl:otherwise> <!-- $table_or_dl = 'dl' -->
|
6312
|
+
<xsl:for-each select="*[local-name() = 'td' or local-name() = 'th']">
|
6313
|
+
<xsl:variable name="is_dt" select="position() = 1"/>
|
6314
|
+
|
6315
|
+
<xsl:for-each select="*">
|
6316
|
+
<!-- <test><xsl:copy-of select="."/></test> -->
|
6317
|
+
<fo:table-row number-columns-spanned="{$col_count}">
|
6318
|
+
<xsl:choose>
|
6319
|
+
<xsl:when test="$is_dt">
|
6320
|
+
<xsl:call-template name="insert_dt_cell"/>
|
6321
|
+
</xsl:when>
|
6322
|
+
<xsl:otherwise>
|
6323
|
+
<xsl:call-template name="insert_dd_cell"/>
|
6324
|
+
</xsl:otherwise>
|
6325
|
+
</xsl:choose>
|
6326
|
+
</fo:table-row>
|
6327
|
+
</xsl:for-each>
|
6328
|
+
</xsl:for-each>
|
6329
|
+
</xsl:otherwise>
|
6330
|
+
</xsl:choose>
|
6331
|
+
|
6332
|
+
</xsl:for-each>
|
6333
|
+
</fo:table-body>
|
5881
6334
|
</xsl:template><xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
|
5882
6335
|
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
|
5883
6336
|
|
@@ -5982,7 +6435,7 @@
|
|
5982
6435
|
</xsl:choose>
|
5983
6436
|
</xsl:attribute>
|
5984
6437
|
</xsl:if>
|
5985
|
-
</xsl:template><xsl:template match="*[local-name()='td']">
|
6438
|
+
</xsl:template><xsl:template match="*[local-name()='td']" name="td">
|
5986
6439
|
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
|
5987
6440
|
<xsl:call-template name="setTextAlignment">
|
5988
6441
|
<xsl:with-param name="default">left</xsl:with-param>
|
@@ -6027,8 +6480,18 @@
|
|
6027
6480
|
|
6028
6481
|
<xsl:call-template name="setTableCellAttributes"/>
|
6029
6482
|
|
6483
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
6484
|
+
<xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
|
6485
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
6486
|
+
</xsl:if>
|
6487
|
+
|
6030
6488
|
<fo:block>
|
6031
6489
|
|
6490
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
6491
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
6492
|
+
</xsl:if>
|
6493
|
+
|
6494
|
+
|
6032
6495
|
|
6033
6496
|
<xsl:if test="not(.//bipm:image)">
|
6034
6497
|
<xsl:attribute name="line-stacking-strategy">font-height</xsl:attribute>
|
@@ -6041,6 +6504,9 @@
|
|
6041
6504
|
|
6042
6505
|
|
6043
6506
|
<xsl:apply-templates/>
|
6507
|
+
|
6508
|
+
<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"/> -->
|
6509
|
+
|
6044
6510
|
</fo:block>
|
6045
6511
|
</fo:table-cell>
|
6046
6512
|
</xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
|
@@ -6254,9 +6720,9 @@
|
|
6254
6720
|
<!-- current hierarchy is 'figure' element -->
|
6255
6721
|
<xsl:variable name="following_dl_colwidths">
|
6256
6722
|
<xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
|
6257
|
-
<xsl:variable name="
|
6258
|
-
<xsl:variable name="doc_ns">
|
6259
|
-
bipm
|
6723
|
+
<xsl:variable name="simple-table">
|
6724
|
+
<!-- <xsl:variable name="doc_ns">
|
6725
|
+
<xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
|
6260
6726
|
</xsl:variable>
|
6261
6727
|
<xsl:variable name="ns">
|
6262
6728
|
<xsl:choose>
|
@@ -6267,7 +6733,7 @@
|
|
6267
6733
|
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
6268
6734
|
</xsl:otherwise>
|
6269
6735
|
</xsl:choose>
|
6270
|
-
</xsl:variable>
|
6736
|
+
</xsl:variable> -->
|
6271
6737
|
|
6272
6738
|
<xsl:for-each select="*[local-name() = 'dl'][1]">
|
6273
6739
|
<tbody>
|
@@ -6278,7 +6744,7 @@
|
|
6278
6744
|
|
6279
6745
|
<xsl:call-template name="calculate-column-widths">
|
6280
6746
|
<xsl:with-param name="cols-count" select="2"/>
|
6281
|
-
<xsl:with-param name="table" select="$
|
6747
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
6282
6748
|
</xsl:call-template>
|
6283
6749
|
|
6284
6750
|
</xsl:if>
|
@@ -6463,7 +6929,18 @@
|
|
6463
6929
|
|
6464
6930
|
|
6465
6931
|
|
6932
|
+
|
6933
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
6934
|
+
<!-- to determine start of table -->
|
6935
|
+
<fo:block id="{concat('table_if_start_',@id)}" keep-with-next="always" font-size="1pt">Start table '<xsl:value-of select="@id"/>'.</fo:block>
|
6936
|
+
</xsl:if>
|
6937
|
+
|
6466
6938
|
<fo:table width="95%" table-layout="fixed">
|
6939
|
+
|
6940
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
6941
|
+
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
6942
|
+
</xsl:if>
|
6943
|
+
|
6467
6944
|
|
6468
6945
|
<xsl:choose>
|
6469
6946
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'"/>
|
@@ -6472,52 +6949,130 @@
|
|
6472
6949
|
|
6473
6950
|
</xsl:when>
|
6474
6951
|
</xsl:choose>
|
6475
|
-
<!-- create virtual html table for dl/[dt and dd] -->
|
6476
|
-
<xsl:variable name="html-table">
|
6477
|
-
<xsl:variable name="doc_ns">
|
6478
|
-
bipm
|
6479
|
-
</xsl:variable>
|
6480
|
-
<xsl:variable name="ns">
|
6481
|
-
<xsl:choose>
|
6482
|
-
<xsl:when test="normalize-space($doc_ns) != ''">
|
6483
|
-
<xsl:value-of select="normalize-space($doc_ns)"/>
|
6484
|
-
</xsl:when>
|
6485
|
-
<xsl:otherwise>
|
6486
|
-
<xsl:value-of select="substring-before(name(/*), '-')"/>
|
6487
|
-
</xsl:otherwise>
|
6488
|
-
</xsl:choose>
|
6489
|
-
</xsl:variable>
|
6490
|
-
<tbody>
|
6491
|
-
<xsl:apply-templates mode="dl"/>
|
6492
|
-
</tbody>
|
6493
|
-
</xsl:variable>
|
6494
|
-
<!-- DEBUG: html-table<xsl:copy-of select="$html-table"/> -->
|
6495
|
-
<xsl:variable name="colwidths">
|
6496
|
-
<xsl:call-template name="calculate-column-widths">
|
6497
|
-
<xsl:with-param name="cols-count" select="2"/>
|
6498
|
-
<xsl:with-param name="table" select="$html-table"/>
|
6499
|
-
</xsl:call-template>
|
6500
|
-
</xsl:variable>
|
6501
|
-
<!-- DEBUG: colwidths=<xsl:copy-of select="$colwidths"/> -->
|
6502
|
-
<xsl:variable name="maxlength_dt">
|
6503
|
-
<xsl:call-template name="getMaxLength_dt"/>
|
6504
|
-
</xsl:variable>
|
6505
|
-
<xsl:variable name="isContainsKeepTogetherTag_">
|
6506
|
-
false
|
6507
|
-
</xsl:variable>
|
6508
|
-
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
6509
|
-
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
6510
|
-
<xsl:call-template name="setColumnWidth_dl">
|
6511
|
-
<xsl:with-param name="colwidths" select="$colwidths"/>
|
6512
|
-
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
6513
|
-
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
6514
|
-
</xsl:call-template>
|
6515
6952
|
|
6516
|
-
|
6517
|
-
|
6518
|
-
|
6519
|
-
|
6520
|
-
|
6953
|
+
|
6954
|
+
<xsl:choose>
|
6955
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
6956
|
+
<!-- generate IF for table widths -->
|
6957
|
+
<!-- example:
|
6958
|
+
<tr>
|
6959
|
+
<td valign="top" align="left" id="tab-symdu_1_1">
|
6960
|
+
<p>Symbol</p>
|
6961
|
+
<word id="tab-symdu_1_1_word_1">Symbol</word>
|
6962
|
+
</td>
|
6963
|
+
<td valign="top" align="left" id="tab-symdu_1_2">
|
6964
|
+
<p>Description</p>
|
6965
|
+
<word id="tab-symdu_1_2_word_1">Description</word>
|
6966
|
+
</td>
|
6967
|
+
</tr>
|
6968
|
+
-->
|
6969
|
+
|
6970
|
+
<!-- create virtual html table for dl/[dt and dd] -->
|
6971
|
+
<xsl:variable name="simple-table">
|
6972
|
+
|
6973
|
+
<xsl:variable name="dl_table">
|
6974
|
+
<tbody>
|
6975
|
+
<xsl:apply-templates mode="dl_if">
|
6976
|
+
<xsl:with-param name="id" select="@id"/>
|
6977
|
+
</xsl:apply-templates>
|
6978
|
+
</tbody>
|
6979
|
+
</xsl:variable>
|
6980
|
+
|
6981
|
+
<!-- dl_table='<xsl:copy-of select="$dl_table"/>' -->
|
6982
|
+
|
6983
|
+
<!-- Step: replace <br/> to <p>...</p> -->
|
6984
|
+
<xsl:variable name="table_without_br">
|
6985
|
+
<xsl:apply-templates select="xalan:nodeset($dl_table)" mode="table-without-br"/>
|
6986
|
+
</xsl:variable>
|
6987
|
+
|
6988
|
+
<!-- table_without_br='<xsl:copy-of select="$table_without_br"/>' -->
|
6989
|
+
|
6990
|
+
<!-- Step: add id to each cell -->
|
6991
|
+
<!-- add <word>...</word> for each word, image, math -->
|
6992
|
+
<xsl:variable name="simple-table-id">
|
6993
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-id">
|
6994
|
+
<xsl:with-param name="id" select="@id"/>
|
6995
|
+
</xsl:apply-templates>
|
6996
|
+
</xsl:variable>
|
6997
|
+
|
6998
|
+
<!-- simple-table-id='<xsl:copy-of select="$simple-table-id"/>' -->
|
6999
|
+
|
7000
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
7001
|
+
|
7002
|
+
</xsl:variable>
|
7003
|
+
|
7004
|
+
<!-- DEBUG: simple-table<xsl:copy-of select="$simple-table"/> -->
|
7005
|
+
|
7006
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table)" mode="process_table-if">
|
7007
|
+
<xsl:with-param name="table_or_dl">dl</xsl:with-param>
|
7008
|
+
</xsl:apply-templates>
|
7009
|
+
|
7010
|
+
</xsl:when>
|
7011
|
+
<xsl:otherwise>
|
7012
|
+
|
7013
|
+
<xsl:variable name="simple-table">
|
7014
|
+
|
7015
|
+
<xsl:variable name="dl_table">
|
7016
|
+
<tbody>
|
7017
|
+
<xsl:apply-templates mode="dl">
|
7018
|
+
<xsl:with-param name="id" select="@id"/>
|
7019
|
+
</xsl:apply-templates>
|
7020
|
+
</tbody>
|
7021
|
+
</xsl:variable>
|
7022
|
+
|
7023
|
+
<xsl:copy-of select="$dl_table"/>
|
7024
|
+
</xsl:variable>
|
7025
|
+
|
7026
|
+
<xsl:variable name="colwidths">
|
7027
|
+
<xsl:call-template name="calculate-column-widths">
|
7028
|
+
<xsl:with-param name="cols-count" select="2"/>
|
7029
|
+
<xsl:with-param name="table" select="$simple-table"/>
|
7030
|
+
</xsl:call-template>
|
7031
|
+
</xsl:variable>
|
7032
|
+
|
7033
|
+
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
|
7034
|
+
DEBUG
|
7035
|
+
colwidths=<xsl:copy-of select="$colwidths"/>
|
7036
|
+
<xsl:text disable-output-escaping="yes">- -></xsl:text> -->
|
7037
|
+
|
7038
|
+
<!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
|
7039
|
+
|
7040
|
+
<xsl:variable name="maxlength_dt">
|
7041
|
+
<xsl:call-template name="getMaxLength_dt"/>
|
7042
|
+
</xsl:variable>
|
7043
|
+
|
7044
|
+
<xsl:variable name="isContainsKeepTogetherTag_">
|
7045
|
+
false
|
7046
|
+
</xsl:variable>
|
7047
|
+
<xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
|
7048
|
+
<!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
|
7049
|
+
|
7050
|
+
|
7051
|
+
<xsl:call-template name="setColumnWidth_dl">
|
7052
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
7053
|
+
<xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
|
7054
|
+
<xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
|
7055
|
+
</xsl:call-template>
|
7056
|
+
|
7057
|
+
<fo:table-body>
|
7058
|
+
|
7059
|
+
<!-- DEBUG -->
|
7060
|
+
<xsl:if test="$table_if_debug = 'true'">
|
7061
|
+
<fo:table-row>
|
7062
|
+
<fo:table-cell number-columns-spanned="2" font-size="60%">
|
7063
|
+
<xsl:apply-templates select="xalan:nodeset($colwidths)" mode="print_as_xml"/>
|
7064
|
+
</fo:table-cell>
|
7065
|
+
</fo:table-row>
|
7066
|
+
</xsl:if>
|
7067
|
+
|
7068
|
+
<xsl:apply-templates>
|
7069
|
+
<xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
|
7070
|
+
<xsl:with-param name="split_keep-within-line" select="xalan:nodeset($colwidths)/split_keep-within-line"/>
|
7071
|
+
</xsl:apply-templates>
|
7072
|
+
|
7073
|
+
</fo:table-body>
|
7074
|
+
</xsl:otherwise>
|
7075
|
+
</xsl:choose>
|
6521
7076
|
</fo:table>
|
6522
7077
|
</fo:block>
|
6523
7078
|
</fo:block>
|
@@ -6528,6 +7083,9 @@
|
|
6528
7083
|
<xsl:param name="colwidths"/>
|
6529
7084
|
<xsl:param name="maxlength_dt"/>
|
6530
7085
|
<xsl:param name="isContainsKeepTogetherTag"/>
|
7086
|
+
|
7087
|
+
<!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
|
7088
|
+
|
6531
7089
|
<xsl:choose>
|
6532
7090
|
<xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
|
6533
7091
|
<fo:table-column column-width="50%"/>
|
@@ -6535,6 +7093,11 @@
|
|
6535
7093
|
</xsl:when>
|
6536
7094
|
<xsl:otherwise>
|
6537
7095
|
<xsl:choose>
|
7096
|
+
<xsl:when test="xalan:nodeset($colwidths)/autolayout">
|
7097
|
+
<xsl:call-template name="insertTableColumnWidth">
|
7098
|
+
<xsl:with-param name="colwidths" select="$colwidths"/>
|
7099
|
+
</xsl:call-template>
|
7100
|
+
</xsl:when>
|
6538
7101
|
<xsl:when test="$isContainsKeepTogetherTag">
|
6539
7102
|
<xsl:call-template name="insertTableColumnWidth">
|
6540
7103
|
<xsl:with-param name="colwidths" select="$colwidths"/>
|
@@ -6579,13 +7142,19 @@
|
|
6579
7142
|
</xsl:choose>
|
6580
7143
|
</xsl:template><xsl:template name="insertTableColumnWidth">
|
6581
7144
|
<xsl:param name="colwidths"/>
|
7145
|
+
|
6582
7146
|
<xsl:for-each select="xalan:nodeset($colwidths)//column">
|
6583
7147
|
<xsl:choose>
|
6584
7148
|
<xsl:when test=". = 1 or . = 0">
|
6585
7149
|
<fo:table-column column-width="proportional-column-width(2)"/>
|
6586
7150
|
</xsl:when>
|
6587
7151
|
<xsl:otherwise>
|
6588
|
-
<fo:table-column column-width="proportional-column-width({.})"/>
|
7152
|
+
<!-- <fo:table-column column-width="proportional-column-width({.})"/> -->
|
7153
|
+
<xsl:variable name="divider">
|
7154
|
+
<xsl:value-of select="@divider"/>
|
7155
|
+
<xsl:if test="not(@divider)">1</xsl:if>
|
7156
|
+
</xsl:variable>
|
7157
|
+
<fo:table-column column-width="proportional-column-width({round(. div $divider)})"/>
|
6589
7158
|
</xsl:otherwise>
|
6590
7159
|
</xsl:choose>
|
6591
7160
|
</xsl:for-each>
|
@@ -6647,11 +7216,19 @@
|
|
6647
7216
|
</fo:table-cell>
|
6648
7217
|
</fo:table-row>
|
6649
7218
|
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
|
7219
|
+
<xsl:param name="id"/>
|
7220
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
6650
7221
|
<tr>
|
6651
7222
|
<td>
|
7223
|
+
<xsl:attribute name="id">
|
7224
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
|
7225
|
+
</xsl:attribute>
|
6652
7226
|
<xsl:apply-templates/>
|
6653
7227
|
</td>
|
6654
7228
|
<td>
|
7229
|
+
<xsl:attribute name="id">
|
7230
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
|
7231
|
+
</xsl:attribute>
|
6655
7232
|
|
6656
7233
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
|
6657
7234
|
<xsl:with-param name="process">true</xsl:with-param>
|
@@ -6662,50 +7239,122 @@
|
|
6662
7239
|
|
6663
7240
|
</xsl:template><xsl:template match="*[local-name()='dt']">
|
6664
7241
|
<xsl:param name="key_iso"/>
|
7242
|
+
<xsl:param name="split_keep-within-line"/>
|
6665
7243
|
|
6666
7244
|
<fo:table-row xsl:use-attribute-sets="dt-row-style">
|
6667
|
-
<
|
7245
|
+
<xsl:call-template name="insert_dt_cell">
|
7246
|
+
<xsl:with-param name="key_iso" select="$key_iso"/>
|
7247
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7248
|
+
</xsl:call-template>
|
7249
|
+
<xsl:for-each select="following-sibling::*[local-name()='dd'][1]">
|
7250
|
+
<xsl:call-template name="insert_dd_cell">
|
7251
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7252
|
+
</xsl:call-template>
|
7253
|
+
</xsl:for-each>
|
7254
|
+
</fo:table-row>
|
7255
|
+
</xsl:template><xsl:template name="insert_dt_cell">
|
7256
|
+
<xsl:param name="key_iso"/>
|
7257
|
+
<xsl:param name="split_keep-within-line"/>
|
7258
|
+
<fo:table-cell xsl:use-attribute-sets="dt-cell-style">
|
7259
|
+
|
7260
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
7261
|
+
<!-- border is mandatory, to calculate real width -->
|
7262
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
7263
|
+
<xsl:attribute name="text-align">left</xsl:attribute>
|
7264
|
+
</xsl:if>
|
7265
|
+
|
7266
|
+
|
7267
|
+
<fo:block xsl:use-attribute-sets="dt-block-style">
|
7268
|
+
<xsl:copy-of select="@id"/>
|
7269
|
+
|
7270
|
+
<xsl:if test="normalize-space($key_iso) = 'true'">
|
7271
|
+
<xsl:attribute name="margin-top">0</xsl:attribute>
|
7272
|
+
</xsl:if>
|
7273
|
+
|
7274
|
+
|
7275
|
+
|
7276
|
+
<xsl:apply-templates>
|
7277
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7278
|
+
</xsl:apply-templates>
|
7279
|
+
|
7280
|
+
<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"/> -->
|
7281
|
+
|
7282
|
+
</fo:block>
|
7283
|
+
</fo:table-cell>
|
7284
|
+
</xsl:template><xsl:template name="insert_dd_cell">
|
7285
|
+
<xsl:param name="split_keep-within-line"/>
|
7286
|
+
<fo:table-cell xsl:use-attribute-sets="dd-cell-style">
|
7287
|
+
|
7288
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
7289
|
+
<!-- border is mandatory, to calculate real width -->
|
7290
|
+
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
|
7291
|
+
</xsl:if>
|
7292
|
+
|
7293
|
+
<fo:block>
|
7294
|
+
|
7295
|
+
<xsl:if test="$isGenerateTableIF = 'true'">
|
7296
|
+
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
|
7297
|
+
</xsl:if>
|
7298
|
+
|
6668
7299
|
|
6669
|
-
<fo:block xsl:use-attribute-sets="dt-style">
|
6670
|
-
<xsl:copy-of select="@id"/>
|
6671
|
-
|
6672
|
-
<xsl:if test="normalize-space($key_iso) = 'true'">
|
6673
|
-
<xsl:attribute name="margin-top">0</xsl:attribute>
|
6674
|
-
</xsl:if>
|
6675
|
-
|
6676
|
-
|
6677
|
-
|
6678
|
-
<xsl:apply-templates/>
|
6679
|
-
</fo:block>
|
6680
|
-
</fo:table-cell>
|
6681
|
-
<fo:table-cell>
|
6682
|
-
<fo:block>
|
6683
|
-
|
6684
7300
|
|
6685
|
-
|
6686
|
-
|
6687
|
-
|
6688
|
-
|
6689
|
-
|
6690
|
-
|
7301
|
+
<xsl:choose>
|
7302
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
7303
|
+
<xsl:apply-templates> <!-- following-sibling::*[local-name()='dd'][1] -->
|
7304
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
7305
|
+
</xsl:apply-templates>
|
7306
|
+
</xsl:when>
|
7307
|
+
<xsl:otherwise>
|
7308
|
+
<xsl:apply-templates select="."> <!-- following-sibling::*[local-name()='dd'][1] -->
|
7309
|
+
<xsl:with-param name="process">true</xsl:with-param>
|
7310
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7311
|
+
</xsl:apply-templates>
|
7312
|
+
</xsl:otherwise>
|
7313
|
+
|
7314
|
+
</xsl:choose>
|
7315
|
+
|
7316
|
+
<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"/> -->
|
7317
|
+
|
7318
|
+
</fo:block>
|
7319
|
+
</fo:table-cell>
|
6691
7320
|
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
|
6692
7321
|
<xsl:apply-templates/>
|
6693
7322
|
</xsl:template><xsl:template match="*[local-name()='dd']">
|
6694
7323
|
<xsl:param name="process">false</xsl:param>
|
7324
|
+
<xsl:param name="split_keep-within-line"/>
|
6695
7325
|
<xsl:if test="$process = 'true'">
|
6696
7326
|
<xsl:apply-templates select="@language"/>
|
6697
|
-
<xsl:apply-templates
|
7327
|
+
<xsl:apply-templates>
|
7328
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7329
|
+
</xsl:apply-templates>
|
6698
7330
|
</xsl:if>
|
6699
7331
|
</xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
6700
7332
|
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
6701
|
-
</xsl:template><xsl:template match="*[local-name()='
|
7333
|
+
</xsl:template><xsl:template match="*[local-name()='dt']" mode="dl_if">
|
7334
|
+
<xsl:param name="id"/>
|
7335
|
+
<xsl:variable name="row_number" select="count(preceding-sibling::*[local-name()='dt']) + 1"/>
|
7336
|
+
<tr>
|
7337
|
+
<td>
|
7338
|
+
<xsl:copy-of select="node()"/>
|
7339
|
+
</td>
|
7340
|
+
<td>
|
7341
|
+
|
7342
|
+
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()"/>
|
7343
|
+
|
7344
|
+
</td>
|
7345
|
+
</tr>
|
7346
|
+
|
7347
|
+
</xsl:template><xsl:template match="*[local-name()='dd']" mode="dl_if"/><xsl:template match="*[local-name()='em']">
|
6702
7348
|
<fo:inline font-style="italic">
|
6703
7349
|
<xsl:apply-templates/>
|
6704
7350
|
</fo:inline>
|
6705
7351
|
</xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
|
7352
|
+
<xsl:param name="split_keep-within-line"/>
|
6706
7353
|
<fo:inline font-weight="bold">
|
6707
7354
|
|
6708
|
-
<xsl:apply-templates
|
7355
|
+
<xsl:apply-templates>
|
7356
|
+
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
|
7357
|
+
</xsl:apply-templates>
|
6709
7358
|
</fo:inline>
|
6710
7359
|
</xsl:template><xsl:template match="*[local-name()='padding']">
|
6711
7360
|
<fo:inline padding-right="{@value}"> </fo:inline>
|
@@ -6906,6 +7555,10 @@
|
|
6906
7555
|
<xsl:param name="text"/>
|
6907
7556
|
<xsl:param name="separator" select="' '"/>
|
6908
7557
|
<xsl:choose>
|
7558
|
+
|
7559
|
+
<xsl:when test="$isGenerateTableIF = 'true' and not(contains($text, $separator))">
|
7560
|
+
<word><xsl:value-of select="normalize-space($text)"/></word>
|
7561
|
+
</xsl:when>
|
6909
7562
|
<xsl:when test="not(contains($text, $separator))">
|
6910
7563
|
<word>
|
6911
7564
|
<xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
|
@@ -6950,13 +7603,66 @@
|
|
6950
7603
|
</xsl:when>
|
6951
7604
|
<xsl:otherwise>
|
6952
7605
|
<word>
|
6953
|
-
<xsl:
|
7606
|
+
<xsl:variable name="word" select="normalize-space(substring-before($text, $separator))"/>
|
7607
|
+
<xsl:choose>
|
7608
|
+
<xsl:when test="$isGenerateTableIF = 'true'">
|
7609
|
+
<xsl:value-of select="$word"/>
|
7610
|
+
</xsl:when>
|
7611
|
+
<xsl:otherwise>
|
7612
|
+
<xsl:value-of select="string-length($word)"/>
|
7613
|
+
</xsl:otherwise>
|
7614
|
+
</xsl:choose>
|
6954
7615
|
</word>
|
6955
7616
|
<xsl:call-template name="tokenize">
|
6956
7617
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
6957
7618
|
</xsl:call-template>
|
6958
7619
|
</xsl:otherwise>
|
6959
7620
|
</xsl:choose>
|
7621
|
+
</xsl:template><xsl:template name="tokenize_with_tags">
|
7622
|
+
<xsl:param name="tags"/>
|
7623
|
+
<xsl:param name="text"/>
|
7624
|
+
<xsl:param name="separator" select="' '"/>
|
7625
|
+
<xsl:choose>
|
7626
|
+
|
7627
|
+
<xsl:when test="not(contains($text, $separator))">
|
7628
|
+
<word>
|
7629
|
+
<xsl:call-template name="enclose_text_in_tags">
|
7630
|
+
<xsl:with-param name="text" select="normalize-space($text)"/>
|
7631
|
+
<xsl:with-param name="tags" select="$tags"/>
|
7632
|
+
</xsl:call-template>
|
7633
|
+
</word>
|
7634
|
+
</xsl:when>
|
7635
|
+
<xsl:otherwise>
|
7636
|
+
<word>
|
7637
|
+
<xsl:call-template name="enclose_text_in_tags">
|
7638
|
+
<xsl:with-param name="text" select="normalize-space(substring-before($text, $separator))"/>
|
7639
|
+
<xsl:with-param name="tags" select="$tags"/>
|
7640
|
+
</xsl:call-template>
|
7641
|
+
</word>
|
7642
|
+
<xsl:call-template name="tokenize_with_tags">
|
7643
|
+
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
7644
|
+
</xsl:call-template>
|
7645
|
+
</xsl:otherwise>
|
7646
|
+
</xsl:choose>
|
7647
|
+
</xsl:template><xsl:template name="enclose_text_in_tags">
|
7648
|
+
<xsl:param name="text"/>
|
7649
|
+
<xsl:param name="tags"/>
|
7650
|
+
<xsl:param name="num">1</xsl:param> <!-- default (start) value -->
|
7651
|
+
|
7652
|
+
<xsl:variable name="tag_name" select="normalize-space(xalan:nodeset($tags)//tag[$num])"/>
|
7653
|
+
|
7654
|
+
<xsl:choose>
|
7655
|
+
<xsl:when test="$tag_name = ''"><xsl:value-of select="$text"/></xsl:when>
|
7656
|
+
<xsl:otherwise>
|
7657
|
+
<xsl:element name="{$tag_name}">
|
7658
|
+
<xsl:call-template name="enclose_text_in_tags">
|
7659
|
+
<xsl:with-param name="text" select="$text"/>
|
7660
|
+
<xsl:with-param name="tags" select="$tags"/>
|
7661
|
+
<xsl:with-param name="num" select="$num + 1"/>
|
7662
|
+
</xsl:call-template>
|
7663
|
+
</xsl:element>
|
7664
|
+
</xsl:otherwise>
|
7665
|
+
</xsl:choose>
|
6960
7666
|
</xsl:template><xsl:template name="max_length">
|
6961
7667
|
<xsl:param name="words"/>
|
6962
7668
|
<xsl:for-each select="$words//word">
|
@@ -7057,12 +7763,19 @@
|
|
7057
7763
|
</xsl:otherwise>
|
7058
7764
|
</xsl:choose>
|
7059
7765
|
</xsl:template><xsl:template name="getSimpleTable">
|
7766
|
+
<xsl:param name="id"/>
|
7767
|
+
|
7060
7768
|
<xsl:variable name="simple-table">
|
7061
7769
|
|
7770
|
+
<!-- Step 0. replace <br/> to <p>...</p> -->
|
7771
|
+
<xsl:variable name="table_without_br">
|
7772
|
+
<xsl:apply-templates mode="table-without-br"/>
|
7773
|
+
</xsl:variable>
|
7774
|
+
|
7062
7775
|
<!-- Step 1. colspan processing -->
|
7063
7776
|
<xsl:variable name="simple-table-colspan">
|
7064
7777
|
<tbody>
|
7065
|
-
<xsl:apply-templates mode="simple-table-colspan"/>
|
7778
|
+
<xsl:apply-templates select="xalan:nodeset($table_without_br)" mode="simple-table-colspan"/>
|
7066
7779
|
</tbody>
|
7067
7780
|
</xsl:variable>
|
7068
7781
|
|
@@ -7071,10 +7784,67 @@
|
|
7071
7784
|
<xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
|
7072
7785
|
</xsl:variable>
|
7073
7786
|
|
7074
|
-
|
7075
|
-
|
7787
|
+
<!-- Step 3: add id to each cell -->
|
7788
|
+
<!-- add <word>...</word> for each word, image, math -->
|
7789
|
+
<xsl:variable name="simple-table-id">
|
7790
|
+
<xsl:apply-templates select="xalan:nodeset($simple-table-rowspan)" mode="simple-table-id">
|
7791
|
+
<xsl:with-param name="id" select="$id"/>
|
7792
|
+
</xsl:apply-templates>
|
7793
|
+
</xsl:variable>
|
7794
|
+
|
7795
|
+
<xsl:copy-of select="xalan:nodeset($simple-table-id)"/>
|
7796
|
+
|
7076
7797
|
</xsl:variable>
|
7077
7798
|
<xsl:copy-of select="$simple-table"/>
|
7799
|
+
</xsl:template><xsl:template match="@*|node()" mode="table-without-br">
|
7800
|
+
<xsl:copy>
|
7801
|
+
<xsl:apply-templates select="@*|node()" mode="table-without-br"/>
|
7802
|
+
</xsl:copy>
|
7803
|
+
</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">
|
7804
|
+
<xsl:copy>
|
7805
|
+
<xsl:copy-of select="@*"/>
|
7806
|
+
<p>
|
7807
|
+
<xsl:copy-of select="node()"/>
|
7808
|
+
</p>
|
7809
|
+
</xsl:copy>
|
7810
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td'][*[local-name()='br']]" mode="table-without-br">
|
7811
|
+
<xsl:copy>
|
7812
|
+
<xsl:copy-of select="@*"/>
|
7813
|
+
<xsl:for-each select="*[local-name()='br']">
|
7814
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
7815
|
+
<p>
|
7816
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
7817
|
+
<xsl:copy-of select="."/>
|
7818
|
+
</xsl:for-each>
|
7819
|
+
</p>
|
7820
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
7821
|
+
<p>
|
7822
|
+
<xsl:for-each select="following-sibling::node()">
|
7823
|
+
<xsl:copy-of select="."/>
|
7824
|
+
</xsl:for-each>
|
7825
|
+
</p>
|
7826
|
+
</xsl:if>
|
7827
|
+
</xsl:for-each>
|
7828
|
+
</xsl:copy>
|
7829
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'p'][*[local-name()='br']]" mode="table-without-br">
|
7830
|
+
<xsl:for-each select="*[local-name()='br']">
|
7831
|
+
<xsl:variable name="current_id" select="generate-id()"/>
|
7832
|
+
<p>
|
7833
|
+
<xsl:for-each select="preceding-sibling::node()[following-sibling::*[local-name() = 'br'][1][generate-id() = $current_id]][not(local-name() = 'br')]">
|
7834
|
+
<xsl:copy-of select="."/>
|
7835
|
+
</xsl:for-each>
|
7836
|
+
</p>
|
7837
|
+
<xsl:if test="not(following-sibling::*[local-name() = 'br'])">
|
7838
|
+
<p>
|
7839
|
+
<xsl:for-each select="following-sibling::node()">
|
7840
|
+
<xsl:copy-of select="."/>
|
7841
|
+
</xsl:for-each>
|
7842
|
+
</p>
|
7843
|
+
</xsl:if>
|
7844
|
+
</xsl:for-each>
|
7845
|
+
</xsl:template><xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
7846
|
+
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
7847
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
|
7078
7848
|
</xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
|
7079
7849
|
<xsl:apply-templates mode="simple-table-colspan"/>
|
7080
7850
|
</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">
|
@@ -7164,6 +7934,126 @@
|
|
7164
7934
|
<xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
|
7165
7935
|
<xsl:with-param name="previousRow" select="$newRow"/>
|
7166
7936
|
</xsl:apply-templates>
|
7937
|
+
</xsl:template><xsl:template match="/" mode="simple-table-id">
|
7938
|
+
<xsl:param name="id"/>
|
7939
|
+
<xsl:variable name="id_prefixed" select="concat('table_if_',$id)"/> <!-- table id prefixed by 'table_if_' to simple search in IF -->
|
7940
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
7941
|
+
<xsl:with-param name="id" select="$id_prefixed"/>
|
7942
|
+
</xsl:apply-templates>
|
7943
|
+
</xsl:template><xsl:template match="@*|node()" mode="simple-table-id">
|
7944
|
+
<xsl:param name="id"/>
|
7945
|
+
<xsl:copy>
|
7946
|
+
<xsl:apply-templates select="@*|node()" mode="simple-table-id">
|
7947
|
+
<xsl:with-param name="id" select="$id"/>
|
7948
|
+
</xsl:apply-templates>
|
7949
|
+
</xsl:copy>
|
7950
|
+
</xsl:template><xsl:template match="*[local-name()='tbody']" mode="simple-table-id">
|
7951
|
+
<xsl:param name="id"/>
|
7952
|
+
<xsl:copy>
|
7953
|
+
<xsl:copy-of select="@*"/>
|
7954
|
+
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
|
7955
|
+
<xsl:apply-templates select="node()" mode="simple-table-id">
|
7956
|
+
<xsl:with-param name="id" select="$id"/>
|
7957
|
+
</xsl:apply-templates>
|
7958
|
+
</xsl:copy>
|
7959
|
+
</xsl:template><xsl:template match="*[local-name()='th' or local-name()='td']" mode="simple-table-id">
|
7960
|
+
<xsl:param name="id"/>
|
7961
|
+
<xsl:copy>
|
7962
|
+
<xsl:copy-of select="@*"/>
|
7963
|
+
<xsl:variable name="row_number" select="count(../preceding-sibling::*) + 1"/>
|
7964
|
+
<xsl:variable name="col_number" select="count(preceding-sibling::*) + 1"/>
|
7965
|
+
<xsl:attribute name="id">
|
7966
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number)"/>
|
7967
|
+
</xsl:attribute>
|
7968
|
+
|
7969
|
+
<xsl:for-each select="*[local-name() = 'p']">
|
7970
|
+
<xsl:copy>
|
7971
|
+
<xsl:copy-of select="@*"/>
|
7972
|
+
<xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
|
7973
|
+
<xsl:attribute name="id">
|
7974
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num)"/>
|
7975
|
+
</xsl:attribute>
|
7976
|
+
|
7977
|
+
<xsl:copy-of select="node()"/>
|
7978
|
+
</xsl:copy>
|
7979
|
+
</xsl:for-each>
|
7980
|
+
|
7981
|
+
|
7982
|
+
<xsl:if test="$isGenerateTableIF = 'true'"> <!-- split each paragraph to words, image, math -->
|
7983
|
+
|
7984
|
+
<xsl:variable name="td_text">
|
7985
|
+
<xsl:apply-templates select="." mode="td_text_with_formatting"/>
|
7986
|
+
</xsl:variable>
|
7987
|
+
|
7988
|
+
<!-- td_text='<xsl:copy-of select="$td_text"/>' -->
|
7989
|
+
|
7990
|
+
<xsl:variable name="words">
|
7991
|
+
<xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
|
7992
|
+
<word>
|
7993
|
+
<xsl:copy-of select="."/>
|
7994
|
+
</word>
|
7995
|
+
</xsl:for-each>
|
7996
|
+
|
7997
|
+
<xsl:for-each select="xalan:nodeset($td_text)//*[local-name() = 'word'][normalize-space() != '']">
|
7998
|
+
<xsl:copy-of select="."/>
|
7999
|
+
</xsl:for-each>
|
8000
|
+
|
8001
|
+
</xsl:variable>
|
8002
|
+
|
8003
|
+
<xsl:for-each select="xalan:nodeset($words)/word">
|
8004
|
+
<xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
|
8005
|
+
<xsl:copy>
|
8006
|
+
<xsl:attribute name="id">
|
8007
|
+
<xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num)"/>
|
8008
|
+
</xsl:attribute>
|
8009
|
+
<xsl:copy-of select="node()"/>
|
8010
|
+
</xsl:copy>
|
8011
|
+
</xsl:for-each>
|
8012
|
+
</xsl:if>
|
8013
|
+
</xsl:copy>
|
8014
|
+
|
8015
|
+
</xsl:template><xsl:template match="@*|node()" mode="td_text_with_formatting">
|
8016
|
+
<xsl:copy>
|
8017
|
+
<xsl:apply-templates select="@*|node()" mode="td_text_with_formatting"/>
|
8018
|
+
</xsl:copy>
|
8019
|
+
</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">
|
8020
|
+
<xsl:variable name="formatting_tags">
|
8021
|
+
<xsl:call-template name="getFormattingTags"/>
|
8022
|
+
</xsl:variable>
|
8023
|
+
<word>
|
8024
|
+
<xsl:call-template name="enclose_text_in_tags">
|
8025
|
+
<xsl:with-param name="text" select="normalize-space(.)"/>
|
8026
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
8027
|
+
</xsl:call-template>
|
8028
|
+
</word>
|
8029
|
+
</xsl:template><xsl:template match="*[local-name() != 'keep-together_within-line']/text()" mode="td_text_with_formatting">
|
8030
|
+
|
8031
|
+
<xsl:variable name="td_text" select="."/>
|
8032
|
+
|
8033
|
+
<xsl:variable name="string_with_added_zerospaces">
|
8034
|
+
<xsl:call-template name="add-zero-spaces-java">
|
8035
|
+
<xsl:with-param name="text" select="$td_text"/>
|
8036
|
+
</xsl:call-template>
|
8037
|
+
</xsl:variable>
|
8038
|
+
|
8039
|
+
<xsl:variable name="formatting_tags">
|
8040
|
+
<xsl:call-template name="getFormattingTags"/>
|
8041
|
+
</xsl:variable>
|
8042
|
+
|
8043
|
+
<!-- <word>text</word> -->
|
8044
|
+
<xsl:call-template name="tokenize_with_tags">
|
8045
|
+
<xsl:with-param name="tags" select="$formatting_tags"/>
|
8046
|
+
<xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
|
8047
|
+
</xsl:call-template>
|
8048
|
+
</xsl:template><xsl:template name="getFormattingTags">
|
8049
|
+
<tags>
|
8050
|
+
<xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
|
8051
|
+
<xsl:if test="ancestor::*[local-name() = 'em']"><tag>em</tag></xsl:if>
|
8052
|
+
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
8053
|
+
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
8054
|
+
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
8055
|
+
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
8056
|
+
</tags>
|
7167
8057
|
</xsl:template><xsl:template name="getLang">
|
7168
8058
|
<xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
|
7169
8059
|
<xsl:variable name="language">
|
@@ -8920,7 +9810,9 @@
|
|
8920
9810
|
<!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
|
8921
9811
|
</xsl:if>
|
8922
9812
|
<xsl:variable name="simple-table">
|
8923
|
-
<xsl:call-template name="getSimpleTable"
|
9813
|
+
<xsl:call-template name="getSimpleTable">
|
9814
|
+
<xsl:with-param name="id" select="@id"/>
|
9815
|
+
</xsl:call-template>
|
8924
9816
|
</xsl:variable>
|
8925
9817
|
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
|
8926
9818
|
<xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
|
@@ -9879,7 +10771,7 @@
|
|
9879
10771
|
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
9880
10772
|
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
9881
10773
|
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
9882
|
-
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"> </xsl:if>
|
10774
|
+
<xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
|
9883
10775
|
</xsl:template><xsl:template match="*[local-name() = 'errata']">
|
9884
10776
|
<!-- <row>
|
9885
10777
|
<date>05-07-2013</date>
|
@@ -11240,4 +12132,40 @@
|
|
11240
12132
|
<xsl:value-of select="$value"/>
|
11241
12133
|
</xsl:otherwise>
|
11242
12134
|
</xsl:choose>
|
12135
|
+
</xsl:template><xsl:template match="*" mode="print_as_xml">
|
12136
|
+
<xsl:param name="level">0</xsl:param>
|
12137
|
+
|
12138
|
+
<fo:block margin-left="{2*$level}mm">
|
12139
|
+
<xsl:text>
|
12140
|
+
<</xsl:text>
|
12141
|
+
<xsl:value-of select="local-name()"/>
|
12142
|
+
<xsl:for-each select="@*">
|
12143
|
+
<xsl:text> </xsl:text>
|
12144
|
+
<xsl:value-of select="local-name()"/>
|
12145
|
+
<xsl:text>="</xsl:text>
|
12146
|
+
<xsl:value-of select="."/>
|
12147
|
+
<xsl:text>"</xsl:text>
|
12148
|
+
</xsl:for-each>
|
12149
|
+
<xsl:text>></xsl:text>
|
12150
|
+
|
12151
|
+
<xsl:if test="not(*)">
|
12152
|
+
<fo:inline font-weight="bold"><xsl:value-of select="."/></fo:inline>
|
12153
|
+
<xsl:text></</xsl:text>
|
12154
|
+
<xsl:value-of select="local-name()"/>
|
12155
|
+
<xsl:text>></xsl:text>
|
12156
|
+
</xsl:if>
|
12157
|
+
</fo:block>
|
12158
|
+
|
12159
|
+
<xsl:if test="*">
|
12160
|
+
<fo:block>
|
12161
|
+
<xsl:apply-templates mode="print_as_xml">
|
12162
|
+
<xsl:with-param name="level" select="$level + 1"/>
|
12163
|
+
</xsl:apply-templates>
|
12164
|
+
</fo:block>
|
12165
|
+
<fo:block margin-left="{2*$level}mm">
|
12166
|
+
<xsl:text></</xsl:text>
|
12167
|
+
<xsl:value-of select="local-name()"/>
|
12168
|
+
<xsl:text>></xsl:text>
|
12169
|
+
</fo:block>
|
12170
|
+
</xsl:if>
|
11243
12171
|
</xsl:template></xsl:stylesheet>
|