metanorma-ogc 1.3.6 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/ogc/boilerplate.xml +6 -6
  3. data/lib/asciidoctor/ogc/converter.rb +91 -36
  4. data/lib/asciidoctor/ogc/front.rb +1 -1
  5. data/lib/asciidoctor/ogc/isodoc.rng +67 -16
  6. data/lib/asciidoctor/ogc/ogc.rng +13 -13
  7. data/lib/asciidoctor/ogc/reqt.rng +15 -4
  8. data/lib/isodoc/ogc/biblio.rb +57 -51
  9. data/lib/isodoc/ogc/i18n-en.yaml +17 -3
  10. data/lib/isodoc/ogc/metadata.rb +1 -1
  11. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +494 -139
  12. data/lib/isodoc/ogc/ogc.best-practice.xsl +494 -139
  13. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +494 -139
  14. data/lib/isodoc/ogc/ogc.community-practice.xsl +494 -139
  15. data/lib/isodoc/ogc/ogc.community-standard.xsl +494 -139
  16. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +494 -139
  17. data/lib/isodoc/ogc/ogc.engineering-report.xsl +494 -139
  18. data/lib/isodoc/ogc/ogc.other.xsl +494 -139
  19. data/lib/isodoc/ogc/ogc.policy.xsl +494 -139
  20. data/lib/isodoc/ogc/ogc.reference-model.xsl +494 -139
  21. data/lib/isodoc/ogc/ogc.release-notes.xsl +494 -139
  22. data/lib/isodoc/ogc/ogc.standard.xsl +494 -139
  23. data/lib/isodoc/ogc/ogc.test-suite.xsl +494 -139
  24. data/lib/isodoc/ogc/ogc.user-guide.xsl +494 -139
  25. data/lib/isodoc/ogc/ogc.white-paper.xsl +451 -100
  26. data/lib/isodoc/ogc/presentation_xml_convert.rb +53 -46
  27. data/lib/isodoc/ogc/reqt.rb +73 -24
  28. data/lib/isodoc/ogc/word_convert.rb +13 -12
  29. data/lib/isodoc/ogc/xref.rb +58 -41
  30. data/lib/metanorma/ogc/processor.rb +2 -1
  31. data/lib/metanorma/ogc/version.rb +1 -1
  32. metadata +2 -2
@@ -32,6 +32,7 @@
32
32
  <xsl:attribute name="margin-top">18pt</xsl:attribute>
33
33
  <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
34
34
  <xsl:attribute name="line-height">110%</xsl:attribute>
35
+ <xsl:attribute name="role">H1</xsl:attribute>
35
36
  </xsl:attribute-set>
36
37
 
37
38
  <xsl:attribute-set name="title-depth2-style">
@@ -42,6 +43,7 @@
42
43
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
43
44
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
44
45
  <xsl:attribute name="line-height">110%</xsl:attribute>
46
+ <xsl:attribute name="role">H2</xsl:attribute>
45
47
  </xsl:attribute-set>
46
48
 
47
49
  <xsl:attribute-set name="title-depth3-style">
@@ -51,7 +53,8 @@
51
53
  <xsl:attribute name="color">rgb(21, 43, 77)</xsl:attribute>
52
54
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
53
55
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
54
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
56
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
57
+ <xsl:attribute name="role">H3</xsl:attribute>
55
58
  </xsl:attribute-set>
56
59
 
57
60
  <xsl:attribute-set name="empty-style">
@@ -126,7 +129,7 @@
126
129
 
127
130
  <fo:block-container margin-left="-12mm" margin-right="-9mm">
128
131
  <fo:block-container margin-left="0mm" margin-right="0mm">
129
- <fo:block font-size="36pt" background-color="{$color}" color="white" margin-left="2.5mm" padding-top="1mm" padding-left="1mm">
132
+ <fo:block font-size="36pt" background-color="{$color}" color="white" margin-left="2.5mm" padding-top="1mm" padding-left="1mm" role="H1">
130
133
  <xsl:apply-templates select="/ogc:ogc-standard/ogc:bibdata/ogc:title/node()"/>
131
134
  </fo:block>
132
135
  </fo:block-container>
@@ -216,43 +219,45 @@
216
219
  <fo:block break-after="page"/>
217
220
 
218
221
  <fo:block-container line-height="1.08" font-family="Lato">
219
- <fo:block xsl:use-attribute-sets="title-toc-style">
220
- <xsl:text>Table of Contents</xsl:text>
221
- </fo:block>
222
- <xsl:variable name="margin-left">3.9</xsl:variable>
223
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
224
- <fo:block margin-top="8pt" margin-bottom="5pt" margin-left="{(@level - 1) * $margin-left}mm" text-align-last="justify">
225
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
226
- <xsl:if test="@section != ''">
227
- <xsl:value-of select="@section"/><xsl:text> </xsl:text>
228
- </xsl:if>
229
- <xsl:apply-templates select="title"/>
230
- <fo:inline keep-together.within-line="always">
231
- <fo:leader leader-pattern="dots"/>
232
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
233
- </fo:inline>
234
- </fo:basic-link>
235
- </fo:block>
236
- </xsl:for-each>
237
-
238
- <xsl:if test="//ogc:figure[@id and ogc:name] or //ogc:table[@id and ogc:name]">
239
- <fo:block font-size="11pt" margin-top="8pt"> </fo:block>
240
- <fo:block font-size="11pt" margin-top="8pt"> </fo:block>
241
- <fo:block xsl:use-attribute-sets="title-toc-style">
242
- <xsl:text>Table of Figures</xsl:text>
222
+ <fo:block role="TOC">
223
+ <fo:block xsl:use-attribute-sets="title-toc-style" role="H1">
224
+ <xsl:text>Table of Contents</xsl:text>
243
225
  </fo:block>
244
- <xsl:for-each select="//ogc:figure[@id and ogc:name] | //ogc:table[@id and ogc:name]">
245
- <fo:block margin-top="8pt" margin-bottom="5pt" text-align-last="justify">
246
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{ogc:name}">
247
- <xsl:apply-templates select="ogc:name" mode="contents"/>
226
+ <xsl:variable name="margin-left">3.9</xsl:variable>
227
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
228
+ <fo:block margin-top="8pt" margin-bottom="5pt" margin-left="{(@level - 1) * $margin-left}mm" text-align-last="justify" role="TOCI">
229
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
230
+ <xsl:if test="@section != ''">
231
+ <xsl:value-of select="@section"/><xsl:text> </xsl:text>
232
+ </xsl:if>
233
+ <xsl:apply-templates select="title"/>
248
234
  <fo:inline keep-together.within-line="always">
249
235
  <fo:leader leader-pattern="dots"/>
250
- <fo:page-number-citation ref-id="{@id}"/>
236
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
251
237
  </fo:inline>
252
238
  </fo:basic-link>
253
239
  </fo:block>
254
240
  </xsl:for-each>
255
- </xsl:if>
241
+
242
+ <xsl:if test="//ogc:figure[@id and ogc:name] or //ogc:table[@id and ogc:name]">
243
+ <fo:block font-size="11pt" margin-top="8pt"> </fo:block>
244
+ <fo:block font-size="11pt" margin-top="8pt"> </fo:block>
245
+ <fo:block xsl:use-attribute-sets="title-toc-style">
246
+ <xsl:text>Table of Figures</xsl:text>
247
+ </fo:block>
248
+ <xsl:for-each select="//ogc:figure[@id and ogc:name] | //ogc:table[@id and ogc:name]">
249
+ <fo:block margin-top="8pt" margin-bottom="5pt" text-align-last="justify" role="TOCI">
250
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{ogc:name}">
251
+ <xsl:apply-templates select="ogc:name" mode="contents"/>
252
+ <fo:inline keep-together.within-line="always">
253
+ <fo:leader leader-pattern="dots"/>
254
+ <fo:page-number-citation ref-id="{@id}"/>
255
+ </fo:inline>
256
+ </fo:basic-link>
257
+ </fo:block>
258
+ </xsl:for-each>
259
+ </xsl:if>
260
+ </fo:block>
256
261
  </fo:block-container>
257
262
 
258
263
 
@@ -417,7 +422,10 @@
417
422
  </xsl:template>
418
423
 
419
424
  <xsl:template match="ogc:license-statement//ogc:title">
420
- <fo:block font-family="Lato" text-align="center" font-weight="bold" margin-top="4pt">
425
+ <xsl:variable name="level">
426
+ <xsl:call-template name="getLevel"/>
427
+ </xsl:variable>
428
+ <fo:block font-family="Lato" text-align="center" font-weight="bold" margin-top="4pt" role="H{$level}">
421
429
  <xsl:apply-templates/>
422
430
  </fo:block>
423
431
  </xsl:template>
@@ -450,7 +458,10 @@
450
458
  </xsl:template>
451
459
 
452
460
  <xsl:template match="ogc:copyright-statement//ogc:title | ogc:legal-statement//ogc:title">
453
- <fo:block font-family="Lato" text-align="center" font-weight="bold">
461
+ <xsl:variable name="level">
462
+ <xsl:call-template name="getLevel"/>
463
+ </xsl:variable>
464
+ <fo:block font-family="Lato" text-align="center" font-weight="bold" role="H{$level}">
454
465
  <xsl:apply-templates/>
455
466
  </fo:block>
456
467
  </xsl:template>
@@ -489,8 +500,9 @@
489
500
  <!-- ====== -->
490
501
 
491
502
  <xsl:template match="ogc:annex/ogc:title">
492
- <fo:block xsl:use-attribute-sets="title-depth1-style">
503
+ <fo:block xsl:use-attribute-sets="title-depth1-style" role="H1">
493
504
  <xsl:apply-templates/>
505
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
494
506
  </fo:block>
495
507
  </xsl:template>
496
508
 
@@ -520,7 +532,7 @@
520
532
  </fo:inline>
521
533
  </xsl:when>
522
534
  <xsl:otherwise>
523
- <fo:inline font-family="Lato">
535
+ <fo:inline font-family="Lato" role="H{$level}">
524
536
  <xsl:apply-templates/>
525
537
  </fo:inline>
526
538
  </xsl:otherwise>
@@ -531,21 +543,25 @@
531
543
  <xsl:when test="$level = 1">
532
544
  <fo:block xsl:use-attribute-sets="title-depth1-style">
533
545
  <xsl:apply-templates/>
546
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
534
547
  </fo:block>
535
548
  </xsl:when>
536
549
  <xsl:when test="$level = 2">
537
550
  <fo:block xsl:use-attribute-sets="title-depth2-style">
538
551
  <xsl:apply-templates/>
552
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
539
553
  </fo:block>
540
554
  </xsl:when>
541
555
  <xsl:when test="$level = 3">
542
556
  <fo:block xsl:use-attribute-sets="title-depth3-style">
543
557
  <xsl:apply-templates/>
558
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
544
559
  </fo:block>
545
560
  </xsl:when>
546
561
  <xsl:otherwise>
547
- <fo:block font-family="Lato">
562
+ <fo:block font-family="Lato" role="H{$level}">
548
563
  <xsl:apply-templates/>
564
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
549
565
  </fo:block>
550
566
  </xsl:otherwise>
551
567
  </xsl:choose>
@@ -751,7 +767,10 @@
751
767
  <xsl:otherwise>12pt</xsl:otherwise>
752
768
  </xsl:choose>
753
769
  </xsl:variable>
754
- <fo:block font-size="{$font-size}">
770
+ <xsl:variable name="levelTerm">
771
+ <xsl:call-template name="getLevelTermName"/>
772
+ </xsl:variable>
773
+ <fo:block font-size="{$font-size}" role="H{$levelTerm}">
755
774
  <fo:block font-weight="bold" keep-with-next="always">
756
775
  <xsl:apply-templates select="ancestor::ogc:term/ogc:name" mode="presentation"/>
757
776
  </fo:block>
@@ -861,13 +880,13 @@
861
880
  </fo:block>
862
881
  </fo:static-content>
863
882
 
864
- <fo:static-content flow-name="header">
883
+ <fo:static-content flow-name="header" role="artifact">
865
884
  <fo:block-container height="16.5mm" background-color="{$color}">
866
885
  <fo:block> </fo:block>
867
886
  </fo:block-container>
868
887
  </fo:static-content>
869
888
 
870
- <fo:static-content flow-name="footer">
889
+ <fo:static-content flow-name="footer" role="artifact">
871
890
  <fo:block-container height="100%" display-align="after">
872
891
  <fo:block-container height="23.5mm" background-color="{$color}" color="rgb(231, 230, 230)" display-align="after">
873
892
  <fo:block-container margin-left="1in" margin-right="1in">
@@ -1072,6 +1091,7 @@
1072
1091
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1073
1092
  <xsl:attribute name="white-space">pre</xsl:attribute>
1074
1093
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1094
+ <xsl:attribute name="role">Code</xsl:attribute>
1075
1095
 
1076
1096
 
1077
1097
 
@@ -1080,7 +1100,7 @@
1080
1100
 
1081
1101
 
1082
1102
 
1083
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1103
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
1084
1104
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1085
1105
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1086
1106
  <xsl:attribute name="line-height">113%</xsl:attribute>
@@ -1124,8 +1144,13 @@
1124
1144
 
1125
1145
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1126
1146
 
1127
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1128
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1147
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1148
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1149
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1150
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1151
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1152
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1153
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1129
1154
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1130
1155
 
1131
1156
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -1212,6 +1237,7 @@
1212
1237
 
1213
1238
 
1214
1239
 
1240
+
1215
1241
 
1216
1242
  <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
1217
1243
 
@@ -1228,7 +1254,9 @@
1228
1254
 
1229
1255
 
1230
1256
 
1231
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1257
+ </xsl:attribute-set><xsl:variable name="table-border_">
1258
+
1259
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1232
1260
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1233
1261
 
1234
1262
 
@@ -1362,7 +1390,8 @@
1362
1390
 
1363
1391
 
1364
1392
 
1365
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1393
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1394
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1366
1395
 
1367
1396
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1368
1397
  <xsl:attribute name="margin-left">13mm</xsl:attribute>
@@ -1461,7 +1490,7 @@
1461
1490
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1462
1491
 
1463
1492
 
1464
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1493
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
1465
1494
 
1466
1495
 
1467
1496
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
@@ -1569,9 +1598,13 @@
1569
1598
  <fo:block>&#xA0;</fo:block>
1570
1599
  </xsl:if> -->
1571
1600
 
1601
+
1602
+ <!-- Display table's name before table as standalone block -->
1572
1603
  <!-- $namespace = 'iso' or -->
1573
1604
 
1574
-
1605
+
1606
+
1607
+
1575
1608
 
1576
1609
  <xsl:call-template name="fn_name_display"/>
1577
1610
 
@@ -1648,6 +1681,12 @@
1648
1681
 
1649
1682
 
1650
1683
 
1684
+
1685
+
1686
+
1687
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1688
+
1689
+
1651
1690
  <xsl:variable name="table_width">
1652
1691
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1653
1692
 
@@ -1672,6 +1711,7 @@
1672
1711
 
1673
1712
 
1674
1713
 
1714
+
1675
1715
  <attribute name="margin-left">0mm</attribute>
1676
1716
  <attribute name="margin-right">0mm</attribute>
1677
1717
 
@@ -1697,6 +1737,8 @@
1697
1737
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1698
1738
  </xsl:if>
1699
1739
 
1740
+
1741
+
1700
1742
  <xsl:choose>
1701
1743
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1702
1744
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -1983,9 +2025,9 @@
1983
2025
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1984
2026
  <xsl:with-param name="continued">true</xsl:with-param>
1985
2027
  </xsl:apply-templates>
1986
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1987
- <xsl:call-template name="fn_name_display"/>
1988
- </xsl:for-each>
2028
+
2029
+
2030
+
1989
2031
 
1990
2032
  </fo:table-cell>
1991
2033
  </fo:table-row>
@@ -2067,7 +2109,11 @@
2067
2109
 
2068
2110
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2069
2111
 
2070
- <xsl:if test="$isNoteOrFnExist = 'true'">
2112
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
2113
+
2114
+ </xsl:variable>
2115
+
2116
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
2071
2117
 
2072
2118
  <xsl:variable name="cols-count">
2073
2119
  <xsl:choose>
@@ -2096,6 +2142,8 @@
2096
2142
  </xsl:choose>
2097
2143
  </xsl:for-each>
2098
2144
 
2145
+
2146
+
2099
2147
  <xsl:choose>
2100
2148
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2101
2149
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2122,6 +2170,7 @@
2122
2170
 
2123
2171
 
2124
2172
 
2173
+
2125
2174
  <!-- fn will be processed inside 'note' processing -->
2126
2175
 
2127
2176
 
@@ -2130,6 +2179,11 @@
2130
2179
 
2131
2180
 
2132
2181
 
2182
+
2183
+
2184
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2185
+
2186
+
2133
2187
  <!-- except gb -->
2134
2188
 
2135
2189
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2155,6 +2209,10 @@
2155
2209
  <!-- fn processing -->
2156
2210
  <xsl:call-template name="fn_display"/>
2157
2211
 
2212
+
2213
+ <!-- for PAS display Notes after footnotes -->
2214
+
2215
+
2158
2216
  </fo:table-cell>
2159
2217
  </fo:table-row>
2160
2218
  </fo:table-body>
@@ -2196,6 +2254,19 @@
2196
2254
 
2197
2255
  </fo:table-body>
2198
2256
 
2257
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2258
+ <xsl:choose>
2259
+ <xsl:when test="substring-after(., '—') != ''">
2260
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2261
+ </xsl:when>
2262
+ <xsl:otherwise>
2263
+ <xsl:value-of select="."/>
2264
+ </xsl:otherwise>
2265
+ </xsl:choose>
2266
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2267
+ <xsl:apply-templates mode="presentation_name"/>
2268
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2269
+ <xsl:apply-templates select="."/>
2199
2270
  </xsl:template><xsl:template match="*[local-name()='tr']">
2200
2271
  <xsl:variable name="parent-name" select="local-name(..)"/>
2201
2272
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2208,10 +2279,13 @@
2208
2279
 
2209
2280
 
2210
2281
 
2282
+
2283
+
2211
2284
  </xsl:if>
2212
2285
  <xsl:if test="$parent-name = 'tfoot'">
2213
2286
 
2214
2287
 
2288
+
2215
2289
  </xsl:if>
2216
2290
 
2217
2291
 
@@ -2221,6 +2295,8 @@
2221
2295
 
2222
2296
 
2223
2297
 
2298
+
2299
+
2224
2300
  <!-- <xsl:if test="$namespace = 'bipm'">
2225
2301
  <xsl:attribute name="height">8mm</xsl:attribute>
2226
2302
  </xsl:if> -->
@@ -2350,8 +2426,13 @@
2350
2426
 
2351
2427
 
2352
2428
 
2429
+
2430
+ <!-- Table's note name (NOTE, for example) -->
2431
+
2353
2432
  <fo:inline padding-right="2mm">
2354
2433
 
2434
+
2435
+
2355
2436
 
2356
2437
 
2357
2438
 
@@ -2359,6 +2440,8 @@
2359
2440
 
2360
2441
  </fo:inline>
2361
2442
 
2443
+
2444
+
2362
2445
  <xsl:apply-templates mode="process"/>
2363
2446
  </fo:block>
2364
2447
 
@@ -2366,24 +2449,18 @@
2366
2449
  <xsl:apply-templates/>
2367
2450
  </xsl:template><xsl:template name="fn_display">
2368
2451
  <xsl:variable name="references">
2452
+
2369
2453
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2370
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2371
-
2372
-
2373
- <xsl:attribute name="id">
2374
- <xsl:value-of select="@reference"/>
2375
- <xsl:text>_</xsl:text>
2376
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
2377
- </xsl:attribute>
2378
-
2379
- <xsl:apply-templates/>
2380
- </fn>
2454
+ <xsl:call-template name="create_fn"/>
2381
2455
  </xsl:for-each>
2382
2456
  </xsl:variable>
2457
+
2383
2458
  <xsl:for-each select="xalan:nodeset($references)//fn">
2384
2459
  <xsl:variable name="reference" select="@reference"/>
2385
2460
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2386
2461
  <fo:block margin-bottom="12pt">
2462
+
2463
+
2387
2464
 
2388
2465
 
2389
2466
 
@@ -2403,6 +2480,7 @@
2403
2480
  <xsl:value-of select="@reference"/>
2404
2481
 
2405
2482
 
2483
+
2406
2484
  </fo:inline>
2407
2485
  <fo:inline>
2408
2486
 
@@ -2412,6 +2490,18 @@
2412
2490
  </fo:block>
2413
2491
  </xsl:if>
2414
2492
  </xsl:for-each>
2493
+ </xsl:template><xsl:template name="create_fn">
2494
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2495
+
2496
+
2497
+ <xsl:attribute name="id">
2498
+ <xsl:value-of select="@reference"/>
2499
+ <xsl:text>_</xsl:text>
2500
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
2501
+ </xsl:attribute>
2502
+
2503
+ <xsl:apply-templates/>
2504
+ </fn>
2415
2505
  </xsl:template><xsl:template name="fn_name_display">
2416
2506
  <!-- <xsl:variable name="references">
2417
2507
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -2562,6 +2652,7 @@
2562
2652
 
2563
2653
  <xsl:value-of select="@reference"/>
2564
2654
 
2655
+
2565
2656
  </fo:basic-link>
2566
2657
  </fo:inline>
2567
2658
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3403,16 +3494,68 @@
3403
3494
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3404
3495
  </xsl:call-template>
3405
3496
 
3497
+
3498
+
3406
3499
  <xsl:variable name="mathml">
3407
3500
  <xsl:apply-templates select="." mode="mathml"/>
3408
3501
  </xsl:variable>
3409
3502
  <fo:instream-foreign-object fox:alt-text="Math">
3410
3503
 
3411
3504
 
3505
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3506
+ <xsl:variable name="comment_text_">
3507
+ <xsl:choose>
3508
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3509
+ <xsl:value-of select="$comment_text_following"/>
3510
+ </xsl:when>
3511
+ <xsl:otherwise>
3512
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3513
+ </xsl:otherwise>
3514
+ </xsl:choose>
3515
+ </xsl:variable>
3516
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3517
+
3518
+ <xsl:if test="normalize-space($comment_text) != ''">
3519
+ <!-- put Mathin Alternate Text -->
3520
+ <xsl:attribute name="fox:alt-text">
3521
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3522
+ </xsl:attribute>
3523
+ </xsl:if>
3524
+
3525
+ <xsl:variable name="mathml_content">
3526
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3527
+ </xsl:variable>
3528
+ <!-- put MathML in Actual Text -->
3529
+ <xsl:attribute name="fox:actual-text">
3530
+ <xsl:value-of select="$mathml_content"/>
3531
+ </xsl:attribute>
3532
+
3533
+
3412
3534
  <!-- <xsl:copy-of select="."/> -->
3413
3535
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3414
3536
  </fo:instream-foreign-object>
3415
3537
  </fo:inline>
3538
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3539
+ <!-- <xsl:text>a+b</xsl:text> -->
3540
+ <xsl:text>&lt;</xsl:text>
3541
+ <xsl:value-of select="local-name()"/>
3542
+ <xsl:if test="local-name() = 'math'">
3543
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3544
+ </xsl:if>
3545
+ <xsl:for-each select="@*">
3546
+ <xsl:text> </xsl:text>
3547
+ <xsl:value-of select="local-name()"/>
3548
+ <xsl:text>="</xsl:text>
3549
+ <xsl:value-of select="."/>
3550
+ <xsl:text>"</xsl:text>
3551
+ </xsl:for-each>
3552
+ <xsl:text>&gt;</xsl:text>
3553
+ <xsl:apply-templates mode="mathml_actual_text"/>
3554
+ <xsl:text>&lt;/</xsl:text>
3555
+ <xsl:value-of select="local-name()"/>
3556
+ <xsl:text>&gt;</xsl:text>
3557
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3558
+ <xsl:value-of select="normalize-space()"/>
3416
3559
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3417
3560
  <xsl:copy>
3418
3561
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3422,19 +3565,6 @@
3422
3565
  <!-- replace start and end spaces to non-break space -->
3423
3566
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3424
3567
  </xsl:copy>
3425
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3426
- <xsl:copy>
3427
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3428
- </xsl:copy>
3429
- <xsl:choose>
3430
- <!-- if in msub, then don't add space -->
3431
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3432
- <!-- if next char in digit, don't add space -->
3433
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3434
- <xsl:otherwise>
3435
- <mathml:mspace width="0.5ex"/>
3436
- </xsl:otherwise>
3437
- </xsl:choose>
3438
3568
  </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">
3439
3569
  <xsl:variable name="target">
3440
3570
  <xsl:choose>
@@ -3487,7 +3617,10 @@
3487
3617
  </fo:block>
3488
3618
  <xsl:apply-templates/>
3489
3619
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3490
- <fo:inline><xsl:apply-templates/></fo:inline>
3620
+ <xsl:variable name="level">
3621
+ <xsl:call-template name="getLevel"/>
3622
+ </xsl:variable>
3623
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3491
3624
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3492
3625
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3493
3626
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3522,9 +3655,10 @@
3522
3655
 
3523
3656
  </xsl:variable>
3524
3657
 
3658
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3525
3659
  <xsl:choose>
3526
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3527
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3660
+ <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>
3661
+ <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>
3528
3662
  </xsl:choose>
3529
3663
  <xsl:apply-templates/>
3530
3664
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3572,6 +3706,7 @@
3572
3706
 
3573
3707
 
3574
3708
 
3709
+
3575
3710
  <fo:block-container margin-left="0mm">
3576
3711
 
3577
3712
 
@@ -3673,7 +3808,10 @@
3673
3808
  </fo:block>
3674
3809
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3675
3810
  <xsl:if test="normalize-space() != ''">
3676
- <fo:inline>
3811
+ <xsl:variable name="level">
3812
+ <xsl:call-template name="getLevelTermName"/>
3813
+ </xsl:variable>
3814
+ <fo:inline role="H{$level}">
3677
3815
  <xsl:apply-templates/>
3678
3816
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3679
3817
  <xsl:text>.</xsl:text>
@@ -3746,7 +3884,24 @@
3746
3884
  </fo:instream-foreign-object>
3747
3885
  </xsl:when>
3748
3886
  <xsl:otherwise>
3749
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3887
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3888
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3889
+
3890
+ <xsl:variable name="img_src">
3891
+ <xsl:choose>
3892
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3893
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3894
+ </xsl:choose>
3895
+ </xsl:variable>
3896
+
3897
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
3898
+ <xsl:if test="number($scale) &lt; 100">
3899
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
3900
+ </xsl:if>
3901
+
3902
+ </xsl:if>
3903
+
3904
+ </fo:external-graphic>
3750
3905
  </xsl:otherwise>
3751
3906
  </xsl:choose>
3752
3907
 
@@ -3917,11 +4072,13 @@
3917
4072
  <xsl:attribute name="width">100%</xsl:attribute>
3918
4073
  <xsl:attribute name="content-height">100%</xsl:attribute>
3919
4074
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4075
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4076
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
3920
4077
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3921
4078
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3922
4079
  <!-- effective height / width = 1.48, 1.4 - with title -->
3923
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3924
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4080
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4081
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
3925
4082
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3926
4083
  </xsl:if>
3927
4084
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -3938,6 +4095,23 @@
3938
4095
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3939
4096
  <xsl:value-of select="."/>
3940
4097
  </xsl:attribute>
4098
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4099
+ <xsl:copy>
4100
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4101
+ <xsl:variable name="viewbox">
4102
+ <xsl:call-template name="split">
4103
+ <xsl:with-param name="pText" select="@viewBox"/>
4104
+ <xsl:with-param name="sep" select="' '"/>
4105
+ </xsl:call-template>
4106
+ </xsl:variable>
4107
+ <xsl:attribute name="width">
4108
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4109
+ </xsl:attribute>
4110
+ <xsl:attribute name="height">
4111
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4112
+ </xsl:attribute>
4113
+ <xsl:apply-templates mode="svg_update"/>
4114
+ </xsl:copy>
3941
4115
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3942
4116
  <xsl:variable name="svg_content" select="document(@src)"/>
3943
4117
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4279,6 +4453,7 @@
4279
4453
  </xsl:when>
4280
4454
  <xsl:otherwise>
4281
4455
  <xsl:apply-templates/>
4456
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4282
4457
  </xsl:otherwise>
4283
4458
  </xsl:choose>
4284
4459
  </fo:block>
@@ -4427,14 +4602,6 @@
4427
4602
  <fo:block>
4428
4603
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4429
4604
  </fo:block>
4430
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4431
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4432
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4433
- </fo:block>
4434
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4435
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4436
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4437
- </fo:block>
4438
4605
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4439
4606
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4440
4607
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4451,6 +4618,38 @@
4451
4618
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4452
4619
  <xsl:apply-templates/>
4453
4620
  </fo:block>
4621
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4622
+ <fo:block xsl:use-attribute-sets="subject-style">
4623
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4624
+ </fo:block>
4625
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4626
+ <fo:block xsl:use-attribute-sets="subject-style">
4627
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4628
+ </fo:block>
4629
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4630
+ <fo:block xsl:use-attribute-sets="inherit-style">
4631
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4632
+ </fo:block>
4633
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4634
+ <fo:block xsl:use-attribute-sets="description-style">
4635
+ <xsl:apply-templates/>
4636
+ </fo:block>
4637
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4638
+ <fo:block xsl:use-attribute-sets="specification-style">
4639
+ <xsl:apply-templates/>
4640
+ </fo:block>
4641
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4642
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4643
+ <xsl:apply-templates/>
4644
+ </fo:block>
4645
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4646
+ <fo:block xsl:use-attribute-sets="verification-style">
4647
+ <xsl:apply-templates/>
4648
+ </fo:block>
4649
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4650
+ <fo:block xsl:use-attribute-sets="import-style">
4651
+ <xsl:apply-templates/>
4652
+ </fo:block>
4454
4653
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4455
4654
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4456
4655
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4602,7 +4801,19 @@
4602
4801
  </fo:inline>
4603
4802
  </xsl:if>
4604
4803
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4605
- <fo:inline><xsl:apply-templates/></fo:inline>
4804
+ <xsl:variable name="element">inline
4805
+
4806
+ </xsl:variable>
4807
+ <xsl:choose>
4808
+ <xsl:when test="contains($element, 'block')">
4809
+ <fo:block xsl:use-attribute-sets="example-p-style">
4810
+ <xsl:apply-templates/>
4811
+ </fo:block>
4812
+ </xsl:when>
4813
+ <xsl:otherwise>
4814
+ <fo:inline><xsl:apply-templates/></fo:inline>
4815
+ </xsl:otherwise>
4816
+ </xsl:choose>
4606
4817
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4607
4818
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4608
4819
 
@@ -4795,9 +5006,10 @@
4795
5006
 
4796
5007
 
4797
5008
  </xsl:if>
4798
-
5009
+
5010
+
5011
+
4799
5012
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4800
-
4801
5013
  <xsl:if test="normalize-space(@citeas) = ''">
4802
5014
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4803
5015
  </xsl:if>
@@ -4808,6 +5020,7 @@
4808
5020
 
4809
5021
 
4810
5022
 
5023
+
4811
5024
  </xsl:if>
4812
5025
 
4813
5026
  <xsl:apply-templates/>
@@ -5190,7 +5403,6 @@
5190
5403
  </xsl:template><xsl:template name="processBibitem">
5191
5404
 
5192
5405
 
5193
- <!-- end BIPM bibitem processing-->
5194
5406
 
5195
5407
 
5196
5408
  <!-- start OGC bibtem processing -->
@@ -5460,6 +5672,9 @@
5460
5672
  <fo:block-container border="1pt solid black" width="50%">
5461
5673
  <fo:block> </fo:block>
5462
5674
  </fo:block-container>
5675
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5676
+ <fo:inline padding-right="5mm"> </fo:inline>
5677
+ <fo:inline><xsl:apply-templates/></fo:inline>
5463
5678
  </xsl:template><xsl:template name="convertDate">
5464
5679
  <xsl:param name="date"/>
5465
5680
  <xsl:param name="format" select="'short'"/>
@@ -5698,6 +5913,26 @@
5698
5913
  <xsl:value-of select="$level"/>
5699
5914
  </xsl:otherwise>
5700
5915
  </xsl:choose>
5916
+ </xsl:template><xsl:template name="getLevelTermName">
5917
+ <xsl:choose>
5918
+ <xsl:when test="normalize-space(../@depth) != ''">
5919
+ <xsl:value-of select="../@depth"/>
5920
+ </xsl:when>
5921
+ <xsl:otherwise>
5922
+ <xsl:variable name="title_level_">
5923
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5924
+ <xsl:call-template name="getLevel"/>
5925
+ </xsl:for-each>
5926
+ </xsl:variable>
5927
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5928
+ <xsl:choose>
5929
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5930
+ <xsl:otherwise>
5931
+ <xsl:call-template name="getLevel"/>
5932
+ </xsl:otherwise>
5933
+ </xsl:choose>
5934
+ </xsl:otherwise>
5935
+ </xsl:choose>
5701
5936
  </xsl:template><xsl:template name="split">
5702
5937
  <xsl:param name="pText" select="."/>
5703
5938
  <xsl:param name="sep" select="','"/>
@@ -5795,20 +6030,40 @@
5795
6030
  </xsl:call-template>
5796
6031
  </xsl:if>
5797
6032
  </xsl:template><xsl:template name="getLocalizedString">
5798
- <xsl:param name="key"/>
6033
+ <xsl:param name="key"/>
6034
+ <xsl:param name="formatted">false</xsl:param>
5799
6035
 
5800
6036
  <xsl:variable name="curr_lang">
5801
6037
  <xsl:call-template name="getLang"/>
5802
6038
  </xsl:variable>
5803
6039
 
5804
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6040
+ <xsl:variable name="data_value">
6041
+ <xsl:choose>
6042
+ <xsl:when test="$formatted = 'true'">
6043
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6044
+ </xsl:when>
6045
+ <xsl:otherwise>
6046
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6047
+ </xsl:otherwise>
6048
+ </xsl:choose>
6049
+ </xsl:variable>
5805
6050
 
5806
6051
  <xsl:choose>
5807
- <xsl:when test="$data_value != ''">
5808
- <xsl:value-of select="$data_value"/>
6052
+ <xsl:when test="normalize-space($data_value) != ''">
6053
+ <xsl:choose>
6054
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
6055
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
6056
+ </xsl:choose>
5809
6057
  </xsl:when>
5810
6058
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5811
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6059
+ <xsl:choose>
6060
+ <xsl:when test="$formatted = 'true'">
6061
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6062
+ </xsl:when>
6063
+ <xsl:otherwise>
6064
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6065
+ </xsl:otherwise>
6066
+ </xsl:choose>
5812
6067
  </xsl:when>
5813
6068
  <xsl:otherwise>
5814
6069
  <xsl:variable name="key_">
@@ -5819,7 +6074,7 @@
5819
6074
  <xsl:value-of select="$key_"/>
5820
6075
  </xsl:otherwise>
5821
6076
  </xsl:choose>
5822
-
6077
+
5823
6078
  </xsl:template><xsl:template name="setTrackChangesStyles">
5824
6079
  <xsl:param name="isAdded"/>
5825
6080
  <xsl:param name="isDeleted"/>
@@ -5870,4 +6125,100 @@
5870
6125
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5871
6126
  </xsl:choose>
5872
6127
  </xsl:attribute>
6128
+ </xsl:template><xsl:template name="number-to-words">
6129
+ <xsl:param name="number"/>
6130
+ <xsl:param name="first"/>
6131
+ <xsl:if test="$number != ''">
6132
+ <xsl:variable name="words">
6133
+ <words>
6134
+ <word cardinal="1">One-</word>
6135
+ <word ordinal="1">First </word>
6136
+ <word cardinal="2">Two-</word>
6137
+ <word ordinal="2">Second </word>
6138
+ <word cardinal="3">Three-</word>
6139
+ <word ordinal="3">Third </word>
6140
+ <word cardinal="4">Four-</word>
6141
+ <word ordinal="4">Fourth </word>
6142
+ <word cardinal="5">Five-</word>
6143
+ <word ordinal="5">Fifth </word>
6144
+ <word cardinal="6">Six-</word>
6145
+ <word ordinal="6">Sixth </word>
6146
+ <word cardinal="7">Seven-</word>
6147
+ <word ordinal="7">Seventh </word>
6148
+ <word cardinal="8">Eight-</word>
6149
+ <word ordinal="8">Eighth </word>
6150
+ <word cardinal="9">Nine-</word>
6151
+ <word ordinal="9">Ninth </word>
6152
+ <word ordinal="10">Tenth </word>
6153
+ <word ordinal="11">Eleventh </word>
6154
+ <word ordinal="12">Twelfth </word>
6155
+ <word ordinal="13">Thirteenth </word>
6156
+ <word ordinal="14">Fourteenth </word>
6157
+ <word ordinal="15">Fifteenth </word>
6158
+ <word ordinal="16">Sixteenth </word>
6159
+ <word ordinal="17">Seventeenth </word>
6160
+ <word ordinal="18">Eighteenth </word>
6161
+ <word ordinal="19">Nineteenth </word>
6162
+ <word cardinal="20">Twenty-</word>
6163
+ <word ordinal="20">Twentieth </word>
6164
+ <word cardinal="30">Thirty-</word>
6165
+ <word ordinal="30">Thirtieth </word>
6166
+ <word cardinal="40">Forty-</word>
6167
+ <word ordinal="40">Fortieth </word>
6168
+ <word cardinal="50">Fifty-</word>
6169
+ <word ordinal="50">Fiftieth </word>
6170
+ <word cardinal="60">Sixty-</word>
6171
+ <word ordinal="60">Sixtieth </word>
6172
+ <word cardinal="70">Seventy-</word>
6173
+ <word ordinal="70">Seventieth </word>
6174
+ <word cardinal="80">Eighty-</word>
6175
+ <word ordinal="80">Eightieth </word>
6176
+ <word cardinal="90">Ninety-</word>
6177
+ <word ordinal="90">Ninetieth </word>
6178
+ <word cardinal="100">Hundred-</word>
6179
+ <word ordinal="100">Hundredth </word>
6180
+ </words>
6181
+ </xsl:variable>
6182
+
6183
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
6184
+
6185
+ <xsl:variable name="value">
6186
+ <xsl:choose>
6187
+ <xsl:when test="$ordinal != ''">
6188
+ <xsl:value-of select="$ordinal"/>
6189
+ </xsl:when>
6190
+ <xsl:otherwise>
6191
+ <xsl:choose>
6192
+ <xsl:when test="$number &lt; 100">
6193
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
6194
+ <xsl:variable name="digit" select="substring($number,2)"/>
6195
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
6196
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
6197
+ </xsl:when>
6198
+ <xsl:otherwise>
6199
+ <!-- more 100 -->
6200
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
6201
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
6202
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
6203
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
6204
+ <xsl:call-template name="number-to-words">
6205
+ <xsl:with-param name="number" select="$digits"/>
6206
+ </xsl:call-template>
6207
+ </xsl:otherwise>
6208
+ </xsl:choose>
6209
+ </xsl:otherwise>
6210
+ </xsl:choose>
6211
+ </xsl:variable>
6212
+ <xsl:choose>
6213
+ <xsl:when test="$first = 'true'">
6214
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
6215
+ <xsl:call-template name="capitalize">
6216
+ <xsl:with-param name="str" select="$value_lc"/>
6217
+ </xsl:call-template>
6218
+ </xsl:when>
6219
+ <xsl:otherwise>
6220
+ <xsl:value-of select="$value"/>
6221
+ </xsl:otherwise>
6222
+ </xsl:choose>
6223
+ </xsl:if>
5873
6224
  </xsl:template></xsl:stylesheet>