metanorma-iho 0.2.0 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,24 +30,8 @@
30
30
  -->
31
31
  <xsl:variable name="contents">
32
32
  <contents>
33
- <xsl:apply-templates select="/iho:iho-standard/iho:preface/*" mode="contents"/>
34
-
35
- <xsl:apply-templates select="/iho:iho-standard/iho:sections/*" mode="contents"/> <!-- iho:clause[1] [@id = '_scope'] -->
36
-
37
- <!-- [@id = '_normative_references'] -->
38
- <!-- <xsl:apply-templates select="/iho:iho-standard/iho:bibliography/iho:references[1]" mode="contents">
39
- <xsl:with-param name="sectionNum" select="'2'"/>
40
- </xsl:apply-templates> -->
41
- <!-- @id != '_scope' -->
42
- <!-- <xsl:apply-templates select="/iho:iho-standard/iho:sections/*[position() &gt; 1]" mode="contents">
43
- <xsl:with-param name="sectionNumSkew" select="'1'"/>
44
- </xsl:apply-templates> -->
45
- <xsl:apply-templates select="/iho:iho-standard/iho:annex" mode="contents"/>
46
-
47
-
48
- <!-- Bibliography -->
49
- <xsl:apply-templates select="/iho:iho-standard/iho:bibliography/iho:references[position() &gt; 1]" mode="contents"/> <!-- @id = '_bibliography' -->
50
-
33
+ <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
34
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
51
35
  </contents>
52
36
  </xsl:variable>
53
37
 
@@ -127,6 +111,10 @@
127
111
 
128
112
  <xsl:call-template name="addPDFUAmeta"/>
129
113
 
114
+ <xsl:call-template name="addBookmarks">
115
+ <xsl:with-param name="contents" select="$contents"/>
116
+ </xsl:call-template>
117
+
130
118
  <!-- =========================== -->
131
119
  <!-- Cover Page -->
132
120
  <fo:page-sequence master-reference="cover">
@@ -233,7 +221,7 @@
233
221
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
234
222
  </xsl:if>
235
223
 
236
- <xsl:for-each select="xalan:nodeset($contents)//item"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
224
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
237
225
  <fo:block>
238
226
  <xsl:if test="@level = 1">
239
227
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -259,8 +247,8 @@
259
247
  </fo:list-item-label>
260
248
  <fo:list-item-body start-indent="body-start()">
261
249
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
262
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
263
- <xsl:apply-templates/>
250
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
251
+ <xsl:apply-templates select="title"/>
264
252
  <fo:inline keep-together.within-line="always">
265
253
  <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
266
254
  <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
@@ -277,7 +265,7 @@
277
265
  </fo:block-container>
278
266
 
279
267
  <!-- Foreword, Introduction -->
280
- <xsl:apply-templates select="/iho:iho-standard/iho:preface/*"/>
268
+ <xsl:call-template name="processPrefaceSectionsDefault"/>
281
269
 
282
270
  </fo:flow>
283
271
  </fo:page-sequence>
@@ -302,9 +290,13 @@
302
290
 
303
291
  <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt"><xsl:value-of select="$title-en"/></fo:block>
304
292
 
305
- <xsl:apply-templates select="/iho:iho-standard/iho:sections/*"/>
306
-
307
-
293
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
294
+ <!-- Normative references -->
295
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']"/>
296
+ <!-- Terms and definitions -->
297
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms']"/>
298
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='definitions']"/>
299
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope')]"/>
308
300
 
309
301
  </fo:block-container>
310
302
  </fo:flow>
@@ -319,12 +311,32 @@
319
311
  </fo:static-content>
320
312
  <xsl:call-template name="insertHeaderFooter"/>
321
313
  <fo:flow flow-name="xsl-region-body">
322
- <fo:block-container>
323
- <xsl:apply-templates select="/iho:iho-standard/iho:annex"/>
314
+ <fo:block-container>
315
+ <xsl:apply-templates select="/*/*[local-name()='annex']"/>
316
+ </fo:block-container>
317
+ </fo:flow>
318
+ </fo:page-sequence>
319
+ </xsl:if>
320
+
321
+ <xsl:if test="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]">
322
+ <fo:page-sequence master-reference="document">
323
+ <fo:static-content flow-name="xsl-footnote-separator">
324
+ <fo:block>
325
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
326
+ </fo:block>
327
+ </fo:static-content>
328
+ <xsl:call-template name="insertHeaderFooter"/>
329
+ <fo:flow flow-name="xsl-region-body">
330
+ <fo:block-container>
331
+ <!-- Bibliography -->
332
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
324
333
  </fo:block-container>
325
334
  </fo:flow>
326
335
  </fo:page-sequence>
327
336
  </xsl:if>
337
+
338
+
339
+
328
340
  <!-- =========================== -->
329
341
  <!-- End Document Pages -->
330
342
  <!-- =========================== -->
@@ -353,15 +365,21 @@
353
365
  </xsl:variable>
354
366
 
355
367
  <xsl:variable name="display">
356
- <xsl:choose>
357
- <xsl:when test="ancestor-or-self::iho:bibitem">false</xsl:when>
358
- <xsl:when test="ancestor-or-self::iho:term">false</xsl:when>
368
+ <xsl:choose>
359
369
  <xsl:when test="$level &lt;= 2">true</xsl:when>
360
370
  <xsl:otherwise>false</xsl:otherwise>
361
371
  </xsl:choose>
362
372
  </xsl:variable>
363
373
 
364
- <xsl:if test="$display = 'true'">
374
+ <xsl:variable name="skip">
375
+ <xsl:choose>
376
+ <xsl:when test="ancestor-or-self::iho:bibitem">true</xsl:when>
377
+ <xsl:when test="ancestor-or-self::iho:term">true</xsl:when>
378
+ <xsl:otherwise>false</xsl:otherwise>
379
+ </xsl:choose>
380
+ </xsl:variable>
381
+
382
+ <xsl:if test="$skip = 'false'">
365
383
 
366
384
  <xsl:variable name="section">
367
385
  <xsl:call-template name="getSection"/>
@@ -380,10 +398,13 @@
380
398
  <xsl:if test="ancestor-or-self::iho:annex">annex</xsl:if>
381
399
  </xsl:variable>
382
400
 
383
- <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}">
384
- <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
401
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
402
+ <title>
403
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
404
+ </title>
405
+ <xsl:apply-templates mode="contents"/>
385
406
  </item>
386
- <xsl:apply-templates mode="contents"/>
407
+
387
408
  </xsl:if>
388
409
 
389
410
  </xsl:template>
@@ -428,7 +449,7 @@
428
449
  </fo:block>
429
450
  </xsl:template>
430
451
 
431
- <xsl:template match="iho:references[position() &gt; 1]/iho:title">
452
+ <xsl:template match="iho:bibliography/iho:references[not(@normative='true')]/iho:title">
432
453
  <fo:block font-size="16pt" font-weight="bold" text-align="center" margin-top="6pt" margin-bottom="36pt" keep-with-next="always">
433
454
  <xsl:apply-templates/>
434
455
  </fo:block>
@@ -570,13 +591,13 @@
570
591
  <fo:inline font-size="70%" keep-with-previous.within-line="always" vertical-align="super"> <!-- -->
571
592
  <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
572
593
  <!-- <xsl:value-of select="@reference"/> -->
573
- <xsl:value-of select="$number + count(//iho:bibitem[ancestor::iho:references[@id='_normative_references']]/iho:note)"/>
594
+ <xsl:value-of select="$number + count(//iho:bibitem[ancestor::iho:references[@normative='true']]/iho:note)"/>
574
595
  </fo:basic-link>
575
596
  </fo:inline>
576
597
  <fo:footnote-body>
577
598
  <fo:block font-size="10pt" margin-bottom="12pt">
578
599
  <fo:inline id="footnote_{@reference}_{$number}" font-size="60%" vertical-align="super" keep-with-next.within-line="always" padding-right="1mm"> <!-- font-size="60%" alignment-baseline="hanging" -->
579
- <xsl:value-of select="$number + count(//iho:bibitem[ancestor::iho:references[@id='_normative_references']]/iho:note)"/>
600
+ <xsl:value-of select="$number + count(//iho:bibitem[ancestor::iho:references[@normative='true']]/iho:note)"/>
580
601
  </fo:inline>
581
602
  <xsl:for-each select="iho:p">
582
603
  <xsl:apply-templates/>
@@ -600,7 +621,7 @@
600
621
  </xsl:template>
601
622
 
602
623
 
603
- <xsl:template match="iho:ul | iho:ol">
624
+ <xsl:template match="iho:ul | iho:ol" mode="ul_ol">
604
625
  <fo:list-block provisional-distance-between-starts="6mm">
605
626
  <xsl:apply-templates/>
606
627
  </fo:list-block>
@@ -616,13 +637,16 @@
616
637
  <xsl:apply-templates mode="process"/>
617
638
  </fo:block>
618
639
  </xsl:template>
619
- <xsl:template match="iho:ul//iho:note/iho:name | iho:ol//iho:note/iho:name" mode="process"/>
620
- <xsl:template match="iho:ul//iho:note/iho:p | iho:ol//iho:note/iho:p" mode="process">
640
+ <xsl:template match="iho:ul//iho:note/iho:name | iho:ol//iho:note/iho:name" mode="process" priority="2"/>
641
+ <xsl:template match="iho:ul//iho:note/iho:p | iho:ol//iho:note/iho:p" mode="process" priority="2">
621
642
  <fo:block font-size="11pt" margin-top="4pt">
622
643
  <xsl:apply-templates/>
623
644
  </fo:block>
624
645
  </xsl:template>
625
646
 
647
+ <xsl:template match="iho:ul//iho:note/* | iho:ol//iho:note/*" mode="process">
648
+ <xsl:apply-templates select="."/>
649
+ </xsl:template>
626
650
 
627
651
 
628
652
  <xsl:template match="iho:li">
@@ -682,7 +706,13 @@
682
706
  </fo:block>
683
707
  </xsl:template>
684
708
 
685
- <!-- Example: [1] IHO S-100, Universal Hydrographic Data Model v4.0.0, December 2018 (Encoding, Feature Catalogue) -->
709
+
710
+ <!-- IHO documents:
711
+ "[1] S57 edition 3.1: IHO Transfer Standard for Digital Hydrographic Data, International Hydrographic Organization (www.iho.int)”
712
+ [{number}] {docID} edition {edition}: {title}, {author/organization}
713
+
714
+ Non-IHO documents:
715
+ Provide title and publisher -->
686
716
  <xsl:template match="iho:bibitem">
687
717
  <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm" line-height="115%">
688
718
  <fo:list-item>
@@ -695,38 +725,34 @@
695
725
  </fo:list-item-label>
696
726
  <fo:list-item-body start-indent="body-start()">
697
727
  <fo:block>
698
- <xsl:variable name="docidentifier">
699
- <xsl:if test="iho:docidentifier">
700
- <xsl:choose>
701
- <xsl:when test="iho:docidentifier/@type = 'metanorma'"/>
702
- <xsl:otherwise><xsl:value-of select="iho:docidentifier"/></xsl:otherwise>
703
- </xsl:choose>
704
- </xsl:if>
705
- </xsl:variable>
706
- <xsl:value-of select="$docidentifier"/>
707
- <xsl:apply-templates select="iho:note"/>
708
- <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
709
- <xsl:choose>
710
- <xsl:when test="iho:title[@type = 'main' and @language = 'en']">
711
- <xsl:apply-templates select="iho:title[@type = 'main' and @language = 'en']"/>
712
- </xsl:when>
713
- <xsl:otherwise>
714
- <xsl:apply-templates select="iho:title"/>
715
- </xsl:otherwise>
716
- </xsl:choose>
717
- <xsl:apply-templates select="iho:formattedref"/>
728
+ <xsl:call-template name="processBibitem"/>
718
729
  </fo:block>
719
730
  </fo:list-item-body>
720
731
  </fo:list-item>
721
732
  </fo:list-block>
722
733
  </xsl:template>
723
734
 
735
+ <xsl:template match="iho:bibitem/iho:edition">
736
+ <xsl:text> edition </xsl:text>
737
+ <xsl:value-of select="."/>
738
+ </xsl:template>
739
+
724
740
  <xsl:template match="iho:bibitem/iho:title">
725
741
  <fo:inline font-style="italic">
726
742
  <xsl:apply-templates/>
727
743
  </fo:inline>
728
744
  </xsl:template>
729
745
 
746
+ <xsl:template match="iho:bibitem/iho:uri">
747
+ <xsl:text> (</xsl:text>
748
+ <fo:inline xsl:use-attribute-sets="link-style">
749
+ <fo:basic-link external-destination="." fox:alt-text=".">
750
+ <xsl:value-of select="."/>
751
+ </fo:basic-link>
752
+ </fo:inline>
753
+ <xsl:text>)</xsl:text>
754
+ </xsl:template>
755
+
730
756
  <xsl:template match="iho:bibitem/iho:note" priority="2">
731
757
  <fo:footnote>
732
758
  <xsl:variable name="number">
@@ -941,6 +967,12 @@
941
967
 
942
968
  </title-edition>
943
969
 
970
+ <title-edition lang="fr">
971
+
972
+ <xsl:text>Édition </xsl:text>
973
+
974
+ </title-edition>
975
+
944
976
 
945
977
  <title-toc lang="en">
946
978
 
@@ -949,7 +981,12 @@
949
981
 
950
982
 
951
983
  </title-toc>
952
- <title-toc lang="fr">Sommaire</title-toc>
984
+ <title-toc lang="fr">
985
+
986
+ <xsl:text>Sommaire</xsl:text>
987
+
988
+
989
+ </title-toc>
953
990
 
954
991
  <title-toc lang="zh">Contents</title-toc>
955
992
 
@@ -983,7 +1020,12 @@
983
1020
 
984
1021
 
985
1022
 
986
- <title-source lang="en">SOURCE</title-source>
1023
+ <title-source lang="en">
1024
+
1025
+ <xsl:text>SOURCE</xsl:text>
1026
+
1027
+
1028
+ </title-source>
987
1029
 
988
1030
  <title-keywords lang="en">Keywords</title-keywords>
989
1031
 
@@ -1026,12 +1068,25 @@
1026
1068
  <title-warning lang="zh">警告</title-warning>
1027
1069
 
1028
1070
  <title-amendment lang="en">AMENDMENT</title-amendment>
1071
+
1072
+ <title-continued lang="en">(continued)</title-continued>
1073
+ <title-continued lang="fr">(continué)</title-continued>
1074
+
1029
1075
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1030
1076
  <xsl:param name="name"/>
1031
- <xsl:variable name="lang">
1032
- <xsl:call-template name="getLang"/>
1077
+ <xsl:param name="lang"/>
1078
+ <xsl:variable name="lang_">
1079
+ <xsl:choose>
1080
+ <xsl:when test="$lang != ''">
1081
+ <xsl:value-of select="$lang"/>
1082
+ </xsl:when>
1083
+ <xsl:otherwise>
1084
+ <xsl:call-template name="getLang"/>
1085
+ </xsl:otherwise>
1086
+ </xsl:choose>
1033
1087
  </xsl:variable>
1034
- <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
1088
+ <xsl:variable name="language" select="normalize-space($lang_)"/>
1089
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $language]"/>
1035
1090
  <xsl:choose>
1036
1091
  <xsl:when test="normalize-space($title_) != ''">
1037
1092
  <xsl:value-of select="$title_"/>
@@ -1040,12 +1095,15 @@
1040
1095
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1041
1096
  </xsl:otherwise>
1042
1097
  </xsl:choose>
1043
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
1098
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
1099
+
1100
+ </xsl:attribute-set><xsl:attribute-set name="link-style">
1044
1101
 
1045
1102
  <xsl:attribute name="color">blue</xsl:attribute>
1046
1103
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1047
1104
 
1048
1105
 
1106
+
1049
1107
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1050
1108
  <xsl:attribute name="white-space">pre</xsl:attribute>
1051
1109
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1057,8 +1115,8 @@
1057
1115
 
1058
1116
 
1059
1117
 
1060
- <xsl:attribute name="font-family">SFMono-Regular</xsl:attribute>
1061
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1118
+
1119
+ <xsl:attribute name="font-family">SFMono-Regular</xsl:attribute>
1062
1120
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1063
1121
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1064
1122
  <xsl:attribute name="line-height">113%</xsl:attribute>
@@ -1113,9 +1171,11 @@
1113
1171
 
1114
1172
 
1115
1173
 
1174
+
1116
1175
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1117
1176
 
1118
1177
 
1178
+
1119
1179
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1120
1180
 
1121
1181
 
@@ -1134,6 +1194,9 @@
1134
1194
 
1135
1195
 
1136
1196
 
1197
+
1198
+
1199
+
1137
1200
 
1138
1201
  </xsl:attribute-set><xsl:attribute-set name="example-p-style">
1139
1202
 
@@ -1150,6 +1213,8 @@
1150
1213
 
1151
1214
 
1152
1215
 
1216
+
1217
+
1153
1218
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1154
1219
 
1155
1220
 
@@ -1174,6 +1239,8 @@
1174
1239
 
1175
1240
 
1176
1241
 
1242
+
1243
+
1177
1244
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1178
1245
 
1179
1246
 
@@ -1187,11 +1254,13 @@
1187
1254
 
1188
1255
  <xsl:attribute name="color">blue</xsl:attribute>
1189
1256
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1190
-
1257
+
1258
+
1191
1259
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1192
1260
 
1193
1261
 
1194
1262
 
1263
+
1195
1264
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1196
1265
 
1197
1266
 
@@ -1211,9 +1280,7 @@
1211
1280
 
1212
1281
 
1213
1282
 
1214
-
1215
-
1216
- </xsl:attribute-set><xsl:attribute-set name="note-name-style">
1283
+ </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
1217
1284
 
1218
1285
 
1219
1286
 
@@ -1225,7 +1292,9 @@
1225
1292
 
1226
1293
 
1227
1294
 
1228
-
1295
+
1296
+
1297
+
1229
1298
 
1230
1299
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1231
1300
 
@@ -1255,6 +1324,8 @@
1255
1324
 
1256
1325
 
1257
1326
 
1327
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1328
+
1258
1329
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1259
1330
 
1260
1331
 
@@ -1285,6 +1356,7 @@
1285
1356
  <xsl:attribute name="color">blue</xsl:attribute>
1286
1357
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1287
1358
 
1359
+
1288
1360
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1289
1361
 
1290
1362
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -1296,6 +1368,7 @@
1296
1368
 
1297
1369
 
1298
1370
 
1371
+
1299
1372
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1300
1373
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1301
1374
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1312,7 +1385,7 @@
1312
1385
 
1313
1386
 
1314
1387
 
1315
-
1388
+
1316
1389
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
1317
1390
 
1318
1391
  </xsl:attribute-set><xsl:attribute-set name="image-style">
@@ -1337,14 +1410,16 @@
1337
1410
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1338
1411
 
1339
1412
 
1340
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1341
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1413
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
1414
+
1342
1415
 
1343
1416
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
1344
1417
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1345
1418
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1346
1419
  <xsl:attribute name="text-align">center</xsl:attribute>
1347
1420
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1421
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1422
+
1348
1423
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
1349
1424
 
1350
1425
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -1357,7 +1432,43 @@
1357
1432
 
1358
1433
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1359
1434
 
1360
- </xsl:attribute-set><xsl:template match="text()">
1435
+ </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1436
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1437
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1438
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1439
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
1440
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1441
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1442
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1443
+
1444
+ <!-- Normative references -->
1445
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1446
+ <!-- Terms and definitions -->
1447
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
1448
+ <!-- Another main sections -->
1449
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
1450
+ <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1451
+ <!-- Bibliography -->
1452
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1453
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1454
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1455
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1456
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1457
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1458
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1459
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1460
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1461
+
1462
+ <!-- Normative references -->
1463
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']"/>
1464
+ <!-- Terms and definitions -->
1465
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]"/>
1466
+ <!-- Another main sections -->
1467
+ <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]"/>
1468
+ <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1469
+ <!-- Bibliography -->
1470
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1471
+ </xsl:template><xsl:template match="text()">
1361
1472
  <xsl:value-of select="."/>
1362
1473
  </xsl:template><xsl:template match="*[local-name()='br']">
1363
1474
  <xsl:value-of select="$linebreak"/>
@@ -1374,6 +1485,10 @@
1374
1485
 
1375
1486
 
1376
1487
 
1488
+
1489
+
1490
+ <!-- $namespace = 'iso' or -->
1491
+
1377
1492
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1378
1493
 
1379
1494
 
@@ -1409,6 +1524,7 @@
1409
1524
  <xsl:with-param name="table" select="$simple-table"/>
1410
1525
  </xsl:call-template>
1411
1526
  </xsl:variable>
1527
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1412
1528
 
1413
1529
  <!-- <xsl:variable name="colwidths2">
1414
1530
  <xsl:call-template name="calculate-column-widths">
@@ -1430,9 +1546,12 @@
1430
1546
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1431
1547
 
1432
1548
 
1549
+
1550
+
1551
+
1433
1552
 
1434
1553
 
1435
-
1554
+
1436
1555
 
1437
1556
 
1438
1557
 
@@ -1440,20 +1559,43 @@
1440
1559
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
1441
1560
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
1442
1561
 
1443
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
1444
-
1445
-
1562
+
1563
+
1564
+
1565
+
1566
+ <xsl:variable name="table_attributes">
1567
+ <attribute name="table-layout">fixed</attribute>
1568
+ <attribute name="width">100%</attribute>
1569
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1570
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1446
1571
 
1447
1572
 
1448
1573
 
1449
1574
 
1575
+
1576
+
1577
+
1578
+
1579
+ <attribute name="margin-left">0mm</attribute>
1580
+ <attribute name="margin-right">0mm</attribute>
1450
1581
 
1582
+
1451
1583
 
1584
+ </xsl:variable>
1585
+
1586
+
1587
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1452
1588
 
1589
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1590
+ <xsl:attribute name="{@name}">
1591
+ <xsl:value-of select="."/>
1592
+ </xsl:attribute>
1593
+ </xsl:for-each>
1453
1594
 
1454
-
1455
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1456
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1595
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1596
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1597
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1598
+ </xsl:if>
1457
1599
 
1458
1600
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
1459
1601
  <xsl:choose>
@@ -1477,6 +1619,33 @@
1477
1619
 
1478
1620
  </fo:table>
1479
1621
 
1622
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1623
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1624
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1625
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1626
+ </xsl:call-template>
1627
+ </xsl:for-each>
1628
+
1629
+ <!-- insert footer as table -->
1630
+ <!-- <fo:table>
1631
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1632
+ <xsl:attribute name="{@name}">
1633
+ <xsl:value-of select="."/>
1634
+ </xsl:attribute>
1635
+ </xsl:for-each>
1636
+
1637
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1638
+ <xsl:choose>
1639
+ <xsl:when test=". = 1 or . = 0">
1640
+ <fo:table-column column-width="proportional-column-width(2)"/>
1641
+ </xsl:when>
1642
+ <xsl:otherwise>
1643
+ <fo:table-column column-width="proportional-column-width({.})"/>
1644
+ </xsl:otherwise>
1645
+ </xsl:choose>
1646
+ </xsl:for-each>
1647
+ </fo:table>-->
1648
+
1480
1649
 
1481
1650
 
1482
1651
 
@@ -1485,8 +1654,9 @@
1485
1654
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1486
1655
  <xsl:if test="normalize-space() != ''">
1487
1656
  <fo:block xsl:use-attribute-sets="table-name-style">
1488
- <xsl:apply-templates/>
1489
- </fo:block>
1657
+
1658
+ <xsl:apply-templates/>
1659
+ </fo:block>
1490
1660
  </xsl:if>
1491
1661
  </xsl:template><xsl:template name="calculate-columns-numbers">
1492
1662
  <xsl:param name="table-row"/>
@@ -1540,6 +1710,13 @@
1540
1710
  <xsl:for-each select="xalan:nodeset($table)//tr">
1541
1711
  <xsl:variable name="td_text">
1542
1712
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1713
+
1714
+ <!-- <xsl:if test="$namespace = 'bipm'">
1715
+ <xsl:for-each select="*[local-name()='td'][$curr-col]//*[local-name()='math']">
1716
+ <word><xsl:value-of select="normalize-space(.)"/></word>
1717
+ </xsl:for-each>
1718
+ </xsl:if> -->
1719
+
1543
1720
  </xsl:variable>
1544
1721
  <xsl:variable name="words">
1545
1722
  <xsl:variable name="string_with_added_zerospaces">
@@ -1599,13 +1776,31 @@
1599
1776
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
1600
1777
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1601
1778
  <xsl:value-of select="@target"/>
1779
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1780
+ <xsl:variable name="math_text" select="normalize-space(.)"/>
1781
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1602
1782
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1603
1783
  <xsl:param name="cols-count"/>
1604
1784
  <!-- font-weight="bold" -->
1605
- <fo:table-header>
1785
+ <fo:table-header>
1606
1786
 
1607
1787
  <xsl:apply-templates/>
1608
1788
  </fo:table-header>
1789
+ </xsl:template><xsl:template name="table-header-title">
1790
+ <xsl:param name="cols-count"/>
1791
+ <!-- row for title -->
1792
+ <fo:table-row>
1793
+ <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
1794
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
1795
+ <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1796
+ <xsl:call-template name="fn_name_display"/>
1797
+ </xsl:for-each>
1798
+ <fo:block text-align="right" font-style="italic">
1799
+ <xsl:text> </xsl:text>
1800
+ <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
1801
+ </fo:block>
1802
+ </fo:table-cell>
1803
+ </fo:table-row>
1609
1804
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
1610
1805
  <fo:table-body>
1611
1806
  <xsl:apply-templates/>
@@ -1613,6 +1808,13 @@
1613
1808
  </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
1614
1809
  <xsl:apply-templates/>
1615
1810
  </xsl:template><xsl:template name="insertTableFooter">
1811
+ <xsl:param name="cols-count"/>
1812
+ <xsl:if test="../*[local-name()='tfoot']">
1813
+ <fo:table-footer>
1814
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
1815
+ </fo:table-footer>
1816
+ </xsl:if>
1817
+ </xsl:template><xsl:template name="insertTableFooter2">
1616
1818
  <xsl:param name="cols-count"/>
1617
1819
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1618
1820
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
@@ -1634,11 +1836,15 @@
1634
1836
  <!-- fn will be processed inside 'note' processing -->
1635
1837
 
1636
1838
 
1637
- <!-- except gb -->
1839
+
1840
+ <!-- except gb and bipm -->
1638
1841
 
1639
1842
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1640
1843
 
1641
1844
 
1845
+
1846
+
1847
+
1642
1848
  <!-- horizontal row separator -->
1643
1849
 
1644
1850
 
@@ -1652,6 +1858,84 @@
1652
1858
  </fo:table-footer>
1653
1859
 
1654
1860
  </xsl:if>
1861
+ </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1862
+ <xsl:param name="table_attributes"/>
1863
+ <xsl:param name="colwidths"/>
1864
+
1865
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1866
+
1867
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1868
+
1869
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1870
+
1871
+ <fo:table keep-with-previous="always">
1872
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1873
+ <xsl:choose>
1874
+ <xsl:when test="@name = 'border-top'">
1875
+ <xsl:attribute name="{@name}">0pt solid black</xsl:attribute>
1876
+ </xsl:when>
1877
+ <xsl:when test="@name = 'border'">
1878
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
1879
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
1880
+ </xsl:when>
1881
+ <xsl:otherwise>
1882
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
1883
+ </xsl:otherwise>
1884
+ </xsl:choose>
1885
+ </xsl:for-each>
1886
+
1887
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1888
+ <xsl:choose>
1889
+ <xsl:when test=". = 1 or . = 0">
1890
+ <fo:table-column column-width="proportional-column-width(2)"/>
1891
+ </xsl:when>
1892
+ <xsl:otherwise>
1893
+ <fo:table-column column-width="proportional-column-width({.})"/>
1894
+ </xsl:otherwise>
1895
+ </xsl:choose>
1896
+ </xsl:for-each>
1897
+
1898
+ <fo:table-body>
1899
+ <fo:table-row>
1900
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
1901
+
1902
+
1903
+
1904
+ <!-- fn will be processed inside 'note' processing -->
1905
+
1906
+
1907
+
1908
+ <!-- except gb and bipm -->
1909
+
1910
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1911
+
1912
+
1913
+ <!-- <xsl:if test="$namespace = 'bipm'">
1914
+ <xsl:choose>
1915
+ <xsl:when test="ancestor::*[local-name()='preface']">
1916
+ show Note under table in preface (ex. abstract) sections
1917
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1918
+ </xsl:when>
1919
+ <xsl:otherwise>
1920
+ empty, because notes show at page side in main sections
1921
+ <fo:block/>
1922
+ </xsl:otherwise>
1923
+ </xsl:choose>
1924
+ </xsl:if> -->
1925
+
1926
+
1927
+ <!-- horizontal row separator -->
1928
+
1929
+
1930
+ <!-- fn processing -->
1931
+ <xsl:call-template name="fn_display"/>
1932
+
1933
+ </fo:table-cell>
1934
+ </fo:table-row>
1935
+ </fo:table-body>
1936
+
1937
+ </fo:table>
1938
+ </xsl:if>
1655
1939
  </xsl:template><xsl:template match="*[local-name()='tbody']">
1656
1940
 
1657
1941
  <xsl:variable name="cols-count">
@@ -1669,6 +1953,8 @@
1669
1953
  </xsl:choose>
1670
1954
  </xsl:variable>
1671
1955
 
1956
+
1957
+
1672
1958
  <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
1673
1959
  <xsl:with-param name="cols-count" select="$cols-count"/>
1674
1960
  </xsl:apply-templates>
@@ -1678,6 +1964,8 @@
1678
1964
  </xsl:call-template>
1679
1965
 
1680
1966
  <fo:table-body>
1967
+
1968
+
1681
1969
  <xsl:apply-templates/>
1682
1970
  <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
1683
1971
 
@@ -1701,10 +1989,23 @@
1701
1989
  </xsl:if>
1702
1990
 
1703
1991
 
1992
+
1993
+
1704
1994
  <xsl:apply-templates/>
1705
1995
  </fo:table-row>
1706
1996
  </xsl:template><xsl:template match="*[local-name()='th']">
1707
1997
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
1998
+ <xsl:attribute name="text-align">
1999
+ <xsl:choose>
2000
+ <xsl:when test="@align">
2001
+ <xsl:value-of select="@align"/>
2002
+ </xsl:when>
2003
+ <xsl:otherwise>center</xsl:otherwise>
2004
+ </xsl:choose>
2005
+ </xsl:attribute>
2006
+
2007
+
2008
+
1708
2009
 
1709
2010
 
1710
2011
 
@@ -1723,18 +2024,40 @@
1723
2024
  <xsl:value-of select="@rowspan"/>
1724
2025
  </xsl:attribute>
1725
2026
  </xsl:if>
2027
+ <xsl:call-template name="display-align"/>
1726
2028
  <fo:block>
1727
2029
  <xsl:apply-templates/>
1728
2030
  </fo:block>
1729
2031
  </fo:table-cell>
2032
+ </xsl:template><xsl:template name="display-align">
2033
+ <xsl:if test="@valign">
2034
+ <xsl:attribute name="display-align">
2035
+ <xsl:choose>
2036
+ <xsl:when test="@valign = 'top'">before</xsl:when>
2037
+ <xsl:when test="@valign = 'middle'">center</xsl:when>
2038
+ <xsl:when test="@valign = 'bottom'">after</xsl:when>
2039
+ <xsl:otherwise>before</xsl:otherwise>
2040
+ </xsl:choose>
2041
+ </xsl:attribute>
2042
+ </xsl:if>
1730
2043
  </xsl:template><xsl:template match="*[local-name()='td']">
1731
2044
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2045
+ <xsl:attribute name="text-align">
2046
+ <xsl:choose>
2047
+ <xsl:when test="@align">
2048
+ <xsl:value-of select="@align"/>
2049
+ </xsl:when>
2050
+ <xsl:otherwise>left</xsl:otherwise>
2051
+ </xsl:choose>
2052
+ </xsl:attribute>
1732
2053
  <!-- and ancestor::*[local-name() = 'thead'] -->
1733
2054
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
1734
2055
 
1735
2056
 
1736
2057
 
1737
-
2058
+
2059
+
2060
+
1738
2061
 
1739
2062
 
1740
2063
 
@@ -1750,8 +2073,8 @@
1750
2073
  <xsl:value-of select="@rowspan"/>
1751
2074
  </xsl:attribute>
1752
2075
  </xsl:if>
1753
- <fo:block>
1754
-
2076
+ <xsl:call-template name="display-align"/>
2077
+ <fo:block>
1755
2078
  <xsl:apply-templates/>
1756
2079
  </fo:block>
1757
2080
  </fo:table-cell>
@@ -1765,6 +2088,8 @@
1765
2088
 
1766
2089
  <xsl:attribute name="font-size">12pt</xsl:attribute>
1767
2090
 
2091
+
2092
+
1768
2093
  <fo:inline padding-right="2mm">
1769
2094
 
1770
2095
 
@@ -1772,10 +2097,11 @@
1772
2097
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
1773
2098
 
1774
2099
 
1775
-
2100
+
1776
2101
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
1777
2102
 
1778
2103
  </fo:inline>
2104
+
1779
2105
  <xsl:apply-templates mode="process"/>
1780
2106
  </fo:block>
1781
2107
 
@@ -1799,6 +2125,7 @@
1799
2125
 
1800
2126
 
1801
2127
 
2128
+
1802
2129
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
1803
2130
 
1804
2131
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -1808,12 +2135,15 @@
1808
2135
 
1809
2136
 
1810
2137
 
2138
+
1811
2139
  <xsl:value-of select="@reference"/>
1812
2140
 
2141
+
1813
2142
  </fo:inline>
1814
2143
  <fo:inline>
1815
2144
 
1816
- <xsl:apply-templates/>
2145
+ <!-- <xsl:apply-templates /> -->
2146
+ <xsl:copy-of select="./node()"/>
1817
2147
  </fo:inline>
1818
2148
  </fo:block>
1819
2149
  </xsl:if>
@@ -1850,13 +2180,26 @@
1850
2180
  <xsl:variable name="following_dl_colwidths">
1851
2181
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
1852
2182
  <xsl:variable name="html-table">
1853
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
1854
- <xsl:element name="{$ns}:table">
1855
- <xsl:for-each select="*[local-name() = 'dl'][1]">
1856
- <tbody>
1857
- <xsl:apply-templates mode="dl"/>
1858
- </tbody>
1859
- </xsl:for-each>
2183
+ <xsl:variable name="doc_ns">
2184
+
2185
+ </xsl:variable>
2186
+ <xsl:variable name="ns">
2187
+ <xsl:choose>
2188
+ <xsl:when test="normalize-space($doc_ns) != ''">
2189
+ <xsl:value-of select="normalize-space($doc_ns)"/>
2190
+ </xsl:when>
2191
+ <xsl:otherwise>
2192
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
2193
+ </xsl:otherwise>
2194
+ </xsl:choose>
2195
+ </xsl:variable>
2196
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2197
+ <xsl:element name="{$ns}:table">
2198
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2199
+ <tbody>
2200
+ <xsl:apply-templates mode="dl"/>
2201
+ </tbody>
2202
+ </xsl:for-each>
1860
2203
  </xsl:element>
1861
2204
  </xsl:variable>
1862
2205
 
@@ -1915,7 +2258,8 @@
1915
2258
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
1916
2259
  </xsl:if>
1917
2260
 
1918
- <xsl:apply-templates/>
2261
+ <!-- <xsl:apply-templates /> -->
2262
+ <xsl:copy-of select="./node()"/>
1919
2263
  </fo:block>
1920
2264
  </fo:table-cell>
1921
2265
  </fo:table-row>
@@ -1933,9 +2277,13 @@
1933
2277
 
1934
2278
 
1935
2279
 
2280
+
2281
+
1936
2282
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
1937
2283
 
2284
+
1938
2285
  <xsl:value-of select="@reference"/>
2286
+
1939
2287
  </fo:basic-link>
1940
2288
  </fo:inline>
1941
2289
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -1943,119 +2291,146 @@
1943
2291
  <xsl:apply-templates/>
1944
2292
  </fo:inline>
1945
2293
  </xsl:template><xsl:template match="*[local-name()='dl']">
1946
- <xsl:variable name="parent" select="local-name(..)"/>
1947
-
1948
- <xsl:variable name="key_iso">
1949
- <!-- and (not(../@class) or ../@class !='pseudocode') -->
1950
- </xsl:variable>
1951
-
1952
- <xsl:choose>
1953
- <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
1954
-
1955
-
1956
- <fo:block margin-bottom="12pt" text-align="left">
1957
-
1958
- <xsl:variable name="title-where">
1959
- <xsl:call-template name="getTitle">
1960
- <xsl:with-param name="name" select="'title-where'"/>
1961
- </xsl:call-template>
1962
- </xsl:variable>
1963
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
1964
- <xsl:apply-templates select="*[local-name()='dt']/*"/>
1965
- <xsl:text/>
1966
- <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
1967
- </fo:block>
1968
-
1969
- </xsl:when>
1970
- <xsl:when test="$parent = 'formula'"> <!-- a few components -->
1971
- <fo:block margin-bottom="12pt" text-align="left">
1972
-
1973
-
1974
-
1975
-
1976
- <xsl:variable name="title-where">
1977
- <xsl:call-template name="getTitle">
1978
- <xsl:with-param name="name" select="'title-where'"/>
1979
- </xsl:call-template>
1980
- </xsl:variable>
1981
- <xsl:value-of select="$title-where"/>
1982
- </fo:block>
1983
- </xsl:when>
1984
- <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
1985
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
1986
-
1987
-
1988
-
1989
- <xsl:variable name="title-key">
1990
- <xsl:call-template name="getTitle">
1991
- <xsl:with-param name="name" select="'title-key'"/>
1992
- </xsl:call-template>
1993
- </xsl:variable>
1994
- <xsl:value-of select="$title-key"/>
1995
- </fo:block>
1996
- </xsl:when>
1997
- </xsl:choose>
1998
-
1999
- <!-- a few components -->
2000
- <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2001
- <fo:block>
2002
-
2294
+ <fo:block-container margin-left="0mm">
2295
+ <xsl:if test="parent::*[local-name() = 'note']">
2296
+ <xsl:attribute name="margin-left">
2297
+ <xsl:choose>
2298
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
2299
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
2300
+ </xsl:choose>
2301
+ </xsl:attribute>
2003
2302
 
2303
+ </xsl:if>
2304
+ <fo:block-container margin-left="0mm">
2305
+
2306
+ <xsl:variable name="parent" select="local-name(..)"/>
2004
2307
 
2308
+ <xsl:variable name="key_iso">
2309
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2310
+ </xsl:variable>
2005
2311
 
2006
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
2312
+ <xsl:choose>
2313
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2314
+
2315
+
2316
+ <fo:block margin-bottom="12pt" text-align="left">
2317
+
2318
+ <xsl:variable name="title-where">
2319
+ <xsl:call-template name="getTitle">
2320
+ <xsl:with-param name="name" select="'title-where'"/>
2321
+ </xsl:call-template>
2322
+ </xsl:variable>
2323
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2324
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2325
+ <xsl:text/>
2326
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2327
+ </fo:block>
2328
+
2329
+ </xsl:when>
2330
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2331
+ <fo:block margin-bottom="12pt" text-align="left">
2332
+
2333
+
2334
+
2335
+
2336
+ <xsl:variable name="title-where">
2337
+ <xsl:call-template name="getTitle">
2338
+ <xsl:with-param name="name" select="'title-where'"/>
2339
+ </xsl:call-template>
2340
+ </xsl:variable>
2341
+ <xsl:value-of select="$title-where"/>
2342
+ </fo:block>
2343
+ </xsl:when>
2344
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2345
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2346
+
2347
+
2348
+
2349
+ <xsl:variable name="title-key">
2350
+ <xsl:call-template name="getTitle">
2351
+ <xsl:with-param name="name" select="'title-key'"/>
2352
+ </xsl:call-template>
2353
+ </xsl:variable>
2354
+ <xsl:value-of select="$title-key"/>
2355
+ </fo:block>
2356
+ </xsl:when>
2357
+ </xsl:choose>
2007
2358
 
2008
- <fo:block>
2009
-
2010
-
2011
-
2012
- <xsl:attribute name="margin-left">-3.5mm</xsl:attribute>
2013
-
2014
-
2015
- <fo:table width="95%" table-layout="fixed">
2359
+ <!-- a few components -->
2360
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2361
+ <fo:block>
2016
2362
 
2017
- <xsl:choose>
2018
- <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2019
- <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2020
- </xsl:when>
2021
- <xsl:when test="normalize-space($key_iso) = 'true'">
2022
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2363
+
2364
+
2365
+
2366
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
2367
+
2368
+ <fo:block>
2369
+
2370
+
2371
+
2372
+ <xsl:attribute name="margin-left">-3.5mm</xsl:attribute>
2373
+
2374
+
2375
+ <fo:table width="95%" table-layout="fixed">
2023
2376
 
2024
- </xsl:when>
2025
- </xsl:choose>
2026
- <!-- create virtual html table for dl/[dt and dd] -->
2027
- <xsl:variable name="html-table">
2028
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2029
- <xsl:element name="{$ns}:table">
2030
- <tbody>
2031
- <xsl:apply-templates mode="dl"/>
2032
- </tbody>
2033
- </xsl:element>
2034
- </xsl:variable>
2035
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
2036
- <xsl:variable name="colwidths">
2037
- <xsl:call-template name="calculate-column-widths">
2038
- <xsl:with-param name="cols-count" select="2"/>
2039
- <xsl:with-param name="table" select="$html-table"/>
2040
- </xsl:call-template>
2041
- </xsl:variable>
2042
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2043
- <xsl:variable name="maxlength_dt">
2044
- <xsl:call-template name="getMaxLength_dt"/>
2045
- </xsl:variable>
2046
- <xsl:call-template name="setColumnWidth_dl">
2047
- <xsl:with-param name="colwidths" select="$colwidths"/>
2048
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2049
- </xsl:call-template>
2050
- <fo:table-body>
2051
- <xsl:apply-templates>
2052
- <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2053
- </xsl:apply-templates>
2054
- </fo:table-body>
2055
- </fo:table>
2056
- </fo:block>
2057
- </fo:block>
2058
- </xsl:if>
2377
+ <xsl:choose>
2378
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2379
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2380
+ </xsl:when>
2381
+ <xsl:when test="normalize-space($key_iso) = 'true'">
2382
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2383
+
2384
+ </xsl:when>
2385
+ </xsl:choose>
2386
+ <!-- create virtual html table for dl/[dt and dd] -->
2387
+ <xsl:variable name="html-table">
2388
+ <xsl:variable name="doc_ns">
2389
+
2390
+ </xsl:variable>
2391
+ <xsl:variable name="ns">
2392
+ <xsl:choose>
2393
+ <xsl:when test="normalize-space($doc_ns) != ''">
2394
+ <xsl:value-of select="normalize-space($doc_ns)"/>
2395
+ </xsl:when>
2396
+ <xsl:otherwise>
2397
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
2398
+ </xsl:otherwise>
2399
+ </xsl:choose>
2400
+ </xsl:variable>
2401
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2402
+ <xsl:element name="{$ns}:table">
2403
+ <tbody>
2404
+ <xsl:apply-templates mode="dl"/>
2405
+ </tbody>
2406
+ </xsl:element>
2407
+ </xsl:variable>
2408
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2409
+ <xsl:variable name="colwidths">
2410
+ <xsl:call-template name="calculate-column-widths">
2411
+ <xsl:with-param name="cols-count" select="2"/>
2412
+ <xsl:with-param name="table" select="$html-table"/>
2413
+ </xsl:call-template>
2414
+ </xsl:variable>
2415
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2416
+ <xsl:variable name="maxlength_dt">
2417
+ <xsl:call-template name="getMaxLength_dt"/>
2418
+ </xsl:variable>
2419
+ <xsl:call-template name="setColumnWidth_dl">
2420
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2421
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2422
+ </xsl:call-template>
2423
+ <fo:table-body>
2424
+ <xsl:apply-templates>
2425
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2426
+ </xsl:apply-templates>
2427
+ </fo:table-body>
2428
+ </fo:table>
2429
+ </fo:block>
2430
+ </fo:block>
2431
+ </xsl:if>
2432
+ </fo:block-container>
2433
+ </fo:block-container>
2059
2434
  </xsl:template><xsl:template name="setColumnWidth_dl">
2060
2435
  <xsl:param name="colwidths"/>
2061
2436
  <xsl:param name="maxlength_dt"/>
@@ -2152,6 +2527,7 @@
2152
2527
  <xsl:param name="key_iso"/>
2153
2528
 
2154
2529
  <fo:table-row>
2530
+
2155
2531
  <fo:table-cell>
2156
2532
 
2157
2533
  <fo:block margin-top="6pt">
@@ -2169,6 +2545,7 @@
2169
2545
 
2170
2546
 
2171
2547
 
2548
+
2172
2549
  <xsl:apply-templates/>
2173
2550
  <!-- <xsl:if test="$namespace = 'gb'">
2174
2551
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -2180,14 +2557,36 @@
2180
2557
  <fo:table-cell>
2181
2558
  <fo:block>
2182
2559
 
2183
-
2560
+ <!-- <xsl:if test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
2561
+ <xsl:if test="local-name(*[1]) != 'stem'">
2562
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2563
+ </xsl:if>
2564
+ </xsl:if> -->
2184
2565
 
2185
2566
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2186
2567
 
2187
2568
  </fo:block>
2188
2569
  </fo:table-cell>
2189
2570
  </fo:table-row>
2190
-
2571
+ <!-- <xsl:if test="$namespace = 'nist-cswp' or $namespace = 'nist-sp'">
2572
+ <xsl:if test="local-name(*[1]) = 'stem'">
2573
+ <fo:table-row>
2574
+ <fo:table-cell>
2575
+ <fo:block margin-top="6pt">
2576
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2577
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2578
+ </xsl:if>
2579
+ <xsl:text>&#xA0;</xsl:text>
2580
+ </fo:block>
2581
+ </fo:table-cell>
2582
+ <fo:table-cell>
2583
+ <fo:block>
2584
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2585
+ </fo:block>
2586
+ </fo:table-cell>
2587
+ </fo:table-row>
2588
+ </xsl:if>
2589
+ </xsl:if> -->
2191
2590
  </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2192
2591
  <xsl:apply-templates/>
2193
2592
  </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
@@ -2212,6 +2611,31 @@
2212
2611
  </fo:inline>
2213
2612
  </xsl:template><xsl:template match="*[local-name()='tt']">
2214
2613
  <fo:inline xsl:use-attribute-sets="tt-style">
2614
+ <xsl:variable name="_font-size">
2615
+
2616
+
2617
+
2618
+
2619
+ 10
2620
+
2621
+
2622
+
2623
+
2624
+
2625
+
2626
+
2627
+
2628
+
2629
+ </xsl:variable>
2630
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
2631
+ <xsl:if test="$font-size != ''">
2632
+ <xsl:attribute name="font-size">
2633
+ <xsl:choose>
2634
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
2635
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
2636
+ </xsl:choose>
2637
+ </xsl:attribute>
2638
+ </xsl:if>
2215
2639
  <xsl:apply-templates/>
2216
2640
  </fo:inline>
2217
2641
  </xsl:template><xsl:template match="*[local-name()='del']">
@@ -2537,11 +2961,24 @@
2537
2961
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2538
2962
  <xsl:value-of select="substring($str, 2)"/>
2539
2963
  </xsl:template><xsl:template match="mathml:math">
2540
- <fo:inline font-family="STIX2Math">
2541
- <fo:instream-foreign-object fox:alt-text="Math">
2542
- <xsl:copy-of select="."/>
2543
- </fo:instream-foreign-object>
2964
+ <fo:inline font-family="STIX Two Math"> <!-- -->
2965
+ <xsl:variable name="mathml">
2966
+ <xsl:apply-templates select="." mode="mathml"/>
2967
+ </xsl:variable>
2968
+ <fo:instream-foreign-object fox:alt-text="Math">
2969
+ <!-- <xsl:copy-of select="."/> -->
2970
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
2971
+ </fo:instream-foreign-object>
2544
2972
  </fo:inline>
2973
+ </xsl:template><xsl:template match="@*|node()" mode="mathml">
2974
+ <xsl:copy>
2975
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
2976
+ </xsl:copy>
2977
+ </xsl:template><xsl:template match="mathml:mtext" mode="mathml">
2978
+ <xsl:copy>
2979
+ <!-- replace start and end spaces to non-break space -->
2980
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
2981
+ </xsl:copy>
2545
2982
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
2546
2983
  <xsl:variable name="target">
2547
2984
  <xsl:choose>
@@ -2618,13 +3055,26 @@
2618
3055
  <xsl:apply-templates/>
2619
3056
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
2620
3057
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2621
-
3058
+
2622
3059
  <xsl:apply-templates/>
2623
3060
  </fo:basic-link>
2624
3061
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
2625
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
2626
- <xsl:apply-templates/>
2627
- </fo:block>
3062
+ <fo:block-container margin-left="0mm">
3063
+ <xsl:if test="parent::*[local-name() = 'note']">
3064
+ <xsl:attribute name="margin-left">
3065
+ <xsl:choose>
3066
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3067
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3068
+ </xsl:choose>
3069
+ </xsl:attribute>
3070
+
3071
+ </xsl:if>
3072
+ <fo:block-container margin-left="0mm">
3073
+ <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
3074
+ <xsl:apply-templates/>
3075
+ </fo:block>
3076
+ </fo:block-container>
3077
+ </fo:block-container>
2628
3078
  </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'dt']/*[local-name() = 'stem']">
2629
3079
  <fo:inline>
2630
3080
  <xsl:apply-templates/>
@@ -2688,7 +3138,9 @@
2688
3138
  </xsl:choose>
2689
3139
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
2690
3140
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
2691
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3141
+ <fo:inline xsl:use-attribute-sets="termnote-name-style">
3142
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3143
+ </fo:inline>
2692
3144
  <xsl:apply-templates/>
2693
3145
  </fo:block>
2694
3146
  </xsl:template><xsl:template match="*[local-name() = 'note']/*[local-name() = 'name'] | *[local-name() = 'termnote']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']" mode="presentation">
@@ -2783,15 +3235,109 @@
2783
3235
 
2784
3236
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
2785
3237
  </fo:block>
2786
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
3238
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
2787
3239
  <xsl:apply-templates mode="contents"/>
2788
3240
  <xsl:text> </xsl:text>
2789
- </xsl:template><xsl:template match="text()" mode="contents">
3241
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
3242
+ <xsl:apply-templates mode="bookmarks"/>
3243
+ <xsl:text> </xsl:text>
3244
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3245
+ <xsl:value-of select="."/>
3246
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
2790
3247
  <xsl:value-of select="."/>
2791
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3248
+ </xsl:template><xsl:template match="node()" mode="contents">
3249
+ <xsl:apply-templates mode="contents"/>
3250
+ </xsl:template><xsl:template match="node()" mode="bookmarks">
3251
+ <xsl:apply-templates mode="bookmarks"/>
3252
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3253
+ <xsl:apply-templates select="."/>
3254
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3255
+ <xsl:apply-templates mode="bookmarks"/>
3256
+ </xsl:template><xsl:template name="addBookmarks">
3257
+ <xsl:param name="contents"/>
3258
+ <xsl:if test="xalan:nodeset($contents)//item">
3259
+ <fo:bookmark-tree>
3260
+ <xsl:choose>
3261
+ <xsl:when test="xalan:nodeset($contents)/doc">
3262
+ <xsl:choose>
3263
+ <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3264
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3265
+ <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3266
+ <fo:bookmark-title>
3267
+ <xsl:variable name="bookmark-title_">
3268
+ <xsl:call-template name="getLangVersion">
3269
+ <xsl:with-param name="lang" select="@lang"/>
3270
+ </xsl:call-template>
3271
+ </xsl:variable>
3272
+ <xsl:choose>
3273
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3274
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3275
+ </xsl:when>
3276
+ <xsl:otherwise>
3277
+ <xsl:choose>
3278
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3279
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3280
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3281
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3282
+ </xsl:choose>
3283
+ </xsl:otherwise>
3284
+ </xsl:choose>
3285
+ </fo:bookmark-title>
3286
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3287
+ </fo:bookmark>
3288
+
3289
+ </xsl:for-each>
3290
+ </xsl:when>
3291
+ <xsl:otherwise>
3292
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3293
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3294
+ </xsl:for-each>
3295
+ </xsl:otherwise>
3296
+ </xsl:choose>
3297
+ </xsl:when>
3298
+ <xsl:otherwise>
3299
+ <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
3300
+ </xsl:otherwise>
3301
+ </xsl:choose>
3302
+
3303
+
3304
+
3305
+
3306
+
3307
+
3308
+
3309
+
3310
+ </fo:bookmark-tree>
3311
+ </xsl:if>
3312
+ </xsl:template><xsl:template name="getLangVersion">
3313
+ <xsl:param name="lang"/>
3314
+ <xsl:choose>
3315
+ <xsl:when test="$lang = 'en'">
3316
+
3317
+
3318
+ </xsl:when>
3319
+ <xsl:when test="$lang = 'fr'">
3320
+
3321
+
3322
+ </xsl:when>
3323
+ <xsl:when test="$lang = 'de'">Deutsche</xsl:when>
3324
+ <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3325
+ </xsl:choose>
3326
+ </xsl:template><xsl:template match="item" mode="bookmark">
3327
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
3328
+ <fo:bookmark-title>
3329
+ <xsl:if test="@section != ''">
3330
+ <xsl:value-of select="@section"/>
3331
+ <xsl:text> </xsl:text>
3332
+ </xsl:if>
3333
+ <xsl:value-of select="normalize-space(title)"/>
3334
+ </fo:bookmark-title>
3335
+ <xsl:apply-templates mode="bookmark"/>
3336
+ </fo:bookmark>
3337
+ </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
2792
3338
  <xsl:if test="normalize-space() != ''">
2793
3339
  <fo:block xsl:use-attribute-sets="figure-name-style">
2794
-
3340
+
2795
3341
  <xsl:apply-templates/>
2796
3342
  </fo:block>
2797
3343
  </xsl:if>
@@ -2846,7 +3392,7 @@
2846
3392
  <xsl:apply-templates/>
2847
3393
  </xsl:otherwise>
2848
3394
  </xsl:choose>
2849
- </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
3395
+ </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
2850
3396
  <xsl:text> </xsl:text>
2851
3397
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
2852
3398
  <xsl:copy>
@@ -2855,21 +3401,61 @@
2855
3401
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
2856
3402
  <xsl:text> </xsl:text>
2857
3403
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
2858
- <fo:block xsl:use-attribute-sets="sourcecode-style">
2859
- <xsl:apply-templates/>
2860
- </fo:block>
2861
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2862
- </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()">
3404
+
3405
+ <fo:block-container margin-left="0mm">
3406
+ <xsl:if test="parent::*[local-name() = 'note']">
3407
+ <xsl:attribute name="margin-left">
3408
+ <xsl:choose>
3409
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3410
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3411
+ </xsl:choose>
3412
+ </xsl:attribute>
3413
+
3414
+ </xsl:if>
3415
+ <fo:block-container margin-left="0mm">
3416
+
3417
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3418
+ <xsl:variable name="_font-size">
3419
+
3420
+
3421
+
3422
+
3423
+ 10
3424
+
3425
+
3426
+
3427
+
3428
+
3429
+
3430
+
3431
+
3432
+
3433
+ </xsl:variable>
3434
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
3435
+ <xsl:if test="$font-size != ''">
3436
+ <xsl:attribute name="font-size">
3437
+ <xsl:choose>
3438
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3439
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3440
+ </xsl:choose>
3441
+ </xsl:attribute>
3442
+ </xsl:if>
3443
+ <xsl:apply-templates/>
3444
+ </fo:block>
3445
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3446
+
3447
+ </fo:block-container>
3448
+ </fo:block-container>
3449
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
2863
3450
  <xsl:variable name="text">
2864
3451
  <xsl:call-template name="add-zero-spaces-equal"/>
2865
3452
  </xsl:variable>
2866
- <xsl:call-template name="add-zero-spaces">
3453
+ <xsl:call-template name="add-zero-spaces-java">
2867
3454
  <xsl:with-param name="text" select="$text"/>
2868
3455
  </xsl:call-template>
2869
3456
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="presentation">
2870
3457
  <xsl:if test="normalize-space() != ''">
2871
- <fo:block xsl:use-attribute-sets="sourcecode-name-style">
2872
-
3458
+ <fo:block xsl:use-attribute-sets="sourcecode-name-style">
2873
3459
  <xsl:apply-templates/>
2874
3460
  </fo:block>
2875
3461
  </xsl:if>
@@ -2937,6 +3523,145 @@
2937
3523
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
2938
3524
  <xsl:apply-templates/>
2939
3525
  </fo:block>
3526
+ </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3527
+ <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
3528
+ <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3529
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
3530
+ </xsl:if>
3531
+ <fo:block-container margin-left="0mm" margin-right="0mm">
3532
+ <fo:table id="{@id}" table-layout="fixed" width="100%"> <!-- border="1pt solid black" -->
3533
+ <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3534
+ <!-- <xsl:attribute name="border">0.5pt solid black</xsl:attribute> -->
3535
+ </xsl:if>
3536
+ <xsl:variable name="simple-table">
3537
+ <xsl:call-template name="getSimpleTable"/>
3538
+ </xsl:variable>
3539
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3540
+ <xsl:if test="$cols-count = 2 and not(ancestor::*[local-name()='table'])">
3541
+ <!-- <fo:table-column column-width="35mm"/>
3542
+ <fo:table-column column-width="115mm"/> -->
3543
+ <fo:table-column column-width="30%"/>
3544
+ <fo:table-column column-width="70%"/>
3545
+ </xsl:if>
3546
+ <xsl:apply-templates mode="requirement"/>
3547
+ </fo:table>
3548
+ <!-- fn processing -->
3549
+ <xsl:if test=".//*[local-name() = 'fn']">
3550
+ <xsl:for-each select="*[local-name() = 'tbody']">
3551
+ <fo:block font-size="90%" border-bottom="1pt solid black">
3552
+ <xsl:call-template name="fn_display"/>
3553
+ </fo:block>
3554
+ </xsl:for-each>
3555
+ </xsl:if>
3556
+ </fo:block-container>
3557
+ </fo:block-container>
3558
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="requirement">
3559
+ <fo:table-header>
3560
+ <xsl:apply-templates mode="requirement"/>
3561
+ </fo:table-header>
3562
+ </xsl:template><xsl:template match="*[local-name()='tbody']" mode="requirement">
3563
+ <fo:table-body>
3564
+ <xsl:apply-templates mode="requirement"/>
3565
+ </fo:table-body>
3566
+ </xsl:template><xsl:template match="*[local-name()='tr']" mode="requirement">
3567
+ <fo:table-row height="7mm" border-bottom="0.5pt solid grey">
3568
+ <xsl:if test="parent::*[local-name()='thead']"> <!-- and not(ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']) -->
3569
+ <!-- <xsl:attribute name="border">1pt solid black</xsl:attribute> -->
3570
+ <xsl:attribute name="background-color">rgb(33, 55, 92)</xsl:attribute>
3571
+ </xsl:if>
3572
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Requirement ')">
3573
+ <xsl:attribute name="background-color">rgb(252, 246, 222)</xsl:attribute>
3574
+ </xsl:if>
3575
+ <xsl:if test="starts-with(*[local-name()='td'][1], 'Recommendation ')">
3576
+ <xsl:attribute name="background-color">rgb(233, 235, 239)</xsl:attribute>
3577
+ </xsl:if>
3578
+ <xsl:apply-templates mode="requirement"/>
3579
+ </fo:table-row>
3580
+ </xsl:template><xsl:template match="*[local-name()='th']" mode="requirement">
3581
+ <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" -->
3582
+ <xsl:attribute name="text-align">
3583
+ <xsl:choose>
3584
+ <xsl:when test="@align">
3585
+ <xsl:value-of select="@align"/>
3586
+ </xsl:when>
3587
+ <xsl:otherwise>left</xsl:otherwise>
3588
+ </xsl:choose>
3589
+ </xsl:attribute>
3590
+ <xsl:if test="@colspan">
3591
+ <xsl:attribute name="number-columns-spanned">
3592
+ <xsl:value-of select="@colspan"/>
3593
+ </xsl:attribute>
3594
+ </xsl:if>
3595
+ <xsl:if test="@rowspan">
3596
+ <xsl:attribute name="number-rows-spanned">
3597
+ <xsl:value-of select="@rowspan"/>
3598
+ </xsl:attribute>
3599
+ </xsl:if>
3600
+ <xsl:call-template name="display-align"/>
3601
+
3602
+ <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3603
+ <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3604
+ <xsl:attribute name="background-color">rgb(165, 165, 165)</xsl:attribute>
3605
+ </xsl:if>
3606
+ <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommendtest'">
3607
+ <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3608
+ <xsl:attribute name="background-color">rgb(201, 201, 201)</xsl:attribute>
3609
+ </xsl:if> -->
3610
+
3611
+ <fo:block>
3612
+ <xsl:apply-templates/>
3613
+ </fo:block>
3614
+ </fo:table-cell>
3615
+ </xsl:template><xsl:template match="*[local-name()='td']" mode="requirement">
3616
+ <fo:table-cell text-align="{@align}" display-align="center" padding="1mm" padding-left="2mm"> <!-- border="0.5pt solid black" -->
3617
+ <xsl:if test="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
3618
+ <xsl:attribute name="padding">0mm</xsl:attribute>
3619
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
3620
+ </xsl:if>
3621
+ <xsl:attribute name="text-align">
3622
+ <xsl:choose>
3623
+ <xsl:when test="@align">
3624
+ <xsl:value-of select="@align"/>
3625
+ </xsl:when>
3626
+ <xsl:otherwise>left</xsl:otherwise>
3627
+ </xsl:choose>
3628
+ </xsl:attribute>
3629
+ <xsl:if test="following-sibling::*[local-name()='td'] and not(preceding-sibling::*[local-name()='td'])">
3630
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3631
+ </xsl:if>
3632
+ <xsl:if test="@colspan">
3633
+ <xsl:attribute name="number-columns-spanned">
3634
+ <xsl:value-of select="@colspan"/>
3635
+ </xsl:attribute>
3636
+ </xsl:if>
3637
+ <xsl:if test="@rowspan">
3638
+ <xsl:attribute name="number-rows-spanned">
3639
+ <xsl:value-of select="@rowspan"/>
3640
+ </xsl:attribute>
3641
+ </xsl:if>
3642
+ <xsl:call-template name="display-align"/>
3643
+
3644
+ <!-- <xsl:if test="ancestor::*[local-name()='table']/@type = 'recommend'">
3645
+ <xsl:attribute name="padding-left">0.5mm</xsl:attribute>
3646
+ <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3647
+ <xsl:if test="parent::*[local-name()='tr']/preceding-sibling::*[local-name()='tr'] and not(*[local-name()='table'])">
3648
+ <xsl:attribute name="background-color">rgb(201, 201, 201)</xsl:attribute>
3649
+ </xsl:if>
3650
+ </xsl:if> -->
3651
+ <!-- 2nd line and below -->
3652
+
3653
+ <fo:block>
3654
+ <xsl:apply-templates/>
3655
+ </fo:block>
3656
+ </fo:table-cell>
3657
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@class='RecommendationTitle' or @class = 'RecommendationTestTitle']" priority="2">
3658
+ <fo:block font-size="11pt" color="rgb(237, 193, 35)"> <!-- font-weight="bold" margin-bottom="4pt" text-align="center" -->
3659
+ <xsl:apply-templates/>
3660
+ </fo:block>
3661
+ </xsl:template><xsl:template match="*[local-name() = 'p2'][ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']]">
3662
+ <fo:block> <!-- margin-bottom="10pt" -->
3663
+ <xsl:apply-templates/>
3664
+ </fo:block>
2940
3665
  </xsl:template><xsl:template match="*[local-name() = 'termexample']">
2941
3666
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
2942
3667
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -2956,12 +3681,13 @@
2956
3681
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2957
3682
 
2958
3683
  <xsl:variable name="element">
2959
- block
3684
+ block
2960
3685
 
3686
+ <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
2961
3687
  </xsl:variable>
2962
3688
 
2963
3689
  <xsl:choose>
2964
- <xsl:when test="normalize-space($element) = 'block'">
3690
+ <xsl:when test="contains(normalize-space($element), 'block')">
2965
3691
  <fo:block xsl:use-attribute-sets="example-body-style">
2966
3692
  <xsl:apply-templates/>
2967
3693
  </fo:block>
@@ -2998,25 +3724,44 @@
2998
3724
  </xsl:otherwise>
2999
3725
  </xsl:choose>
3000
3726
 
3001
- </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3002
- <fo:block xsl:use-attribute-sets="example-p-style">
3727
+ </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3728
+
3729
+ <xsl:variable name="element">
3730
+ block
3003
3731
 
3004
- <xsl:apply-templates/>
3005
- </fo:block>
3732
+ </xsl:variable>
3733
+ <xsl:choose>
3734
+ <xsl:when test="normalize-space($element) = 'block'">
3735
+ <fo:block xsl:use-attribute-sets="example-p-style">
3736
+
3737
+ <xsl:apply-templates/>
3738
+ </fo:block>
3739
+ </xsl:when>
3740
+ <xsl:otherwise>
3741
+ <fo:inline xsl:use-attribute-sets="example-p-style">
3742
+ <xsl:apply-templates/>
3743
+ </fo:inline>
3744
+ </xsl:otherwise>
3745
+ </xsl:choose>
3006
3746
  </xsl:template><xsl:template match="*[local-name() = 'termsource']">
3007
3747
  <fo:block xsl:use-attribute-sets="termsource-style">
3008
3748
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
3009
3749
  <xsl:variable name="termsource_text">
3010
3750
  <xsl:apply-templates/>
3011
3751
  </xsl:variable>
3752
+
3012
3753
  <xsl:choose>
3013
3754
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
3014
3755
  <xsl:apply-templates/>
3015
3756
  </xsl:when>
3016
- <xsl:otherwise>
3017
- <xsl:text>[</xsl:text>
3018
- <xsl:apply-templates/>
3019
- <xsl:text>]</xsl:text>
3757
+ <xsl:otherwise>
3758
+
3759
+ <xsl:text>[</xsl:text>
3760
+
3761
+ <xsl:apply-templates/>
3762
+
3763
+ <xsl:text>]</xsl:text>
3764
+
3020
3765
  </xsl:otherwise>
3021
3766
  </xsl:choose>
3022
3767
  </fo:block>
@@ -3027,10 +3772,13 @@
3027
3772
  </xsl:template><xsl:template match="*[local-name() = 'origin']">
3028
3773
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3029
3774
 
3030
- <xsl:call-template name="getTitle">
3031
- <xsl:with-param name="name" select="'title-source'"/>
3032
- </xsl:call-template>
3033
- <xsl:text>: </xsl:text>
3775
+ <fo:inline>
3776
+
3777
+ <xsl:call-template name="getTitle">
3778
+ <xsl:with-param name="name" select="'title-source'"/>
3779
+ </xsl:call-template>
3780
+ <xsl:text>: </xsl:text>
3781
+ </fo:inline>
3034
3782
 
3035
3783
  <fo:inline xsl:use-attribute-sets="origin-style">
3036
3784
  <xsl:apply-templates/>
@@ -3042,18 +3790,29 @@
3042
3790
  <xsl:if test="normalize-space() != ''">
3043
3791
  <xsl:value-of select="."/>
3044
3792
  </xsl:if>
3045
- </xsl:template><xsl:template match="*[local-name() = 'quote']">
3793
+ </xsl:template><xsl:template match="*[local-name() = 'quote']">
3794
+ <fo:block-container margin-left="0mm">
3795
+ <xsl:if test="parent::*[local-name() = 'note']">
3796
+ <xsl:if test="not(ancestor::*[local-name() = 'table'])">
3797
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
3798
+ </xsl:if>
3799
+ </xsl:if>
3800
+
3801
+ <fo:block-container margin-left="0mm">
3046
3802
 
3047
- <fo:block xsl:use-attribute-sets="quote-style">
3048
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3049
- </fo:block>
3050
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3051
- <fo:block xsl:use-attribute-sets="quote-source-style">
3052
- <!-- — ISO, ISO 7301:2011, Clause 1 -->
3053
- <xsl:apply-templates select="*[local-name() = 'author']"/>
3054
- <xsl:apply-templates select="*[local-name() = 'source']"/>
3055
- </fo:block>
3056
- </xsl:if>
3803
+ <fo:block xsl:use-attribute-sets="quote-style">
3804
+ <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3805
+ </fo:block>
3806
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3807
+ <fo:block xsl:use-attribute-sets="quote-source-style">
3808
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
3809
+ <xsl:apply-templates select="*[local-name() = 'author']"/>
3810
+ <xsl:apply-templates select="*[local-name() = 'source']"/>
3811
+ </fo:block>
3812
+ </xsl:if>
3813
+
3814
+ </fo:block-container>
3815
+ </fo:block-container>
3057
3816
  </xsl:template><xsl:template match="*[local-name() = 'source']">
3058
3817
  <xsl:if test="../*[local-name() = 'author']">
3059
3818
  <xsl:text>, </xsl:text>
@@ -3084,6 +3843,7 @@
3084
3843
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
3085
3844
 
3086
3845
 
3846
+
3087
3847
  </xsl:if>
3088
3848
 
3089
3849
 
@@ -3122,6 +3882,7 @@
3122
3882
 
3123
3883
 
3124
3884
 
3885
+
3125
3886
  </xsl:variable>
3126
3887
 
3127
3888
  <xsl:variable name="padding-right">
@@ -3212,13 +3973,14 @@
3212
3973
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
3213
3974
  <fo:block>
3214
3975
  <xsl:call-template name="setId"/>
3976
+
3215
3977
  <xsl:apply-templates/>
3216
3978
  </fo:block>
3217
3979
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
3218
3980
  <fo:block id="{@id}">
3219
3981
  <xsl:apply-templates/>
3220
3982
  </fo:block>
3221
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@id = '_normative_references' or @id = '_references']">
3983
+ </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
3222
3984
 
3223
3985
  <fo:block id="{@id}">
3224
3986
  <xsl:apply-templates/>
@@ -3236,6 +3998,31 @@
3236
3998
  </xsl:template><xsl:template match="*[local-name() = 'name']/text()">
3237
3999
  <!-- 0xA0 to space replacement -->
3238
4000
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4001
+ </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4002
+ <xsl:choose>
4003
+ <xsl:when test="parent::*[local-name() = 'note']">
4004
+ <fo:block-container>
4005
+ <xsl:attribute name="margin-left">
4006
+ <xsl:choose>
4007
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
4008
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
4009
+ </xsl:choose>
4010
+ </xsl:attribute>
4011
+
4012
+
4013
+ <fo:block-container margin-left="0mm">
4014
+ <fo:block>
4015
+ <xsl:apply-templates select="." mode="ul_ol"/>
4016
+ </fo:block>
4017
+ </fo:block-container>
4018
+ </fo:block-container>
4019
+ </xsl:when>
4020
+ <xsl:otherwise>
4021
+ <fo:block>
4022
+ <xsl:apply-templates select="." mode="ul_ol"/>
4023
+ </fo:block>
4024
+ </xsl:otherwise>
4025
+ </xsl:choose>
3239
4026
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
3240
4027
  <!-- <row>
3241
4028
  <date>05-07-2013</date>
@@ -3267,6 +4054,164 @@
3267
4054
  <fo:table-cell border="1pt solid black" padding-left="1mm" padding-top="0.5mm">
3268
4055
  <fo:block><xsl:apply-templates/></fo:block>
3269
4056
  </fo:table-cell>
4057
+ </xsl:template><xsl:template name="processBibitem">
4058
+
4059
+
4060
+
4061
+
4062
+ <!-- start IHO bibtem processing -->
4063
+ <xsl:choose>
4064
+ <xsl:when test="iho:formattedref">
4065
+ <xsl:apply-templates select="iho:formattedref"/>
4066
+ </xsl:when>
4067
+ <xsl:otherwise>
4068
+ <xsl:choose>
4069
+ <!-- IHO documents -->
4070
+ <!-- {docID} edition {edition}: {title}, {author/organization} -->
4071
+ <xsl:when test="iho:docidentifier[1]/@type='IHO'">
4072
+ <xsl:value-of select="iho:docidentifier[1]"/>
4073
+ <xsl:apply-templates select="iho:edition"/>
4074
+ <xsl:if test="iho:title or iho:contributor or iho:url">
4075
+ <xsl:text>: </xsl:text>
4076
+ </xsl:if>
4077
+ </xsl:when>
4078
+
4079
+ <!-- Non-IHO documents -->
4080
+ <!-- title and publisher -->
4081
+ <xsl:otherwise>
4082
+ <xsl:variable name="docID">
4083
+ <xsl:call-template name="processBibitemDocId"/>
4084
+ </xsl:variable>
4085
+ <xsl:value-of select="normalize-space($docID)"/>
4086
+ <xsl:if test="normalize-space($docID) != ''"><xsl:text>: </xsl:text></xsl:if>
4087
+ </xsl:otherwise>
4088
+ </xsl:choose>
4089
+
4090
+ <xsl:choose>
4091
+ <xsl:when test="iho:title[@type = 'main' and @language = 'en']">
4092
+ <xsl:apply-templates select="iho:title[@type = 'main' and @language = 'en']"/>
4093
+ </xsl:when>
4094
+ <xsl:otherwise>
4095
+ <xsl:apply-templates select="iho:title"/>
4096
+ </xsl:otherwise>
4097
+ </xsl:choose>
4098
+
4099
+ <xsl:if test="iho:title and iho:contributor">
4100
+ <xsl:text>, </xsl:text>
4101
+ </xsl:if>
4102
+
4103
+ <xsl:variable name="authors">
4104
+ <xsl:choose>
4105
+ <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4106
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4107
+ <xsl:copy-of select="."/>
4108
+ </xsl:for-each>
4109
+ </xsl:when>
4110
+ <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']">
4111
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='editor']">
4112
+ <xsl:copy-of select="."/>
4113
+ </xsl:for-each>
4114
+ </xsl:when>
4115
+ <xsl:when test="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='publisher'][*[local-name() = 'organization']]">
4116
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='publisher'][*[local-name() = 'organization']]">
4117
+ <xsl:copy>
4118
+ <xsl:choose>
4119
+ <xsl:when test="position() != 1 and position() != last()">, </xsl:when>
4120
+ <xsl:when test="position() != 1 and position() = last()"> and </xsl:when>
4121
+ </xsl:choose>
4122
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4123
+ </xsl:copy>
4124
+ </xsl:for-each>
4125
+ </xsl:when>
4126
+ </xsl:choose>
4127
+ </xsl:variable>
4128
+
4129
+ <xsl:for-each select="xalan:nodeset($authors)/*">
4130
+ <xsl:choose>
4131
+ <xsl:when test="not(*[local-name() = 'role'])"><!-- publisher organisation -->
4132
+ <xsl:value-of select="."/>
4133
+ </xsl:when>
4134
+ <xsl:otherwise> <!-- author, editor -->
4135
+ <xsl:choose>
4136
+ <xsl:when test="*[local-name() = 'organization']/*[local-name() = 'name']">
4137
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4138
+ </xsl:when>
4139
+ <xsl:otherwise>
4140
+ <xsl:for-each select="*[local-name() = 'person']">
4141
+ <xsl:variable name="author">
4142
+ <xsl:call-template name="processPersonalAuthor"/>
4143
+ </xsl:variable>
4144
+ <xsl:value-of select="xalan:nodeset($author)/author"/>
4145
+ </xsl:for-each>
4146
+ </xsl:otherwise>
4147
+ </xsl:choose>
4148
+ </xsl:otherwise>
4149
+ </xsl:choose>
4150
+ <xsl:if test="*[local-name() = 'organization']/*[local-name() = 'name'] and position() != last()">
4151
+ <xsl:text>, </xsl:text>
4152
+ </xsl:if>
4153
+ </xsl:for-each>
4154
+
4155
+ <xsl:apply-templates select="*[local-name() = 'uri'][1]"/>
4156
+
4157
+ </xsl:otherwise>
4158
+ </xsl:choose>
4159
+ <!-- end IHO bibitem processing -->
4160
+
4161
+ </xsl:template><xsl:template name="processBibitemDocId">
4162
+ <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
4163
+ <xsl:choose>
4164
+ <xsl:when test="normalize-space($_doc_ident) != ''">
4165
+ <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
4166
+ <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4167
+ <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4168
+ </xsl:if>
4169
+ <xsl:value-of select="$_doc_ident"/>
4170
+ </xsl:when>
4171
+ <xsl:otherwise>
4172
+ <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4173
+ <xsl:if test="$type != ''">
4174
+ <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4175
+ </xsl:if>
4176
+ <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4177
+ </xsl:otherwise>
4178
+ </xsl:choose>
4179
+ </xsl:template><xsl:template name="processPersonalAuthor">
4180
+ <xsl:choose>
4181
+ <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
4182
+ <author>
4183
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
4184
+ </author>
4185
+ </xsl:when>
4186
+ <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
4187
+ <author>
4188
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
4189
+ <xsl:text> </xsl:text>
4190
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
4191
+ </author>
4192
+ </xsl:when>
4193
+ <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
4194
+ <author>
4195
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
4196
+ <xsl:text> </xsl:text>
4197
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
4198
+ </author>
4199
+ </xsl:when>
4200
+ <xsl:otherwise>
4201
+ <xsl:apply-templates/>
4202
+ </xsl:otherwise>
4203
+ </xsl:choose>
4204
+ </xsl:template><xsl:template name="renderDate">
4205
+ <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
4206
+ <xsl:value-of select="*[local-name() = 'on']"/>
4207
+ </xsl:if>
4208
+ <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
4209
+ <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
4210
+ </xsl:if>
4211
+ </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
4212
+ <xsl:value-of select="translate(.,'. ','')"/>
4213
+ </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4214
+ <xsl:value-of select="substring(.,1,1)"/>
3270
4215
  </xsl:template><xsl:template name="convertDate">
3271
4216
  <xsl:param name="date"/>
3272
4217
  <xsl:param name="format" select="'short'"/>
@@ -3345,6 +4290,7 @@
3345
4290
  <dc:title>
3346
4291
  <xsl:variable name="title">
3347
4292
 
4293
+
3348
4294
 
3349
4295
  <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
3350
4296
 
@@ -3365,6 +4311,7 @@
3365
4311
  <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
3366
4312
 
3367
4313
 
4314
+
3368
4315
  </dc:creator>
3369
4316
  <dc:description>
3370
4317
  <xsl:variable name="abstract">
@@ -3374,6 +4321,7 @@
3374
4321
 
3375
4322
 
3376
4323
 
4324
+
3377
4325
  </xsl:variable>
3378
4326
  <xsl:value-of select="normalize-space($abstract)"/>
3379
4327
  </dc:description>
@@ -3472,7 +4420,9 @@
3472
4420
 
3473
4421
  <xsl:value-of select="document('')//*/namespace::iho"/>
3474
4422
 
3475
-
4423
+
4424
+
4425
+
3476
4426
  </xsl:variable>
3477
4427
  <xsl:if test="$documentNS != $XSLNS">
3478
4428
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -3498,4 +4448,21 @@
3498
4448
  </xsl:otherwise>
3499
4449
  </xsl:choose>
3500
4450
  </xsl:attribute>
4451
+ </xsl:template><xsl:template name="add-letter-spacing">
4452
+ <xsl:param name="text"/>
4453
+ <xsl:param name="letter-spacing" select="'0.15'"/>
4454
+ <xsl:if test="string-length($text) &gt; 0">
4455
+ <xsl:variable name="char" select="substring($text, 1, 1)"/>
4456
+ <fo:inline padding-right="{$letter-spacing}mm">
4457
+ <xsl:if test="$char = '®'">
4458
+ <xsl:attribute name="font-size">58%</xsl:attribute>
4459
+ <xsl:attribute name="baseline-shift">30%</xsl:attribute>
4460
+ </xsl:if>
4461
+ <xsl:value-of select="$char"/>
4462
+ </fo:inline>
4463
+ <xsl:call-template name="add-letter-spacing">
4464
+ <xsl:with-param name="text" select="substring($text, 2)"/>
4465
+ <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4466
+ </xsl:call-template>
4467
+ </xsl:if>
3501
4468
  </xsl:template></xsl:stylesheet>