metanorma-ogc 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa7220c37ec4c4f57f175cc19ded9faa15b4cef238107d9dbf20fed3350e7964
4
- data.tar.gz: 652a56390a308dc6d52c991b6492fbc733275a87b64bdc3b7ebcfd33519e7743
3
+ metadata.gz: 6d485aa36153e193dceebf844193f8042fce9db6ce93b00e66ac43e7755a541e
4
+ data.tar.gz: '0692880332b57c821956e5d9ec5e3dd3ddf94e33f8b6b92f8f16b89f72bae1b9'
5
5
  SHA512:
6
- metadata.gz: a6374615ac10104cb610e08015f44df88f2ba8a2d11f9830dc91cc4055a881d240d50a54f2db3fb253de8ff00a1900cfc4a6e76db5867b939c15b9abf791db35
7
- data.tar.gz: e0c934e414bae2c2749033a9b62add64765d0adc44f72711f97c8f48eb1e15ccf311a5c46d7538cdaf5f91acfd39b2e13ab91432a41e593543090b19eb87aa71
6
+ metadata.gz: f6d4d7d832023e182ef9f0bbe2a4603a5827f7667131f3a27cdc3ebd1a57917483011396f67b160ac91d65576d6d04a73fee200064f2caf0d10736ece807d51c
7
+ data.tar.gz: 846eb44d909ef21e3a08b3bddcb4171271a92dd65cf4c9d208dac02154228ac1b18699d2a71c0e1e7bc2a7912160dc815429bf5a80873591e0ae3708d5ca1693
@@ -74,23 +74,28 @@ module Asciidoctor
74
74
  end
75
75
 
76
76
  def requirement_metadata_component_tags
77
- %w(test-purpose test-method conditions part description reference
78
- requirement permission recommendation)
77
+ %w(test-purpose test-method test-method-type conditions part description
78
+ reference step requirement permission recommendation)
79
79
  end
80
80
 
81
- def requirement_metadata1(reqt, dlist)
82
- ins = super
81
+ def requirement_metadata1(reqt, dlist, ins)
82
+ ins1 = super
83
83
  dlist.xpath("./dt").each do |e|
84
- next unless requirement_metadata_component_tags.include? e.text
84
+ tag = e&.text&.gsub(/ /, "-")&.downcase
85
+ next unless requirement_metadata_component_tags.include? tag
85
86
 
86
- ins.next = requirement_metadata1_component(e)
87
- ins = ins.next
87
+ ins1.next = requirement_metadata1_component(e, tag)
88
+ ins1 = ins1.next
88
89
  end
89
90
  end
90
91
 
91
- def requirement_metadata1_component(term)
92
+ def requirement_metadata1_component(term, tag)
92
93
  val = term.at("./following::dd")
93
- val.name = term.text
94
+ val.name = tag
95
+ val.xpath("./dl").each do |d|
96
+ requirement_metadata1(val, d, d)
97
+ d.remove
98
+ end
94
99
  if %w(requirement permission
95
100
  recommendation).include?(term.text) && !val.text.empty?
96
101
  val["label"] = val.text.strip
@@ -109,8 +114,8 @@ module Asciidoctor
109
114
  end
110
115
 
111
116
  def requirement_metadata_to_component(reqt)
112
- reqt.xpath("./test-method | ./test-purpose | ./conditions | ./part | "\
113
- "./reference")
117
+ reqt.xpath(".//test-method | .//test-purpose | .//conditions | "\
118
+ ".//part | .//test-method-type | .//step | .//reference")
114
119
  .each do |c|
115
120
  c["class"] = c.name
116
121
  c.name = "component"
@@ -125,8 +130,10 @@ module Asciidoctor
125
130
  end
126
131
 
127
132
  def requirement_subparts_to_blocks(reqt)
128
- reqt.xpath("./component | ./description").each do |c|
129
- %w(p ol ul dl table).include?(c&.elements&.first&.name) and next
133
+ reqt.xpath(".//component | .//description").each do |c|
134
+ next if %w(p ol ul dl table component description)
135
+ .include?(c&.elements&.first&.name)
136
+
130
137
  c.children = "<p>#{c.children.to_xml}</p>"
131
138
  end
132
139
  end
@@ -140,6 +147,27 @@ module Asciidoctor
140
147
  t.remove
141
148
  end
142
149
  end
150
+
151
+ def requirement_cleanup(xmldoc)
152
+ requirement_type(xmldoc)
153
+ super
154
+ end
155
+
156
+ def requirement_type(xmldoc)
157
+ xmldoc.xpath(REQRECPER).each do |r|
158
+ next unless r["type"]
159
+
160
+ r["type"] = case r["type"]
161
+ when "requirement", "recommendation", "permission"
162
+ "general"
163
+ when "requirement_class" then "class"
164
+ when "conformance_test" then "verification"
165
+ when "conformance_class" then "conformanceclass"
166
+ when "abstract_test" then "abstracttest"
167
+ else r["type"]
168
+ end
169
+ end
170
+ end
143
171
  end
144
172
  end
145
173
  end
@@ -122,6 +122,16 @@ module Asciidoctor
122
122
  xml.hi { |s| s << text }
123
123
  end
124
124
 
125
+ def example(node)
126
+ role = node.role || node.attr("style")
127
+ if %w(requirement_class conformance_test conformance_class
128
+ abstract_test).include?(role)
129
+ node.set_attr("type", role)
130
+ return requirement(node, "requirement")
131
+ end
132
+ super
133
+ end
134
+
125
135
  def presentation_xml_converter(node)
126
136
  IsoDoc::Ogc::PresentationXMLConvert.new(html_extract_attributes(node))
127
137
  end
@@ -1036,6 +1036,7 @@
1036
1036
  <ref name="svgmap"/>
1037
1037
  <ref name="inputform"/>
1038
1038
  <ref name="toc"/>
1039
+ <ref name="passthrough"/>
1039
1040
  </choice>
1040
1041
  </define>
1041
1042
  <define name="toc">
@@ -1043,6 +1044,14 @@
1043
1044
  <ref name="ul"/>
1044
1045
  </element>
1045
1046
  </define>
1047
+ <define name="passthrough">
1048
+ <element name="passthrough">
1049
+ <optional>
1050
+ <attribute name="formats"/>
1051
+ </optional>
1052
+ <text/>
1053
+ </element>
1054
+ </define>
1046
1055
  <define name="inputform">
1047
1056
  <element name="form">
1048
1057
  <attribute name="id">
@@ -414,7 +414,7 @@
414
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,7 +429,7 @@
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]">
432
+ <xsl:for-each select="//ogc:table[@id and ogc:name and contains(ogc:name, '—')]">
433
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"/>
@@ -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,7 +458,7 @@
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]">
461
+ <xsl:for-each select="//ogc:figure[@id and ogc:name and contains(ogc:name, '—')]">
462
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"/>
@@ -910,6 +910,7 @@
910
910
  <xsl:call-template name="insertSectionTitle">
911
911
  <xsl:with-param name="section" select="$section"/>
912
912
  <xsl:with-param name="title" select="$title"/>
913
+ <xsl:with-param name="level" select="$level"/>
913
914
  </xsl:call-template>
914
915
  </fo:block>
915
916
  </xsl:when>
@@ -1057,10 +1058,13 @@
1057
1058
  <xsl:template match="ogc:ul | ogc:ol" mode="ul_ol">
1058
1059
  <fo:block-container margin-left="13mm">
1059
1060
  <xsl:if test="ancestor::ogc:table">
1060
- <xsl:attribute name="margin-left">1.5mm</xsl:attribute>
1061
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
1061
1062
  </xsl:if>
1062
1063
  <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol">
1063
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>
1064
1068
  </xsl:if>
1065
1069
  <fo:block-container margin-left="0mm">
1066
1070
  <fo:list-block provisional-distance-between-starts="12mm" space-after="12pt" line-height="115%">
@@ -1069,6 +1073,9 @@
1069
1073
  </xsl:if>
1070
1074
  <xsl:if test="ancestor::ogc:ul | ancestor::ogc:ol">
1071
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>
1072
1079
  </xsl:if>
1073
1080
  <xsl:if test="following-sibling::*[1][local-name() = 'ul' or local-name() = 'ol']">
1074
1081
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -1104,17 +1111,14 @@
1104
1111
  <xsl:when test="../@type = 'roman'">
1105
1112
  <xsl:number format="i)"/>
1106
1113
  </xsl:when>
1107
- <xsl:when test="ancestor::ogc:table">
1108
- <xsl:variable name="level" select="count(ancestor-or-self::ogc:li[ancestor::ogc:table])"/>
1114
+ <xsl:otherwise>
1115
+ <xsl:variable name="level" select="count(ancestor-or-self::ogc:li)"/>
1109
1116
  <xsl:choose>
1110
1117
  <xsl:when test="$level = 1"><xsl:number format="a)" lang="en"/></xsl:when>
1111
1118
  <xsl:when test="$level = 2"><xsl:number format="1."/></xsl:when>
1112
1119
  <xsl:when test="$level = 3"><xsl:number format="i)"/></xsl:when>
1113
1120
  <xsl:otherwise><xsl:number format="a)" lang="en"/></xsl:otherwise>
1114
1121
  </xsl:choose>
1115
- </xsl:when>
1116
- <xsl:otherwise>
1117
- <xsl:number format="1."/>
1118
1122
  </xsl:otherwise>
1119
1123
  </xsl:choose>
1120
1124
  </xsl:otherwise>
@@ -1123,6 +1127,9 @@
1123
1127
  </fo:list-item-label>
1124
1128
  <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
1125
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>
1126
1133
  <xsl:if test="not(following-sibling::*) and not(../following-sibling::*)">
1127
1134
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1128
1135
  </xsl:if>
@@ -1274,7 +1281,6 @@
1274
1281
 
1275
1282
  <xsl:template match="ogc:figure" priority="2">
1276
1283
  <fo:block-container id="{@id}" margin-top="12pt" margin-bottom="12pt">
1277
- <xsl:apply-templates select="ogc:name" mode="presentation"/>
1278
1284
  <fo:block>
1279
1285
  <xsl:apply-templates/>
1280
1286
  </fo:block>
@@ -1282,6 +1288,7 @@
1282
1288
  <xsl:for-each select="ogc:note">
1283
1289
  <xsl:call-template name="note"/>
1284
1290
  </xsl:for-each>
1291
+ <xsl:apply-templates select="ogc:name" mode="presentation"/>
1285
1292
  </fo:block-container>
1286
1293
  </xsl:template>
1287
1294
 
@@ -1442,6 +1449,7 @@
1442
1449
  <xsl:template name="insertSectionTitle">
1443
1450
  <xsl:param name="section"/>
1444
1451
  <xsl:param name="title"/>
1452
+ <xsl:param name="level">1</xsl:param>
1445
1453
  <fo:block>
1446
1454
  <fo:block font-size="18pt" color="{$color_blue}" keep-with-next="always" line-height="150%">
1447
1455
  <xsl:if test="$section != ''">
@@ -1452,10 +1460,24 @@
1452
1460
  </xsl:call-template>
1453
1461
  </fo:inline>
1454
1462
  </xsl:if>
1455
- <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>
1456
1471
 
1457
1472
  <xsl:variable name="variant-title">
1458
- <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="titlesmall"/>
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>
1459
1481
  </xsl:variable>
1460
1482
  <xsl:if test="normalize-space($variant-title) != ''">
1461
1483
  <fo:inline padding-right="5mm"> </fo:inline>
@@ -1474,25 +1496,59 @@
1474
1496
  </xsl:call-template>
1475
1497
  </xsl:template>
1476
1498
 
1499
+ <xsl:template match="text()" mode="titlesimple">
1500
+ <xsl:value-of select="."/>
1501
+ </xsl:template>
1502
+
1477
1503
  <xsl:template match="ogc:strong" mode="titlesmall">
1478
1504
  <xsl:apply-templates mode="titlesmall"/>
1479
1505
  </xsl:template>
1506
+ <xsl:template match="ogc:strong" mode="titlesimple">
1507
+ <xsl:apply-templates mode="titlesimple"/>
1508
+ </xsl:template>
1480
1509
 
1481
1510
  <xsl:template match="ogc:em" mode="titlesmall">
1482
1511
  <fo:inline font-style="italic"><xsl:apply-templates mode="titlesmall"/></fo:inline>
1483
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>
1484
1516
 
1485
1517
  <xsl:template match="ogc:fn" mode="titlesmall">
1486
1518
  <xsl:call-template name="fn"/>
1487
1519
  </xsl:template>
1520
+ <xsl:template match="ogc:fn" mode="titlesimple">
1521
+ <xsl:call-template name="fn"/>
1522
+ </xsl:template>
1488
1523
  <xsl:template match="ogc:tab " mode="titlesmall">
1489
1524
  <xsl:apply-templates select="."/>
1490
1525
  </xsl:template>
1526
+ <xsl:template match="ogc:tab " mode="titlesimple">
1527
+ <xsl:apply-templates select="."/>
1528
+ </xsl:template>
1491
1529
 
1492
1530
  <xsl:template match="ogc:br" mode="titlesmall">
1493
1531
  <xsl:value-of select="$linebreak"/>
1494
1532
  </xsl:template>
1495
-
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>
1496
1552
 
1497
1553
  <xsl:template name="insertOrangeHorizontalLine">
1498
1554
  <fo:block-container width="12.7mm" border-top="1pt solid {$color_orange}" margin-top="3mm">
@@ -1850,7 +1906,8 @@
1850
1906
 
1851
1907
  <xsl:attribute name="text-align">left</xsl:attribute>
1852
1908
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1853
- <xsl:attribute name="font-weight">bold</xsl:attribute><!-- normal -->
1909
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1910
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
1854
1911
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1855
1912
 
1856
1913
 
@@ -2010,10 +2067,14 @@
2010
2067
 
2011
2068
 
2012
2069
 
2013
- <xsl:attribute name="font-weight">bold</xsl:attribute>
2014
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
2015
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2016
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2070
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
2071
+ <!-- <xsl:attribute name="margin-top">12pt</xsl:attribute> -->
2072
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2073
+ <!-- <xsl:attribute name="margin-bottom">6pt</xsl:attribute> -->
2074
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2075
+ <!-- <xsl:attribute name="keep-with-next">always</xsl:attribute> -->
2076
+ <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2077
+ <xsl:attribute name="text-align">center</xsl:attribute>
2017
2078
 
2018
2079
 
2019
2080
 
@@ -2107,13 +2168,20 @@
2107
2168
 
2108
2169
  </xsl:attribute-set><xsl:attribute-set name="list-style">
2109
2170
 
2110
- </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">
2171
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
2172
+ <xsl:attribute name="line-height">135%</xsl:attribute>
2173
+ </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">
2111
2174
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2112
2175
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2113
2176
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
2114
2177
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
2115
2178
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
2116
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2179
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
2180
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2181
+ <xsl:sort select="@displayorder" data-type="number"/>
2182
+ <xsl:apply-templates select="." mode="contents"/>
2183
+ </xsl:for-each>
2184
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
2117
2185
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
2118
2186
 
2119
2187
  <!-- Normative references -->
@@ -2126,13 +2194,33 @@
2126
2194
  <!-- Bibliography -->
2127
2195
  <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"/>
2128
2196
 
2129
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2197
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
2198
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2199
+ <xsl:sort select="@displayorder" data-type="number"/>
2200
+ <xsl:apply-templates select="." mode="contents"/>
2201
+ </xsl:for-each>
2202
+
2203
+ <xsl:for-each select="/*/*[local-name()='annex']">
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()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2209
+ <xsl:sort select="@displayorder" data-type="number"/>
2210
+ <xsl:apply-templates select="." mode="contents"/>
2211
+ </xsl:for-each>
2212
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
2130
2213
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
2131
2214
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
2132
2215
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
2133
2216
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
2134
2217
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
2135
- </xsl:template><xsl:template name="processMainSectionsDefault">
2218
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2219
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
2220
+ <xsl:sort select="@displayorder" data-type="number"/>
2221
+ <xsl:apply-templates select="."/>
2222
+ </xsl:for-each>
2223
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
2136
2224
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
2137
2225
 
2138
2226
  <!-- Normative references -->
@@ -2144,6 +2232,22 @@
2144
2232
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
2145
2233
  <!-- Bibliography -->
2146
2234
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
2235
+ </xsl:template><xsl:template name="processMainSectionsDefault">
2236
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2237
+ <xsl:sort select="@displayorder" data-type="number"/>
2238
+ <xsl:apply-templates select="."/>
2239
+
2240
+ </xsl:for-each>
2241
+
2242
+ <xsl:for-each select="/*/*[local-name()='annex']">
2243
+ <xsl:sort select="@displayorder" data-type="number"/>
2244
+ <xsl:apply-templates select="."/>
2245
+ </xsl:for-each>
2246
+
2247
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2248
+ <xsl:sort select="@displayorder" data-type="number"/>
2249
+ <xsl:apply-templates select="."/>
2250
+ </xsl:for-each>
2147
2251
  </xsl:template><xsl:template match="text()">
2148
2252
  <xsl:value-of select="."/>
2149
2253
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -4699,6 +4803,13 @@
4699
4803
  </xsl:attribute>
4700
4804
  <xsl:apply-templates mode="svg_update"/>
4701
4805
  </xsl:copy>
4806
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
4807
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4808
+ <xsl:for-each select="*[local-name() = 'svg']">
4809
+ <xsl:call-template name="image_svg">
4810
+ <xsl:with-param name="name" select="$name"/>
4811
+ </xsl:call-template>
4812
+ </xsl:for-each>
4702
4813
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4703
4814
  <xsl:variable name="svg_content" select="document(@src)"/>
4704
4815
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4803,7 +4914,7 @@
4803
4914
  </fo:basic-link>
4804
4915
  </fo:block>
4805
4916
  </fo:block-container>
4806
- </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">
4917
+ </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">
4807
4918
  <xsl:apply-templates mode="contents"/>
4808
4919
  <xsl:text> </xsl:text>
4809
4920
  </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">
@@ -5530,14 +5641,15 @@
5530
5641
  </xsl:if>
5531
5642
  </xsl:template><xsl:variable name="localized.source">
5532
5643
  <xsl:call-template name="getLocalizedString">
5533
- <xsl:with-param name="key">source</xsl:with-param>
5534
- </xsl:call-template>
5644
+ <xsl:with-param name="key">source</xsl:with-param>
5645
+ </xsl:call-template>
5535
5646
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5536
5647
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5537
5648
  <xsl:if test="normalize-space(@citeas) = ''">
5538
5649
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5539
5650
  </xsl:if>
5540
5651
 
5652
+ <xsl:text>[</xsl:text>
5541
5653
  <fo:inline>
5542
5654
 
5543
5655
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -5547,18 +5659,18 @@
5547
5659
 
5548
5660
 
5549
5661
 
5550
-
5551
- <xsl:call-template name="getTitle">
5552
- <xsl:with-param name="name" select="'title-source'"/>
5553
- </xsl:call-template>
5662
+ <xsl:value-of select="$localized.source"/>
5554
5663
  <xsl:text>: </xsl:text>
5555
5664
 
5556
5665
 
5666
+
5667
+
5557
5668
  </fo:inline>
5558
5669
 
5559
5670
  <fo:inline xsl:use-attribute-sets="origin-style">
5560
5671
  <xsl:apply-templates/>
5561
5672
  </fo:inline>
5673
+ <xsl:text>]</xsl:text>
5562
5674
  </fo:basic-link>
5563
5675
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
5564
5676
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -5625,6 +5737,9 @@
5625
5737
 
5626
5738
  </xsl:if>
5627
5739
 
5740
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
5741
+ <xsl:variable name="text" select="normalize-space()"/>
5742
+
5628
5743
 
5629
5744
 
5630
5745
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -5638,7 +5753,9 @@
5638
5753
 
5639
5754
 
5640
5755
  </xsl:if>
5641
-
5756
+
5757
+
5758
+
5642
5759
  <xsl:apply-templates/>
5643
5760
  </fo:basic-link>
5644
5761
 
@@ -6287,9 +6404,97 @@
6287
6404
  <fo:block-container border="1pt solid black" width="50%">
6288
6405
  <fo:block> </fo:block>
6289
6406
  </fo:block-container>
6407
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
6408
+ <xsl:param name="colwidths"/>
6409
+ <xsl:variable name="colwidths_">
6410
+ <xsl:choose>
6411
+ <xsl:when test="not($colwidths)">
6412
+ <xsl:variable name="toc_table_simple">
6413
+ <tbody>
6414
+ <xsl:apply-templates mode="toc_table_width"/>
6415
+ </tbody>
6416
+ </xsl:variable>
6417
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
6418
+ <xsl:call-template name="calculate-column-widths">
6419
+ <xsl:with-param name="cols-count" select="$cols-count"/>
6420
+ <xsl:with-param name="table" select="$toc_table_simple"/>
6421
+ </xsl:call-template>
6422
+ </xsl:when>
6423
+ <xsl:otherwise>
6424
+ <xsl:copy-of select="$colwidths"/>
6425
+ </xsl:otherwise>
6426
+ </xsl:choose>
6427
+ </xsl:variable>
6428
+ <fo:block role="TOCI" space-after="16pt">
6429
+ <fo:table width="100%" table-layout="fixed">
6430
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
6431
+ <fo:table-column column-width="proportional-column-width({.})"/>
6432
+ </xsl:for-each>
6433
+ <fo:table-body>
6434
+ <xsl:apply-templates/>
6435
+ </fo:table-body>
6436
+ </fo:table>
6437
+ </fo:block>
6438
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
6439
+ <fo:table-row min-height="5mm">
6440
+ <xsl:apply-templates/>
6441
+ </fo:table-row>
6442
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
6443
+ <xsl:apply-templates/>
6444
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
6445
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
6446
+ <xsl:variable name="target" select="@target"/>
6447
+ <xsl:for-each select="*[local-name() = 'tab']">
6448
+ <xsl:variable name="current_id" select="generate-id()"/>
6449
+ <fo:table-cell>
6450
+ <fo:block>
6451
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
6452
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
6453
+ <xsl:choose>
6454
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6455
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
6456
+ </xsl:choose>
6457
+ </xsl:for-each>
6458
+ </fo:basic-link>
6459
+ </fo:block>
6460
+ </fo:table-cell>
6461
+ </xsl:for-each>
6462
+ <!-- last column - for page numbers -->
6463
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
6464
+ <fo:block>
6465
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
6466
+ <fo:page-number-citation ref-id="{$target}"/>
6467
+ </fo:basic-link>
6468
+ </fo:block>
6469
+ </fo:table-cell>
6470
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
6471
+ <xsl:apply-templates mode="toc_table_width"/>
6472
+ </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">
6473
+ <tr>
6474
+ <xsl:apply-templates mode="toc_table_width"/>
6475
+ </tr>
6476
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
6477
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
6478
+ <xsl:for-each select="*[local-name() = 'tab']">
6479
+ <xsl:variable name="current_id" select="generate-id()"/>
6480
+ <td>
6481
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
6482
+ <xsl:copy-of select="."/>
6483
+ </xsl:for-each>
6484
+ </td>
6485
+ </xsl:for-each>
6486
+ <td>333</td> <!-- page number, just for fill -->
6290
6487
  </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6291
6488
  <fo:inline padding-right="5mm"> </fo:inline>
6292
6489
  <fo:inline><xsl:apply-templates/></fo:inline>
6490
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
6491
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
6492
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
6493
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
6494
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
6495
+ </svg>
6496
+ </fo:instream-foreign-object>
6497
+ </fo:inline>
6293
6498
  </xsl:template><xsl:template name="convertDate">
6294
6499
  <xsl:param name="date"/>
6295
6500
  <xsl:param name="format" select="'short'"/>