metanorma-itu 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,8 +14,12 @@
14
14
 
15
15
 
16
16
  <xsl:variable name="debug">false</xsl:variable>
17
- <xsl:variable name="pageWidth" select="'210mm'"/>
18
- <xsl:variable name="pageHeight" select="'297mm'"/>
17
+ <xsl:variable name="pageWidth" select="210"/>
18
+ <xsl:variable name="pageHeight" select="297"/>
19
+ <xsl:variable name="marginLeftRight1" select="20"/>
20
+ <xsl:variable name="marginLeftRight2" select="20"/>
21
+ <xsl:variable name="marginTop" select="20"/>
22
+ <xsl:variable name="marginBottom" select="20"/>
19
23
 
20
24
  <!-- Rec. ITU-T G.650.1 (03/2018) -->
21
25
  <xsl:variable name="footerprefix" select="'Rec. '"/>
@@ -133,7 +137,7 @@
133
137
 
134
138
 
135
139
  <!-- Technical Report first page -->
136
- <fo:simple-page-master master-name="TR-first-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
140
+ <fo:simple-page-master master-name="TR-first-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
137
141
  <fo:region-body margin-top="21.6mm" margin-bottom="25.4mm" margin-left="20.1mm" margin-right="22.6mm"/>
138
142
  <fo:region-before region-name="TR-first-page-header" extent="21.6mm" display-align="center"/>
139
143
  <fo:region-after region-name="TR-first-page-footer" extent="25.4mm" display-align="center"/>
@@ -142,7 +146,7 @@
142
146
  </fo:simple-page-master>
143
147
 
144
148
  <!-- cover page -->
145
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
149
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
146
150
  <fo:region-body margin-top="19.2mm" margin-bottom="5mm" margin-left="19.2mm" margin-right="19.2mm"/>
147
151
  <fo:region-before region-name="cover-page-header" extent="19.2mm" display-align="center"/>
148
152
  <fo:region-after/>
@@ -151,7 +155,7 @@
151
155
  </fo:simple-page-master>
152
156
  <!-- contents pages -->
153
157
  <!-- odd pages Preface -->
154
- <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
158
+ <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
155
159
  <fo:region-body margin-top="19.2mm" margin-bottom="19.2mm" margin-left="19.2mm" margin-right="19.2mm"/>
156
160
  <fo:region-before region-name="header-odd" extent="19.2mm" display-align="center"/>
157
161
  <fo:region-after region-name="footer-odd" extent="19.2mm"/>
@@ -159,7 +163,7 @@
159
163
  <fo:region-end region-name="right-region" extent="19.2mm"/>
160
164
  </fo:simple-page-master>
161
165
  <!-- even pages Preface -->
162
- <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
166
+ <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
163
167
  <fo:region-body margin-top="19.2mm" margin-bottom="19.2mm" margin-left="19.2mm" margin-right="19.2mm"/>
164
168
  <fo:region-before region-name="header-even" extent="19.2mm" display-align="center"/>
165
169
  <fo:region-after region-name="footer-even" extent="19.2mm"/>
@@ -173,20 +177,20 @@
173
177
  </fo:repeatable-page-master-alternatives>
174
178
  </fo:page-sequence-master>
175
179
  <!-- odd pages Body -->
176
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
177
- <fo:region-body margin-top="20mm" margin-bottom="20mm" margin-left="20mm" margin-right="20mm"/>
178
- <fo:region-before region-name="header-odd" extent="20mm" display-align="center"/>
179
- <fo:region-after region-name="footer-odd" extent="20mm"/>
180
- <fo:region-start region-name="left-region" extent="20mm"/>
181
- <fo:region-end region-name="right-region" extent="20mm"/>
180
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
181
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
182
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm" display-align="center"/>
183
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
184
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
185
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
182
186
  </fo:simple-page-master>
183
187
  <!-- even pages Body -->
184
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
185
- <fo:region-body margin-top="20mm" margin-bottom="20mm" margin-left="20mm" margin-right="20mm"/>
186
- <fo:region-before region-name="header-even" extent="20mm" display-align="center"/>
187
- <fo:region-after region-name="footer-even" extent="20mm"/>
188
- <fo:region-start region-name="left-region" extent="20mm"/>
189
- <fo:region-end region-name="right-region" extent="20mm"/>
188
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
189
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
190
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm" display-align="center"/>
191
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
192
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
193
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
190
194
  </fo:simple-page-master>
191
195
  <fo:page-sequence-master master-name="document">
192
196
  <fo:repeatable-page-master-alternatives>
@@ -2249,6 +2253,7 @@
2249
2253
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
2250
2254
 
2251
2255
 
2256
+
2252
2257
  <xsl:attribute name="color">blue</xsl:attribute>
2253
2258
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2254
2259
 
@@ -2469,14 +2474,15 @@
2469
2474
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
2470
2475
 
2471
2476
  <!-- Normative references -->
2472
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
2477
+ <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"/>
2473
2478
  <!-- Terms and definitions -->
2474
2479
  <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"/>
2475
2480
  <!-- Another main sections -->
2476
2481
  <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"/>
2477
2482
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
2478
2483
  <!-- Bibliography -->
2479
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
2484
+ <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"/>
2485
+
2480
2486
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2481
2487
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
2482
2488
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -3261,6 +3267,7 @@
3261
3267
 
3262
3268
 
3263
3269
 
3270
+
3264
3271
  <xsl:if test="ancestor::*[local-name()='preface']">
3265
3272
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
3266
3273
  </xsl:if>
@@ -3307,6 +3314,7 @@
3307
3314
 
3308
3315
 
3309
3316
 
3317
+
3310
3318
  <fo:inline padding-right="2mm">
3311
3319
 
3312
3320
 
@@ -3357,6 +3365,7 @@
3357
3365
 
3358
3366
 
3359
3367
 
3368
+
3360
3369
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
3361
3370
  <xsl:attribute name="font-size">70%</xsl:attribute>
3362
3371
 
@@ -3507,6 +3516,9 @@
3507
3516
 
3508
3517
 
3509
3518
 
3519
+
3520
+
3521
+
3510
3522
  <xsl:attribute name="vertical-align">super</xsl:attribute>
3511
3523
  <xsl:attribute name="color">blue</xsl:attribute>
3512
3524
 
@@ -4431,6 +4443,7 @@
4431
4443
  <fo:inline xsl:use-attribute-sets="link-style">
4432
4444
 
4433
4445
 
4446
+
4434
4447
  <xsl:choose>
4435
4448
  <xsl:when test="$target_text = ''">
4436
4449
  <xsl:apply-templates/>
@@ -4787,6 +4800,234 @@
4787
4800
  <xsl:param name="height"/>
4788
4801
  <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; "/>
4789
4802
  <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; "/>
4803
+ </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">
4804
+ <xsl:param name="name"/>
4805
+
4806
+ <xsl:variable name="svg_content">
4807
+ <xsl:apply-templates select="." mode="svg_update"/>
4808
+ </xsl:variable>
4809
+
4810
+ <xsl:variable name="alt-text">
4811
+ <xsl:choose>
4812
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
4813
+ <xsl:value-of select="../*[local-name() = 'name']"/>
4814
+ </xsl:when>
4815
+ <xsl:when test="normalize-space($name) != ''">
4816
+ <xsl:value-of select="$name"/>
4817
+ </xsl:when>
4818
+ <xsl:otherwise>Figure</xsl:otherwise>
4819
+ </xsl:choose>
4820
+ </xsl:variable>
4821
+
4822
+ <xsl:choose>
4823
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
4824
+ <fo:block>
4825
+ <xsl:variable name="width" select="@width"/>
4826
+ <xsl:variable name="height" select="@height"/>
4827
+
4828
+ <xsl:variable name="scale_x">
4829
+ <xsl:choose>
4830
+ <xsl:when test="$width &gt; $width_effective_px">
4831
+ <xsl:value-of select="$width_effective_px div $width"/>
4832
+ </xsl:when>
4833
+ <xsl:otherwise>1</xsl:otherwise>
4834
+ </xsl:choose>
4835
+ </xsl:variable>
4836
+
4837
+ <xsl:variable name="scale_y">
4838
+ <xsl:choose>
4839
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
4840
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
4841
+ </xsl:when>
4842
+ <xsl:otherwise>1</xsl:otherwise>
4843
+ </xsl:choose>
4844
+ </xsl:variable>
4845
+
4846
+ <xsl:variable name="scale">
4847
+ <xsl:choose>
4848
+ <xsl:when test="$scale_y != 1">
4849
+ <xsl:value-of select="$scale_x * $scale_y"/>
4850
+ </xsl:when>
4851
+ <xsl:otherwise>
4852
+ <xsl:value-of select="$scale_x"/>
4853
+ </xsl:otherwise>
4854
+ </xsl:choose>
4855
+ </xsl:variable>
4856
+
4857
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
4858
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
4859
+
4860
+ <fo:table table-layout="fixed" width="100%">
4861
+ <fo:table-column column-width="proportional-column-width(1)"/>
4862
+ <fo:table-column column-width="{$width_scale}px"/>
4863
+ <fo:table-column column-width="proportional-column-width(1)"/>
4864
+ <fo:table-body>
4865
+ <fo:table-row>
4866
+ <fo:table-cell column-number="2">
4867
+ <fo:block>
4868
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
4869
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4870
+ <fo:block line-height="0" font-size="0">
4871
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4872
+ <xsl:call-template name="bookmark"/>
4873
+ </xsl:for-each>
4874
+ </fo:block>
4875
+ </xsl:if>
4876
+ <fo:block text-depth="0" line-height="0" font-size="0">
4877
+
4878
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4879
+ <xsl:attribute name="width">100%</xsl:attribute>
4880
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4881
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4882
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4883
+
4884
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
4885
+ </fo:instream-foreign-object>
4886
+ </fo:block>
4887
+
4888
+ <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">
4889
+ <xsl:with-param name="scale" select="$scale"/>
4890
+ </xsl:apply-templates>
4891
+ </fo:block-container>
4892
+ </fo:block>
4893
+ </fo:table-cell>
4894
+ </fo:table-row>
4895
+ </fo:table-body>
4896
+ </fo:table>
4897
+ </fo:block>
4898
+
4899
+ </xsl:when>
4900
+ <xsl:otherwise>
4901
+ <fo:block xsl:use-attribute-sets="image-style">
4902
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4903
+ <xsl:attribute name="width">100%</xsl:attribute>
4904
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4905
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4906
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4907
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4908
+ <!-- effective height / width = 1.48, 1.4 - with title -->
4909
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4910
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4911
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4912
+ </xsl:if>
4913
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4914
+ <xsl:copy-of select="$svg_content"/>
4915
+ </fo:instream-foreign-object>
4916
+ </fo:block>
4917
+ </xsl:otherwise>
4918
+ </xsl:choose>
4919
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
4920
+ <xsl:copy>
4921
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
4922
+ </xsl:copy>
4923
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
4924
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4925
+ <xsl:value-of select="."/>
4926
+ </xsl:attribute>
4927
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4928
+ <xsl:variable name="svg_content" select="document(@src)"/>
4929
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4930
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
4931
+ <xsl:call-template name="image_svg">
4932
+ <xsl:with-param name="name" select="$name"/>
4933
+ </xsl:call-template>
4934
+ </xsl:for-each>
4935
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
4936
+ <xsl:copy>
4937
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
4938
+ </xsl:copy>
4939
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
4940
+ <xsl:apply-templates mode="svg_remove_a"/>
4941
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
4942
+ <xsl:param name="scale"/>
4943
+ <xsl:variable name="dest">
4944
+ <xsl:choose>
4945
+ <xsl:when test="starts-with(@href, '#')">
4946
+ <xsl:value-of select="substring-after(@href, '#')"/>
4947
+ </xsl:when>
4948
+ <xsl:otherwise>
4949
+ <xsl:value-of select="@href"/>
4950
+ </xsl:otherwise>
4951
+ </xsl:choose>
4952
+ </xsl:variable>
4953
+ <xsl:for-each select="./*[local-name() = 'rect']">
4954
+ <xsl:call-template name="insertSVGMapLink">
4955
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
4956
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
4957
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
4958
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
4959
+ <xsl:with-param name="dest" select="$dest"/>
4960
+ </xsl:call-template>
4961
+ </xsl:for-each>
4962
+
4963
+ <xsl:for-each select="./*[local-name() = 'polygon']">
4964
+ <xsl:variable name="points">
4965
+ <xsl:call-template name="split">
4966
+ <xsl:with-param name="pText" select="@points"/>
4967
+ </xsl:call-template>
4968
+ </xsl:variable>
4969
+ <xsl:variable name="x_coords">
4970
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
4971
+ <xsl:sort select="." data-type="number"/>
4972
+ <x><xsl:value-of select="."/></x>
4973
+ </xsl:for-each>
4974
+ </xsl:variable>
4975
+ <xsl:variable name="y_coords">
4976
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
4977
+ <xsl:sort select="." data-type="number"/>
4978
+ <y><xsl:value-of select="."/></y>
4979
+ </xsl:for-each>
4980
+ </xsl:variable>
4981
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
4982
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
4983
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
4984
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
4985
+ <xsl:call-template name="insertSVGMapLink">
4986
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
4987
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
4988
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
4989
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
4990
+ <xsl:with-param name="dest" select="$dest"/>
4991
+ </xsl:call-template>
4992
+ </xsl:for-each>
4993
+
4994
+ <xsl:for-each select="./*[local-name() = 'circle']">
4995
+ <xsl:call-template name="insertSVGMapLink">
4996
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
4997
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
4998
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
4999
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
5000
+ <xsl:with-param name="dest" select="$dest"/>
5001
+ </xsl:call-template>
5002
+ </xsl:for-each>
5003
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
5004
+ <xsl:call-template name="insertSVGMapLink">
5005
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
5006
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
5007
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
5008
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
5009
+ <xsl:with-param name="dest" select="$dest"/>
5010
+ </xsl:call-template>
5011
+ </xsl:for-each>
5012
+ </xsl:template><xsl:template name="insertSVGMapLink">
5013
+ <xsl:param name="left"/>
5014
+ <xsl:param name="top"/>
5015
+ <xsl:param name="width"/>
5016
+ <xsl:param name="height"/>
5017
+ <xsl:param name="dest"/>
5018
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
5019
+ <fo:block font-size="1pt">
5020
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
5021
+ <fo:inline-container inline-progression-dimension="100%">
5022
+ <fo:block-container height="{$height - 1}px" width="100%">
5023
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
5024
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
5025
+ </xsl:if> -->
5026
+ <fo:block> </fo:block></fo:block-container>
5027
+ </fo:inline-container>
5028
+ </fo:basic-link>
5029
+ </fo:block>
5030
+ </fo:block-container>
4790
5031
  </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">
4791
5032
  <xsl:apply-templates mode="contents"/>
4792
5033
  <xsl:text> </xsl:text>
@@ -4815,28 +5056,39 @@
4815
5056
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
4816
5057
  <xsl:for-each select="xalan:nodeset($contents)/doc">
4817
5058
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5059
+ <xsl:if test="@bundle = 'true'">
5060
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
5061
+ </xsl:if>
4818
5062
  <fo:bookmark-title>
4819
- <xsl:variable name="bookmark-title_">
4820
- <xsl:call-template name="getLangVersion">
4821
- <xsl:with-param name="lang" select="@lang"/>
4822
- <xsl:with-param name="doctype" select="@doctype"/>
4823
- <xsl:with-param name="title" select="@title-part"/>
4824
- </xsl:call-template>
4825
- </xsl:variable>
4826
5063
  <xsl:choose>
4827
- <xsl:when test="normalize-space($bookmark-title_) != ''">
4828
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
4829
- </xsl:when>
4830
- <xsl:otherwise>
5064
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
5065
+ <xsl:variable name="bookmark-title_">
5066
+ <xsl:call-template name="getLangVersion">
5067
+ <xsl:with-param name="lang" select="@lang"/>
5068
+ <xsl:with-param name="doctype" select="@doctype"/>
5069
+ <xsl:with-param name="title" select="@title-part"/>
5070
+ </xsl:call-template>
5071
+ </xsl:variable>
4831
5072
  <xsl:choose>
4832
- <xsl:when test="@lang = 'en'">English</xsl:when>
4833
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
4834
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4835
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5073
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
5074
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
5075
+ </xsl:when>
5076
+ <xsl:otherwise>
5077
+ <xsl:choose>
5078
+ <xsl:when test="@lang = 'en'">English</xsl:when>
5079
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
5080
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5081
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5082
+ </xsl:choose>
5083
+ </xsl:otherwise>
4836
5084
  </xsl:choose>
5085
+ </xsl:when>
5086
+ <xsl:otherwise>
5087
+ <xsl:value-of select="@title-part"/>
4837
5088
  </xsl:otherwise>
4838
5089
  </xsl:choose>
4839
5090
  </fo:bookmark-title>
5091
+
4840
5092
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4841
5093
 
4842
5094
  <xsl:call-template name="insertFigureBookmarks">
@@ -4935,16 +5187,23 @@
4935
5187
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
4936
5188
  </xsl:choose>
4937
5189
  </xsl:template><xsl:template match="item" mode="bookmark">
4938
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
4939
- <fo:bookmark-title>
4940
- <xsl:if test="@section != ''">
4941
- <xsl:value-of select="@section"/>
4942
- <xsl:text> </xsl:text>
4943
- </xsl:if>
4944
- <xsl:value-of select="normalize-space(title)"/>
4945
- </fo:bookmark-title>
4946
- <xsl:apply-templates mode="bookmark"/>
4947
- </fo:bookmark>
5190
+ <xsl:choose>
5191
+ <xsl:when test="@id != ''">
5192
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
5193
+ <fo:bookmark-title>
5194
+ <xsl:if test="@section != ''">
5195
+ <xsl:value-of select="@section"/>
5196
+ <xsl:text> </xsl:text>
5197
+ </xsl:if>
5198
+ <xsl:value-of select="normalize-space(title)"/>
5199
+ </fo:bookmark-title>
5200
+ <xsl:apply-templates mode="bookmark"/>
5201
+ </fo:bookmark>
5202
+ </xsl:when>
5203
+ <xsl:otherwise>
5204
+ <xsl:apply-templates mode="bookmark"/>
5205
+ </xsl:otherwise>
5206
+ </xsl:choose>
4948
5207
  </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">
4949
5208
  <xsl:if test="normalize-space() != ''">
4950
5209
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -5490,6 +5749,7 @@
5490
5749
  </xsl:if>
5491
5750
 
5492
5751
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5752
+
5493
5753
  <xsl:if test="normalize-space(@citeas) = ''">
5494
5754
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5495
5755
  </xsl:if>