metanorma-bipm 2.5.8 → 2.5.9

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: 25dd92a7dd70c253d1d2e15fdfa2e90626a107a9dd2d4b3713dab963f59c061d
4
- data.tar.gz: e3a45c0697e91c1faacc6efadcf5e199fdf6281e1df1b1bd1b28ffe13435ccba
3
+ metadata.gz: 9a808a19b6ff81b587516fee73852d0b9bc7c3317a2b642ee56335e199631f4f
4
+ data.tar.gz: b262ffd071d210ff90ea09c5797fcfbd86698699e847bfba21c84ff756f7cc62
5
5
  SHA512:
6
- metadata.gz: 89bc9c415a3dd71c89b49deeddf3333c2254867ce982424584473fd54722bdfad4aade14dd2d56b8eeffe7396b7c6882ff9aea6d5c0000cf6a7affee066b7555
7
- data.tar.gz: cf1cf5a6e1b6671cb6f8e1b134fc930f89728a241f4d206e008b20fd0a63e26adb69d122291dec4e275052e1d6ee54223df7e94e8069d1e67dfeffe0cf5ec3e0
6
+ metadata.gz: 9ee4c018e4e186d058a5bbdf4716a9e20bce298645be4af2977b179eb4115fa3a16f0652622beb60a1d10ade20a2e09c15fec1848b397e51837c1c4633be0dfe
7
+ data.tar.gz: 0f0e97a0e2d637ec76274db80d85f9de6aaf2ed346b1117d89a559ea5bbbb15ed77a51a65a8c1b2145e27b8e4a64791220efb4ad4b417fc9541fa599a2519586
@@ -432,9 +432,15 @@
432
432
  </xsl:variable> -->
433
433
 
434
434
  <xsl:variable name="update_xml_pres">
435
- <xsl:apply-templates mode="update_xml_pres"/>
435
+ <xsl:apply-templates select="." mode="update_xml_pres"/>
436
436
  </xsl:variable>
437
437
 
438
+ <xsl:if test="$debug = 'true'">
439
+ <redirect:write file="update_xml_pres.xml">
440
+ <xsl:copy-of select="xalan:nodeset($update_xml_pres)"/>
441
+ </redirect:write>
442
+ </xsl:if>
443
+
438
444
  <xsl:message>START flatxml_</xsl:message>
439
445
  <xsl:variable name="startTime2" select="java:getTime(java:java.util.Date.new())"/>
440
446
  <xsl:variable name="flatxml__">
@@ -477,9 +483,15 @@
477
483
  </xsl:variable> -->
478
484
 
479
485
  <xsl:variable name="update_xml_pres">
480
- <xsl:apply-templates mode="update_xml_pres"/>
486
+ <xsl:apply-templates select="." mode="update_xml_pres"/>
481
487
  </xsl:variable>
482
488
 
489
+ <xsl:if test="$debug = 'true'">
490
+ <redirect:write file="update_xml_pres.xml">
491
+ <xsl:copy-of select="xalan:nodeset($update_xml_pres)"/>
492
+ </redirect:write>
493
+ </xsl:if>
494
+
483
495
  <xsl:variable name="flatxml__">
484
496
  <!-- <xsl:apply-templates select="xalan:nodeset($title_eref)" mode="flatxml"/> -->
485
497
  <!-- <xsl:apply-templates select="." mode="flatxml"/> -->
@@ -552,6 +564,12 @@
552
564
 
553
565
  <!-- indexes=<xsl:copy-of select="$indexes"/> -->
554
566
 
567
+ <xsl:if test="$debug = 'true'">
568
+ <redirect:write file="flatxml.xml">
569
+ <xsl:copy-of select="$flatxml"/>
570
+ </redirect:write>
571
+ </xsl:if>
572
+
555
573
  <xsl:apply-templates select="xalan:nodeset($flatxml)/bipm:bipm-standard" mode="bipm-standard">
556
574
  <xsl:with-param name="curr_docnum" select="1"/>
557
575
  </xsl:apply-templates>
@@ -583,6 +601,20 @@
583
601
  <!-- END Move eref inside title -->
584
602
  <!-- ================================= -->
585
603
 
604
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres" priority="2">
605
+ <xsl:element name="title" namespace="https://www.metanorma.org/ns/bipm">
606
+ <xsl:copy-of select="@*"/>
607
+ <xsl:apply-templates mode="update_xml_pres"/>
608
+ </xsl:element>
609
+ </xsl:template>
610
+
611
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres" priority="2">
612
+ <xsl:element name="name" namespace="https://www.metanorma.org/ns/bipm">
613
+ <xsl:copy-of select="@*"/>
614
+ <xsl:apply-templates mode="update_xml_pres"/>
615
+ </xsl:element>
616
+ </xsl:template>
617
+
586
618
  <!-- ================================= -->
587
619
  <!-- Flattening xml for fit notes at page sides (margins) -->
588
620
  <!-- ================================= -->
@@ -1160,10 +1192,10 @@
1160
1192
  <!-- <xsl:copy-of select="$contents"/> -->
1161
1193
 
1162
1194
  <xsl:if test="$contents/doc[@id = $docid]//item[@display='true']">
1163
- <fo:table table-layout="fixed" width="100%" id="__internal_layout__toc_{generate-id()}">
1195
+ <fo:table table-layout="fixed" width="100%" id="__internal_layout__toc_{generate-id()}" role="SKIP">
1164
1196
  <fo:table-column column-width="127mm"/>
1165
1197
  <fo:table-column column-width="12mm"/>
1166
- <fo:table-body>
1198
+ <fo:table-body role="SKIP">
1167
1199
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and not(@type = 'annex') and not(@type = 'index') and not(@parent = 'annex')]">
1168
1200
  <xsl:call-template name="insertContentItem"/>
1169
1201
  </xsl:for-each>
@@ -1838,7 +1870,7 @@
1838
1870
 
1839
1871
  <xsl:template name="insertContentItem">
1840
1872
  <xsl:param name="keep-with-next"/>
1841
- <fo:table-row>
1873
+ <fo:table-row role="TOCI">
1842
1874
  <xsl:if test="$keep-with-next = 'true'">
1843
1875
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1844
1876
  </xsl:if>
@@ -1856,14 +1888,14 @@
1856
1888
  </xsl:choose>
1857
1889
  </xsl:variable>
1858
1890
 
1859
- <fo:table-cell>
1891
+ <fo:table-cell role="SKIP">
1860
1892
  <xsl:if test="normalize-space($space-before) != ''">
1861
1893
  <xsl:attribute name="padding-top"><xsl:value-of select="normalize-space($space-before)"/></xsl:attribute>
1862
1894
  </xsl:if>
1863
1895
  <xsl:if test="normalize-space($space-after) != ''">
1864
1896
  <xsl:attribute name="padding-bottom"><xsl:value-of select="normalize-space($space-after)"/></xsl:attribute>
1865
1897
  </xsl:if>
1866
- <fo:block role="TOCI">
1898
+ <fo:block role="SKIP">
1867
1899
  <xsl:if test="@level = 1">
1868
1900
  <xsl:attribute name="font-family">Arial</xsl:attribute>
1869
1901
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -1891,7 +1923,7 @@
1891
1923
  <xsl:attribute name="space-before">14pt</xsl:attribute>
1892
1924
  </xsl:if>
1893
1925
 
1894
- <fo:list-block>
1926
+ <fo:list-block role="SKIP">
1895
1927
  <xsl:attribute name="provisional-distance-between-starts">
1896
1928
  <xsl:choose>
1897
1929
  <xsl:when test="@section = '' or @level &gt; 3">0mm</xsl:when>
@@ -1902,9 +1934,9 @@
1902
1934
  </xsl:choose>
1903
1935
  </xsl:attribute>
1904
1936
 
1905
- <fo:list-item>
1906
- <fo:list-item-label end-indent="label-end()">
1907
- <fo:block>
1937
+ <fo:list-item role="SKIP">
1938
+ <fo:list-item-label end-indent="label-end()" role="SKIP">
1939
+ <fo:block role="SKIP">
1908
1940
  <xsl:if test="@level = 1 or (@level = 2 and not(@parent = 'annex'))">
1909
1941
  <xsl:value-of select="@section"/>
1910
1942
  <xsl:if test="normalize-space(@section) != '' and @type = 'annex'">.</xsl:if>
@@ -1912,18 +1944,18 @@
1912
1944
 
1913
1945
  </fo:block>
1914
1946
  </fo:list-item-label>
1915
- <fo:list-item-body start-indent="body-start()">
1916
- <fo:block>
1947
+ <fo:list-item-body start-indent="body-start()" role="SKIP">
1948
+ <fo:block role="SKIP">
1917
1949
  <xsl:if test="@level &gt;= 3">
1918
1950
  <xsl:attribute name="margin-left">11mm</xsl:attribute>
1919
1951
  <xsl:attribute name="text-indent">-11mm</xsl:attribute>
1920
1952
  </xsl:if>
1921
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1953
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}" role="SKIP">
1922
1954
  <xsl:if test="@level &gt;= 3">
1923
- <fo:inline padding-right="2mm"><xsl:value-of select="@section"/></fo:inline>
1955
+ <fo:inline padding-right="2mm" role="SKIP"><xsl:value-of select="@section"/></fo:inline>
1924
1956
  </xsl:if>
1925
1957
 
1926
- <fo:inline>
1958
+ <fo:inline role="SKIP">
1927
1959
  <xsl:apply-templates select="title"/>
1928
1960
  </fo:inline>
1929
1961
 
@@ -1934,16 +1966,16 @@
1934
1966
  </fo:list-block>
1935
1967
  </fo:block>
1936
1968
  </fo:table-cell>
1937
- <fo:table-cell text-align="right">
1969
+ <fo:table-cell text-align="right" role="SKIP">
1938
1970
  <xsl:if test="normalize-space($space-before) != ''">
1939
1971
  <xsl:attribute name="padding-top"><xsl:value-of select="normalize-space($space-before)"/></xsl:attribute>
1940
1972
  </xsl:if>
1941
1973
  <xsl:if test="normalize-space($space-after) != ''">
1942
1974
  <xsl:attribute name="padding-bottom"><xsl:value-of select="normalize-space($space-after)"/></xsl:attribute>
1943
1975
  </xsl:if>
1944
- <fo:block>
1945
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1946
- <fo:inline font-family="Arial" font-weight="bold" font-size="10pt"><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1976
+ <fo:block role="SKIP">
1977
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}" role="SKIP">
1978
+ <fo:inline font-family="Arial" font-weight="bold" font-size="10pt" role="SKIP"><fo:wrapper role="artifact"><fo:page-number-citation ref-id="{@id}"/></fo:wrapper></fo:inline>
1947
1979
  </fo:basic-link>
1948
1980
  </fo:block>
1949
1981
  </fo:table-cell>
@@ -2287,6 +2319,10 @@
2287
2319
  <xsl:otherwise>
2288
2320
  <fo:block role="H{$level}">
2289
2321
 
2322
+ <xsl:if test="ancestor::*[local-name() = 'clause'][@type = 'toc'] and $level &gt;= 3">
2323
+ <xsl:attribute name="role">Caption</xsl:attribute>
2324
+ </xsl:if>
2325
+
2290
2326
  <xsl:choose>
2291
2327
  <xsl:when test="ancestor::bipm:annex and $level &gt;= 2">
2292
2328
  <xsl:if test="$level &gt;= 3">
@@ -3296,7 +3332,7 @@
3296
3332
  <!-- Table of Contents (ToC) processing -->
3297
3333
  <!-- =================== -->
3298
3334
  <xsl:template match="bipm:clause[@type = 'toc']" priority="3">
3299
- <fo:block role="TOC">
3335
+ <fo:block>
3300
3336
  <xsl:copy-of select="@id"/>
3301
3337
  <xsl:apply-templates select="bipm:title[1]"/>
3302
3338
 
@@ -3314,12 +3350,12 @@
3314
3350
  </xsl:call-template>
3315
3351
  </xsl:variable>
3316
3352
 
3317
- <fo:table width="100%" table-layout="fixed">
3353
+ <fo:table width="100%" table-layout="fixed" role="TOC">
3318
3354
  <fo:table-column column-width="100%"/>
3319
- <fo:table-header>
3320
- <fo:table-row font-weight="bold">
3321
- <fo:table-cell text-align="right" font-size="9pt" font-family="Arial">
3322
- <fo:block>
3355
+ <fo:table-header role="SKIP">
3356
+ <fo:table-row font-weight="bold" role="SKIP">
3357
+ <fo:table-cell text-align="right" font-size="9pt" font-family="Arial" role="SKIP">
3358
+ <fo:block role="Caption">
3323
3359
  <xsl:variable name="page">
3324
3360
  <xsl:call-template name="getLocalizedString">
3325
3361
  <xsl:with-param name="key">Page.sg</xsl:with-param>
@@ -3330,10 +3366,10 @@
3330
3366
  </fo:table-cell>
3331
3367
  </fo:table-row>
3332
3368
  </fo:table-header>
3333
- <fo:table-body>
3334
- <fo:table-row>
3335
- <fo:table-cell>
3336
- <fo:block>
3369
+ <fo:table-body role="SKIP">
3370
+ <fo:table-row role="SKIP">
3371
+ <fo:table-cell role="SKIP">
3372
+ <fo:block role="SKIP">
3337
3373
  <xsl:variable name="title_id" select="generate-id(bipm:title[1])"/>
3338
3374
  <xsl:apply-templates select="*[not(generate-id() = $title_id)]">
3339
3375
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -7296,7 +7332,9 @@
7296
7332
  <fo:block role="SKIP">
7297
7333
 
7298
7334
  <xsl:if test="$isGenerateTableIF = 'true'">
7299
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
7335
+
7336
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
7337
+
7300
7338
  </xsl:if>
7301
7339
 
7302
7340
  <xsl:if test="not(.//bipm:image)">
@@ -8337,7 +8375,17 @@
8337
8375
  <xsl:call-template name="refine_dt-cell-style"/>
8338
8376
 
8339
8377
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
8340
- <xsl:copy-of select="@id"/>
8378
+
8379
+ <xsl:choose>
8380
+ <xsl:when test="$isGenerateTableIF = 'true'">
8381
+
8382
+ <xsl:copy-of select="@id"/>
8383
+
8384
+ </xsl:when>
8385
+ <xsl:otherwise>
8386
+ <xsl:copy-of select="@id"/>
8387
+ </xsl:otherwise>
8388
+ </xsl:choose>
8341
8389
 
8342
8390
  <xsl:if test="normalize-space($key_iso) = 'true'">
8343
8391
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -8369,7 +8417,9 @@
8369
8417
  <fo:block role="SKIP">
8370
8418
 
8371
8419
  <xsl:if test="$isGenerateTableIF = 'true'">
8372
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
8420
+
8421
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
8422
+
8373
8423
  </xsl:if>
8374
8424
 
8375
8425
  <xsl:choose>
@@ -9607,6 +9657,14 @@
9607
9657
  </xsl:for-each>
9608
9658
  </xsl:variable>
9609
9659
 
9660
+ <!-- <xsl:if test="$debug = 'true'">
9661
+ <redirect:write file="{generate-id()}_words_with_width_sorted.xml">
9662
+ <td_text><xsl:copy-of select="$td_text"/></td_text>
9663
+ <words_with_width><xsl:copy-of select="$words_with_width"/></words_with_width>
9664
+ <xsl:copy-of select="$words_with_width_sorted"/>
9665
+ </redirect:write>
9666
+ </xsl:if> -->
9667
+
9610
9668
  <xsl:variable name="words">
9611
9669
  <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
9612
9670
  <word>
@@ -9732,6 +9790,7 @@
9732
9790
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
9733
9791
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
9734
9792
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
9793
+ <xsl:if test="ancestor::*[local-name() = 'font_en_vertical']"><tag>font_en_vertical</tag></xsl:if>
9735
9794
  </tags>
9736
9795
  </xsl:template>
9737
9796
  <!-- =============================== -->
@@ -10304,7 +10363,16 @@
10304
10363
  </xsl:when>
10305
10364
  <xsl:otherwise>
10306
10365
  <!-- output text from <link>text</link> -->
10307
- <xsl:apply-templates/>
10366
+ <xsl:choose>
10367
+ <xsl:when test="starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.')">
10368
+ <xsl:call-template name="add-zero-spaces-link-java">
10369
+ <xsl:with-param name="text" select="."/>
10370
+ </xsl:call-template>
10371
+ </xsl:when>
10372
+ <xsl:otherwise>
10373
+ <xsl:apply-templates/>
10374
+ </xsl:otherwise>
10375
+ </xsl:choose>
10308
10376
  </xsl:otherwise>
10309
10377
  </xsl:choose>
10310
10378
  </fo:basic-link>
@@ -10964,16 +11032,29 @@
10964
11032
  <xsl:template name="getImageSrc">
10965
11033
  <xsl:choose>
10966
11034
  <xsl:when test="not(starts-with(@src, 'data:'))">
11035
+ <xsl:call-template name="getImageSrcExternal"/>
11036
+ </xsl:when>
11037
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
11038
+ </xsl:choose>
11039
+ </xsl:template>
11040
+
11041
+ <xsl:template name="getImageSrcExternal">
11042
+ <xsl:choose>
11043
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
11044
+ <xsl:value-of select="@src"/>
11045
+ </xsl:when>
11046
+ <xsl:otherwise>
11047
+ <xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/>
11048
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/>
10967
11049
  <xsl:choose>
10968
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
10969
- <xsl:value-of select="@src"/>
11050
+ <xsl:when test="$file_exists = 'true'">
11051
+ <xsl:value-of select="$src_with_basepath"/>
10970
11052
  </xsl:when>
10971
11053
  <xsl:otherwise>
10972
- <xsl:value-of select="concat($basepath, @src)"/>
11054
+ <xsl:value-of select="@src"/>
10973
11055
  </xsl:otherwise>
10974
11056
  </xsl:choose>
10975
- </xsl:when>
10976
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
11057
+ </xsl:otherwise>
10977
11058
  </xsl:choose>
10978
11059
  </xsl:template>
10979
11060
 
@@ -11021,14 +11102,8 @@
11021
11102
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
11022
11103
  </xsl:when>
11023
11104
  <xsl:when test="not(starts-with(@src, 'data:'))">
11024
- <xsl:choose>
11025
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
11026
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
11027
- </xsl:when>
11028
- <xsl:otherwise>
11029
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
11030
- </xsl:otherwise>
11031
- </xsl:choose>
11105
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
11106
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
11032
11107
  </xsl:when>
11033
11108
  <xsl:otherwise>
11034
11109
  <xsl:value-of select="@src"/>
@@ -11049,16 +11124,8 @@
11049
11124
  </svg>
11050
11125
  </xsl:when>
11051
11126
  <xsl:when test="not(starts-with(@src, 'data:'))">
11052
- <xsl:variable name="src">
11053
- <xsl:choose>
11054
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
11055
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
11056
- </xsl:when>
11057
- <xsl:otherwise>
11058
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
11059
- </xsl:otherwise>
11060
- </xsl:choose>
11061
- </xsl:variable>
11127
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
11128
+ <xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/>
11062
11129
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
11063
11130
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
11064
11131
  <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
@@ -15190,7 +15257,9 @@
15190
15257
  <xsl:template name="add_id">
15191
15258
  <xsl:if test="not(@id)">
15192
15259
  <!-- add @id - first element with @id plus '_element_name' -->
15193
- <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
15260
+ <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
15261
+ <xsl:variable name="prefix_id"><xsl:value-of select="$prefix_id_"/><xsl:if test="normalize-space($prefix_id_) = ''"><xsl:value-of select="generate-id()"/></xsl:if></xsl:variable>
15262
+ <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
15194
15263
  </xsl:if>
15195
15264
  </xsl:template>
15196
15265
 
@@ -16122,7 +16191,14 @@
16122
16191
  <xsl:variable name="title">
16123
16192
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
16124
16193
 
16125
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
16194
+ <xsl:choose>
16195
+ <xsl:when test="*[local-name() = 'title'][@language = $lang and @type = 'main']">
16196
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
16197
+ </xsl:when>
16198
+ <xsl:otherwise>
16199
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'title-main']"/>
16200
+ </xsl:otherwise>
16201
+ </xsl:choose>
16126
16202
 
16127
16203
  </xsl:for-each>
16128
16204
  </xsl:variable>
@@ -16495,6 +16571,7 @@
16495
16571
  <xsl:param name="formatted">false</xsl:param>
16496
16572
  <xsl:param name="lang"/>
16497
16573
  <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
16574
+ <xsl:param name="bibdata_updated"/>
16498
16575
 
16499
16576
  <xsl:variable name="curr_lang">
16500
16577
  <xsl:choose>
@@ -16508,6 +16585,9 @@
16508
16585
 
16509
16586
  <xsl:variable name="data_value">
16510
16587
  <xsl:choose>
16588
+ <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
16589
+ <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16590
+ </xsl:when>
16511
16591
  <xsl:when test="$formatted = 'true'">
16512
16592
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16513
16593
  </xsl:when>
@@ -16679,14 +16759,8 @@
16679
16759
  <xsl:value-of select="$src"/>
16680
16760
  </xsl:when>
16681
16761
  <xsl:otherwise>
16682
- <xsl:choose>
16683
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
16684
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
16685
- </xsl:when>
16686
- <xsl:otherwise>
16687
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
16688
- </xsl:otherwise>
16689
- </xsl:choose>
16762
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
16763
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
16690
16764
  </xsl:otherwise>
16691
16765
  </xsl:choose>
16692
16766
  </xsl:template>
@@ -16708,15 +16782,23 @@
16708
16782
  <!-- END: insert cover page image -->
16709
16783
 
16710
16784
  <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
16785
+ <xsl:variable name="regex_ja_spec_half_width_">
16786
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
16787
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
16788
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
16789
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
16790
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
16791
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
16792
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
16793
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
16794
+ </xsl:variable>
16795
+ <xsl:variable name="regex_ja_spec_half_width" select="translate(normalize-space($regex_ja_spec_half_width_), ' ', '')"/>
16711
16796
  <xsl:variable name="regex_ja_spec_">[
16712
16797
  <!-- Rotate 90° clockwise -->
16713
- \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
16798
+ <xsl:value-of select="$regex_ja_spec_half_width"/>
16714
16799
  \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
16715
- \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
16716
16800
  \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
16717
- \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
16718
16801
  \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
16719
- \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
16720
16802
  \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
16721
16803
  \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
16722
16804
  \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
@@ -16724,21 +16806,16 @@
16724
16806
  \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
16725
16807
  \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
16726
16808
  \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
16727
- \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
16728
16809
  \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
16729
- \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
16730
16810
  \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
16731
16811
  \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
16732
16812
  \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
16733
- \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
16734
16813
  \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
16735
- \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
16736
16814
  \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
16737
16815
  \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
16738
16816
  \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
16739
16817
  \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
16740
16818
  \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
16741
-
16742
16819
  \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
16743
16820
  \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
16744
16821
  \u301C <!-- U+301C WAVE DASH (〜) -->
@@ -16770,6 +16847,7 @@
16770
16847
  <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
16771
16848
  <xsl:template name="insertVerticalChar">
16772
16849
  <xsl:param name="str"/>
16850
+ <xsl:param name="char_prev"/>
16773
16851
  <xsl:param name="writing-mode">lr-tb</xsl:param>
16774
16852
  <xsl:param name="reference-orientation">90</xsl:param>
16775
16853
  <xsl:param name="add_zero_width_space">false</xsl:param>
@@ -16779,53 +16857,99 @@
16779
16857
  </xsl:when>
16780
16858
  <xsl:otherwise>
16781
16859
  <xsl:if test="string-length($str) &gt; 0">
16782
- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
16860
+
16861
+ <!-- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/> -->
16783
16862
  <xsl:variable name="char" select="substring($str,1,1)"/>
16784
- <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
16785
- <xsl:if test="normalize-space($writing-mode) != ''">
16786
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
16787
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
16788
- </xsl:if>
16789
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
16790
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
16791
- </xsl:if>
16792
- <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
16793
- <!-- Rotate 180°:
16794
- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
16795
- U+3002 IDEOGRAPHIC FULL STOP (。)
16796
- U+FE52 SMALL FULL STOP (﹒)
16797
- U+FF0E FULLWIDTH FULL STOP ()
16798
- -->
16799
- <xsl:attribute name="reference-orientation">-90</xsl:attribute>
16800
- </xsl:if>
16801
- <fo:block-container width="1em">
16802
- <fo:block line-height="1em">
16803
- <xsl:choose>
16804
- <xsl:when test="$horizontal_mode = 'true'">
16805
- <xsl:value-of select="$str"/>
16806
- </xsl:when>
16807
- <xsl:otherwise>
16863
+ <xsl:variable name="char_next" select="substring($str,2,1)"/>
16864
+
16865
+ <xsl:variable name="char_half_width" select="normalize-space(java:matches(java:java.lang.String.new($char), concat('([', $regex_ja_spec_half_width, ']{1,})')))"/>
16866
+
16867
+ <xsl:choose>
16868
+ <xsl:when test="$char_half_width = 'true'">
16869
+ <fo:inline>
16870
+ <xsl:attribute name="baseline-shift">7%</xsl:attribute>
16871
+ <xsl:value-of select="$char"/>
16872
+ </fo:inline>
16873
+ </xsl:when>
16874
+ <xsl:otherwise>
16875
+ <!-- namespace-uri(ancestor::*[local-name() = 'title']) != '' to skip title from $contents -->
16876
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_prev = '' and ../preceding-sibling::node())">
16877
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
16878
+ </xsl:if>
16879
+ <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm" role="SKIP" text-align-last="center">
16880
+ <xsl:if test="normalize-space($writing-mode) != ''">
16881
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
16882
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
16883
+ </xsl:if>
16884
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
16885
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
16886
+ </xsl:if>
16887
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
16888
+ <!-- Rotate 180°:
16889
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
16890
+ U+3002 IDEOGRAPHIC FULL STOP (。)
16891
+ U+FE52 SMALL FULL STOP (﹒)
16892
+ U+FF0E FULLWIDTH FULL STOP (.)
16893
+ -->
16894
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
16895
+ </xsl:if>
16896
+ <fo:block-container width="1em" role="SKIP"><!-- border="0.5pt solid blue" -->
16897
+ <fo:block line-height="1em" role="SKIP">
16898
+ <!-- <xsl:choose>
16899
+ <xsl:when test="$horizontal_mode = 'true'">
16900
+ <xsl:value-of select="$str"/>
16901
+ </xsl:when>
16902
+ <xsl:otherwise>
16903
+ <xsl:value-of select="$char"/>
16904
+ </xsl:otherwise>
16905
+ </xsl:choose> -->
16808
16906
  <xsl:value-of select="$char"/>
16809
- </xsl:otherwise>
16810
- </xsl:choose>
16811
- </fo:block>
16812
- </fo:block-container>
16813
- </fo:inline-container>
16814
- <xsl:if test="$add_zero_width_space = 'true' and ($char = ',' or $char = '.' or $char = ' ' or $char = '·' or $char = ')' or $char = ']' or $char = '}')"><xsl:value-of select="$zero_width_space"/></xsl:if>
16815
-
16816
- <xsl:if test="$horizontal_mode = 'false'">
16817
- <xsl:call-template name="insertVerticalChar">
16818
- <xsl:with-param name="str" select="substring($str, 2)"/>
16819
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
16820
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
16821
- <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
16822
- </xsl:call-template>
16823
- </xsl:if>
16907
+ </fo:block>
16908
+ </fo:block-container>
16909
+ </fo:inline-container>
16910
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_next != '' or ../following-sibling::node())">
16911
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
16912
+ </xsl:if>
16913
+ </xsl:otherwise>
16914
+ </xsl:choose>
16915
+
16916
+ <xsl:if test="$add_zero_width_space = 'true' and ($char = ',' or $char = '.' or $char = ' ' or $char = '·' or $char = ')' or $char = ']' or $char = '}' or $char = '/')"><xsl:value-of select="$zero_width_space"/></xsl:if>
16917
+ <!-- <xsl:if test="$horizontal_mode = 'false'"> -->
16918
+ <xsl:call-template name="insertVerticalChar">
16919
+ <xsl:with-param name="str" select="substring($str, 2)"/>
16920
+ <xsl:with-param name="char_prev" select="$char"/>
16921
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
16922
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
16923
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
16924
+ </xsl:call-template>
16925
+ <!-- </xsl:if> -->
16824
16926
  </xsl:if>
16825
16927
  </xsl:otherwise>
16826
16928
  </xsl:choose>
16827
16929
  </xsl:template>
16828
16930
 
16931
+ <xsl:template name="insertHorizontalChars">
16932
+ <xsl:param name="str"/>
16933
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
16934
+ <xsl:param name="reference-orientation">90</xsl:param>
16935
+ <xsl:param name="add_zero_width_space">false</xsl:param>
16936
+ <xsl:choose>
16937
+ <xsl:otherwise>
16938
+ <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm" role="SKIP">
16939
+ <xsl:if test="normalize-space($writing-mode) != ''">
16940
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
16941
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
16942
+ </xsl:if>
16943
+ <fo:block-container width="1em" role="SKIP"> <!-- border="0.5pt solid green" -->
16944
+ <fo:block line-height="1em" role="SKIP">
16945
+ <xsl:value-of select="$str"/>
16946
+ </fo:block>
16947
+ </fo:block-container>
16948
+ </fo:inline-container>
16949
+ </xsl:otherwise>
16950
+ </xsl:choose>
16951
+ </xsl:template>
16952
+
16829
16953
  <xsl:template name="number-to-words">
16830
16954
  <xsl:param name="number"/>
16831
16955
  <xsl:param name="first"/>