metanorma-bipm 1.0.6 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
6
  <xsl:variable name="images" select="document($svg_images)"/>
7
+ <xsl:param name="basepath"/>
7
8
 
8
9
  <xsl:param name="initial_page_number"/>
9
10
  <xsl:param name="doc_split_by_language"/>
@@ -254,6 +255,28 @@
254
255
  </fo:repeatable-page-master-alternatives>
255
256
  </fo:page-sequence-master>
256
257
 
258
+ <!-- Document pages (landscape orientation) -->
259
+ <fo:simple-page-master master-name="document-landscape-odd" page-width="{$pageHeight}" page-height="{$pageWidth}">
260
+ <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="40mm"/>
261
+ <fo:region-before region-name="header-odd" extent="25.4mm"/>
262
+ <fo:region-after region-name="footer" extent="22mm"/> <!-- debug: background-color="green" -->
263
+ <fo:region-start region-name="left-region" extent="17mm"/>
264
+ <fo:region-end region-name="right-region" extent="26.5mm"/>
265
+ </fo:simple-page-master>
266
+ <fo:simple-page-master master-name="document-landscape-even" page-width="{$pageHeight}" page-height="{$pageWidth}">
267
+ <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="40mm"/>
268
+ <fo:region-before region-name="header-even" extent="25.4mm"/>
269
+ <fo:region-after region-name="footer" extent="22mm"/> <!-- debug: background-color="green" -->
270
+ <fo:region-start region-name="left-region" extent="17mm"/>
271
+ <fo:region-end region-name="right-region" extent="26.5mm"/>
272
+ </fo:simple-page-master>
273
+ <fo:page-sequence-master master-name="document-landscape">
274
+ <fo:repeatable-page-master-alternatives>
275
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="document-landscape-even"/>
276
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="document-landscape-odd"/>
277
+ </fo:repeatable-page-master-alternatives>
278
+ </fo:page-sequence-master>
279
+
257
280
  <!-- Index pages -->
258
281
  <fo:simple-page-master master-name="index-odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
259
282
  <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="41.7mm" column-count="2" column-gap="10mm"/>
@@ -329,10 +352,14 @@
329
352
  <xsl:apply-templates select="xalan:nodeset($current_document)" mode="flatxml"/>
330
353
  </xsl:variable> -->
331
354
 
332
- <xsl:variable name="flatxml">
355
+ <xsl:variable name="flatxml_">
333
356
  <xsl:apply-templates select="." mode="flatxml"/>
334
357
  </xsl:variable>
335
358
 
359
+ <xsl:variable name="flatxml">
360
+ <xsl:apply-templates select="xalan:nodeset($flatxml_)" mode="pagebreak"/>
361
+ </xsl:variable>
362
+
336
363
  <!-- flatxml=<xsl:copy-of select="$flatxml"/> -->
337
364
 
338
365
  <xsl:apply-templates select="xalan:nodeset($flatxml)/bipm:bipm-standard" mode="bipm-standard">
@@ -356,10 +383,14 @@
356
383
  <xsl:apply-templates select="xalan:nodeset($current_document)" mode="flatxml"/>
357
384
  </xsl:variable> -->
358
385
 
359
- <xsl:variable name="flatxml">
386
+ <xsl:variable name="flatxml_">
360
387
  <xsl:apply-templates select="." mode="flatxml"/>
361
388
  </xsl:variable>
362
389
 
390
+ <xsl:variable name="flatxml">
391
+ <xsl:apply-templates select="xalan:nodeset($flatxml_)" mode="pagebreak"/>
392
+ </xsl:variable>
393
+
363
394
  <xsl:apply-templates select="xalan:nodeset($flatxml)/bipm:bipm-standard" mode="bipm-standard">
364
395
  <xsl:with-param name="curr_docnum" select="$num"/>
365
396
  </xsl:apply-templates>
@@ -372,10 +403,14 @@
372
403
  </xsl:when>
373
404
  <xsl:otherwise>
374
405
 
375
- <xsl:variable name="flatxml">
406
+ <xsl:variable name="flatxml_">
376
407
  <xsl:apply-templates mode="flatxml"/>
377
408
  </xsl:variable>
378
-
409
+
410
+ <xsl:variable name="flatxml">
411
+ <xsl:apply-templates select="xalan:nodeset($flatxml_)" mode="pagebreak"/>
412
+ </xsl:variable>
413
+
379
414
  <!-- flatxml=<xsl:copy-of select="$flatxml"/> -->
380
415
 
381
416
  <!-- indexes=<xsl:copy-of select="$indexes"/> -->
@@ -861,8 +896,82 @@
861
896
  <!-- END: Flattening xml for fit notes at page sides (margins) -->
862
897
  <!-- ================================= -->
863
898
 
899
+ <!-- ================================= -->
900
+ <!-- Page breaks processing (close previous elements (clause) and start new) -->
901
+ <!-- ================================= -->
902
+ <xsl:template match="@*|node()" mode="pagebreak">
903
+ <xsl:copy>
904
+ <xsl:apply-templates select="@*|node()" mode="pagebreak"/>
905
+ </xsl:copy>
906
+ </xsl:template>
864
907
 
908
+ <xsl:template match="node()[bipm:pagebreak[@orientation]]" mode="pagebreak">
909
+ <xsl:variable name="element_name" select="local-name()"/>
910
+ <xsl:for-each select="bipm:pagebreak[@orientation]">
911
+ <xsl:variable name="pagebreak_id" select="generate-id()"/>
912
+ <xsl:variable name="pagebreak_previous_orientation" select="preceding-sibling::bipm:pagebreak[@orientation][1]/@orientation"/>
913
+
914
+ <!-- copy elements before page break -->
915
+ <xsl:element name="{$element_name}" namespace="https://www.metanorma.org/ns/bipm">
916
+ <xsl:if test="not(preceding-sibling::bipm:pagebreak[@orientation])">
917
+ <xsl:apply-templates select="../@*" mode="pagebreak"/>
918
+ </xsl:if>
919
+ <xsl:if test="$pagebreak_previous_orientation != ''">
920
+ <xsl:attribute name="orientation"><xsl:value-of select="$pagebreak_previous_orientation"/></xsl:attribute>
921
+ </xsl:if>
922
+
923
+ <xsl:apply-templates select="preceding-sibling::node()[following-sibling::bipm:pagebreak[@orientation][1][generate-id(.) = $pagebreak_id]][not(local-name() = 'pagebreak' and @orientation)]" mode="pagebreak"/>
924
+ </xsl:element>
925
+
926
+ <!-- copy elements after last page break -->
927
+ <xsl:if test="position() = last() and following-sibling::node()">
928
+ <xsl:element name="{$element_name}" namespace="https://www.metanorma.org/ns/bipm">
929
+ <xsl:attribute name="orientation"><xsl:value-of select="@orientation"/></xsl:attribute>
930
+ <xsl:apply-templates select="following-sibling::node()" mode="pagebreak"/>
931
+ </xsl:element>
932
+ </xsl:if>
933
+
934
+ </xsl:for-each>
935
+
936
+ </xsl:template>
865
937
 
938
+ <xsl:template match="bipm:pagebreak2" mode="pagebreak">
939
+ <xsl:variable name="orientation" select="normalize-space(@orientation)"/>
940
+ <xsl:variable name="tree">
941
+ <xsl:for-each select="ancestor::*[ancestor::bipm:sections or ancestor::bipm:annex or ancestor::bipm:preface]">
942
+ <element pos="{position()}">
943
+ <xsl:value-of select="name()"/>
944
+ </element>
945
+ </xsl:for-each>
946
+ </xsl:variable>
947
+ <!-- close preceding elements -->
948
+ <xsl:for-each select="xalan:nodeset($tree)//element">
949
+ <xsl:sort data-type="number" order="descending" select="@pos"/>
950
+ <xsl:text disable-output-escaping="yes">&lt;/</xsl:text>
951
+ <xsl:value-of select="."/>
952
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
953
+ </xsl:for-each>
954
+ <!-- open elements -->
955
+ <xsl:for-each select="xalan:nodeset($tree)//element">
956
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
957
+ <xsl:value-of select="."/>
958
+ <xsl:for-each select="@*[local-name() != 'pos']">
959
+ <xsl:text> </xsl:text>
960
+ <xsl:value-of select="local-name()"/>
961
+ <xsl:text>="</xsl:text>
962
+ <xsl:value-of select="."/>
963
+ <xsl:text>"</xsl:text>
964
+ </xsl:for-each>
965
+ <xsl:if test="position() = 1">
966
+ <xsl:text> orientation="</xsl:text><xsl:value-of select="$orientation"/><xsl:text>"</xsl:text>
967
+ </xsl:if>
968
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
969
+ </xsl:for-each>
970
+
971
+ </xsl:template>
972
+ <!-- ================================= -->
973
+ <!-- END: Page breaks processing -->
974
+ <!-- ================================= -->
866
975
 
867
976
  <xsl:template match="bipm:bipm-standard"/>
868
977
  <xsl:template match="bipm:bipm-standard" mode="bipm-standard">
@@ -1072,12 +1181,11 @@
1072
1181
 
1073
1182
 
1074
1183
  <!-- Document Pages -->
1075
-
1076
1184
  <xsl:apply-templates select="bipm:sections/*" mode="sections"/>
1077
1185
 
1078
1186
 
1079
-
1080
1187
  <!-- Normative references -->
1188
+
1081
1189
  <xsl:apply-templates select="bipm:bibliography/bipm:references[@normative='true']" mode="sections"/>
1082
1190
 
1083
1191
  <xsl:apply-templates select="bipm:annex" mode="sections"/>
@@ -1085,6 +1193,9 @@
1085
1193
  <!-- Bibliography -->
1086
1194
  <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1087
1195
 
1196
+ <!-- Document Control -->
1197
+ <xsl:apply-templates select="bipm:doccontrol" mode="sections"/>
1198
+
1088
1199
  <!-- Index -->
1089
1200
  <!-- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index" /> -->
1090
1201
  <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index"/>
@@ -1238,7 +1349,6 @@
1238
1349
  <xsl:apply-templates select="bipm:preface/*" mode="sections"/> <!-- bipm:clause -->
1239
1350
 
1240
1351
  <!-- Document Pages -->
1241
-
1242
1352
  <xsl:apply-templates select="bipm:sections/*" mode="sections"/>
1243
1353
  <!-- <xsl:call-template name="sections_appendix"/> --> <!-- without pagebreaks -->
1244
1354
 
@@ -1250,6 +1360,9 @@
1250
1360
 
1251
1361
  <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1252
1362
 
1363
+ <!-- Document Control -->
1364
+ <xsl:apply-templates select="bipm:doccontrol" mode="sections"/>
1365
+
1253
1366
  <!-- Index -->
1254
1367
  <!-- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index" /> -->
1255
1368
  <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index"/>
@@ -1963,11 +2076,14 @@
1963
2076
 
1964
2077
  <xsl:template match="node()" mode="sections">
1965
2078
  <fo:page-sequence master-reference="document" force-page-count="no-force">
2079
+ <xsl:if test="@orientation = 'landscape'">
2080
+ <xsl:attribute name="master-reference">document-landscape</xsl:attribute>
2081
+ </xsl:if>
2082
+
1966
2083
  <xsl:call-template name="insertFootnoteSeparator"/>
1967
2084
 
1968
2085
  <xsl:variable name="header-title">
1969
2086
  <xsl:choose>
1970
-
1971
2087
  <xsl:when test="local-name(..) = 'sections'">
1972
2088
  <xsl:choose>
1973
2089
  <xsl:when test="./bipm:title[1]/*[local-name() = 'tab']">
@@ -2008,6 +2124,7 @@
2008
2124
  </xsl:variable>
2009
2125
  <xsl:call-template name="insertHeaderFooter">
2010
2126
  <xsl:with-param name="header-title" select="$header-title"/>
2127
+ <xsl:with-param name="orientation" select="@orientation"/>
2011
2128
  </xsl:call-template>
2012
2129
 
2013
2130
  <fo:flow flow-name="xsl-region-body">
@@ -2479,13 +2596,25 @@
2479
2596
  <xsl:variable name="space-before-value" select="normalize-space($space-before)"/>
2480
2597
 
2481
2598
  <fo:table table-layout="fixed" width="174mm" line-height="135%">
2599
+ <xsl:if test="@orientation = 'landscape'">
2600
+ <xsl:attribute name="width">261mm</xsl:attribute> <!-- 87 = (297 - 210) -->
2601
+ </xsl:if>
2482
2602
  <xsl:call-template name="setId"/>
2483
2603
  <xsl:if test="$space-before-value != ''">
2484
2604
  <xsl:attribute name="space-before"><xsl:value-of select="$space-before-value"/></xsl:attribute>
2485
2605
  </xsl:if>
2486
- <fo:table-column column-width="137mm"/>
2606
+
2607
+ <xsl:choose>
2608
+ <xsl:when test="@orientation = 'landscape'">
2609
+ <fo:table-column column-width="224mm"/> <!-- +87 -->
2610
+ </xsl:when>
2611
+ <xsl:otherwise>
2612
+ <fo:table-column column-width="137mm"/>
2613
+ </xsl:otherwise>
2614
+ </xsl:choose>
2487
2615
  <fo:table-column column-width="5mm"/>
2488
2616
  <fo:table-column column-width="32mm"/>
2617
+
2489
2618
  <fo:table-body>
2490
2619
 
2491
2620
  <xsl:variable name="total_rows" select="count(*)"/>
@@ -3296,7 +3425,7 @@
3296
3425
 
3297
3426
  <!-- set height for sup -->
3298
3427
  <!-- <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1 and mathml:mtext and (mathml:mtext/text() != '' and mathml:mtext/text() != ' ' and mathml:mtext/text() != '&#xa0;')]/mathml:mtext" mode="mtext"> -->
3299
- <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1]/*" mode="mathml" priority="2">
3428
+ <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1 and not(mathml:mfenced)]/*" mode="mathml" priority="3">
3300
3429
  <xsl:copy>
3301
3430
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3302
3431
  </xsl:copy>
@@ -3327,23 +3456,49 @@
3327
3456
  <mrow>
3328
3457
  <mtext>Cu</mtext>
3329
3458
  </mrow>
3330
- </mfenced>
3331
- to:
3459
+ </mfenced>
3460
+ to:
3461
+ <mfenced open="(" close=")" separators="">
3462
+ <mathml:mo rspace="-0.35em"></mathml:mo>
3463
+ <mathml:mspace width="-0.15em"/>
3464
+ <mrow>
3465
+ <mtext>Cu</mtext>
3466
+ </mrow>
3467
+ <mathml:mspace width="-0.1em"/>
3468
+ </mfenced>
3469
+ -->
3470
+ <xsl:template match="mathml:mfenced[count(*) = 1]" mode="mathml" priority="2">
3471
+ <xsl:if test="preceding-sibling::*">
3472
+ <mathml:mo rspace="-0.35em"/><!-- decrease space before opening bracket -->
3473
+ </xsl:if>
3474
+ <xsl:copy>
3475
+ <xsl:apply-templates select="@*" mode="mathml"/>
3476
+ <xsl:if test="not(@separators)">
3477
+ <xsl:attribute name="separators"/>
3478
+ </xsl:if>
3479
+ <mathml:mspace width="-0.15em"/> <!-- decrease space between opening brackets and inside text-->
3480
+ <xsl:apply-templates mode="mathml"/>
3481
+ <mathml:mspace width="-0.1em"/> <!-- decrease space between inside text and closing brackets -->
3482
+ </xsl:copy>
3483
+ </xsl:template>
3484
+
3485
+ <!-- to:
3332
3486
  <mrow>
3333
3487
  <mtext>(Cu)</mtext>
3334
3488
  </mrow> -->
3335
- <xsl:template match="mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 0]] | mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 1] and */*/*[count(*) = 0]]" mode="mathml" priority="2">
3489
+ <!-- <xsl:template match="mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 0]] |
3490
+ mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 1] and */*/*[count(*) = 0]]" mode="mathml" priority="2">
3336
3491
  <xsl:apply-templates mode="mathml"/>
3337
3492
  </xsl:template>
3338
-
3339
- <xsl:template match="mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0] | mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0]" mode="mathml" priority="2"> <!-- [not(following-sibling::*) and not(preceding-sibling::*)] -->
3493
+ <xsl:template match="mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0] |
3494
+ mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0]" mode="mathml" priority="2">
3340
3495
  <xsl:copy>
3341
3496
  <xsl:apply-templates select="@*" mode="mathml"/>
3342
3497
  <xsl:value-of select="ancestor::mathml:mfenced[1]/@open"/>
3343
3498
  <xsl:value-of select="."/>
3344
3499
  <xsl:value-of select="ancestor::mathml:mfenced[1]/@close"/>
3345
3500
  </xsl:copy>
3346
- </xsl:template>
3501
+ </xsl:template> -->
3347
3502
 
3348
3503
  <!-- Decrease height of / and | -->
3349
3504
  <xsl:template match="mathml:mo[normalize-space(text()) = '/' or normalize-space(text()) = '|']" mode="mathml">
@@ -3356,6 +3511,20 @@
3356
3511
  </xsl:copy>
3357
3512
  </xsl:template>
3358
3513
 
3514
+ <!-- Decrease a distance before and after of delta -->
3515
+ <xsl:template match="mathml:mo[normalize-space(text()) = 'Δ']" mode="mathml">
3516
+ <xsl:copy>
3517
+ <xsl:apply-templates select="@*" mode="mathml"/>
3518
+ <xsl:if test="not(@rspace)">
3519
+ <xsl:attribute name="rspace">0em</xsl:attribute>
3520
+ </xsl:if>
3521
+ <xsl:if test="not(@lspace) and (preceding-sibling::*[1][local-name() = 'mo'] or not(preceding-sibling::*))">
3522
+ <xsl:attribute name="lspace">0em</xsl:attribute>
3523
+ </xsl:if>
3524
+ <xsl:apply-templates mode="mathml"/>
3525
+ </xsl:copy>
3526
+ </xsl:template>
3527
+
3359
3528
  <xsl:template match="mathml:mi[string-length(normalize-space()) &gt; 1]" mode="mathml" priority="2">
3360
3529
  <xsl:if test="preceding-sibling::* and preceding-sibling::*[1][not(local-name() = 'mfenced' or local-name() = 'mo')]">
3361
3530
  <mathml:mspace width="0.3em"/>
@@ -3367,7 +3536,8 @@
3367
3536
  </xsl:template>
3368
3537
 
3369
3538
  <xsl:template name="insertHeaderFooter">
3370
- <xsl:param name="header-title"/>
3539
+ <xsl:param name="header-title"/>
3540
+ <xsl:param name="orientation"/>
3371
3541
  <fo:static-content flow-name="header-odd">
3372
3542
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3373
3543
  <fo:block text-align="right">
@@ -3382,9 +3552,12 @@
3382
3552
  </fo:block>
3383
3553
  </fo:block-container>
3384
3554
  <fo:block-container font-size="1pt" border-top="0.5pt solid black" margin-left="81mm" width="86mm">
3385
- <fo:block> </fo:block>
3386
- </fo:block-container>
3387
- </fo:static-content>
3555
+ <xsl:if test="$orientation = 'landscape'">
3556
+ <xsl:attribute name="margin-left">168mm</xsl:attribute>
3557
+ </xsl:if>
3558
+ <fo:block> </fo:block>
3559
+ </fo:block-container>
3560
+ </fo:static-content>
3388
3561
  <fo:static-content flow-name="header-even">
3389
3562
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3390
3563
  <fo:block>
@@ -4141,6 +4314,9 @@
4141
4314
  <title-continued lang="en">(continued)</title-continued>
4142
4315
  <title-continued lang="fr">(continué)</title-continued>
4143
4316
 
4317
+ </xsl:variable><xsl:variable name="bibdata">
4318
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
4319
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
4144
4320
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
4145
4321
  <xsl:param name="name"/>
4146
4322
  <xsl:param name="lang"/>
@@ -4169,13 +4345,16 @@
4169
4345
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
4170
4346
  <xsl:attribute name="font-size">10.5pt</xsl:attribute>
4171
4347
 
4348
+
4172
4349
  </xsl:attribute-set><xsl:attribute-set name="link-style">
4173
4350
 
4351
+
4174
4352
  <xsl:attribute name="color">blue</xsl:attribute>
4175
4353
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
4176
4354
 
4177
4355
 
4178
4356
 
4357
+
4179
4358
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
4180
4359
  <xsl:attribute name="white-space">pre</xsl:attribute>
4181
4360
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -4233,6 +4412,7 @@
4233
4412
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
4234
4413
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4235
4414
 
4415
+
4236
4416
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
4237
4417
 
4238
4418
 
@@ -4249,9 +4429,7 @@
4249
4429
 
4250
4430
 
4251
4431
 
4252
-
4253
-
4254
-
4432
+
4255
4433
 
4256
4434
 
4257
4435
 
@@ -4280,6 +4458,7 @@
4280
4458
 
4281
4459
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
4282
4460
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4461
+
4283
4462
 
4284
4463
 
4285
4464
 
@@ -4299,6 +4478,7 @@
4299
4478
  <xsl:attribute name="text-indent">-25mm</xsl:attribute>
4300
4479
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
4301
4480
 
4481
+
4302
4482
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
4303
4483
 
4304
4484
 
@@ -4311,15 +4491,19 @@
4311
4491
 
4312
4492
 
4313
4493
 
4494
+
4495
+
4314
4496
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
4315
4497
 
4316
4498
 
4317
4499
 
4318
4500
 
4501
+
4319
4502
  </xsl:attribute-set><xsl:attribute-set name="note-style">
4320
4503
 
4321
4504
 
4322
4505
 
4506
+
4323
4507
 
4324
4508
 
4325
4509
 
@@ -4346,6 +4530,7 @@
4346
4530
 
4347
4531
 
4348
4532
 
4533
+
4349
4534
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
4350
4535
 
4351
4536
 
@@ -4368,7 +4553,9 @@
4368
4553
 
4369
4554
 
4370
4555
 
4556
+
4371
4557
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
4558
+
4372
4559
 
4373
4560
 
4374
4561
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -4391,14 +4578,18 @@
4391
4578
 
4392
4579
 
4393
4580
 
4581
+
4582
+
4394
4583
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
4395
4584
 
4396
4585
 
4397
4586
 
4587
+
4398
4588
  </xsl:attribute-set><xsl:attribute-set name="term-style">
4399
4589
 
4400
4590
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
4401
4591
 
4592
+
4402
4593
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
4403
4594
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4404
4595
  <xsl:attribute name="text-align">left</xsl:attribute>
@@ -4431,10 +4622,12 @@
4431
4622
 
4432
4623
 
4433
4624
 
4625
+
4434
4626
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
4435
4627
 
4436
4628
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
4437
4629
 
4630
+
4438
4631
  <xsl:attribute name="width">100%</xsl:attribute>
4439
4632
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
4440
4633
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -4458,13 +4651,34 @@
4458
4651
 
4459
4652
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
4460
4653
 
4461
-
4654
+
4655
+
4462
4656
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
4463
4657
 
4658
+
4464
4659
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
4465
4660
 
4466
4661
 
4467
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
4662
+
4663
+ </xsl:attribute-set><xsl:variable name="color-added-text">
4664
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
4665
+ </xsl:variable><xsl:attribute-set name="add-style">
4666
+ <xsl:attribute name="color">red</xsl:attribute>
4667
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4668
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
4669
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
4670
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
4671
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
4672
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
4673
+ <xsl:text>red</xsl:text>
4674
+ </xsl:variable><xsl:attribute-set name="del-style">
4675
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
4676
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
4677
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
4678
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
4679
+
4680
+
4681
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
4468
4682
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
4469
4683
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
4470
4684
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -4509,16 +4723,17 @@
4509
4723
  <xsl:call-template name="add-zero-spaces-java"/>
4510
4724
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
4511
4725
 
4726
+ <xsl:variable name="table-preamble">
4727
+
4728
+
4729
+ </xsl:variable>
4730
+
4512
4731
  <xsl:variable name="table">
4513
4732
 
4514
4733
  <xsl:variable name="simple-table">
4515
4734
  <xsl:call-template name="getSimpleTable"/>
4516
4735
  </xsl:variable>
4517
4736
 
4518
-
4519
-
4520
-
4521
-
4522
4737
  <!-- <xsl:if test="$namespace = 'bipm'">
4523
4738
  <fo:block>&#xA0;</fo:block>
4524
4739
  </xsl:if> -->
@@ -4533,7 +4748,7 @@
4533
4748
 
4534
4749
 
4535
4750
 
4536
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
4751
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
4537
4752
 
4538
4753
  <!-- <xsl:variable name="cols-count">
4539
4754
  <xsl:choose>
@@ -4552,8 +4767,6 @@
4552
4767
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
4553
4768
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
4554
4769
 
4555
-
4556
-
4557
4770
  <xsl:variable name="colwidths">
4558
4771
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
4559
4772
  <xsl:call-template name="calculate-column-widths">
@@ -4581,9 +4794,11 @@
4581
4794
  </xsl:choose>
4582
4795
  </xsl:variable>
4583
4796
 
4797
+
4584
4798
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
4585
4799
 
4586
4800
 
4801
+
4587
4802
 
4588
4803
 
4589
4804
 
@@ -4595,6 +4810,8 @@
4595
4810
 
4596
4811
 
4597
4812
 
4813
+
4814
+
4598
4815
  <xsl:attribute name="space-after">12pt</xsl:attribute>
4599
4816
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
4600
4817
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -4629,13 +4846,15 @@
4629
4846
 
4630
4847
 
4631
4848
 
4849
+
4850
+
4632
4851
 
4633
4852
 
4634
4853
 
4635
4854
 
4636
4855
 
4637
4856
 
4638
- <xsl:if test="not(ancestor::*[local-name()='preface']) and not(ancestor::*[local-name()='note_side']) and not(ancestor::*[local-name() = 'annex'] and .//*[local-name() = 'xref'][@pagenumber])">
4857
+ <xsl:if test="not(ancestor::*[local-name()='preface']) and not(ancestor::*[local-name()='note_side']) and not(ancestor::*[local-name() = 'annex'] and .//*[local-name() = 'xref'][@pagenumber]) and not(ancestor::*[local-name() = 'doccontrol'])">
4639
4858
  <attribute name="border-top">0.5pt solid black</attribute>
4640
4859
  <attribute name="border-bottom">0.5pt solid black</attribute>
4641
4860
  </xsl:if>
@@ -4725,7 +4944,8 @@
4725
4944
  </fo:block-container>
4726
4945
  </xsl:variable>
4727
4946
 
4728
-
4947
+ <xsl:variable name="isAdded" select="@added"/>
4948
+ <xsl:variable name="isDeleted" select="@deleted"/>
4729
4949
 
4730
4950
  <xsl:choose>
4731
4951
  <xsl:when test="@width">
@@ -4734,16 +4954,47 @@
4734
4954
 
4735
4955
 
4736
4956
 
4737
- <xsl:copy-of select="$table"/>
4957
+ <xsl:choose>
4958
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
4959
+ <xsl:copy-of select="$table-preamble"/>
4960
+ <fo:block>
4961
+ <xsl:call-template name="setTrackChangesStyles">
4962
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4963
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4964
+ </xsl:call-template>
4965
+ <xsl:copy-of select="$table"/>
4966
+ </fo:block>
4967
+ </xsl:when>
4968
+ <xsl:otherwise>
4969
+ <xsl:copy-of select="$table-preamble"/>
4970
+ <xsl:copy-of select="$table"/>
4971
+ </xsl:otherwise>
4972
+ </xsl:choose>
4738
4973
 
4739
4974
 
4740
4975
  </xsl:when>
4741
4976
  <xsl:otherwise>
4742
- <xsl:copy-of select="$table"/>
4977
+ <xsl:choose>
4978
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
4979
+ <xsl:copy-of select="$table-preamble"/>
4980
+ <fo:block>
4981
+ <xsl:call-template name="setTrackChangesStyles">
4982
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4983
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4984
+ </xsl:call-template>
4985
+ <xsl:copy-of select="$table"/>
4986
+ </fo:block>
4987
+ </xsl:when>
4988
+ <xsl:otherwise>
4989
+ <xsl:copy-of select="$table-preamble"/>
4990
+ <xsl:copy-of select="$table"/>
4991
+ </xsl:otherwise>
4992
+ </xsl:choose>
4743
4993
  </xsl:otherwise>
4744
4994
  </xsl:choose>
4745
4995
 
4746
4996
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
4997
+ <xsl:param name="continued"/>
4747
4998
  <xsl:if test="normalize-space() != ''">
4748
4999
  <fo:block xsl:use-attribute-sets="table-name-style">
4749
5000
 
@@ -4751,8 +5002,21 @@
4751
5002
  <xsl:if test="not(*[local-name()='tab'])"> <!-- table without number -->
4752
5003
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
4753
5004
  </xsl:if>
5005
+ <xsl:if test="not(../preceding-sibling::*) and ancestor::node()[@orientation]">
5006
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
5007
+ </xsl:if>
5008
+
5009
+ <xsl:choose>
5010
+ <xsl:when test="$continued = 'true'">
5011
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
5012
+
5013
+ </xsl:when>
5014
+ <xsl:otherwise>
5015
+ <xsl:apply-templates/>
5016
+ </xsl:otherwise>
5017
+ </xsl:choose>
5018
+
4754
5019
 
4755
- <xsl:apply-templates/>
4756
5020
  </fo:block>
4757
5021
  </xsl:if>
4758
5022
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -4804,7 +5068,7 @@
4804
5068
  </xsl:for-each>
4805
5069
  </xsl:when>
4806
5070
  <xsl:otherwise>
4807
- <xsl:for-each select="xalan:nodeset($table)//tr">
5071
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
4808
5072
  <xsl:variable name="td_text">
4809
5073
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
4810
5074
 
@@ -4892,18 +5156,18 @@
4892
5156
  <xsl:apply-templates/>
4893
5157
  </fo:table-header>
4894
5158
  </xsl:template><xsl:template name="table-header-title">
4895
- <xsl:param name="cols-count"/>
5159
+ <xsl:param name="cols-count"/>
4896
5160
  <!-- row for title -->
4897
5161
  <fo:table-row>
4898
5162
  <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">
4899
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
5163
+
5164
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
5165
+ <xsl:with-param name="continued">true</xsl:with-param>
5166
+ </xsl:apply-templates>
4900
5167
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
4901
5168
  <xsl:call-template name="fn_name_display"/>
4902
- </xsl:for-each>
4903
- <fo:block text-align="right" font-style="italic">
4904
- <xsl:text> </xsl:text>
4905
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
4906
- </fo:block>
5169
+ </xsl:for-each>
5170
+
4907
5171
  </fo:table-cell>
4908
5172
  </fo:table-row>
4909
5173
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -5138,6 +5402,7 @@
5138
5402
 
5139
5403
 
5140
5404
 
5405
+
5141
5406
  </xsl:if>
5142
5407
  <xsl:if test="$parent-name = 'tfoot'">
5143
5408
 
@@ -5165,7 +5430,8 @@
5165
5430
  <xsl:attribute name="text-align">
5166
5431
  <xsl:choose>
5167
5432
  <xsl:when test="@align">
5168
- <xsl:value-of select="@align"/>
5433
+ <xsl:call-template name="setAlignment"/>
5434
+ <!-- <xsl:value-of select="@align"/> -->
5169
5435
  </xsl:when>
5170
5436
  <xsl:otherwise>center</xsl:otherwise>
5171
5437
  </xsl:choose>
@@ -5181,17 +5447,33 @@
5181
5447
 
5182
5448
 
5183
5449
 
5450
+
5184
5451
  <xsl:attribute name="font-weight">normal</xsl:attribute>
5185
5452
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
5186
5453
  <!-- <xsl:attribute name="border-top">solid black 0.5pt</xsl:attribute> -->
5187
5454
  <xsl:attribute name="border-bottom">solid black 0.5pt</xsl:attribute>
5188
5455
  <xsl:attribute name="height">8mm</xsl:attribute>
5189
5456
  <xsl:attribute name="padding-top">2mm</xsl:attribute>
5190
- <xsl:if test="ancestor::*[local-name() = 'annex'] and ancestor::*[local-name() = 'table']//*[local-name() = 'xref'][@pagenumber]"><!-- for Annex ToC -->
5457
+ <xsl:if test="(ancestor::*[local-name() = 'annex'] and ancestor::*[local-name() = 'table']//*[local-name() = 'xref'][@pagenumber]) or ancestor::*[local-name() = 'doccontrol']"><!-- for Annex ToC -->
5191
5458
  <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
5192
5459
  <xsl:attribute name="border-bottom">solid black 0pt</xsl:attribute>
5193
5460
  </xsl:if>
5461
+ <xsl:if test="ancestor::*[local-name() = 'doccontrol']">
5462
+ <xsl:attribute name="text-align">
5463
+ <xsl:choose>
5464
+ <xsl:when test="@align">
5465
+ <xsl:value-of select="@align"/>
5466
+ </xsl:when>
5467
+ <xsl:otherwise>left</xsl:otherwise>
5468
+ </xsl:choose>
5469
+ </xsl:attribute>
5470
+ <xsl:attribute name="display-align">before</xsl:attribute>
5471
+ </xsl:if>
5472
+
5194
5473
 
5474
+ <xsl:if test="$lang = 'ar'">
5475
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5476
+ </xsl:if>
5195
5477
  <xsl:if test="@colspan">
5196
5478
  <xsl:attribute name="number-columns-spanned">
5197
5479
  <xsl:value-of select="@colspan"/>
@@ -5223,11 +5505,16 @@
5223
5505
  <xsl:attribute name="text-align">
5224
5506
  <xsl:choose>
5225
5507
  <xsl:when test="@align">
5226
- <xsl:value-of select="@align"/>
5508
+ <xsl:call-template name="setAlignment"/>
5509
+ <!-- <xsl:value-of select="@align"/> -->
5227
5510
  </xsl:when>
5228
5511
  <xsl:otherwise>left</xsl:otherwise>
5229
5512
  </xsl:choose>
5230
5513
  </xsl:attribute>
5514
+ <xsl:if test="$lang = 'ar'">
5515
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5516
+ </xsl:if>
5517
+
5231
5518
 
5232
5519
 
5233
5520
 
@@ -5247,7 +5534,13 @@
5247
5534
  <xsl:if test="not(ancestor::*[local-name()='tr']/following-sibling::*[local-name()='tr'])"> <!-- last row -->
5248
5535
  <xsl:attribute name="padding-bottom">2mm</xsl:attribute>
5249
5536
  </xsl:if>
5537
+ <xsl:if test="ancestor::*[local-name() = 'doccontrol']">
5538
+ <xsl:attribute name="display-align">before</xsl:attribute>
5539
+ </xsl:if>
5250
5540
 
5541
+ <xsl:if test=".//*[local-name() = 'table']">
5542
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5543
+ </xsl:if>
5251
5544
  <xsl:if test="@colspan">
5252
5545
  <xsl:attribute name="number-columns-spanned">
5253
5546
  <xsl:value-of select="@colspan"/>
@@ -5406,13 +5699,13 @@
5406
5699
  </xsl:choose>
5407
5700
  </xsl:variable>
5408
5701
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
5409
- <xsl:element name="{$ns}:table">
5702
+ <!-- <xsl:element name="{$ns}:table"> -->
5410
5703
  <xsl:for-each select="*[local-name() = 'dl'][1]">
5411
5704
  <tbody>
5412
5705
  <xsl:apply-templates mode="dl"/>
5413
5706
  </tbody>
5414
5707
  </xsl:for-each>
5415
- </xsl:element>
5708
+ <!-- </xsl:element> -->
5416
5709
  </xsl:variable>
5417
5710
 
5418
5711
  <xsl:call-template name="calculate-column-widths">
@@ -5511,6 +5804,8 @@
5511
5804
  <xsl:apply-templates/>
5512
5805
  </fo:inline>
5513
5806
  </xsl:template><xsl:template match="*[local-name()='dl']">
5807
+ <xsl:variable name="isAdded" select="@added"/>
5808
+ <xsl:variable name="isDeleted" select="@deleted"/>
5514
5809
  <fo:block-container>
5515
5810
 
5516
5811
 
@@ -5530,6 +5825,12 @@
5530
5825
  </xsl:attribute>
5531
5826
 
5532
5827
  </xsl:if>
5828
+
5829
+ <xsl:call-template name="setTrackChangesStyles">
5830
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5831
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5832
+ </xsl:call-template>
5833
+
5533
5834
  <fo:block-container>
5534
5835
 
5535
5836
 
@@ -5586,6 +5887,7 @@
5586
5887
 
5587
5888
 
5588
5889
 
5890
+
5589
5891
  <xsl:variable name="title-key">
5590
5892
 
5591
5893
 
@@ -5638,11 +5940,11 @@
5638
5940
  </xsl:choose>
5639
5941
  </xsl:variable>
5640
5942
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
5641
- <xsl:element name="{$ns}:table">
5943
+ <!-- <xsl:element name="{$ns}:table"> -->
5642
5944
  <tbody>
5643
5945
  <xsl:apply-templates mode="dl"/>
5644
5946
  </tbody>
5645
- </xsl:element>
5947
+ <!-- </xsl:element> -->
5646
5948
  </xsl:variable>
5647
5949
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
5648
5950
  <xsl:variable name="colwidths">
@@ -5870,6 +6172,8 @@
5870
6172
 
5871
6173
  <xsl:apply-templates/>
5872
6174
  </fo:inline>
6175
+ </xsl:template><xsl:template match="*[local-name()='padding']">
6176
+ <fo:inline padding-right="{@value}"> </fo:inline>
5873
6177
  </xsl:template><xsl:template match="*[local-name()='sup']">
5874
6178
  <fo:inline font-size="80%" vertical-align="super">
5875
6179
  <xsl:apply-templates/>
@@ -5895,6 +6199,7 @@
5895
6199
 
5896
6200
 
5897
6201
 
6202
+
5898
6203
 
5899
6204
  </xsl:variable>
5900
6205
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -5912,8 +6217,74 @@
5912
6217
  <fo:inline text-decoration="underline">
5913
6218
  <xsl:apply-templates/>
5914
6219
  </fo:inline>
6220
+ </xsl:template><xsl:template match="*[local-name()='add']">
6221
+ <xsl:choose>
6222
+ <xsl:when test="@amendment">
6223
+ <fo:inline>
6224
+ <xsl:call-template name="insertTag">
6225
+ <xsl:with-param name="kind">A</xsl:with-param>
6226
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
6227
+ </xsl:call-template>
6228
+ <xsl:apply-templates/>
6229
+ <xsl:call-template name="insertTag">
6230
+ <xsl:with-param name="type">closing</xsl:with-param>
6231
+ <xsl:with-param name="kind">A</xsl:with-param>
6232
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
6233
+ </xsl:call-template>
6234
+ </fo:inline>
6235
+ </xsl:when>
6236
+ <xsl:when test="@corrigenda">
6237
+ <fo:inline>
6238
+ <xsl:call-template name="insertTag">
6239
+ <xsl:with-param name="kind">C</xsl:with-param>
6240
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
6241
+ </xsl:call-template>
6242
+ <xsl:apply-templates/>
6243
+ <xsl:call-template name="insertTag">
6244
+ <xsl:with-param name="type">closing</xsl:with-param>
6245
+ <xsl:with-param name="kind">C</xsl:with-param>
6246
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
6247
+ </xsl:call-template>
6248
+ </fo:inline>
6249
+ </xsl:when>
6250
+ <xsl:otherwise>
6251
+ <fo:inline xsl:use-attribute-sets="add-style">
6252
+ <xsl:apply-templates/>
6253
+ </fo:inline>
6254
+ </xsl:otherwise>
6255
+ </xsl:choose>
6256
+
6257
+ </xsl:template><xsl:template name="insertTag">
6258
+ <xsl:param name="type"/>
6259
+ <xsl:param name="kind"/>
6260
+ <xsl:param name="value"/>
6261
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
6262
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
6263
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
6264
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
6265
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
6266
+ <xsl:attribute name="height">5mm</xsl:attribute>
6267
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6268
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6269
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6270
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
6271
+ <g>
6272
+ <xsl:if test="$type = 'closing'">
6273
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
6274
+ </xsl:if>
6275
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
6276
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
6277
+ </g>
6278
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
6279
+ <xsl:if test="$type = 'closing'">
6280
+ <xsl:attribute name="x">25</xsl:attribute>
6281
+ </xsl:if>
6282
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
6283
+ </text>
6284
+ </svg>
6285
+ </fo:instream-foreign-object>
5915
6286
  </xsl:template><xsl:template match="*[local-name()='del']">
5916
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
6287
+ <fo:inline xsl:use-attribute-sets="del-style">
5917
6288
  <xsl:apply-templates/>
5918
6289
  </fo:inline>
5919
6290
  </xsl:template><xsl:template match="*[local-name()='hi']">
@@ -6210,11 +6581,15 @@
6210
6581
  </xsl:apply-templates>
6211
6582
  </xsl:template><xsl:template name="getLang">
6212
6583
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6584
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
6213
6585
  <xsl:variable name="language">
6214
6586
  <xsl:choose>
6215
6587
  <xsl:when test="$language_current != ''">
6216
6588
  <xsl:value-of select="$language_current"/>
6217
6589
  </xsl:when>
6590
+ <xsl:when test="$language_current_2 != ''">
6591
+ <xsl:value-of select="$language_current_2"/>
6592
+ </xsl:when>
6218
6593
  <xsl:otherwise>
6219
6594
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
6220
6595
  </xsl:otherwise>
@@ -6254,24 +6629,34 @@
6254
6629
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
6255
6630
  <xsl:value-of select="substring($str, 2)"/>
6256
6631
  </xsl:template><xsl:template match="mathml:math">
6257
- <fo:inline font-family="STIX Two Math"> <!-- -->
6632
+ <xsl:variable name="isAdded" select="@added"/>
6633
+ <xsl:variable name="isDeleted" select="@deleted"/>
6634
+
6635
+ <fo:inline xsl:use-attribute-sets="mathml-style">
6258
6636
 
6259
6637
  <xsl:if test="ancestor::*[local-name()='table']">
6260
6638
  <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
6261
6639
  </xsl:if>
6262
6640
 
6641
+
6642
+ <xsl:call-template name="setTrackChangesStyles">
6643
+ <xsl:with-param name="isAdded" select="$isAdded"/>
6644
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
6645
+ </xsl:call-template>
6646
+
6263
6647
  <xsl:variable name="mathml">
6264
6648
  <xsl:apply-templates select="." mode="mathml"/>
6265
6649
  </xsl:variable>
6266
6650
  <fo:instream-foreign-object fox:alt-text="Math">
6267
6651
 
6268
- <xsl:if test="ancestor::*[local-name() = 'formula']">
6652
+ <xsl:if test="local-name(../..) = 'formula'">
6269
6653
  <xsl:attribute name="width">95%</xsl:attribute>
6270
6654
  <xsl:attribute name="content-height">100%</xsl:attribute>
6271
6655
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6272
6656
  <xsl:attribute name="scaling">uniform</xsl:attribute>
6273
6657
  </xsl:if>
6274
6658
 
6659
+
6275
6660
  <!-- <xsl:copy-of select="."/> -->
6276
6661
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
6277
6662
  </fo:instream-foreign-object>
@@ -6292,6 +6677,16 @@
6292
6677
  <mathml:mspace width="0.5ex"/>
6293
6678
  </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">
6294
6679
  <xsl:variable name="target">
6680
+ <xsl:choose>
6681
+ <xsl:when test="@updatetype = 'true'">
6682
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6683
+ </xsl:when>
6684
+ <xsl:otherwise>
6685
+ <xsl:value-of select="normalize-space(@target)"/>
6686
+ </xsl:otherwise>
6687
+ </xsl:choose>
6688
+ </xsl:variable>
6689
+ <xsl:variable name="target_text">
6295
6690
  <xsl:choose>
6296
6691
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
6297
6692
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -6304,19 +6699,19 @@
6304
6699
  <fo:inline xsl:use-attribute-sets="link-style">
6305
6700
 
6306
6701
  <xsl:choose>
6307
- <xsl:when test="$target = ''">
6702
+ <xsl:when test="$target_text = ''">
6308
6703
  <xsl:apply-templates/>
6309
6704
  </xsl:when>
6310
6705
  <xsl:otherwise>
6311
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
6706
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6312
6707
  <xsl:choose>
6313
6708
  <xsl:when test="normalize-space(.) = ''">
6314
- <!-- <xsl:value-of select="$target"/> -->
6315
6709
  <xsl:call-template name="add-zero-spaces-link-java">
6316
- <xsl:with-param name="text" select="$target"/>
6710
+ <xsl:with-param name="text" select="$target_text"/>
6317
6711
  </xsl:call-template>
6318
6712
  </xsl:when>
6319
6713
  <xsl:otherwise>
6714
+ <!-- output text from <link>text</link> -->
6320
6715
  <xsl:apply-templates/>
6321
6716
  </xsl:otherwise>
6322
6717
  </xsl:choose>
@@ -6435,6 +6830,7 @@
6435
6830
 
6436
6831
 
6437
6832
  <fo:inline xsl:use-attribute-sets="note-name-style">
6833
+
6438
6834
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
6439
6835
  </fo:inline>
6440
6836
  <xsl:apply-templates/>
@@ -6461,6 +6857,7 @@
6461
6857
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
6462
6858
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
6463
6859
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
6860
+
6464
6861
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
6465
6862
  </fo:inline>
6466
6863
  <xsl:apply-templates/>
@@ -6526,12 +6923,19 @@
6526
6923
  </fo:inline>
6527
6924
  </xsl:if>
6528
6925
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
6926
+ <xsl:variable name="isAdded" select="@added"/>
6927
+ <xsl:variable name="isDeleted" select="@deleted"/>
6529
6928
  <fo:block-container id="{@id}">
6530
6929
 
6531
6930
  <xsl:if test="*[local-name() = 'name']">
6532
6931
  <xsl:attribute name="space-after">12pt</xsl:attribute>
6533
6932
  </xsl:if>
6534
6933
 
6934
+ <xsl:call-template name="setTrackChangesStyles">
6935
+ <xsl:with-param name="isAdded" select="$isAdded"/>
6936
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
6937
+ </xsl:call-template>
6938
+
6535
6939
  <fo:block>
6536
6940
  <xsl:apply-templates/>
6537
6941
  </fo:block>
@@ -6539,7 +6943,10 @@
6539
6943
  <xsl:for-each select="*[local-name() = 'note']">
6540
6944
  <xsl:call-template name="note"/>
6541
6945
  </xsl:for-each>
6542
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
6946
+
6947
+
6948
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
6949
+
6543
6950
  </fo:block-container>
6544
6951
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
6545
6952
  <fo:block id="{@id}">
@@ -6551,37 +6958,122 @@
6551
6958
  <xsl:apply-templates/>
6552
6959
  </fo:block>
6553
6960
  </xsl:template><xsl:template match="*[local-name() = 'image']">
6554
- <fo:block xsl:use-attribute-sets="image-style">
6555
-
6556
-
6557
- <xsl:variable name="src">
6558
- <xsl:choose>
6559
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
6560
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
6561
- </xsl:when>
6562
- <xsl:otherwise>
6563
- <xsl:value-of select="@src"/>
6564
- </xsl:otherwise>
6565
- </xsl:choose>
6566
- </xsl:variable>
6567
-
6568
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
6569
- </fo:block>
6961
+ <xsl:variable name="isAdded" select="../@added"/>
6962
+ <xsl:variable name="isDeleted" select="../@deleted"/>
6963
+ <xsl:choose>
6964
+ <xsl:when test="ancestor::*[local-name() = 'title']">
6965
+ <fo:inline padding-left="1mm" padding-right="1mm">
6966
+ <xsl:variable name="src">
6967
+ <xsl:call-template name="image_src"/>
6968
+ </xsl:variable>
6969
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
6970
+ </fo:inline>
6971
+ </xsl:when>
6972
+ <xsl:otherwise>
6973
+ <fo:block xsl:use-attribute-sets="image-style">
6974
+
6975
+ <xsl:variable name="src">
6976
+ <xsl:call-template name="image_src"/>
6977
+ </xsl:variable>
6978
+
6979
+ <xsl:choose>
6980
+ <xsl:when test="$isDeleted = 'true'">
6981
+ <!-- enclose in svg -->
6982
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
6983
+ <xsl:attribute name="width">100%</xsl:attribute>
6984
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6985
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6986
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6987
+
6988
+
6989
+ <xsl:apply-templates select="." mode="cross_image"/>
6990
+
6991
+ </fo:instream-foreign-object>
6992
+ </xsl:when>
6993
+ <xsl:otherwise>
6994
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
6995
+ </xsl:otherwise>
6996
+ </xsl:choose>
6997
+
6998
+ </fo:block>
6999
+ </xsl:otherwise>
7000
+ </xsl:choose>
7001
+ </xsl:template><xsl:template name="image_src">
7002
+ <xsl:choose>
7003
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
7004
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7005
+ </xsl:when>
7006
+ <xsl:when test="not(starts-with(@src, 'data:'))">
7007
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7008
+ </xsl:when>
7009
+ <xsl:otherwise>
7010
+ <xsl:value-of select="@src"/>
7011
+ </xsl:otherwise>
7012
+ </xsl:choose>
7013
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
7014
+ <xsl:choose>
7015
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
7016
+ <xsl:variable name="src">
7017
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
7018
+ </xsl:variable>
7019
+ <xsl:variable name="width" select="document($src)/@width"/>
7020
+ <xsl:variable name="height" select="document($src)/@height"/>
7021
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
7022
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
7023
+ </svg>
7024
+ </xsl:when>
7025
+ <xsl:when test="not(starts-with(@src, 'data:'))">
7026
+ <xsl:variable name="src">
7027
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
7028
+ </xsl:variable>
7029
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7030
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
7031
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
7032
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
7033
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
7034
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
7035
+ </svg>
7036
+ </xsl:when>
7037
+ <xsl:otherwise>
7038
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
7039
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
7040
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
7041
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
7042
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
7043
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
7044
+ <!-- width=<xsl:value-of select="$width"/> -->
7045
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
7046
+ <!-- height=<xsl:value-of select="$height"/> -->
7047
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
7048
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
7049
+ <xsl:call-template name="svg_cross">
7050
+ <xsl:with-param name="width" select="$width"/>
7051
+ <xsl:with-param name="height" select="$height"/>
7052
+ </xsl:call-template>
7053
+ </svg>
7054
+ </xsl:otherwise>
7055
+ </xsl:choose>
7056
+
7057
+ </xsl:template><xsl:template name="svg_cross">
7058
+ <xsl:param name="width"/>
7059
+ <xsl:param name="height"/>
7060
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
7061
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
6570
7062
  </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">
6571
7063
  <xsl:apply-templates mode="contents"/>
6572
7064
  <xsl:text> </xsl:text>
6573
7065
  </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">
6574
7066
  <xsl:apply-templates mode="bookmarks"/>
6575
7067
  <xsl:text> </xsl:text>
6576
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
7068
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
6577
7069
  <xsl:value-of select="."/>
6578
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
7070
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
6579
7071
  <xsl:value-of select="."/>
6580
7072
  </xsl:template><xsl:template match="node()" mode="contents">
6581
7073
  <xsl:apply-templates mode="contents"/>
6582
7074
  </xsl:template><xsl:template match="node()" mode="bookmarks">
6583
7075
  <xsl:apply-templates mode="bookmarks"/>
6584
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
7076
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
6585
7077
  <xsl:apply-templates select="."/>
6586
7078
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
6587
7079
  <xsl:apply-templates mode="bookmarks"/>
@@ -6794,6 +7286,8 @@
6794
7286
  </fo:list-item-body>
6795
7287
  </fo:list-item>
6796
7288
  </fo:list-block>
7289
+ </xsl:template><xsl:template name="extractSection">
7290
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
6797
7291
  </xsl:template><xsl:template name="extractTitle">
6798
7292
  <xsl:choose>
6799
7293
  <xsl:when test="*[local-name() = 'tab']">
@@ -6820,6 +7314,7 @@
6820
7314
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6821
7315
 
6822
7316
  <fo:block-container margin-left="0mm">
7317
+ <xsl:copy-of select="@id"/>
6823
7318
  <xsl:if test="parent::*[local-name() = 'note']">
6824
7319
  <xsl:attribute name="margin-left">
6825
7320
  <xsl:choose>
@@ -6841,6 +7336,7 @@
6841
7336
 
6842
7337
 
6843
7338
 
7339
+
6844
7340
 
6845
7341
 
6846
7342
 
@@ -7096,6 +7592,7 @@
7096
7592
  </xsl:template><xsl:template match="*[local-name() = 'example']">
7097
7593
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
7098
7594
 
7595
+
7099
7596
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
7100
7597
 
7101
7598
  <xsl:variable name="element">
@@ -7123,6 +7620,7 @@
7123
7620
  <xsl:variable name="element">
7124
7621
  block
7125
7622
 
7623
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
7126
7624
  </xsl:variable>
7127
7625
  <xsl:choose>
7128
7626
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -7130,7 +7628,7 @@
7130
7628
  <xsl:apply-templates/>
7131
7629
  </fo:inline>
7132
7630
  </xsl:when>
7133
- <xsl:when test="normalize-space($element) = 'block'">
7631
+ <xsl:when test="contains(normalize-space($element), 'block')">
7134
7632
  <fo:block xsl:use-attribute-sets="example-name-style">
7135
7633
  <xsl:apply-templates/>
7136
7634
  </fo:block>
@@ -7162,7 +7660,7 @@
7162
7660
  </fo:inline>
7163
7661
  </xsl:otherwise>
7164
7662
  </xsl:choose>
7165
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
7663
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
7166
7664
  <fo:block xsl:use-attribute-sets="termsource-style">
7167
7665
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
7168
7666
  <xsl:variable name="termsource_text">
@@ -7171,13 +7669,15 @@
7171
7669
 
7172
7670
  <xsl:choose>
7173
7671
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
7174
- <xsl:apply-templates/>
7672
+ <!-- <xsl:apply-templates /> -->
7673
+ <xsl:copy-of select="$termsource_text"/>
7175
7674
  </xsl:when>
7176
7675
  <xsl:otherwise>
7177
7676
 
7178
7677
  <xsl:text>[</xsl:text>
7179
7678
 
7180
- <xsl:apply-templates/>
7679
+ <!-- <xsl:apply-templates /> -->
7680
+ <xsl:copy-of select="$termsource_text"/>
7181
7681
 
7182
7682
  <xsl:text>]</xsl:text>
7183
7683
 
@@ -7188,20 +7688,25 @@
7188
7688
  <xsl:if test="normalize-space() != ''">
7189
7689
  <xsl:value-of select="."/>
7190
7690
  </xsl:if>
7191
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
7691
+ </xsl:template><xsl:variable name="localized.source">
7692
+ <xsl:call-template name="getLocalizedString">
7693
+ <xsl:with-param name="key">source</xsl:with-param>
7694
+ </xsl:call-template>
7695
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
7192
7696
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7697
+ <xsl:if test="normalize-space(@citeas) = ''">
7698
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
7699
+ </xsl:if>
7193
7700
 
7194
7701
  <fo:inline>
7195
7702
 
7196
7703
 
7197
7704
 
7705
+ <xsl:value-of select="$localized.source"/>
7706
+ <xsl:text> </xsl:text>
7198
7707
 
7199
- <xsl:call-template name="getTitle">
7200
- <xsl:with-param name="name" select="'title-source'"/>
7201
- </xsl:call-template>
7202
7708
 
7203
7709
 
7204
- <xsl:text>: </xsl:text>
7205
7710
  </fo:inline>
7206
7711
 
7207
7712
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -7322,6 +7827,7 @@
7322
7827
 
7323
7828
 
7324
7829
 
7830
+
7325
7831
  <xsl:choose>
7326
7832
  <xsl:when test="ancestor::bipm:annex">2</xsl:when>
7327
7833
  <xsl:otherwise>8</xsl:otherwise>
@@ -7352,7 +7858,8 @@
7352
7858
  </fo:inline>
7353
7859
  </xsl:when>
7354
7860
  <xsl:otherwise>
7355
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
7861
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
7862
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
7356
7863
  </xsl:otherwise>
7357
7864
  </xsl:choose>
7358
7865
 
@@ -7406,7 +7913,6 @@
7406
7913
 
7407
7914
 
7408
7915
 
7409
-
7410
7916
  <xsl:apply-templates/>
7411
7917
  </fo:block>
7412
7918
 
@@ -7451,7 +7957,7 @@
7451
7957
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
7452
7958
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
7453
7959
  <xsl:choose>
7454
- <xsl:when test="parent::*[local-name() = 'note']">
7960
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
7455
7961
  <fo:block-container>
7456
7962
  <xsl:attribute name="margin-left">
7457
7963
  <xsl:choose>
@@ -7463,6 +7969,7 @@
7463
7969
 
7464
7970
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
7465
7971
 
7972
+
7466
7973
  <fo:block-container margin-left="0mm">
7467
7974
  <fo:block>
7468
7975
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -7621,8 +8128,8 @@
7621
8128
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
7622
8129
  <xsl:apply-templates/>
7623
8130
  </fo:block>
7624
- </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
7625
- <fo:inline id="{@id}"/>
8131
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
8132
+ <fo:inline id="{@id}" font-size="1pt"/>
7626
8133
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
7627
8134
  <!-- <row>
7628
8135
  <date>05-07-2013</date>
@@ -7692,6 +8199,10 @@
7692
8199
 
7693
8200
 
7694
8201
 
8202
+
8203
+
8204
+
8205
+
7695
8206
  </xsl:template><xsl:template name="processBibitemDocId">
7696
8207
  <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')]"/>
7697
8208
  <xsl:choose>
@@ -7748,6 +8259,70 @@
7748
8259
  <xsl:value-of select="substring(.,1,1)"/>
7749
8260
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
7750
8261
  <fo:inline><xsl:apply-templates/></fo:inline>
8262
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
8263
+ <fo:block>
8264
+ <xsl:apply-templates/>
8265
+ </fo:block>
8266
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
8267
+ <fo:inline><xsl:apply-templates/></fo:inline>
8268
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
8269
+ <fo:inline>
8270
+ <xsl:call-template name="text_input"/>
8271
+ </fo:inline>
8272
+ </xsl:template><xsl:template name="text_input">
8273
+ <xsl:variable name="count">
8274
+ <xsl:choose>
8275
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
8276
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
8277
+ <xsl:otherwise>10</xsl:otherwise>
8278
+ </xsl:choose>
8279
+ </xsl:variable>
8280
+ <xsl:call-template name="repeat">
8281
+ <xsl:with-param name="char" select="'_'"/>
8282
+ <xsl:with-param name="count" select="$count"/>
8283
+ </xsl:call-template>
8284
+ <xsl:text> </xsl:text>
8285
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
8286
+ <xsl:variable name="caption">
8287
+ <xsl:choose>
8288
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
8289
+ <xsl:otherwise>BUTTON</xsl:otherwise>
8290
+ </xsl:choose>
8291
+ </xsl:variable>
8292
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
8293
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
8294
+ <fo:inline padding-right="1mm">
8295
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
8296
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
8297
+ <xsl:attribute name="content-width">100%</xsl:attribute>
8298
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8299
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
8300
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
8301
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
8302
+ </svg>
8303
+ </fo:instream-foreign-object>
8304
+ </fo:inline>
8305
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
8306
+ <fo:inline padding-right="1mm">
8307
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
8308
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
8309
+ <xsl:attribute name="content-width">100%</xsl:attribute>
8310
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8311
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
8312
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
8313
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
8314
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
8315
+ </svg>
8316
+ </fo:instream-foreign-object>
8317
+ </fo:inline>
8318
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
8319
+ <fo:inline>
8320
+ <xsl:call-template name="text_input"/>
8321
+ </fo:inline>
8322
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
8323
+ <fo:block-container border="1pt solid black" width="50%">
8324
+ <fo:block> </fo:block>
8325
+ </fo:block-container>
7751
8326
  </xsl:template><xsl:template name="convertDate">
7752
8327
  <xsl:param name="date"/>
7753
8328
  <xsl:param name="format" select="'short'"/>
@@ -7955,6 +8530,9 @@
7955
8530
  <xsl:when test="parent::*[local-name() = 'preface']">
7956
8531
  <xsl:value-of select="$level_total - 1"/>
7957
8532
  </xsl:when>
8533
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
8534
+ <xsl:value-of select="$level_total - 1"/>
8535
+ </xsl:when>
7958
8536
  <xsl:when test="ancestor::*[local-name() = 'preface']">
7959
8537
  <xsl:value-of select="$level_total - 2"/>
7960
8538
  </xsl:when>
@@ -8019,6 +8597,7 @@
8019
8597
 
8020
8598
 
8021
8599
 
8600
+
8022
8601
 
8023
8602
 
8024
8603
 
@@ -8079,17 +8658,69 @@
8079
8658
  </xsl:call-template>
8080
8659
  </xsl:if>
8081
8660
  </xsl:template><xsl:template name="getLocalizedString">
8082
- <xsl:param name="key"/>
8661
+ <xsl:param name="key"/>
8083
8662
 
8084
8663
  <xsl:variable name="curr_lang">
8085
8664
  <xsl:call-template name="getLang"/>
8086
8665
  </xsl:variable>
8087
8666
 
8667
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
8668
+
8088
8669
  <xsl:choose>
8670
+ <xsl:when test="$data_value != ''">
8671
+ <xsl:value-of select="$data_value"/>
8672
+ </xsl:when>
8089
8673
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
8090
8674
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
8091
8675
  </xsl:when>
8092
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
8676
+ <xsl:otherwise>
8677
+ <xsl:variable name="key_">
8678
+ <xsl:call-template name="capitalize">
8679
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
8680
+ </xsl:call-template>
8681
+ </xsl:variable>
8682
+ <xsl:value-of select="$key_"/>
8683
+ </xsl:otherwise>
8093
8684
  </xsl:choose>
8094
8685
 
8686
+ </xsl:template><xsl:template name="setTrackChangesStyles">
8687
+ <xsl:param name="isAdded"/>
8688
+ <xsl:param name="isDeleted"/>
8689
+ <xsl:choose>
8690
+ <xsl:when test="local-name() = 'math'">
8691
+ <xsl:if test="$isAdded = 'true'">
8692
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
8693
+ </xsl:if>
8694
+ <xsl:if test="$isDeleted = 'true'">
8695
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
8696
+ </xsl:if>
8697
+ </xsl:when>
8698
+ <xsl:otherwise>
8699
+ <xsl:if test="$isAdded = 'true'">
8700
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
8701
+ <xsl:attribute name="padding">2mm</xsl:attribute>
8702
+ </xsl:if>
8703
+ <xsl:if test="$isDeleted = 'true'">
8704
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
8705
+ <xsl:if test="local-name() = 'table'">
8706
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
8707
+ </xsl:if>
8708
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
8709
+ <xsl:attribute name="padding">2mm</xsl:attribute>
8710
+ </xsl:if>
8711
+ </xsl:otherwise>
8712
+ </xsl:choose>
8713
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
8714
+ <xsl:if test="$lang = 'ar'">
8715
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
8716
+ </xsl:if>
8717
+ </xsl:template><xsl:template name="setAlignment">
8718
+ <xsl:param name="align" select="normalize-space(@align)"/>
8719
+ <xsl:choose>
8720
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
8721
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
8722
+ <xsl:when test="$align != ''">
8723
+ <xsl:value-of select="$align"/>
8724
+ </xsl:when>
8725
+ </xsl:choose>
8095
8726
  </xsl:template></xsl:stylesheet>