metanorma-iho 0.7.7 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1520,11 +1520,17 @@
1520
1520
  <!-- ========================== -->
1521
1521
  <!-- Definition's list styles -->
1522
1522
  <!-- ========================== -->
1523
+
1524
+ <xsl:attribute-set name="dl-block-style">
1525
+
1526
+ </xsl:attribute-set>
1527
+
1523
1528
  <xsl:attribute-set name="dt-row-style">
1524
1529
 
1525
1530
  </xsl:attribute-set>
1526
1531
 
1527
1532
  <xsl:attribute-set name="dt-cell-style">
1533
+
1528
1534
  </xsl:attribute-set>
1529
1535
 
1530
1536
  <xsl:attribute-set name="dt-block-style">
@@ -1544,6 +1550,7 @@
1544
1550
 
1545
1551
  <xsl:attribute-set name="dd-cell-style">
1546
1552
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
1553
+
1547
1554
  </xsl:attribute-set>
1548
1555
 
1549
1556
  <!-- ========================== -->
@@ -1559,6 +1566,7 @@
1559
1566
  </xsl:attribute-set>
1560
1567
 
1561
1568
  <xsl:attribute-set name="xref-style">
1569
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1562
1570
 
1563
1571
  <xsl:attribute name="color">blue</xsl:attribute>
1564
1572
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -1684,6 +1692,10 @@
1684
1692
 
1685
1693
  </xsl:attribute-set>
1686
1694
 
1695
+ <xsl:attribute-set name="figure-source-style">
1696
+
1697
+ </xsl:attribute-set>
1698
+
1687
1699
  <!-- Formula's styles -->
1688
1700
  <xsl:attribute-set name="formula-style">
1689
1701
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -2223,7 +2235,7 @@
2223
2235
 
2224
2236
  <xsl:template name="processTables_Contents">
2225
2237
  <tables>
2226
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2238
+ <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
2227
2239
  <table id="{@id}" alt-text="{*[local-name() = 'name']}">
2228
2240
  <xsl:copy-of select="*[local-name() = 'name']"/>
2229
2241
  </table>
@@ -2567,7 +2579,7 @@
2567
2579
  </xsl:attribute>
2568
2580
  </xsl:for-each>
2569
2581
 
2570
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2582
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2571
2583
  <xsl:if test="$isNoteOrFnExist = 'true'">
2572
2584
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2573
2585
  </xsl:if>
@@ -2611,7 +2623,7 @@
2611
2623
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2612
2624
  </xsl:when>
2613
2625
  <xsl:otherwise>
2614
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note and dl which render separaterely -->
2626
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
2615
2627
  </xsl:otherwise>
2616
2628
  </xsl:choose>
2617
2629
 
@@ -2715,6 +2727,11 @@
2715
2727
  </xsl:if>
2716
2728
  </xsl:template> <!-- table/name -->
2717
2729
 
2730
+ <!-- SOURCE: ... -->
2731
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2732
+ <xsl:call-template name="termsource"/>
2733
+ </xsl:template>
2734
+
2718
2735
  <xsl:template name="calculate-columns-numbers">
2719
2736
  <xsl:param name="table-row"/>
2720
2737
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
@@ -3071,7 +3088,7 @@
3071
3088
  </fo:table-header>
3072
3089
  </xsl:template> <!-- thead -->
3073
3090
 
3074
- <!-- template is using for iso, jcgm, bsi only -->
3091
+ <!-- template is using for iec, iso, jcgm, bsi only -->
3075
3092
  <xsl:template name="table-header-title">
3076
3093
  <xsl:param name="cols-count"/>
3077
3094
  <!-- row for title -->
@@ -3114,7 +3131,7 @@
3114
3131
  <xsl:param name="colwidths"/>
3115
3132
  <xsl:param name="colgroup"/>
3116
3133
 
3117
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3134
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
3118
3135
 
3119
3136
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3120
3137
 
@@ -3184,6 +3201,7 @@
3184
3201
 
3185
3202
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3186
3203
  <xsl:apply-templates select="../*[local-name()='note']"/>
3204
+ <xsl:apply-templates select="../*[local-name()='source']"/>
3187
3205
 
3188
3206
  <xsl:variable name="isDisplayRowSeparator">
3189
3207
 
@@ -3542,9 +3560,13 @@
3542
3560
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3543
3561
  </xsl:if>
3544
3562
 
3545
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3546
- <xsl:value-of select="$current_fn_number_text"/>
3547
- </fo:basic-link>
3563
+ <xsl:call-template name="insert_basic_link">
3564
+ <xsl:with-param name="element">
3565
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3566
+ <xsl:value-of select="$current_fn_number_text"/>
3567
+ </fo:basic-link>
3568
+ </xsl:with-param>
3569
+ </xsl:call-template>
3548
3570
  </fo:inline>
3549
3571
  </xsl:variable>
3550
3572
 
@@ -3816,7 +3838,7 @@
3816
3838
  <xsl:variable name="isAdded" select="@added"/>
3817
3839
  <xsl:variable name="isDeleted" select="@deleted"/>
3818
3840
  <!-- <dl><xsl:copy-of select="."/></dl> -->
3819
- <fo:block-container>
3841
+ <fo:block-container xsl:use-attribute-sets="dl-block-style">
3820
3842
 
3821
3843
  <xsl:call-template name="setBlockSpanAll"/>
3822
3844
 
@@ -3824,6 +3846,18 @@
3824
3846
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3825
3847
  </xsl:if>
3826
3848
 
3849
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
3850
+ <!-- set font-size as sourcecode font-size -->
3851
+ <xsl:variable name="sourcecode_attributes">
3852
+ <xsl:call-template name="get_sourcecode_attributes"/>
3853
+ </xsl:variable>
3854
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@font-size">
3855
+ <xsl:attribute name="{local-name()}">
3856
+ <xsl:value-of select="."/>
3857
+ </xsl:attribute>
3858
+ </xsl:for-each>
3859
+ </xsl:if>
3860
+
3827
3861
  <xsl:if test="parent::*[local-name() = 'note']">
3828
3862
  <xsl:attribute name="margin-left">
3829
3863
  <xsl:choose>
@@ -3865,8 +3899,10 @@
3865
3899
  <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
3866
3900
  <xsl:text> </xsl:text>
3867
3901
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3868
- <xsl:text/>
3869
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
3902
+ <xsl:if test="*[local-name()='dd']/node()[normalize-space() != ''][1][self::text()]">
3903
+ <xsl:text> </xsl:text>
3904
+ </xsl:if>
3905
+ <xsl:apply-templates select="*[local-name()='dd']/node()" mode="inline"/>
3870
3906
  </fo:block>
3871
3907
 
3872
3908
  </xsl:when> <!-- END: only one component -->
@@ -4263,6 +4299,7 @@
4263
4299
  <xsl:param name="split_keep-within-line"/>
4264
4300
 
4265
4301
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
4302
+
4266
4303
  <xsl:call-template name="insert_dt_cell">
4267
4304
  <xsl:with-param name="key_iso" select="$key_iso"/>
4268
4305
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -4284,6 +4321,7 @@
4284
4321
  <!-- border is mandatory, to calculate real width -->
4285
4322
  <xsl:attribute name="border">0.1pt solid black</xsl:attribute>
4286
4323
  <xsl:attribute name="text-align">left</xsl:attribute>
4324
+
4287
4325
  </xsl:if>
4288
4326
 
4289
4327
  <fo:block xsl:use-attribute-sets="dt-block-style">
@@ -4357,8 +4395,18 @@
4357
4395
  </xsl:if>
4358
4396
  </xsl:template>
4359
4397
 
4360
- <xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4361
- <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4398
+ <xsl:template match="*[local-name()='dd']/*" mode="inline">
4399
+ <xsl:variable name="is_inline_element_after_where">
4400
+ <xsl:if test="(local-name() = 'p') and not(preceding-sibling::node()[normalize-space() != ''])">true</xsl:if>
4401
+ </xsl:variable>
4402
+ <xsl:choose>
4403
+ <xsl:when test="$is_inline_element_after_where = 'true'">
4404
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
4405
+ </xsl:when>
4406
+ <xsl:otherwise>
4407
+ <xsl:apply-templates select="."/>
4408
+ </xsl:otherwise>
4409
+ </xsl:choose>
4362
4410
  </xsl:template>
4363
4411
 
4364
4412
  <!-- virtual html table for dl/[dt and dd] for IF (Intermediate Format) -->
@@ -4798,6 +4846,7 @@
4798
4846
  <fo:inline>
4799
4847
  <xsl:for-each select="$styles/style">
4800
4848
  <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4849
+
4801
4850
  </xsl:for-each>
4802
4851
  <xsl:apply-templates/>
4803
4852
  </fo:inline>
@@ -5857,6 +5906,79 @@
5857
5906
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
5858
5907
  </xsl:template>
5859
5908
 
5909
+ <!-- special case for:
5910
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
5911
+ <mstyle displaystyle="true">
5912
+ <msup>
5913
+ <mi color="#00000000">C</mi>
5914
+ <mtext>R</mtext>
5915
+ </msup>
5916
+ <msubsup>
5917
+ <mtext>C</mtext>
5918
+ <mi>n</mi>
5919
+ <mi>k</mi>
5920
+ </msubsup>
5921
+ </mstyle>
5922
+ </math>
5923
+ -->
5924
+ <xsl:template match="mathml:msup/mathml:mi[. = '‌' or . = ''][not(preceding-sibling::*)][following-sibling::mathml:mtext]" mode="mathml">
5925
+ <xsl:copy>
5926
+ <xsl:copy-of select="@*"/>
5927
+ <xsl:variable name="next_mtext" select="ancestor::mathml:msup/following-sibling::*[1][self::mathml:msubsup or self::mathml:msub or self::mathml:msup]/mathml:mtext"/>
5928
+ <xsl:if test="string-length($next_mtext) != ''">
5929
+ <xsl:attribute name="color">#00000000</xsl:attribute>
5930
+ </xsl:if>
5931
+ <xsl:apply-templates/>
5932
+ <xsl:value-of select="$next_mtext"/>
5933
+ </xsl:copy>
5934
+ </xsl:template>
5935
+
5936
+ <!-- special case for:
5937
+ <msup>
5938
+ <mtext/>
5939
+ <mn>1</mn>
5940
+ </msup>
5941
+ convert to (add mspace after mtext and enclose them into mrow):
5942
+ <msup>
5943
+ <mrow>
5944
+ <mtext/>
5945
+ <mspace height="1.47ex"/>
5946
+ </mrow>
5947
+ <mn>1</mn>
5948
+ </msup>
5949
+ -->
5950
+ <xsl:template match="mathml:msup/mathml:mtext[not(preceding-sibling::*)]" mode="mathml">
5951
+ <mathml:mrow>
5952
+ <xsl:copy-of select="."/>
5953
+ <mathml:mspace height="1.47ex"/>
5954
+ </mathml:mrow>
5955
+ </xsl:template>
5956
+
5957
+ <!-- add space around vertical line -->
5958
+ <xsl:template match="mathml:mo[normalize-space(text()) = '|']" mode="mathml">
5959
+ <xsl:copy>
5960
+ <xsl:apply-templates select="@*" mode="mathml"/>
5961
+ <xsl:if test="not(@lspace)">
5962
+ <xsl:attribute name="lspace">0.4em</xsl:attribute>
5963
+ </xsl:if>
5964
+ <xsl:if test="not(@rspace)">
5965
+ <xsl:attribute name="rspace">0.4em</xsl:attribute>
5966
+ </xsl:if>
5967
+ <xsl:apply-templates mode="mathml"/>
5968
+ </xsl:copy>
5969
+ </xsl:template>
5970
+
5971
+ <!-- decrease fontsize for 'Circled Times' char -->
5972
+ <xsl:template match="mathml:mo[normalize-space(text()) = '⊗']" mode="mathml">
5973
+ <xsl:copy>
5974
+ <xsl:apply-templates select="@*" mode="mathml"/>
5975
+ <xsl:if test="not(@fontsize)">
5976
+ <xsl:attribute name="fontsize">55%</xsl:attribute>
5977
+ </xsl:if>
5978
+ <xsl:apply-templates mode="mathml"/>
5979
+ </xsl:copy>
5980
+ </xsl:template>
5981
+
5860
5982
  <!-- Examples:
5861
5983
  <stem type="AsciiMath">x = 1</stem>
5862
5984
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -5914,19 +6036,23 @@
5914
6036
  <xsl:apply-templates/>
5915
6037
  </xsl:when>
5916
6038
  <xsl:otherwise>
5917
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
5918
- <xsl:choose>
5919
- <xsl:when test="normalize-space(.) = ''">
5920
- <xsl:call-template name="add-zero-spaces-link-java">
5921
- <xsl:with-param name="text" select="$target_text"/>
5922
- </xsl:call-template>
5923
- </xsl:when>
5924
- <xsl:otherwise>
5925
- <!-- output text from <link>text</link> -->
5926
- <xsl:apply-templates/>
5927
- </xsl:otherwise>
5928
- </xsl:choose>
5929
- </fo:basic-link>
6039
+ <xsl:call-template name="insert_basic_link">
6040
+ <xsl:with-param name="element">
6041
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6042
+ <xsl:choose>
6043
+ <xsl:when test="normalize-space(.) = ''">
6044
+ <xsl:call-template name="add-zero-spaces-link-java">
6045
+ <xsl:with-param name="text" select="$target_text"/>
6046
+ </xsl:call-template>
6047
+ </xsl:when>
6048
+ <xsl:otherwise>
6049
+ <!-- output text from <link>text</link> -->
6050
+ <xsl:apply-templates/>
6051
+ </xsl:otherwise>
6052
+ </xsl:choose>
6053
+ </fo:basic-link>
6054
+ </xsl:with-param>
6055
+ </xsl:call-template>
5930
6056
  </xsl:otherwise>
5931
6057
  </xsl:choose>
5932
6058
  </fo:inline>
@@ -5989,12 +6115,16 @@
5989
6115
  </xsl:template>
5990
6116
 
5991
6117
  <xsl:template match="*[local-name() = 'xref']">
5992
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5993
- <xsl:if test="parent::*[local-name() = 'add']">
5994
- <xsl:call-template name="append_add-style"/>
5995
- </xsl:if>
5996
- <xsl:apply-templates/>
5997
- </fo:basic-link>
6118
+ <xsl:call-template name="insert_basic_link">
6119
+ <xsl:with-param name="element">
6120
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
6121
+ <xsl:if test="parent::*[local-name() = 'add']">
6122
+ <xsl:call-template name="append_add-style"/>
6123
+ </xsl:if>
6124
+ <xsl:apply-templates/>
6125
+ </fo:basic-link>
6126
+ </xsl:with-param>
6127
+ </xsl:call-template>
5998
6128
  </xsl:template>
5999
6129
 
6000
6130
  <!-- ====== -->
@@ -6297,6 +6427,13 @@
6297
6427
  </fo:block>
6298
6428
  </xsl:template>
6299
6429
 
6430
+ <!-- SOURCE: ... -->
6431
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
6432
+
6433
+ <xsl:call-template name="termsource"/>
6434
+
6435
+ </xsl:template>
6436
+
6300
6437
  <xsl:template match="*[local-name() = 'image']">
6301
6438
  <xsl:variable name="isAdded" select="../@added"/>
6302
6439
  <xsl:variable name="isDeleted" select="../@deleted"/>
@@ -6370,7 +6507,7 @@
6370
6507
  <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6371
6508
  </xsl:when>
6372
6509
  <xsl:when test="not(starts-with(@src, 'data:'))">
6373
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6510
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6374
6511
  </xsl:when>
6375
6512
  <xsl:otherwise>
6376
6513
  <xsl:value-of select="@src"/>
@@ -6392,7 +6529,7 @@
6392
6529
  </xsl:when>
6393
6530
  <xsl:when test="not(starts-with(@src, 'data:'))">
6394
6531
  <xsl:variable name="src">
6395
- <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
6532
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
6396
6533
  </xsl:variable>
6397
6534
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
6398
6535
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -6778,15 +6915,19 @@
6778
6915
  <xsl:param name="dest"/>
6779
6916
  <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
6780
6917
  <fo:block font-size="1pt">
6781
- <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6782
- <fo:inline-container inline-progression-dimension="100%">
6783
- <fo:block-container height="{$height - 1}px" width="100%">
6784
- <!-- DEBUG <xsl:if test="local-name()='polygon'">
6785
- <xsl:attribute name="background-color">magenta</xsl:attribute>
6786
- </xsl:if> -->
6787
- <fo:block> </fo:block></fo:block-container>
6788
- </fo:inline-container>
6789
- </fo:basic-link>
6918
+ <xsl:call-template name="insert_basic_link">
6919
+ <xsl:with-param name="element">
6920
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
6921
+ <fo:inline-container inline-progression-dimension="100%">
6922
+ <fo:block-container height="{$height - 1}px" width="100%">
6923
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
6924
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
6925
+ </xsl:if> -->
6926
+ <fo:block> </fo:block></fo:block-container>
6927
+ </fo:inline-container>
6928
+ </fo:basic-link>
6929
+ </xsl:with-param>
6930
+ </xsl:call-template>
6790
6931
  </fo:block>
6791
6932
  </fo:block-container>
6792
6933
  </xsl:template>
@@ -7427,9 +7568,11 @@
7427
7568
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7428
7569
  </xsl:if>
7429
7570
 
7430
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
7571
+ <xsl:apply-templates select="node()[not(local-name() = 'name' or local-name() = 'dl')]"/>
7431
7572
  </fo:block>
7432
7573
 
7574
+ <xsl:apply-templates select="*[local-name() = 'dl']"/> <!-- Key table -->
7575
+
7433
7576
  <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
7434
7577
 
7435
7578
  </fo:block-container>
@@ -7461,11 +7604,22 @@
7461
7604
  <!-- add sourcecode highlighting -->
7462
7605
  <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7463
7606
  <xsl:variable name="class" select="@class"/>
7607
+
7608
+ <!-- Example: <1> -->
7609
+ <xsl:variable name="is_callout">
7610
+ <xsl:if test="parent::*[local-name() = 'dt']">
7611
+ <xsl:variable name="dt_id" select="../@id"/>
7612
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']//*[local-name() = 'callout'][@target = $dt_id]">true</xsl:if>
7613
+ </xsl:if>
7614
+ </xsl:variable>
7615
+
7464
7616
  <xsl:choose>
7465
7617
  <xsl:when test="$sourcecode_css//class[@name = $class]">
7466
7618
  <fo:inline>
7467
7619
  <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7620
+ <xsl:if test="$is_callout = 'true'">&lt;</xsl:if>
7468
7621
  <xsl:apply-templates/>
7622
+ <xsl:if test="$is_callout = 'true'">&gt;</xsl:if>
7469
7623
  </fo:inline>
7470
7624
  </xsl:when>
7471
7625
  <xsl:otherwise>
@@ -7889,6 +8043,10 @@
7889
8043
  </fo:block>
7890
8044
  </xsl:template>
7891
8045
 
8046
+ <xsl:template match="*[local-name() = 'div']">
8047
+ <fo:block><xsl:apply-templates/></fo:block>
8048
+ </xsl:template>
8049
+
7892
8050
  <xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit'] | *[local-name() = 'div'][@type = 'requirement-inherit'] | *[local-name() = 'div'][@type = 'recommendation-inherit'] | *[local-name() = 'div'][@type = 'permission-inherit']">
7893
8051
  <fo:block xsl:use-attribute-sets="inherit-style">
7894
8052
  <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
@@ -8314,14 +8472,18 @@
8314
8472
  </xsl:template>
8315
8473
 
8316
8474
  <xsl:template match="*[local-name() = 'origin']">
8317
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8318
- <xsl:if test="normalize-space(@citeas) = ''">
8319
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8320
- </xsl:if>
8321
- <fo:inline xsl:use-attribute-sets="origin-style">
8322
- <xsl:apply-templates/>
8323
- </fo:inline>
8324
- </fo:basic-link>
8475
+ <xsl:call-template name="insert_basic_link">
8476
+ <xsl:with-param name="element">
8477
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8478
+ <xsl:if test="normalize-space(@citeas) = ''">
8479
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8480
+ </xsl:if>
8481
+ <fo:inline xsl:use-attribute-sets="origin-style">
8482
+ <xsl:apply-templates/>
8483
+ </fo:inline>
8484
+ </fo:basic-link>
8485
+ </xsl:with-param>
8486
+ </xsl:call-template>
8325
8487
  </xsl:template>
8326
8488
 
8327
8489
  <!-- not using, see https://github.com/glossarist/iev-document/issues/23 -->
@@ -8395,9 +8557,13 @@
8395
8557
  <xsl:if test="../*[local-name() = 'author']">
8396
8558
  <xsl:text>, </xsl:text>
8397
8559
  </xsl:if>
8398
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8399
- <xsl:apply-templates/>
8400
- </fo:basic-link>
8560
+ <xsl:call-template name="insert_basic_link">
8561
+ <xsl:with-param name="element">
8562
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
8563
+ <xsl:apply-templates/>
8564
+ </fo:basic-link>
8565
+ </xsl:with-param>
8566
+ </xsl:call-template>
8401
8567
  </xsl:template>
8402
8568
 
8403
8569
  <xsl:template match="*[local-name() = 'author']">
@@ -8446,28 +8612,32 @@
8446
8612
  <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
8447
8613
  <xsl:variable name="text" select="normalize-space()"/>
8448
8614
 
8449
- <fo:basic-link fox:alt-text="{@citeas}">
8450
- <xsl:if test="normalize-space(@citeas) = ''">
8451
- <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8452
- </xsl:if>
8453
- <xsl:if test="@type = 'inline'">
8615
+ <xsl:call-template name="insert_basic_link">
8616
+ <xsl:with-param name="element">
8617
+ <fo:basic-link fox:alt-text="{@citeas}">
8618
+ <xsl:if test="normalize-space(@citeas) = ''">
8619
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
8620
+ </xsl:if>
8621
+ <xsl:if test="@type = 'inline'">
8454
8622
 
8455
- <xsl:attribute name="color">blue</xsl:attribute>
8456
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
8623
+ <xsl:attribute name="color">blue</xsl:attribute>
8624
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
8457
8625
 
8458
- </xsl:if>
8626
+ </xsl:if>
8459
8627
 
8460
- <xsl:choose>
8461
- <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8462
- <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8463
- </xsl:when>
8464
- <xsl:otherwise>
8465
- <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8466
- </xsl:otherwise>
8467
- </xsl:choose>
8628
+ <xsl:choose>
8629
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
8630
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
8631
+ </xsl:when>
8632
+ <xsl:otherwise>
8633
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
8634
+ </xsl:otherwise>
8635
+ </xsl:choose>
8468
8636
 
8469
- <xsl:apply-templates/>
8470
- </fo:basic-link>
8637
+ <xsl:apply-templates/>
8638
+ </fo:basic-link>
8639
+ </xsl:with-param>
8640
+ </xsl:call-template>
8471
8641
 
8472
8642
  </fo:inline>
8473
8643
  </xsl:when>
@@ -8584,13 +8754,8 @@
8584
8754
  </xsl:template>
8585
8755
 
8586
8756
  <xsl:template match="*[local-name() = 'deprecates']">
8587
- <xsl:variable name="title-deprecated">
8588
- <xsl:call-template name="getLocalizedString">
8589
- <xsl:with-param name="key">deprecated</xsl:with-param>
8590
- </xsl:call-template>
8591
- </xsl:variable>
8592
8757
  <fo:block xsl:use-attribute-sets="deprecates-style">
8593
- <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
8758
+ <xsl:apply-templates/>
8594
8759
  </fo:block>
8595
8760
  </xsl:template>
8596
8761
 
@@ -8711,7 +8876,10 @@
8711
8876
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
8712
8877
 
8713
8878
  <xsl:template name="setULLabel">
8714
- <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8879
+ <xsl:variable name="list_level__">
8880
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
8881
+ </xsl:variable>
8882
+ <xsl:variable name="list_level_" select="number($list_level__)"/>
8715
8883
  <xsl:variable name="list_level">
8716
8884
  <xsl:choose>
8717
8885
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
@@ -8844,9 +9012,11 @@
8844
9012
  </fo:block-container>
8845
9013
  </xsl:when>
8846
9014
  <xsl:otherwise>
8847
- <fo:block>
8848
- <xsl:apply-templates select="." mode="list"/>
8849
- </fo:block>
9015
+
9016
+ <fo:block>
9017
+ <xsl:apply-templates select="." mode="list"/>
9018
+ </fo:block>
9019
+
8850
9020
  </xsl:otherwise>
8851
9021
  </xsl:choose>
8852
9022
  </xsl:template>
@@ -9536,24 +9706,32 @@
9536
9706
  <xsl:for-each select="*[local-name() = 'tab']">
9537
9707
  <xsl:variable name="current_id" select="generate-id()"/>
9538
9708
  <fo:table-cell>
9539
- <fo:block>
9540
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9541
- <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9542
- <xsl:choose>
9543
- <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9544
- <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9545
- </xsl:choose>
9546
- </xsl:for-each>
9547
- </fo:basic-link>
9709
+ <fo:block line-height-shift-adjustment="disregard-shifts">
9710
+ <xsl:call-template name="insert_basic_link">
9711
+ <xsl:with-param name="element">
9712
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9713
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
9714
+ <xsl:choose>
9715
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
9716
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
9717
+ </xsl:choose>
9718
+ </xsl:for-each>
9719
+ </fo:basic-link>
9720
+ </xsl:with-param>
9721
+ </xsl:call-template>
9548
9722
  </fo:block>
9549
9723
  </fo:table-cell>
9550
9724
  </xsl:for-each>
9551
9725
  <!-- last column - for page numbers -->
9552
9726
  <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
9553
9727
  <fo:block>
9554
- <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9555
- <fo:page-number-citation ref-id="{$target}"/>
9556
- </fo:basic-link>
9728
+ <xsl:call-template name="insert_basic_link">
9729
+ <xsl:with-param name="element">
9730
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
9731
+ <fo:page-number-citation ref-id="{$target}"/>
9732
+ </fo:basic-link>
9733
+ </xsl:with-param>
9734
+ </xsl:call-template>
9557
9735
  </fo:block>
9558
9736
  </fo:table-cell>
9559
9737
  </xsl:template>
@@ -9595,6 +9773,27 @@
9595
9773
  <!-- End Table of Contents (ToC) processing -->
9596
9774
  <!-- =================== -->
9597
9775
 
9776
+ <!-- insert fo:basic-link, if external-destination or internal-destination is non-empty, otherwise insert fo:inline -->
9777
+ <xsl:template name="insert_basic_link">
9778
+ <xsl:param name="element"/>
9779
+ <xsl:variable name="element_node" select="xalan:nodeset($element)"/>
9780
+ <xsl:variable name="external-destination" select="normalize-space(count($element_node/fo:basic-link/@external-destination[. != '']) = 1)"/>
9781
+ <xsl:variable name="internal-destination" select="normalize-space(count($element_node/fo:basic-link/@internal-destination[. != '']) = 1)"/>
9782
+ <xsl:choose>
9783
+ <xsl:when test="$external-destination = 'true' or $internal-destination = 'true'">
9784
+ <xsl:copy-of select="$element_node"/>
9785
+ </xsl:when>
9786
+ <xsl:otherwise>
9787
+ <fo:inline>
9788
+ <xsl:for-each select="$element_node/fo:basic-link/@*[local-name() != 'external-destination' and local-name() != 'internal-destination' and local-name() != 'alt-text']">
9789
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
9790
+ </xsl:for-each>
9791
+ <xsl:copy-of select="$element_node/fo:basic-link/node()"/>
9792
+ </fo:inline>
9793
+ </xsl:otherwise>
9794
+ </xsl:choose>
9795
+ </xsl:template>
9796
+
9598
9797
  <xsl:template match="*[local-name() = 'variant-title']"/> <!-- [@type = 'sub'] -->
9599
9798
  <xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9600
9799
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -9814,6 +10013,23 @@
9814
10013
  <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_step1">
9815
10014
  <xsl:copy-of select="."/>
9816
10015
  </xsl:template>
10016
+
10017
+ <!-- add @id, redundant for table auto-layout algorithm -->
10018
+ <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
10019
+ <xsl:copy>
10020
+ <xsl:copy-of select="@*"/>
10021
+ <xsl:call-template name="add_id"/>
10022
+ <xsl:apply-templates mode="update_xml_step1"/>
10023
+ </xsl:copy>
10024
+ </xsl:template>
10025
+
10026
+ <xsl:template name="add_id">
10027
+ <xsl:if test="not(@id)">
10028
+ <!-- add @id - first element with @id plus '_element_name' -->
10029
+ <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
10030
+ </xsl:if>
10031
+ </xsl:template>
10032
+
9817
10033
  <!-- =========================================================================== -->
9818
10034
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9819
10035
  <!-- =========================================================================== -->