metanorma-iho 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74009f28ae0e8d7d53ae1ba871d3d343cb343e2c907455d50507de29ef3824d9
4
- data.tar.gz: 25ec650bf51cdcbb5fab99d9ba8716dcd25b2b301f05f384daf55efa19aa3e1d
3
+ metadata.gz: a004b35531809df73115ec0a8091609c5fba1f0ff3047c3872cdd78f999860dd
4
+ data.tar.gz: 39efd220edea91cec2953ab1b15a54564afad01ab81318ae2a11a0892d3346a5
5
5
  SHA512:
6
- metadata.gz: 7aa71c58b70bf5a1cf8f3c3b5f6c4a6606f2fafbb5683719b3601e3485a81ce297f7f1f1bcfc551b867999636824825ba8e2d357360e8019e3d1b73eaae17482
7
- data.tar.gz: 5551240737a8d2ec9f765fcf4db38b33916c81ae0a3f8ca977f6418fa29793d1cda0ec3e943c5aea94337760bc5e6b0fca29a8b86929a062fde7302f551062ed
6
+ metadata.gz: 681c2073b4d051acddaa7569cd4f3a522f2e17c5245e1e68e381fa69c7d82ede83d760f78156f33df04b9641bc7f88d7ebb5a6ae05239169d0493c43b42b2f06
7
+ data.tar.gz: 96155b68694666a1c1084126a9c58c728d62bfa67b2f7a52a97ff0118cf8693025bb5648a9a617dc6ffd653689e4362695659cbf3aeddcb2a0fff7a6216fe7be
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
19
+ ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  steps:
@@ -955,7 +955,24 @@
955
955
  <define name="concept">
956
956
  <element name="concept">
957
957
  <optional>
958
- <attribute name="term"/>
958
+ <element name="refterm">
959
+ <zeroOrMore>
960
+ <choice>
961
+ <ref name="PureTextElement"/>
962
+ <ref name="stem"/>
963
+ </choice>
964
+ </zeroOrMore>
965
+ </element>
966
+ </optional>
967
+ <optional>
968
+ <element name="renderterm">
969
+ <zeroOrMore>
970
+ <choice>
971
+ <ref name="PureTextElement"/>
972
+ <ref name="stem"/>
973
+ </choice>
974
+ </zeroOrMore>
975
+ </element>
959
976
  </optional>
960
977
  <choice>
961
978
  <ref name="eref"/>
@@ -15,8 +15,13 @@
15
15
 
16
16
 
17
17
  <xsl:variable name="debug">false</xsl:variable>
18
- <xsl:variable name="pageWidth" select="'210mm'"/>
19
- <xsl:variable name="pageHeight" select="'297mm'"/>
18
+ <xsl:variable name="pageWidth" select="210"/>
19
+ <xsl:variable name="pageHeight" select="297"/>
20
+ <xsl:variable name="marginLeftRight1" select="25.4"/>
21
+ <xsl:variable name="marginLeftRight2" select="25.4"/>
22
+ <xsl:variable name="marginTop" select="25.4"/>
23
+ <xsl:variable name="marginBottom" select="25.4"/>
24
+
20
25
 
21
26
  <xsl:variable name="title-en" select="/iho:iho-standard/iho:bibdata/iho:title[@language = 'en']"/>
22
27
  <xsl:variable name="docidentifier" select="/iho:iho-standard/iho:bibdata/iho:docidentifier[@type = 'IHO']"/>
@@ -43,44 +48,44 @@
43
48
  <fo:root font-family="Arial, Cambria Math" font-size="12pt" xml:lang="{$lang}">
44
49
  <fo:layout-master-set>
45
50
  <!-- cover page -->
46
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
51
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
47
52
  <fo:region-body margin-top="0mm" margin-bottom="5mm" margin-left="0mm" margin-right="5mm"/>
48
53
  </fo:simple-page-master>
49
54
 
50
- <fo:simple-page-master master-name="first" page-width="{$pageWidth}" page-height="{$pageHeight}">
51
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
52
- <fo:region-before region-name="header" extent="25.4mm"/>
53
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
54
- <fo:region-start region-name="left-region" extent="25.4mm"/>
55
- <fo:region-end region-name="right-region" extent="25.4mm"/>
55
+ <fo:simple-page-master master-name="first" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
56
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
57
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
58
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
59
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
60
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
56
61
  </fo:simple-page-master>
57
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
58
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
59
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
60
- <fo:region-after region-name="footer-odd" extent="25.4mm"/>
61
- <fo:region-start region-name="left-region" extent="25.4mm"/>
62
- <fo:region-end region-name="right-region" extent="25.4mm"/>
62
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
63
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
64
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
65
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
66
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
67
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
63
68
  </fo:simple-page-master>
64
- <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}">
65
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
66
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
67
- <fo:region-after region-name="footer-odd" extent="25.4mm"/>
68
- <fo:region-start region-name="left-region" extent="25.4mm"/>
69
- <fo:region-end region-name="right-region" extent="25.4mm"/>
69
+ <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
70
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
71
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
72
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
73
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
74
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
70
75
  </fo:simple-page-master>
71
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
72
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
73
- <fo:region-before region-name="header-even" extent="25.4mm"/>
74
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
75
- <fo:region-start region-name="left-region" extent="25.4mm"/>
76
- <fo:region-end region-name="right-region" extent="25.4mm"/>
76
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
77
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
78
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
79
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
80
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
81
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
77
82
  </fo:simple-page-master>
78
- <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}">
79
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
80
- <fo:region-before region-name="header-even" extent="25.4mm"/>
81
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
82
- <fo:region-start region-name="left-region" extent="25.4mm"/>
83
- <fo:region-end region-name="right-region" extent="25.4mm"/>
83
+ <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
84
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
85
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
86
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
87
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
88
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
84
89
  </fo:simple-page-master>
85
90
  <!-- Preface pages -->
86
91
  <fo:page-sequence-master master-name="preface">
@@ -1288,6 +1293,7 @@
1288
1293
 
1289
1294
 
1290
1295
 
1296
+
1291
1297
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1292
1298
 
1293
1299
 
@@ -1510,14 +1516,15 @@
1510
1516
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1511
1517
 
1512
1518
  <!-- Normative references -->
1513
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1519
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/>
1514
1520
  <!-- Terms and definitions -->
1515
1521
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
1516
1522
  <!-- Another main sections -->
1517
1523
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
1518
1524
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1519
1525
  <!-- Bibliography -->
1520
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1526
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
1527
+
1521
1528
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1522
1529
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1523
1530
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -2298,6 +2305,7 @@
2298
2305
 
2299
2306
 
2300
2307
 
2308
+
2301
2309
  <xsl:if test=".//*[local-name() = 'table']">
2302
2310
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2303
2311
  </xsl:if>
@@ -2329,6 +2337,7 @@
2329
2337
 
2330
2338
 
2331
2339
 
2340
+
2332
2341
  <fo:inline padding-right="2mm">
2333
2342
 
2334
2343
 
@@ -2375,6 +2384,7 @@
2375
2384
 
2376
2385
 
2377
2386
 
2387
+
2378
2388
  <xsl:value-of select="@reference"/>
2379
2389
 
2380
2390
 
@@ -2519,6 +2529,9 @@
2519
2529
 
2520
2530
 
2521
2531
 
2532
+
2533
+
2534
+
2522
2535
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2523
2536
 
2524
2537
 
@@ -3425,6 +3438,7 @@
3425
3438
  <fo:inline xsl:use-attribute-sets="link-style">
3426
3439
 
3427
3440
 
3441
+
3428
3442
  <xsl:choose>
3429
3443
  <xsl:when test="$target_text = ''">
3430
3444
  <xsl:apply-templates/>
@@ -3777,6 +3791,234 @@
3777
3791
  <xsl:param name="height"/>
3778
3792
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3779
3793
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3794
+ </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
3795
+ <xsl:param name="name"/>
3796
+
3797
+ <xsl:variable name="svg_content">
3798
+ <xsl:apply-templates select="." mode="svg_update"/>
3799
+ </xsl:variable>
3800
+
3801
+ <xsl:variable name="alt-text">
3802
+ <xsl:choose>
3803
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3804
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3805
+ </xsl:when>
3806
+ <xsl:when test="normalize-space($name) != ''">
3807
+ <xsl:value-of select="$name"/>
3808
+ </xsl:when>
3809
+ <xsl:otherwise>Figure</xsl:otherwise>
3810
+ </xsl:choose>
3811
+ </xsl:variable>
3812
+
3813
+ <xsl:choose>
3814
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3815
+ <fo:block>
3816
+ <xsl:variable name="width" select="@width"/>
3817
+ <xsl:variable name="height" select="@height"/>
3818
+
3819
+ <xsl:variable name="scale_x">
3820
+ <xsl:choose>
3821
+ <xsl:when test="$width &gt; $width_effective_px">
3822
+ <xsl:value-of select="$width_effective_px div $width"/>
3823
+ </xsl:when>
3824
+ <xsl:otherwise>1</xsl:otherwise>
3825
+ </xsl:choose>
3826
+ </xsl:variable>
3827
+
3828
+ <xsl:variable name="scale_y">
3829
+ <xsl:choose>
3830
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3831
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3832
+ </xsl:when>
3833
+ <xsl:otherwise>1</xsl:otherwise>
3834
+ </xsl:choose>
3835
+ </xsl:variable>
3836
+
3837
+ <xsl:variable name="scale">
3838
+ <xsl:choose>
3839
+ <xsl:when test="$scale_y != 1">
3840
+ <xsl:value-of select="$scale_x * $scale_y"/>
3841
+ </xsl:when>
3842
+ <xsl:otherwise>
3843
+ <xsl:value-of select="$scale_x"/>
3844
+ </xsl:otherwise>
3845
+ </xsl:choose>
3846
+ </xsl:variable>
3847
+
3848
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3849
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3850
+
3851
+ <fo:table table-layout="fixed" width="100%">
3852
+ <fo:table-column column-width="proportional-column-width(1)"/>
3853
+ <fo:table-column column-width="{$width_scale}px"/>
3854
+ <fo:table-column column-width="proportional-column-width(1)"/>
3855
+ <fo:table-body>
3856
+ <fo:table-row>
3857
+ <fo:table-cell column-number="2">
3858
+ <fo:block>
3859
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3860
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3861
+ <fo:block line-height="0" font-size="0">
3862
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3863
+ <xsl:call-template name="bookmark"/>
3864
+ </xsl:for-each>
3865
+ </fo:block>
3866
+ </xsl:if>
3867
+ <fo:block text-depth="0" line-height="0" font-size="0">
3868
+
3869
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3870
+ <xsl:attribute name="width">100%</xsl:attribute>
3871
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3872
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3873
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3874
+
3875
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3876
+ </fo:instream-foreign-object>
3877
+ </fo:block>
3878
+
3879
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
3880
+ <xsl:with-param name="scale" select="$scale"/>
3881
+ </xsl:apply-templates>
3882
+ </fo:block-container>
3883
+ </fo:block>
3884
+ </fo:table-cell>
3885
+ </fo:table-row>
3886
+ </fo:table-body>
3887
+ </fo:table>
3888
+ </fo:block>
3889
+
3890
+ </xsl:when>
3891
+ <xsl:otherwise>
3892
+ <fo:block xsl:use-attribute-sets="image-style">
3893
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3894
+ <xsl:attribute name="width">100%</xsl:attribute>
3895
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3896
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3897
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3898
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3899
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3900
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3901
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3902
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3903
+ </xsl:if>
3904
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3905
+ <xsl:copy-of select="$svg_content"/>
3906
+ </fo:instream-foreign-object>
3907
+ </fo:block>
3908
+ </xsl:otherwise>
3909
+ </xsl:choose>
3910
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3911
+ <xsl:copy>
3912
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3913
+ </xsl:copy>
3914
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3915
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3916
+ <xsl:value-of select="."/>
3917
+ </xsl:attribute>
3918
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3919
+ <xsl:variable name="svg_content" select="document(@src)"/>
3920
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3921
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3922
+ <xsl:call-template name="image_svg">
3923
+ <xsl:with-param name="name" select="$name"/>
3924
+ </xsl:call-template>
3925
+ </xsl:for-each>
3926
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3927
+ <xsl:copy>
3928
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3929
+ </xsl:copy>
3930
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3931
+ <xsl:apply-templates mode="svg_remove_a"/>
3932
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3933
+ <xsl:param name="scale"/>
3934
+ <xsl:variable name="dest">
3935
+ <xsl:choose>
3936
+ <xsl:when test="starts-with(@href, '#')">
3937
+ <xsl:value-of select="substring-after(@href, '#')"/>
3938
+ </xsl:when>
3939
+ <xsl:otherwise>
3940
+ <xsl:value-of select="@href"/>
3941
+ </xsl:otherwise>
3942
+ </xsl:choose>
3943
+ </xsl:variable>
3944
+ <xsl:for-each select="./*[local-name() = 'rect']">
3945
+ <xsl:call-template name="insertSVGMapLink">
3946
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3947
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3948
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3949
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3950
+ <xsl:with-param name="dest" select="$dest"/>
3951
+ </xsl:call-template>
3952
+ </xsl:for-each>
3953
+
3954
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3955
+ <xsl:variable name="points">
3956
+ <xsl:call-template name="split">
3957
+ <xsl:with-param name="pText" select="@points"/>
3958
+ </xsl:call-template>
3959
+ </xsl:variable>
3960
+ <xsl:variable name="x_coords">
3961
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3962
+ <xsl:sort select="." data-type="number"/>
3963
+ <x><xsl:value-of select="."/></x>
3964
+ </xsl:for-each>
3965
+ </xsl:variable>
3966
+ <xsl:variable name="y_coords">
3967
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3968
+ <xsl:sort select="." data-type="number"/>
3969
+ <y><xsl:value-of select="."/></y>
3970
+ </xsl:for-each>
3971
+ </xsl:variable>
3972
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3973
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3974
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3975
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3976
+ <xsl:call-template name="insertSVGMapLink">
3977
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3978
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3979
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3980
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3981
+ <xsl:with-param name="dest" select="$dest"/>
3982
+ </xsl:call-template>
3983
+ </xsl:for-each>
3984
+
3985
+ <xsl:for-each select="./*[local-name() = 'circle']">
3986
+ <xsl:call-template name="insertSVGMapLink">
3987
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3988
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3989
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3990
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3991
+ <xsl:with-param name="dest" select="$dest"/>
3992
+ </xsl:call-template>
3993
+ </xsl:for-each>
3994
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3995
+ <xsl:call-template name="insertSVGMapLink">
3996
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3997
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3998
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3999
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
4000
+ <xsl:with-param name="dest" select="$dest"/>
4001
+ </xsl:call-template>
4002
+ </xsl:for-each>
4003
+ </xsl:template><xsl:template name="insertSVGMapLink">
4004
+ <xsl:param name="left"/>
4005
+ <xsl:param name="top"/>
4006
+ <xsl:param name="width"/>
4007
+ <xsl:param name="height"/>
4008
+ <xsl:param name="dest"/>
4009
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
4010
+ <fo:block font-size="1pt">
4011
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4012
+ <fo:inline-container inline-progression-dimension="100%">
4013
+ <fo:block-container height="{$height - 1}px" width="100%">
4014
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4015
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4016
+ </xsl:if> -->
4017
+ <fo:block> </fo:block></fo:block-container>
4018
+ </fo:inline-container>
4019
+ </fo:basic-link>
4020
+ </fo:block>
4021
+ </fo:block-container>
3780
4022
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
3781
4023
  <xsl:apply-templates mode="contents"/>
3782
4024
  <xsl:text> </xsl:text>
@@ -3805,28 +4047,39 @@
3805
4047
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3806
4048
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3807
4049
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4050
+ <xsl:if test="@bundle = 'true'">
4051
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4052
+ </xsl:if>
3808
4053
  <fo:bookmark-title>
3809
- <xsl:variable name="bookmark-title_">
3810
- <xsl:call-template name="getLangVersion">
3811
- <xsl:with-param name="lang" select="@lang"/>
3812
- <xsl:with-param name="doctype" select="@doctype"/>
3813
- <xsl:with-param name="title" select="@title-part"/>
3814
- </xsl:call-template>
3815
- </xsl:variable>
3816
4054
  <xsl:choose>
3817
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3818
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3819
- </xsl:when>
3820
- <xsl:otherwise>
4055
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4056
+ <xsl:variable name="bookmark-title_">
4057
+ <xsl:call-template name="getLangVersion">
4058
+ <xsl:with-param name="lang" select="@lang"/>
4059
+ <xsl:with-param name="doctype" select="@doctype"/>
4060
+ <xsl:with-param name="title" select="@title-part"/>
4061
+ </xsl:call-template>
4062
+ </xsl:variable>
3821
4063
  <xsl:choose>
3822
- <xsl:when test="@lang = 'en'">English</xsl:when>
3823
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3824
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3825
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4064
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4065
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4066
+ </xsl:when>
4067
+ <xsl:otherwise>
4068
+ <xsl:choose>
4069
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4070
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4071
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4072
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4073
+ </xsl:choose>
4074
+ </xsl:otherwise>
3826
4075
  </xsl:choose>
4076
+ </xsl:when>
4077
+ <xsl:otherwise>
4078
+ <xsl:value-of select="@title-part"/>
3827
4079
  </xsl:otherwise>
3828
4080
  </xsl:choose>
3829
4081
  </fo:bookmark-title>
4082
+
3830
4083
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3831
4084
 
3832
4085
  <xsl:call-template name="insertFigureBookmarks">
@@ -3925,16 +4178,23 @@
3925
4178
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3926
4179
  </xsl:choose>
3927
4180
  </xsl:template><xsl:template match="item" mode="bookmark">
3928
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3929
- <fo:bookmark-title>
3930
- <xsl:if test="@section != ''">
3931
- <xsl:value-of select="@section"/>
3932
- <xsl:text> </xsl:text>
3933
- </xsl:if>
3934
- <xsl:value-of select="normalize-space(title)"/>
3935
- </fo:bookmark-title>
3936
- <xsl:apply-templates mode="bookmark"/>
3937
- </fo:bookmark>
4181
+ <xsl:choose>
4182
+ <xsl:when test="@id != ''">
4183
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4184
+ <fo:bookmark-title>
4185
+ <xsl:if test="@section != ''">
4186
+ <xsl:value-of select="@section"/>
4187
+ <xsl:text> </xsl:text>
4188
+ </xsl:if>
4189
+ <xsl:value-of select="normalize-space(title)"/>
4190
+ </fo:bookmark-title>
4191
+ <xsl:apply-templates mode="bookmark"/>
4192
+ </fo:bookmark>
4193
+ </xsl:when>
4194
+ <xsl:otherwise>
4195
+ <xsl:apply-templates mode="bookmark"/>
4196
+ </xsl:otherwise>
4197
+ </xsl:choose>
3938
4198
  </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3939
4199
  <xsl:if test="normalize-space() != ''">
3940
4200
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -4495,6 +4755,7 @@
4495
4755
  </xsl:if>
4496
4756
 
4497
4757
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4758
+
4498
4759
  <xsl:if test="normalize-space(@citeas) = ''">
4499
4760
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4500
4761
  </xsl:if>
@@ -15,8 +15,13 @@
15
15
 
16
16
 
17
17
  <xsl:variable name="debug">false</xsl:variable>
18
- <xsl:variable name="pageWidth" select="'210mm'"/>
19
- <xsl:variable name="pageHeight" select="'297mm'"/>
18
+ <xsl:variable name="pageWidth" select="210"/>
19
+ <xsl:variable name="pageHeight" select="297"/>
20
+ <xsl:variable name="marginLeftRight1" select="25.4"/>
21
+ <xsl:variable name="marginLeftRight2" select="25.4"/>
22
+ <xsl:variable name="marginTop" select="25.4"/>
23
+ <xsl:variable name="marginBottom" select="25.4"/>
24
+
20
25
 
21
26
  <xsl:variable name="title-en" select="/iho:iho-standard/iho:bibdata/iho:title[@language = 'en']"/>
22
27
  <xsl:variable name="docidentifier" select="/iho:iho-standard/iho:bibdata/iho:docidentifier[@type = 'IHO']"/>
@@ -43,44 +48,44 @@
43
48
  <fo:root font-family="Arial, Cambria Math" font-size="12pt" xml:lang="{$lang}">
44
49
  <fo:layout-master-set>
45
50
  <!-- cover page -->
46
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
51
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
47
52
  <fo:region-body margin-top="0mm" margin-bottom="5mm" margin-left="0mm" margin-right="5mm"/>
48
53
  </fo:simple-page-master>
49
54
 
50
- <fo:simple-page-master master-name="first" page-width="{$pageWidth}" page-height="{$pageHeight}">
51
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
52
- <fo:region-before region-name="header" extent="25.4mm"/>
53
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
54
- <fo:region-start region-name="left-region" extent="25.4mm"/>
55
- <fo:region-end region-name="right-region" extent="25.4mm"/>
55
+ <fo:simple-page-master master-name="first" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
56
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
57
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
58
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
59
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
60
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
56
61
  </fo:simple-page-master>
57
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
58
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
59
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
60
- <fo:region-after region-name="footer-odd" extent="25.4mm"/>
61
- <fo:region-start region-name="left-region" extent="25.4mm"/>
62
- <fo:region-end region-name="right-region" extent="25.4mm"/>
62
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
63
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
64
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
65
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
66
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
67
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
63
68
  </fo:simple-page-master>
64
- <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}">
65
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
66
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
67
- <fo:region-after region-name="footer-odd" extent="25.4mm"/>
68
- <fo:region-start region-name="left-region" extent="25.4mm"/>
69
- <fo:region-end region-name="right-region" extent="25.4mm"/>
69
+ <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
70
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
71
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
72
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
73
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
74
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
70
75
  </fo:simple-page-master>
71
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
72
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
73
- <fo:region-before region-name="header-even" extent="25.4mm"/>
74
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
75
- <fo:region-start region-name="left-region" extent="25.4mm"/>
76
- <fo:region-end region-name="right-region" extent="25.4mm"/>
76
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
77
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
78
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
79
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
80
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
81
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
77
82
  </fo:simple-page-master>
78
- <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}">
79
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
80
- <fo:region-before region-name="header-even" extent="25.4mm"/>
81
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
82
- <fo:region-start region-name="left-region" extent="25.4mm"/>
83
- <fo:region-end region-name="right-region" extent="25.4mm"/>
83
+ <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
84
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
85
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
86
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
87
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
88
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
84
89
  </fo:simple-page-master>
85
90
  <!-- Preface pages -->
86
91
  <fo:page-sequence-master master-name="preface">
@@ -1288,6 +1293,7 @@
1288
1293
 
1289
1294
 
1290
1295
 
1296
+
1291
1297
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1292
1298
 
1293
1299
 
@@ -1510,14 +1516,15 @@
1510
1516
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1511
1517
 
1512
1518
  <!-- Normative references -->
1513
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1519
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/>
1514
1520
  <!-- Terms and definitions -->
1515
1521
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
1516
1522
  <!-- Another main sections -->
1517
1523
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
1518
1524
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1519
1525
  <!-- Bibliography -->
1520
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1526
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
1527
+
1521
1528
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1522
1529
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1523
1530
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -2298,6 +2305,7 @@
2298
2305
 
2299
2306
 
2300
2307
 
2308
+
2301
2309
  <xsl:if test=".//*[local-name() = 'table']">
2302
2310
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2303
2311
  </xsl:if>
@@ -2329,6 +2337,7 @@
2329
2337
 
2330
2338
 
2331
2339
 
2340
+
2332
2341
  <fo:inline padding-right="2mm">
2333
2342
 
2334
2343
 
@@ -2375,6 +2384,7 @@
2375
2384
 
2376
2385
 
2377
2386
 
2387
+
2378
2388
  <xsl:value-of select="@reference"/>
2379
2389
 
2380
2390
 
@@ -2519,6 +2529,9 @@
2519
2529
 
2520
2530
 
2521
2531
 
2532
+
2533
+
2534
+
2522
2535
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2523
2536
 
2524
2537
 
@@ -3425,6 +3438,7 @@
3425
3438
  <fo:inline xsl:use-attribute-sets="link-style">
3426
3439
 
3427
3440
 
3441
+
3428
3442
  <xsl:choose>
3429
3443
  <xsl:when test="$target_text = ''">
3430
3444
  <xsl:apply-templates/>
@@ -3777,6 +3791,234 @@
3777
3791
  <xsl:param name="height"/>
3778
3792
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3779
3793
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3794
+ </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
3795
+ <xsl:param name="name"/>
3796
+
3797
+ <xsl:variable name="svg_content">
3798
+ <xsl:apply-templates select="." mode="svg_update"/>
3799
+ </xsl:variable>
3800
+
3801
+ <xsl:variable name="alt-text">
3802
+ <xsl:choose>
3803
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3804
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3805
+ </xsl:when>
3806
+ <xsl:when test="normalize-space($name) != ''">
3807
+ <xsl:value-of select="$name"/>
3808
+ </xsl:when>
3809
+ <xsl:otherwise>Figure</xsl:otherwise>
3810
+ </xsl:choose>
3811
+ </xsl:variable>
3812
+
3813
+ <xsl:choose>
3814
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3815
+ <fo:block>
3816
+ <xsl:variable name="width" select="@width"/>
3817
+ <xsl:variable name="height" select="@height"/>
3818
+
3819
+ <xsl:variable name="scale_x">
3820
+ <xsl:choose>
3821
+ <xsl:when test="$width &gt; $width_effective_px">
3822
+ <xsl:value-of select="$width_effective_px div $width"/>
3823
+ </xsl:when>
3824
+ <xsl:otherwise>1</xsl:otherwise>
3825
+ </xsl:choose>
3826
+ </xsl:variable>
3827
+
3828
+ <xsl:variable name="scale_y">
3829
+ <xsl:choose>
3830
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3831
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3832
+ </xsl:when>
3833
+ <xsl:otherwise>1</xsl:otherwise>
3834
+ </xsl:choose>
3835
+ </xsl:variable>
3836
+
3837
+ <xsl:variable name="scale">
3838
+ <xsl:choose>
3839
+ <xsl:when test="$scale_y != 1">
3840
+ <xsl:value-of select="$scale_x * $scale_y"/>
3841
+ </xsl:when>
3842
+ <xsl:otherwise>
3843
+ <xsl:value-of select="$scale_x"/>
3844
+ </xsl:otherwise>
3845
+ </xsl:choose>
3846
+ </xsl:variable>
3847
+
3848
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3849
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3850
+
3851
+ <fo:table table-layout="fixed" width="100%">
3852
+ <fo:table-column column-width="proportional-column-width(1)"/>
3853
+ <fo:table-column column-width="{$width_scale}px"/>
3854
+ <fo:table-column column-width="proportional-column-width(1)"/>
3855
+ <fo:table-body>
3856
+ <fo:table-row>
3857
+ <fo:table-cell column-number="2">
3858
+ <fo:block>
3859
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3860
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3861
+ <fo:block line-height="0" font-size="0">
3862
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3863
+ <xsl:call-template name="bookmark"/>
3864
+ </xsl:for-each>
3865
+ </fo:block>
3866
+ </xsl:if>
3867
+ <fo:block text-depth="0" line-height="0" font-size="0">
3868
+
3869
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3870
+ <xsl:attribute name="width">100%</xsl:attribute>
3871
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3872
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3873
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3874
+
3875
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3876
+ </fo:instream-foreign-object>
3877
+ </fo:block>
3878
+
3879
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
3880
+ <xsl:with-param name="scale" select="$scale"/>
3881
+ </xsl:apply-templates>
3882
+ </fo:block-container>
3883
+ </fo:block>
3884
+ </fo:table-cell>
3885
+ </fo:table-row>
3886
+ </fo:table-body>
3887
+ </fo:table>
3888
+ </fo:block>
3889
+
3890
+ </xsl:when>
3891
+ <xsl:otherwise>
3892
+ <fo:block xsl:use-attribute-sets="image-style">
3893
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3894
+ <xsl:attribute name="width">100%</xsl:attribute>
3895
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3896
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3897
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3898
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3899
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3900
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3901
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3902
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3903
+ </xsl:if>
3904
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3905
+ <xsl:copy-of select="$svg_content"/>
3906
+ </fo:instream-foreign-object>
3907
+ </fo:block>
3908
+ </xsl:otherwise>
3909
+ </xsl:choose>
3910
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3911
+ <xsl:copy>
3912
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3913
+ </xsl:copy>
3914
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3915
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3916
+ <xsl:value-of select="."/>
3917
+ </xsl:attribute>
3918
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3919
+ <xsl:variable name="svg_content" select="document(@src)"/>
3920
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3921
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3922
+ <xsl:call-template name="image_svg">
3923
+ <xsl:with-param name="name" select="$name"/>
3924
+ </xsl:call-template>
3925
+ </xsl:for-each>
3926
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3927
+ <xsl:copy>
3928
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3929
+ </xsl:copy>
3930
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3931
+ <xsl:apply-templates mode="svg_remove_a"/>
3932
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3933
+ <xsl:param name="scale"/>
3934
+ <xsl:variable name="dest">
3935
+ <xsl:choose>
3936
+ <xsl:when test="starts-with(@href, '#')">
3937
+ <xsl:value-of select="substring-after(@href, '#')"/>
3938
+ </xsl:when>
3939
+ <xsl:otherwise>
3940
+ <xsl:value-of select="@href"/>
3941
+ </xsl:otherwise>
3942
+ </xsl:choose>
3943
+ </xsl:variable>
3944
+ <xsl:for-each select="./*[local-name() = 'rect']">
3945
+ <xsl:call-template name="insertSVGMapLink">
3946
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3947
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3948
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3949
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3950
+ <xsl:with-param name="dest" select="$dest"/>
3951
+ </xsl:call-template>
3952
+ </xsl:for-each>
3953
+
3954
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3955
+ <xsl:variable name="points">
3956
+ <xsl:call-template name="split">
3957
+ <xsl:with-param name="pText" select="@points"/>
3958
+ </xsl:call-template>
3959
+ </xsl:variable>
3960
+ <xsl:variable name="x_coords">
3961
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3962
+ <xsl:sort select="." data-type="number"/>
3963
+ <x><xsl:value-of select="."/></x>
3964
+ </xsl:for-each>
3965
+ </xsl:variable>
3966
+ <xsl:variable name="y_coords">
3967
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3968
+ <xsl:sort select="." data-type="number"/>
3969
+ <y><xsl:value-of select="."/></y>
3970
+ </xsl:for-each>
3971
+ </xsl:variable>
3972
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3973
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3974
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3975
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3976
+ <xsl:call-template name="insertSVGMapLink">
3977
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3978
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3979
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3980
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3981
+ <xsl:with-param name="dest" select="$dest"/>
3982
+ </xsl:call-template>
3983
+ </xsl:for-each>
3984
+
3985
+ <xsl:for-each select="./*[local-name() = 'circle']">
3986
+ <xsl:call-template name="insertSVGMapLink">
3987
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3988
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3989
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3990
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3991
+ <xsl:with-param name="dest" select="$dest"/>
3992
+ </xsl:call-template>
3993
+ </xsl:for-each>
3994
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3995
+ <xsl:call-template name="insertSVGMapLink">
3996
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3997
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3998
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3999
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
4000
+ <xsl:with-param name="dest" select="$dest"/>
4001
+ </xsl:call-template>
4002
+ </xsl:for-each>
4003
+ </xsl:template><xsl:template name="insertSVGMapLink">
4004
+ <xsl:param name="left"/>
4005
+ <xsl:param name="top"/>
4006
+ <xsl:param name="width"/>
4007
+ <xsl:param name="height"/>
4008
+ <xsl:param name="dest"/>
4009
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
4010
+ <fo:block font-size="1pt">
4011
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4012
+ <fo:inline-container inline-progression-dimension="100%">
4013
+ <fo:block-container height="{$height - 1}px" width="100%">
4014
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4015
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4016
+ </xsl:if> -->
4017
+ <fo:block> </fo:block></fo:block-container>
4018
+ </fo:inline-container>
4019
+ </fo:basic-link>
4020
+ </fo:block>
4021
+ </fo:block-container>
3780
4022
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
3781
4023
  <xsl:apply-templates mode="contents"/>
3782
4024
  <xsl:text> </xsl:text>
@@ -3805,28 +4047,39 @@
3805
4047
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3806
4048
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3807
4049
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4050
+ <xsl:if test="@bundle = 'true'">
4051
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4052
+ </xsl:if>
3808
4053
  <fo:bookmark-title>
3809
- <xsl:variable name="bookmark-title_">
3810
- <xsl:call-template name="getLangVersion">
3811
- <xsl:with-param name="lang" select="@lang"/>
3812
- <xsl:with-param name="doctype" select="@doctype"/>
3813
- <xsl:with-param name="title" select="@title-part"/>
3814
- </xsl:call-template>
3815
- </xsl:variable>
3816
4054
  <xsl:choose>
3817
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3818
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3819
- </xsl:when>
3820
- <xsl:otherwise>
4055
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4056
+ <xsl:variable name="bookmark-title_">
4057
+ <xsl:call-template name="getLangVersion">
4058
+ <xsl:with-param name="lang" select="@lang"/>
4059
+ <xsl:with-param name="doctype" select="@doctype"/>
4060
+ <xsl:with-param name="title" select="@title-part"/>
4061
+ </xsl:call-template>
4062
+ </xsl:variable>
3821
4063
  <xsl:choose>
3822
- <xsl:when test="@lang = 'en'">English</xsl:when>
3823
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3824
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3825
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4064
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4065
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4066
+ </xsl:when>
4067
+ <xsl:otherwise>
4068
+ <xsl:choose>
4069
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4070
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4071
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4072
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4073
+ </xsl:choose>
4074
+ </xsl:otherwise>
3826
4075
  </xsl:choose>
4076
+ </xsl:when>
4077
+ <xsl:otherwise>
4078
+ <xsl:value-of select="@title-part"/>
3827
4079
  </xsl:otherwise>
3828
4080
  </xsl:choose>
3829
4081
  </fo:bookmark-title>
4082
+
3830
4083
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3831
4084
 
3832
4085
  <xsl:call-template name="insertFigureBookmarks">
@@ -3925,16 +4178,23 @@
3925
4178
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3926
4179
  </xsl:choose>
3927
4180
  </xsl:template><xsl:template match="item" mode="bookmark">
3928
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3929
- <fo:bookmark-title>
3930
- <xsl:if test="@section != ''">
3931
- <xsl:value-of select="@section"/>
3932
- <xsl:text> </xsl:text>
3933
- </xsl:if>
3934
- <xsl:value-of select="normalize-space(title)"/>
3935
- </fo:bookmark-title>
3936
- <xsl:apply-templates mode="bookmark"/>
3937
- </fo:bookmark>
4181
+ <xsl:choose>
4182
+ <xsl:when test="@id != ''">
4183
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4184
+ <fo:bookmark-title>
4185
+ <xsl:if test="@section != ''">
4186
+ <xsl:value-of select="@section"/>
4187
+ <xsl:text> </xsl:text>
4188
+ </xsl:if>
4189
+ <xsl:value-of select="normalize-space(title)"/>
4190
+ </fo:bookmark-title>
4191
+ <xsl:apply-templates mode="bookmark"/>
4192
+ </fo:bookmark>
4193
+ </xsl:when>
4194
+ <xsl:otherwise>
4195
+ <xsl:apply-templates mode="bookmark"/>
4196
+ </xsl:otherwise>
4197
+ </xsl:choose>
3938
4198
  </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3939
4199
  <xsl:if test="normalize-space() != ''">
3940
4200
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -4495,6 +4755,7 @@
4495
4755
  </xsl:if>
4496
4756
 
4497
4757
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4758
+
4498
4759
  <xsl:if test="normalize-space(@citeas) = ''">
4499
4760
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4500
4761
  </xsl:if>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.3.5".freeze
3
+ VERSION = "0.3.6".freeze
4
4
  end
5
5
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
28
28
 
29
29
  spec.add_dependency "htmlentities", "~> 4.3.4"
30
- spec.add_dependency "metanorma-generic", "~> 1.10.0"
30
+ spec.add_dependency "metanorma-generic", "~> 1.10.2"
31
31
 
32
32
  spec.add_development_dependency "byebug", "~> 9.1"
33
33
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.10.0
33
+ version: 1.10.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.10.0
40
+ version: 1.10.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: byebug
43
43
  requirement: !ruby/object:Gem::Requirement