metanorma-m3aawg 1.7.5 → 1.7.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: 0d95848b94791a3a1ec260709272d02fb57cf356ab5b856be428c4ba937cfe00
4
- data.tar.gz: 4c69d81d994cf5602854c9c37e5c51fd1a91a2b4e5e7d564a351e412ad535ac6
3
+ metadata.gz: 5b0ab31279f1bb3381e027d7a9297d62e909becf654d75f5b03c794b40aaf66e
4
+ data.tar.gz: 396b95f0101682acb613b590b1f3af7771571c02d6ebcfdd530c306e83401a8e
5
5
  SHA512:
6
- metadata.gz: e99643ec9118b7e52e12939cb1107faf81cd9d17e33a6982f296e1a43a2f640e23dc6b6fec462725e3d7e01a7b932ce69e7d395fbcdb7311cc6eca54e37cf5fb
7
- data.tar.gz: f25efedcac4967fc897ac457ae4987146c6be348e5610d3943379fd07e427101399c544b09d6286a64a650f977527991078f5b450262bc4138bf8642ef8ccabb
6
+ metadata.gz: 3eec7587c14f94dbe788828bf771d8ebcc55ce26e9c2486a0ea69c996928e4efdc4e547cb77bbdb7ba395d8939f7ae570e5e7f3f1f68caec5a8bb69da9e0fe46
7
+ data.tar.gz: e93d2b334d55d89f9401b351dcd4670a3a52371dc43f06f483e151aeb2fcb285c5d37de0832d81c804147d8231b20a502b97d278ea068c5ee2daa7eb14ce8d8e
@@ -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"/>
@@ -14,8 +14,12 @@
14
14
 
15
15
 
16
16
  <xsl:variable name="debug">false</xsl:variable>
17
- <xsl:variable name="pageWidth" select="'215.9mm'"/>
18
- <xsl:variable name="pageHeight" select="'279.4mm'"/>
17
+ <xsl:variable name="pageWidth" select="215.9"/>
18
+ <xsl:variable name="pageHeight" select="279.4"/>
19
+ <xsl:variable name="marginLeftRight1" select="17.3"/>
20
+ <xsl:variable name="marginLeftRight2" select="17.3"/>
21
+ <xsl:variable name="marginTop" select="35"/>
22
+ <xsl:variable name="marginBottom" select="23"/>
19
23
 
20
24
  <xsl:variable name="title-en" select="/m3d:m3d-standard/m3d:bibdata/m3d:title[@language = 'en']"/>
21
25
  <!-- Example:
@@ -39,7 +43,7 @@
39
43
  <fo:layout-master-set>
40
44
 
41
45
  <!-- cover page -->
42
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
46
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
43
47
  <fo:region-body margin-top="31mm" margin-bottom="32mm" margin-left="17.3mm" margin-right="22mm"/>
44
48
  <fo:region-before region-name="cover-header" extent="31mm"/>
45
49
  <fo:region-after region-name="cover-footer" extent="32mm"/>
@@ -48,17 +52,17 @@
48
52
  </fo:simple-page-master>
49
53
 
50
54
  <!-- contents pages -->
51
- <fo:simple-page-master master-name="page" page-width="{$pageWidth}" page-height="{$pageHeight}">
52
- <fo:region-body margin-top="20mm" margin-bottom="23mm" margin-left="17.3mm" margin-right="17.3mm"/>
53
- <fo:region-before region-name="header" extent="35mm"/>
54
- <fo:region-after region-name="footer" extent="23mm"/>
55
- <fo:region-start region-name="left-region" extent="17.3mm"/>
56
- <fo:region-end region-name="right-region" extent="17.3mm"/>
55
+ <fo:simple-page-master master-name="page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
56
+ <fo:region-body margin-top="20mm" margin-bottom="23mm" 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" 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"/>
57
61
  </fo:simple-page-master>
58
62
 
59
- <fo:simple-page-master master-name="last" page-width="{$pageWidth}" page-height="{$pageHeight}">
60
- <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="17.3mm" margin-right="17.3mm"/>
61
- <fo:region-before region-name="header" extent="35mm"/>
63
+ <fo:simple-page-master master-name="last" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
64
+ <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
65
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
62
66
  <fo:region-after region-name="footer-last" extent="53mm"/>
63
67
  <fo:region-start region-name="left-region" extent="17.3mm"/>
64
68
  <fo:region-end region-name="right-region" extent="17.3mm"/>
@@ -1226,6 +1230,7 @@
1226
1230
 
1227
1231
 
1228
1232
 
1233
+
1229
1234
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1230
1235
 
1231
1236
 
@@ -1434,14 +1439,15 @@
1434
1439
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1435
1440
 
1436
1441
  <!-- Normative references -->
1437
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1442
+ <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"/>
1438
1443
  <!-- Terms and definitions -->
1439
1444
  <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"/>
1440
1445
  <!-- Another main sections -->
1441
1446
  <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"/>
1442
1447
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1443
1448
  <!-- Bibliography -->
1444
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1449
+ <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"/>
1450
+
1445
1451
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1446
1452
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1447
1453
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -2217,6 +2223,7 @@
2217
2223
 
2218
2224
 
2219
2225
 
2226
+
2220
2227
  <xsl:if test=".//*[local-name() = 'table']">
2221
2228
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2222
2229
  </xsl:if>
@@ -2246,6 +2253,7 @@
2246
2253
 
2247
2254
 
2248
2255
 
2256
+
2249
2257
  <fo:inline padding-right="2mm">
2250
2258
 
2251
2259
 
@@ -2289,6 +2297,7 @@
2289
2297
 
2290
2298
 
2291
2299
 
2300
+
2292
2301
  <xsl:value-of select="@reference"/>
2293
2302
 
2294
2303
 
@@ -2433,6 +2442,9 @@
2433
2442
 
2434
2443
 
2435
2444
 
2445
+
2446
+
2447
+
2436
2448
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2437
2449
 
2438
2450
 
@@ -3337,6 +3349,7 @@
3337
3349
  <fo:inline xsl:use-attribute-sets="link-style">
3338
3350
 
3339
3351
 
3352
+
3340
3353
  <xsl:choose>
3341
3354
  <xsl:when test="$target_text = ''">
3342
3355
  <xsl:apply-templates/>
@@ -3691,6 +3704,234 @@
3691
3704
  <xsl:param name="height"/>
3692
3705
  <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; "/>
3693
3706
  <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; "/>
3707
+ </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">
3708
+ <xsl:param name="name"/>
3709
+
3710
+ <xsl:variable name="svg_content">
3711
+ <xsl:apply-templates select="." mode="svg_update"/>
3712
+ </xsl:variable>
3713
+
3714
+ <xsl:variable name="alt-text">
3715
+ <xsl:choose>
3716
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3717
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3718
+ </xsl:when>
3719
+ <xsl:when test="normalize-space($name) != ''">
3720
+ <xsl:value-of select="$name"/>
3721
+ </xsl:when>
3722
+ <xsl:otherwise>Figure</xsl:otherwise>
3723
+ </xsl:choose>
3724
+ </xsl:variable>
3725
+
3726
+ <xsl:choose>
3727
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3728
+ <fo:block>
3729
+ <xsl:variable name="width" select="@width"/>
3730
+ <xsl:variable name="height" select="@height"/>
3731
+
3732
+ <xsl:variable name="scale_x">
3733
+ <xsl:choose>
3734
+ <xsl:when test="$width &gt; $width_effective_px">
3735
+ <xsl:value-of select="$width_effective_px div $width"/>
3736
+ </xsl:when>
3737
+ <xsl:otherwise>1</xsl:otherwise>
3738
+ </xsl:choose>
3739
+ </xsl:variable>
3740
+
3741
+ <xsl:variable name="scale_y">
3742
+ <xsl:choose>
3743
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3744
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3745
+ </xsl:when>
3746
+ <xsl:otherwise>1</xsl:otherwise>
3747
+ </xsl:choose>
3748
+ </xsl:variable>
3749
+
3750
+ <xsl:variable name="scale">
3751
+ <xsl:choose>
3752
+ <xsl:when test="$scale_y != 1">
3753
+ <xsl:value-of select="$scale_x * $scale_y"/>
3754
+ </xsl:when>
3755
+ <xsl:otherwise>
3756
+ <xsl:value-of select="$scale_x"/>
3757
+ </xsl:otherwise>
3758
+ </xsl:choose>
3759
+ </xsl:variable>
3760
+
3761
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3762
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3763
+
3764
+ <fo:table table-layout="fixed" width="100%">
3765
+ <fo:table-column column-width="proportional-column-width(1)"/>
3766
+ <fo:table-column column-width="{$width_scale}px"/>
3767
+ <fo:table-column column-width="proportional-column-width(1)"/>
3768
+ <fo:table-body>
3769
+ <fo:table-row>
3770
+ <fo:table-cell column-number="2">
3771
+ <fo:block>
3772
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3773
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3774
+ <fo:block line-height="0" font-size="0">
3775
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3776
+ <xsl:call-template name="bookmark"/>
3777
+ </xsl:for-each>
3778
+ </fo:block>
3779
+ </xsl:if>
3780
+ <fo:block text-depth="0" line-height="0" font-size="0">
3781
+
3782
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3783
+ <xsl:attribute name="width">100%</xsl:attribute>
3784
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3785
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3786
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3787
+
3788
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3789
+ </fo:instream-foreign-object>
3790
+ </fo:block>
3791
+
3792
+ <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">
3793
+ <xsl:with-param name="scale" select="$scale"/>
3794
+ </xsl:apply-templates>
3795
+ </fo:block-container>
3796
+ </fo:block>
3797
+ </fo:table-cell>
3798
+ </fo:table-row>
3799
+ </fo:table-body>
3800
+ </fo:table>
3801
+ </fo:block>
3802
+
3803
+ </xsl:when>
3804
+ <xsl:otherwise>
3805
+ <fo:block xsl:use-attribute-sets="image-style">
3806
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3807
+ <xsl:attribute name="width">100%</xsl:attribute>
3808
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3809
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3810
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3811
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3812
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3813
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3814
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3815
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3816
+ </xsl:if>
3817
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3818
+ <xsl:copy-of select="$svg_content"/>
3819
+ </fo:instream-foreign-object>
3820
+ </fo:block>
3821
+ </xsl:otherwise>
3822
+ </xsl:choose>
3823
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3824
+ <xsl:copy>
3825
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3826
+ </xsl:copy>
3827
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3828
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3829
+ <xsl:value-of select="."/>
3830
+ </xsl:attribute>
3831
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3832
+ <xsl:variable name="svg_content" select="document(@src)"/>
3833
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3834
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3835
+ <xsl:call-template name="image_svg">
3836
+ <xsl:with-param name="name" select="$name"/>
3837
+ </xsl:call-template>
3838
+ </xsl:for-each>
3839
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3840
+ <xsl:copy>
3841
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3842
+ </xsl:copy>
3843
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3844
+ <xsl:apply-templates mode="svg_remove_a"/>
3845
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3846
+ <xsl:param name="scale"/>
3847
+ <xsl:variable name="dest">
3848
+ <xsl:choose>
3849
+ <xsl:when test="starts-with(@href, '#')">
3850
+ <xsl:value-of select="substring-after(@href, '#')"/>
3851
+ </xsl:when>
3852
+ <xsl:otherwise>
3853
+ <xsl:value-of select="@href"/>
3854
+ </xsl:otherwise>
3855
+ </xsl:choose>
3856
+ </xsl:variable>
3857
+ <xsl:for-each select="./*[local-name() = 'rect']">
3858
+ <xsl:call-template name="insertSVGMapLink">
3859
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3860
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3861
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3862
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3863
+ <xsl:with-param name="dest" select="$dest"/>
3864
+ </xsl:call-template>
3865
+ </xsl:for-each>
3866
+
3867
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3868
+ <xsl:variable name="points">
3869
+ <xsl:call-template name="split">
3870
+ <xsl:with-param name="pText" select="@points"/>
3871
+ </xsl:call-template>
3872
+ </xsl:variable>
3873
+ <xsl:variable name="x_coords">
3874
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3875
+ <xsl:sort select="." data-type="number"/>
3876
+ <x><xsl:value-of select="."/></x>
3877
+ </xsl:for-each>
3878
+ </xsl:variable>
3879
+ <xsl:variable name="y_coords">
3880
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3881
+ <xsl:sort select="." data-type="number"/>
3882
+ <y><xsl:value-of select="."/></y>
3883
+ </xsl:for-each>
3884
+ </xsl:variable>
3885
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3886
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3887
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3888
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3889
+ <xsl:call-template name="insertSVGMapLink">
3890
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3891
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3892
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3893
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3894
+ <xsl:with-param name="dest" select="$dest"/>
3895
+ </xsl:call-template>
3896
+ </xsl:for-each>
3897
+
3898
+ <xsl:for-each select="./*[local-name() = 'circle']">
3899
+ <xsl:call-template name="insertSVGMapLink">
3900
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3901
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3902
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3903
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3904
+ <xsl:with-param name="dest" select="$dest"/>
3905
+ </xsl:call-template>
3906
+ </xsl:for-each>
3907
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3908
+ <xsl:call-template name="insertSVGMapLink">
3909
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3910
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3911
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3912
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
3913
+ <xsl:with-param name="dest" select="$dest"/>
3914
+ </xsl:call-template>
3915
+ </xsl:for-each>
3916
+ </xsl:template><xsl:template name="insertSVGMapLink">
3917
+ <xsl:param name="left"/>
3918
+ <xsl:param name="top"/>
3919
+ <xsl:param name="width"/>
3920
+ <xsl:param name="height"/>
3921
+ <xsl:param name="dest"/>
3922
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
3923
+ <fo:block font-size="1pt">
3924
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
3925
+ <fo:inline-container inline-progression-dimension="100%">
3926
+ <fo:block-container height="{$height - 1}px" width="100%">
3927
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
3928
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
3929
+ </xsl:if> -->
3930
+ <fo:block> </fo:block></fo:block-container>
3931
+ </fo:inline-container>
3932
+ </fo:basic-link>
3933
+ </fo:block>
3934
+ </fo:block-container>
3694
3935
  </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">
3695
3936
  <xsl:apply-templates mode="contents"/>
3696
3937
  <xsl:text> </xsl:text>
@@ -3719,28 +3960,39 @@
3719
3960
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3720
3961
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3721
3962
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3963
+ <xsl:if test="@bundle = 'true'">
3964
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
3965
+ </xsl:if>
3722
3966
  <fo:bookmark-title>
3723
- <xsl:variable name="bookmark-title_">
3724
- <xsl:call-template name="getLangVersion">
3725
- <xsl:with-param name="lang" select="@lang"/>
3726
- <xsl:with-param name="doctype" select="@doctype"/>
3727
- <xsl:with-param name="title" select="@title-part"/>
3728
- </xsl:call-template>
3729
- </xsl:variable>
3730
3967
  <xsl:choose>
3731
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3732
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3733
- </xsl:when>
3734
- <xsl:otherwise>
3968
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
3969
+ <xsl:variable name="bookmark-title_">
3970
+ <xsl:call-template name="getLangVersion">
3971
+ <xsl:with-param name="lang" select="@lang"/>
3972
+ <xsl:with-param name="doctype" select="@doctype"/>
3973
+ <xsl:with-param name="title" select="@title-part"/>
3974
+ </xsl:call-template>
3975
+ </xsl:variable>
3735
3976
  <xsl:choose>
3736
- <xsl:when test="@lang = 'en'">English</xsl:when>
3737
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3738
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3739
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3977
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3978
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3979
+ </xsl:when>
3980
+ <xsl:otherwise>
3981
+ <xsl:choose>
3982
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3983
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3984
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3985
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3986
+ </xsl:choose>
3987
+ </xsl:otherwise>
3740
3988
  </xsl:choose>
3989
+ </xsl:when>
3990
+ <xsl:otherwise>
3991
+ <xsl:value-of select="@title-part"/>
3741
3992
  </xsl:otherwise>
3742
3993
  </xsl:choose>
3743
3994
  </fo:bookmark-title>
3995
+
3744
3996
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3745
3997
 
3746
3998
  <xsl:call-template name="insertFigureBookmarks">
@@ -3839,16 +4091,23 @@
3839
4091
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3840
4092
  </xsl:choose>
3841
4093
  </xsl:template><xsl:template match="item" mode="bookmark">
3842
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3843
- <fo:bookmark-title>
3844
- <xsl:if test="@section != ''">
3845
- <xsl:value-of select="@section"/>
3846
- <xsl:text> </xsl:text>
3847
- </xsl:if>
3848
- <xsl:value-of select="normalize-space(title)"/>
3849
- </fo:bookmark-title>
3850
- <xsl:apply-templates mode="bookmark"/>
3851
- </fo:bookmark>
4094
+ <xsl:choose>
4095
+ <xsl:when test="@id != ''">
4096
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4097
+ <fo:bookmark-title>
4098
+ <xsl:if test="@section != ''">
4099
+ <xsl:value-of select="@section"/>
4100
+ <xsl:text> </xsl:text>
4101
+ </xsl:if>
4102
+ <xsl:value-of select="normalize-space(title)"/>
4103
+ </fo:bookmark-title>
4104
+ <xsl:apply-templates mode="bookmark"/>
4105
+ </fo:bookmark>
4106
+ </xsl:when>
4107
+ <xsl:otherwise>
4108
+ <xsl:apply-templates mode="bookmark"/>
4109
+ </xsl:otherwise>
4110
+ </xsl:choose>
3852
4111
  </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">
3853
4112
  <xsl:if test="normalize-space() != ''">
3854
4113
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -4394,6 +4653,7 @@
4394
4653
  </xsl:if>
4395
4654
 
4396
4655
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4656
+
4397
4657
  <xsl:if test="normalize-space(@citeas) = ''">
4398
4658
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4399
4659
  </xsl:if>
@@ -14,8 +14,12 @@
14
14
 
15
15
 
16
16
  <xsl:variable name="debug">false</xsl:variable>
17
- <xsl:variable name="pageWidth" select="'215.9mm'"/>
18
- <xsl:variable name="pageHeight" select="'279.4mm'"/>
17
+ <xsl:variable name="pageWidth" select="215.9"/>
18
+ <xsl:variable name="pageHeight" select="279.4"/>
19
+ <xsl:variable name="marginLeftRight1" select="17.3"/>
20
+ <xsl:variable name="marginLeftRight2" select="17.3"/>
21
+ <xsl:variable name="marginTop" select="35"/>
22
+ <xsl:variable name="marginBottom" select="23"/>
19
23
 
20
24
  <xsl:variable name="title-en" select="/m3d:m3d-standard/m3d:bibdata/m3d:title[@language = 'en']"/>
21
25
  <!-- Example:
@@ -39,7 +43,7 @@
39
43
  <fo:layout-master-set>
40
44
 
41
45
  <!-- cover page -->
42
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
46
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
43
47
  <fo:region-body margin-top="31mm" margin-bottom="32mm" margin-left="17.3mm" margin-right="22mm"/>
44
48
  <fo:region-before region-name="cover-header" extent="31mm"/>
45
49
  <fo:region-after region-name="cover-footer" extent="32mm"/>
@@ -48,17 +52,17 @@
48
52
  </fo:simple-page-master>
49
53
 
50
54
  <!-- contents pages -->
51
- <fo:simple-page-master master-name="page" page-width="{$pageWidth}" page-height="{$pageHeight}">
52
- <fo:region-body margin-top="20mm" margin-bottom="23mm" margin-left="17.3mm" margin-right="17.3mm"/>
53
- <fo:region-before region-name="header" extent="35mm"/>
54
- <fo:region-after region-name="footer" extent="23mm"/>
55
- <fo:region-start region-name="left-region" extent="17.3mm"/>
56
- <fo:region-end region-name="right-region" extent="17.3mm"/>
55
+ <fo:simple-page-master master-name="page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
56
+ <fo:region-body margin-top="20mm" margin-bottom="23mm" 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" 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"/>
57
61
  </fo:simple-page-master>
58
62
 
59
- <fo:simple-page-master master-name="last" page-width="{$pageWidth}" page-height="{$pageHeight}">
60
- <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="17.3mm" margin-right="17.3mm"/>
61
- <fo:region-before region-name="header" extent="35mm"/>
63
+ <fo:simple-page-master master-name="last" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
64
+ <fo:region-body margin-top="20mm" margin-bottom="53mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
65
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
62
66
  <fo:region-after region-name="footer-last" extent="53mm"/>
63
67
  <fo:region-start region-name="left-region" extent="17.3mm"/>
64
68
  <fo:region-end region-name="right-region" extent="17.3mm"/>
@@ -1226,6 +1230,7 @@
1226
1230
 
1227
1231
 
1228
1232
 
1233
+
1229
1234
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1230
1235
 
1231
1236
 
@@ -1434,14 +1439,15 @@
1434
1439
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1435
1440
 
1436
1441
  <!-- Normative references -->
1437
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1442
+ <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"/>
1438
1443
  <!-- Terms and definitions -->
1439
1444
  <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"/>
1440
1445
  <!-- Another main sections -->
1441
1446
  <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"/>
1442
1447
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1443
1448
  <!-- Bibliography -->
1444
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1449
+ <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"/>
1450
+
1445
1451
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1446
1452
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1447
1453
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -2217,6 +2223,7 @@
2217
2223
 
2218
2224
 
2219
2225
 
2226
+
2220
2227
  <xsl:if test=".//*[local-name() = 'table']">
2221
2228
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2222
2229
  </xsl:if>
@@ -2246,6 +2253,7 @@
2246
2253
 
2247
2254
 
2248
2255
 
2256
+
2249
2257
  <fo:inline padding-right="2mm">
2250
2258
 
2251
2259
 
@@ -2289,6 +2297,7 @@
2289
2297
 
2290
2298
 
2291
2299
 
2300
+
2292
2301
  <xsl:value-of select="@reference"/>
2293
2302
 
2294
2303
 
@@ -2433,6 +2442,9 @@
2433
2442
 
2434
2443
 
2435
2444
 
2445
+
2446
+
2447
+
2436
2448
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2437
2449
 
2438
2450
 
@@ -3337,6 +3349,7 @@
3337
3349
  <fo:inline xsl:use-attribute-sets="link-style">
3338
3350
 
3339
3351
 
3352
+
3340
3353
  <xsl:choose>
3341
3354
  <xsl:when test="$target_text = ''">
3342
3355
  <xsl:apply-templates/>
@@ -3691,6 +3704,234 @@
3691
3704
  <xsl:param name="height"/>
3692
3705
  <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; "/>
3693
3706
  <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; "/>
3707
+ </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">
3708
+ <xsl:param name="name"/>
3709
+
3710
+ <xsl:variable name="svg_content">
3711
+ <xsl:apply-templates select="." mode="svg_update"/>
3712
+ </xsl:variable>
3713
+
3714
+ <xsl:variable name="alt-text">
3715
+ <xsl:choose>
3716
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3717
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3718
+ </xsl:when>
3719
+ <xsl:when test="normalize-space($name) != ''">
3720
+ <xsl:value-of select="$name"/>
3721
+ </xsl:when>
3722
+ <xsl:otherwise>Figure</xsl:otherwise>
3723
+ </xsl:choose>
3724
+ </xsl:variable>
3725
+
3726
+ <xsl:choose>
3727
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3728
+ <fo:block>
3729
+ <xsl:variable name="width" select="@width"/>
3730
+ <xsl:variable name="height" select="@height"/>
3731
+
3732
+ <xsl:variable name="scale_x">
3733
+ <xsl:choose>
3734
+ <xsl:when test="$width &gt; $width_effective_px">
3735
+ <xsl:value-of select="$width_effective_px div $width"/>
3736
+ </xsl:when>
3737
+ <xsl:otherwise>1</xsl:otherwise>
3738
+ </xsl:choose>
3739
+ </xsl:variable>
3740
+
3741
+ <xsl:variable name="scale_y">
3742
+ <xsl:choose>
3743
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3744
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3745
+ </xsl:when>
3746
+ <xsl:otherwise>1</xsl:otherwise>
3747
+ </xsl:choose>
3748
+ </xsl:variable>
3749
+
3750
+ <xsl:variable name="scale">
3751
+ <xsl:choose>
3752
+ <xsl:when test="$scale_y != 1">
3753
+ <xsl:value-of select="$scale_x * $scale_y"/>
3754
+ </xsl:when>
3755
+ <xsl:otherwise>
3756
+ <xsl:value-of select="$scale_x"/>
3757
+ </xsl:otherwise>
3758
+ </xsl:choose>
3759
+ </xsl:variable>
3760
+
3761
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3762
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3763
+
3764
+ <fo:table table-layout="fixed" width="100%">
3765
+ <fo:table-column column-width="proportional-column-width(1)"/>
3766
+ <fo:table-column column-width="{$width_scale}px"/>
3767
+ <fo:table-column column-width="proportional-column-width(1)"/>
3768
+ <fo:table-body>
3769
+ <fo:table-row>
3770
+ <fo:table-cell column-number="2">
3771
+ <fo:block>
3772
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3773
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3774
+ <fo:block line-height="0" font-size="0">
3775
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3776
+ <xsl:call-template name="bookmark"/>
3777
+ </xsl:for-each>
3778
+ </fo:block>
3779
+ </xsl:if>
3780
+ <fo:block text-depth="0" line-height="0" font-size="0">
3781
+
3782
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3783
+ <xsl:attribute name="width">100%</xsl:attribute>
3784
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3785
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3786
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3787
+
3788
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3789
+ </fo:instream-foreign-object>
3790
+ </fo:block>
3791
+
3792
+ <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">
3793
+ <xsl:with-param name="scale" select="$scale"/>
3794
+ </xsl:apply-templates>
3795
+ </fo:block-container>
3796
+ </fo:block>
3797
+ </fo:table-cell>
3798
+ </fo:table-row>
3799
+ </fo:table-body>
3800
+ </fo:table>
3801
+ </fo:block>
3802
+
3803
+ </xsl:when>
3804
+ <xsl:otherwise>
3805
+ <fo:block xsl:use-attribute-sets="image-style">
3806
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3807
+ <xsl:attribute name="width">100%</xsl:attribute>
3808
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3809
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3810
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3811
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3812
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3813
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3814
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3815
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3816
+ </xsl:if>
3817
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3818
+ <xsl:copy-of select="$svg_content"/>
3819
+ </fo:instream-foreign-object>
3820
+ </fo:block>
3821
+ </xsl:otherwise>
3822
+ </xsl:choose>
3823
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3824
+ <xsl:copy>
3825
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3826
+ </xsl:copy>
3827
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3828
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3829
+ <xsl:value-of select="."/>
3830
+ </xsl:attribute>
3831
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3832
+ <xsl:variable name="svg_content" select="document(@src)"/>
3833
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3834
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3835
+ <xsl:call-template name="image_svg">
3836
+ <xsl:with-param name="name" select="$name"/>
3837
+ </xsl:call-template>
3838
+ </xsl:for-each>
3839
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3840
+ <xsl:copy>
3841
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3842
+ </xsl:copy>
3843
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3844
+ <xsl:apply-templates mode="svg_remove_a"/>
3845
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3846
+ <xsl:param name="scale"/>
3847
+ <xsl:variable name="dest">
3848
+ <xsl:choose>
3849
+ <xsl:when test="starts-with(@href, '#')">
3850
+ <xsl:value-of select="substring-after(@href, '#')"/>
3851
+ </xsl:when>
3852
+ <xsl:otherwise>
3853
+ <xsl:value-of select="@href"/>
3854
+ </xsl:otherwise>
3855
+ </xsl:choose>
3856
+ </xsl:variable>
3857
+ <xsl:for-each select="./*[local-name() = 'rect']">
3858
+ <xsl:call-template name="insertSVGMapLink">
3859
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3860
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3861
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3862
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3863
+ <xsl:with-param name="dest" select="$dest"/>
3864
+ </xsl:call-template>
3865
+ </xsl:for-each>
3866
+
3867
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3868
+ <xsl:variable name="points">
3869
+ <xsl:call-template name="split">
3870
+ <xsl:with-param name="pText" select="@points"/>
3871
+ </xsl:call-template>
3872
+ </xsl:variable>
3873
+ <xsl:variable name="x_coords">
3874
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3875
+ <xsl:sort select="." data-type="number"/>
3876
+ <x><xsl:value-of select="."/></x>
3877
+ </xsl:for-each>
3878
+ </xsl:variable>
3879
+ <xsl:variable name="y_coords">
3880
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3881
+ <xsl:sort select="." data-type="number"/>
3882
+ <y><xsl:value-of select="."/></y>
3883
+ </xsl:for-each>
3884
+ </xsl:variable>
3885
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3886
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3887
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3888
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3889
+ <xsl:call-template name="insertSVGMapLink">
3890
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3891
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3892
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3893
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3894
+ <xsl:with-param name="dest" select="$dest"/>
3895
+ </xsl:call-template>
3896
+ </xsl:for-each>
3897
+
3898
+ <xsl:for-each select="./*[local-name() = 'circle']">
3899
+ <xsl:call-template name="insertSVGMapLink">
3900
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3901
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3902
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3903
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3904
+ <xsl:with-param name="dest" select="$dest"/>
3905
+ </xsl:call-template>
3906
+ </xsl:for-each>
3907
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3908
+ <xsl:call-template name="insertSVGMapLink">
3909
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3910
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3911
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3912
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
3913
+ <xsl:with-param name="dest" select="$dest"/>
3914
+ </xsl:call-template>
3915
+ </xsl:for-each>
3916
+ </xsl:template><xsl:template name="insertSVGMapLink">
3917
+ <xsl:param name="left"/>
3918
+ <xsl:param name="top"/>
3919
+ <xsl:param name="width"/>
3920
+ <xsl:param name="height"/>
3921
+ <xsl:param name="dest"/>
3922
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
3923
+ <fo:block font-size="1pt">
3924
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
3925
+ <fo:inline-container inline-progression-dimension="100%">
3926
+ <fo:block-container height="{$height - 1}px" width="100%">
3927
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
3928
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
3929
+ </xsl:if> -->
3930
+ <fo:block> </fo:block></fo:block-container>
3931
+ </fo:inline-container>
3932
+ </fo:basic-link>
3933
+ </fo:block>
3934
+ </fo:block-container>
3694
3935
  </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">
3695
3936
  <xsl:apply-templates mode="contents"/>
3696
3937
  <xsl:text> </xsl:text>
@@ -3719,28 +3960,39 @@
3719
3960
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3720
3961
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3721
3962
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3963
+ <xsl:if test="@bundle = 'true'">
3964
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
3965
+ </xsl:if>
3722
3966
  <fo:bookmark-title>
3723
- <xsl:variable name="bookmark-title_">
3724
- <xsl:call-template name="getLangVersion">
3725
- <xsl:with-param name="lang" select="@lang"/>
3726
- <xsl:with-param name="doctype" select="@doctype"/>
3727
- <xsl:with-param name="title" select="@title-part"/>
3728
- </xsl:call-template>
3729
- </xsl:variable>
3730
3967
  <xsl:choose>
3731
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3732
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3733
- </xsl:when>
3734
- <xsl:otherwise>
3968
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
3969
+ <xsl:variable name="bookmark-title_">
3970
+ <xsl:call-template name="getLangVersion">
3971
+ <xsl:with-param name="lang" select="@lang"/>
3972
+ <xsl:with-param name="doctype" select="@doctype"/>
3973
+ <xsl:with-param name="title" select="@title-part"/>
3974
+ </xsl:call-template>
3975
+ </xsl:variable>
3735
3976
  <xsl:choose>
3736
- <xsl:when test="@lang = 'en'">English</xsl:when>
3737
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3738
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3739
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3977
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3978
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3979
+ </xsl:when>
3980
+ <xsl:otherwise>
3981
+ <xsl:choose>
3982
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3983
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3984
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3985
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3986
+ </xsl:choose>
3987
+ </xsl:otherwise>
3740
3988
  </xsl:choose>
3989
+ </xsl:when>
3990
+ <xsl:otherwise>
3991
+ <xsl:value-of select="@title-part"/>
3741
3992
  </xsl:otherwise>
3742
3993
  </xsl:choose>
3743
3994
  </fo:bookmark-title>
3995
+
3744
3996
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3745
3997
 
3746
3998
  <xsl:call-template name="insertFigureBookmarks">
@@ -3839,16 +4091,23 @@
3839
4091
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3840
4092
  </xsl:choose>
3841
4093
  </xsl:template><xsl:template match="item" mode="bookmark">
3842
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3843
- <fo:bookmark-title>
3844
- <xsl:if test="@section != ''">
3845
- <xsl:value-of select="@section"/>
3846
- <xsl:text> </xsl:text>
3847
- </xsl:if>
3848
- <xsl:value-of select="normalize-space(title)"/>
3849
- </fo:bookmark-title>
3850
- <xsl:apply-templates mode="bookmark"/>
3851
- </fo:bookmark>
4094
+ <xsl:choose>
4095
+ <xsl:when test="@id != ''">
4096
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4097
+ <fo:bookmark-title>
4098
+ <xsl:if test="@section != ''">
4099
+ <xsl:value-of select="@section"/>
4100
+ <xsl:text> </xsl:text>
4101
+ </xsl:if>
4102
+ <xsl:value-of select="normalize-space(title)"/>
4103
+ </fo:bookmark-title>
4104
+ <xsl:apply-templates mode="bookmark"/>
4105
+ </fo:bookmark>
4106
+ </xsl:when>
4107
+ <xsl:otherwise>
4108
+ <xsl:apply-templates mode="bookmark"/>
4109
+ </xsl:otherwise>
4110
+ </xsl:choose>
3852
4111
  </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">
3853
4112
  <xsl:if test="normalize-space() != ''">
3854
4113
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -4394,6 +4653,7 @@
4394
4653
  </xsl:if>
4395
4654
 
4396
4655
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4656
+
4397
4657
  <xsl:if test="normalize-space(@citeas) = ''">
4398
4658
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4399
4659
  </xsl:if>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module M3AAWG
3
- VERSION = "1.7.5".freeze
3
+ VERSION = "1.7.6".freeze
4
4
  end
5
5
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "htmlentities", "~> 4.3.4"
32
32
  spec.add_dependency "thread_safe"
33
33
 
34
- spec.add_dependency "metanorma-generic", "~> 1.10.0"
34
+ spec.add_dependency "metanorma-generic", "~> 1.10.2"
35
35
 
36
36
  spec.add_development_dependency "byebug", "~> 9.1"
37
37
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-m3aawg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.5
4
+ version: 1.7.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
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.10.0
47
+ version: 1.10.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.10.0
54
+ version: 1.10.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: byebug
57
57
  requirement: !ruby/object:Gem::Requirement