metanorma-iho 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,42 +6,45 @@
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
9
- <xsl:variable name="title-en"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@language = 'en']/node()"/></xsl:variable>
10
- <xsl:variable name="title-main_"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'main']/node()"/></xsl:variable>
11
- <xsl:variable name="title-main"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-main']/node()"/></xsl:variable>
12
- <xsl:variable name="title-appendix"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-appendix']/node()"/></xsl:variable>
13
- <xsl:variable name="title-annex"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-annex']/node()"/></xsl:variable>
14
- <xsl:variable name="title-part"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-part']/node()"/></xsl:variable>
15
- <xsl:variable name="title-supplement"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-supplement']/node()"/></xsl:variable>
16
- <xsl:variable name="title_header">
17
- <xsl:copy-of select="$title-main_"/>
18
- <xsl:if test="normalize-space($title-main_) = ''"><xsl:copy-of select="$title-en"/></xsl:if>
19
- </xsl:variable>
20
-
21
- <xsl:variable name="docidentifier_parent" select="normalize-space(/mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'IHO-parent-document'])"/>
22
- <xsl:variable name="docidentifier">
23
- <xsl:value-of select="$docidentifier_parent"/>
24
- <xsl:if test="$docidentifier_parent = ''"><xsl:value-of select="/mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'IHO']"/></xsl:if>
25
- </xsl:variable>
26
- <xsl:variable name="copyrightText" select="concat('© International Hydrographic Association ', /mn:metanorma/mn:bibdata/mn:copyright/mn:from ,' – All rights reserved')"/>
27
- <xsl:variable name="edition">
28
- <xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:edition[normalize-space(@language) = '']"/>
29
- </xsl:variable>
30
- <xsl:variable name="month_year">
31
- <xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:date[@type = 'published']"/>
32
- </xsl:variable>
33
-
34
9
  <!-- Example:
35
10
  <item level="1" id="Foreword" display="true">Foreword</item>
36
11
  <item id="term-script" display="false">3.2</item>
37
12
  -->
38
13
  <xsl:variable name="contents_">
39
- <mnx:contents>
40
- <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
41
- <xsl:call-template name="processMainSectionsDefault_Contents"/>
14
+ <xsl:variable name="bundle" select="count(//mn:metanorma) &gt; 1"/>
15
+ <xsl:for-each select="//mn:metanorma">
16
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
17
+ <xsl:variable name="docidentifier"><xsl:value-of select="mn:bibdata/mn:docidentifier[@type = 'IHO']"/></xsl:variable>
18
+ <xsl:variable name="docnumber_">
19
+ <xsl:choose>
20
+ <xsl:when test="ancestor::*[local-name() = 'doc-container'] and (preceding::mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'IHO'] = $docidentifier or following::mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'IHO'] = $docidentifier)">
21
+ <xsl:variable name="doc_container_id" select="ancestor::*[local-name() = 'doc-container']/@id"/>
22
+ <xsl:value-of select="ancestor::*[local-name() = 'metanorma-collection']//*[local-name() = 'entry'][@target = $doc_container_id]/*[local-name() = 'identifier']"/>
23
+ </xsl:when>
24
+ <xsl:otherwise>
25
+ <xsl:value-of select="$docidentifier"/>
26
+ <xsl:if test="normalize-space($docidentifier) = ''">
27
+ <xsl:value-of select="mn:bibdata/mn:docidentifier[1]"/>
28
+ </xsl:if>
29
+ </xsl:otherwise>
30
+ </xsl:choose>
31
+ </xsl:variable>
32
+ <xsl:variable name="docnumber" select="normalize-space($docnumber_)"/>
33
+ <xsl:variable name="current_document">
34
+ <xsl:copy-of select="."/>
35
+ </xsl:variable>
42
36
 
43
- <xsl:call-template name="processTablesFigures_Contents"/>
44
- </mnx:contents>
37
+ <xsl:for-each select="xalan:nodeset($current_document)"> <!-- <xsl:for-each select="."> -->
38
+ <mnx:doc num="{$num}" firstpage_id="firstpage_id_{$num}" title-part="{$docnumber}" bundle="{$bundle}"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
39
+ <mnx:contents>
40
+ <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
41
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
42
+
43
+ <xsl:call-template name="processTablesFigures_Contents"/>
44
+ </mnx:contents>
45
+ </mnx:doc>
46
+ </xsl:for-each>
47
+ </xsl:for-each>
45
48
  </xsl:variable>
46
49
  <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
47
50
 
@@ -94,6 +97,13 @@
94
97
  <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
95
98
  <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
96
99
  </fo:simple-page-master>
100
+ <fo:simple-page-master master-name="blankpage-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
101
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
102
+ <fo:region-before region-name="header-blank" extent="{$marginTop}mm"/>
103
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
104
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
105
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
106
+ </fo:simple-page-master>
97
107
  <!-- Preface pages -->
98
108
  <fo:page-sequence-master master-name="preface">
99
109
  <fo:repeatable-page-master-alternatives>
@@ -105,7 +115,7 @@
105
115
  </fo:page-sequence-master>
106
116
  <fo:page-sequence-master master-name="preface-landscape">
107
117
  <fo:repeatable-page-master-alternatives>
108
- <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
118
+ <fo:conditional-page-master-reference master-reference="blankpage-landscape" blank-or-not-blank="blank"/>
109
119
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-landscape"/>
110
120
  <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-landscape"/>
111
121
  </fo:repeatable-page-master-alternatives>
@@ -127,7 +137,7 @@
127
137
  </fo:page-sequence-master>
128
138
  <fo:page-sequence-master master-name="document-landscape">
129
139
  <fo:repeatable-page-master-alternatives>
130
- <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
140
+ <fo:conditional-page-master-reference master-reference="blankpage-landscape" blank-or-not-blank="blank"/>
131
141
  <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-landscape"/>
132
142
  <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-landscape"/>
133
143
  </fo:repeatable-page-master-alternatives>
@@ -165,154 +175,213 @@
165
175
  </redirect:write>
166
176
  </xsl:if>
167
177
 
168
- <xsl:for-each select="xalan:nodeset($updated_xml)/*">
178
+ <!-- <xsl:for-each select="xalan:nodeset($updated_xml)/*"> -->
179
+ <xsl:for-each select="xalan:nodeset($updated_xml)//mn:metanorma">
180
+ <xsl:variable name="num"><xsl:number level="any" count="mn:metanorma"/></xsl:variable>
169
181
 
170
- <xsl:call-template name="cover-page"/>
171
-
172
- <xsl:choose>
173
- <xsl:when test="/mn:metanorma/mn:boilerplate/*[not(self::mn:feedback-statement)]">
174
- <fo:page-sequence master-reference="preface" format="i" force-page-count="no-force">
175
- <xsl:call-template name="insertHeaderFooter">
176
- <xsl:with-param name="font-weight">normal</xsl:with-param>
177
- </xsl:call-template>
178
- <fo:flow flow-name="xsl-region-body">
179
- <fo:block-container margin-left="-1.5mm" margin-right="-1mm">
180
- <fo:block-container margin-left="0mm" margin-right="0mm" border="0.5pt solid black">
181
- <fo:block-container margin-top="6.5mm" margin-left="7.5mm" margin-right="8.5mm" margin-bottom="7.5mm">
182
- <fo:block-container margin="0">
183
- <fo:block text-align="justify">
184
- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/*[not(self::mn:feedback-statement)]"/>
185
- </fo:block>
186
- </fo:block-container>
187
- </fo:block-container>
188
- </fo:block-container>
189
- </fo:block-container>
190
- </fo:flow>
191
- </fo:page-sequence>
192
- </xsl:when>
193
- <xsl:otherwise>
194
- <!-- https://github.com/metanorma/metanorma-iho/issues/293:
195
- If the publication has no copyright boxed note (normally on page ii of the publication), page ii should be "Page intentionally left blank". -->
196
- <fo:page-sequence master-reference="blankpage" format="i" force-page-count="no-force">
197
- <xsl:call-template name="insertHeaderFooterBlank"/>
198
- <fo:flow flow-name="xsl-region-body">
199
- <fo:block/>
200
- </fo:flow>
201
- </fo:page-sequence>
202
- </xsl:otherwise>
203
- </xsl:choose>
204
-
205
- <xsl:variable name="updated_xml_with_pages">
206
- <xsl:call-template name="processPrefaceAndMainSectionsIHO_items"/>
182
+ <xsl:variable name="current_document">
183
+ <xsl:copy-of select="."/>
207
184
  </xsl:variable>
208
185
 
209
- <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
186
+ <xsl:for-each select="xalan:nodeset($current_document)">
210
187
 
211
- <xsl:for-each select=".//mn:page_sequence[parent::mn:preface][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
188
+ <xsl:variable name="title-en"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@language = 'en']/node()"/></xsl:variable>
189
+ <xsl:variable name="title-main_"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'main']/node()"/></xsl:variable>
212
190
 
213
- <!-- Preface Pages -->
214
- <fo:page-sequence master-reference="preface" format="i" force-page-count="end-on-even">
191
+ <xsl:variable name="title_header">
192
+ <xsl:copy-of select="$title-main_"/>
193
+ <xsl:if test="normalize-space($title-main_) = ''"><xsl:copy-of select="$title-en"/></xsl:if>
194
+ </xsl:variable>
215
195
 
216
- <xsl:attribute name="master-reference">
217
- <xsl:text>preface</xsl:text>
218
- <xsl:call-template name="getPageSequenceOrientation"/>
219
- </xsl:attribute>
196
+ <xsl:variable name="docidentifier_parent" select="normalize-space(/mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'IHO-parent-document'])"/>
197
+ <xsl:variable name="docidentifier">
198
+ <xsl:value-of select="$docidentifier_parent"/>
199
+ <xsl:if test="$docidentifier_parent = ''"><xsl:value-of select="/mn:metanorma/mn:bibdata/mn:docidentifier[@type = 'IHO']"/></xsl:if>
200
+ </xsl:variable>
220
201
 
221
- <xsl:call-template name="insertFootnoteSeparatorCommon"/>
222
- <xsl:call-template name="insertHeaderFooter">
223
- <xsl:with-param name="font-weight">normal</xsl:with-param>
224
- </xsl:call-template>
225
- <fo:flow flow-name="xsl-region-body">
202
+ <xsl:variable name="copyrightText" select="concat('© International Hydrographic Association ', /mn:metanorma/mn:bibdata/mn:copyright/mn:from ,' – All rights reserved')"/>
203
+ <xsl:variable name="edition"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:edition[normalize-space(@language) = '']"/></xsl:variable>
204
+ <xsl:variable name="month_year"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:date[@type = 'published']"/></xsl:variable>
205
+
206
+ <xsl:call-template name="cover-page">
207
+ <xsl:with-param name="num" select="$num"/>
208
+ <xsl:with-param name="docidentifier" select="$docidentifier"/>
209
+ <xsl:with-param name="edition" select="$edition"/>
210
+ <xsl:with-param name="month_year" select="$month_year"/>
211
+ </xsl:call-template>
226
212
 
227
- <!-- <xsl:if test="position() = 1">
213
+ <xsl:choose>
214
+ <xsl:when test="/mn:metanorma/mn:boilerplate/*[not(self::mn:feedback-statement)]">
215
+ <fo:page-sequence master-reference="preface" format="i" force-page-count="no-force">
216
+ <xsl:call-template name="insertHeaderFooter">
217
+ <xsl:with-param name="title_header" select="$title_header"/>
218
+ <xsl:with-param name="docidentifier" select="$docidentifier"/>
219
+ <xsl:with-param name="edition" select="$edition"/>
220
+ <xsl:with-param name="month_year" select="$month_year"/>
221
+ <xsl:with-param name="font-weight">normal</xsl:with-param>
222
+ </xsl:call-template>
223
+ <fo:flow flow-name="xsl-region-body">
228
224
  <fo:block-container margin-left="-1.5mm" margin-right="-1mm">
229
- <fo:block-container margin-left="0mm" margin-right="0mm" border="0.5pt solid black" >
225
+ <fo:block-container margin-left="0mm" margin-right="0mm" border="0.5pt solid black">
230
226
  <fo:block-container margin-top="6.5mm" margin-left="7.5mm" margin-right="8.5mm" margin-bottom="7.5mm">
231
227
  <fo:block-container margin="0">
232
228
  <fo:block text-align="justify">
233
- <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/*[local-name() != 'feedback-statement']"/>
229
+ <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/*[not(self::mn:feedback-statement)]"/>
234
230
  </fo:block>
235
231
  </fo:block-container>
236
232
  </fo:block-container>
237
233
  </fo:block-container>
238
234
  </fo:block-container>
239
- <fo:block break-after="page"/>
240
- </xsl:if> -->
235
+ </fo:flow>
236
+ </fo:page-sequence>
237
+ </xsl:when>
238
+ <xsl:otherwise>
239
+ <!-- https://github.com/metanorma/metanorma-iho/issues/293:
240
+ If the publication has no copyright boxed note (normally on page ii of the publication), page ii should be "Page intentionally left blank". -->
241
+ <fo:page-sequence master-reference="blankpage" format="i" force-page-count="no-force">
242
+ <xsl:call-template name="insertHeaderFooterBlank">
243
+ <xsl:with-param name="title_header" select="$title_header"/>
244
+ <xsl:with-param name="docidentifier" select="$docidentifier"/>
245
+ <xsl:with-param name="edition" select="$edition"/>
246
+ <xsl:with-param name="month_year" select="$month_year"/>
247
+ </xsl:call-template>
248
+ <fo:flow flow-name="xsl-region-body">
249
+ <fo:block/>
250
+ </fo:flow>
251
+ </fo:page-sequence>
252
+ </xsl:otherwise>
253
+ </xsl:choose>
241
254
 
242
- <!-- Contents, Document History, ... except Foreword and Introduction -->
243
- <!-- <xsl:call-template name="processPrefaceSectionsDefault"/> -->
244
- <xsl:apply-templates select="*[not(self::mn:foreword) and not(self::mn:introduction)]"/>
255
+ <xsl:variable name="updated_xml_with_pages">
256
+ <xsl:call-template name="processPrefaceAndMainSectionsIHO_items"/>
257
+ </xsl:variable>
245
258
 
246
- </fo:flow>
247
- </fo:page-sequence>
248
- <!-- End Preface Pages -->
249
- <!-- =========================== -->
250
- <!-- =========================== -->
251
- </xsl:for-each>
259
+ <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
252
260
 
253
- <xsl:for-each select=".//mn:page_sequence[mn:foreword or mn:introduction][parent::mn:preface][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
261
+ <xsl:for-each select=".//mn:page_sequence[parent::mn:preface][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
254
262
 
255
- <!-- Preface Pages -->
256
- <fo:page-sequence master-reference="preface" format="i" force-page-count="end-on-even">
263
+ <!-- Preface Pages -->
264
+ <fo:page-sequence master-reference="preface" format="i" force-page-count="end-on-even">
257
265
 
258
- <xsl:attribute name="master-reference">
259
- <xsl:text>preface</xsl:text>
260
- <xsl:call-template name="getPageSequenceOrientation"/>
261
- </xsl:attribute>
266
+ <xsl:attribute name="master-reference">
267
+ <xsl:text>preface</xsl:text>
268
+ <xsl:call-template name="getPageSequenceOrientation"/>
269
+ </xsl:attribute>
262
270
 
263
- <xsl:call-template name="insertFootnoteSeparatorCommon"/>
264
- <xsl:call-template name="insertHeaderFooter">
265
- <xsl:with-param name="font-weight">normal</xsl:with-param>
266
- </xsl:call-template>
267
- <fo:flow flow-name="xsl-region-body">
271
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
272
+ <xsl:call-template name="insertHeaderFooter">
273
+ <xsl:with-param name="title_header" select="$title_header"/>
274
+ <xsl:with-param name="docidentifier" select="$docidentifier"/>
275
+ <xsl:with-param name="edition" select="$edition"/>
276
+ <xsl:with-param name="month_year" select="$month_year"/>
277
+ <xsl:with-param name="font-weight">normal</xsl:with-param>
278
+ <xsl:with-param name="orientation"><xsl:call-template name="getPageSequenceOrientation"/></xsl:with-param>
279
+ </xsl:call-template>
280
+ <fo:flow flow-name="xsl-region-body">
281
+
282
+ <!-- <xsl:if test="position() = 1">
283
+ <fo:block-container margin-left="-1.5mm" margin-right="-1mm">
284
+ <fo:block-container margin-left="0mm" margin-right="0mm" border="0.5pt solid black" >
285
+ <fo:block-container margin-top="6.5mm" margin-left="7.5mm" margin-right="8.5mm" margin-bottom="7.5mm">
286
+ <fo:block-container margin="0">
287
+ <fo:block text-align="justify">
288
+ <xsl:apply-templates select="/mn:metanorma/mn:boilerplate/*[local-name() != 'feedback-statement']"/>
289
+ </fo:block>
290
+ </fo:block-container>
291
+ </fo:block-container>
292
+ </fo:block-container>
293
+ </fo:block-container>
294
+ <fo:block break-after="page"/>
295
+ </xsl:if> -->
268
296
 
269
- <!-- Foreword, Introduction -->
270
- <xsl:apply-templates select="*[self::mn:foreword or self::mn:introduction]"/>
297
+ <!-- Contents, Document History, ... except Foreword and Introduction -->
298
+ <!-- <xsl:call-template name="processPrefaceSectionsDefault"/> -->
299
+ <xsl:apply-templates select="*[not(self::mn:foreword) and not(self::mn:introduction)]">
300
+ <xsl:with-param name="num" select="$num"/>
301
+ </xsl:apply-templates>
271
302
 
272
- </fo:flow>
273
- </fo:page-sequence>
274
- <!-- End Preface Pages -->
275
- <!-- =========================== -->
276
- <!-- =========================== -->
277
- </xsl:for-each>
303
+ </fo:flow>
304
+ </fo:page-sequence>
305
+ <!-- End Preface Pages -->
306
+ <!-- =========================== -->
307
+ <!-- =========================== -->
308
+ </xsl:for-each>
278
309
 
279
- <xsl:for-each select=".//mn:page_sequence[not(parent::mn:preface)][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
310
+ <xsl:for-each select=".//mn:page_sequence[mn:foreword or mn:introduction][parent::mn:preface][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
280
311
 
281
- <fo:page-sequence master-reference="document" format="1" force-page-count="end-on-even">
312
+ <!-- Preface Pages -->
313
+ <fo:page-sequence master-reference="preface" format="i" force-page-count="end-on-even">
282
314
 
283
- <xsl:attribute name="master-reference">
284
- <xsl:text>document</xsl:text>
285
- <xsl:call-template name="getPageSequenceOrientation"/>
286
- </xsl:attribute>
315
+ <xsl:attribute name="master-reference">
316
+ <xsl:text>preface</xsl:text>
317
+ <xsl:call-template name="getPageSequenceOrientation"/>
318
+ </xsl:attribute>
287
319
 
288
- <xsl:if test="position() = 1">
289
- <xsl:attribute name="initial-page-number">1</xsl:attribute>
290
- </xsl:if>
320
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
321
+ <xsl:call-template name="insertHeaderFooter">
322
+ <xsl:with-param name="title_header" select="$title_header"/>
323
+ <xsl:with-param name="docidentifier" select="$docidentifier"/>
324
+ <xsl:with-param name="edition" select="$edition"/>
325
+ <xsl:with-param name="month_year" select="$month_year"/>
326
+ <xsl:with-param name="font-weight">normal</xsl:with-param>
327
+ <xsl:with-param name="orientation"><xsl:call-template name="getPageSequenceOrientation"/></xsl:with-param>
328
+ </xsl:call-template>
329
+ <fo:flow flow-name="xsl-region-body">
291
330
 
292
- <xsl:call-template name="insertFootnoteSeparatorCommon"/>
293
- <xsl:call-template name="insertHeaderFooter"/>
294
- <fo:flow flow-name="xsl-region-body">
295
- <fo:block-container>
331
+ <!-- Foreword, Introduction -->
332
+ <xsl:apply-templates select="*[self::mn:foreword or self::mn:introduction]"/>
296
333
 
297
- <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt" role="H1"><xsl:value-of select="$title-en"/></fo:block> -->
334
+ </fo:flow>
335
+ </fo:page-sequence>
336
+ <!-- End Preface Pages -->
337
+ <!-- =========================== -->
338
+ <!-- =========================== -->
339
+ </xsl:for-each>
298
340
 
299
- <!-- <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" /> -->
300
- <!-- Normative references -->
301
- <!-- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" /> -->
302
- <!-- Terms and definitions -->
303
- <!-- <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms']" />
304
- <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='definitions']" />
305
- <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope')]" /> -->
341
+ <xsl:for-each select=".//mn:page_sequence[not(parent::mn:preface)][normalize-space() != '' or .//mn:image or .//*[local-name() = 'svg']]">
306
342
 
307
- <!-- <xsl:call-template name="processMainSectionsDefault"/> -->
343
+ <fo:page-sequence master-reference="document" format="1" force-page-count="end-on-even">
308
344
 
309
- <xsl:apply-templates/>
345
+ <xsl:attribute name="master-reference">
346
+ <xsl:text>document</xsl:text>
347
+ <xsl:call-template name="getPageSequenceOrientation"/>
348
+ </xsl:attribute>
310
349
 
311
- <xsl:if test="$table_if = 'true'"><fo:block/></xsl:if>
312
- </fo:block-container>
313
- </fo:flow>
314
- </fo:page-sequence>
315
- <!-- </xsl:if> -->
350
+ <xsl:if test="position() = 1">
351
+ <xsl:attribute name="initial-page-number">1</xsl:attribute>
352
+ </xsl:if>
353
+
354
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
355
+ <xsl:call-template name="insertHeaderFooter">
356
+ <xsl:with-param name="title_header" select="$title_header"/>
357
+ <xsl:with-param name="docidentifier" select="$docidentifier"/>
358
+ <xsl:with-param name="edition" select="$edition"/>
359
+ <xsl:with-param name="month_year" select="$month_year"/>
360
+ <xsl:with-param name="orientation"><xsl:call-template name="getPageSequenceOrientation"/></xsl:with-param>
361
+ </xsl:call-template>
362
+ <fo:flow flow-name="xsl-region-body">
363
+ <fo:block-container>
364
+
365
+ <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt" role="H1"><xsl:value-of select="$title-en"/></fo:block> -->
366
+
367
+ <!-- <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" /> -->
368
+ <!-- Normative references -->
369
+ <!-- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" /> -->
370
+ <!-- Terms and definitions -->
371
+ <!-- <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms']" />
372
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='definitions']" />
373
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope')]" /> -->
374
+
375
+ <!-- <xsl:call-template name="processMainSectionsDefault"/> -->
376
+
377
+ <xsl:apply-templates/>
378
+
379
+ <xsl:if test="$table_if = 'true'"><fo:block/></xsl:if>
380
+ </fo:block-container>
381
+ </fo:flow>
382
+ </fo:page-sequence>
383
+ <!-- </xsl:if> -->
384
+ </xsl:for-each>
316
385
  </xsl:for-each>
317
386
  </xsl:for-each>
318
387
 
@@ -362,11 +431,31 @@
362
431
  </xsl:template>
363
432
 
364
433
  <xsl:template name="cover-page">
434
+ <xsl:param name="num"/>
435
+ <xsl:param name="docidentifier"/>
436
+ <xsl:param name="edition"/>
437
+ <xsl:param name="month_year"/>
438
+
439
+ <xsl:variable name="title-en"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@language = 'en']/node()"/></xsl:variable>
440
+ <xsl:variable name="title-main_"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'main']/node()"/></xsl:variable>
441
+ <xsl:variable name="title-main"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-main']/node()"/></xsl:variable>
442
+ <xsl:variable name="title-appendix"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-appendix']/node()"/></xsl:variable>
443
+ <xsl:variable name="title-annex"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-annex']/node()"/></xsl:variable>
444
+ <xsl:variable name="title-part"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-part']/node()"/></xsl:variable>
445
+ <xsl:variable name="title-supplement"><xsl:apply-templates select="/mn:metanorma/mn:bibdata/mn:title[@type = 'title-supplement']/node()"/></xsl:variable>
446
+
365
447
  <!-- =========================== -->
366
448
  <!-- Cover Page -->
367
449
  <fo:page-sequence master-reference="cover-page">
368
450
  <fo:flow flow-name="xsl-region-body">
369
451
 
452
+ <fo:block-container absolute-position="fixed" top="1mm">
453
+ <xsl:if test="$num = 1">
454
+ <xsl:attribute name="id">firstpage_id_0</xsl:attribute>
455
+ </xsl:if>
456
+ <fo:block id="firstpage_id_{$num}"> </fo:block>
457
+ </fo:block-container>
458
+
370
459
  <xsl:variable name="isCoverPageImage" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata[mn:name = 'coverpage-image']/mn:value/mn:image and 1 = 1)"/>
371
460
 
372
461
  <xsl:variable name="document_scheme" select="normalize-space(/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata[mn:name = 'document-scheme']/mn:value)"/>
@@ -377,7 +466,7 @@
377
466
  </xsl:when>
378
467
  <xsl:otherwise>
379
468
 
380
- <fo:block-container position="absolute" left="14.25mm" top="12mm" id="__internal_layout__coverpage_{generate-id()}">
469
+ <fo:block-container position="absolute" left="14.25mm" top="12mm" id="__internal_layout__coverpage_{$num}_{generate-id()}">
381
470
  <fo:table table-layout="fixed" width="181.1mm">
382
471
  <fo:table-column column-width="26mm"/>
383
472
  <fo:table-column column-width="19.4mm"/>
@@ -416,28 +505,11 @@
416
505
  <fo:block-container font-size="0"> <!-- height="168mm" width="115mm" -->
417
506
  <fo:block>
418
507
  <xsl:for-each select="/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata[mn:name = 'coverpage-image'][1]/mn:value/mn:image[1]">
419
- <xsl:choose>
420
- <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
421
- <fo:instream-foreign-object fox:alt-text="Image Front">
422
- <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
423
- <xsl:call-template name="getSVG"/>
424
- </fo:instream-foreign-object>
425
- </xsl:when>
426
- <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
427
- <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
428
- </xsl:when>
429
- <xsl:otherwise> <!-- bitmap image -->
430
- <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
431
- <xsl:if test="$coverimage_src != ''">
432
- <xsl:variable name="coverpage">
433
- <xsl:call-template name="getImageURL">
434
- <xsl:with-param name="src" select="$coverimage_src"/>
435
- </xsl:call-template>
436
- </xsl:variable>
437
- <fo:external-graphic src="{$coverpage}" width="155.5mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
438
- </xsl:if>
439
- </xsl:otherwise>
440
- </xsl:choose>
508
+
509
+ <xsl:call-template name="insertPageImage">
510
+ <xsl:with-param name="bitmap_width">155.5</xsl:with-param>
511
+ </xsl:call-template>
512
+
441
513
  </xsl:for-each>
442
514
  </fo:block>
443
515
  </fo:block-container>
@@ -605,6 +677,7 @@
605
677
  </xsl:template>
606
678
 
607
679
  <xsl:template match="mn:preface//mn:clause[@type = 'toc']" name="toc" priority="4">
680
+ <xsl:param name="num"/>
608
681
  <!-- Table of Contents -->
609
682
  <fo:block>
610
683
 
@@ -620,7 +693,7 @@
620
693
 
621
694
  <fo:block role="TOC" xsl:use-attribute-sets="toc-style">
622
695
 
623
- <xsl:for-each select="$contents//mnx:item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
696
+ <xsl:for-each select="$contents/mnx:doc[@num = $num]//mnx:item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
624
697
  <fo:block role="TOCI">
625
698
  <fo:list-block xsl:use-attribute-sets="toc-item-block-style">
626
699
 
@@ -628,7 +701,7 @@
628
701
 
629
702
  <fo:list-item>
630
703
  <fo:list-item-label end-indent="label-end()">
631
- <fo:block id="__internal_layout__toc_sectionnum_{generate-id()}">
704
+ <fo:block id="__internal_layout__toc_sectionnum_{$num}_{generate-id()}">
632
705
  <xsl:if test="@section != '' and not(@type = 'annex')"> <!-- output below -->
633
706
  <xsl:value-of select="@section"/>
634
707
  </xsl:if>
@@ -784,7 +857,7 @@
784
857
  <fo:inline><xsl:copy-of select="@id"/><xsl:apply-templates/></fo:inline>
785
858
  </xsl:template>
786
859
 
787
- <xsl:template match="/mn:metanorma/mn:bibdata/mn:edition">
860
+ <xsl:template match="mn:metanorma/mn:bibdata/mn:edition">
788
861
  <xsl:call-template name="capitalize">
789
862
  <xsl:with-param name="str">
790
863
  <xsl:call-template name="getLocalizedString">
@@ -796,7 +869,7 @@
796
869
  <xsl:apply-templates/>
797
870
  </xsl:template>
798
871
 
799
- <xsl:template match="/mn:metanorma/mn:bibdata/mn:date[@type = 'published']">
872
+ <xsl:template match="mn:metanorma/mn:bibdata/mn:date[@type = 'published']">
800
873
  <xsl:call-template name="convertDate">
801
874
  <xsl:with-param name="date" select="."/>
802
875
  <xsl:with-param name="format" select="'short'"/>
@@ -821,15 +894,21 @@
821
894
  <!-- title -->
822
895
  <!-- ====== -->
823
896
 
824
- <xsl:template match="mn:annex/mn:fmt-title">
825
- <fo:block font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always" role="H1">
897
+ <xsl:template match="mn:annex/mn:fmt-title" name="annex_title">
898
+ <fo:block xsl:use-attribute-sets="annex-title-style">
899
+
900
+ <xsl:call-template name="refine_annex-title-style"/>
901
+
826
902
  <xsl:apply-templates/>
827
903
  <xsl:apply-templates select="following-sibling::*[1][mn:variant-title][@type = 'sub']" mode="subtitle"/>
828
904
  </fo:block>
829
905
  </xsl:template>
830
906
 
831
907
  <xsl:template match="mn:bibliography/mn:references[not(@normative='true')]/mn:fmt-title">
832
- <fo:block font-size="16pt" font-weight="bold" text-align="center" margin-top="6pt" margin-bottom="36pt" keep-with-next="always" role="H1">
908
+ <fo:block xsl:use-attribute-sets="references-non-normative-title-style">
909
+
910
+ <xsl:call-template name="refine_references-non-normative-title-style"/>
911
+
833
912
  <xsl:apply-templates/>
834
913
  </fo:block>
835
914
  </xsl:template>
@@ -976,10 +1055,16 @@
976
1055
  <xsl:attribute name="space-after">0pt</xsl:attribute>
977
1056
  </xsl:if>
978
1057
 
1058
+ <xsl:if test="ancestor::mn:li and ancestor::mn:table">
1059
+ <xsl:attribute name="space-after">0pt</xsl:attribute>
1060
+ </xsl:if>
1061
+
979
1062
  <xsl:if test=".//mn:fn">
980
1063
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
981
1064
  </xsl:if>
982
1065
 
1066
+ <xsl:copy-of select="@id"/>
1067
+
983
1068
  <xsl:apply-templates>
984
1069
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
985
1070
  </xsl:apply-templates>
@@ -1033,7 +1118,12 @@
1033
1118
  <xsl:template match="mn:index"/>
1034
1119
 
1035
1120
  <xsl:template name="insertHeaderFooter">
1121
+ <xsl:param name="title_header"/>
1122
+ <xsl:param name="docidentifier"/>
1123
+ <xsl:param name="edition"/>
1124
+ <xsl:param name="month_year"/>
1036
1125
  <xsl:param name="font-weight" select="'bold'"/>
1126
+ <xsl:param name="orientation"/>
1037
1127
  <fo:static-content flow-name="header-odd" role="artifact">
1038
1128
  <fo:block-container height="100%" font-size="8pt">
1039
1129
  <fo:block padding-top="12.5mm">
@@ -1070,10 +1160,19 @@
1070
1160
  </fo:block>
1071
1161
  </fo:block-container>
1072
1162
  </fo:static-content>
1073
- <xsl:call-template name="insertHeaderBlank"/>
1074
- <xsl:call-template name="insertFooter"/>
1163
+ <xsl:call-template name="insertHeaderBlank">
1164
+ <xsl:with-param name="title_header" select="$title_header"/>
1165
+ <xsl:with-param name="orientation" select="$orientation"/>
1166
+ </xsl:call-template>
1167
+ <xsl:call-template name="insertFooter">
1168
+ <xsl:with-param name="docidentifier" select="$docidentifier"/>
1169
+ <xsl:with-param name="edition" select="$edition"/>
1170
+ <xsl:with-param name="month_year" select="$month_year"/>
1171
+ </xsl:call-template>
1075
1172
  </xsl:template>
1076
1173
  <xsl:template name="insertHeaderBlank">
1174
+ <xsl:param name="title_header"/>
1175
+ <xsl:param name="orientation"/>
1077
1176
  <fo:static-content flow-name="header-blank" role="artifact">
1078
1177
  <fo:block-container height="100%" font-size="8pt">
1079
1178
  <fo:block padding-top="12.5mm">
@@ -1092,11 +1191,18 @@
1092
1191
  </fo:block>
1093
1192
  </fo:block-container>
1094
1193
  <fo:block-container position="absolute" left="40.5mm" top="130mm" height="4mm" width="79mm" border="0.75pt solid black" text-align="center" display-align="center" line-height="100%">
1194
+ <xsl:if test="$orientation = '-landscape'">
1195
+ <xsl:attribute name="left">84mm</xsl:attribute>
1196
+ <xsl:attribute name="top">87mm</xsl:attribute>
1197
+ </xsl:if>
1095
1198
  <fo:block>Page intentionally left blank</fo:block>
1096
1199
  </fo:block-container>
1097
1200
  </fo:static-content>
1098
1201
  </xsl:template>
1099
1202
  <xsl:template name="insertFooter">
1203
+ <xsl:param name="docidentifier"/>
1204
+ <xsl:param name="edition"/>
1205
+ <xsl:param name="month_year"/>
1100
1206
  <fo:static-content flow-name="footer" role="artifact">
1101
1207
  <fo:block-container height="100%" display-align="after">
1102
1208
  <fo:block padding-bottom="12.5mm" font-size="8pt" text-align-last="justify">
@@ -1114,8 +1220,18 @@
1114
1220
  </fo:static-content>
1115
1221
  </xsl:template>
1116
1222
  <xsl:template name="insertHeaderFooterBlank">
1117
- <xsl:call-template name="insertHeaderBlank"/>
1118
- <xsl:call-template name="insertFooter"/>
1223
+ <xsl:param name="title_header"/>
1224
+ <xsl:param name="docidentifier"/>
1225
+ <xsl:param name="edition"/>
1226
+ <xsl:param name="month_year"/>
1227
+ <xsl:call-template name="insertHeaderBlank">
1228
+ <xsl:with-param name="title_header" select="$title_header"/>
1229
+ </xsl:call-template>
1230
+ <xsl:call-template name="insertFooter">
1231
+ <xsl:with-param name="docidentifier" select="$docidentifier"/>
1232
+ <xsl:with-param name="edition" select="$edition"/>
1233
+ <xsl:with-param name="month_year" select="$month_year"/>
1234
+ </xsl:call-template>
1119
1235
  </xsl:template>
1120
1236
 
1121
1237
  <xsl:variable name="Image-IHO-SVG">
@@ -2761,42 +2877,86 @@
2761
2877
  <xsl:attribute-set name="copyright-statement-style">
2762
2878
  </xsl:attribute-set> <!-- copyright-statement-style -->
2763
2879
 
2880
+ <xsl:template name="refine_copyright-statement-style">
2881
+ </xsl:template>
2882
+
2764
2883
  <xsl:attribute-set name="copyright-statement-title-style">
2765
2884
  </xsl:attribute-set> <!-- copyright-statement-title-style -->
2766
2885
 
2886
+ <xsl:template name="refine_copyright-statement-title-style">
2887
+ </xsl:template>
2888
+
2767
2889
  <xsl:attribute-set name="copyright-statement-p-style">
2768
2890
  </xsl:attribute-set> <!-- copyright-statement-p-style -->
2769
2891
 
2770
- <xsl:attribute-set name="license-statement-style">
2892
+ <xsl:template name="refine_copyright-statement-p-style">
2893
+
2894
+ </xsl:template>
2895
+
2896
+ <xsl:attribute-set name="license-statement-style">
2771
2897
  </xsl:attribute-set> <!-- license-statement-style -->
2772
2898
 
2899
+ <xsl:template name="refine_license-statement-style">
2900
+ </xsl:template>
2901
+
2773
2902
  <xsl:attribute-set name="license-statement-title-style">
2774
2903
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2775
2904
  </xsl:attribute-set> <!-- license-statement-title-style -->
2776
2905
 
2906
+ <xsl:template name="refine_license-statement-title-style">
2907
+ </xsl:template>
2908
+
2777
2909
  <xsl:attribute-set name="license-statement-p-style">
2778
2910
  </xsl:attribute-set> <!-- license-statement-p-style -->
2779
2911
 
2912
+ <xsl:template name="refine_license-statement-p-style">
2913
+
2914
+ </xsl:template>
2915
+
2780
2916
  <xsl:attribute-set name="legal-statement-style">
2781
2917
  </xsl:attribute-set> <!-- legal-statement-style -->
2782
2918
 
2919
+ <xsl:template name="refine_legal-statement-style">
2920
+ </xsl:template>
2921
+
2783
2922
  <xsl:attribute-set name="legal-statement-title-style">
2784
2923
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2785
2924
  </xsl:attribute-set> <!-- legal-statement-title-style -->
2786
2925
 
2926
+ <xsl:template name="refine_legal-statement-title-style">
2927
+ </xsl:template>
2928
+
2787
2929
  <xsl:attribute-set name="legal-statement-p-style">
2788
2930
  </xsl:attribute-set> <!-- legal-statement-p-style -->
2789
2931
 
2932
+ <xsl:template name="refine_legal-statement-p-style">
2933
+ <xsl:if test="@align">
2934
+ <xsl:attribute name="text-align">
2935
+ <xsl:value-of select="@align"/>
2936
+ </xsl:attribute>
2937
+ </xsl:if>
2938
+ </xsl:template>
2939
+
2790
2940
  <xsl:attribute-set name="feedback-statement-style">
2791
2941
  </xsl:attribute-set> <!-- feedback-statement-style -->
2792
2942
 
2943
+ <xsl:template name="refine_feedback-statement-style">
2944
+ </xsl:template>
2945
+
2793
2946
  <xsl:attribute-set name="feedback-statement-title-style">
2794
2947
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2795
2948
  </xsl:attribute-set> <!-- feedback-statement-title-style -->
2796
2949
 
2950
+ <xsl:template name="refine_feedback-statement-title-style">
2951
+
2952
+ </xsl:template>
2953
+
2797
2954
  <xsl:attribute-set name="feedback-statement-p-style">
2798
2955
  </xsl:attribute-set> <!-- feedback-statement-p-style -->
2799
2956
 
2957
+ <xsl:template name="refine_feedback-statement-p-style">
2958
+ </xsl:template>
2959
+
2800
2960
  <!-- End boilerplate sections styles -->
2801
2961
 
2802
2962
  <!-- ================================= -->
@@ -2804,6 +2964,8 @@
2804
2964
  <!-- ================================= -->
2805
2965
  <xsl:template match="mn:copyright-statement">
2806
2966
  <fo:block xsl:use-attribute-sets="copyright-statement-style" role="SKIP">
2967
+ <xsl:call-template name="refine_copyright-statement-style"/>
2968
+
2807
2969
  <xsl:apply-templates/>
2808
2970
  </fo:block>
2809
2971
  </xsl:template> <!-- copyright-statement -->
@@ -2820,6 +2982,7 @@
2820
2982
 
2821
2983
  <xsl:template match="mn:license-statement">
2822
2984
  <fo:block xsl:use-attribute-sets="license-statement-style">
2985
+ <xsl:call-template name="refine_license-statement-style"/>
2823
2986
  <xsl:apply-templates/>
2824
2987
  </fo:block>
2825
2988
  </xsl:template> <!-- license-statement -->
@@ -2837,6 +3000,7 @@
2837
3000
  <xsl:template match="mn:legal-statement">
2838
3001
  <xsl:param name="isLegacy">false</xsl:param>
2839
3002
  <fo:block xsl:use-attribute-sets="legal-statement-style">
3003
+ <xsl:call-template name="refine_legal-statement-style"/>
2840
3004
  <xsl:apply-templates/>
2841
3005
  </fo:block>
2842
3006
  </xsl:template> <!-- legal-statement -->
@@ -3006,6 +3170,27 @@
3006
3170
  <xsl:attribute-set name="sourcecode-container-style">
3007
3171
  </xsl:attribute-set>
3008
3172
 
3173
+ <xsl:template name="refine_sourcecode-container-style">
3174
+ <xsl:if test="not(ancestor::mn:li) or ancestor::mn:example">
3175
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3176
+ </xsl:if>
3177
+
3178
+ <xsl:if test="ancestor::mn:example">
3179
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3180
+ </xsl:if>
3181
+
3182
+ <xsl:copy-of select="@id"/>
3183
+
3184
+ <xsl:if test="parent::mn:note">
3185
+ <xsl:attribute name="margin-left">
3186
+ <xsl:choose>
3187
+ <xsl:when test="not(ancestor::mn:table)"><xsl:value-of select="$note-body-indent"/></xsl:when>
3188
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3189
+ </xsl:choose>
3190
+ </xsl:attribute>
3191
+ </xsl:if>
3192
+ </xsl:template>
3193
+
3009
3194
  <xsl:attribute-set name="sourcecode-style">
3010
3195
  <xsl:attribute name="white-space">pre</xsl:attribute>
3011
3196
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -3027,6 +3212,9 @@
3027
3212
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
3028
3213
  </xsl:attribute-set> <!-- sourcecode-name-style -->
3029
3214
 
3215
+ <xsl:template name="refine_sourcecode-name-style">
3216
+ </xsl:template>
3217
+
3030
3218
  <xsl:template name="add-zero-spaces-equal">
3031
3219
  <xsl:param name="text" select="."/>
3032
3220
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
@@ -3114,24 +3302,8 @@
3114
3302
  <xsl:otherwise>
3115
3303
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style" role="SKIP">
3116
3304
 
3117
- <xsl:if test="not(ancestor::mn:li) or ancestor::mn:example">
3118
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
3119
- </xsl:if>
3120
-
3121
- <xsl:if test="ancestor::mn:example">
3122
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
3123
- </xsl:if>
3124
-
3125
- <xsl:copy-of select="@id"/>
3305
+ <xsl:call-template name="refine_sourcecode-container-style"/>
3126
3306
 
3127
- <xsl:if test="parent::mn:note">
3128
- <xsl:attribute name="margin-left">
3129
- <xsl:choose>
3130
- <xsl:when test="not(ancestor::mn:table)"><xsl:value-of select="$note-body-indent"/></xsl:when>
3131
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3132
- </xsl:choose>
3133
- </xsl:attribute>
3134
- </xsl:if>
3135
3307
  <fo:block-container margin-left="0mm" role="SKIP">
3136
3308
 
3137
3309
  <fo:block xsl:use-attribute-sets="sourcecode-style">
@@ -3458,6 +3630,7 @@
3458
3630
  <xsl:template match="mn:sourcecode/mn:fmt-name">
3459
3631
  <xsl:if test="normalize-space() != ''">
3460
3632
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
3633
+ <xsl:call-template name="refine_sourcecode-name-style"/>
3461
3634
  <xsl:apply-templates/>
3462
3635
  </fo:block>
3463
3636
  </xsl:if>
@@ -3506,12 +3679,31 @@
3506
3679
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3507
3680
  <xsl:attribute name="font-family">Fira Code, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
3508
3681
  <xsl:attribute name="line-height">113%</xsl:attribute>
3509
- </xsl:attribute-set>
3682
+ </xsl:attribute-set> <!-- pre-style -->
3683
+
3684
+ <xsl:template name="refine_pre-style">
3685
+ </xsl:template>
3510
3686
 
3511
3687
  <xsl:attribute-set name="tt-style">
3512
3688
  <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
3513
3689
  </xsl:attribute-set>
3514
3690
 
3691
+ <xsl:template name="refine_tt-style">
3692
+ <xsl:variable name="_font-size">9.5 <!-- inherit -->
3693
+ </xsl:variable>
3694
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
3695
+ <xsl:if test="$font-size != ''">
3696
+ <xsl:attribute name="font-size">
3697
+ <xsl:choose>
3698
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3699
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3700
+ <xsl:when test="ancestor::mn:note or ancestor::mn:example"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3701
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3702
+ </xsl:choose>
3703
+ </xsl:attribute>
3704
+ </xsl:if>
3705
+ </xsl:template>
3706
+
3515
3707
  <xsl:variable name="color-added-text">
3516
3708
  <xsl:text>rgb(0, 255, 0)</xsl:text>
3517
3709
  </xsl:variable>
@@ -3524,9 +3716,14 @@
3524
3716
  <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
3525
3717
  </xsl:attribute-set>
3526
3718
 
3719
+ <xsl:template name="refine_add-style">
3720
+ </xsl:template>
3721
+
3527
3722
  <xsl:variable name="add-style">
3528
- <add-style xsl:use-attribute-sets="add-style"/>
3529
- </xsl:variable>
3723
+ <add-style xsl:use-attribute-sets="add-style">
3724
+ <xsl:call-template name="refine_add-style"/>
3725
+ </add-style>
3726
+ </xsl:variable>
3530
3727
  <xsl:template name="append_add-style">
3531
3728
  <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
3532
3729
  </xsl:template>
@@ -3539,24 +3736,77 @@
3539
3736
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
3540
3737
  </xsl:attribute-set>
3541
3738
 
3739
+ <xsl:template name="refine_del-style">
3740
+ </xsl:template>
3741
+
3742
+ <xsl:attribute-set name="strong-style">
3743
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3744
+ </xsl:attribute-set>
3745
+
3746
+ <xsl:template name="refine_strong_style">
3747
+ <xsl:if test="ancestor::*['preferred']">
3748
+ <xsl:attribute name="role">SKIP</xsl:attribute>
3749
+ </xsl:if>
3750
+ </xsl:template> <!-- refine_strong_style -->
3751
+
3752
+ <xsl:attribute-set name="em-style">
3753
+ <xsl:attribute name="font-style">italic</xsl:attribute>
3754
+ </xsl:attribute-set>
3755
+
3756
+ <xsl:template name="refine_em_style">
3757
+ </xsl:template> <!-- refine_em_style -->
3758
+
3759
+ <xsl:attribute-set name="sup-style">
3760
+ <xsl:attribute name="font-size">80%</xsl:attribute>
3761
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
3762
+ </xsl:attribute-set>
3763
+
3764
+ <xsl:template name="refine_sup-style">
3765
+ </xsl:template>
3766
+
3767
+ <xsl:attribute-set name="sub-style">
3768
+ <xsl:attribute name="font-size">80%</xsl:attribute>
3769
+ <xsl:attribute name="vertical-align">sub</xsl:attribute>
3770
+ </xsl:attribute-set>
3771
+
3772
+ <xsl:template name="refine_sub-style">
3773
+ </xsl:template>
3774
+
3775
+ <xsl:attribute-set name="underline-style">
3776
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3777
+ </xsl:attribute-set>
3778
+
3779
+ <xsl:template name="refine_underline-style">
3780
+ </xsl:template>
3781
+
3782
+ <xsl:attribute-set name="hi-style">
3783
+ <xsl:attribute name="background-color">yellow</xsl:attribute>
3784
+ </xsl:attribute-set>
3785
+
3786
+ <xsl:template name="refine_hi-style">
3787
+ </xsl:template>
3788
+
3789
+ <xsl:attribute-set name="strike-style">
3790
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
3791
+ </xsl:attribute-set>
3792
+
3793
+ <xsl:template name="refine_strike-style">
3794
+ </xsl:template>
3795
+
3542
3796
  <xsl:template match="mn:br">
3543
3797
  <xsl:value-of select="$linebreak"/>
3544
3798
  </xsl:template>
3545
3799
 
3546
- <xsl:template match="mn:em">
3547
- <fo:inline font-style="italic">
3548
- <xsl:call-template name="refine_italic_style"/>
3800
+ <xsl:template match="mn:em">
3801
+ <fo:inline xsl:use-attribute-sets="em-style">
3802
+ <xsl:call-template name="refine_em_style"/>
3549
3803
  <xsl:apply-templates/>
3550
3804
  </fo:inline>
3551
3805
  </xsl:template>
3552
3806
 
3553
- <xsl:template name="refine_italic_style">
3554
- </xsl:template>
3555
-
3556
3807
  <xsl:template match="mn:strong | *[local-name()='b']">
3557
3808
  <xsl:param name="split_keep-within-line"/>
3558
- <fo:inline font-weight="bold">
3559
-
3809
+ <fo:inline xsl:use-attribute-sets="strong-style">
3560
3810
  <xsl:call-template name="refine_strong_style"/>
3561
3811
 
3562
3812
  <xsl:apply-templates>
@@ -3565,44 +3815,27 @@
3565
3815
  </fo:inline>
3566
3816
  </xsl:template>
3567
3817
 
3568
- <xsl:template name="refine_strong_style">
3569
- <xsl:if test="ancestor::*['preferred']">
3570
- <xsl:attribute name="role">SKIP</xsl:attribute>
3571
- </xsl:if>
3572
- </xsl:template>
3573
-
3574
3818
  <xsl:template match="*[local-name()='padding']">
3575
3819
  <fo:inline padding-right="{@value}"> </fo:inline>
3576
3820
  </xsl:template>
3577
3821
 
3578
3822
  <xsl:template match="mn:sup">
3579
- <fo:inline font-size="80%" vertical-align="super">
3823
+ <fo:inline xsl:use-attribute-sets="sup-style">
3824
+ <xsl:call-template name="refine_sup-style"/>
3580
3825
  <xsl:apply-templates/>
3581
3826
  </fo:inline>
3582
3827
  </xsl:template>
3583
3828
 
3584
3829
  <xsl:template match="mn:sub">
3585
- <fo:inline font-size="80%" vertical-align="sub">
3830
+ <fo:inline xsl:use-attribute-sets="sub-style">
3831
+ <xsl:call-template name="refine_sub-style"/>
3586
3832
  <xsl:apply-templates/>
3587
3833
  </fo:inline>
3588
3834
  </xsl:template>
3589
3835
 
3590
3836
  <xsl:template match="mn:tt">
3591
3837
  <fo:inline xsl:use-attribute-sets="tt-style">
3592
-
3593
- <xsl:variable name="_font-size">9.5 <!-- inherit -->
3594
- </xsl:variable>
3595
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
3596
- <xsl:if test="$font-size != ''">
3597
- <xsl:attribute name="font-size">
3598
- <xsl:choose>
3599
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3600
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3601
- <xsl:when test="ancestor::mn:note or ancestor::mn:example"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3602
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3603
- </xsl:choose>
3604
- </xsl:attribute>
3605
- </xsl:if>
3838
+ <xsl:call-template name="refine_tt-style"/>
3606
3839
  <xsl:apply-templates/>
3607
3840
  </fo:inline>
3608
3841
  </xsl:template> <!-- tt -->
@@ -3621,7 +3854,8 @@
3621
3854
  </xsl:template>
3622
3855
 
3623
3856
  <xsl:template match="mn:underline">
3624
- <fo:inline text-decoration="underline">
3857
+ <fo:inline xsl:use-attribute-sets="underline-style">
3858
+ <xsl:call-template name="refine_underline-style"/>
3625
3859
  <xsl:apply-templates/>
3626
3860
  </fo:inline>
3627
3861
  </xsl:template>
@@ -3779,6 +4013,7 @@
3779
4013
 
3780
4014
  <xsl:template match="mn:del">
3781
4015
  <fo:inline xsl:use-attribute-sets="del-style">
4016
+ <xsl:call-template name="refine_del-style"/>
3782
4017
  <xsl:apply-templates/>
3783
4018
  </fo:inline>
3784
4019
  </xsl:template>
@@ -3788,7 +4023,8 @@
3788
4023
 
3789
4024
  <!-- highlight text -->
3790
4025
  <xsl:template match="mn:hi | mn:span[@class = 'fmt-hi']" priority="3">
3791
- <fo:inline background-color="yellow">
4026
+ <fo:inline xsl:use-attribute-sets="hi-style">
4027
+ <xsl:call-template name="refine_hi-style"/>
3792
4028
  <xsl:apply-templates/>
3793
4029
  </fo:inline>
3794
4030
  </xsl:template>
@@ -3874,7 +4110,8 @@
3874
4110
  </xsl:template>
3875
4111
 
3876
4112
  <xsl:template match="mn:strike">
3877
- <fo:inline text-decoration="line-through">
4113
+ <fo:inline xsl:use-attribute-sets="strike-style">
4114
+ <xsl:call-template name="refine_strike-style"/>
3878
4115
  <xsl:apply-templates/>
3879
4116
  </fo:inline>
3880
4117
  </xsl:template>
@@ -3902,7 +4139,7 @@
3902
4139
  </xsl:otherwise>
3903
4140
  </xsl:choose>
3904
4141
  </xsl:variable>
3905
- <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color' or $key = 'baseline-shift'">
4142
+ <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color' or $key = 'baseline-shift' or $key = 'line-height' ">
3906
4143
  <style name="{$key}"><xsl:value-of select="$value"/></style>
3907
4144
  </xsl:if>
3908
4145
  <xsl:if test="$key = 'text-indent'">
@@ -3954,6 +4191,7 @@
3954
4191
 
3955
4192
  <xsl:template match="mn:pre" name="pre">
3956
4193
  <fo:block xsl:use-attribute-sets="pre-style">
4194
+ <xsl:call-template name="refine_pre-style"/>
3957
4195
  <xsl:copy-of select="@id"/>
3958
4196
  <xsl:choose>
3959
4197
 
@@ -3984,24 +4222,42 @@
3984
4222
  <xsl:attribute-set name="permission-style">
3985
4223
  </xsl:attribute-set>
3986
4224
 
4225
+ <xsl:template name="refine_permission-style">
4226
+ </xsl:template>
4227
+
3987
4228
  <xsl:attribute-set name="permission-name-style">
3988
4229
  <xsl:attribute name="font-weight">bold</xsl:attribute>
3989
4230
  </xsl:attribute-set>
3990
4231
 
4232
+ <xsl:template name="refine_permission-name-style">
4233
+ </xsl:template>
4234
+
3991
4235
  <xsl:attribute-set name="permission-label-style">
3992
4236
  </xsl:attribute-set>
3993
4237
 
4238
+ <xsl:template name="refine_permission-label-style">
4239
+ </xsl:template>
4240
+
3994
4241
  <xsl:attribute-set name="requirement-style">
3995
4242
  </xsl:attribute-set>
3996
4243
 
4244
+ <xsl:template name="refine_requirement-style">
4245
+ </xsl:template>
4246
+
3997
4247
  <xsl:attribute-set name="requirement-name-style">
3998
4248
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3999
4249
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4000
4250
  </xsl:attribute-set>
4001
4251
 
4252
+ <xsl:template name="refine_requirement-name-style">
4253
+ </xsl:template>
4254
+
4002
4255
  <xsl:attribute-set name="requirement-label-style">
4003
4256
  </xsl:attribute-set>
4004
4257
 
4258
+ <xsl:template name="refine_requirement-label-style">
4259
+ </xsl:template>
4260
+
4005
4261
  <xsl:attribute-set name="subject-style">
4006
4262
  </xsl:attribute-set>
4007
4263
 
@@ -4030,19 +4286,29 @@
4030
4286
  <xsl:attribute name="border">1pt solid black</xsl:attribute>
4031
4287
  </xsl:attribute-set>
4032
4288
 
4289
+ <xsl:template name="refine_recommendation-style">
4290
+ </xsl:template>
4291
+
4033
4292
  <xsl:attribute-set name="recommendation-name-style">
4034
4293
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4035
4294
  </xsl:attribute-set>
4036
4295
 
4296
+ <xsl:template name="refine_recommendation-name-style">
4297
+ </xsl:template>
4298
+
4037
4299
  <xsl:attribute-set name="recommendation-label-style">
4038
4300
  </xsl:attribute-set>
4039
4301
 
4302
+ <xsl:template name="refine_recommendation-label-style">
4303
+ </xsl:template>
4304
+
4040
4305
  <!-- ========== -->
4041
4306
  <!-- permission -->
4042
4307
  <!-- ========== -->
4043
4308
  <xsl:template match="mn:permission">
4044
4309
  <xsl:call-template name="setNamedDestination"/>
4045
4310
  <fo:block id="{@id}" xsl:use-attribute-sets="permission-style">
4311
+ <xsl:call-template name="refine_permission-style"/>
4046
4312
  <xsl:apply-templates select="mn:fmt-name"/>
4047
4313
  <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
4048
4314
  </fo:block>
@@ -4051,6 +4317,7 @@
4051
4317
  <xsl:template match="mn:permission/mn:fmt-name">
4052
4318
  <xsl:if test="normalize-space() != ''">
4053
4319
  <fo:inline xsl:use-attribute-sets="permission-name-style">
4320
+ <xsl:call-template name="refine_permission-name-style"/>
4054
4321
  <xsl:apply-templates/><xsl:text>:</xsl:text>
4055
4322
  </fo:inline>
4056
4323
 
@@ -4059,6 +4326,7 @@
4059
4326
 
4060
4327
  <xsl:template match="mn:permission/mn:label">
4061
4328
  <fo:block xsl:use-attribute-sets="permission-label-style">
4329
+ <xsl:call-template name="refine_permission-label-style"/>
4062
4330
  <xsl:apply-templates/>
4063
4331
  </fo:block>
4064
4332
  </xsl:template>
@@ -4071,6 +4339,7 @@
4071
4339
  <xsl:template match="mn:requirement">
4072
4340
  <xsl:call-template name="setNamedDestination"/>
4073
4341
  <fo:block id="{@id}" xsl:use-attribute-sets="requirement-style">
4342
+ <xsl:call-template name="refine_requirement-style"/>
4074
4343
  <xsl:apply-templates select="mn:fmt-name"/>
4075
4344
  <xsl:apply-templates select="mn:label"/>
4076
4345
  <xsl:apply-templates select="@obligation"/>
@@ -4082,6 +4351,7 @@
4082
4351
  <xsl:template match="mn:requirement/mn:fmt-name">
4083
4352
  <xsl:if test="normalize-space() != ''">
4084
4353
  <fo:inline xsl:use-attribute-sets="requirement-name-style">
4354
+ <xsl:call-template name="refine_requirement-name-style"/>
4085
4355
  <xsl:apply-templates/><xsl:text>:</xsl:text>
4086
4356
  </fo:inline>
4087
4357
 
@@ -4090,6 +4360,7 @@
4090
4360
 
4091
4361
  <xsl:template match="mn:requirement/mn:label">
4092
4362
  <fo:block xsl:use-attribute-sets="requirement-label-style">
4363
+ <xsl:call-template name="refine_requirement-label-style"/>
4093
4364
  <xsl:apply-templates/>
4094
4365
  </fo:block>
4095
4366
  </xsl:template>
@@ -4115,6 +4386,7 @@
4115
4386
  <xsl:template match="mn:recommendation">
4116
4387
  <xsl:call-template name="setNamedDestination"/>
4117
4388
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4389
+ <xsl:call-template name="refine_recommendation-style"/>
4118
4390
  <xsl:apply-templates select="mn:fmt-name"/>
4119
4391
  <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
4120
4392
  </fo:block>
@@ -4123,6 +4395,7 @@
4123
4395
  <xsl:template match="mn:recommendation/mn:fmt-name">
4124
4396
  <xsl:if test="normalize-space() != ''">
4125
4397
  <fo:inline xsl:use-attribute-sets="recommendation-name-style">
4398
+ <xsl:call-template name="refine_recommendation-name-style"/>
4126
4399
  <xsl:apply-templates/><xsl:text>:</xsl:text>
4127
4400
  </fo:inline>
4128
4401
 
@@ -4131,6 +4404,7 @@
4131
4404
 
4132
4405
  <xsl:template match="mn:recommendation/mn:label">
4133
4406
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4407
+ <xsl:call-template name="refine_recommendation-label-style"/>
4134
4408
  <xsl:apply-templates/>
4135
4409
  </fo:block>
4136
4410
  </xsl:template>
@@ -4312,36 +4586,66 @@
4312
4586
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
4313
4587
  </xsl:attribute-set> <!-- term-style -->
4314
4588
 
4589
+ <xsl:template name="refine_term-style">
4590
+ </xsl:template>
4591
+
4315
4592
  <xsl:attribute-set name="term-name-style">
4316
4593
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4317
4594
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4318
4595
  </xsl:attribute-set> <!-- term-name-style -->
4319
4596
 
4320
- <xsl:attribute-set name="preferred-block-style">
4597
+ <xsl:template name="refine_term-name-style">
4598
+ </xsl:template>
4599
+
4600
+ <xsl:attribute-set name="preferred-block-style">
4321
4601
  <xsl:attribute name="line-height">1.1</xsl:attribute>
4322
4602
  </xsl:attribute-set> <!-- preferred-block-style -->
4323
4603
 
4604
+ <xsl:template name="refine_preferred-block-style">
4605
+ </xsl:template>
4606
+
4324
4607
  <xsl:attribute-set name="preferred-term-style">
4325
4608
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4326
4609
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4327
4610
  </xsl:attribute-set> <!-- preferred-term-style -->
4328
4611
 
4612
+ <xsl:template name="refine_preferred-term-style">
4613
+ <xsl:if test="mn:strong">
4614
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
4615
+ </xsl:if>
4616
+ </xsl:template>
4617
+
4329
4618
  <xsl:attribute-set name="domain-style">
4330
4619
  </xsl:attribute-set> <!-- domain-style -->
4331
4620
 
4621
+ <xsl:template name="refine_domain-style">
4622
+ </xsl:template>
4623
+
4332
4624
  <xsl:attribute-set name="admitted-style">
4333
4625
  </xsl:attribute-set> <!-- admitted-style -->
4334
4626
 
4627
+ <xsl:template name="refine_admitted-style">
4628
+ </xsl:template>
4629
+
4335
4630
  <xsl:attribute-set name="deprecates-style">
4336
4631
  </xsl:attribute-set> <!-- deprecates-style -->
4337
4632
 
4633
+ <xsl:template name="refine_deprecates-style">
4634
+ </xsl:template>
4635
+
4338
4636
  <xsl:attribute-set name="related-block-style" use-attribute-sets="preferred-block-style">
4339
4637
  </xsl:attribute-set>
4340
4638
 
4639
+ <xsl:template name="refine_related-block-style">
4640
+ </xsl:template>
4641
+
4341
4642
  <xsl:attribute-set name="definition-style">
4342
4643
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4343
4644
  </xsl:attribute-set> <!-- definition-style -->
4344
4645
 
4646
+ <xsl:template name="refine_definition-style">
4647
+ </xsl:template>
4648
+
4345
4649
  <xsl:attribute-set name="termsource-style">
4346
4650
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4347
4651
  </xsl:attribute-set> <!-- termsource-style -->
@@ -4352,11 +4656,17 @@
4352
4656
  <xsl:attribute-set name="termsource-text-style">
4353
4657
  </xsl:attribute-set> <!-- termsource-text-style -->
4354
4658
 
4659
+ <xsl:template name="refine_termsource-text-style">
4660
+ </xsl:template>
4661
+
4355
4662
  <xsl:attribute-set name="origin-style">
4356
4663
  <xsl:attribute name="color">blue</xsl:attribute>
4357
4664
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
4358
4665
  </xsl:attribute-set> <!-- origin-style -->
4359
4666
 
4667
+ <xsl:template name="refine_origin-style">
4668
+ </xsl:template>
4669
+
4360
4670
  <!-- ====== -->
4361
4671
  <!-- term -->
4362
4672
  <!-- ====== -->
@@ -4372,9 +4682,8 @@
4372
4682
  <xsl:template match="mn:term">
4373
4683
  <xsl:call-template name="setNamedDestination"/>
4374
4684
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
4685
+ <xsl:call-template name="refine_term-style"/>
4375
4686
 
4376
- <xsl:if test="parent::mn:term and not(preceding-sibling::mn:term)">
4377
- </xsl:if>
4378
4687
  <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
4379
4688
  </fo:block>
4380
4689
  </xsl:template>
@@ -4450,6 +4759,7 @@
4450
4759
  <!-- text SOURCE: -->
4451
4760
  <xsl:template match="mn:fmt-termsource/mn:strong[1][following-sibling::*[1][self::mn:fmt-origin]]/text()">
4452
4761
  <fo:inline xsl:use-attribute-sets="termsource-text-style">
4762
+ <xsl:call-template name="refine_termsource-text-style"/>
4453
4763
  <xsl:value-of select="."/>
4454
4764
  </fo:inline>
4455
4765
  </xsl:template>
@@ -4462,6 +4772,7 @@
4462
4772
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4463
4773
  </xsl:if>
4464
4774
  <fo:inline xsl:use-attribute-sets="origin-style">
4775
+ <xsl:call-template name="refine_origin-style"/>
4465
4776
  <xsl:apply-templates/>
4466
4777
  </fo:inline>
4467
4778
  </fo:basic-link>
@@ -4511,9 +4822,12 @@
4511
4822
  </xsl:variable>
4512
4823
  <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
4513
4824
 
4825
+ <xsl:call-template name="refine_preferred-block-style"/>
4826
+
4514
4827
  <xsl:if test="parent::mn:term and not(preceding-sibling::mn:fmt-preferred)"> <!-- if first preffered in term, then display term's name -->
4515
4828
 
4516
4829
  <fo:block xsl:use-attribute-sets="term-name-style" role="SKIP">
4830
+ <xsl:call-template name="refine_term-name-style"/>
4517
4831
 
4518
4832
  <xsl:for-each select="ancestor::mn:term[1]/mn:fmt-name"><!-- change context -->
4519
4833
  <xsl:call-template name="setIDforNamedDestination"/>
@@ -4524,7 +4838,7 @@
4524
4838
  </xsl:if>
4525
4839
 
4526
4840
  <fo:block xsl:use-attribute-sets="preferred-term-style" role="SKIP">
4527
- <xsl:call-template name="setStyle_preferred"/>
4841
+ <xsl:call-template name="refine_preferred-term-style"/>
4528
4842
 
4529
4843
  <xsl:apply-templates/>
4530
4844
  </fo:block>
@@ -4545,22 +4859,18 @@
4545
4859
 
4546
4860
  <xsl:template match="mn:fmt-admitted">
4547
4861
  <fo:block xsl:use-attribute-sets="admitted-style">
4862
+ <xsl:call-template name="refine_admitted-style"/>
4548
4863
  <xsl:apply-templates/>
4549
4864
  </fo:block>
4550
4865
  </xsl:template>
4551
4866
 
4552
4867
  <xsl:template match="mn:fmt-deprecates">
4553
4868
  <fo:block xsl:use-attribute-sets="deprecates-style">
4869
+ <xsl:call-template name="refine_deprecates-style"/>
4554
4870
  <xsl:apply-templates/>
4555
4871
  </fo:block>
4556
4872
  </xsl:template>
4557
4873
 
4558
- <xsl:template name="setStyle_preferred">
4559
- <xsl:if test="mn:strong">
4560
- <xsl:attribute name="font-weight">normal</xsl:attribute>
4561
- </xsl:if>
4562
- </xsl:template>
4563
-
4564
4874
  <!-- regarding ISO 10241-1:2011, If there is more than one preferred term, each preferred term follows the previous one on a new line. -->
4565
4875
  <!-- in metanorma xml preferred terms delimited by semicolons -->
4566
4876
  <xsl:template match="mn:fmt-preferred/text()[contains(., ';')] | mn:fmt-preferred/mn:strong/text()[contains(., ';')]">
@@ -4570,6 +4880,7 @@
4570
4880
 
4571
4881
  <xsl:template match="mn:fmt-related">
4572
4882
  <fo:block role="SKIP" xsl:use-attribute-sets="related-block-style">
4883
+ <xsl:call-template name="refine_related-block-style"/>
4573
4884
  <xsl:apply-templates/>
4574
4885
  </fo:block>
4575
4886
  </xsl:template>
@@ -4584,6 +4895,7 @@
4584
4895
  <!-- ========== -->
4585
4896
  <xsl:template match="mn:fmt-definition">
4586
4897
  <fo:block xsl:use-attribute-sets="definition-style" role="SKIP">
4898
+ <xsl:call-template name="refine_definition-style"/>
4587
4899
  <xsl:apply-templates/>
4588
4900
  </fo:block>
4589
4901
  </xsl:template>
@@ -4636,6 +4948,9 @@
4636
4948
  <xsl:attribute-set name="example-body-style">
4637
4949
  </xsl:attribute-set> <!-- example-body-style -->
4638
4950
 
4951
+ <xsl:template name="refine_example-body-style">
4952
+ </xsl:template>
4953
+
4639
4954
  <xsl:attribute-set name="example-name-style">
4640
4955
  <!-- <xsl:attribute name="keep-with-next">always</xsl:attribute>
4641
4956
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -4686,6 +5001,8 @@
4686
5001
  <xsl:when test="contains($element, 'block')">
4687
5002
  <fo:block xsl:use-attribute-sets="example-p-style">
4688
5003
 
5004
+ <xsl:call-template name="refine_example-p-style"/>
5005
+
4689
5006
  <xsl:apply-templates/>
4690
5007
  </fo:block>
4691
5008
  </xsl:when>
@@ -4737,6 +5054,7 @@
4737
5054
  </fo:block>
4738
5055
 
4739
5056
  <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
5057
+ <xsl:call-template name="refine_example-body-style"/>
4740
5058
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
4741
5059
  <xsl:variable name="example_body">
4742
5060
  <xsl:apply-templates select="node()[not(self::mn:fmt-name)]">
@@ -4799,6 +5117,7 @@
4799
5117
  <xsl:if test="*[not(self::mn:fmt-name)][position() &gt; 1]">
4800
5118
  <!-- display further elements in blocks -->
4801
5119
  <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
5120
+ <xsl:call-template name="refine_example-body-style"/>
4802
5121
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
4803
5122
  <xsl:apply-templates select="*[not(self::mn:fmt-name)][position() &gt; 1]">
4804
5123
  <xsl:with-param name="fo_element" select="'block'"/>
@@ -4903,6 +5222,9 @@
4903
5222
 
4904
5223
  <xsl:template name="refine_table-container-style">
4905
5224
  <xsl:param name="margin-side"/>
5225
+ <xsl:if test="contains(translate(@style, ' ', ''), 'border:none')">
5226
+ <xsl:attribute name="font-size">inherit</xsl:attribute>
5227
+ </xsl:if>
4906
5228
  <!-- end table block-container attributes -->
4907
5229
  </xsl:template> <!-- refine_table-container-style -->
4908
5230
 
@@ -5003,6 +5325,9 @@
5003
5325
  <xsl:if test="$lang = 'ar'">
5004
5326
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
5005
5327
  </xsl:if>
5328
+ <xsl:if test="contains(translate(ancestor::mn:table/@style, ' ', ''), 'border:none')">
5329
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
5330
+ </xsl:if>
5006
5331
 
5007
5332
  <xsl:call-template name="setBordersTableArray"/>
5008
5333
 
@@ -5041,6 +5366,9 @@
5041
5366
  <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
5042
5367
  </xsl:attribute-set> <!-- table-fn-number-style -->
5043
5368
 
5369
+ <xsl:template name="refine_table-fn-number-style">
5370
+ </xsl:template>
5371
+
5044
5372
  <xsl:attribute-set name="table-fmt-fn-label-style">
5045
5373
  <xsl:attribute name="font-size">80%</xsl:attribute>
5046
5374
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -5049,30 +5377,12 @@
5049
5377
  <xsl:template name="refine_table-fmt-fn-label-style">
5050
5378
  </xsl:template>
5051
5379
 
5052
- <xsl:attribute-set name="fn-container-body-style">
5053
- <xsl:attribute name="text-indent">0</xsl:attribute>
5054
- <xsl:attribute name="start-indent">0</xsl:attribute>
5055
- </xsl:attribute-set>
5056
-
5057
5380
  <xsl:attribute-set name="table-fn-body-style">
5058
5381
  </xsl:attribute-set>
5059
5382
 
5060
- <xsl:attribute-set name="figure-fn-number-style">
5061
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
5062
- </xsl:attribute-set> <!-- figure-fn-number-style -->
5063
-
5064
- <xsl:attribute-set name="figure-fmt-fn-label-style">
5065
- <xsl:attribute name="font-size">80%</xsl:attribute>
5066
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5067
- </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
5068
-
5069
- <xsl:template name="refine_figure-fmt-fn-label-style">
5383
+ <xsl:template name="refine_table-fn-body-style">
5070
5384
  </xsl:template>
5071
5385
 
5072
- <xsl:attribute-set name="figure-fn-body-style">
5073
- <xsl:attribute name="text-align">justify</xsl:attribute>
5074
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
5075
- </xsl:attribute-set>
5076
5386
  <!-- ========================== -->
5077
5387
  <!-- END Table styles -->
5078
5388
  <!-- ========================== -->
@@ -6350,6 +6660,7 @@
6350
6660
  </xsl:apply-templates>
6351
6661
 
6352
6662
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
6663
+ <xsl:call-template name="refine_table-fn-body-style"/>
6353
6664
  <!-- <xsl:copy-of select="./node()"/> -->
6354
6665
  <xsl:apply-templates/>
6355
6666
  </fo:inline>
@@ -6368,6 +6679,7 @@
6368
6679
  <xsl:param name="process">false</xsl:param>
6369
6680
  <xsl:if test="$process = 'true'">
6370
6681
  <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
6682
+ <xsl:call-template name="refine_table-fn-number-style"/>
6371
6683
 
6372
6684
  <!-- tab is padding-right -->
6373
6685
  <xsl:apply-templates select=".//mn:tab">
@@ -7239,9 +7551,18 @@
7239
7551
  <xsl:attribute-set name="dl-block-style">
7240
7552
  </xsl:attribute-set>
7241
7553
 
7554
+ <xsl:template name="refine_dl-block-style">
7555
+ <xsl:if test="@key = 'true' and ancestor::mn:figure">
7556
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
7557
+ </xsl:if>
7558
+ </xsl:template>
7559
+
7242
7560
  <xsl:attribute-set name="dt-row-style">
7243
7561
  </xsl:attribute-set>
7244
7562
 
7563
+ <xsl:template name="refine_dt-row-style">
7564
+ </xsl:template>
7565
+
7245
7566
  <xsl:attribute-set name="dt-cell-style">
7246
7567
  </xsl:attribute-set>
7247
7568
 
@@ -7262,6 +7583,9 @@
7262
7583
  <xsl:attribute name="font-weight">normal</xsl:attribute>
7263
7584
  </xsl:attribute-set> <!-- dl-name-style -->
7264
7585
 
7586
+ <xsl:template name="refine_dl-name-style">
7587
+ </xsl:template>
7588
+
7265
7589
  <xsl:attribute-set name="dd-cell-style">
7266
7590
  <xsl:attribute name="padding-left">2mm</xsl:attribute>
7267
7591
  </xsl:attribute-set>
@@ -7300,9 +7624,7 @@
7300
7624
  <!-- <dl><xsl:copy-of select="."/></dl> -->
7301
7625
  <fo:block-container xsl:use-attribute-sets="dl-block-style" role="SKIP">
7302
7626
 
7303
- <xsl:if test="@key = 'true' and ancestor::mn:figure">
7304
- <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
7305
- </xsl:if>
7627
+ <xsl:call-template name="refine_dl-block-style"/>
7306
7628
 
7307
7629
  <xsl:call-template name="setBlockSpanAll"/>
7308
7630
  <xsl:if test="not(ancestor::mn:quote)">
@@ -7601,6 +7923,8 @@
7601
7923
  <xsl:if test="$process = 'true'">
7602
7924
  <fo:block xsl:use-attribute-sets="dl-name-style">
7603
7925
 
7926
+ <xsl:call-template name="refine_dl-name-style"/>
7927
+
7604
7928
  <xsl:apply-templates/>
7605
7929
  </fo:block>
7606
7930
  </xsl:if>
@@ -7789,6 +8113,8 @@
7789
8113
  <xsl:param name="split_keep-within-line"/>
7790
8114
 
7791
8115
  <fo:table-row xsl:use-attribute-sets="dt-row-style">
8116
+ <xsl:call-template name="refine_dt-row-style"/>
8117
+
7792
8118
  <xsl:call-template name="insert_dt_cell">
7793
8119
  <xsl:with-param name="key_iso" select="$key_iso"/>
7794
8120
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
@@ -7998,15 +8324,22 @@
7998
8324
  <xsl:attribute-set name="appendix-style">
7999
8325
  </xsl:attribute-set>
8000
8326
 
8327
+ <xsl:template name="refine_appendix-style">
8328
+ </xsl:template>
8329
+
8001
8330
  <xsl:attribute-set name="appendix-example-style">
8002
8331
  </xsl:attribute-set>
8003
8332
 
8333
+ <xsl:template name="refine_appendix-example-style">
8334
+ </xsl:template>
8335
+
8004
8336
  <!-- ======================== -->
8005
8337
  <!-- Appendix processing -->
8006
8338
  <!-- ======================== -->
8007
8339
  <xsl:template match="mn:appendix">
8008
8340
  <xsl:call-template name="setNamedDestination"/>
8009
8341
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
8342
+ <xsl:call-template name="refine_appendix-style"/>
8010
8343
  <xsl:apply-templates select="mn:fmt-title"/>
8011
8344
  </fo:block>
8012
8345
  <xsl:apply-templates select="node()[not(self::mn:fmt-title)]"/>
@@ -8025,6 +8358,7 @@
8025
8358
  <xsl:template match="mn:appendix//mn:example" priority="2">
8026
8359
  <xsl:call-template name="setNamedDestination"/>
8027
8360
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
8361
+ <xsl:call-template name="refine_appendix-example-style"/>
8028
8362
  <xsl:apply-templates select="mn:fmt-name"/>
8029
8363
  </fo:block>
8030
8364
  <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
@@ -8033,7 +8367,16 @@
8033
8367
  <xsl:attribute-set name="xref-style">
8034
8368
  <xsl:attribute name="color">blue</xsl:attribute>
8035
8369
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
8036
- </xsl:attribute-set>
8370
+ </xsl:attribute-set> <!-- xref-style -->
8371
+
8372
+ <xsl:template name="refine_xref-style">
8373
+ <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[self::mn:table or self::mn:dl])">
8374
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8375
+ </xsl:if>
8376
+ <xsl:if test="parent::mn:add">
8377
+ <xsl:call-template name="append_add-style"/>
8378
+ </xsl:if>
8379
+ </xsl:template> <!-- refine_xref-style -->
8037
8380
 
8038
8381
  <xsl:template match="mn:fmt-xref">
8039
8382
  <xsl:call-template name="insert_basic_link">
@@ -8042,12 +8385,8 @@
8042
8385
  <xsl:call-template name="getAltText"/>
8043
8386
  </xsl:variable>
8044
8387
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
8045
- <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[self::mn:table or self::mn:dl])">
8046
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8047
- </xsl:if>
8048
- <xsl:if test="parent::mn:add">
8049
- <xsl:call-template name="append_add-style"/>
8050
- </xsl:if>
8388
+ <xsl:call-template name="refine_xref-style"/>
8389
+
8051
8390
  <xsl:apply-templates/>
8052
8391
  </fo:basic-link>
8053
8392
  </xsl:with-param>
@@ -8160,10 +8499,10 @@
8160
8499
  <xsl:attribute name="margin-top">4pt</xsl:attribute>
8161
8500
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
8162
8501
  <xsl:attribute name="text-align">justify</xsl:attribute>
8163
- </xsl:attribute-set>
8502
+ </xsl:attribute-set> <!-- note-style -->
8164
8503
 
8165
8504
  <xsl:template name="refine_note-style">
8166
- </xsl:template>
8505
+ </xsl:template> <!-- refine_note-style -->
8167
8506
 
8168
8507
  <xsl:variable name="note-body-indent">10mm</xsl:variable>
8169
8508
  <xsl:variable name="note-body-indent-table">5mm</xsl:variable>
@@ -8171,7 +8510,7 @@
8171
8510
  <xsl:attribute-set name="note-name-style">
8172
8511
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
8173
8512
  <xsl:attribute name="padding-right">2mm</xsl:attribute>
8174
- </xsl:attribute-set>
8513
+ </xsl:attribute-set> <!-- note-name-style -->
8175
8514
 
8176
8515
  <xsl:template name="refine_note-name-style">
8177
8516
  </xsl:template> <!-- refine_note-name-style -->
@@ -8187,20 +8526,23 @@
8187
8526
  <xsl:attribute-set name="note-p-style">
8188
8527
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
8189
8528
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
8190
- </xsl:attribute-set>
8529
+ </xsl:attribute-set> <!-- note-p-style -->
8530
+
8531
+ <xsl:template name="refine_note-p-style">
8532
+ </xsl:template>
8191
8533
 
8192
8534
  <xsl:attribute-set name="termnote-style">
8193
8535
  <xsl:attribute name="font-size">10pt</xsl:attribute>
8194
8536
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
8195
8537
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
8196
8538
  <xsl:attribute name="text-align">justify</xsl:attribute>
8197
- </xsl:attribute-set>
8539
+ </xsl:attribute-set> <!-- termnote-style -->
8198
8540
 
8199
8541
  <xsl:template name="refine_termnote-style">
8200
8542
  </xsl:template> <!-- refine_termnote-style -->
8201
8543
 
8202
8544
  <xsl:attribute-set name="termnote-name-style">
8203
- </xsl:attribute-set>
8545
+ </xsl:attribute-set> <!-- termnote-name-style -->
8204
8546
 
8205
8547
  <xsl:template name="refine_termnote-name-style">
8206
8548
  </xsl:template>
@@ -8208,6 +8550,9 @@
8208
8550
  <xsl:attribute-set name="termnote-p-style">
8209
8551
  </xsl:attribute-set>
8210
8552
 
8553
+ <xsl:template name="refine_termnote-p-style">
8554
+ </xsl:template>
8555
+
8211
8556
  <!-- ====== -->
8212
8557
  <!-- note -->
8213
8558
  <!-- termnote -->
@@ -8268,11 +8613,13 @@
8268
8613
  <xsl:choose>
8269
8614
  <xsl:when test="$num = 1"> <!-- display first NOTE's paragraph in the same line with label NOTE -->
8270
8615
  <fo:inline xsl:use-attribute-sets="note-p-style" role="SKIP">
8616
+ <xsl:call-template name="refine_note-p-style"/>
8271
8617
  <xsl:apply-templates/>
8272
8618
  </fo:inline>
8273
8619
  </xsl:when>
8274
8620
  <xsl:otherwise>
8275
8621
  <fo:block xsl:use-attribute-sets="note-p-style" role="SKIP">
8622
+ <xsl:call-template name="refine_note-p-style"/>
8276
8623
  <xsl:apply-templates/>
8277
8624
  </fo:block>
8278
8625
  </xsl:otherwise>
@@ -8364,11 +8711,13 @@
8364
8711
  <xsl:choose>
8365
8712
  <xsl:when test="$num = 1"> <!-- first paragraph renders in the same line as titlenote name -->
8366
8713
  <fo:inline xsl:use-attribute-sets="termnote-p-style">
8714
+ <xsl:call-template name="refine_termnote-p-style"/>
8367
8715
  <xsl:apply-templates/>
8368
8716
  </fo:inline>
8369
8717
  </xsl:when>
8370
8718
  <xsl:otherwise>
8371
8719
  <fo:block xsl:use-attribute-sets="termnote-p-style">
8720
+ <xsl:call-template name="refine_termnote-p-style"/>
8372
8721
  <xsl:apply-templates/>
8373
8722
  </fo:block>
8374
8723
  </xsl:otherwise>
@@ -8384,7 +8733,7 @@
8384
8733
  <xsl:attribute name="font-family">Calibri</xsl:attribute>
8385
8734
  <xsl:attribute name="margin-left">4.5mm</xsl:attribute>
8386
8735
  <xsl:attribute name="margin-right">9mm</xsl:attribute>
8387
- </xsl:attribute-set>
8736
+ </xsl:attribute-set> <!-- quote-style -->
8388
8737
 
8389
8738
  <xsl:template name="refine_quote-style">
8390
8739
  </xsl:template>
@@ -8393,6 +8742,9 @@
8393
8742
  <xsl:attribute name="text-align">right</xsl:attribute>
8394
8743
  </xsl:attribute-set>
8395
8744
 
8745
+ <xsl:template name="refine_quote-source-style">
8746
+ </xsl:template>
8747
+
8396
8748
  <!-- ====== -->
8397
8749
  <!-- quote -->
8398
8750
  <!-- source -->
@@ -8421,6 +8773,7 @@
8421
8773
  </fo:block-container>
8422
8774
  <xsl:if test="mn:author or mn:fmt-source or mn:attribution">
8423
8775
  <fo:block xsl:use-attribute-sets="quote-source-style">
8776
+ <xsl:call-template name="refine_quote-source-style"/>
8424
8777
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
8425
8778
  <xsl:apply-templates select="mn:author"/>
8426
8779
  <xsl:apply-templates select="mn:fmt-source"/>
@@ -8483,6 +8836,9 @@
8483
8836
  <xsl:attribute-set name="figure-style">
8484
8837
  </xsl:attribute-set>
8485
8838
 
8839
+ <xsl:template name="refine_figure-style">
8840
+ </xsl:template>
8841
+
8486
8842
  <xsl:attribute-set name="figure-name-style">
8487
8843
  <xsl:attribute name="role">Caption</xsl:attribute>
8488
8844
  <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
@@ -8491,7 +8847,7 @@
8491
8847
  <xsl:attribute name="margin-top">2pt</xsl:attribute>
8492
8848
  <xsl:attribute name="space-after">6pt</xsl:attribute>
8493
8849
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
8494
- </xsl:attribute-set>
8850
+ </xsl:attribute-set> <!-- figure-name-style -->
8495
8851
 
8496
8852
  <xsl:template name="refine_figure-name-style">
8497
8853
  </xsl:template> <!-- refine_figure-name-style -->
@@ -8499,7 +8855,7 @@
8499
8855
  <xsl:attribute-set name="image-style">
8500
8856
  <xsl:attribute name="role">SKIP</xsl:attribute>
8501
8857
  <xsl:attribute name="text-align">center</xsl:attribute>
8502
- </xsl:attribute-set>
8858
+ </xsl:attribute-set> <!-- image-style -->
8503
8859
 
8504
8860
  <xsl:template name="refine_image-style">
8505
8861
  </xsl:template>
@@ -8509,14 +8865,51 @@
8509
8865
  <xsl:attribute name="content-height">100%</xsl:attribute>
8510
8866
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8511
8867
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
8512
- </xsl:attribute-set>
8868
+ </xsl:attribute-set> <!-- image-graphic-style -->
8869
+
8870
+ <xsl:template name="refine_image-graphic-style">
8871
+ </xsl:template>
8513
8872
 
8514
8873
  <xsl:attribute-set name="figure-source-style">
8515
8874
  </xsl:attribute-set>
8516
8875
 
8876
+ <xsl:template name="refine_figure-source-style">
8877
+ </xsl:template>
8878
+
8517
8879
  <xsl:attribute-set name="figure-pseudocode-p-style">
8518
8880
  </xsl:attribute-set>
8519
8881
 
8882
+ <xsl:template name="refine_figure-pseudocode-p-style">
8883
+ </xsl:template>
8884
+
8885
+ <xsl:attribute-set name="figure-fn-number-style">
8886
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
8887
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
8888
+
8889
+ <xsl:template name="refine_figure-fn-number-style">
8890
+ </xsl:template>
8891
+
8892
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
8893
+ <xsl:attribute name="font-size">80%</xsl:attribute>
8894
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
8895
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
8896
+
8897
+ <xsl:template name="refine_figure-fmt-fn-label-style">
8898
+ </xsl:template>
8899
+
8900
+ <xsl:attribute-set name="figure-fn-body-style">
8901
+ <xsl:attribute name="text-align">justify</xsl:attribute>
8902
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
8903
+ </xsl:attribute-set>
8904
+
8905
+ <xsl:template name="refine_figure-fn-body-style">
8906
+ <xsl:variable name="key_iso">
8907
+ </xsl:variable>
8908
+ <xsl:if test="normalize-space($key_iso) = 'true'">
8909
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
8910
+ </xsl:if>
8911
+ </xsl:template>
8912
+
8520
8913
  <!-- ============================ -->
8521
8914
  <!-- figure's footnotes rendering -->
8522
8915
  <!-- ============================ -->
@@ -8629,9 +9022,8 @@
8629
9022
  </fo:table-cell>
8630
9023
  <fo:table-cell>
8631
9024
  <fo:block xsl:use-attribute-sets="figure-fn-body-style">
8632
- <xsl:if test="normalize-space($key_iso) = 'true'">
8633
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
8634
- </xsl:if>
9025
+ <xsl:call-template name="refine_figure-fn-body-style"/>
9026
+
8635
9027
  <!-- <xsl:copy-of select="./node()"/> -->
8636
9028
  <xsl:apply-templates/>
8637
9029
  </fo:block>
@@ -8649,6 +9041,7 @@
8649
9041
  <xsl:param name="process">false</xsl:param>
8650
9042
  <xsl:if test="$process = 'true'">
8651
9043
  <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
9044
+ <xsl:call-template name="refine_figure-fn-number-style"/>
8652
9045
  <xsl:attribute name="padding-right">0mm</xsl:attribute>
8653
9046
 
8654
9047
  <!-- tab is padding-right -->
@@ -8686,6 +9079,7 @@
8686
9079
  <xsl:attribute name="font-size">10pt</xsl:attribute>
8687
9080
  </xsl:if>
8688
9081
  <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
9082
+ <xsl:call-template name="refine_figure-fn-number-style"/>
8689
9083
  <!-- <xsl:value-of select="@reference"/> -->
8690
9084
  <xsl:apply-templates/>
8691
9085
  </fo:inline>
@@ -8731,6 +9125,8 @@
8731
9125
 
8732
9126
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
8733
9127
 
9128
+ <xsl:call-template name="refine_figure-style"/>
9129
+
8734
9130
  <xsl:for-each select="mn:fmt-name"> <!-- set context -->
8735
9131
  <xsl:call-template name="setIDforNamedDestination"/>
8736
9132
  </xsl:for-each>
@@ -8774,6 +9170,7 @@
8774
9170
 
8775
9171
  <xsl:template match="mn:figure[@class = 'pseudocode']//mn:p">
8776
9172
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
9173
+ <xsl:call-template name="refine_figure-pseudocode-p-style"/>
8777
9174
  <xsl:apply-templates/>
8778
9175
  </fo:block>
8779
9176
  </xsl:template>
@@ -8903,6 +9300,8 @@
8903
9300
  </xsl:variable>
8904
9301
  <xsl:copy-of select="xalan:nodeset($image-graphic-style_attributes)/attributes/@*"/>
8905
9302
 
9303
+ <xsl:call-template name="refine_image-graphic-style"/>
9304
+
8906
9305
  <xsl:if test="not(@mimetype = 'image/svg+xml') and not(ancestor::mn:table)">
8907
9306
  <xsl:variable name="scale">
8908
9307
  <xsl:call-template name="getImageScale">
@@ -9602,6 +10001,9 @@
9602
10001
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
9603
10002
  </xsl:attribute-set> <!-- formula-style -->
9604
10003
 
10004
+ <xsl:template name="refine_formula-style">
10005
+ </xsl:template>
10006
+
9605
10007
  <xsl:attribute-set name="formula-stem-block-style">
9606
10008
  <xsl:attribute name="text-align">center</xsl:attribute>
9607
10009
  </xsl:attribute-set> <!-- formula-stem-block-style -->
@@ -9670,6 +10072,8 @@
9670
10072
  <xsl:template match="mn:formula[mn:fmt-name]/mn:fmt-stem">
9671
10073
  <fo:block xsl:use-attribute-sets="formula-style">
9672
10074
 
10075
+ <xsl:call-template name="refine_formula-style"/>
10076
+
9673
10077
  <fo:table table-layout="fixed" width="100%">
9674
10078
  <fo:table-column column-width="95%"/>
9675
10079
  <fo:table-column column-width="5%"/>
@@ -10089,11 +10493,17 @@
10089
10493
  <xsl:attribute name="font-weight">normal</xsl:attribute>
10090
10494
  </xsl:attribute-set> <!-- list-name-style -->
10091
10495
 
10496
+ <xsl:template name="refine_list-name-style">
10497
+ </xsl:template>
10498
+
10092
10499
  <xsl:attribute-set name="list-item-style">
10093
10500
  <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
10094
10501
  </xsl:attribute-set>
10095
10502
 
10096
10503
  <xsl:template name="refine_list-item-style">
10504
+ <xsl:if test="ancestor::mn:table">
10505
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
10506
+ </xsl:if>
10097
10507
  </xsl:template> <!-- refine_list-item-style -->
10098
10508
 
10099
10509
  <xsl:attribute-set name="list-item-label-style">
@@ -10390,6 +10800,7 @@
10390
10800
  <xsl:param name="process">false</xsl:param>
10391
10801
  <xsl:if test="$process = 'true'">
10392
10802
  <fo:block xsl:use-attribute-sets="list-name-style">
10803
+ <xsl:call-template name="refine_list-name-style"/>
10393
10804
  <xsl:apply-templates/>
10394
10805
  </fo:block>
10395
10806
  </xsl:if>
@@ -10450,24 +10861,45 @@
10450
10861
  <!-- END Lists processing -->
10451
10862
  <!-- ===================================== -->
10452
10863
 
10864
+ <xsl:attribute-set name="footnote-separator-leader-style">
10865
+ </xsl:attribute-set>
10866
+
10867
+ <xsl:template name="refine_footnote-separator-leader-style">
10868
+ </xsl:template>
10869
+
10870
+ <xsl:attribute-set name="fn-container-body-style">
10871
+ <xsl:attribute name="text-indent">0</xsl:attribute>
10872
+ <xsl:attribute name="start-indent">0</xsl:attribute>
10873
+ </xsl:attribute-set>
10874
+
10875
+ <xsl:template name="refine_fn-container-body-style">
10876
+ </xsl:template>
10877
+
10453
10878
  <xsl:attribute-set name="fn-reference-style">
10454
10879
  <xsl:attribute name="font-size">80%</xsl:attribute>
10455
10880
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
10456
-
10457
- </xsl:attribute-set>
10881
+ </xsl:attribute-set> <!-- fn-reference-style -->
10458
10882
 
10459
10883
  <xsl:template name="refine_fn-reference-style">
10884
+ <!-- https://github.com/metanorma/metanorma-ieee/issues/595 -->
10885
+ <xsl:if test="preceding-sibling::node()[normalize-space() != ''][1][self::mn:fn]">,</xsl:if>
10460
10886
  </xsl:template> <!-- refine_fn-reference-style -->
10461
10887
 
10462
10888
  <xsl:attribute-set name="fn-style">
10463
10889
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
10464
10890
  </xsl:attribute-set>
10465
10891
 
10892
+ <xsl:template name="refine_fn-style">
10893
+ </xsl:template>
10894
+
10466
10895
  <xsl:attribute-set name="fn-num-style">
10467
10896
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
10468
10897
  <xsl:attribute name="font-size">70%</xsl:attribute>
10469
10898
  <xsl:attribute name="vertical-align">super</xsl:attribute>
10470
- </xsl:attribute-set>
10899
+ </xsl:attribute-set> <!-- fn-num-style -->
10900
+
10901
+ <xsl:template name="refine_fn-num-style">
10902
+ </xsl:template>
10471
10903
 
10472
10904
  <xsl:attribute-set name="fn-body-style">
10473
10905
  <xsl:attribute name="font-weight">normal</xsl:attribute>
@@ -10476,7 +10908,7 @@
10476
10908
  <xsl:attribute name="start-indent">0</xsl:attribute>
10477
10909
  <xsl:attribute name="font-size">10pt</xsl:attribute>
10478
10910
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
10479
- </xsl:attribute-set>
10911
+ </xsl:attribute-set> <!-- fn-body-style" -->
10480
10912
 
10481
10913
  <xsl:template name="refine_fn-body-style">
10482
10914
  </xsl:template> <!-- refine_fn-body-style -->
@@ -10541,10 +10973,12 @@
10541
10973
  <xsl:choose>
10542
10974
  <xsl:when test="ancestor::mn:bibitem">
10543
10975
  <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style">
10976
+ <xsl:call-template name="refine_bibitem-note-fn-style"/>
10544
10977
  </fn_styles>
10545
10978
  </xsl:when>
10546
10979
  <xsl:otherwise>
10547
10980
  <fn_styles xsl:use-attribute-sets="fn-num-style">
10981
+ <xsl:call-template name="refine_fn-num-style"/>
10548
10982
  </fn_styles>
10549
10983
  </xsl:otherwise>
10550
10984
  </xsl:choose>
@@ -10554,9 +10988,12 @@
10554
10988
  <xsl:copy-of select="."/>
10555
10989
  </xsl:for-each>
10556
10990
 
10557
- <xsl:if test="following-sibling::node()[normalize-space() != ''][1][self::mn:fn]">
10991
+ <!-- https://github.com/metanorma/metanorma-ieee/issues/595 -->
10992
+ <!-- <xsl:if test="following-sibling::node()[normalize-space() != ''][1][self::mn:fn]">
10558
10993
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
10559
- </xsl:if>
10994
+ </xsl:if> -->
10995
+
10996
+ <xsl:if test="preceding-sibling::node()[normalize-space() != ''][1][self::mn:fn]">,</xsl:if>
10560
10997
 
10561
10998
  <xsl:call-template name="insert_basic_link">
10562
10999
  <xsl:with-param name="element">
@@ -10579,10 +11016,12 @@
10579
11016
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
10580
11017
 
10581
11018
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
11019
+ <xsl:call-template name="refine_fn-style"/>
10582
11020
  <xsl:copy-of select="$footnote_inline"/>
10583
11021
  <fo:footnote-body role="Note">
10584
11022
 
10585
11023
  <fo:block-container xsl:use-attribute-sets="fn-container-body-style" role="SKIP">
11024
+ <xsl:call-template name="refine_fn-container-body-style"/>
10586
11025
 
10587
11026
  <xsl:variable name="fn_block">
10588
11027
  <xsl:call-template name="refine_fn-body-style"/>
@@ -10684,6 +11123,9 @@
10684
11123
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
10685
11124
  </xsl:attribute-set> <!-- admonition-style -->
10686
11125
 
11126
+ <xsl:template name="refine_admonition-style">
11127
+ </xsl:template>
11128
+
10687
11129
  <xsl:attribute-set name="admonition-container-style">
10688
11130
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
10689
11131
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -10691,6 +11133,9 @@
10691
11133
  <xsl:attribute name="padding-top">3mm</xsl:attribute>
10692
11134
  </xsl:attribute-set> <!-- admonition-container-style -->
10693
11135
 
11136
+ <xsl:template name="refine_admonition-container-style">
11137
+ </xsl:template>
11138
+
10694
11139
  <xsl:attribute-set name="admonition-name-style">
10695
11140
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
10696
11141
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -10700,9 +11145,16 @@
10700
11145
  <xsl:attribute name="text-align">center</xsl:attribute>
10701
11146
  </xsl:attribute-set> <!-- admonition-name-style -->
10702
11147
 
11148
+ <xsl:template name="refine_admonition-name-style">
11149
+ </xsl:template>
11150
+
10703
11151
  <xsl:attribute-set name="admonition-p-style">
10704
11152
  <xsl:attribute name="font-style">italic</xsl:attribute>
10705
11153
  </xsl:attribute-set> <!-- admonition-p-style -->
11154
+
11155
+ <xsl:template name="refine_admonition-p-style">
11156
+ </xsl:template>
11157
+
10706
11158
  <!-- end admonition -->
10707
11159
 
10708
11160
  <!-- ================ -->
@@ -10712,12 +11164,18 @@
10712
11164
  <xsl:call-template name="setNamedDestination"/>
10713
11165
  <fo:block-container id="{@id}" xsl:use-attribute-sets="admonition-style">
10714
11166
 
11167
+ <xsl:call-template name="refine_admonition-style"/>
11168
+
10715
11169
  <xsl:call-template name="setBlockSpanAll"/>
10716
11170
  <fo:block-container xsl:use-attribute-sets="admonition-container-style" role="SKIP">
11171
+
11172
+ <xsl:call-template name="refine_admonition-container-style"/>
10717
11173
  <fo:block xsl:use-attribute-sets="admonition-name-style">
11174
+ <xsl:call-template name="refine_admonition-name-style"/>
10718
11175
  <xsl:call-template name="displayAdmonitionName"/>
10719
11176
  </fo:block>
10720
11177
  <fo:block xsl:use-attribute-sets="admonition-p-style">
11178
+ <xsl:call-template name="refine_admonition-p-style"/>
10721
11179
  <xsl:apply-templates select="node()[not(self::mn:fmt-name)]"/>
10722
11180
  </fo:block>
10723
11181
 
@@ -10778,10 +11236,27 @@
10778
11236
  <!-- END Admonition -->
10779
11237
  <!-- ================ -->
10780
11238
 
11239
+ <xsl:attribute-set name="references-non-normative-title-style">
11240
+ <xsl:attribute name="font-size">16pt</xsl:attribute>
11241
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
11242
+ <xsl:attribute name="text-align">center</xsl:attribute>
11243
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
11244
+ <xsl:attribute name="margin-bottom">36pt</xsl:attribute>
11245
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
11246
+ <xsl:attribute name="role">H1</xsl:attribute>
11247
+ </xsl:attribute-set>
11248
+
11249
+ <xsl:template name="refine_references-non-normative-title-style">
11250
+
11251
+ </xsl:template>
11252
+
10781
11253
  <!-- bibitem in Normative References (references/@normative="true") -->
10782
11254
  <xsl:attribute-set name="bibitem-normative-style">
10783
11255
  </xsl:attribute-set> <!-- bibitem-normative-style -->
10784
11256
 
11257
+ <xsl:template name="refine_bibitem-normative-style">
11258
+ </xsl:template>
11259
+
10785
11260
  <!-- bibitem in Normative References (references/@normative="true"), renders as list -->
10786
11261
  <xsl:attribute-set name="bibitem-normative-list-style">
10787
11262
  <xsl:attribute name="provisional-distance-between-starts">12mm</xsl:attribute>
@@ -10790,9 +11265,28 @@
10790
11265
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
10791
11266
  </xsl:attribute-set> <!-- bibitem-normative-list-style -->
10792
11267
 
11268
+ <xsl:template name="refine_bibitem-normative-list-style">
11269
+ <xsl:variable name="docidentifier">
11270
+ <xsl:apply-templates select="mn:biblio-tag">
11271
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
11272
+ </xsl:apply-templates>
11273
+ </xsl:variable>
11274
+ <xsl:attribute name="provisional-distance-between-starts">
11275
+ <xsl:choose>
11276
+ <xsl:when test="string-length($docidentifier) = 0">0mm</xsl:when>
11277
+ <xsl:when test="string-length($docidentifier) &gt; 19">46.5mm</xsl:when>
11278
+ <xsl:when test="string-length($docidentifier) &gt; 10">37mm</xsl:when>
11279
+ <xsl:otherwise>24.5mm</xsl:otherwise>
11280
+ </xsl:choose>
11281
+ </xsl:attribute>
11282
+ </xsl:template>
11283
+
10793
11284
  <xsl:attribute-set name="bibitem-non-normative-style">
10794
11285
  </xsl:attribute-set> <!-- bibitem-non-normative-style -->
10795
11286
 
11287
+ <xsl:template name="refine_bibitem-non-normative-style">
11288
+ </xsl:template>
11289
+
10796
11290
  <!-- bibitem in bibliography section (references/@normative="false"), renders as list -->
10797
11291
  <xsl:attribute-set name="bibitem-non-normative-list-style">
10798
11292
  <xsl:attribute name="provisional-distance-between-starts">12mm</xsl:attribute>
@@ -10800,17 +11294,29 @@
10800
11294
  <xsl:attribute name="line-height">115%</xsl:attribute>
10801
11295
  </xsl:attribute-set> <!-- bibitem-non-normative-list-style -->
10802
11296
 
11297
+ <xsl:template name="refine_bibitem-non-normative-list-style">
11298
+ </xsl:template>
11299
+
10803
11300
  <xsl:attribute-set name="bibitem-non-normative-list-item-style">
10804
11301
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
10805
11302
  </xsl:attribute-set>
10806
11303
 
11304
+ <xsl:template name="refine_bibitem-non-normative-list-item-style">
11305
+ </xsl:template>
11306
+
10807
11307
  <!-- bibitem in bibliography section (references/@normative="false"), list body -->
10808
11308
  <xsl:attribute-set name="bibitem-normative-list-body-style">
10809
11309
  </xsl:attribute-set>
10810
11310
 
11311
+ <xsl:template name="refine_bibitem-normative-list-body-style">
11312
+ </xsl:template>
11313
+
10811
11314
  <xsl:attribute-set name="bibitem-non-normative-list-body-style">
10812
11315
  </xsl:attribute-set> <!-- bibitem-non-normative-list-body-style -->
10813
11316
 
11317
+ <xsl:template name="refine_bibitem-non-normative-list-body-style">
11318
+ </xsl:template>
11319
+
10814
11320
  <!-- footnote reference number for bibitem, in the text -->
10815
11321
  <xsl:attribute-set name="bibitem-note-fn-style">
10816
11322
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
@@ -10819,6 +11325,9 @@
10819
11325
  <xsl:attribute name="baseline-shift">30%</xsl:attribute>
10820
11326
  </xsl:attribute-set> <!-- bibitem-note-fn-style -->
10821
11327
 
11328
+ <xsl:template name="refine_bibitem-note-fn-style">
11329
+ </xsl:template>
11330
+
10822
11331
  <!-- footnote number on the page bottom -->
10823
11332
  <xsl:attribute-set name="bibitem-note-fn-number-style">
10824
11333
  <xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
@@ -10837,6 +11346,9 @@
10837
11346
  <xsl:attribute-set name="references-non-normative-style">
10838
11347
  </xsl:attribute-set> <!-- references-non-normative-style -->
10839
11348
 
11349
+ <xsl:template name="refine_references-non-normative-style">
11350
+ </xsl:template>
11351
+
10840
11352
  <!-- ======================= -->
10841
11353
  <!-- Bibliography rendering -->
10842
11354
  <!-- ======================= -->
@@ -10877,6 +11389,7 @@
10877
11389
  <xsl:apply-templates select="mn:fmt-title[@columns = 1]"/>
10878
11390
 
10879
11391
  <fo:block xsl:use-attribute-sets="references-non-normative-style">
11392
+ <xsl:call-template name="refine_references-non-normative-style"/>
10880
11393
  <xsl:apply-templates select="node()[not(self::mn:fmt-title and @columns = 1)]"/>
10881
11394
  </fo:block>
10882
11395
  </xsl:template> <!-- references -->
@@ -10891,19 +11404,13 @@
10891
11404
  <xsl:call-template name="setNamedDestination"/>
10892
11405
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-normative-list-style">
10893
11406
 
11407
+ <xsl:call-template name="refine_bibitem-normative-list-style"/>
11408
+
10894
11409
  <xsl:variable name="docidentifier">
10895
11410
  <xsl:apply-templates select="mn:biblio-tag">
10896
11411
  <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
10897
11412
  </xsl:apply-templates>
10898
11413
  </xsl:variable>
10899
- <xsl:attribute name="provisional-distance-between-starts">
10900
- <xsl:choose>
10901
- <xsl:when test="string-length($docidentifier) = 0">0mm</xsl:when>
10902
- <xsl:when test="string-length($docidentifier) &gt; 19">46.5mm</xsl:when>
10903
- <xsl:when test="string-length($docidentifier) &gt; 10">37mm</xsl:when>
10904
- <xsl:otherwise>24.5mm</xsl:otherwise>
10905
- </xsl:choose>
10906
- </xsl:attribute>
10907
11414
 
10908
11415
  <fo:list-item>
10909
11416
  <fo:list-item-label end-indent="label-end()">
@@ -10915,6 +11422,7 @@
10915
11422
  </fo:list-item-label>
10916
11423
  <fo:list-item-body start-indent="body-start()">
10917
11424
  <fo:block xsl:use-attribute-sets="bibitem-normative-list-body-style">
11425
+ <xsl:call-template name="refine_bibitem-normative-list-body-style"/>
10918
11426
  <xsl:call-template name="processBibitem">
10919
11427
  <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
10920
11428
  </xsl:call-template>
@@ -10926,18 +11434,23 @@
10926
11434
  </xsl:template> <!-- bibitem -->
10927
11435
 
10928
11436
  <!-- Bibliography (non-normative references) -->
10929
- <xsl:template match="mn:references[not(@normative='true')]/mn:bibitem | mn:references[not(@normative='true')]/mn:note" name="bibitem_non_normative" priority="2">
11437
+ <xsl:template match="mn:references[not(@normative='true')]/mn:bibitem" name="bibitem_non_normative" priority="2">
10930
11438
  <xsl:param name="skip" select="normalize-space(preceding-sibling::*[not(self::mn:note)][1][self::mn:bibitem] and 1 = 1)"/> <!-- current bibiitem is non-first -->
10931
11439
  <xsl:call-template name="bibitem"/>
10932
11440
 
10933
11441
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
10934
11442
 
11443
+ <!-- bibitem's notes will be processing in 'processBibitemFollowingNotes' -->
11444
+ <xsl:template match="mn:references/mn:note" priority="2"/> <!-- [not(@normative='true')] -->
11445
+
10935
11446
  <xsl:template name="insertListItem_Bibitem">
10936
11447
  <xsl:choose>
10937
11448
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
10938
11449
  <xsl:otherwise>
10939
11450
  <xsl:call-template name="setNamedDestination"/>
10940
11451
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
11452
+ <xsl:call-template name="refine_bibitem-non-normative-list-item-style"/>
11453
+
10941
11454
  <fo:list-item-label end-indent="label-end()">
10942
11455
  <fo:block role="SKIP">
10943
11456
  <fo:inline role="SKIP">
@@ -10948,16 +11461,18 @@
10948
11461
  </fo:block>
10949
11462
  </fo:list-item-label>
10950
11463
  <fo:list-item-body start-indent="body-start()">
10951
- <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style" role="SKIP">
11464
+ <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style"> <!-- role="SKIP" -->
11465
+ <xsl:call-template name="refine_bibitem-non-normative-list-body-style"/>
10952
11466
  <xsl:call-template name="processBibitem">
10953
11467
  <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
10954
11468
  </xsl:call-template>
10955
11469
  </fo:block>
11470
+ <xsl:call-template name="processBibitemFollowingNotes"/>
10956
11471
  </fo:list-item-body>
10957
11472
  </fo:list-item>
10958
11473
  </xsl:otherwise>
10959
11474
  </xsl:choose>
10960
- <xsl:apply-templates select="following-sibling::*[1]"> <!-- [self::mn:bibitem] -->
11475
+ <xsl:apply-templates select="following-sibling::*[self::mn:bibitem][1]">
10961
11476
  <xsl:with-param name="skip">false</xsl:with-param>
10962
11477
  </xsl:apply-templates>
10963
11478
  </xsl:template>
@@ -10973,25 +11488,16 @@
10973
11488
  <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
10974
11489
  </xsl:apply-templates>
10975
11490
  <xsl:apply-templates select="mn:formattedref"/>
11491
+ <xsl:call-template name="processBibitemFollowingNotes"/>
10976
11492
  <!-- end bibitem processing -->
10977
-
10978
- <xsl:call-template name="processBibliographyNote"/>
10979
11493
  </xsl:template> <!-- processBibitem (bibitem) -->
10980
11494
 
10981
- <xsl:template name="processBibliographyNote">
10982
- <xsl:if test="self::mn:note">
10983
- <xsl:variable name="note_node">
10984
- <xsl:element name="{local-name(..)}" namespace="{$namespace_full}"> <!-- save parent context node for determining styles -->
10985
- <xsl:copy> <!-- skip @id -->
10986
- <xsl:copy-of select="node()"/>
10987
- </xsl:copy>
10988
- </xsl:element>
10989
- </xsl:variable>
10990
- <!-- <xsl:for-each select="xalan:nodeset($note_node)//mn:note">
10991
- <xsl:call-template name="note"/>
10992
- </xsl:for-each> -->
11495
+ <xsl:template name="processBibitemFollowingNotes">
11496
+ <!-- current context is bibitem element -->
11497
+ <xsl:variable name="bibitem_id" select="@id"/>
11498
+ <xsl:for-each select="following-sibling::mn:note[preceding-sibling::mn:bibitem[1][@id = $bibitem_id] and preceding-sibling::*[1][self::mn:note or self::mn:bibitem]]">
10993
11499
  <xsl:call-template name="note"/>
10994
- </xsl:if>
11500
+ </xsl:for-each>
10995
11501
  </xsl:template>
10996
11502
 
10997
11503
  <xsl:template match="mn:title" mode="title">
@@ -11191,11 +11697,17 @@
11191
11697
  <!-- Index section styles -->
11192
11698
  <xsl:attribute-set name="indexsect-title-style">
11193
11699
  <xsl:attribute name="role">H1</xsl:attribute>
11194
- </xsl:attribute-set>
11700
+ </xsl:attribute-set> <!-- indexsect-title-style -->
11701
+
11702
+ <xsl:template name="refine_indexsect-title-style">
11703
+ </xsl:template>
11195
11704
 
11196
11705
  <xsl:attribute-set name="indexsect-clause-title-style">
11197
11706
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
11198
- </xsl:attribute-set>
11707
+ </xsl:attribute-set> <!-- indexsect-clause-title-style -->
11708
+
11709
+ <xsl:template name="refine_indexsect-clause-title-style">
11710
+ </xsl:template>
11199
11711
  <!-- End Index section styles -->
11200
11712
 
11201
11713
  <!-- =================== -->
@@ -11389,6 +11901,7 @@
11389
11901
 
11390
11902
  <xsl:template match="mn:indexsect/mn:fmt-title | mn:indexsect/mn:title" priority="4">
11391
11903
  <fo:block xsl:use-attribute-sets="indexsect-title-style">
11904
+ <xsl:call-template name="refine_indexsect-title-style"/>
11392
11905
  <!-- Index -->
11393
11906
  <xsl:apply-templates/>
11394
11907
  </fo:block>
@@ -11397,6 +11910,7 @@
11397
11910
  <xsl:template match="mn:indexsect/mn:clause/mn:fmt-title | mn:indexsect/mn:clause/mn:title" priority="4">
11398
11911
  <!-- Letter A, B, C, ... -->
11399
11912
  <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
11913
+ <xsl:call-template name="refine_indexsect-clause-title-style"/>
11400
11914
  <xsl:apply-templates/>
11401
11915
  </fo:block>
11402
11916
  </xsl:template>
@@ -11439,13 +11953,31 @@
11439
11953
  <!-- skip here, see the template 'fmt-review-start' -->
11440
11954
  </xsl:when>
11441
11955
  <xsl:otherwise>
11442
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11443
- <fo:inline id="{@id}" font-size="1pt"><xsl:if test="preceding-sibling::node()[self::mn:fmt-annotation-start][@source = $bookmark_id] and following-sibling::node()[self::mn:fmt-annotation-end][@source = $bookmark_id]"><xsl:attribute name="line-height">0.1</xsl:attribute></xsl:if><xsl:value-of select="$hair_space"/></fo:inline>
11444
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11445
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11956
+ <xsl:choose>
11957
+ <xsl:when test="parent::mn:example or parent::mn:termexample or parent::mn:note or parent::mn:termnote">
11958
+ <fo:block font-size="1pt" line-height="0.1">
11959
+ <xsl:call-template name="fo_inline_bookmark">
11960
+ <xsl:with-param name="bookmark_id" select="$bookmark_id"/>
11961
+ </xsl:call-template>
11962
+ </fo:block>
11963
+ </xsl:when>
11964
+ <xsl:otherwise>
11965
+ <xsl:call-template name="fo_inline_bookmark">
11966
+ <xsl:with-param name="bookmark_id" select="$bookmark_id"/>
11967
+ </xsl:call-template>
11968
+ </xsl:otherwise>
11969
+ </xsl:choose>
11446
11970
  </xsl:otherwise>
11447
11971
  </xsl:choose>
11448
11972
  </xsl:template>
11973
+
11974
+ <xsl:template name="fo_inline_bookmark">
11975
+ <xsl:param name="bookmark_id"/>
11976
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11977
+ <fo:inline id="{@id}" font-size="1pt"><xsl:if test="preceding-sibling::node()[self::mn:fmt-annotation-start][@source = $bookmark_id] and following-sibling::node()[self::mn:fmt-annotation-end][@source = $bookmark_id]"><xsl:attribute name="line-height">0.1</xsl:attribute></xsl:if><xsl:value-of select="$hair_space"/></fo:inline>
11978
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11979
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11980
+ </xsl:template>
11449
11981
  <!-- =================== -->
11450
11982
  <!-- End of Index processing -->
11451
11983
  <!-- =================== -->
@@ -11601,9 +12133,15 @@
11601
12133
  <xsl:attribute name="leader-pattern">dots</xsl:attribute>
11602
12134
  </xsl:attribute-set> <!-- END: toc-leader-style -->
11603
12135
 
12136
+ <xsl:template name="refine_toc-leader-style">
12137
+ </xsl:template>
12138
+
11604
12139
  <xsl:attribute-set name="toc-pagenumber-style">
11605
12140
  </xsl:attribute-set>
11606
12141
 
12142
+ <xsl:template name="refine_toc-pagenumber-style">
12143
+ </xsl:template>
12144
+
11607
12145
  <!-- List of Figures, Tables -->
11608
12146
  <xsl:attribute-set name="toc-listof-title-style">
11609
12147
  <xsl:attribute name="role">TOCI</xsl:attribute>
@@ -11618,6 +12156,9 @@
11618
12156
  <xsl:attribute-set name="toc-listof-item-block-style">
11619
12157
  </xsl:attribute-set>
11620
12158
 
12159
+ <xsl:template name="refine_toc-listof-item-block-style">
12160
+ </xsl:template>
12161
+
11621
12162
  <xsl:attribute-set name="toc-listof-item-style">
11622
12163
  <xsl:attribute name="role">TOCI</xsl:attribute>
11623
12164
  <xsl:attribute name="text-align-last">justify</xsl:attribute>
@@ -11625,6 +12166,9 @@
11625
12166
  <xsl:attribute name="text-indent">-12mm</xsl:attribute>
11626
12167
  </xsl:attribute-set>
11627
12168
 
12169
+ <xsl:template name="refine_toc-listof-item-style">
12170
+ </xsl:template>
12171
+
11628
12172
  <xsl:template name="processPrefaceSectionsDefault_Contents">
11629
12173
  <xsl:variable name="nodes_preface_">
11630
12174
  <xsl:for-each select="/*/mn:preface/*[not(self::mn:note or self::mn:admonition or @type = 'toc')]">
@@ -12737,23 +13281,55 @@
12737
13281
  <!-- Ruby text (CJK languages) rendering -->
12738
13282
  <!-- ===================================== -->
12739
13283
  <!-- ===================================== -->
13284
+
13285
+ <xsl:attribute-set name="ruby-style">
13286
+ <xsl:attribute name="text-indent">0mm</xsl:attribute>
13287
+ <xsl:attribute name="last-line-end-indent">0mm</xsl:attribute>
13288
+ </xsl:attribute-set>
13289
+
13290
+ <xsl:template name="refine_ruby-style">
13291
+ <xsl:if test="not(ancestor::mn:ruby)">
13292
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
13293
+ </xsl:if>
13294
+ <xsl:variable name="rt_text" select="mn:rt"/>
13295
+ <xsl:variable name="rb_text" select=".//mn:rb[not(mn:ruby)]"/>
13296
+ <!-- Example: width="2em" -->
13297
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
13298
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
13299
+ <xsl:variable name="text_width">
13300
+ <xsl:choose>
13301
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
13302
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
13303
+ </xsl:choose>
13304
+ </xsl:variable>
13305
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
13306
+ </xsl:template> <!-- refine_ruby-style -->
13307
+
13308
+ <xsl:attribute-set name="rb-style">
13309
+ <xsl:attribute name="line-height">1em</xsl:attribute>
13310
+ <xsl:attribute name="text-align">center</xsl:attribute>
13311
+ </xsl:attribute-set>
13312
+
13313
+ <xsl:template name="refine_rb-style">
13314
+ </xsl:template>
13315
+
13316
+ <xsl:attribute-set name="rt-style">
13317
+ <xsl:attribute name="font-size">0.5em</xsl:attribute>
13318
+ <xsl:attribute name="text-align">center</xsl:attribute>
13319
+ <xsl:attribute name="line-height">1.2em</xsl:attribute>
13320
+ <xsl:attribute name="space-before">-1.4em</xsl:attribute>
13321
+ <xsl:attribute name="space-before.conditionality">retain</xsl:attribute>
13322
+ </xsl:attribute-set>
13323
+
13324
+ <xsl:template name="refine_rt-style">
13325
+ <xsl:if test="ancestor::mn:ruby[last()]//mn:ruby or ancestor::mn:rb">
13326
+ <xsl:attribute name="space-before">0em</xsl:attribute>
13327
+ </xsl:if>
13328
+ </xsl:template>
13329
+
12740
13330
  <xsl:template match="mn:ruby">
12741
- <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
12742
- <xsl:if test="not(ancestor::mn:ruby)">
12743
- <xsl:attribute name="alignment-baseline">central</xsl:attribute>
12744
- </xsl:if>
12745
- <xsl:variable name="rt_text" select="mn:rt"/>
12746
- <xsl:variable name="rb_text" select=".//mn:rb[not(mn:ruby)]"/>
12747
- <!-- Example: width="2em" -->
12748
- <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
12749
- <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
12750
- <xsl:variable name="text_width">
12751
- <xsl:choose>
12752
- <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
12753
- <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
12754
- </xsl:choose>
12755
- </xsl:variable>
12756
- <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
13331
+ <fo:inline-container xsl:use-attribute-sets="ruby-style">
13332
+ <xsl:call-template name="refine_ruby-style"/>
12757
13333
 
12758
13334
  <xsl:choose>
12759
13335
  <xsl:when test="ancestor::mn:ruby">
@@ -12771,17 +13347,14 @@
12771
13347
  </xsl:template>
12772
13348
 
12773
13349
  <xsl:template match="mn:rb">
12774
- <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
13350
+ <fo:block xsl:use-attribute-sets="rb-style"><xsl:call-template name="refine_rb-style"/><xsl:apply-templates/></fo:block>
12775
13351
  </xsl:template>
12776
13352
 
12777
13353
  <xsl:template match="mn:rt">
12778
- <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
12779
- <xsl:if test="ancestor::mn:ruby[last()]//mn:ruby or ancestor::mn:rb">
12780
- <xsl:attribute name="space-before">0em</xsl:attribute>
12781
- </xsl:if>
13354
+ <fo:block xsl:use-attribute-sets="rt-style"> <!-- -->
13355
+ <xsl:call-template name="refine_rt-style"/>
12782
13356
  <xsl:apply-templates/>
12783
13357
  </fo:block>
12784
-
12785
13358
  </xsl:template>
12786
13359
 
12787
13360
  <!-- ===================================== -->
@@ -12790,6 +13363,24 @@
12790
13363
  <!-- ===================================== -->
12791
13364
  <!-- ===================================== -->
12792
13365
 
13366
+ <xsl:attribute-set name="annex-title-style">
13367
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
13368
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
13369
+ <xsl:attribute name="text-align">center</xsl:attribute>
13370
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
13371
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13372
+ <xsl:attribute name="role">H1</xsl:attribute>
13373
+ </xsl:attribute-set>
13374
+
13375
+ <xsl:template name="refine_annex-title-style">
13376
+ </xsl:template>
13377
+
13378
+ <xsl:attribute-set name="p-zzSTDTitle1-style">
13379
+ </xsl:attribute-set>
13380
+
13381
+ <xsl:template name="refine_p-zzSTDTitle1-style">
13382
+ </xsl:template>
13383
+
12793
13384
  <xsl:template name="processPrefaceSectionsDefault">
12794
13385
  <xsl:for-each select="/*/mn:preface/*[not(self::mn:note or self::mn:admonition)]">
12795
13386
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -13345,11 +13936,35 @@
13345
13936
 
13346
13937
  <xsl:template match="mn:svgmap"/>
13347
13938
 
13939
+ <xsl:template match="mn:name[following-sibling::*[1][self::mn:fmt-name]]"/>
13940
+
13348
13941
  <!-- for correct rendering combining chars, added in mode="update_xml_step2" -->
13349
13942
  <xsl:template match="*[local-name() = 'lang_none']">
13350
13943
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
13351
13944
  </xsl:template>
13352
13945
 
13946
+ <xsl:template name="addTagElementT">
13947
+ <xsl:variable name="title_">
13948
+ <xsl:apply-templates select="mn:fmt-title"/>
13949
+ </xsl:variable>
13950
+ <xsl:variable name="title__">
13951
+ <xsl:for-each select="xalan:nodeset($title_)/*/node()">
13952
+ <xsl:choose>
13953
+ <xsl:when test="self::text()"><xsl:text> </xsl:text><xsl:value-of select="."/><xsl:text> </xsl:text></xsl:when>
13954
+ <xsl:otherwise><xsl:text> </xsl:text><xsl:copy-of select="."/><xsl:text> </xsl:text></xsl:otherwise>
13955
+ </xsl:choose>
13956
+ </xsl:for-each>
13957
+ </xsl:variable>
13958
+ <xsl:variable name="title" select="normalize-space($title__)"/>
13959
+ <xsl:if test="$title != ''">
13960
+ <xsl:attribute name="fox:title">
13961
+ <xsl:if test="ancestor::mn:sections">
13962
+ <xsl:text>Section </xsl:text>
13963
+ </xsl:if>
13964
+ <xsl:value-of select="$title"/></xsl:attribute>
13965
+ </xsl:if>
13966
+ </xsl:template>
13967
+
13353
13968
  <xsl:template name="replaceChar">
13354
13969
  <xsl:param name="text"/>
13355
13970
  <xsl:param name="replace"/>
@@ -14116,6 +14731,13 @@
14116
14731
  <xsl:with-param name="default" select="$text_align_default"/>
14117
14732
  </xsl:call-template>
14118
14733
  <xsl:call-template name="setKeepAttributes"/>
14734
+ <xsl:if test="node()[1][self::mn:span][contains(@style, 'line-height')]">
14735
+ <xsl:variable name="styles">
14736
+ <xsl:apply-templates select="*[1]"/>
14737
+ </xsl:variable>
14738
+ <!-- move attribute line-height from inline to block -->
14739
+ <xsl:attribute name="line-height"><xsl:value-of select="xalan:nodeset($styles)//*/@line-height"/></xsl:attribute>
14740
+ </xsl:if>
14119
14741
  </xsl:template>
14120
14742
 
14121
14743
  <xsl:template name="setKeepAttributes">
@@ -14141,34 +14763,41 @@
14141
14763
  <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage{$suffix}_{$name}_{$number}_{generate-id()}">
14142
14764
  <fo:block>
14143
14765
  <xsl:for-each select="/mn:metanorma/mn:metanorma-extension/mn:presentation-metadata[mn:name = $name][1]/mn:value/mn:image[$num]">
14144
- <xsl:choose>
14145
- <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
14146
- <fo:instream-foreign-object fox:alt-text="Image Front">
14147
- <xsl:attribute name="content-height"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
14148
- <xsl:call-template name="getSVG"/>
14149
- </fo:instream-foreign-object>
14150
- </xsl:when>
14151
- <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
14152
- <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
14153
- </xsl:when>
14154
- <xsl:otherwise> <!-- bitmap image -->
14155
- <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
14156
- <xsl:if test="$coverimage_src != ''">
14157
- <xsl:variable name="coverpage">
14158
- <xsl:call-template name="getImageURL">
14159
- <xsl:with-param name="src" select="$coverimage_src"/>
14160
- </xsl:call-template>
14161
- </xsl:variable>
14162
- <!-- <xsl:variable name="coverpage" select="concat('url(file:',$basepath, 'coverpage1.png', ')')"/> --> <!-- for DEBUG -->
14163
- <fo:external-graphic src="{$coverpage}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
14164
- </xsl:if>
14165
- </xsl:otherwise>
14166
- </xsl:choose>
14766
+
14767
+ <xsl:call-template name="insertPageImage"/>
14768
+
14167
14769
  </xsl:for-each>
14168
14770
  </fo:block>
14169
14771
  </fo:block-container>
14170
14772
  </xsl:template>
14171
14773
 
14774
+ <xsl:template name="insertPageImage">
14775
+ <xsl:param name="svg_content_height" select="$pageHeight"/>
14776
+ <xsl:param name="bitmap_width" select="$pageWidth"/>
14777
+ <xsl:choose>
14778
+ <xsl:when test="*[local-name() = 'svg'] or java:endsWith(java:java.lang.String.new(@src), '.svg')">
14779
+ <fo:instream-foreign-object fox:alt-text="Image Front">
14780
+ <xsl:attribute name="content-height"><xsl:value-of select="$svg_content_height"/>mm</xsl:attribute>
14781
+ <xsl:call-template name="getSVG"/>
14782
+ </fo:instream-foreign-object>
14783
+ </xsl:when>
14784
+ <xsl:when test="starts-with(@src, 'data:application/pdf;base64')">
14785
+ <fo:external-graphic src="{@src}" fox:alt-text="Image Front"/>
14786
+ </xsl:when>
14787
+ <xsl:otherwise> <!-- bitmap image -->
14788
+ <xsl:variable name="coverimage_src" select="normalize-space(@src)"/>
14789
+ <xsl:if test="$coverimage_src != ''">
14790
+ <xsl:variable name="coverpage">
14791
+ <xsl:call-template name="getImageURL">
14792
+ <xsl:with-param name="src" select="$coverimage_src"/>
14793
+ </xsl:call-template>
14794
+ </xsl:variable>
14795
+ <fo:external-graphic src="{$coverpage}" width="{$bitmap_width}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
14796
+ </xsl:if>
14797
+ </xsl:otherwise>
14798
+ </xsl:choose>
14799
+ </xsl:template>
14800
+
14172
14801
  <xsl:template name="getImageURL">
14173
14802
  <xsl:param name="src"/>
14174
14803
  <xsl:choose>
@@ -14596,6 +15225,14 @@
14596
15225
  </xsl:attribute>
14597
15226
  </xsl:template>
14598
15227
 
15228
+ <xsl:template name="getCharByCodePoint">
15229
+ <xsl:param name="codepoint"/>
15230
+ <xsl:param name="radix">16</xsl:param>
15231
+ <xsl:variable name="codepointInt" select="java:java.lang.Integer.parseInt($codepoint,$radix)"/>
15232
+ <xsl:variable name="chars" select="java:java.lang.Character.toChars($codepointInt)"/>
15233
+ <xsl:value-of select="java:java.lang.String.new($chars)"/>
15234
+ </xsl:template>
15235
+
14599
15236
  <xsl:template name="substring-after-last">
14600
15237
  <xsl:param name="value"/>
14601
15238
  <xsl:param name="delimiter"/>