metanorma-bipm 2.5.3 → 2.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -7287,7 +7287,8 @@
7287
7287
  </xsl:choose>
7288
7288
  </xsl:variable>
7289
7289
  <xsl:variable name="current_fn_number_text">
7290
- <xsl:value-of select="$current_fn_number"/>
7290
+
7291
+ <xsl:value-of select="$current_fn_number"/>
7291
7292
 
7292
7293
  </xsl:variable>
7293
7294
 
@@ -7305,10 +7306,14 @@
7305
7306
  <xsl:variable name="fn_styles">
7306
7307
  <xsl:choose>
7307
7308
  <xsl:when test="ancestor::*[local-name() = 'bibitem']">
7308
- <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
7309
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style">
7310
+
7311
+ </fn_styles>
7309
7312
  </xsl:when>
7310
7313
  <xsl:otherwise>
7311
- <fn_styles xsl:use-attribute-sets="fn-num-style"/>
7314
+ <fn_styles xsl:use-attribute-sets="fn-num-style">
7315
+
7316
+ </fn_styles>
7312
7317
  </xsl:otherwise>
7313
7318
  </xsl:choose>
7314
7319
  </xsl:variable>
@@ -7323,8 +7328,10 @@
7323
7328
 
7324
7329
  <xsl:call-template name="insert_basic_link">
7325
7330
  <xsl:with-param name="element">
7326
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
7327
- <xsl:copy-of select="$current_fn_number_text"/>
7331
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
7332
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
7333
+ <xsl:copy-of select="$current_fn_number_text"/>
7334
+ </fo:inline>
7328
7335
  </fo:basic-link>
7329
7336
  </xsl:with-param>
7330
7337
  </xsl:call-template>
@@ -7609,7 +7616,7 @@
7609
7616
 
7610
7617
  <xsl:call-template name="refine_fn-reference-style"/>
7611
7618
 
7612
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7619
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7613
7620
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
7614
7621
  <xsl:attribute name="internal-destination">
7615
7622
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -8612,9 +8619,19 @@
8612
8619
  </fo:inline>
8613
8620
  </xsl:template>
8614
8621
 
8615
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="text()[ancestor::*[local-name()='smallcap']]">
8622
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
8623
+ <xsl:param name="txt"/>
8616
8624
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8617
- <xsl:variable name="text" select="."/>
8625
+ <xsl:variable name="text">
8626
+ <xsl:choose>
8627
+ <xsl:when test="$txt != ''">
8628
+ <xsl:value-of select="$txt"/>
8629
+ </xsl:when>
8630
+ <xsl:otherwise>
8631
+ <xsl:value-of select="."/>
8632
+ </xsl:otherwise>
8633
+ </xsl:choose>
8634
+ </xsl:variable>
8618
8635
  <xsl:variable name="ratio_">
8619
8636
  0.75
8620
8637
  </xsl:variable>
@@ -10092,9 +10109,12 @@
10092
10109
  <xsl:apply-templates/>
10093
10110
  </xsl:when>
10094
10111
  <xsl:otherwise>
10112
+ <xsl:variable name="alt_text">
10113
+ <xsl:call-template name="getAltText"/>
10114
+ </xsl:variable>
10095
10115
  <xsl:call-template name="insert_basic_link">
10096
10116
  <xsl:with-param name="element">
10097
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
10117
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
10098
10118
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
10099
10119
  <xsl:attribute name="role">Annot</xsl:attribute>
10100
10120
  </xsl:if>
@@ -10121,6 +10141,14 @@
10121
10141
  </fo:inline>
10122
10142
  </xsl:template> <!-- link -->
10123
10143
 
10144
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getAltText">
10145
+ <xsl:choose>
10146
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
10147
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
10148
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
10149
+ </xsl:choose>
10150
+ </xsl:template>
10151
+
10124
10152
  <!-- ======================== -->
10125
10153
  <!-- Appendix processing -->
10126
10154
  <!-- ======================== -->
@@ -10151,7 +10179,7 @@
10151
10179
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'callout']">
10152
10180
  <xsl:choose>
10153
10181
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
10154
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
10182
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
10155
10183
  </xsl:choose>
10156
10184
  </xsl:template>
10157
10185
 
@@ -10180,10 +10208,14 @@
10180
10208
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'xref']">
10181
10209
  <xsl:call-template name="insert_basic_link">
10182
10210
  <xsl:with-param name="element">
10183
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
10211
+ <xsl:variable name="alt_text">
10212
+ <xsl:call-template name="getAltText"/>
10213
+ </xsl:variable>
10214
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
10184
10215
  <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
10185
10216
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
10186
10217
  </xsl:if>
10218
+
10187
10219
  <xsl:if test="parent::*[local-name() = 'add']">
10188
10220
  <xsl:call-template name="append_add-style"/>
10189
10221
  </xsl:if>
@@ -10292,44 +10324,44 @@
10292
10324
 
10293
10325
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'note']" name="note">
10294
10326
 
10295
- <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
10327
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
10296
10328
 
10297
- <xsl:call-template name="setBlockSpanAll"/>
10329
+ <xsl:call-template name="setBlockSpanAll"/>
10298
10330
 
10299
- <xsl:call-template name="refine_note-style"/>
10331
+ <xsl:call-template name="refine_note-style"/>
10300
10332
 
10301
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10333
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10302
10334
 
10303
- <fo:block>
10335
+ <fo:block>
10304
10336
 
10305
- <xsl:call-template name="refine_note_block_style"/>
10337
+ <xsl:call-template name="refine_note_block_style"/>
10306
10338
 
10307
- <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
10339
+ <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
10308
10340
 
10309
- <xsl:call-template name="refine_note-name-style"/>
10341
+ <xsl:call-template name="refine_note-name-style"/>
10310
10342
 
10311
- <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
10312
- <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
10313
- <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
10314
- <xsl:call-template name="append_add-style"/>
10315
- </xsl:if>
10343
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
10344
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
10345
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
10346
+ <xsl:call-template name="append_add-style"/>
10347
+ </xsl:if>
10316
10348
 
10317
- <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
10318
- <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
10319
- <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
10320
- <xsl:with-param name="skip">false</xsl:with-param>
10321
- </xsl:apply-templates>
10322
- </xsl:if>
10349
+ <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
10350
+ <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
10351
+ <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
10352
+ <xsl:with-param name="skip">false</xsl:with-param>
10353
+ </xsl:apply-templates>
10354
+ </xsl:if>
10323
10355
 
10324
- <xsl:apply-templates select="*[local-name() = 'name']"/>
10356
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
10325
10357
 
10326
- </fo:inline>
10358
+ </fo:inline>
10327
10359
 
10328
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10329
- </fo:block>
10360
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
10361
+ </fo:block>
10330
10362
 
10331
- </fo:block-container>
10332
- </fo:block-container>
10363
+ </fo:block-container>
10364
+ </fo:block-container>
10333
10365
 
10334
10366
  </xsl:template>
10335
10367
 
@@ -12693,12 +12725,14 @@
12693
12725
 
12694
12726
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
12695
12727
 
12696
- <xsl:variable name="provisional_distance_between_starts">
12728
+ <xsl:variable name="provisional_distance_between_starts_">
12697
12729
  7
12698
12730
  </xsl:variable>
12699
- <xsl:variable name="indent">
12731
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
12732
+ <xsl:variable name="indent_">
12700
12733
  0
12701
12734
  </xsl:variable>
12735
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
12702
12736
 
12703
12737
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
12704
12738
  <fo:list-item>
@@ -12762,6 +12796,7 @@
12762
12796
  </xsl:when>
12763
12797
  <xsl:when test="contains(normalize-space($fo_element), 'block')">
12764
12798
  <fo:block xsl:use-attribute-sets="example-name-style">
12799
+
12765
12800
  <xsl:apply-templates/>
12766
12801
  </fo:block>
12767
12802
  </xsl:when>
@@ -12777,6 +12812,7 @@
12777
12812
 
12778
12813
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
12779
12814
  <fo:inline xsl:use-attribute-sets="example-name-style">
12815
+
12780
12816
  <xsl:apply-templates/>
12781
12817
  </fo:inline>
12782
12818
  </xsl:template>
@@ -13154,12 +13190,14 @@
13154
13190
 
13155
13191
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
13156
13192
  <fo:block xsl:use-attribute-sets="term-name-style" role="SKIP">
13193
+
13157
13194
  <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
13158
13195
  </fo:block>
13159
13196
  </xsl:if>
13160
13197
 
13161
13198
  <fo:block xsl:use-attribute-sets="preferred-term-style" role="SKIP">
13162
13199
  <xsl:call-template name="setStyle_preferred"/>
13200
+
13163
13201
  <xsl:apply-templates/>
13164
13202
  </fo:block>
13165
13203
  </fo:block>
@@ -13427,14 +13465,17 @@
13427
13465
  </xsl:when>
13428
13466
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
13429
13467
 
13430
- <xsl:variable name="label">
13468
+ <xsl:variable name="type" select="../@type"/>
13431
13469
 
13432
- <xsl:variable name="type" select="../@type"/>
13470
+ <xsl:variable name="label">
13433
13471
 
13434
13472
  <xsl:variable name="style_prefix_">
13435
13473
  <xsl:if test="$type = 'roman'">
13436
13474
  ( <!-- Example: (i) -->
13437
13475
  </xsl:if>
13476
+ <xsl:if test="$type = 'alphabet'">
13477
+
13478
+ </xsl:if>
13438
13479
  </xsl:variable>
13439
13480
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
13440
13481
 
@@ -13460,13 +13501,15 @@
13460
13501
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
13461
13502
  <xsl:value-of select="$style_prefix"/>
13462
13503
  </xsl:if>
13504
+
13463
13505
  <xsl:value-of select="@label"/>
13506
+
13464
13507
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
13465
13508
  <xsl:value-of select="$style_suffix"/>
13466
13509
  </xsl:if>
13467
13510
  </xsl:variable>
13468
13511
 
13469
- <xsl:value-of select="normalize-space($label)"/>
13512
+ <xsl:value-of select="normalize-space($label)"/>
13470
13513
 
13471
13514
  </xsl:when>
13472
13515
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -15664,7 +15707,8 @@
15664
15707
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
15665
15708
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
15666
15709
  <!-- Todo: need update -->
15667
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
15710
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
15711
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
15668
15712
 
15669
15713
  <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
15670
15714
  <xsl:attribute name="src">
@@ -15685,6 +15729,9 @@
15685
15729
  <xsl:if test="$afrelationship != ''">
15686
15730
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15687
15731
  </xsl:if>
15732
+ <xsl:if test="$volatile != ''">
15733
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15734
+ </xsl:if>
15688
15735
  </pdf:embedded-file>
15689
15736
  </xsl:for-each>
15690
15737
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -15695,14 +15742,18 @@
15695
15742
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
15696
15743
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
15697
15744
  <!-- Todo: need update -->
15698
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
15745
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
15746
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
15699
15747
  <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
15700
15748
  <xsl:if test="$description != ''">
15701
15749
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
15702
15750
  </xsl:if>
15703
15751
  <xsl:if test="$afrelationship != ''">
15704
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15705
- </xsl:if>
15752
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
15753
+ </xsl:if>
15754
+ <xsl:if test="$volatile != ''">
15755
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
15756
+ </xsl:if>
15706
15757
  </pdf:embedded-file>
15707
15758
  </xsl:for-each>
15708
15759
  </xsl:if>
@@ -15749,10 +15800,31 @@
15749
15800
  <xsl:value-of select="$level_total - 2"/>
15750
15801
  </xsl:when>
15751
15802
  <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
15752
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
15803
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
15804
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
15805
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
15806
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
15807
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
15808
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
15809
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
15810
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
15811
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
15812
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
15813
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
15753
15814
  <xsl:choose>
15754
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15755
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
15815
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
15816
+ <xsl:value-of select="number($curr_clause_depth)"/>
15817
+ </xsl:when>
15818
+ <xsl:otherwise>
15819
+ <xsl:value-of select="$level_total - 2"/>
15820
+ </xsl:otherwise>
15821
+ </xsl:choose>
15822
+ </xsl:when>
15823
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
15824
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15825
+ <xsl:choose>
15826
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
15827
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
15756
15828
  </xsl:when>
15757
15829
  <xsl:otherwise>
15758
15830
  <xsl:value-of select="$level_total - 2"/>
@@ -15760,7 +15832,7 @@
15760
15832
  </xsl:choose>
15761
15833
  </xsl:when>
15762
15834
  <xsl:when test="ancestor::*[local-name() = 'sections']">
15763
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
15835
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
15764
15836
  <xsl:choose>
15765
15837
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
15766
15838
  <xsl:value-of select="number($upper_clause_depth + 1)"/>
@@ -16077,9 +16149,10 @@
16077
16149
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBackgroundPageImage">
16078
16150
  <xsl:param name="number">1</xsl:param>
16079
16151
  <xsl:param name="name">coverpage-image</xsl:param>
16152
+ <xsl:param name="suffix"/>
16080
16153
  <xsl:variable name="num" select="number($number)"/>
16081
16154
  <!-- background image -->
16082
- <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
16155
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage{$suffix}_{$name}_{$number}_{generate-id()}">
16083
16156
  <fo:block>
16084
16157
  <xsl:for-each select="/*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = $name][1]/*[local-name() = 'value']/*[local-name() = 'image'][$num]">
16085
16158
  <xsl:choose>
@@ -16145,16 +16218,29 @@
16145
16218
 
16146
16219
  <!-- END: insert cover page image -->
16147
16220
 
16221
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
16148
16222
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertVerticalChar">
16149
16223
  <xsl:param name="str"/>
16224
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
16225
+ <xsl:param name="reference-orientation">90</xsl:param>
16150
16226
  <xsl:if test="string-length($str) &gt; 0">
16151
- <fo:inline-container writing-mode="lr-tb" text-align="center" alignment-baseline="central" reference-orientation="90" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
16227
+ <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">
16228
+ <xsl:if test="normalize-space($writing-mode) != ''">
16229
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
16230
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
16231
+ </xsl:if>
16232
+ <xsl:variable name="char" select="substring($str,1,1)"/>
16233
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
16234
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
16235
+ </xsl:if>
16152
16236
  <fo:block-container width="1em">
16153
- <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
16237
+ <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
16154
16238
  </fo:block-container>
16155
16239
  </fo:inline-container>
16156
16240
  <xsl:call-template name="insertVerticalChar">
16157
16241
  <xsl:with-param name="str" select="substring($str, 2)"/>
16242
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
16243
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
16158
16244
  </xsl:call-template>
16159
16245
  </xsl:if>
16160
16246
  </xsl:template>