metanorma-iso 1.7.2 → 1.7.3

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.
@@ -1,19 +1,33 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
7
8
 
8
9
 
9
10
 
10
11
  <xsl:key name="kfn" match="iso:p/iso:fn" use="@reference"/>
11
12
 
13
+ <xsl:key name="attachments" match="iso:eref[contains(@bibitemid, '.exp')]" use="@bibitemid"/>
14
+
12
15
 
13
16
 
14
17
  <xsl:variable name="debug">false</xsl:variable>
15
- <xsl:variable name="pageWidth" select="'210mm'"/>
16
- <xsl:variable name="pageHeight" select="'297mm'"/>
18
+ <xsl:variable name="pageWidth" select="210"/>
19
+ <xsl:variable name="pageHeight" select="297"/>
20
+ <xsl:variable name="marginLeftRight1" select="25"/>
21
+ <xsl:variable name="marginLeftRight2" select="12.5"/>
22
+ <xsl:variable name="marginTop" select="27.4"/>
23
+ <xsl:variable name="marginBottom" select="13"/>
24
+
25
+ <xsl:variable name="figure_name_height">14</xsl:variable>
26
+ <xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><!-- paper width minus margins -->
27
+ <xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><!-- paper height minus margins and title height -->
28
+ <xsl:variable name="image_dpi" select="96"/>
29
+ <xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/>
30
+ <xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/>
17
31
 
18
32
  <xsl:variable name="docidentifierISO" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso'] | /iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'ISO']"/>
19
33
 
@@ -157,6 +171,7 @@
157
171
  <contents>
158
172
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
159
173
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
174
+ <xsl:apply-templates select="//iso:indexsect" mode="contents"/>
160
175
  </contents>
161
176
  </xsl:variable>
162
177
 
@@ -170,10 +185,11 @@
170
185
  <xsl:if test="$lang = 'zh'">
171
186
  <xsl:attribute name="font-family">Source Han Sans, Times New Roman, Cambria Math</xsl:attribute>
172
187
  </xsl:if>
188
+
173
189
  <fo:layout-master-set>
174
190
 
175
191
  <!-- cover page -->
176
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
192
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
177
193
  <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="31.7mm" margin-right="31.7mm"/>
178
194
  <fo:region-before region-name="cover-page-header" extent="25.4mm"/>
179
195
  <fo:region-after/>
@@ -181,7 +197,7 @@
181
197
  <fo:region-end region-name="cover-right-region" extent="31.7mm"/>
182
198
  </fo:simple-page-master>
183
199
 
184
- <fo:simple-page-master master-name="cover-page-published" page-width="{$pageWidth}" page-height="{$pageHeight}">
200
+ <fo:simple-page-master master-name="cover-page-published" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
185
201
  <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="78mm" margin-right="18.5mm"/>
186
202
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
187
203
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
@@ -190,19 +206,19 @@
190
206
  </fo:simple-page-master>
191
207
 
192
208
 
193
- <fo:simple-page-master master-name="cover-page-publishedISO-odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
194
- <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="25mm" margin-right="12.5mm"/>
209
+ <fo:simple-page-master master-name="cover-page-publishedISO-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
210
+ <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
195
211
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
196
212
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
197
- <fo:region-start region-name="cover-left-region" extent="25mm"/>
198
- <fo:region-end region-name="cover-right-region" extent="12.5mm"/>
213
+ <fo:region-start region-name="cover-left-region" extent="{$marginLeftRight1}mm"/>
214
+ <fo:region-end region-name="cover-right-region" extent="{$marginLeftRight2}mm"/>
199
215
  </fo:simple-page-master>
200
- <fo:simple-page-master master-name="cover-page-publishedISO-even" page-width="{$pageWidth}" page-height="{$pageHeight}">
201
- <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="12.5mm" margin-right="25mm"/>
216
+ <fo:simple-page-master master-name="cover-page-publishedISO-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
217
+ <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
202
218
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
203
219
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
204
- <fo:region-start region-name="cover-left-region" extent="12.5mm"/>
205
- <fo:region-end region-name="cover-right-region" extent="25mm"/>
220
+ <fo:region-start region-name="cover-left-region" extent="{$marginLeftRight2}mm"/>
221
+ <fo:region-end region-name="cover-right-region" extent="{$marginLeftRight1}mm"/>
206
222
  </fo:simple-page-master>
207
223
  <fo:page-sequence-master master-name="cover-page-publishedISO">
208
224
  <fo:repeatable-page-master-alternatives>
@@ -214,7 +230,7 @@
214
230
 
215
231
  <!-- contents pages -->
216
232
  <!-- odd pages -->
217
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
233
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
218
234
  <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="19mm" margin-right="19mm"/>
219
235
  <fo:region-before region-name="header-odd" extent="27.4mm"/> <!-- display-align="center" -->
220
236
  <fo:region-after region-name="footer-odd" extent="13mm"/>
@@ -222,7 +238,7 @@
222
238
  <fo:region-end region-name="right-region" extent="19mm"/>
223
239
  </fo:simple-page-master>
224
240
  <!-- even pages -->
225
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
241
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
226
242
  <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="19mm" margin-right="19mm"/>
227
243
  <fo:region-before region-name="header-even" extent="27.4mm"/> <!-- display-align="center" -->
228
244
  <fo:region-after region-name="footer-even" extent="13mm"/>
@@ -244,35 +260,35 @@
244
260
 
245
261
 
246
262
  <!-- first page -->
247
- <fo:simple-page-master master-name="first-publishedISO" page-width="{$pageWidth}" page-height="{$pageHeight}">
248
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="25mm" margin-right="12.5mm"/>
249
- <fo:region-before region-name="header-first" extent="27.4mm"/> <!-- display-align="center" -->
250
- <fo:region-after region-name="footer-odd" extent="13mm"/>
251
- <fo:region-start region-name="left-region" extent="25mm"/>
252
- <fo:region-end region-name="right-region" extent="12.5mm"/>
263
+ <fo:simple-page-master master-name="first-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
264
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
265
+ <fo:region-before region-name="header-first" extent="{$marginTop}mm"/> <!-- display-align="center" -->
266
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
267
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
268
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
253
269
  </fo:simple-page-master>
254
270
  <!-- odd pages -->
255
- <fo:simple-page-master master-name="odd-publishedISO" page-width="{$pageWidth}" page-height="{$pageHeight}">
256
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="25mm" margin-right="12.5mm"/>
257
- <fo:region-before region-name="header-odd" extent="27.4mm"/> <!-- display-align="center" -->
258
- <fo:region-after region-name="footer-odd" extent="13mm"/>
259
- <fo:region-start region-name="left-region" extent="25mm"/>
260
- <fo:region-end region-name="right-region" extent="12.5mm"/>
271
+ <fo:simple-page-master master-name="odd-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
272
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
273
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/> <!-- display-align="center" -->
274
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
275
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
276
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
261
277
  </fo:simple-page-master>
262
278
  <!-- even pages -->
263
- <fo:simple-page-master master-name="even-publishedISO" page-width="{$pageWidth}" page-height="{$pageHeight}">
264
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
265
- <fo:region-before region-name="header-even" extent="27.4mm"/>
266
- <fo:region-after region-name="footer-even" extent="13mm"/>
267
- <fo:region-start region-name="left-region" extent="12.5mm"/>
268
- <fo:region-end region-name="right-region" extent="25mm"/>
279
+ <fo:simple-page-master master-name="even-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
280
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
281
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
282
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
283
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
284
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
269
285
  </fo:simple-page-master>
270
- <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
271
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
272
- <fo:region-before region-name="header" extent="27.4mm"/>
273
- <fo:region-after region-name="footer" extent="13mm"/>
274
- <fo:region-start region-name="left" extent="12.5mm"/>
275
- <fo:region-end region-name="right" extent="25mm"/>
286
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
287
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
288
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
289
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
290
+ <fo:region-start region-name="left" extent="{$marginLeftRight2}mm"/>
291
+ <fo:region-end region-name="right" extent="{$marginLeftRight1}mm"/>
276
292
  </fo:simple-page-master>
277
293
  <fo:page-sequence-master master-name="preface-publishedISO">
278
294
  <fo:repeatable-page-master-alternatives>
@@ -291,17 +307,48 @@
291
307
  </fo:repeatable-page-master-alternatives>
292
308
  </fo:page-sequence-master>
293
309
 
294
- <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
295
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
296
- <fo:region-before region-name="header-even" extent="27.4mm"/>
297
- <fo:region-after region-name="last-page-footer" extent="13mm"/>
298
- <fo:region-start region-name="left-region" extent="12.5mm"/>
299
- <fo:region-end region-name="right-region" extent="25mm"/>
310
+ <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
311
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
312
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
313
+ <fo:region-after region-name="last-page-footer" extent="{$marginBottom}mm"/>
314
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
315
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
300
316
  </fo:simple-page-master>
301
317
 
318
+ <!-- Index pages -->
319
+ <fo:simple-page-master master-name="index-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
320
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm" column-count="2" column-gap="10mm"/>
321
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
322
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
323
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
324
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
325
+ </fo:simple-page-master>
326
+ <fo:simple-page-master master-name="index-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
327
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm" column-count="2" column-gap="10mm"/>
328
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
329
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
330
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
331
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
332
+ </fo:simple-page-master>
333
+ <fo:page-sequence-master master-name="index">
334
+ <fo:repeatable-page-master-alternatives>
335
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="index-even"/>
336
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="index-odd"/>
337
+ </fo:repeatable-page-master-alternatives>
338
+ </fo:page-sequence-master>
339
+
340
+
302
341
  </fo:layout-master-set>
342
+
343
+ <fo:declarations>
344
+ <xsl:call-template name="addPDFUAmeta"/>
345
+ <xsl:for-each select="//*[local-name() = 'eref'][generate-id(.)=generate-id(key('attachments',@bibitemid)[1])]">
346
+ <xsl:variable name="url" select="concat('url(', ., ')')"/>
347
+ <pdf:embedded-file src="{$url}"/>
348
+ </xsl:for-each>
349
+ </fo:declarations>
303
350
 
304
- <xsl:call-template name="addPDFUAmeta"/>
351
+
305
352
 
306
353
  <xsl:call-template name="addBookmarks">
307
354
  <xsl:with-param name="contents" select="$contents"/>
@@ -1182,6 +1229,10 @@
1182
1229
  </fo:flow>
1183
1230
  </fo:page-sequence>
1184
1231
 
1232
+
1233
+ <!-- Index -->
1234
+ <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1235
+
1185
1236
  <xsl:if test="$isPublished = 'true'">
1186
1237
  <fo:page-sequence master-reference="last-page" force-page-count="no-force">
1187
1238
  <xsl:call-template name="insertHeaderEven"/>
@@ -1314,7 +1365,10 @@
1314
1365
  </xsl:variable>
1315
1366
 
1316
1367
  <xsl:variable name="type">
1317
- <xsl:value-of select="local-name()"/>
1368
+ <xsl:choose>
1369
+ <xsl:when test="local-name() = 'indexsect'">index</xsl:when>
1370
+ <xsl:otherwise><xsl:value-of select="local-name()"/></xsl:otherwise>
1371
+ </xsl:choose>
1318
1372
  </xsl:variable>
1319
1373
 
1320
1374
  <xsl:variable name="display">
@@ -1347,10 +1401,15 @@
1347
1401
  </xsl:variable>
1348
1402
 
1349
1403
  <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
1404
+ <xsl:if test="$type = 'index'">
1405
+ <xsl:attribute name="level">1</xsl:attribute>
1406
+ </xsl:if>
1350
1407
  <title>
1351
1408
  <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
1352
1409
  </title>
1353
- <xsl:apply-templates mode="contents"/>
1410
+ <xsl:if test="$type != 'index'">
1411
+ <xsl:apply-templates mode="contents"/>
1412
+ </xsl:if>
1354
1413
  </item>
1355
1414
  </xsl:if>
1356
1415
  </xsl:template>
@@ -1588,6 +1647,9 @@
1588
1647
  </xsl:choose>
1589
1648
  </xsl:attribute>
1590
1649
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1650
+ <xsl:if test="@id">
1651
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1652
+ </xsl:if>
1591
1653
  <xsl:apply-templates/>
1592
1654
  </xsl:element>
1593
1655
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1891,7 +1953,300 @@
1891
1953
  </fo:block>
1892
1954
  </xsl:template>
1893
1955
 
1956
+ <!-- =================== -->
1957
+ <!-- SVG images processing -->
1958
+ <!-- =================== -->
1959
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2">
1960
+
1961
+ <xsl:choose>
1962
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
1963
+ <fo:block>
1964
+ <xsl:variable name="width" select="@width"/>
1965
+ <xsl:variable name="height" select="@height"/>
1966
+
1967
+ <xsl:variable name="scale_x">
1968
+ <xsl:choose>
1969
+ <xsl:when test="$width &gt; $width_effective_px">
1970
+ <xsl:value-of select="$width_effective_px div $width"/>
1971
+ </xsl:when>
1972
+ <xsl:otherwise>1</xsl:otherwise>
1973
+ </xsl:choose>
1974
+ </xsl:variable>
1975
+
1976
+ <xsl:variable name="scale_y">
1977
+ <xsl:choose>
1978
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
1979
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
1980
+ </xsl:when>
1981
+ <xsl:otherwise>1</xsl:otherwise>
1982
+ </xsl:choose>
1983
+ </xsl:variable>
1984
+
1985
+ <xsl:variable name="scale">
1986
+ <xsl:choose>
1987
+ <xsl:when test="$scale_y != 1">
1988
+ <xsl:value-of select="$scale_x * $scale_y"/>
1989
+ </xsl:when>
1990
+ <xsl:otherwise>
1991
+ <xsl:value-of select="$scale_x"/>
1992
+ </xsl:otherwise>
1993
+ </xsl:choose>
1994
+ </xsl:variable>
1995
+
1996
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
1997
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
1998
+
1999
+ <fo:table table-layout="fixed" width="100%">
2000
+ <fo:table-column column-width="proportional-column-width(1)"/>
2001
+ <fo:table-column column-width="{$width_scale}px"/>
2002
+ <fo:table-column column-width="proportional-column-width(1)"/>
2003
+ <fo:table-body>
2004
+ <fo:table-row>
2005
+ <fo:table-cell column-number="2">
2006
+ <fo:block>
2007
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
2008
+ <fo:block text-depth="0" line-height="0" font-size="0">
2009
+ <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
2010
+ <xsl:attribute name="width">100%</xsl:attribute>
2011
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2012
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2013
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
1894
2014
 
2015
+ <xsl:apply-templates select="." mode="svg_remove_a"/>
2016
+ </fo:instream-foreign-object>
2017
+ </fo:block>
2018
+
2019
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
2020
+ <xsl:with-param name="scale" select="$scale"/>
2021
+ </xsl:apply-templates>
2022
+ </fo:block-container>
2023
+ </fo:block>
2024
+ </fo:table-cell>
2025
+ </fo:table-row>
2026
+ </fo:table-body>
2027
+ </fo:table>
2028
+ </fo:block>
2029
+
2030
+ </xsl:when>
2031
+ <xsl:otherwise>
2032
+ <fo:block xsl:use-attribute-sets="image-style">
2033
+ <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
2034
+ <xsl:attribute name="width">100%</xsl:attribute>
2035
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2036
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2037
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
2038
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
2039
+ <!-- effective height / width = 1.48, 1.4 - with title -->
2040
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
2041
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
2042
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2043
+ </xsl:if>
2044
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2045
+ <xsl:copy-of select="."/>
2046
+ </fo:instream-foreign-object>
2047
+ </fo:block>
2048
+ </xsl:otherwise>
2049
+ </xsl:choose>
2050
+ </xsl:template>
2051
+
2052
+ <xsl:template match="@*|node()" mode="svg_remove_a">
2053
+ <xsl:copy>
2054
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
2055
+ </xsl:copy>
2056
+ </xsl:template>
2057
+
2058
+ <xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
2059
+ <xsl:apply-templates mode="svg_remove_a"/>
2060
+ </xsl:template>
2061
+
2062
+ <xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
2063
+ <xsl:param name="scale"/>
2064
+ <xsl:variable name="dest">
2065
+ <xsl:choose>
2066
+ <xsl:when test="starts-with(@href, '#')">
2067
+ <xsl:value-of select="substring-after(@href, '#')"/>
2068
+ </xsl:when>
2069
+ <xsl:otherwise>
2070
+ <xsl:value-of select="@href"/>
2071
+ </xsl:otherwise>
2072
+ </xsl:choose>
2073
+ </xsl:variable>
2074
+ <xsl:for-each select="./*[local-name() = 'rect']">
2075
+ <xsl:call-template name="insertSVGMapLink">
2076
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
2077
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
2078
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
2079
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
2080
+ <xsl:with-param name="dest" select="$dest"/>
2081
+ </xsl:call-template>
2082
+ </xsl:for-each>
2083
+
2084
+ <xsl:for-each select="./*[local-name() = 'polygon']">
2085
+ <xsl:variable name="points">
2086
+ <xsl:call-template name="split">
2087
+ <xsl:with-param name="pText" select="@points"/>
2088
+ </xsl:call-template>
2089
+ </xsl:variable>
2090
+ <xsl:variable name="x_coords">
2091
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
2092
+ <xsl:sort select="." data-type="number"/>
2093
+ <x><xsl:value-of select="."/></x>
2094
+ </xsl:for-each>
2095
+ </xsl:variable>
2096
+ <xsl:variable name="y_coords">
2097
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
2098
+ <xsl:sort select="." data-type="number"/>
2099
+ <y><xsl:value-of select="."/></y>
2100
+ </xsl:for-each>
2101
+ </xsl:variable>
2102
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
2103
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
2104
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
2105
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
2106
+ <xsl:call-template name="insertSVGMapLink">
2107
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
2108
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
2109
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
2110
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
2111
+ <xsl:with-param name="dest" select="$dest"/>
2112
+ </xsl:call-template>
2113
+ </xsl:for-each>
2114
+
2115
+ <xsl:for-each select="./*[local-name() = 'circle']">
2116
+ <xsl:call-template name="insertSVGMapLink">
2117
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
2118
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
2119
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
2120
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
2121
+ <xsl:with-param name="dest" select="$dest"/>
2122
+ </xsl:call-template>
2123
+ </xsl:for-each>
2124
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
2125
+ <xsl:call-template name="insertSVGMapLink">
2126
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
2127
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
2128
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
2129
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
2130
+ <xsl:with-param name="dest" select="$dest"/>
2131
+ </xsl:call-template>
2132
+ </xsl:for-each>
2133
+ </xsl:template>
2134
+
2135
+ <xsl:template name="insertSVGMapLink">
2136
+ <xsl:param name="left"/>
2137
+ <xsl:param name="top"/>
2138
+ <xsl:param name="width"/>
2139
+ <xsl:param name="height"/>
2140
+ <xsl:param name="dest"/>
2141
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
2142
+ <fo:block font-size="1pt">
2143
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
2144
+ <fo:inline-container inline-progression-dimension="100%">
2145
+ <fo:block-container height="{$height - 1}px" width="100%">
2146
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
2147
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
2148
+ </xsl:if> -->
2149
+ <fo:block> </fo:block></fo:block-container>
2150
+ </fo:inline-container>
2151
+ </fo:basic-link>
2152
+ </fo:block>
2153
+ </fo:block-container>
2154
+ </xsl:template>
2155
+
2156
+ <!-- =================== -->
2157
+ <!-- End SVG images processing -->
2158
+ <!-- =================== -->
2159
+
2160
+ <!-- For express listings PDF attachments -->
2161
+ <xsl:template match="*[local-name() = 'eref'][contains(., '.exp')]" priority="2">
2162
+ <fo:inline xsl:use-attribute-sets="eref-style">
2163
+ <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
2164
+ <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
2165
+ <xsl:if test="normalize-space(@citeas) = ''">
2166
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
2167
+ </xsl:if>
2168
+ <xsl:apply-templates/>
2169
+ </fo:basic-link>
2170
+ </fo:inline>
2171
+ </xsl:template>
2172
+
2173
+
2174
+ <!-- =================== -->
2175
+ <!-- Index processing -->
2176
+ <!-- =================== -->
2177
+
2178
+ <xsl:template match="iso:indexsect"/>
2179
+ <xsl:template match="iso:indexsect" mode="index">
2180
+
2181
+ <fo:page-sequence master-reference="index" force-page-count="no-force">
2182
+ <xsl:variable name="header-title">
2183
+ <xsl:choose>
2184
+ <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2185
+ <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
2186
+ </xsl:when>
2187
+ <xsl:otherwise>
2188
+ <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2189
+ </xsl:otherwise>
2190
+ </xsl:choose>
2191
+ </xsl:variable>
2192
+ <xsl:call-template name="insertHeaderFooter">
2193
+ <xsl:with-param name="header-title" select="$header-title"/>
2194
+ </xsl:call-template>
2195
+
2196
+ <fo:flow flow-name="xsl-region-body">
2197
+ <fo:block id="{@id}" span="all">
2198
+ <xsl:apply-templates select="iso:title"/>
2199
+ </fo:block>
2200
+ <fo:block>
2201
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
2202
+ </fo:block>
2203
+ </fo:flow>
2204
+ </fo:page-sequence>
2205
+ </xsl:template>
2206
+
2207
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:title" priority="4"> -->
2208
+ <xsl:template match="iso:indexsect/iso:title" priority="4">
2209
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt">
2210
+ <!-- Index -->
2211
+ <xsl:apply-templates/>
2212
+ </fo:block>
2213
+ </xsl:template>
2214
+
2215
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:clause/iso:title" priority="4"> -->
2216
+ <xsl:template match="iso:indexsect/iso:clause/iso:title" priority="4">
2217
+ <!-- Letter A, B, C, ... -->
2218
+ <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
2219
+ <xsl:apply-templates/>
2220
+ </fo:block>
2221
+ </xsl:template>
2222
+
2223
+ <xsl:template match="iso:indexsect//iso:li/text()">
2224
+ <!-- to split by '_' and other chars -->
2225
+ <xsl:call-template name="add-zero-spaces-java"/>
2226
+ </xsl:template>
2227
+
2228
+ <xsl:template match="iso:xref" priority="2">
2229
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2230
+ <xsl:choose>
2231
+ <xsl:when test="@pagenumber='true'">
2232
+ <fo:inline>
2233
+ <xsl:if test="@id">
2234
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2235
+ </xsl:if>
2236
+ <fo:page-number-citation ref-id="{@target}"/>
2237
+ </fo:inline>
2238
+ </xsl:when>
2239
+ <xsl:otherwise>
2240
+ <xsl:apply-templates/>
2241
+ </xsl:otherwise>
2242
+ </xsl:choose>
2243
+ </fo:basic-link>
2244
+ </xsl:template>
2245
+
2246
+ <!-- =================== -->
2247
+ <!-- End of Index processing -->
2248
+ <!-- =================== -->
2249
+
1895
2250
 
1896
2251
  <xsl:template name="insertHeaderFooter">
1897
2252
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2393,6 +2748,9 @@
2393
2748
 
2394
2749
 
2395
2750
 
2751
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2752
+
2753
+
2396
2754
 
2397
2755
 
2398
2756
 
@@ -3034,7 +3392,15 @@
3034
3392
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3035
3393
  <xsl:value-of select="@target"/>
3036
3394
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3037
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3395
+ <xsl:variable name="mathml">
3396
+ <xsl:for-each select="*">
3397
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3398
+ <xsl:copy-of select="."/>
3399
+ </xsl:if>
3400
+ </xsl:for-each>
3401
+ </xsl:variable>
3402
+
3403
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3038
3404
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3039
3405
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3040
3406
  <xsl:param name="cols-count"/>
@@ -4075,6 +4441,10 @@
4075
4441
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4076
4442
  <xsl:apply-templates/>
4077
4443
  </fo:inline>
4444
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4445
+ <fo:inline background-color="yellow">
4446
+ <xsl:apply-templates/>
4447
+ </fo:inline>
4078
4448
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
4079
4449
  <xsl:variable name="text" select="normalize-space(.)"/>
4080
4450
  <fo:inline font-size="75%">
@@ -4415,6 +4785,7 @@
4415
4785
  <xsl:apply-templates select="." mode="mathml"/>
4416
4786
  </xsl:variable>
4417
4787
  <fo:instream-foreign-object fox:alt-text="Math">
4788
+
4418
4789
  <!-- <xsl:copy-of select="."/> -->
4419
4790
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4420
4791
  </fo:instream-foreign-object>
@@ -4433,7 +4804,7 @@
4433
4804
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4434
4805
  </xsl:copy>
4435
4806
  <mathml:mspace width="0.5ex"/>
4436
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4807
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4437
4808
  <xsl:variable name="target">
4438
4809
  <xsl:choose>
4439
4810
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4467,8 +4838,6 @@
4467
4838
  </xsl:otherwise>
4468
4839
  </xsl:choose>
4469
4840
  </fo:inline>
4470
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4471
- <fo:inline id="{@id}"/>
4472
4841
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4473
4842
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4474
4843
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4677,6 +5046,7 @@
4677
5046
  <fo:block id="{@id}">
4678
5047
  <xsl:apply-templates/>
4679
5048
  </fo:block>
5049
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4680
5050
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4681
5051
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4682
5052
  <xsl:apply-templates/>
@@ -5216,8 +5586,8 @@
5216
5586
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5217
5587
 
5218
5588
  <xsl:variable name="element">
5219
- block
5220
-
5589
+
5590
+ inline
5221
5591
  <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5222
5592
  </xsl:variable>
5223
5593
 
@@ -5260,9 +5630,15 @@
5260
5630
  </xsl:choose>
5261
5631
 
5262
5632
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5263
-
5633
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5264
5634
  <xsl:variable name="element">
5265
- block
5635
+
5636
+
5637
+ <xsl:choose>
5638
+ <xsl:when test="$num = 1">inline</xsl:when>
5639
+ <xsl:otherwise>block</xsl:otherwise>
5640
+ </xsl:choose>
5641
+
5266
5642
 
5267
5643
  </xsl:variable>
5268
5644
  <xsl:choose>
@@ -5367,29 +5743,47 @@
5367
5743
  <xsl:text>— </xsl:text>
5368
5744
  <xsl:apply-templates/>
5369
5745
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5370
- <fo:inline xsl:use-attribute-sets="eref-style">
5371
- <xsl:if test="@type = 'footnote'">
5372
-
5373
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5374
- <xsl:attribute name="font-size">80%</xsl:attribute>
5375
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5376
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5377
-
5378
-
5379
- </xsl:if>
5380
-
5381
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5382
-
5383
- <xsl:if test="@type = 'inline'">
5384
-
5385
-
5386
-
5387
- </xsl:if>
5388
-
5389
-
5390
- <xsl:apply-templates/>
5391
- </fo:basic-link>
5392
- </fo:inline>
5746
+
5747
+ <xsl:variable name="bibitemid">
5748
+ <xsl:choose>
5749
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5750
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5751
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5752
+ </xsl:choose>
5753
+ </xsl:variable>
5754
+
5755
+ <xsl:choose>
5756
+ <xsl:when test="normalize-space($bibitemid) != ''">
5757
+ <fo:inline xsl:use-attribute-sets="eref-style">
5758
+ <xsl:if test="@type = 'footnote'">
5759
+
5760
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5761
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5762
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5763
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5764
+
5765
+
5766
+ </xsl:if>
5767
+
5768
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5769
+ <xsl:if test="normalize-space(@citeas) = ''">
5770
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5771
+ </xsl:if>
5772
+ <xsl:if test="@type = 'inline'">
5773
+
5774
+
5775
+
5776
+ </xsl:if>
5777
+
5778
+ <xsl:apply-templates/>
5779
+ </fo:basic-link>
5780
+
5781
+ </fo:inline>
5782
+ </xsl:when>
5783
+ <xsl:otherwise>
5784
+ <fo:inline><xsl:apply-templates/></fo:inline>
5785
+ </xsl:otherwise>
5786
+ </xsl:choose>
5393
5787
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5394
5788
  <!-- zero-space char -->
5395
5789
  <xsl:variable name="depth">
@@ -5572,6 +5966,153 @@
5572
5966
  </fo:block>
5573
5967
  </xsl:otherwise>
5574
5968
  </xsl:choose>
5969
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5970
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5971
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5972
+ </xsl:for-each>
5973
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5974
+ <xsl:copy>
5975
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5976
+ </xsl:copy>
5977
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5978
+ <xsl:variable name="id">
5979
+ <xsl:call-template name="generateIndexXrefId"/>
5980
+ </xsl:variable>
5981
+ <xsl:copy> <!-- add id to xref -->
5982
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5983
+ <xsl:attribute name="id">
5984
+ <xsl:value-of select="$id"/>
5985
+ </xsl:attribute>
5986
+ <xsl:apply-templates mode="index_add_id"/>
5987
+ </xsl:copy>
5988
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5989
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5990
+ <xsl:if test="@to">
5991
+ <xsl:value-of select="$dash"/>
5992
+ <xsl:copy>
5993
+ <xsl:copy-of select="@*"/>
5994
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
5995
+ <xsl:attribute name="id">
5996
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
5997
+ </xsl:attribute>
5998
+ <xsl:apply-templates mode="index_add_id"/>
5999
+ </xsl:copy>
6000
+ </xsl:if>
6001
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
6002
+ <xsl:copy>
6003
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
6004
+ </xsl:copy>
6005
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
6006
+ <xsl:copy>
6007
+ <xsl:apply-templates select="@*" mode="index_update"/>
6008
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
6009
+ </xsl:copy>
6010
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
6011
+ <xsl:param name="element"/>
6012
+ <xsl:param name="remove" select="'false'"/>
6013
+ <xsl:param name="target"/>
6014
+ <!-- <node></node> -->
6015
+ <xsl:choose>
6016
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6017
+ <!-- skip text (i.e. remove it) and process next element -->
6018
+ <!-- [removed_<xsl:value-of select="."/>] -->
6019
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6020
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
6021
+ </xsl:apply-templates>
6022
+ </xsl:when>
6023
+ <xsl:when test="self::text()">
6024
+ <xsl:value-of select="."/>
6025
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6026
+ </xsl:when>
6027
+ <xsl:when test="self::* and local-name(.) = 'xref'">
6028
+ <xsl:variable name="id" select="@id"/>
6029
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
6030
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
6031
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
6032
+
6033
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
6034
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
6035
+
6036
+ <xsl:choose>
6037
+ <!-- 2nd pass -->
6038
+ <!-- if page is equal to page for next and page is not the end of range -->
6039
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
6040
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
6041
+ <!-- [removed_xref] -->
6042
+
6043
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6044
+ <xsl:with-param name="remove">true</xsl:with-param>
6045
+ <xsl:with-param name="target">
6046
+ <xsl:choose>
6047
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
6048
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
6049
+ </xsl:choose>
6050
+ </xsl:with-param>
6051
+ </xsl:apply-templates>
6052
+ </xsl:when>
6053
+
6054
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
6055
+ <!-- remove xref -->
6056
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6057
+ <xsl:with-param name="remove">true</xsl:with-param>
6058
+ </xsl:apply-templates>
6059
+ </xsl:when>
6060
+
6061
+ <xsl:otherwise>
6062
+ <xsl:apply-templates select="." mode="xref_copy">
6063
+ <xsl:with-param name="target" select="$target"/>
6064
+ </xsl:apply-templates>
6065
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6066
+ </xsl:otherwise>
6067
+ </xsl:choose>
6068
+ </xsl:when>
6069
+ <xsl:when test="self::* and local-name(.) = 'ul'">
6070
+ <!-- ul -->
6071
+ <xsl:apply-templates select="." mode="index_update"/>
6072
+ </xsl:when>
6073
+ <xsl:otherwise>
6074
+ <xsl:apply-templates select="." mode="xref_copy">
6075
+ <xsl:with-param name="target" select="$target"/>
6076
+ </xsl:apply-templates>
6077
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6078
+ </xsl:otherwise>
6079
+ </xsl:choose>
6080
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
6081
+ <xsl:param name="target"/>
6082
+ <xsl:copy>
6083
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
6084
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
6085
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
6086
+ </xsl:if>
6087
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
6088
+ </xsl:copy>
6089
+ </xsl:template><xsl:template name="generateIndexXrefId">
6090
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6091
+
6092
+ <xsl:variable name="docid">
6093
+ <xsl:call-template name="getDocumentId"/>
6094
+ </xsl:variable>
6095
+ <xsl:variable name="item_number">
6096
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
6097
+ </xsl:variable>
6098
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6099
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6100
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6101
+ <xsl:apply-templates/>
6102
+ <fo:block>
6103
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6104
+ <fo:block> </fo:block>
6105
+ </xsl:if>
6106
+ </fo:block>
6107
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6108
+ <xsl:apply-templates/>
6109
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6110
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6111
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6112
+ <xsl:apply-templates/>
6113
+ </fo:block>
6114
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
6115
+ <fo:inline id="{@id}"/>
5575
6116
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5576
6117
  <!-- <row>
5577
6118
  <date>05-07-2013</date>
@@ -5788,70 +6329,68 @@
5788
6329
  <xsl:variable name="lang">
5789
6330
  <xsl:call-template name="getLang"/>
5790
6331
  </xsl:variable>
5791
- <fo:declarations>
5792
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5793
- <pdf:dictionary type="normal" key="ViewerPreferences">
5794
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5795
- </pdf:dictionary>
5796
- </pdf:catalog>
5797
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5798
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5799
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5800
- <!-- Dublin Core properties go here -->
5801
- <dc:title>
5802
- <xsl:variable name="title">
5803
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5804
-
5805
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5806
-
5807
-
5808
-
5809
-
5810
-
5811
-
5812
- </xsl:for-each>
5813
- </xsl:variable>
5814
- <xsl:choose>
5815
- <xsl:when test="normalize-space($title) != ''">
5816
- <xsl:value-of select="$title"/>
5817
- </xsl:when>
5818
- <xsl:otherwise>
5819
- <xsl:text> </xsl:text>
5820
- </xsl:otherwise>
5821
- </xsl:choose>
5822
- </dc:title>
5823
- <dc:creator>
6332
+ <pdf:catalog>
6333
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6334
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6335
+ </pdf:dictionary>
6336
+ </pdf:catalog>
6337
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6338
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6339
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6340
+ <!-- Dublin Core properties go here -->
6341
+ <dc:title>
6342
+ <xsl:variable name="title">
5824
6343
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5825
6344
 
5826
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5827
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5828
- <xsl:if test="position() != last()">; </xsl:if>
5829
- </xsl:for-each>
5830
-
6345
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5831
6346
 
5832
6347
 
5833
- </xsl:for-each>
5834
- </dc:creator>
5835
- <dc:description>
5836
- <xsl:variable name="abstract">
5837
6348
 
5838
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5839
6349
 
5840
6350
 
5841
- </xsl:variable>
5842
- <xsl:value-of select="normalize-space($abstract)"/>
5843
- </dc:description>
5844
- <pdf:Keywords>
5845
- <xsl:call-template name="insertKeywords"/>
5846
- </pdf:Keywords>
5847
- </rdf:Description>
5848
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5849
- <!-- XMP properties go here -->
5850
- <xmp:CreatorTool/>
5851
- </rdf:Description>
5852
- </rdf:RDF>
5853
- </x:xmpmeta>
5854
- </fo:declarations>
6351
+
6352
+ </xsl:for-each>
6353
+ </xsl:variable>
6354
+ <xsl:choose>
6355
+ <xsl:when test="normalize-space($title) != ''">
6356
+ <xsl:value-of select="$title"/>
6357
+ </xsl:when>
6358
+ <xsl:otherwise>
6359
+ <xsl:text> </xsl:text>
6360
+ </xsl:otherwise>
6361
+ </xsl:choose>
6362
+ </dc:title>
6363
+ <dc:creator>
6364
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6365
+
6366
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6367
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6368
+ <xsl:if test="position() != last()">; </xsl:if>
6369
+ </xsl:for-each>
6370
+
6371
+
6372
+
6373
+ </xsl:for-each>
6374
+ </dc:creator>
6375
+ <dc:description>
6376
+ <xsl:variable name="abstract">
6377
+
6378
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6379
+
6380
+
6381
+ </xsl:variable>
6382
+ <xsl:value-of select="normalize-space($abstract)"/>
6383
+ </dc:description>
6384
+ <pdf:Keywords>
6385
+ <xsl:call-template name="insertKeywords"/>
6386
+ </pdf:Keywords>
6387
+ </rdf:Description>
6388
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6389
+ <!-- XMP properties go here -->
6390
+ <xmp:CreatorTool/>
6391
+ </rdf:Description>
6392
+ </rdf:RDF>
6393
+ </x:xmpmeta>
5855
6394
  </xsl:template><xsl:template name="getId">
5856
6395
  <xsl:choose>
5857
6396
  <xsl:when test="../@id">