metanorma-ogc 1.4.0 → 1.4.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/ogc/boilerplate.xml +6 -6
  3. data/lib/asciidoctor/ogc/cleanup.rb +173 -0
  4. data/lib/asciidoctor/ogc/converter.rb +62 -64
  5. data/lib/asciidoctor/ogc/front.rb +1 -1
  6. data/lib/asciidoctor/ogc/isodoc.rng +211 -11
  7. data/lib/asciidoctor/ogc/reqt.rng +16 -0
  8. data/lib/asciidoctor/ogc/validate.rb +35 -20
  9. data/lib/isodoc/ogc/base_convert.rb +47 -10
  10. data/lib/isodoc/ogc/biblio.rb +57 -51
  11. data/lib/isodoc/ogc/html/htmlstyle.css +10 -0
  12. data/lib/isodoc/ogc/html/htmlstyle.scss +12 -0
  13. data/lib/isodoc/ogc/html/ogc.css +4 -0
  14. data/lib/isodoc/ogc/html/ogc.scss +4 -0
  15. data/lib/isodoc/ogc/i18n-en.yaml +24 -8
  16. data/lib/isodoc/ogc/metadata.rb +1 -1
  17. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +501 -127
  18. data/lib/isodoc/ogc/ogc.best-practice.xsl +501 -127
  19. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +501 -127
  20. data/lib/isodoc/ogc/ogc.community-practice.xsl +501 -127
  21. data/lib/isodoc/ogc/ogc.community-standard.xsl +501 -127
  22. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +501 -127
  23. data/lib/isodoc/ogc/ogc.engineering-report.xsl +501 -127
  24. data/lib/isodoc/ogc/ogc.other.xsl +501 -127
  25. data/lib/isodoc/ogc/ogc.policy.xsl +501 -127
  26. data/lib/isodoc/ogc/ogc.reference-model.xsl +501 -127
  27. data/lib/isodoc/ogc/ogc.release-notes.xsl +501 -127
  28. data/lib/isodoc/ogc/ogc.standard.xsl +501 -127
  29. data/lib/isodoc/ogc/ogc.test-suite.xsl +501 -127
  30. data/lib/isodoc/ogc/ogc.user-guide.xsl +501 -127
  31. data/lib/isodoc/ogc/ogc.white-paper.xsl +358 -66
  32. data/lib/isodoc/ogc/presentation_xml_convert.rb +58 -48
  33. data/lib/isodoc/ogc/reqt.rb +64 -46
  34. data/lib/isodoc/ogc/xref.rb +1 -2
  35. data/lib/metanorma/ogc/version.rb +1 -1
  36. metadata +3 -2
@@ -174,7 +174,7 @@
174
174
 
175
175
  <fo:block-container absolute-position="fixed" left="16.5mm" top="83mm" height="90mm">
176
176
  <fo:block-container width="155mm">
177
- <fo:block font-size="33pt">
177
+ <fo:block font-size="33pt" role="H1">
178
178
  <xsl:call-template name="addLetterSpacing">
179
179
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($doctitle))"/>
180
180
  <xsl:with-param name="letter-spacing" select="1.1"/>
@@ -332,7 +332,7 @@
332
332
  <fo:block-container margin-left="-18mm">
333
333
  <fo:block-container margin-left="0mm">
334
334
  <fo:block margin-bottom="40pt">
335
- <fo:block font-size="33pt" margin-bottom="4pt">
335
+ <fo:block font-size="33pt" margin-bottom="4pt" role="H1">
336
336
  <xsl:call-template name="addLetterSpacing">
337
337
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($title-toc))"/>
338
338
  <xsl:with-param name="letter-spacing" select="1.1"/>
@@ -348,73 +348,73 @@
348
348
 
349
349
 
350
350
  <fo:block-container line-height="130%">
351
-
352
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
353
-
354
- <fo:block>
355
- <xsl:if test="@level = 1">
356
- <xsl:attribute name="margin-top">14pt</xsl:attribute>
357
- </xsl:if>
358
- <xsl:if test="@level = 1 or @parent = 'annex'">
359
- <xsl:attribute name="font-size">12pt</xsl:attribute>
360
- </xsl:if>
361
- <xsl:if test="@level = 2 and not(@parent = 'annex')">
362
- <xsl:attribute name="font-size">10pt</xsl:attribute>
363
- </xsl:if>
351
+ <fo:block role="TOC">
352
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
364
353
 
365
- <xsl:choose>
366
- <xsl:when test="@level = 1">
367
- <fo:list-block provisional-distance-between-starts="7mm">
368
- <xsl:if test="@type = 'annex'">
369
- <xsl:attribute name="provisional-distance-between-starts">0mm</xsl:attribute>
370
- </xsl:if>
371
- <fo:list-item>
372
- <fo:list-item-label end-indent="label-end()">
373
- <fo:block>
374
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
375
- </fo:block>
376
- </fo:list-item-label>
377
- <fo:list-item-body start-indent="body-start()">
378
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
379
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
380
- <xsl:variable name="sectionTitle">
381
- <xsl:apply-templates select="title"/>
382
- </xsl:variable>
383
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($sectionTitle))"/>
384
- <xsl:text> </xsl:text>
385
- <fo:inline keep-together.within-line="always">
386
- <fo:leader leader-pattern="dots"/>
387
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
388
- </fo:inline>
389
- </fo:basic-link>
390
- </fo:block>
391
- </fo:list-item-body>
392
- </fo:list-item>
393
- </fo:list-block>
394
- </xsl:when>
395
- <xsl:otherwise>
396
- <fo:block text-align-last="justify" margin-left="7mm">
397
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
398
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
399
- <xsl:text> </xsl:text>
400
- <xsl:apply-templates select="title"/>
401
- <xsl:text> </xsl:text>
402
- <fo:inline keep-together.within-line="always">
403
- <fo:leader leader-pattern="dots"/>
404
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
405
- </fo:inline>
406
- </fo:basic-link>
407
- </fo:block>
408
- </xsl:otherwise>
409
- </xsl:choose>
410
-
411
-
412
- </fo:block>
413
- </xsl:for-each>
414
-
354
+ <fo:block role="TOCI">
355
+ <xsl:if test="@level = 1">
356
+ <xsl:attribute name="margin-top">14pt</xsl:attribute>
357
+ </xsl:if>
358
+ <xsl:if test="@level = 1 or @parent = 'annex'">
359
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
360
+ </xsl:if>
361
+ <xsl:if test="@level = 2 and not(@parent = 'annex')">
362
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
363
+ </xsl:if>
364
+
365
+ <xsl:choose>
366
+ <xsl:when test="@level = 1">
367
+ <fo:list-block provisional-distance-between-starts="8mm">
368
+ <xsl:if test="@type = 'annex'">
369
+ <xsl:attribute name="provisional-distance-between-starts">0mm</xsl:attribute>
370
+ </xsl:if>
371
+ <fo:list-item>
372
+ <fo:list-item-label end-indent="label-end()">
373
+ <fo:block>
374
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
375
+ </fo:block>
376
+ </fo:list-item-label>
377
+ <fo:list-item-body start-indent="body-start()">
378
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
379
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
380
+ <xsl:variable name="sectionTitle">
381
+ <xsl:apply-templates select="title"/>
382
+ </xsl:variable>
383
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($sectionTitle))"/>
384
+ <xsl:text> </xsl:text>
385
+ <fo:inline keep-together.within-line="always">
386
+ <fo:leader leader-pattern="dots"/>
387
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
388
+ </fo:inline>
389
+ </fo:basic-link>
390
+ </fo:block>
391
+ </fo:list-item-body>
392
+ </fo:list-item>
393
+ </fo:list-block>
394
+ </xsl:when>
395
+ <xsl:otherwise>
396
+ <fo:block text-align-last="justify" margin-left="8mm">
397
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
398
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
399
+ <xsl:text> </xsl:text>
400
+ <xsl:apply-templates select="title"/>
401
+ <xsl:text> </xsl:text>
402
+ <fo:inline keep-together.within-line="always">
403
+ <fo:leader leader-pattern="dots"/>
404
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
405
+ </fo:inline>
406
+ </fo:basic-link>
407
+ </fo:block>
408
+ </xsl:otherwise>
409
+ </xsl:choose>
410
+
411
+
412
+ </fo:block>
413
+ </xsl:for-each>
414
+ </fo:block>
415
415
  </fo:block-container>
416
416
 
417
- <xsl:if test="//ogc:table[@id and ogc:name]">
417
+ <xsl:if test="//ogc:table[@id and ogc:name and contains(ogc:name, '—')]">
418
418
  <xsl:variable name="title-list-tables">
419
419
  <xsl:call-template name="getTitle">
420
420
  <xsl:with-param name="name" select="'title-list-tables'"/>
@@ -429,8 +429,8 @@
429
429
  </fo:block-container>
430
430
  </fo:block-container>
431
431
  <fo:block-container line-height="130%">
432
- <xsl:for-each select="//ogc:table[@id and ogc:name]">
433
- <fo:block text-align-last="justify" margin-top="2pt">
432
+ <xsl:for-each select="//ogc:table[@id and ogc:name and contains(ogc:name, '—')]">
433
+ <fo:block text-align-last="justify" margin-top="2pt" role="TOCI">
434
434
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{ogc:name}">
435
435
  <xsl:apply-templates select="ogc:name" mode="contents"/>
436
436
  <fo:inline keep-together.within-line="always">
@@ -443,7 +443,7 @@
443
443
  </fo:block-container>
444
444
  </xsl:if>
445
445
 
446
- <xsl:if test="//ogc:figure[@id and ogc:name]">
446
+ <xsl:if test="//ogc:figure[@id and ogc:name and contains(ogc:name, '—')]">
447
447
  <xsl:variable name="title-list-figures">
448
448
  <xsl:call-template name="getTitle">
449
449
  <xsl:with-param name="name" select="'title-list-figures'"/>
@@ -458,8 +458,8 @@
458
458
  </fo:block-container>
459
459
 
460
460
  <fo:block-container line-height="130%">
461
- <xsl:for-each select="//ogc:figure[@id and ogc:name]">
462
- <fo:block text-align-last="justify" margin-top="2pt">
461
+ <xsl:for-each select="//ogc:figure[@id and ogc:name and contains(ogc:name, '—')]">
462
+ <fo:block text-align-last="justify" margin-top="2pt" role="TOCI">
463
463
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{ogc:name}">
464
464
  <xsl:apply-templates select="ogc:name" mode="contents"/>
465
465
  <fo:inline keep-together.within-line="always">
@@ -492,7 +492,7 @@
492
492
  <!-- <xsl:for-each select="//ogc:permission[@id and ogc:name] | //ogc:recommendation[@id and ogc:name] | //ogc:requirement[@id and ogc:name]"> -->
493
493
  <xsl:for-each select="//ogc:table[.//ogc:p[@class = 'RecommendationTitle']]">
494
494
  <xsl:variable name="table_id" select="@id"/>
495
- <fo:block text-align-last="justify" margin-top="6pt">
495
+ <fo:block text-align-last="justify" margin-top="6pt" role="TOCI">
496
496
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{.//ogc:p[@class = 'RecommendationTitle'][1]/text()}">
497
497
  <xsl:apply-templates select=".//ogc:p[@class = 'RecommendationTitle'][ancestor::ogc:table[1][@id= $table_id]]/node()"/>
498
498
  <xsl:text> </xsl:text>
@@ -579,7 +579,7 @@
579
579
  <xsl:value-of select="translate(., $thinspace, ' ')"/>
580
580
  </xsl:template>
581
581
 
582
- <xsl:template match="text()" priority="3" mode="contents">
582
+ <xsl:template match="ogc:title//text() | ogc:name//text()" priority="3" mode="contents">
583
583
  <xsl:value-of select="translate(., $thinspace, ' ')"/>
584
584
  </xsl:template>
585
585
 
@@ -587,7 +587,9 @@
587
587
  <xsl:variable name="content">
588
588
  <xsl:call-template name="add-zero-spaces"/>
589
589
  </xsl:variable>
590
- <xsl:value-of select="translate($content, $thinspace, ' ')"/>
590
+ <!-- add zero-width space in the words like 'adeOfAbstractTransportaonSpace' to split it in the table's cell -->
591
+ <xsl:variable name="content2" select="java:replaceAll(java:java.lang.String.new($content),'([a-z]{2,})([A-Z])(.?)','$1​$2$3')"/>
592
+ <xsl:value-of select="translate($content2, $thinspace, ' ')"/>
591
593
  </xsl:template>
592
594
 
593
595
 
@@ -739,14 +741,20 @@
739
741
  </fo:block>
740
742
  </xsl:template>
741
743
 
742
- <xsl:template match="ogc:license-statement//ogc:title">
743
- <fo:block font-weight="bold" color="{$color_blue}">
744
+ <xsl:template match="ogc:license-statement//ogc:title">
745
+ <xsl:variable name="level">
746
+ <xsl:call-template name="getLevel"/>
747
+ </xsl:variable>
748
+ <fo:block font-weight="bold" color="{$color_blue}" role="H{$level}">
744
749
  <xsl:apply-templates/>
745
750
  </fo:block>
746
751
  </xsl:template>
747
752
 
748
753
  <xsl:template match="ogc:copyright-statement//ogc:title">
749
- <fo:block font-weight="bold" color="{$color_blue}" margin-top="24pt">
754
+ <xsl:variable name="level">
755
+ <xsl:call-template name="getLevel"/>
756
+ </xsl:variable>
757
+ <fo:block font-weight="bold" color="{$color_blue}" margin-top="24pt" role="H{$level}">
750
758
  <xsl:apply-templates/>
751
759
  </fo:block>
752
760
  </xsl:template>
@@ -764,7 +772,10 @@
764
772
  </xsl:template>
765
773
 
766
774
  <xsl:template match="ogc:legal-statement//ogc:title">
767
- <fo:inline font-weight="bold">
775
+ <xsl:variable name="level">
776
+ <xsl:call-template name="getLevel"/>
777
+ </xsl:variable>
778
+ <fo:inline font-weight="bold" role="H{$level}">
768
779
  <xsl:apply-templates/><xsl:text>: </xsl:text>
769
780
  </fo:inline>
770
781
  </xsl:template>
@@ -839,7 +850,7 @@
839
850
  <xsl:when test="$level = 1">
840
851
  <fo:block-container margin-left="-22mm">
841
852
  <fo:block-container margin-left="0mm">
842
- <fo:block margin-bottom="10pt" space-before="36pt" keep-with-next="always">
853
+ <fo:block margin-bottom="10pt" space-before="36pt" keep-with-next="always" role="H{$level}">
843
854
  <fo:table table-layout="fixed" width="100%">
844
855
  <fo:table-column column-width="22mm"/>
845
856
  <fo:table-column column-width="158mm"/>
@@ -883,7 +894,7 @@
883
894
  </fo:block-container>
884
895
  </xsl:when>
885
896
  <xsl:when test="$level = 2">
886
- <fo:block space-before="24pt" margin-bottom="10pt">
897
+ <fo:block space-before="24pt" margin-bottom="10pt" role="H{$level}">
887
898
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
888
899
  <xsl:variable name="title">
889
900
  <xsl:choose>
@@ -899,18 +910,21 @@
899
910
  <xsl:call-template name="insertSectionTitle">
900
911
  <xsl:with-param name="section" select="$section"/>
901
912
  <xsl:with-param name="title" select="$title"/>
913
+ <xsl:with-param name="level" select="$level"/>
902
914
  </xsl:call-template>
903
915
  </fo:block>
904
916
  </xsl:when>
905
917
  <xsl:otherwise>
906
918
  <xsl:element name="{$element-name}">
907
919
  <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
908
- <xsl:attribute name="font-weight"><xsl:value-of select="$font-weight"/></xsl:attribute>
909
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
910
- <xsl:attribute name="margin-top">30pt</xsl:attribute>
911
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
912
- <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
920
+ <xsl:attribute name="font-weight"><xsl:value-of select="$font-weight"/></xsl:attribute>
921
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
922
+ <xsl:attribute name="margin-top">30pt</xsl:attribute>
923
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
924
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
925
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
913
926
  <xsl:apply-templates/>
927
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
914
928
  </xsl:element>
915
929
  </xsl:otherwise>
916
930
  </xsl:choose>
@@ -1044,7 +1058,13 @@
1044
1058
  <xsl:template match="ogc:ul | ogc:ol" mode="ul_ol">
1045
1059
  <fo:block-container margin-left="13mm">
1046
1060
  <xsl:if test="ancestor::ogc:table">
1047
- <xsl:attribute name="margin-left">1.5mm</xsl:attribute>
1061
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
1062
+ </xsl:if>
1063
+ <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol">
1064
+ <xsl:attribute name="margin-top">10pt</xsl:attribute>
1065
+ <xsl:if test="ancestor::ogc:table">
1066
+ <xsl:attribute name="margin-top">1mm</xsl:attribute>
1067
+ </xsl:if>
1048
1068
  </xsl:if>
1049
1069
  <fo:block-container margin-left="0mm">
1050
1070
  <fo:list-block provisional-distance-between-starts="12mm" space-after="12pt" line-height="115%">
@@ -1053,6 +1073,9 @@
1053
1073
  </xsl:if>
1054
1074
  <xsl:if test="ancestor::ogc:ul | ancestor::ogc:ol">
1055
1075
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1076
+ <xsl:if test="ancestor::ogc:table[not(@class)]">
1077
+ <xsl:attribute name="space-after">1mm</xsl:attribute>
1078
+ </xsl:if>
1056
1079
  </xsl:if>
1057
1080
  <xsl:if test="following-sibling::*[1][local-name() = 'ul' or local-name() = 'ol']">
1058
1081
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -1080,17 +1103,22 @@
1080
1103
  <xsl:number format="a)" lang="en"/>
1081
1104
  </xsl:when>
1082
1105
  <xsl:when test="../@type = 'alphabet'">
1083
- <xsl:number format="1)"/>
1106
+ <xsl:number format="1."/>
1084
1107
  </xsl:when>
1085
1108
  <xsl:when test="../@type = 'alphabet_upper'">
1086
1109
  <xsl:number format="A)" lang="en"/>
1087
1110
  </xsl:when>
1088
-
1089
1111
  <xsl:when test="../@type = 'roman'">
1090
1112
  <xsl:number format="i)"/>
1091
1113
  </xsl:when>
1092
1114
  <xsl:otherwise>
1093
- <xsl:number format="1)"/>
1115
+ <xsl:variable name="level" select="count(ancestor-or-self::ogc:li)"/>
1116
+ <xsl:choose>
1117
+ <xsl:when test="$level = 1"><xsl:number format="a)" lang="en"/></xsl:when>
1118
+ <xsl:when test="$level = 2"><xsl:number format="1."/></xsl:when>
1119
+ <xsl:when test="$level = 3"><xsl:number format="i)"/></xsl:when>
1120
+ <xsl:otherwise><xsl:number format="a)" lang="en"/></xsl:otherwise>
1121
+ </xsl:choose>
1094
1122
  </xsl:otherwise>
1095
1123
  </xsl:choose>
1096
1124
  </xsl:otherwise>
@@ -1099,6 +1127,12 @@
1099
1127
  </fo:list-item-label>
1100
1128
  <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
1101
1129
  <fo:block margin-bottom="10pt">
1130
+ <xsl:if test="ancestor::ogc:table[not(@class)]">
1131
+ <xsl:attribute name="margin-bottom">1mm</xsl:attribute>
1132
+ </xsl:if>
1133
+ <xsl:if test="not(following-sibling::*) and not(../following-sibling::*)">
1134
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1135
+ </xsl:if>
1102
1136
  <xsl:apply-templates/>
1103
1137
  </fo:block>
1104
1138
  </fo:list-item-body>
@@ -1118,7 +1152,10 @@
1118
1152
  </xsl:template>
1119
1153
 
1120
1154
  <xsl:template match="ogc:term/ogc:name" priority="2">
1121
- <fo:block space-before="36pt" margin-bottom="10pt" keep-with-next="always">
1155
+ <xsl:variable name="levelTerm">
1156
+ <xsl:call-template name="getLevelTermName"/>
1157
+ </xsl:variable>
1158
+ <fo:block space-before="36pt" margin-bottom="10pt" keep-with-next="always" role="H{$levelTerm}">
1122
1159
  <fo:block color="{$color_blue}" keep-with-next="always">
1123
1160
  <fo:inline font-size="18pt" padding-right="1mm"><xsl:apply-templates/></fo:inline>
1124
1161
  <xsl:apply-templates select="../ogc:preferred | ../ogc:deprecated | ../ogc:admitted" mode="term_name"/>
@@ -1244,7 +1281,6 @@
1244
1281
 
1245
1282
  <xsl:template match="ogc:figure" priority="2">
1246
1283
  <fo:block-container id="{@id}" margin-top="12pt" margin-bottom="12pt">
1247
- <xsl:apply-templates select="ogc:name" mode="presentation"/>
1248
1284
  <fo:block>
1249
1285
  <xsl:apply-templates/>
1250
1286
  </fo:block>
@@ -1252,6 +1288,7 @@
1252
1288
  <xsl:for-each select="ogc:note">
1253
1289
  <xsl:call-template name="note"/>
1254
1290
  </xsl:for-each>
1291
+ <xsl:apply-templates select="ogc:name" mode="presentation"/>
1255
1292
  </fo:block-container>
1256
1293
  </xsl:template>
1257
1294
 
@@ -1263,7 +1300,7 @@
1263
1300
 
1264
1301
  <xsl:template name="insertHeaderFooter">
1265
1302
  <xsl:param name="color" select="$color_blue"/>
1266
- <fo:static-content flow-name="footer">
1303
+ <fo:static-content flow-name="footer" role="artifact">
1267
1304
  <fo:block-container font-size="8pt" height="100%" color="{$color}" padding-top="6mm">
1268
1305
  <fo:table table-layout="fixed" width="100%">
1269
1306
  <fo:table-column column-width="90%"/>
@@ -1412,6 +1449,7 @@
1412
1449
  <xsl:template name="insertSectionTitle">
1413
1450
  <xsl:param name="section"/>
1414
1451
  <xsl:param name="title"/>
1452
+ <xsl:param name="level">1</xsl:param>
1415
1453
  <fo:block>
1416
1454
  <fo:block font-size="18pt" color="{$color_blue}" keep-with-next="always" line-height="150%">
1417
1455
  <xsl:if test="$section != ''">
@@ -1422,7 +1460,30 @@
1422
1460
  </xsl:call-template>
1423
1461
  </fo:inline>
1424
1462
  </xsl:if>
1425
- <xsl:apply-templates select="xalan:nodeset($title)" mode="titlesmall"/>
1463
+ <xsl:choose>
1464
+ <xsl:when test="$level = 1">
1465
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="titlesmall"/>
1466
+ </xsl:when>
1467
+ <xsl:otherwise>
1468
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="titlesimple"/>
1469
+ </xsl:otherwise>
1470
+ </xsl:choose>
1471
+
1472
+ <xsl:variable name="variant-title">
1473
+ <xsl:choose>
1474
+ <xsl:when test="$level = 1">
1475
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="titlesmall"/>
1476
+ </xsl:when>
1477
+ <xsl:otherwise>
1478
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="titlesimple"/>
1479
+ </xsl:otherwise>
1480
+ </xsl:choose>
1481
+ </xsl:variable>
1482
+ <xsl:if test="normalize-space($variant-title) != ''">
1483
+ <fo:inline padding-right="5mm"> </fo:inline>
1484
+ <fo:inline><xsl:copy-of select="$variant-title"/></fo:inline>
1485
+ </xsl:if>
1486
+
1426
1487
  </fo:block>
1427
1488
  <xsl:call-template name="insertOrangeHorizontalLine"/>
1428
1489
  </fo:block>
@@ -1435,25 +1496,59 @@
1435
1496
  </xsl:call-template>
1436
1497
  </xsl:template>
1437
1498
 
1499
+ <xsl:template match="text()" mode="titlesimple">
1500
+ <xsl:value-of select="."/>
1501
+ </xsl:template>
1502
+
1438
1503
  <xsl:template match="ogc:strong" mode="titlesmall">
1439
1504
  <xsl:apply-templates mode="titlesmall"/>
1440
1505
  </xsl:template>
1506
+ <xsl:template match="ogc:strong" mode="titlesimple">
1507
+ <xsl:apply-templates mode="titlesimple"/>
1508
+ </xsl:template>
1441
1509
 
1442
1510
  <xsl:template match="ogc:em" mode="titlesmall">
1443
1511
  <fo:inline font-style="italic"><xsl:apply-templates mode="titlesmall"/></fo:inline>
1444
1512
  </xsl:template>
1513
+ <xsl:template match="ogc:em" mode="titlesimple">
1514
+ <fo:inline font-style="italic"><xsl:apply-templates mode="titlesimple"/></fo:inline>
1515
+ </xsl:template>
1445
1516
 
1446
1517
  <xsl:template match="ogc:fn" mode="titlesmall">
1447
1518
  <xsl:call-template name="fn"/>
1448
1519
  </xsl:template>
1520
+ <xsl:template match="ogc:fn" mode="titlesimple">
1521
+ <xsl:call-template name="fn"/>
1522
+ </xsl:template>
1449
1523
  <xsl:template match="ogc:tab " mode="titlesmall">
1450
1524
  <xsl:apply-templates select="."/>
1451
1525
  </xsl:template>
1526
+ <xsl:template match="ogc:tab " mode="titlesimple">
1527
+ <xsl:apply-templates select="."/>
1528
+ </xsl:template>
1452
1529
 
1453
1530
  <xsl:template match="ogc:br" mode="titlesmall">
1454
1531
  <xsl:value-of select="$linebreak"/>
1455
1532
  </xsl:template>
1456
-
1533
+ <xsl:template match="ogc:br" mode="titlesimple">
1534
+ <xsl:value-of select="$linebreak"/>
1535
+ </xsl:template>
1536
+
1537
+ <xsl:template match="*[local-name() = 'name']/text()[1]" priority="2">
1538
+ <!-- 0xA0 to space replacement -->
1539
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
1540
+ <xsl:variable name="separator" select="' — '"/>
1541
+ <xsl:choose>
1542
+ <xsl:when test="contains($text, $separator)">
1543
+ <fo:inline font-weight="bold"><xsl:value-of select="substring-before($text, $separator)"/></fo:inline>
1544
+ <xsl:value-of select="$separator"/>
1545
+ <xsl:value-of select="substring-after($text, $separator)"/>
1546
+ </xsl:when>
1547
+ <xsl:otherwise>
1548
+ <xsl:value-of select="$text"/>
1549
+ </xsl:otherwise>
1550
+ </xsl:choose>
1551
+ </xsl:template>
1457
1552
 
1458
1553
  <xsl:template name="insertOrangeHorizontalLine">
1459
1554
  <fo:block-container width="12.7mm" border-top="1pt solid {$color_orange}" margin-top="3mm">
@@ -1640,6 +1735,7 @@
1640
1735
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1641
1736
  <xsl:attribute name="white-space">pre</xsl:attribute>
1642
1737
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1738
+ <xsl:attribute name="role">Code</xsl:attribute>
1643
1739
 
1644
1740
 
1645
1741
 
@@ -1691,8 +1787,13 @@
1691
1787
 
1692
1788
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1693
1789
 
1694
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1695
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1790
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1791
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1792
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1793
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1794
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1795
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1796
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1696
1797
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1697
1798
 
1698
1799
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -1806,6 +1907,7 @@
1806
1907
  <xsl:attribute name="text-align">left</xsl:attribute>
1807
1908
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1808
1909
  <xsl:attribute name="font-weight">normal</xsl:attribute>
1910
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
1809
1911
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1810
1912
 
1811
1913
 
@@ -1885,6 +1987,11 @@
1885
1987
 
1886
1988
 
1887
1989
 
1990
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
1991
+
1992
+
1993
+
1994
+
1888
1995
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1889
1996
 
1890
1997
 
@@ -1921,7 +2028,8 @@
1921
2028
 
1922
2029
 
1923
2030
 
1924
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
2031
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
2032
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1925
2033
 
1926
2034
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1927
2035
  <xsl:attribute name="margin-left">13mm</xsl:attribute>
@@ -1964,9 +2072,14 @@
1964
2072
 
1965
2073
 
1966
2074
 
1967
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
1968
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1969
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2075
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
2076
+ <!-- <xsl:attribute name="margin-top">12pt</xsl:attribute> -->
2077
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2078
+ <!-- <xsl:attribute name="margin-bottom">6pt</xsl:attribute> -->
2079
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2080
+ <!-- <xsl:attribute name="keep-with-next">always</xsl:attribute> -->
2081
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2082
+ <xsl:attribute name="text-align">center</xsl:attribute>
1970
2083
 
1971
2084
 
1972
2085
 
@@ -2060,13 +2173,20 @@
2060
2173
 
2061
2174
  </xsl:attribute-set><xsl:attribute-set name="list-style">
2062
2175
 
2063
- </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">
2176
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
2177
+ <xsl:attribute name="line-height">135%</xsl:attribute>
2178
+ </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="OLD_processPrefaceSectionsDefault_Contents">
2064
2179
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2065
2180
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2066
2181
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
2067
2182
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
2068
2183
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
2069
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2184
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
2185
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2186
+ <xsl:sort select="@displayorder" data-type="number"/>
2187
+ <xsl:apply-templates select="." mode="contents"/>
2188
+ </xsl:for-each>
2189
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
2070
2190
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
2071
2191
 
2072
2192
  <!-- Normative references -->
@@ -2079,13 +2199,33 @@
2079
2199
  <!-- Bibliography -->
2080
2200
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
2081
2201
 
2082
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2202
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2203
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2204
+ <xsl:sort select="@displayorder" data-type="number"/>
2205
+ <xsl:apply-templates select="." mode="contents"/>
2206
+ </xsl:for-each>
2207
+
2208
+ <xsl:for-each select="/*/*[local-name()='annex']">
2209
+ <xsl:sort select="@displayorder" data-type="number"/>
2210
+ <xsl:apply-templates select="." mode="contents"/>
2211
+ </xsl:for-each>
2212
+
2213
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2214
+ <xsl:sort select="@displayorder" data-type="number"/>
2215
+ <xsl:apply-templates select="." mode="contents"/>
2216
+ </xsl:for-each>
2217
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
2083
2218
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
2084
2219
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
2085
2220
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
2086
2221
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
2087
2222
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
2088
- </xsl:template><xsl:template name="processMainSectionsDefault">
2223
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2224
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2225
+ <xsl:sort select="@displayorder" data-type="number"/>
2226
+ <xsl:apply-templates select="."/>
2227
+ </xsl:for-each>
2228
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
2089
2229
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
2090
2230
 
2091
2231
  <!-- Normative references -->
@@ -2097,6 +2237,22 @@
2097
2237
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
2098
2238
  <!-- Bibliography -->
2099
2239
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
2240
+ </xsl:template><xsl:template name="processMainSectionsDefault">
2241
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2242
+ <xsl:sort select="@displayorder" data-type="number"/>
2243
+ <xsl:apply-templates select="."/>
2244
+
2245
+ </xsl:for-each>
2246
+
2247
+ <xsl:for-each select="/*/*[local-name()='annex']">
2248
+ <xsl:sort select="@displayorder" data-type="number"/>
2249
+ <xsl:apply-templates select="."/>
2250
+ </xsl:for-each>
2251
+
2252
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2253
+ <xsl:sort select="@displayorder" data-type="number"/>
2254
+ <xsl:apply-templates select="."/>
2255
+ </xsl:for-each>
2100
2256
  </xsl:template><xsl:template match="text()">
2101
2257
  <xsl:value-of select="."/>
2102
2258
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -2129,7 +2285,9 @@
2129
2285
 
2130
2286
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2131
2287
 
2132
-
2288
+
2289
+
2290
+
2133
2291
 
2134
2292
  <xsl:call-template name="fn_name_display"/>
2135
2293
 
@@ -2922,6 +3080,8 @@
2922
3080
 
2923
3081
 
2924
3082
  <xsl:attribute name="border">solid 0pt white</xsl:attribute>
3083
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
3084
+ <xsl:attribute name="padding-bottom">1mm</xsl:attribute>
2925
3085
 
2926
3086
 
2927
3087
 
@@ -2964,9 +3124,8 @@
2964
3124
 
2965
3125
  <!-- Table's note name (NOTE, for example) -->
2966
3126
 
2967
- <fo:inline padding-right="2mm">
3127
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
2968
3128
 
2969
-
2970
3129
 
2971
3130
 
2972
3131
 
@@ -3594,6 +3753,8 @@
3594
3753
  <xsl:if test="$font-size != ''">
3595
3754
  <xsl:attribute name="font-size">
3596
3755
  <xsl:choose>
3756
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3757
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3597
3758
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3598
3759
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3599
3760
  </xsl:choose>
@@ -4028,16 +4189,68 @@
4028
4189
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4029
4190
  </xsl:call-template>
4030
4191
 
4192
+
4193
+
4031
4194
  <xsl:variable name="mathml">
4032
4195
  <xsl:apply-templates select="." mode="mathml"/>
4033
4196
  </xsl:variable>
4034
4197
  <fo:instream-foreign-object fox:alt-text="Math">
4035
4198
 
4036
4199
 
4200
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4201
+ <xsl:variable name="comment_text_">
4202
+ <xsl:choose>
4203
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4204
+ <xsl:value-of select="$comment_text_following"/>
4205
+ </xsl:when>
4206
+ <xsl:otherwise>
4207
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4208
+ </xsl:otherwise>
4209
+ </xsl:choose>
4210
+ </xsl:variable>
4211
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4212
+
4213
+ <xsl:if test="normalize-space($comment_text) != ''">
4214
+ <!-- put Mathin Alternate Text -->
4215
+ <xsl:attribute name="fox:alt-text">
4216
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4217
+ </xsl:attribute>
4218
+ </xsl:if>
4219
+
4220
+ <xsl:variable name="mathml_content">
4221
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4222
+ </xsl:variable>
4223
+ <!-- put MathML in Actual Text -->
4224
+ <xsl:attribute name="fox:actual-text">
4225
+ <xsl:value-of select="$mathml_content"/>
4226
+ </xsl:attribute>
4227
+
4228
+
4037
4229
  <!-- <xsl:copy-of select="."/> -->
4038
4230
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4039
4231
  </fo:instream-foreign-object>
4040
4232
  </fo:inline>
4233
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4234
+ <!-- <xsl:text>a+b</xsl:text> -->
4235
+ <xsl:text>&lt;</xsl:text>
4236
+ <xsl:value-of select="local-name()"/>
4237
+ <xsl:if test="local-name() = 'math'">
4238
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
4239
+ </xsl:if>
4240
+ <xsl:for-each select="@*">
4241
+ <xsl:text> </xsl:text>
4242
+ <xsl:value-of select="local-name()"/>
4243
+ <xsl:text>="</xsl:text>
4244
+ <xsl:value-of select="."/>
4245
+ <xsl:text>"</xsl:text>
4246
+ </xsl:for-each>
4247
+ <xsl:text>&gt;</xsl:text>
4248
+ <xsl:apply-templates mode="mathml_actual_text"/>
4249
+ <xsl:text>&lt;/</xsl:text>
4250
+ <xsl:value-of select="local-name()"/>
4251
+ <xsl:text>&gt;</xsl:text>
4252
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
4253
+ <xsl:value-of select="normalize-space()"/>
4041
4254
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
4042
4255
  <xsl:copy>
4043
4256
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -4099,7 +4312,10 @@
4099
4312
  </fo:block>
4100
4313
  <xsl:apply-templates/>
4101
4314
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4102
- <fo:inline><xsl:apply-templates/></fo:inline>
4315
+ <xsl:variable name="level">
4316
+ <xsl:call-template name="getLevel"/>
4317
+ </xsl:variable>
4318
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
4103
4319
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
4104
4320
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
4105
4321
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4134,9 +4350,10 @@
4134
4350
 
4135
4351
  </xsl:variable>
4136
4352
 
4353
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4137
4354
  <xsl:choose>
4138
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4139
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4355
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
4356
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
4140
4357
  </xsl:choose>
4141
4358
  <xsl:apply-templates/>
4142
4359
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -4288,7 +4505,10 @@
4288
4505
  </fo:block>
4289
4506
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
4290
4507
  <xsl:if test="normalize-space() != ''">
4291
- <fo:inline>
4508
+ <xsl:variable name="level">
4509
+ <xsl:call-template name="getLevelTermName"/>
4510
+ </xsl:variable>
4511
+ <fo:inline role="H{$level}">
4292
4512
  <xsl:apply-templates/>
4293
4513
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
4294
4514
  <xsl:text>.</xsl:text>
@@ -4589,6 +4809,13 @@
4589
4809
  </xsl:attribute>
4590
4810
  <xsl:apply-templates mode="svg_update"/>
4591
4811
  </xsl:copy>
4812
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
4813
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4814
+ <xsl:for-each select="*[local-name() = 'svg']">
4815
+ <xsl:call-template name="image_svg">
4816
+ <xsl:with-param name="name" select="$name"/>
4817
+ </xsl:call-template>
4818
+ </xsl:for-each>
4592
4819
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4593
4820
  <xsl:variable name="svg_content" select="document(@src)"/>
4594
4821
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4693,7 +4920,7 @@
4693
4920
  </fo:basic-link>
4694
4921
  </fo:block>
4695
4922
  </fo:block-container>
4696
- </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">
4923
+ </xsl:template><xsl:template match="*[local-name() = 'emf']"/><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">
4697
4924
  <xsl:apply-templates mode="contents"/>
4698
4925
  <xsl:text> </xsl:text>
4699
4926
  </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">
@@ -4962,6 +5189,7 @@
4962
5189
  </xsl:when>
4963
5190
  <xsl:otherwise>
4964
5191
  <xsl:apply-templates/>
5192
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4965
5193
  </xsl:otherwise>
4966
5194
  </xsl:choose>
4967
5195
  </fo:block>
@@ -5034,12 +5262,16 @@
5034
5262
  <xsl:if test="$font-size != ''">
5035
5263
  <xsl:attribute name="font-size">
5036
5264
  <xsl:choose>
5265
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
5266
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
5037
5267
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
5038
5268
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
5039
5269
  </xsl:choose>
5040
5270
  </xsl:attribute>
5041
5271
  </xsl:if>
5042
5272
 
5273
+
5274
+
5043
5275
  <xsl:apply-templates/>
5044
5276
  </fo:block>
5045
5277
 
@@ -5110,14 +5342,6 @@
5110
5342
  <fo:block>
5111
5343
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
5112
5344
  </fo:block>
5113
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5114
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
5115
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5116
- </fo:block>
5117
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
5118
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
5119
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5120
- </fo:block>
5121
5345
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
5122
5346
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
5123
5347
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -5134,6 +5358,38 @@
5134
5358
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
5135
5359
  <xsl:apply-templates/>
5136
5360
  </fo:block>
5361
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5362
+ <fo:block xsl:use-attribute-sets="subject-style">
5363
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5364
+ </fo:block>
5365
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
5366
+ <fo:block xsl:use-attribute-sets="subject-style">
5367
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5368
+ </fo:block>
5369
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
5370
+ <fo:block xsl:use-attribute-sets="inherit-style">
5371
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5372
+ </fo:block>
5373
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
5374
+ <fo:block xsl:use-attribute-sets="description-style">
5375
+ <xsl:apply-templates/>
5376
+ </fo:block>
5377
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
5378
+ <fo:block xsl:use-attribute-sets="specification-style">
5379
+ <xsl:apply-templates/>
5380
+ </fo:block>
5381
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
5382
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
5383
+ <xsl:apply-templates/>
5384
+ </fo:block>
5385
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
5386
+ <fo:block xsl:use-attribute-sets="verification-style">
5387
+ <xsl:apply-templates/>
5388
+ </fo:block>
5389
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
5390
+ <fo:block xsl:use-attribute-sets="import-style">
5391
+ <xsl:apply-templates/>
5392
+ </fo:block>
5137
5393
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
5138
5394
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
5139
5395
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -5395,14 +5651,15 @@
5395
5651
  </xsl:if>
5396
5652
  </xsl:template><xsl:variable name="localized.source">
5397
5653
  <xsl:call-template name="getLocalizedString">
5398
- <xsl:with-param name="key">source</xsl:with-param>
5399
- </xsl:call-template>
5654
+ <xsl:with-param name="key">source</xsl:with-param>
5655
+ </xsl:call-template>
5400
5656
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5401
5657
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5402
5658
  <xsl:if test="normalize-space(@citeas) = ''">
5403
5659
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5404
5660
  </xsl:if>
5405
5661
 
5662
+ <xsl:text>[</xsl:text>
5406
5663
  <fo:inline>
5407
5664
 
5408
5665
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -5412,18 +5669,18 @@
5412
5669
 
5413
5670
 
5414
5671
 
5415
-
5416
- <xsl:call-template name="getTitle">
5417
- <xsl:with-param name="name" select="'title-source'"/>
5418
- </xsl:call-template>
5672
+ <xsl:value-of select="$localized.source"/>
5419
5673
  <xsl:text>: </xsl:text>
5420
5674
 
5421
5675
 
5676
+
5677
+
5422
5678
  </fo:inline>
5423
5679
 
5424
5680
  <fo:inline xsl:use-attribute-sets="origin-style">
5425
5681
  <xsl:apply-templates/>
5426
5682
  </fo:inline>
5683
+ <xsl:text>]</xsl:text>
5427
5684
  </fo:basic-link>
5428
5685
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5429
5686
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -5490,6 +5747,9 @@
5490
5747
 
5491
5748
  </xsl:if>
5492
5749
 
5750
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
5751
+ <xsl:variable name="text" select="normalize-space()"/>
5752
+
5493
5753
 
5494
5754
 
5495
5755
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -5503,7 +5763,9 @@
5503
5763
 
5504
5764
 
5505
5765
  </xsl:if>
5506
-
5766
+
5767
+
5768
+
5507
5769
  <xsl:apply-templates/>
5508
5770
  </fo:basic-link>
5509
5771
 
@@ -5841,6 +6103,7 @@
5841
6103
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5842
6104
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5843
6105
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6106
+
5844
6107
  <xsl:apply-templates/>
5845
6108
  </fo:block>
5846
6109
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -6151,6 +6414,97 @@
6151
6414
  <fo:block-container border="1pt solid black" width="50%">
6152
6415
  <fo:block> </fo:block>
6153
6416
  </fo:block-container>
6417
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
6418
+ <xsl:param name="colwidths"/>
6419
+ <xsl:variable name="colwidths_">
6420
+ <xsl:choose>
6421
+ <xsl:when test="not($colwidths)">
6422
+ <xsl:variable name="toc_table_simple">
6423
+ <tbody>
6424
+ <xsl:apply-templates mode="toc_table_width"/>
6425
+ </tbody>
6426
+ </xsl:variable>
6427
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
6428
+ <xsl:call-template name="calculate-column-widths">
6429
+ <xsl:with-param name="cols-count" select="$cols-count"/>
6430
+ <xsl:with-param name="table" select="$toc_table_simple"/>
6431
+ </xsl:call-template>
6432
+ </xsl:when>
6433
+ <xsl:otherwise>
6434
+ <xsl:copy-of select="$colwidths"/>
6435
+ </xsl:otherwise>
6436
+ </xsl:choose>
6437
+ </xsl:variable>
6438
+ <fo:block role="TOCI" space-after="16pt">
6439
+ <fo:table width="100%" table-layout="fixed">
6440
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
6441
+ <fo:table-column column-width="proportional-column-width({.})"/>
6442
+ </xsl:for-each>
6443
+ <fo:table-body>
6444
+ <xsl:apply-templates/>
6445
+ </fo:table-body>
6446
+ </fo:table>
6447
+ </fo:block>
6448
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
6449
+ <fo:table-row min-height="5mm">
6450
+ <xsl:apply-templates/>
6451
+ </fo:table-row>
6452
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
6453
+ <xsl:apply-templates/>
6454
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
6455
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
6456
+ <xsl:variable name="target" select="@target"/>
6457
+ <xsl:for-each select="*[local-name() = 'tab']">
6458
+ <xsl:variable name="current_id" select="generate-id()"/>
6459
+ <fo:table-cell>
6460
+ <fo:block>
6461
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
6462
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
6463
+ <xsl:choose>
6464
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6465
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
6466
+ </xsl:choose>
6467
+ </xsl:for-each>
6468
+ </fo:basic-link>
6469
+ </fo:block>
6470
+ </fo:table-cell>
6471
+ </xsl:for-each>
6472
+ <!-- last column - for page numbers -->
6473
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
6474
+ <fo:block>
6475
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
6476
+ <fo:page-number-citation ref-id="{$target}"/>
6477
+ </fo:basic-link>
6478
+ </fo:block>
6479
+ </fo:table-cell>
6480
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
6481
+ <xsl:apply-templates mode="toc_table_width"/>
6482
+ </xsl:template><xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'clause'][not(@type = 'toc')]/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'li']" mode="toc_table_width">
6483
+ <tr>
6484
+ <xsl:apply-templates mode="toc_table_width"/>
6485
+ </tr>
6486
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
6487
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
6488
+ <xsl:for-each select="*[local-name() = 'tab']">
6489
+ <xsl:variable name="current_id" select="generate-id()"/>
6490
+ <td>
6491
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
6492
+ <xsl:copy-of select="."/>
6493
+ </xsl:for-each>
6494
+ </td>
6495
+ </xsl:for-each>
6496
+ <td>333</td> <!-- page number, just for fill -->
6497
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6498
+ <fo:inline padding-right="5mm"> </fo:inline>
6499
+ <fo:inline><xsl:apply-templates/></fo:inline>
6500
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
6501
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
6502
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
6503
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
6504
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
6505
+ </svg>
6506
+ </fo:instream-foreign-object>
6507
+ </fo:inline>
6154
6508
  </xsl:template><xsl:template name="convertDate">
6155
6509
  <xsl:param name="date"/>
6156
6510
  <xsl:param name="format" select="'short'"/>
@@ -6389,6 +6743,26 @@
6389
6743
  <xsl:value-of select="$level"/>
6390
6744
  </xsl:otherwise>
6391
6745
  </xsl:choose>
6746
+ </xsl:template><xsl:template name="getLevelTermName">
6747
+ <xsl:choose>
6748
+ <xsl:when test="normalize-space(../@depth) != ''">
6749
+ <xsl:value-of select="../@depth"/>
6750
+ </xsl:when>
6751
+ <xsl:otherwise>
6752
+ <xsl:variable name="title_level_">
6753
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
6754
+ <xsl:call-template name="getLevel"/>
6755
+ </xsl:for-each>
6756
+ </xsl:variable>
6757
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
6758
+ <xsl:choose>
6759
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
6760
+ <xsl:otherwise>
6761
+ <xsl:call-template name="getLevel"/>
6762
+ </xsl:otherwise>
6763
+ </xsl:choose>
6764
+ </xsl:otherwise>
6765
+ </xsl:choose>
6392
6766
  </xsl:template><xsl:template name="split">
6393
6767
  <xsl:param name="pText" select="."/>
6394
6768
  <xsl:param name="sep" select="','"/>