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.
@@ -360,7 +360,7 @@
360
360
 
361
361
  <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface -->
362
362
 
363
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'boilerplate'] or parent::*[local-name() = 'preface']][normalize-space() != '' or .//image or .//svg]">
363
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'boilerplate'] or parent::*[local-name() = 'preface']][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
364
364
 
365
365
  <fo:page-sequence master-reference="document-jcgm" format="i">
366
366
 
@@ -392,7 +392,7 @@
392
392
 
393
393
  <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface -->
394
394
 
395
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'boilerplate'] or parent::*[local-name() = 'preface'])][normalize-space() != '' or .//image or .//svg]">
395
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'boilerplate'] or parent::*[local-name() = 'preface'])][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
396
396
 
397
397
  <!-- JCGM BODY -->
398
398
  <fo:page-sequence master-reference="document-jcgm" force-page-count="no-force">
@@ -1798,8 +1798,21 @@
1798
1798
 
1799
1799
  <!-- <xsl:strip-space elements="jcgm:xref"/> -->
1800
1800
 
1801
- <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1802
- <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
1801
+ <xsl:variable name="namespace_full_">
1802
+ <xsl:choose>
1803
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="namespace-uri(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
1804
+ <xsl:otherwise><xsl:value-of select="namespace-uri(/*)"/></xsl:otherwise><!-- example: https://www.metanorma.org/ns/iso -->
1805
+ </xsl:choose>
1806
+ </xsl:variable>
1807
+ <xsl:variable name="namespace_full" select="normalize-space($namespace_full_)"/>
1808
+
1809
+ <xsl:variable name="root_element_">
1810
+ <xsl:choose>
1811
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="local-name(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
1812
+ <xsl:otherwise><xsl:value-of select="local-name(/*)"/></xsl:otherwise><!-- example: iso-standard -->
1813
+ </xsl:choose>
1814
+ </xsl:variable>
1815
+ <xsl:variable name="root_element" select="normalize-space($root_element_)"/>
1803
1816
 
1804
1817
  <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'])"/>
1805
1818
 
@@ -5161,7 +5174,9 @@
5161
5174
  <fo:block role="SKIP">
5162
5175
 
5163
5176
  <xsl:if test="$isGenerateTableIF = 'true'">
5164
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5177
+
5178
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5179
+
5165
5180
  </xsl:if>
5166
5181
 
5167
5182
  <xsl:apply-templates/>
@@ -6194,7 +6209,17 @@
6194
6209
  <xsl:call-template name="refine_dt-cell-style"/>
6195
6210
 
6196
6211
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
6197
- <xsl:copy-of select="@id"/>
6212
+
6213
+ <xsl:choose>
6214
+ <xsl:when test="$isGenerateTableIF = 'true'">
6215
+
6216
+ <xsl:copy-of select="@id"/>
6217
+
6218
+ </xsl:when>
6219
+ <xsl:otherwise>
6220
+ <xsl:copy-of select="@id"/>
6221
+ </xsl:otherwise>
6222
+ </xsl:choose>
6198
6223
 
6199
6224
  <xsl:if test="normalize-space($key_iso) = 'true'">
6200
6225
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -6226,7 +6251,9 @@
6226
6251
  <fo:block role="SKIP">
6227
6252
 
6228
6253
  <xsl:if test="$isGenerateTableIF = 'true'">
6229
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
6254
+
6255
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
6256
+
6230
6257
  </xsl:if>
6231
6258
 
6232
6259
  <xsl:choose>
@@ -6705,6 +6732,12 @@
6705
6732
  </xsl:if>
6706
6733
  </xsl:template>
6707
6734
 
6735
+ <xsl:template match="*[local-name()='strike']">
6736
+ <fo:inline text-decoration="line-through">
6737
+ <xsl:apply-templates/>
6738
+ </fo:inline>
6739
+ </xsl:template>
6740
+
6708
6741
  <xsl:template match="*[local-name() = 'pagebreak']">
6709
6742
  <fo:block break-after="page"/>
6710
6743
  <fo:block> </fo:block>
@@ -7467,6 +7500,14 @@
7467
7500
  </xsl:for-each>
7468
7501
  </xsl:variable>
7469
7502
 
7503
+ <!-- <xsl:if test="$debug = 'true'">
7504
+ <redirect:write file="{generate-id()}_words_with_width_sorted.xml">
7505
+ <td_text><xsl:copy-of select="$td_text"/></td_text>
7506
+ <words_with_width><xsl:copy-of select="$words_with_width"/></words_with_width>
7507
+ <xsl:copy-of select="$words_with_width_sorted"/>
7508
+ </redirect:write>
7509
+ </xsl:if> -->
7510
+
7470
7511
  <xsl:variable name="words">
7471
7512
  <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
7472
7513
  <word>
@@ -7592,6 +7633,7 @@
7592
7633
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
7593
7634
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
7594
7635
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
7636
+ <xsl:if test="ancestor::*[local-name() = 'font_en_vertical']"><tag>font_en_vertical</tag></xsl:if>
7595
7637
  </tags>
7596
7638
  </xsl:template>
7597
7639
  <!-- =============================== -->
@@ -8139,7 +8181,16 @@
8139
8181
  </xsl:when>
8140
8182
  <xsl:otherwise>
8141
8183
  <!-- output text from <link>text</link> -->
8142
- <xsl:apply-templates/>
8184
+ <xsl:choose>
8185
+ <xsl:when test="starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.')">
8186
+ <xsl:call-template name="add-zero-spaces-link-java">
8187
+ <xsl:with-param name="text" select="."/>
8188
+ </xsl:call-template>
8189
+ </xsl:when>
8190
+ <xsl:otherwise>
8191
+ <xsl:apply-templates/>
8192
+ </xsl:otherwise>
8193
+ </xsl:choose>
8143
8194
  </xsl:otherwise>
8144
8195
  </xsl:choose>
8145
8196
  </fo:basic-link>
@@ -8778,16 +8829,29 @@
8778
8829
  <xsl:template name="getImageSrc">
8779
8830
  <xsl:choose>
8780
8831
  <xsl:when test="not(starts-with(@src, 'data:'))">
8832
+ <xsl:call-template name="getImageSrcExternal"/>
8833
+ </xsl:when>
8834
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8835
+ </xsl:choose>
8836
+ </xsl:template>
8837
+
8838
+ <xsl:template name="getImageSrcExternal">
8839
+ <xsl:choose>
8840
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8841
+ <xsl:value-of select="@src"/>
8842
+ </xsl:when>
8843
+ <xsl:otherwise>
8844
+ <xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/>
8845
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/>
8781
8846
  <xsl:choose>
8782
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8783
- <xsl:value-of select="@src"/>
8847
+ <xsl:when test="$file_exists = 'true'">
8848
+ <xsl:value-of select="$src_with_basepath"/>
8784
8849
  </xsl:when>
8785
8850
  <xsl:otherwise>
8786
- <xsl:value-of select="concat($basepath, @src)"/>
8851
+ <xsl:value-of select="@src"/>
8787
8852
  </xsl:otherwise>
8788
8853
  </xsl:choose>
8789
- </xsl:when>
8790
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8854
+ </xsl:otherwise>
8791
8855
  </xsl:choose>
8792
8856
  </xsl:template>
8793
8857
 
@@ -8835,14 +8899,8 @@
8835
8899
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8836
8900
  </xsl:when>
8837
8901
  <xsl:when test="not(starts-with(@src, 'data:'))">
8838
- <xsl:choose>
8839
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8840
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8841
- </xsl:when>
8842
- <xsl:otherwise>
8843
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8844
- </xsl:otherwise>
8845
- </xsl:choose>
8902
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
8903
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
8846
8904
  </xsl:when>
8847
8905
  <xsl:otherwise>
8848
8906
  <xsl:value-of select="@src"/>
@@ -8863,16 +8921,8 @@
8863
8921
  </svg>
8864
8922
  </xsl:when>
8865
8923
  <xsl:when test="not(starts-with(@src, 'data:'))">
8866
- <xsl:variable name="src">
8867
- <xsl:choose>
8868
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8869
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8870
- </xsl:when>
8871
- <xsl:otherwise>
8872
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8873
- </xsl:otherwise>
8874
- </xsl:choose>
8875
- </xsl:variable>
8924
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
8925
+ <xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/>
8876
8926
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8877
8927
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
8878
8928
  <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
@@ -13007,7 +13057,9 @@
13007
13057
  <xsl:template name="add_id">
13008
13058
  <xsl:if test="not(@id)">
13009
13059
  <!-- add @id - first element with @id plus '_element_name' -->
13010
- <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
13060
+ <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
13061
+ <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>
13062
+ <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
13011
13063
  </xsl:if>
13012
13064
  </xsl:template>
13013
13065
 
@@ -14310,6 +14362,7 @@
14310
14362
  <xsl:param name="formatted">false</xsl:param>
14311
14363
  <xsl:param name="lang"/>
14312
14364
  <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
14365
+ <xsl:param name="bibdata_updated"/>
14313
14366
 
14314
14367
  <xsl:variable name="curr_lang">
14315
14368
  <xsl:choose>
@@ -14323,6 +14376,9 @@
14323
14376
 
14324
14377
  <xsl:variable name="data_value">
14325
14378
  <xsl:choose>
14379
+ <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
14380
+ <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14381
+ </xsl:when>
14326
14382
  <xsl:when test="$formatted = 'true'">
14327
14383
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14328
14384
  </xsl:when>
@@ -14494,14 +14550,8 @@
14494
14550
  <xsl:value-of select="$src"/>
14495
14551
  </xsl:when>
14496
14552
  <xsl:otherwise>
14497
- <xsl:choose>
14498
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
14499
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
14500
- </xsl:when>
14501
- <xsl:otherwise>
14502
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14503
- </xsl:otherwise>
14504
- </xsl:choose>
14553
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
14554
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
14505
14555
  </xsl:otherwise>
14506
14556
  </xsl:choose>
14507
14557
  </xsl:template>
@@ -14523,15 +14573,23 @@
14523
14573
  <!-- END: insert cover page image -->
14524
14574
 
14525
14575
  <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
14576
+ <xsl:variable name="regex_ja_spec_half_width_">
14577
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14578
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14579
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14580
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14581
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14582
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14583
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14584
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14585
+ </xsl:variable>
14586
+ <xsl:variable name="regex_ja_spec_half_width" select="translate(normalize-space($regex_ja_spec_half_width_), ' ', '')"/>
14526
14587
  <xsl:variable name="regex_ja_spec_">[
14527
14588
  <!-- Rotate 90° clockwise -->
14528
- \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14589
+ <xsl:value-of select="$regex_ja_spec_half_width"/>
14529
14590
  \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
14530
- \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14531
14591
  \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
14532
- \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14533
14592
  \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
14534
- \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14535
14593
  \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
14536
14594
  \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
14537
14595
  \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
@@ -14539,21 +14597,16 @@
14539
14597
  \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
14540
14598
  \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
14541
14599
  \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
14542
- \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14543
14600
  \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
14544
- \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14545
14601
  \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
14546
14602
  \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
14547
14603
  \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
14548
- \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14549
14604
  \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
14550
- \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14551
14605
  \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
14552
14606
  \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
14553
14607
  \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
14554
14608
  \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
14555
14609
  \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
14556
-
14557
14610
  \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
14558
14611
  \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
14559
14612
  \u301C <!-- U+301C WAVE DASH (〜) -->
@@ -14585,6 +14638,7 @@
14585
14638
  <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
14586
14639
  <xsl:template name="insertVerticalChar">
14587
14640
  <xsl:param name="str"/>
14641
+ <xsl:param name="char_prev"/>
14588
14642
  <xsl:param name="writing-mode">lr-tb</xsl:param>
14589
14643
  <xsl:param name="reference-orientation">90</xsl:param>
14590
14644
  <xsl:param name="add_zero_width_space">false</xsl:param>
@@ -14594,53 +14648,99 @@
14594
14648
  </xsl:when>
14595
14649
  <xsl:otherwise>
14596
14650
  <xsl:if test="string-length($str) &gt; 0">
14597
- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
14651
+
14652
+ <!-- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/> -->
14598
14653
  <xsl:variable name="char" select="substring($str,1,1)"/>
14599
- <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">
14600
- <xsl:if test="normalize-space($writing-mode) != ''">
14601
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14602
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
14603
- </xsl:if>
14604
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14605
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
14606
- </xsl:if>
14607
- <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14608
- <!-- Rotate 180°:
14609
- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14610
- U+3002 IDEOGRAPHIC FULL STOP (。)
14611
- U+FE52 SMALL FULL STOP (﹒)
14612
- U+FF0E FULLWIDTH FULL STOP ()
14613
- -->
14614
- <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14615
- </xsl:if>
14616
- <fo:block-container width="1em">
14617
- <fo:block line-height="1em">
14618
- <xsl:choose>
14619
- <xsl:when test="$horizontal_mode = 'true'">
14620
- <xsl:value-of select="$str"/>
14621
- </xsl:when>
14622
- <xsl:otherwise>
14654
+ <xsl:variable name="char_next" select="substring($str,2,1)"/>
14655
+
14656
+ <xsl:variable name="char_half_width" select="normalize-space(java:matches(java:java.lang.String.new($char), concat('([', $regex_ja_spec_half_width, ']{1,})')))"/>
14657
+
14658
+ <xsl:choose>
14659
+ <xsl:when test="$char_half_width = 'true'">
14660
+ <fo:inline>
14661
+ <xsl:attribute name="baseline-shift">7%</xsl:attribute>
14662
+ <xsl:value-of select="$char"/>
14663
+ </fo:inline>
14664
+ </xsl:when>
14665
+ <xsl:otherwise>
14666
+ <!-- namespace-uri(ancestor::*[local-name() = 'title']) != '' to skip title from $contents -->
14667
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_prev = '' and ../preceding-sibling::node())">
14668
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
14669
+ </xsl:if>
14670
+ <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">
14671
+ <xsl:if test="normalize-space($writing-mode) != ''">
14672
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14673
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14674
+ </xsl:if>
14675
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14676
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
14677
+ </xsl:if>
14678
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14679
+ <!-- Rotate 180°:
14680
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14681
+ U+3002 IDEOGRAPHIC FULL STOP (。)
14682
+ U+FE52 SMALL FULL STOP (﹒)
14683
+ U+FF0E FULLWIDTH FULL STOP (.)
14684
+ -->
14685
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14686
+ </xsl:if>
14687
+ <fo:block-container width="1em" role="SKIP"><!-- border="0.5pt solid blue" -->
14688
+ <fo:block line-height="1em" role="SKIP">
14689
+ <!-- <xsl:choose>
14690
+ <xsl:when test="$horizontal_mode = 'true'">
14691
+ <xsl:value-of select="$str"/>
14692
+ </xsl:when>
14693
+ <xsl:otherwise>
14694
+ <xsl:value-of select="$char"/>
14695
+ </xsl:otherwise>
14696
+ </xsl:choose> -->
14623
14697
  <xsl:value-of select="$char"/>
14624
- </xsl:otherwise>
14625
- </xsl:choose>
14626
- </fo:block>
14627
- </fo:block-container>
14628
- </fo:inline-container>
14629
- <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>
14630
-
14631
- <xsl:if test="$horizontal_mode = 'false'">
14632
- <xsl:call-template name="insertVerticalChar">
14633
- <xsl:with-param name="str" select="substring($str, 2)"/>
14634
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
14635
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14636
- <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14637
- </xsl:call-template>
14638
- </xsl:if>
14698
+ </fo:block>
14699
+ </fo:block-container>
14700
+ </fo:inline-container>
14701
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_next != '' or ../following-sibling::node())">
14702
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
14703
+ </xsl:if>
14704
+ </xsl:otherwise>
14705
+ </xsl:choose>
14706
+
14707
+ <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>
14708
+ <!-- <xsl:if test="$horizontal_mode = 'false'"> -->
14709
+ <xsl:call-template name="insertVerticalChar">
14710
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14711
+ <xsl:with-param name="char_prev" select="$char"/>
14712
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
14713
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14714
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14715
+ </xsl:call-template>
14716
+ <!-- </xsl:if> -->
14639
14717
  </xsl:if>
14640
14718
  </xsl:otherwise>
14641
14719
  </xsl:choose>
14642
14720
  </xsl:template>
14643
14721
 
14722
+ <xsl:template name="insertHorizontalChars">
14723
+ <xsl:param name="str"/>
14724
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
14725
+ <xsl:param name="reference-orientation">90</xsl:param>
14726
+ <xsl:param name="add_zero_width_space">false</xsl:param>
14727
+ <xsl:choose>
14728
+ <xsl:otherwise>
14729
+ <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">
14730
+ <xsl:if test="normalize-space($writing-mode) != ''">
14731
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14732
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14733
+ </xsl:if>
14734
+ <fo:block-container width="1em" role="SKIP"> <!-- border="0.5pt solid green" -->
14735
+ <fo:block line-height="1em" role="SKIP">
14736
+ <xsl:value-of select="$str"/>
14737
+ </fo:block>
14738
+ </fo:block-container>
14739
+ </fo:inline-container>
14740
+ </xsl:otherwise>
14741
+ </xsl:choose>
14742
+ </xsl:template>
14743
+
14644
14744
  <xsl:template name="number-to-words">
14645
14745
  <xsl:param name="number"/>
14646
14746
  <xsl:param name="first"/>
@@ -2,7 +2,6 @@ require "isodoc"
2
2
  require "metanorma-generic"
3
3
  require "metanorma-iso"
4
4
  require_relative "init"
5
- require_relative "index"
6
5
  require_relative "doccontrol"
7
6
  require_relative "../../relaton/render/general"
8
7
  require_relative "presentation_blocks"
@@ -33,16 +32,6 @@ module IsoDoc
33
32
  super
34
33
  end
35
34
 
36
- # KILL
37
- def annex1x(elem)
38
- @jcgm and return super
39
- elem["unnumbered"] == "true" and return
40
- lbl = @xrefs.anchor(elem["id"], :label)
41
- t = elem.at(ns("./title")) and
42
- t.children = "<strong>#{to_xml(t.children)}</strong>"
43
- prefix_name(elem, ".<tab/>", lbl, "title")
44
- end
45
-
46
35
  def annex_delim(elem)
47
36
  @jcgm and return super
48
37
  ".<tab/>"
@@ -63,19 +52,6 @@ module IsoDoc
63
52
  super
64
53
  end
65
54
 
66
- # KILL
67
- def prefix_namex(node, delims, number, elem)
68
- number.nil? || number.empty? and return
69
- unless name = node.at(ns("./#{elem}[not(@type = 'quoted')]"))
70
- node.at(ns("./#{elem}[@type = 'quoted']")) and return
71
- node.add_first_child "<#{elem}></#{elem}>"
72
- name = node.children.first
73
- end
74
- if name.children.empty? then name.add_child(cleanup_entities(number))
75
- else (name.children.first.previous = "#{number}#{delim}")
76
- end
77
- end
78
-
79
55
  def prefix_name(node, delims, number, elem)
80
56
  if n = node.at(ns("./#{elem}[@type = 'quoted']"))
81
57
  n1 = n.dup
@@ -204,6 +180,24 @@ module IsoDoc
204
180
  termsource_add_modification_text(elem.at(ns("./modification")))
205
181
  end
206
182
 
183
+ def enable_indexsect
184
+ true
185
+ end
186
+
187
+ def index1(docxml, indexsect, index)
188
+ index.keys.sort.each do |k|
189
+ c = indexsect.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
190
+ words = index[k].keys.each_with_object({}) do |w, v|
191
+ v[sortable(w).downcase] = w
192
+ end
193
+ words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
194
+ c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
195
+ end
196
+ end
197
+ docxml.xpath(ns("//indexsect//xref")).each { |x| x.children.remove }
198
+ @xrefs.bookmark_anchor_names(docxml)
199
+ end
200
+
207
201
  include Init
208
202
  end
209
203
  end
@@ -59,14 +59,6 @@ module IsoDoc
59
59
  "./term[#{UNNUM}] | ./terms[#{UNNUM}] | " \
60
60
  "./definitions[#{UNNUM}]".freeze
61
61
 
62
- # KILL
63
- def section_name_anchors(clause, num, lvl)
64
- lbl = @jcgm ? "clause_jcgm" : "clause"
65
- @anchors[clause["id"]] =
66
- { label: num.print, xref: l10n("#{@labels[lbl]} #{num.print}"),
67
- level: lvl, type: "clause", elem: @labels[lbl] }
68
- end
69
-
70
62
  def section_name_anchors(clause, num, level)
71
63
  lbl = @jcgm ? "clause_jcgm" : "clause"
72
64
  xref = labelled_autonum(@labels[lbl], num)
@@ -77,21 +69,6 @@ module IsoDoc
77
69
  elem: @labels[lbl] }
78
70
  end
79
71
 
80
- # KILL
81
- def section_names(clause, num, lvl)
82
- clause.nil? and return num
83
- num.increment(clause)
84
- @anchors[clause["id"]] = section_name_anchors(clause, num, lvl)
85
- i = Counter.new(0, prefix: num.print)
86
- clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
87
- section_names1(c, i.increment(c).print, lvl + 1)
88
- end
89
- clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
90
- unnumbered_section_names1(c, lvl + 1)
91
- end
92
- num
93
- end
94
-
95
72
  def section_names(clause, num, lvl)
96
73
  unnumbered_section_name?(clause) and return num
97
74
  num.increment(clause)
@@ -135,7 +112,7 @@ module IsoDoc
135
112
  section_names1(c, lbl, i.increment(c).print, level + 1)
136
113
  end
137
114
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
138
- unnumbered_section_names1(c, lvl + 1)
115
+ unnumbered_section_names1(c, level + 1)
139
116
  end
140
117
  end
141
118
 
@@ -180,7 +157,7 @@ module IsoDoc
180
157
  @anchors[clause["id"]] = annex_name_anchors(clause, lbl)
181
158
  if @klass.single_term_clause?(clause)
182
159
  annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
183
- lbl, 1)
160
+ nil, "#{prefix}#{num}", 1)
184
161
  else
185
162
  i = Counter.new(0)
186
163
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
@@ -202,8 +179,8 @@ module IsoDoc
202
179
  lbl = semx(clause, lbl, "title")
203
180
  @anchors[clause["id"]] = unnumbered_annex_anchors(lbl)
204
181
  if @klass.single_term_clause?(clause)
205
- annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
206
- num.to_s, 1)
182
+ unnumbered_annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
183
+ 1)
207
184
  else
208
185
  clause.xpath(ns(SUBCLAUSES))
209
186
  .each { |c| unnumbered_annex_names1(c, 2) }
@@ -267,11 +267,11 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
267
267
  <a:documentation>An identifier of the person according to an international identifier scheme</a:documentation>
268
268
  </ref>
269
269
  </zeroOrMore>
270
- <zeroOrMore>
270
+ <optional>
271
271
  <ref name="contact">
272
272
  <a:documentation>Contact information for the person, including URI, address, phone number, and email</a:documentation>
273
273
  </ref>
274
- </zeroOrMore>
274
+ </optional>
275
275
  </element>
276
276
  </define>
277
277
  <define name="fullname">
@@ -454,11 +454,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
454
454
  <a:documentation>An identifier of the organization according to an international identifier scheme</a:documentation>
455
455
  </ref>
456
456
  </zeroOrMore>
457
- <zeroOrMore>
457
+ <optional>
458
458
  <ref name="contact">
459
459
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
460
460
  </ref>
461
- </zeroOrMore>
461
+ </optional>
462
462
  <optional>
463
463
  <ref name="logo">
464
464
  <a:documentation>A logo for the organization</a:documentation>
@@ -540,12 +540,18 @@ real names (if the person is named with a pseudonym or user name); previous lega
540
540
  <!-- TODO may change -->
541
541
  <define name="contact">
542
542
  <a:documentation>Contact information for a person or organization</a:documentation>
543
- <choice>
543
+ <zeroOrMore>
544
544
  <ref name="address"/>
545
+ </zeroOrMore>
546
+ <zeroOrMore>
545
547
  <ref name="phone"/>
548
+ </zeroOrMore>
549
+ <zeroOrMore>
546
550
  <ref name="email"/>
551
+ </zeroOrMore>
552
+ <zeroOrMore>
547
553
  <ref name="uri"/>
548
- </choice>
554
+ </zeroOrMore>
549
555
  </define>
550
556
  <define name="phone">
551
557
  <a:documentation>The phone number associated with a person or organization</a:documentation>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Bipm
3
- VERSION = "2.5.8".freeze
3
+ VERSION = "2.5.10".freeze
4
4
  end
5
5
  end