metanorma-bipm 2.5.8 → 2.5.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -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>
@@ -1344,6 +1376,7 @@
1344
1376
  <fo:block> </fo:block>
1345
1377
  <fo:block> </fo:block>
1346
1378
  <fo:block> </fo:block>
1379
+ <fo:block text-align="right"><xsl:value-of select="bipm:bibdata/bipm:version/bipm:draft"/></fo:block>
1347
1380
  <fo:block text-align-last="justify">
1348
1381
  <fo:inline>
1349
1382
  <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:appendix">
@@ -1838,7 +1871,7 @@
1838
1871
 
1839
1872
  <xsl:template name="insertContentItem">
1840
1873
  <xsl:param name="keep-with-next"/>
1841
- <fo:table-row>
1874
+ <fo:table-row role="TOCI">
1842
1875
  <xsl:if test="$keep-with-next = 'true'">
1843
1876
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1844
1877
  </xsl:if>
@@ -1856,14 +1889,14 @@
1856
1889
  </xsl:choose>
1857
1890
  </xsl:variable>
1858
1891
 
1859
- <fo:table-cell>
1892
+ <fo:table-cell role="SKIP">
1860
1893
  <xsl:if test="normalize-space($space-before) != ''">
1861
1894
  <xsl:attribute name="padding-top"><xsl:value-of select="normalize-space($space-before)"/></xsl:attribute>
1862
1895
  </xsl:if>
1863
1896
  <xsl:if test="normalize-space($space-after) != ''">
1864
1897
  <xsl:attribute name="padding-bottom"><xsl:value-of select="normalize-space($space-after)"/></xsl:attribute>
1865
1898
  </xsl:if>
1866
- <fo:block role="TOCI">
1899
+ <fo:block role="SKIP">
1867
1900
  <xsl:if test="@level = 1">
1868
1901
  <xsl:attribute name="font-family">Arial</xsl:attribute>
1869
1902
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -1891,7 +1924,7 @@
1891
1924
  <xsl:attribute name="space-before">14pt</xsl:attribute>
1892
1925
  </xsl:if>
1893
1926
 
1894
- <fo:list-block>
1927
+ <fo:list-block role="SKIP">
1895
1928
  <xsl:attribute name="provisional-distance-between-starts">
1896
1929
  <xsl:choose>
1897
1930
  <xsl:when test="@section = '' or @level &gt; 3">0mm</xsl:when>
@@ -1902,9 +1935,9 @@
1902
1935
  </xsl:choose>
1903
1936
  </xsl:attribute>
1904
1937
 
1905
- <fo:list-item>
1906
- <fo:list-item-label end-indent="label-end()">
1907
- <fo:block>
1938
+ <fo:list-item role="SKIP">
1939
+ <fo:list-item-label end-indent="label-end()" role="SKIP">
1940
+ <fo:block role="SKIP">
1908
1941
  <xsl:if test="@level = 1 or (@level = 2 and not(@parent = 'annex'))">
1909
1942
  <xsl:value-of select="@section"/>
1910
1943
  <xsl:if test="normalize-space(@section) != '' and @type = 'annex'">.</xsl:if>
@@ -1912,18 +1945,18 @@
1912
1945
 
1913
1946
  </fo:block>
1914
1947
  </fo:list-item-label>
1915
- <fo:list-item-body start-indent="body-start()">
1916
- <fo:block>
1948
+ <fo:list-item-body start-indent="body-start()" role="SKIP">
1949
+ <fo:block role="SKIP">
1917
1950
  <xsl:if test="@level &gt;= 3">
1918
1951
  <xsl:attribute name="margin-left">11mm</xsl:attribute>
1919
1952
  <xsl:attribute name="text-indent">-11mm</xsl:attribute>
1920
1953
  </xsl:if>
1921
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1954
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}" role="SKIP">
1922
1955
  <xsl:if test="@level &gt;= 3">
1923
- <fo:inline padding-right="2mm"><xsl:value-of select="@section"/></fo:inline>
1956
+ <fo:inline padding-right="2mm" role="SKIP"><xsl:value-of select="@section"/></fo:inline>
1924
1957
  </xsl:if>
1925
1958
 
1926
- <fo:inline>
1959
+ <fo:inline role="SKIP">
1927
1960
  <xsl:apply-templates select="title"/>
1928
1961
  </fo:inline>
1929
1962
 
@@ -1934,16 +1967,16 @@
1934
1967
  </fo:list-block>
1935
1968
  </fo:block>
1936
1969
  </fo:table-cell>
1937
- <fo:table-cell text-align="right">
1970
+ <fo:table-cell text-align="right" role="SKIP">
1938
1971
  <xsl:if test="normalize-space($space-before) != ''">
1939
1972
  <xsl:attribute name="padding-top"><xsl:value-of select="normalize-space($space-before)"/></xsl:attribute>
1940
1973
  </xsl:if>
1941
1974
  <xsl:if test="normalize-space($space-after) != ''">
1942
1975
  <xsl:attribute name="padding-bottom"><xsl:value-of select="normalize-space($space-after)"/></xsl:attribute>
1943
1976
  </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>
1977
+ <fo:block role="SKIP">
1978
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}" role="SKIP">
1979
+ <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
1980
  </fo:basic-link>
1948
1981
  </fo:block>
1949
1982
  </fo:table-cell>
@@ -2287,6 +2320,10 @@
2287
2320
  <xsl:otherwise>
2288
2321
  <fo:block role="H{$level}">
2289
2322
 
2323
+ <xsl:if test="ancestor::*[local-name() = 'clause'][@type = 'toc'] and $level &gt;= 3">
2324
+ <xsl:attribute name="role">Caption</xsl:attribute>
2325
+ </xsl:if>
2326
+
2290
2327
  <xsl:choose>
2291
2328
  <xsl:when test="ancestor::bipm:annex and $level &gt;= 2">
2292
2329
  <xsl:if test="$level &gt;= 3">
@@ -3296,7 +3333,7 @@
3296
3333
  <!-- Table of Contents (ToC) processing -->
3297
3334
  <!-- =================== -->
3298
3335
  <xsl:template match="bipm:clause[@type = 'toc']" priority="3">
3299
- <fo:block role="TOC">
3336
+ <fo:block>
3300
3337
  <xsl:copy-of select="@id"/>
3301
3338
  <xsl:apply-templates select="bipm:title[1]"/>
3302
3339
 
@@ -3314,12 +3351,12 @@
3314
3351
  </xsl:call-template>
3315
3352
  </xsl:variable>
3316
3353
 
3317
- <fo:table width="100%" table-layout="fixed">
3354
+ <fo:table width="100%" table-layout="fixed" role="TOC">
3318
3355
  <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>
3356
+ <fo:table-header role="SKIP">
3357
+ <fo:table-row font-weight="bold" role="SKIP">
3358
+ <fo:table-cell text-align="right" font-size="9pt" font-family="Arial" role="SKIP">
3359
+ <fo:block role="Caption">
3323
3360
  <xsl:variable name="page">
3324
3361
  <xsl:call-template name="getLocalizedString">
3325
3362
  <xsl:with-param name="key">Page.sg</xsl:with-param>
@@ -3330,10 +3367,10 @@
3330
3367
  </fo:table-cell>
3331
3368
  </fo:table-row>
3332
3369
  </fo:table-header>
3333
- <fo:table-body>
3334
- <fo:table-row>
3335
- <fo:table-cell>
3336
- <fo:block>
3370
+ <fo:table-body role="SKIP">
3371
+ <fo:table-row role="SKIP">
3372
+ <fo:table-cell role="SKIP">
3373
+ <fo:block role="SKIP">
3337
3374
  <xsl:variable name="title_id" select="generate-id(bipm:title[1])"/>
3338
3375
  <xsl:apply-templates select="*[not(generate-id() = $title_id)]">
3339
3376
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3946,8 +3983,21 @@
3946
3983
 
3947
3984
  <!-- <xsl:strip-space elements="bipm:xref"/> -->
3948
3985
 
3949
- <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
3950
- <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
3986
+ <xsl:variable name="namespace_full_">
3987
+ <xsl:choose>
3988
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="namespace-uri(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
3989
+ <xsl:otherwise><xsl:value-of select="namespace-uri(/*)"/></xsl:otherwise><!-- example: https://www.metanorma.org/ns/iso -->
3990
+ </xsl:choose>
3991
+ </xsl:variable>
3992
+ <xsl:variable name="namespace_full" select="normalize-space($namespace_full_)"/>
3993
+
3994
+ <xsl:variable name="root_element_">
3995
+ <xsl:choose>
3996
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="local-name(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
3997
+ <xsl:otherwise><xsl:value-of select="local-name(/*)"/></xsl:otherwise><!-- example: iso-standard -->
3998
+ </xsl:choose>
3999
+ </xsl:variable>
4000
+ <xsl:variable name="root_element" select="normalize-space($root_element_)"/>
3951
4001
 
3952
4002
  <xsl:variable name="document_scheme" select="normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
3953
4003
 
@@ -7296,7 +7346,9 @@
7296
7346
  <fo:block role="SKIP">
7297
7347
 
7298
7348
  <xsl:if test="$isGenerateTableIF = 'true'">
7299
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
7349
+
7350
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
7351
+
7300
7352
  </xsl:if>
7301
7353
 
7302
7354
  <xsl:if test="not(.//bipm:image)">
@@ -8337,7 +8389,17 @@
8337
8389
  <xsl:call-template name="refine_dt-cell-style"/>
8338
8390
 
8339
8391
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
8340
- <xsl:copy-of select="@id"/>
8392
+
8393
+ <xsl:choose>
8394
+ <xsl:when test="$isGenerateTableIF = 'true'">
8395
+
8396
+ <xsl:copy-of select="@id"/>
8397
+
8398
+ </xsl:when>
8399
+ <xsl:otherwise>
8400
+ <xsl:copy-of select="@id"/>
8401
+ </xsl:otherwise>
8402
+ </xsl:choose>
8341
8403
 
8342
8404
  <xsl:if test="normalize-space($key_iso) = 'true'">
8343
8405
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -8369,7 +8431,9 @@
8369
8431
  <fo:block role="SKIP">
8370
8432
 
8371
8433
  <xsl:if test="$isGenerateTableIF = 'true'">
8372
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
8434
+
8435
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
8436
+
8373
8437
  </xsl:if>
8374
8438
 
8375
8439
  <xsl:choose>
@@ -8845,6 +8909,12 @@
8845
8909
  </xsl:if>
8846
8910
  </xsl:template>
8847
8911
 
8912
+ <xsl:template match="*[local-name()='strike']">
8913
+ <fo:inline text-decoration="line-through">
8914
+ <xsl:apply-templates/>
8915
+ </fo:inline>
8916
+ </xsl:template>
8917
+
8848
8918
  <xsl:template match="*[local-name() = 'pagebreak']">
8849
8919
  <fo:block break-after="page"/>
8850
8920
  <fo:block> </fo:block>
@@ -9607,6 +9677,14 @@
9607
9677
  </xsl:for-each>
9608
9678
  </xsl:variable>
9609
9679
 
9680
+ <!-- <xsl:if test="$debug = 'true'">
9681
+ <redirect:write file="{generate-id()}_words_with_width_sorted.xml">
9682
+ <td_text><xsl:copy-of select="$td_text"/></td_text>
9683
+ <words_with_width><xsl:copy-of select="$words_with_width"/></words_with_width>
9684
+ <xsl:copy-of select="$words_with_width_sorted"/>
9685
+ </redirect:write>
9686
+ </xsl:if> -->
9687
+
9610
9688
  <xsl:variable name="words">
9611
9689
  <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
9612
9690
  <word>
@@ -9732,6 +9810,7 @@
9732
9810
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
9733
9811
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
9734
9812
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
9813
+ <xsl:if test="ancestor::*[local-name() = 'font_en_vertical']"><tag>font_en_vertical</tag></xsl:if>
9735
9814
  </tags>
9736
9815
  </xsl:template>
9737
9816
  <!-- =============================== -->
@@ -10304,7 +10383,16 @@
10304
10383
  </xsl:when>
10305
10384
  <xsl:otherwise>
10306
10385
  <!-- output text from <link>text</link> -->
10307
- <xsl:apply-templates/>
10386
+ <xsl:choose>
10387
+ <xsl:when test="starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.')">
10388
+ <xsl:call-template name="add-zero-spaces-link-java">
10389
+ <xsl:with-param name="text" select="."/>
10390
+ </xsl:call-template>
10391
+ </xsl:when>
10392
+ <xsl:otherwise>
10393
+ <xsl:apply-templates/>
10394
+ </xsl:otherwise>
10395
+ </xsl:choose>
10308
10396
  </xsl:otherwise>
10309
10397
  </xsl:choose>
10310
10398
  </fo:basic-link>
@@ -10964,16 +11052,29 @@
10964
11052
  <xsl:template name="getImageSrc">
10965
11053
  <xsl:choose>
10966
11054
  <xsl:when test="not(starts-with(@src, 'data:'))">
11055
+ <xsl:call-template name="getImageSrcExternal"/>
11056
+ </xsl:when>
11057
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
11058
+ </xsl:choose>
11059
+ </xsl:template>
11060
+
11061
+ <xsl:template name="getImageSrcExternal">
11062
+ <xsl:choose>
11063
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
11064
+ <xsl:value-of select="@src"/>
11065
+ </xsl:when>
11066
+ <xsl:otherwise>
11067
+ <xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/>
11068
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/>
10967
11069
  <xsl:choose>
10968
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
10969
- <xsl:value-of select="@src"/>
11070
+ <xsl:when test="$file_exists = 'true'">
11071
+ <xsl:value-of select="$src_with_basepath"/>
10970
11072
  </xsl:when>
10971
11073
  <xsl:otherwise>
10972
- <xsl:value-of select="concat($basepath, @src)"/>
11074
+ <xsl:value-of select="@src"/>
10973
11075
  </xsl:otherwise>
10974
11076
  </xsl:choose>
10975
- </xsl:when>
10976
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
11077
+ </xsl:otherwise>
10977
11078
  </xsl:choose>
10978
11079
  </xsl:template>
10979
11080
 
@@ -11021,14 +11122,8 @@
11021
11122
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
11022
11123
  </xsl:when>
11023
11124
  <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>
11125
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
11126
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
11032
11127
  </xsl:when>
11033
11128
  <xsl:otherwise>
11034
11129
  <xsl:value-of select="@src"/>
@@ -11049,16 +11144,8 @@
11049
11144
  </svg>
11050
11145
  </xsl:when>
11051
11146
  <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>
11147
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
11148
+ <xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/>
11062
11149
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
11063
11150
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
11064
11151
  <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
@@ -15190,7 +15277,9 @@
15190
15277
  <xsl:template name="add_id">
15191
15278
  <xsl:if test="not(@id)">
15192
15279
  <!-- 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>
15280
+ <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
15281
+ <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>
15282
+ <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
15194
15283
  </xsl:if>
15195
15284
  </xsl:template>
15196
15285
 
@@ -16122,7 +16211,14 @@
16122
16211
  <xsl:variable name="title">
16123
16212
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
16124
16213
 
16125
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
16214
+ <xsl:choose>
16215
+ <xsl:when test="*[local-name() = 'title'][@language = $lang and @type = 'main']">
16216
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
16217
+ </xsl:when>
16218
+ <xsl:otherwise>
16219
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'title-main']"/>
16220
+ </xsl:otherwise>
16221
+ </xsl:choose>
16126
16222
 
16127
16223
  </xsl:for-each>
16128
16224
  </xsl:variable>
@@ -16495,6 +16591,7 @@
16495
16591
  <xsl:param name="formatted">false</xsl:param>
16496
16592
  <xsl:param name="lang"/>
16497
16593
  <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
16594
+ <xsl:param name="bibdata_updated"/>
16498
16595
 
16499
16596
  <xsl:variable name="curr_lang">
16500
16597
  <xsl:choose>
@@ -16508,6 +16605,9 @@
16508
16605
 
16509
16606
  <xsl:variable name="data_value">
16510
16607
  <xsl:choose>
16608
+ <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
16609
+ <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16610
+ </xsl:when>
16511
16611
  <xsl:when test="$formatted = 'true'">
16512
16612
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
16513
16613
  </xsl:when>
@@ -16679,14 +16779,8 @@
16679
16779
  <xsl:value-of select="$src"/>
16680
16780
  </xsl:when>
16681
16781
  <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>
16782
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
16783
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
16690
16784
  </xsl:otherwise>
16691
16785
  </xsl:choose>
16692
16786
  </xsl:template>
@@ -16708,15 +16802,23 @@
16708
16802
  <!-- END: insert cover page image -->
16709
16803
 
16710
16804
  <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
16805
+ <xsl:variable name="regex_ja_spec_half_width_">
16806
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
16807
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
16808
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
16809
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
16810
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
16811
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
16812
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
16813
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
16814
+ </xsl:variable>
16815
+ <xsl:variable name="regex_ja_spec_half_width" select="translate(normalize-space($regex_ja_spec_half_width_), ' ', '')"/>
16711
16816
  <xsl:variable name="regex_ja_spec_">[
16712
16817
  <!-- Rotate 90° clockwise -->
16713
- \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
16818
+ <xsl:value-of select="$regex_ja_spec_half_width"/>
16714
16819
  \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
16715
- \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
16716
16820
  \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
16717
- \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
16718
16821
  \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
16719
- \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
16720
16822
  \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
16721
16823
  \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
16722
16824
  \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
@@ -16724,21 +16826,16 @@
16724
16826
  \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
16725
16827
  \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
16726
16828
  \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
16727
- \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
16728
16829
  \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
16729
- \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
16730
16830
  \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
16731
16831
  \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
16732
16832
  \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
16733
- \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
16734
16833
  \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
16735
- \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
16736
16834
  \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
16737
16835
  \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
16738
16836
  \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
16739
16837
  \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
16740
16838
  \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
16741
-
16742
16839
  \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
16743
16840
  \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
16744
16841
  \u301C <!-- U+301C WAVE DASH (〜) -->
@@ -16770,6 +16867,7 @@
16770
16867
  <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
16771
16868
  <xsl:template name="insertVerticalChar">
16772
16869
  <xsl:param name="str"/>
16870
+ <xsl:param name="char_prev"/>
16773
16871
  <xsl:param name="writing-mode">lr-tb</xsl:param>
16774
16872
  <xsl:param name="reference-orientation">90</xsl:param>
16775
16873
  <xsl:param name="add_zero_width_space">false</xsl:param>
@@ -16779,53 +16877,99 @@
16779
16877
  </xsl:when>
16780
16878
  <xsl:otherwise>
16781
16879
  <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)"/>
16880
+
16881
+ <!-- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/> -->
16783
16882
  <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>
16883
+ <xsl:variable name="char_next" select="substring($str,2,1)"/>
16884
+
16885
+ <xsl:variable name="char_half_width" select="normalize-space(java:matches(java:java.lang.String.new($char), concat('([', $regex_ja_spec_half_width, ']{1,})')))"/>
16886
+
16887
+ <xsl:choose>
16888
+ <xsl:when test="$char_half_width = 'true'">
16889
+ <fo:inline>
16890
+ <xsl:attribute name="baseline-shift">7%</xsl:attribute>
16891
+ <xsl:value-of select="$char"/>
16892
+ </fo:inline>
16893
+ </xsl:when>
16894
+ <xsl:otherwise>
16895
+ <!-- namespace-uri(ancestor::*[local-name() = 'title']) != '' to skip title from $contents -->
16896
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_prev = '' and ../preceding-sibling::node())">
16897
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
16898
+ </xsl:if>
16899
+ <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">
16900
+ <xsl:if test="normalize-space($writing-mode) != ''">
16901
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
16902
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
16903
+ </xsl:if>
16904
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
16905
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
16906
+ </xsl:if>
16907
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
16908
+ <!-- Rotate 180°:
16909
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
16910
+ U+3002 IDEOGRAPHIC FULL STOP (。)
16911
+ U+FE52 SMALL FULL STOP (﹒)
16912
+ U+FF0E FULLWIDTH FULL STOP (.)
16913
+ -->
16914
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
16915
+ </xsl:if>
16916
+ <fo:block-container width="1em" role="SKIP"><!-- border="0.5pt solid blue" -->
16917
+ <fo:block line-height="1em" role="SKIP">
16918
+ <!-- <xsl:choose>
16919
+ <xsl:when test="$horizontal_mode = 'true'">
16920
+ <xsl:value-of select="$str"/>
16921
+ </xsl:when>
16922
+ <xsl:otherwise>
16923
+ <xsl:value-of select="$char"/>
16924
+ </xsl:otherwise>
16925
+ </xsl:choose> -->
16808
16926
  <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>
16927
+ </fo:block>
16928
+ </fo:block-container>
16929
+ </fo:inline-container>
16930
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_next != '' or ../following-sibling::node())">
16931
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
16932
+ </xsl:if>
16933
+ </xsl:otherwise>
16934
+ </xsl:choose>
16935
+
16936
+ <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>
16937
+ <!-- <xsl:if test="$horizontal_mode = 'false'"> -->
16938
+ <xsl:call-template name="insertVerticalChar">
16939
+ <xsl:with-param name="str" select="substring($str, 2)"/>
16940
+ <xsl:with-param name="char_prev" select="$char"/>
16941
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
16942
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
16943
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
16944
+ </xsl:call-template>
16945
+ <!-- </xsl:if> -->
16824
16946
  </xsl:if>
16825
16947
  </xsl:otherwise>
16826
16948
  </xsl:choose>
16827
16949
  </xsl:template>
16828
16950
 
16951
+ <xsl:template name="insertHorizontalChars">
16952
+ <xsl:param name="str"/>
16953
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
16954
+ <xsl:param name="reference-orientation">90</xsl:param>
16955
+ <xsl:param name="add_zero_width_space">false</xsl:param>
16956
+ <xsl:choose>
16957
+ <xsl:otherwise>
16958
+ <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">
16959
+ <xsl:if test="normalize-space($writing-mode) != ''">
16960
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
16961
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
16962
+ </xsl:if>
16963
+ <fo:block-container width="1em" role="SKIP"> <!-- border="0.5pt solid green" -->
16964
+ <fo:block line-height="1em" role="SKIP">
16965
+ <xsl:value-of select="$str"/>
16966
+ </fo:block>
16967
+ </fo:block-container>
16968
+ </fo:inline-container>
16969
+ </xsl:otherwise>
16970
+ </xsl:choose>
16971
+ </xsl:template>
16972
+
16829
16973
  <xsl:template name="number-to-words">
16830
16974
  <xsl:param name="number"/>
16831
16975
  <xsl:param name="first"/>