metanorma-ogc 2.6.8 → 2.6.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4ab48de717eb69643066a331b7b70b6fc5c4c0cf361e1800ea1fc8aa61cbd74
4
- data.tar.gz: 5433c82cabbf8262d41602a84013391bf82083c3dddc216b1a0ce04b735950f3
3
+ metadata.gz: 9b7024136877838d076972e6f8b4b43c5e3e0c1dceff36e204d45660621f459f
4
+ data.tar.gz: 7c8c8dae713611cf78a7d7ac28a6a9b354016ac723649ad75df2bb654789f51f
5
5
  SHA512:
6
- metadata.gz: a4e0e711b1e6636bf0724a93f1ba818ed4d52d4208dd8e2624c8991ed5bd6c279965a931ca051dbc192a29211551aaf99de9fe54fd69070e3c448ff900e25fed
7
- data.tar.gz: 2aa9c78676a0ad5b2057249c7648b8e025ae8a9d491acc336492485d514a10a9b1333c785249df129ddc309c9f44f72fd6ee184a1668f8170abec480d3596a9a
6
+ metadata.gz: 50f04a78ca6e8da12f3e499d251748f73a0cb4f728093aa814570e5f762e67da85d66041f7e13a4848aabe359b71b4053f9dc154c71ccb0ac5d8b02eee7535b5
7
+ data.tar.gz: c7952103ecda423fef41abbdcdf0603c352be500bd3d9a23e700befec5ca92de105ad98a73ad59b333c977006cd0ede9ed31fa7b5893935eae55807955ecc731
@@ -665,7 +665,7 @@
665
665
 
666
666
  <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
667
667
 
668
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'preface']][normalize-space() != '' or .//image or .//svg]">
668
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'preface']][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
669
669
  <!-- Copyright, Content, Foreword, etc. pages -->
670
670
  <fo:page-sequence master-reference="document" format="i" force-page-count="no-force">
671
671
 
@@ -727,7 +727,7 @@
727
727
 
728
728
  </xsl:for-each>
729
729
 
730
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'preface'] or parent::*[local-name() = 'boilerplate'])][normalize-space() != '' or .//image or .//svg]">
730
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'preface'] or parent::*[local-name() = 'boilerplate'])][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
731
731
 
732
732
  <!-- Document Pages -->
733
733
  <!-- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
@@ -1976,8 +1976,21 @@
1976
1976
 
1977
1977
  <!-- <xsl:strip-space elements="ogc:xref"/> -->
1978
1978
 
1979
- <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1980
- <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
1979
+ <xsl:variable name="namespace_full_">
1980
+ <xsl:choose>
1981
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="namespace-uri(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
1982
+ <xsl:otherwise><xsl:value-of select="namespace-uri(/*)"/></xsl:otherwise><!-- example: https://www.metanorma.org/ns/iso -->
1983
+ </xsl:choose>
1984
+ </xsl:variable>
1985
+ <xsl:variable name="namespace_full" select="normalize-space($namespace_full_)"/>
1986
+
1987
+ <xsl:variable name="root_element_">
1988
+ <xsl:choose>
1989
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="local-name(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
1990
+ <xsl:otherwise><xsl:value-of select="local-name(/*)"/></xsl:otherwise><!-- example: iso-standard -->
1991
+ </xsl:choose>
1992
+ </xsl:variable>
1993
+ <xsl:variable name="root_element" select="normalize-space($root_element_)"/>
1981
1994
 
1982
1995
  <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'])"/>
1983
1996
 
@@ -5400,7 +5413,9 @@
5400
5413
  <fo:block role="SKIP">
5401
5414
 
5402
5415
  <xsl:if test="$isGenerateTableIF = 'true'">
5403
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5416
+
5417
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5418
+
5404
5419
  </xsl:if>
5405
5420
 
5406
5421
  <xsl:apply-templates/>
@@ -6437,7 +6452,17 @@
6437
6452
  <xsl:call-template name="refine_dt-cell-style"/>
6438
6453
 
6439
6454
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
6440
- <xsl:copy-of select="@id"/>
6455
+
6456
+ <xsl:choose>
6457
+ <xsl:when test="$isGenerateTableIF = 'true'">
6458
+
6459
+ <xsl:copy-of select="@id"/>
6460
+
6461
+ </xsl:when>
6462
+ <xsl:otherwise>
6463
+ <xsl:copy-of select="@id"/>
6464
+ </xsl:otherwise>
6465
+ </xsl:choose>
6441
6466
 
6442
6467
  <xsl:if test="normalize-space($key_iso) = 'true'">
6443
6468
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -6469,7 +6494,9 @@
6469
6494
  <fo:block role="SKIP">
6470
6495
 
6471
6496
  <xsl:if test="$isGenerateTableIF = 'true'">
6472
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
6497
+
6498
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
6499
+
6473
6500
  </xsl:if>
6474
6501
 
6475
6502
  <xsl:choose>
@@ -6950,6 +6977,12 @@
6950
6977
  </xsl:if>
6951
6978
  </xsl:template>
6952
6979
 
6980
+ <xsl:template match="*[local-name()='strike']">
6981
+ <fo:inline text-decoration="line-through">
6982
+ <xsl:apply-templates/>
6983
+ </fo:inline>
6984
+ </xsl:template>
6985
+
6953
6986
  <xsl:template match="*[local-name() = 'pagebreak']">
6954
6987
  <fo:block break-after="page"/>
6955
6988
  <fo:block> </fo:block>
@@ -7712,6 +7745,14 @@
7712
7745
  </xsl:for-each>
7713
7746
  </xsl:variable>
7714
7747
 
7748
+ <!-- <xsl:if test="$debug = 'true'">
7749
+ <redirect:write file="{generate-id()}_words_with_width_sorted.xml">
7750
+ <td_text><xsl:copy-of select="$td_text"/></td_text>
7751
+ <words_with_width><xsl:copy-of select="$words_with_width"/></words_with_width>
7752
+ <xsl:copy-of select="$words_with_width_sorted"/>
7753
+ </redirect:write>
7754
+ </xsl:if> -->
7755
+
7715
7756
  <xsl:variable name="words">
7716
7757
  <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
7717
7758
  <word>
@@ -7837,6 +7878,7 @@
7837
7878
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
7838
7879
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
7839
7880
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
7881
+ <xsl:if test="ancestor::*[local-name() = 'font_en_vertical']"><tag>font_en_vertical</tag></xsl:if>
7840
7882
  </tags>
7841
7883
  </xsl:template>
7842
7884
  <!-- =============================== -->
@@ -8377,7 +8419,16 @@
8377
8419
  </xsl:when>
8378
8420
  <xsl:otherwise>
8379
8421
  <!-- output text from <link>text</link> -->
8380
- <xsl:apply-templates/>
8422
+ <xsl:choose>
8423
+ <xsl:when test="starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.')">
8424
+ <xsl:call-template name="add-zero-spaces-link-java">
8425
+ <xsl:with-param name="text" select="."/>
8426
+ </xsl:call-template>
8427
+ </xsl:when>
8428
+ <xsl:otherwise>
8429
+ <xsl:apply-templates/>
8430
+ </xsl:otherwise>
8431
+ </xsl:choose>
8381
8432
  </xsl:otherwise>
8382
8433
  </xsl:choose>
8383
8434
  </fo:basic-link>
@@ -9022,16 +9073,29 @@
9022
9073
  <xsl:template name="getImageSrc">
9023
9074
  <xsl:choose>
9024
9075
  <xsl:when test="not(starts-with(@src, 'data:'))">
9076
+ <xsl:call-template name="getImageSrcExternal"/>
9077
+ </xsl:when>
9078
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9079
+ </xsl:choose>
9080
+ </xsl:template>
9081
+
9082
+ <xsl:template name="getImageSrcExternal">
9083
+ <xsl:choose>
9084
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9085
+ <xsl:value-of select="@src"/>
9086
+ </xsl:when>
9087
+ <xsl:otherwise>
9088
+ <xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/>
9089
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/>
9025
9090
  <xsl:choose>
9026
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9027
- <xsl:value-of select="@src"/>
9091
+ <xsl:when test="$file_exists = 'true'">
9092
+ <xsl:value-of select="$src_with_basepath"/>
9028
9093
  </xsl:when>
9029
9094
  <xsl:otherwise>
9030
- <xsl:value-of select="concat($basepath, @src)"/>
9095
+ <xsl:value-of select="@src"/>
9031
9096
  </xsl:otherwise>
9032
9097
  </xsl:choose>
9033
- </xsl:when>
9034
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9098
+ </xsl:otherwise>
9035
9099
  </xsl:choose>
9036
9100
  </xsl:template>
9037
9101
 
@@ -9079,14 +9143,8 @@
9079
9143
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
9080
9144
  </xsl:when>
9081
9145
  <xsl:when test="not(starts-with(@src, 'data:'))">
9082
- <xsl:choose>
9083
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9084
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
9085
- </xsl:when>
9086
- <xsl:otherwise>
9087
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9088
- </xsl:otherwise>
9089
- </xsl:choose>
9146
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
9147
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
9090
9148
  </xsl:when>
9091
9149
  <xsl:otherwise>
9092
9150
  <xsl:value-of select="@src"/>
@@ -9107,16 +9165,8 @@
9107
9165
  </svg>
9108
9166
  </xsl:when>
9109
9167
  <xsl:when test="not(starts-with(@src, 'data:'))">
9110
- <xsl:variable name="src">
9111
- <xsl:choose>
9112
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9113
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
9114
- </xsl:when>
9115
- <xsl:otherwise>
9116
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9117
- </xsl:otherwise>
9118
- </xsl:choose>
9119
- </xsl:variable>
9168
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
9169
+ <xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/>
9120
9170
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
9121
9171
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
9122
9172
  <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
@@ -13234,7 +13284,9 @@
13234
13284
  <xsl:template name="add_id">
13235
13285
  <xsl:if test="not(@id)">
13236
13286
  <!-- add @id - first element with @id plus '_element_name' -->
13237
- <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
13287
+ <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
13288
+ <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>
13289
+ <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
13238
13290
  </xsl:if>
13239
13291
  </xsl:template>
13240
13292
 
@@ -14539,6 +14591,7 @@
14539
14591
  <xsl:param name="formatted">false</xsl:param>
14540
14592
  <xsl:param name="lang"/>
14541
14593
  <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
14594
+ <xsl:param name="bibdata_updated"/>
14542
14595
 
14543
14596
  <xsl:variable name="curr_lang">
14544
14597
  <xsl:choose>
@@ -14552,6 +14605,9 @@
14552
14605
 
14553
14606
  <xsl:variable name="data_value">
14554
14607
  <xsl:choose>
14608
+ <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
14609
+ <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14610
+ </xsl:when>
14555
14611
  <xsl:when test="$formatted = 'true'">
14556
14612
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14557
14613
  </xsl:when>
@@ -14723,14 +14779,8 @@
14723
14779
  <xsl:value-of select="$src"/>
14724
14780
  </xsl:when>
14725
14781
  <xsl:otherwise>
14726
- <xsl:choose>
14727
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
14728
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
14729
- </xsl:when>
14730
- <xsl:otherwise>
14731
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14732
- </xsl:otherwise>
14733
- </xsl:choose>
14782
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
14783
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
14734
14784
  </xsl:otherwise>
14735
14785
  </xsl:choose>
14736
14786
  </xsl:template>
@@ -14752,15 +14802,23 @@
14752
14802
  <!-- END: insert cover page image -->
14753
14803
 
14754
14804
  <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
14805
+ <xsl:variable name="regex_ja_spec_half_width_">
14806
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14807
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14808
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14809
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14810
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14811
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14812
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14813
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14814
+ </xsl:variable>
14815
+ <xsl:variable name="regex_ja_spec_half_width" select="translate(normalize-space($regex_ja_spec_half_width_), ' ', '')"/>
14755
14816
  <xsl:variable name="regex_ja_spec_">[
14756
14817
  <!-- Rotate 90° clockwise -->
14757
- \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14818
+ <xsl:value-of select="$regex_ja_spec_half_width"/>
14758
14819
  \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
14759
- \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14760
14820
  \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
14761
- \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14762
14821
  \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
14763
- \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14764
14822
  \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
14765
14823
  \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
14766
14824
  \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
@@ -14768,21 +14826,16 @@
14768
14826
  \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
14769
14827
  \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
14770
14828
  \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
14771
- \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14772
14829
  \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
14773
- \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14774
14830
  \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
14775
14831
  \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
14776
14832
  \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
14777
- \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14778
14833
  \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
14779
- \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14780
14834
  \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
14781
14835
  \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
14782
14836
  \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
14783
14837
  \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
14784
14838
  \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
14785
-
14786
14839
  \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
14787
14840
  \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
14788
14841
  \u301C <!-- U+301C WAVE DASH (〜) -->
@@ -14814,6 +14867,7 @@
14814
14867
  <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
14815
14868
  <xsl:template name="insertVerticalChar">
14816
14869
  <xsl:param name="str"/>
14870
+ <xsl:param name="char_prev"/>
14817
14871
  <xsl:param name="writing-mode">lr-tb</xsl:param>
14818
14872
  <xsl:param name="reference-orientation">90</xsl:param>
14819
14873
  <xsl:param name="add_zero_width_space">false</xsl:param>
@@ -14823,53 +14877,99 @@
14823
14877
  </xsl:when>
14824
14878
  <xsl:otherwise>
14825
14879
  <xsl:if test="string-length($str) &gt; 0">
14826
- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
14880
+
14881
+ <!-- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/> -->
14827
14882
  <xsl:variable name="char" select="substring($str,1,1)"/>
14828
- <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">
14829
- <xsl:if test="normalize-space($writing-mode) != ''">
14830
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14831
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
14832
- </xsl:if>
14833
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14834
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
14835
- </xsl:if>
14836
- <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14837
- <!-- Rotate 180°:
14838
- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14839
- U+3002 IDEOGRAPHIC FULL STOP (。)
14840
- U+FE52 SMALL FULL STOP (﹒)
14841
- U+FF0E FULLWIDTH FULL STOP ()
14842
- -->
14843
- <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14844
- </xsl:if>
14845
- <fo:block-container width="1em">
14846
- <fo:block line-height="1em">
14847
- <xsl:choose>
14848
- <xsl:when test="$horizontal_mode = 'true'">
14849
- <xsl:value-of select="$str"/>
14850
- </xsl:when>
14851
- <xsl:otherwise>
14883
+ <xsl:variable name="char_next" select="substring($str,2,1)"/>
14884
+
14885
+ <xsl:variable name="char_half_width" select="normalize-space(java:matches(java:java.lang.String.new($char), concat('([', $regex_ja_spec_half_width, ']{1,})')))"/>
14886
+
14887
+ <xsl:choose>
14888
+ <xsl:when test="$char_half_width = 'true'">
14889
+ <fo:inline>
14890
+ <xsl:attribute name="baseline-shift">7%</xsl:attribute>
14891
+ <xsl:value-of select="$char"/>
14892
+ </fo:inline>
14893
+ </xsl:when>
14894
+ <xsl:otherwise>
14895
+ <!-- namespace-uri(ancestor::*[local-name() = 'title']) != '' to skip title from $contents -->
14896
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_prev = '' and ../preceding-sibling::node())">
14897
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
14898
+ </xsl:if>
14899
+ <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">
14900
+ <xsl:if test="normalize-space($writing-mode) != ''">
14901
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14902
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14903
+ </xsl:if>
14904
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14905
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
14906
+ </xsl:if>
14907
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14908
+ <!-- Rotate 180°:
14909
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14910
+ U+3002 IDEOGRAPHIC FULL STOP (。)
14911
+ U+FE52 SMALL FULL STOP (﹒)
14912
+ U+FF0E FULLWIDTH FULL STOP (.)
14913
+ -->
14914
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14915
+ </xsl:if>
14916
+ <fo:block-container width="1em" role="SKIP"><!-- border="0.5pt solid blue" -->
14917
+ <fo:block line-height="1em" role="SKIP">
14918
+ <!-- <xsl:choose>
14919
+ <xsl:when test="$horizontal_mode = 'true'">
14920
+ <xsl:value-of select="$str"/>
14921
+ </xsl:when>
14922
+ <xsl:otherwise>
14923
+ <xsl:value-of select="$char"/>
14924
+ </xsl:otherwise>
14925
+ </xsl:choose> -->
14852
14926
  <xsl:value-of select="$char"/>
14853
- </xsl:otherwise>
14854
- </xsl:choose>
14855
- </fo:block>
14856
- </fo:block-container>
14857
- </fo:inline-container>
14858
- <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>
14859
-
14860
- <xsl:if test="$horizontal_mode = 'false'">
14861
- <xsl:call-template name="insertVerticalChar">
14862
- <xsl:with-param name="str" select="substring($str, 2)"/>
14863
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
14864
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14865
- <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14866
- </xsl:call-template>
14867
- </xsl:if>
14927
+ </fo:block>
14928
+ </fo:block-container>
14929
+ </fo:inline-container>
14930
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_next != '' or ../following-sibling::node())">
14931
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
14932
+ </xsl:if>
14933
+ </xsl:otherwise>
14934
+ </xsl:choose>
14935
+
14936
+ <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>
14937
+ <!-- <xsl:if test="$horizontal_mode = 'false'"> -->
14938
+ <xsl:call-template name="insertVerticalChar">
14939
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14940
+ <xsl:with-param name="char_prev" select="$char"/>
14941
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
14942
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14943
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14944
+ </xsl:call-template>
14945
+ <!-- </xsl:if> -->
14868
14946
  </xsl:if>
14869
14947
  </xsl:otherwise>
14870
14948
  </xsl:choose>
14871
14949
  </xsl:template>
14872
14950
 
14951
+ <xsl:template name="insertHorizontalChars">
14952
+ <xsl:param name="str"/>
14953
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
14954
+ <xsl:param name="reference-orientation">90</xsl:param>
14955
+ <xsl:param name="add_zero_width_space">false</xsl:param>
14956
+ <xsl:choose>
14957
+ <xsl:otherwise>
14958
+ <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">
14959
+ <xsl:if test="normalize-space($writing-mode) != ''">
14960
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14961
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14962
+ </xsl:if>
14963
+ <fo:block-container width="1em" role="SKIP"> <!-- border="0.5pt solid green" -->
14964
+ <fo:block line-height="1em" role="SKIP">
14965
+ <xsl:value-of select="$str"/>
14966
+ </fo:block>
14967
+ </fo:block-container>
14968
+ </fo:inline-container>
14969
+ </xsl:otherwise>
14970
+ </xsl:choose>
14971
+ </xsl:template>
14972
+
14873
14973
  <xsl:template name="number-to-words">
14874
14974
  <xsl:param name="number"/>
14875
14975
  <xsl:param name="first"/>