metanorma-bipm 2.2.13 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -243,13 +243,13 @@
243
243
  <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:copyright/jcgm:from"/>
244
244
  </fo:block>
245
245
  <fo:block font-size="13pt" font-weight="normal" space-after="19.5mm">
246
- <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@type = 'provenance']"/>
246
+ <xsl:value-of select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@type = 'title-provenance']"/>
247
247
  </fo:block>
248
248
  <fo:block border-bottom="1pt solid black"> </fo:block>
249
249
  <fo:block font-size="16.5pt" margin-left="-0.5mm" padding-top="3.5mm" space-after="7mm" margin-right="7mm" line-height="105%" role="H1">
250
- <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
250
+ <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'title-main']" mode="title"/>
251
251
  <xsl:variable name="title_part">
252
- <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'part']" mode="title"/>
252
+ <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'title-part']" mode="title"/>
253
253
  </xsl:variable>
254
254
  <xsl:if test="normalize-space($title_part) != ''">
255
255
  <xsl:text> — </xsl:text>
@@ -258,9 +258,9 @@
258
258
  </fo:block>
259
259
  <fo:block font-size="12pt" font-style="italic" line-height="140%" role="H1">
260
260
  <xsl:variable name="secondLang" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title/@language[. != $lang]"/>
261
- <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'main']" mode="title"/>
261
+ <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'title-main']" mode="title"/>
262
262
  <xsl:variable name="title_part">
263
- <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'part']" mode="title"/>
263
+ <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'title-part']" mode="title"/>
264
264
  </xsl:variable>
265
265
  <xsl:if test="normalize-space($title_part) != ''">
266
266
  <xsl:text> — </xsl:text>
@@ -297,9 +297,9 @@
297
297
  </fo:table-body>
298
298
  </fo:table>
299
299
  <fo:block font-size="18pt" space-before="70mm" role="H1">
300
- <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'main']" mode="title"/>
300
+ <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'title-main']" mode="title"/>
301
301
  <xsl:variable name="title_part">
302
- <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'part']" mode="title"/>
302
+ <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $lang and @type = 'title-part']" mode="title"/>
303
303
  </xsl:variable>
304
304
  <xsl:if test="normalize-space($title_part) != ''">
305
305
  <xsl:text> — </xsl:text>
@@ -308,9 +308,9 @@
308
308
  </fo:block>
309
309
  <fo:block font-size="13pt" space-before="35mm" role="H1">
310
310
  <xsl:variable name="secondLang" select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title/@language[. != $lang]"/>
311
- <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'main']" mode="title"/>
311
+ <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'title-main']" mode="title"/>
312
312
  <xsl:variable name="title_part">
313
- <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'part']" mode="title"/>
313
+ <xsl:apply-templates select="(//jcgm:bipm-standard)[1]/jcgm:bibdata/jcgm:title[@language = $secondLang and @type = 'title-part']" mode="title"/>
314
314
  </xsl:variable>
315
315
  <xsl:if test="normalize-space($title_part) != ''">
316
316
  <xsl:text> — </xsl:text>
@@ -397,14 +397,16 @@
397
397
 
398
398
  <fo:flow flow-name="xsl-region-body" line-height="115%">
399
399
 
400
- <fo:block-container>
400
+ <xsl:if test="count(//*[local-name() = 'bipm-standard']) != 1 ">
401
+ <!-- <fo:block-container> -->
401
402
  <!-- Show title -->
402
403
  <!-- Example: Evaluation of measurement data — An introduction to the `Guide to the expression of uncertainty in measurement' and related documents -->
403
404
 
404
405
  <xsl:for-each select="//*[local-name() = 'bipm-standard']">
405
- <fo:block font-size="20pt" font-weight="bold" margin-bottom="20pt" space-before="36pt" line-height="1.1">
406
- <xsl:variable name="curr_lang" select="*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
407
406
 
407
+ <!-- <fo:block font-size="20pt" font-weight="bold" margin-bottom="20pt" space-before="36pt" line-height="1.1">
408
+ <xsl:variable name="curr_lang" select="*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
409
+
408
410
  <xsl:variable name="title-main">
409
411
  <xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $curr_lang and @type = 'main']" mode="title"/>
410
412
  </xsl:variable>
@@ -412,7 +414,7 @@
412
414
  <xsl:variable name="title-part">
413
415
  <xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $curr_lang and @type = 'part']" mode="title"/>
414
416
  </xsl:variable>
415
-
417
+
416
418
  <fo:block role="H1">
417
419
  <xsl:copy-of select="$title-main"/>
418
420
  <xsl:if test="normalize-space($title-main) != '' and normalize-space($title-part) != ''">
@@ -420,7 +422,7 @@
420
422
  </xsl:if>
421
423
  <xsl:copy-of select="$title-part"/>
422
424
  </fo:block>
423
-
425
+
424
426
  <xsl:variable name="edition">
425
427
  <xsl:apply-templates select="./*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) = '']">
426
428
  <xsl:with-param name="curr_lang" select="$curr_lang"/>
@@ -429,11 +431,14 @@
429
431
  <xsl:if test="normalize-space($edition) != ''">
430
432
  <fo:block margin-top="12pt"><xsl:copy-of select="$edition"/></fo:block>
431
433
  </xsl:if>
434
+
435
+ </fo:block> -->
432
436
 
433
- </fo:block>
434
- </xsl:for-each>
437
+ <xsl:apply-templates select="jcgmsections/jcgm:p[starts-with(@class, 'zzSTDTitle')]"/>
435
438
 
436
- </fo:block-container>
439
+ </xsl:for-each>
440
+ <!-- </fo:block-container> -->
441
+ </xsl:if>
437
442
  <!-- Clause(s) -->
438
443
  <fo:block>
439
444
  <xsl:choose>
@@ -581,6 +586,32 @@
581
586
  </fo:block>
582
587
  </xsl:template>
583
588
 
589
+ <xsl:template match="jcgm:sections/jcgm:p[@class = 'zzSTDTitle1']" priority="4">
590
+ <fo:block font-size="20pt" font-weight="bold" margin-bottom="20pt" space-before="36pt" line-height="1.1" role="H1">
591
+ <xsl:if test="following-sibling::*[1][self::jcgm:p][starts-with(@class, 'zzSTDTitle')]">
592
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
593
+ </xsl:if>
594
+ <xsl:apply-templates/>
595
+ </fo:block>
596
+ <xsl:variable name="curr_lang" select="ancestor::jcgm:bipm-standard/*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
597
+ <xsl:variable name="edition">
598
+ <xsl:apply-templates select="ancestor::jcgm:bipm-standard/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) = '']">
599
+ <xsl:with-param name="curr_lang" select="$curr_lang"/>
600
+ </xsl:apply-templates>
601
+ </xsl:variable>
602
+ <xsl:if test="normalize-space($edition) != ''">
603
+ <fo:block font-size="20pt" font-weight="bold" margin-top="12pt" margin-bottom="20pt" line-height="1.1">
604
+ <xsl:copy-of select="$edition"/>
605
+ </fo:block>
606
+ </xsl:if>
607
+ </xsl:template>
608
+
609
+ <xsl:template match="jcgm:sections/jcgm:p[@class = 'zzSTDTitle2']" priority="4">
610
+ <fo:block font-size="20pt" font-weight="bold" margin-top="12pt" margin-bottom="20pt" line-height="1.1">
611
+ <xsl:apply-templates/>
612
+ </fo:block>
613
+ </xsl:template>
614
+
584
615
  <xsl:template match="node()">
585
616
  <xsl:apply-templates/>
586
617
  </xsl:template>
@@ -1839,19 +1870,32 @@
1839
1870
  <xsl:variable name="titles_">
1840
1871
 
1841
1872
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
1842
- <title-toc lang="en">
1843
-
1844
- </title-toc>
1845
- <title-toc lang="fr">
1873
+ <!-- <title-toc lang="en">
1874
+ <xsl:if test="$namespace = 'csd' or $namespace = 'ieee' or $namespace = 'iho' or $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'unece-rec'">
1875
+ <xsl:text>Contents</xsl:text>
1876
+ </xsl:if>
1877
+ <xsl:if test="$namespace = 'csa' or $namespace = 'm3d' or $namespace = 'nist-sp' or $namespace = 'ogc-white-paper'">
1878
+ <xsl:text>Table of Contents</xsl:text>
1879
+ </xsl:if>
1880
+ <xsl:if test="$namespace = 'gb'">
1881
+ <xsl:text>Table of contents</xsl:text>
1882
+ </xsl:if>
1883
+ </title-toc> -->
1884
+ <title-toc lang="en">Table of contents</title-toc>
1885
+ <!-- <title-toc lang="fr">
1846
1886
  <xsl:text>Sommaire</xsl:text>
1847
- </title-toc>
1848
- <title-toc lang="zh">
1849
-
1887
+ </title-toc> -->
1888
+ <!-- <title-toc lang="zh">
1889
+ <xsl:choose>
1890
+ <xsl:when test="$namespace = 'gb'">
1891
+ <xsl:text>目次</xsl:text>
1892
+ </xsl:when>
1893
+ <xsl:otherwise>
1850
1894
  <xsl:text>Contents</xsl:text>
1851
-
1852
- </title-toc>
1853
-
1854
- <title-descriptors lang="en">Descriptors</title-descriptors>
1895
+ </xsl:otherwise>
1896
+ </xsl:choose>
1897
+ </title-toc> -->
1898
+ <title-toc lang="zh">目次</title-toc>
1855
1899
 
1856
1900
  <title-part lang="en">
1857
1901
 
@@ -1867,20 +1911,6 @@
1867
1911
  <title-subpart lang="en">Sub-part #</title-subpart>
1868
1912
  <title-subpart lang="fr">Partie de sub #</title-subpart>
1869
1913
 
1870
- <title-list-tables lang="en">List of Tables</title-list-tables>
1871
-
1872
- <title-list-figures lang="en">List of Figures</title-list-figures>
1873
-
1874
- <title-table-figures lang="en">Table of Figures</title-table-figures>
1875
-
1876
- <title-list-recommendations lang="en">List of Recommendations</title-list-recommendations>
1877
-
1878
- <title-summary lang="en">Summary</title-summary>
1879
-
1880
- <title-continued lang="ru">(продолжение)</title-continued>
1881
- <title-continued lang="en">(continued)</title-continued>
1882
- <title-continued lang="fr">(continué)</title-continued>
1883
-
1884
1914
  </xsl:variable>
1885
1915
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
1886
1916
 
@@ -1888,8 +1918,8 @@
1888
1918
  <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1889
1919
  <xsl:value-of select="$toc_table_title"/>
1890
1920
  <xsl:if test="normalize-space($toc_table_title) = ''">
1891
- <xsl:call-template name="getTitle">
1892
- <xsl:with-param name="name" select="'title-list-tables'"/>
1921
+ <xsl:call-template name="getLocalizedString">
1922
+ <xsl:with-param name="key">toc_tables</xsl:with-param>
1893
1923
  </xsl:call-template>
1894
1924
  </xsl:if>
1895
1925
  </xsl:variable>
@@ -1898,8 +1928,8 @@
1898
1928
  <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1899
1929
  <xsl:value-of select="$toc_figure_title"/>
1900
1930
  <xsl:if test="normalize-space($toc_figure_title) = ''">
1901
- <xsl:call-template name="getTitle">
1902
- <xsl:with-param name="name" select="'title-list-figures'"/>
1931
+ <xsl:call-template name="getLocalizedString">
1932
+ <xsl:with-param name="key">toc_figures</xsl:with-param>
1903
1933
  </xsl:call-template>
1904
1934
  </xsl:if>
1905
1935
  </xsl:variable>
@@ -1908,8 +1938,8 @@
1908
1938
  <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1909
1939
  <xsl:value-of select="$toc_requirement_title"/>
1910
1940
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
1911
- <xsl:call-template name="getTitle">
1912
- <xsl:with-param name="name" select="'title-list-recommendations'"/>
1941
+ <xsl:call-template name="getLocalizedString">
1942
+ <xsl:with-param name="key">toc_recommendations</xsl:with-param>
1913
1943
  </xsl:call-template>
1914
1944
  </xsl:if>
1915
1945
  </xsl:variable>
@@ -4379,13 +4409,13 @@
4379
4409
  <fo:table-body>
4380
4410
 
4381
4411
  <xsl:variable name="title_continued_">
4382
- <xsl:call-template name="getTitle">
4383
- <xsl:with-param name="name" select="'title-continued'"/>
4412
+ <xsl:call-template name="getLocalizedString">
4413
+ <xsl:with-param name="key">continued</xsl:with-param>
4384
4414
  </xsl:call-template>
4385
4415
  </xsl:variable>
4386
-
4416
+ <xsl:variable name="title_continued_in_parenthesis" select="concat('(',$title_continued_,')')"/>
4387
4417
  <xsl:variable name="title_continued">
4388
- <xsl:value-of select="$title_continued_"/>
4418
+ <xsl:value-of select="$title_continued_in_parenthesis"/>
4389
4419
 
4390
4420
  </xsl:variable>
4391
4421
 
@@ -5709,6 +5739,9 @@
5709
5739
  <!-- END Definition List -->
5710
5740
  <!-- ===================== -->
5711
5741
 
5742
+ <!-- default: ignore title in sections/p -->
5743
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
5744
+
5712
5745
  <!-- ========================= -->
5713
5746
  <!-- Rich text formatting -->
5714
5747
  <!-- ========================= -->
@@ -5787,7 +5820,7 @@
5787
5820
  <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
5788
5821
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
5789
5822
  <xsl:choose>
5790
- <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
5823
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), $regex_url_start, '$2') != ''">
5791
5824
  <!-- url -->
5792
5825
  <xsl:call-template name="add-zero-spaces-link-java"/>
5793
5826
  </xsl:when>
@@ -6249,10 +6282,13 @@
6249
6282
  </xsl:choose>
6250
6283
  </xsl:variable>
6251
6284
 
6285
+ <!-- replace sequence #x200B to one &#x200B -->
6286
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b{2,}', '​')"/>
6287
+
6252
6288
  <!-- replace sequence #x200B and space TO space -->
6253
- <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
6289
+ <xsl:variable name="text11" select="java:replaceAll(java:java.lang.String.new($text10), '\u200b ', ' ')"/>
6254
6290
 
6255
- <xsl:value-of select="$text10"/>
6291
+ <xsl:value-of select="$text11"/>
6256
6292
  </xsl:template>
6257
6293
 
6258
6294
  <xsl:template name="add-zero-spaces-link-java">
@@ -6262,8 +6298,12 @@
6262
6298
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
6263
6299
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
6264
6300
  <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
6301
+
6302
+ <!-- replace sequence #x200B to one &#x200B -->
6303
+ <xsl:variable name="url2" select="java:replaceAll(java:java.lang.String.new($url), '\u200b{2,}', '​')"/>
6304
+
6265
6305
  <!-- remove zero-width space at the end -->
6266
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
6306
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url2), '​$', '')"/>
6267
6307
  </xsl:template>
6268
6308
 
6269
6309
  <!-- add zero space after dash character (for table's entries) -->
@@ -7533,7 +7573,7 @@
7533
7573
 
7534
7574
  <xsl:call-template name="refine_note_block_style"/>
7535
7575
 
7536
- <fo:inline xsl:use-attribute-sets="note-name-style">
7576
+ <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
7537
7577
 
7538
7578
  <xsl:call-template name="refine_note-name-style"/>
7539
7579
 
@@ -7570,12 +7610,12 @@
7570
7610
  <xsl:variable name="num"><xsl:number/></xsl:variable>
7571
7611
  <xsl:choose>
7572
7612
  <xsl:when test="$num = 1"> <!-- display first NOTE's paragraph in the same line with label NOTE -->
7573
- <fo:inline xsl:use-attribute-sets="note-p-style">
7613
+ <fo:inline xsl:use-attribute-sets="note-p-style" role="SKIP">
7574
7614
  <xsl:apply-templates/>
7575
7615
  </fo:inline>
7576
7616
  </xsl:when>
7577
7617
  <xsl:otherwise>
7578
- <fo:block xsl:use-attribute-sets="note-p-style">
7618
+ <fo:block xsl:use-attribute-sets="note-p-style" role="SKIP">
7579
7619
  <xsl:apply-templates/>
7580
7620
  </fo:block>
7581
7621
  </xsl:otherwise>
@@ -7792,25 +7832,45 @@
7792
7832
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7793
7833
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7794
7834
 
7795
- <xsl:variable name="img_src">
7796
- <xsl:choose>
7797
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7798
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7799
- </xsl:choose>
7800
- </xsl:variable>
7835
+ <xsl:if test="@width != '' and @width != 'auto'">
7836
+ <xsl:attribute name="width">
7837
+ <xsl:value-of select="@width"/>
7838
+ </xsl:attribute>
7839
+ </xsl:if>
7801
7840
 
7802
- <xsl:variable name="image_width_effective">
7841
+ <xsl:if test="@height != '' and @height != 'auto'">
7842
+ <xsl:attribute name="height">
7843
+ <xsl:value-of select="@height"/>
7844
+ </xsl:attribute>
7845
+ </xsl:if>
7803
7846
 
7804
- <xsl:value-of select="$width_effective"/>
7847
+ <xsl:choose>
7848
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
7849
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
7850
+ </xsl:when>
7851
+ <xsl:otherwise>
7805
7852
 
7806
- </xsl:variable>
7853
+ <xsl:variable name="img_src">
7854
+ <xsl:choose>
7855
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7856
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7857
+ </xsl:choose>
7858
+ </xsl:variable>
7807
7859
 
7808
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7809
- <xsl:if test="number($scale) &lt; 100">
7860
+ <xsl:variable name="image_width_effective">
7810
7861
 
7811
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7862
+ <xsl:value-of select="$width_effective"/>
7812
7863
 
7813
- </xsl:if>
7864
+ </xsl:variable>
7865
+
7866
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7867
+ <xsl:if test="number($scale) &lt; 100">
7868
+
7869
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7870
+
7871
+ </xsl:if>
7872
+ </xsl:otherwise>
7873
+ </xsl:choose>
7814
7874
 
7815
7875
  </xsl:if>
7816
7876
 
@@ -11482,7 +11542,7 @@
11482
11542
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
11483
11543
  <xsl:apply-templates mode="update_xml_step1"/>
11484
11544
  </xsl:template>
11485
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11545
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11486
11546
  <xsl:copy>
11487
11547
  <xsl:copy-of select="@*"/>
11488
11548
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12048,7 +12108,7 @@
12048
12108
  <xsl:variable name="title">
12049
12109
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
12050
12110
 
12051
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'part']"/>
12111
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'title-part']"/>
12052
12112
 
12053
12113
  </xsl:for-each>
12054
12114
  </xsl:variable>
@@ -12071,7 +12131,7 @@
12071
12131
  <dc:description>
12072
12132
  <xsl:variable name="abstract">
12073
12133
 
12074
- <xsl:value-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
12134
+ <xsl:value-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = $lang and @type = 'title-main']"/>
12075
12135
 
12076
12136
  </xsl:variable>
12077
12137
  <xsl:value-of select="normalize-space($abstract)"/>
@@ -27,14 +27,14 @@ module IsoDoc
27
27
  def title(isoxml, _out)
28
28
  lang1, lang2 = @lang == "fr" ? %w(fr en) : %w(en fr)
29
29
  set(:doctitle, @c.encode(isoxml.at(
30
- ns("#{TITLE}[@type='main'][@language='#{lang1}']"))&.text || ""))
30
+ ns("#{TITLE}[@type='title-main'][@language='#{lang1}']"))&.text || ""))
31
31
  set(:docsubtitle, @c.encode(isoxml.at(
32
- ns("#{TITLE}[@type='main'][@language='#{lang2}']"))&.text || ""))
32
+ ns("#{TITLE}[@type='title-main'][@language='#{lang2}']"))&.text || ""))
33
33
  %w(appendix annex part subtitle provenance).each do |e|
34
34
  set("#{e}title".to_sym, @c.encode(isoxml.at(
35
- ns("#{TITLE}[@type='#{e}'][@language='#{lang1}']"))&.text || ""))
35
+ ns("#{TITLE}[@type='title-#{e}'][@language='#{lang1}']"))&.text || ""))
36
36
  set("#{e}subtitle".to_sym, @c.encode(isoxml.at(
37
- ns("#{TITLE}[@type='#{e}'][@language='#{lang2}']"))&.text || ""))
37
+ ns("#{TITLE}[@type='title-#{e}'][@language='#{lang2}']"))&.text || ""))
38
38
  end
39
39
  end
40
40
 
@@ -0,0 +1,41 @@
1
+ module IsoDoc
2
+ module BIPM
3
+ class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
4
+ def middle_title(docxml)
5
+ @jcgm or return nil
6
+ @iso.middle_title(docxml)
7
+ end
8
+
9
+ def table1(elem)
10
+ labelled_ancestor(elem) || elem["unnumbered"] and return
11
+ n = @xrefs.anchor(elem["id"], :label, false)
12
+ prefix_name(elem, ".<tab/>",
13
+ l10n("#{@i18n.table.capitalize} #{n}"), "name")
14
+ end
15
+
16
+ def figure1(elem)
17
+ if @jcgm
18
+ @iso.xrefs = @xrefs
19
+ @iso.figure1(elem)
20
+ else super
21
+ end
22
+ end
23
+
24
+ # notes and remarques (list notes) are not numbered
25
+ def note1(elem)
26
+ elem.parent.name == "bibitem" || elem["notag"] == "true" and return
27
+ lbl = l10n(note_label(elem))
28
+ prefix_name(elem, "", lbl, "name")
29
+ end
30
+
31
+ def note_label(elem)
32
+ if elem.ancestors("preface").empty?
33
+ if elem.ancestors("ul, ol, dl").empty?
34
+ @i18n.note
35
+ else @i18n.listnote end
36
+ else @i18n.prefacenote
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -5,6 +5,7 @@ require_relative "init"
5
5
  require_relative "index"
6
6
  require_relative "doccontrol"
7
7
  require_relative "../../relaton/render/general"
8
+ require_relative "presentation_blocks"
8
9
 
9
10
  module IsoDoc
10
11
  module BIPM
@@ -12,33 +13,25 @@ module IsoDoc
12
13
  def convert1(docxml, filename, dir)
13
14
  @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/" \
14
15
  "@acronym"))&.value == "JCGM"
15
- @iso = IsoDoc::Iso::PresentationXMLConvert
16
- .new({ language: @lang, script: @script })
17
- i18n = @iso.i18n_init(@lang, @script, @locale, nil)
18
- @iso.metadata_init(@lang, @script, @locale, i18n)
16
+ @xrefs.klass.jcgm = @jcgm
17
+ @jcgm and @iso = iso_processor(docxml)
19
18
  super
20
19
  end
21
20
 
21
+ def iso_processor(docxml)
22
+ iso = IsoDoc::Iso::PresentationXMLConvert
23
+ .new({ language: @lang, script: @script })
24
+ i18n = iso.i18n_init(@lang, @script, @locale, nil)
25
+ iso.metadata_init(@lang, @script, @locale, i18n)
26
+ iso.info(docxml, nil)
27
+ iso
28
+ end
29
+
22
30
  def eref_localities1(opt)
23
31
  @jcgm and return @iso.eref_localities1(opt)
24
32
  super
25
33
  end
26
34
 
27
- def table1(elem)
28
- labelled_ancestor(elem) || elem["unnumbered"] and return
29
- n = @xrefs.anchor(elem["id"], :label, false)
30
- prefix_name(elem, ".<tab/>",
31
- l10n("#{@i18n.table.capitalize} #{n}"), "name")
32
- end
33
-
34
- def figure1(elem)
35
- if @jcgm
36
- @iso.xrefs = @xrefs
37
- @iso.figure1(elem)
38
- else super
39
- end
40
- end
41
-
42
35
  def annex1(elem)
43
36
  @jcgm and return super
44
37
  elem["unnumbered"] == "true" and return
@@ -77,8 +70,8 @@ module IsoDoc
77
70
  end
78
71
 
79
72
  def conversions(docxml)
80
- super
81
73
  doccontrol docxml
74
+ super
82
75
  end
83
76
 
84
77
  def twitter_cldr_localiser_symbols
@@ -115,9 +108,9 @@ module IsoDoc
115
108
  def bibdata_titles(bibdata)
116
109
  app = bibdata.at(ns("//bibdata/ext/" \
117
110
  "structuredidentifier/part")) or return
118
- bibdata.xpath(ns("//bibdata/title[@type = 'part']")).each do |t|
111
+ bibdata.xpath(ns("//bibdata/title[@type = 'title-part']")).each do |t|
119
112
  t.previous = t.dup
120
- t["type"] = "part-with-numbering"
113
+ t["type"] = "title-part-with-numbering"
121
114
  part = t["language"] == "en" ? "Part" : "Partie" # not looking up in YAML
122
115
  t.children = l10n("#{part} #{app.text}: #{to_xml(t.children)}",
123
116
  t["language"])
@@ -170,22 +163,6 @@ module IsoDoc
170
163
  end
171
164
  end
172
165
 
173
- # notes and remarques (list notes) are not numbered
174
- def note1(elem)
175
- elem.parent.name == "bibitem" || elem["notag"] == "true" and return
176
- lbl = l10n(note_label(elem))
177
- prefix_name(elem, "", lbl, "name")
178
- end
179
-
180
- def note_label(elem)
181
- if elem.ancestors("preface").empty?
182
- if elem.ancestors("ul, ol, dl").empty?
183
- @i18n.note
184
- else @i18n.listnote end
185
- else @i18n.prefacenote
186
- end
187
- end
188
-
189
166
  def termsource1(elem)
190
167
  # elem["status"] == "modified" and return super
191
168
  while elem&.next_element&.name == "termsource"
@@ -4,13 +4,15 @@ module IsoDoc
4
4
  end
5
5
 
6
6
  class Xref < IsoDoc::Xref
7
+ attr_accessor :jcgm
8
+
7
9
  def initialize(lang, script, klass, i18n, options = {})
8
10
  @iso = IsoDoc::Iso::Xref.new(lang, script, klass, i18n, options)
9
11
  super
10
12
  end
11
13
 
12
14
  def parse(docxml)
13
- @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/"\
15
+ @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/" \
14
16
  "@acronym"))&.value == "JCGM"
15
17
  @annexlbl =
16
18
  if @jcgm then @labels["iso_annex"]
@@ -38,8 +40,9 @@ module IsoDoc
38
40
  end
39
41
 
40
42
  def clause_names_jcgm(docxml, sect_num)
41
- docxml.xpath(ns("//clause[parent::sections][not(@type = 'scope')]"\
42
- "[not(descendant::terms)]")).each do |c|
43
+ docxml.xpath(ns("//clause[parent::sections][not(@type = 'scope')]" \
44
+ "[not(descendant::terms)][not(descendant::references)]"))
45
+ .each do |c|
43
46
  section_names(c, sect_num, 1)
44
47
  end
45
48
  end
@@ -48,24 +51,24 @@ module IsoDoc
48
51
 
49
52
  def clause_names_bipm(docxml, _sect_num)
50
53
  n = Counter.new
51
- docxml.xpath(ns("//sections/clause[not(#{UNNUM})] | "\
52
- "//sections/terms[not(#{UNNUM})] | "\
54
+ docxml.xpath(ns("//sections/clause[not(#{UNNUM})] | " \
55
+ "//sections/terms[not(#{UNNUM})] | " \
53
56
  "//sections/definitions[not(#{UNNUM})]"))
54
57
  .each { |c| section_names(c, n, 1) }
55
- docxml.xpath(ns("//sections/clause[#{UNNUM}] | "\
56
- "//sections/terms[#{UNNUM}] | "\
58
+ docxml.xpath(ns("//sections/clause[#{UNNUM}] | " \
59
+ "//sections/terms[#{UNNUM}] | " \
57
60
  "//sections/definitions[#{UNNUM}]"))
58
61
  .each { |c| unnumbered_section_names(c, 1) }
59
62
  end
60
63
 
61
64
  NUMBERED_SUBCLAUSES =
62
- "./clause[not(#{UNNUM})] | ./references[not(#{UNNUM})] | "\
63
- "./term[not(#{UNNUM})] | ./terms[not(#{UNNUM})] | "\
65
+ "./clause[not(#{UNNUM})] | ./references[not(#{UNNUM})] | " \
66
+ "./term[not(#{UNNUM})] | ./terms[not(#{UNNUM})] | " \
64
67
  "./definitions[not(#{UNNUM})]".freeze
65
68
 
66
69
  UNNUMBERED_SUBCLAUSES =
67
- "./clause[#{UNNUM}] | ./references[#{UNNUM}] | "\
68
- "./term[#{UNNUM}] | ./terms[#{UNNUM}] | "\
70
+ "./clause[#{UNNUM}] | ./references[#{UNNUM}] | " \
71
+ "./term[#{UNNUM}] | ./terms[#{UNNUM}] | " \
69
72
  "./definitions[#{UNNUM}]".freeze
70
73
 
71
74
  def section_name_anchors(clause, num, lvl)
@@ -91,7 +91,7 @@ module Metanorma
91
91
  def title(node, xml)
92
92
  ["en", "fr"].each do |lang|
93
93
  at = { language: lang, format: "text/plain" }
94
- xml.title **attr_code(at.merge(type: "main")) do |t1|
94
+ xml.title **attr_code(at.merge(type: "title-main")) do |t1|
95
95
  t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-#{lang}"))
96
96
  end
97
97
  %w(cover appendix annex part subpart provenance).each do |w|
@@ -104,7 +104,7 @@ module Metanorma
104
104
  at = { language: lang, format: "text/plain" }
105
105
  return unless title = node.attr("title-#{type}-#{lang}")
106
106
 
107
- xml.title **attr_code(at.merge(type: type)) do |t1|
107
+ xml.title **attr_code(at.merge(type: "title-#{type}")) do |t1|
108
108
  t1 << Metanorma::Utils::asciidoc_sub(title)
109
109
  end
110
110
  end