metanorma-ribose 2.5.6 → 2.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -423,39 +423,45 @@
423
423
  </fo:page-sequence>
424
424
  <!-- END Cover page -->
425
425
 
426
- <!-- ToC pages -->
427
- <fo:page-sequence master-reference="document" force-page-count="no-force"> <!-- master-reference="toc" -->
428
- <xsl:call-template name="insertHeaderFooter">
429
- <xsl:with-param name="section">toc</xsl:with-param>
430
- </xsl:call-template>
431
- <fo:flow flow-name="xsl-region-body">
432
-
433
- <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:clause[@type = 'toc']"/>
434
-
435
- <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:legal-statement"/>
436
-
437
- <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:feedback-statement"/>
438
-
439
- </fo:flow>
440
- </fo:page-sequence>
441
- <!-- ============== -->
442
- <!-- END ToC pages -->
443
- <!-- ============== -->
444
-
445
426
  <xsl:variable name="updated_xml">
446
427
  <xsl:call-template name="updateXML"/>
447
428
  <!-- <xsl:copy-of select="."/> -->
448
429
  </xsl:variable>
449
430
 
431
+ <xsl:if test="$debug = 'true'">
432
+ <redirect:write file="contents_.xml"> <!-- {java:getTime(java:java.util.Date.new())} -->
433
+ <xsl:copy-of select="$contents"/>
434
+ </redirect:write>
435
+ </xsl:if>
436
+
450
437
  <xsl:for-each select="xalan:nodeset($updated_xml)/*">
451
438
 
439
+ <!-- ToC pages -->
440
+ <fo:page-sequence master-reference="document" force-page-count="no-force"> <!-- master-reference="toc" -->
441
+ <xsl:call-template name="insertHeaderFooter">
442
+ <xsl:with-param name="section">toc</xsl:with-param>
443
+ </xsl:call-template>
444
+ <fo:flow flow-name="xsl-region-body">
445
+
446
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:preface/ribose:clause[@type = 'toc']"/>
447
+
448
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:legal-statement"/>
449
+
450
+ <xsl:apply-templates select="/ribose:rsd-standard/ribose:boilerplate/ribose:feedback-statement"/>
451
+
452
+ </fo:flow>
453
+ </fo:page-sequence>
454
+ <!-- ============== -->
455
+ <!-- END ToC pages -->
456
+ <!-- ============== -->
457
+
452
458
  <xsl:variable name="updated_xml_with_pages">
453
459
  <xsl:call-template name="processPrefaceAndMainSectionsRibose_items"/>
454
460
  </xsl:variable>
455
461
 
456
462
  <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface -->
457
463
 
458
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
464
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
459
465
 
460
466
  <fo:page-sequence master-reference="document" force-page-count="no-force">
461
467
 
@@ -689,10 +695,10 @@
689
695
  <!-- ============================= -->
690
696
 
691
697
  <!-- element with title -->
692
- <xsl:template match="*[ribose:title]" mode="contents">
698
+ <xsl:template match="*[ribose:title or ribose:fmt-title]" mode="contents">
693
699
  <xsl:variable name="level">
694
700
  <xsl:call-template name="getLevel">
695
- <xsl:with-param name="depth" select="ribose:title/@depth"/>
701
+ <xsl:with-param name="depth" select="ribose:fmt-title/@depth | ribose:title/@depth"/>
696
702
  </xsl:call-template>
697
703
  </xsl:variable>
698
704
 
@@ -1316,7 +1322,7 @@
1316
1322
  </xsl:if>
1317
1323
  </xsl:template>
1318
1324
 
1319
- <xsl:strip-space elements="ribose:xref"/>
1325
+ <!-- <xsl:strip-space elements="ribose:xref"/> -->
1320
1326
 
1321
1327
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1322
1328
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
@@ -2345,6 +2351,10 @@
2345
2351
 
2346
2352
  <xsl:template name="refine_termnote-name-style">
2347
2353
 
2354
+ <!-- <xsl:if test="$namespace = 'ieee'">
2355
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
2356
+ </xsl:if> -->
2357
+
2348
2358
  </xsl:template>
2349
2359
 
2350
2360
  <xsl:attribute-set name="termnote-p-style">
@@ -3065,9 +3075,21 @@
3065
3075
  <xsl:template name="processTables_Contents">
3066
3076
  <tables>
3067
3077
  <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3068
- <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3069
- <xsl:copy-of select="*[local-name() = 'name']"/>
3070
- </table>
3078
+ <xsl:choose>
3079
+ <xsl:when test="*[local-name() = 'fmt-name']">
3080
+ <xsl:variable name="fmt_name">
3081
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3082
+ </xsl:variable>
3083
+ <table id="{@id}" alt-text="{normalize-space($fmt_name)}">
3084
+ <xsl:copy-of select="$fmt_name"/>
3085
+ </table>
3086
+ </xsl:when>
3087
+ <xsl:otherwise>
3088
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3089
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3090
+ </table>
3091
+ </xsl:otherwise>
3092
+ </xsl:choose>
3071
3093
  </xsl:for-each>
3072
3094
  </tables>
3073
3095
  </xsl:template>
@@ -3075,9 +3097,21 @@
3075
3097
  <xsl:template name="processFigures_Contents">
3076
3098
  <figures>
3077
3099
  <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name'] and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(*[local-name() = 'name'], 'Figure ') and normalize-space(@id) != '']">
3078
- <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3079
- <xsl:copy-of select="*[local-name() = 'name']"/>
3080
- </figure>
3100
+ <xsl:choose>
3101
+ <xsl:when test="*[local-name() = 'fmt-name']">
3102
+ <xsl:variable name="fmt_name">
3103
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
3104
+ </xsl:variable>
3105
+ <figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
3106
+ <xsl:copy-of select="$fmt_name"/>
3107
+ </figure>
3108
+ </xsl:when>
3109
+ <xsl:otherwise>
3110
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3111
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3112
+ </figure>
3113
+ </xsl:otherwise>
3114
+ </xsl:choose>
3081
3115
  </xsl:for-each>
3082
3116
  </figures>
3083
3117
  </xsl:template>
@@ -4656,7 +4690,9 @@
4656
4690
  <fo:block role="SKIP">
4657
4691
 
4658
4692
  <xsl:if test="$isGenerateTableIF = 'true'">
4659
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4693
+
4694
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4695
+
4660
4696
  </xsl:if>
4661
4697
 
4662
4698
  <xsl:apply-templates/>
@@ -5678,7 +5714,17 @@
5678
5714
  <xsl:call-template name="refine_dt-cell-style"/>
5679
5715
 
5680
5716
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
5681
- <xsl:copy-of select="@id"/>
5717
+
5718
+ <xsl:choose>
5719
+ <xsl:when test="$isGenerateTableIF = 'true'">
5720
+
5721
+ <xsl:copy-of select="@id"/>
5722
+
5723
+ </xsl:when>
5724
+ <xsl:otherwise>
5725
+ <xsl:copy-of select="@id"/>
5726
+ </xsl:otherwise>
5727
+ </xsl:choose>
5682
5728
 
5683
5729
  <xsl:if test="normalize-space($key_iso) = 'true'">
5684
5730
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -5710,7 +5756,9 @@
5710
5756
  <fo:block role="SKIP">
5711
5757
 
5712
5758
  <xsl:if test="$isGenerateTableIF = 'true'">
5713
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5759
+
5760
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5761
+
5714
5762
  </xsl:if>
5715
5763
 
5716
5764
  <xsl:choose>
@@ -6958,6 +7006,14 @@
6958
7006
  </xsl:for-each>
6959
7007
  </xsl:variable>
6960
7008
 
7009
+ <!-- <xsl:if test="$debug = 'true'">
7010
+ <redirect:write file="{generate-id()}_words_with_width_sorted.xml">
7011
+ <td_text><xsl:copy-of select="$td_text"/></td_text>
7012
+ <words_with_width><xsl:copy-of select="$words_with_width"/></words_with_width>
7013
+ <xsl:copy-of select="$words_with_width_sorted"/>
7014
+ </redirect:write>
7015
+ </xsl:if> -->
7016
+
6961
7017
  <xsl:variable name="words">
6962
7018
  <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
6963
7019
  <word>
@@ -7083,6 +7139,7 @@
7083
7139
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
7084
7140
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
7085
7141
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
7142
+ <xsl:if test="ancestor::*[local-name() = 'font_en_vertical']"><tag>font_en_vertical</tag></xsl:if>
7086
7143
  </tags>
7087
7144
  </xsl:template>
7088
7145
  <!-- =============================== -->
@@ -7623,7 +7680,16 @@
7623
7680
  </xsl:when>
7624
7681
  <xsl:otherwise>
7625
7682
  <!-- output text from <link>text</link> -->
7626
- <xsl:apply-templates/>
7683
+ <xsl:choose>
7684
+ <xsl:when test="starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.')">
7685
+ <xsl:call-template name="add-zero-spaces-link-java">
7686
+ <xsl:with-param name="text" select="."/>
7687
+ </xsl:call-template>
7688
+ </xsl:when>
7689
+ <xsl:otherwise>
7690
+ <xsl:apply-templates/>
7691
+ </xsl:otherwise>
7692
+ </xsl:choose>
7627
7693
  </xsl:otherwise>
7628
7694
  </xsl:choose>
7629
7695
  </fo:basic-link>
@@ -7837,6 +7903,8 @@
7837
7903
 
7838
7904
  <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
7839
7905
 
7906
+ <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab"/>
7907
+
7840
7908
  <xsl:call-template name="refine_note-name-style"/>
7841
7909
 
7842
7910
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -7893,10 +7961,6 @@
7893
7961
 
7894
7962
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
7895
7963
 
7896
- <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
7897
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
7898
- </xsl:if>
7899
-
7900
7964
  <xsl:call-template name="refine_termnote-name-style"/>
7901
7965
 
7902
7966
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -8046,15 +8110,27 @@
8046
8110
  <!-- Example: Dimensions in millimeters -->
8047
8111
  <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
8048
8112
 
8113
+ <xsl:variable name="show_figure_key_in_block_container">
8114
+ true
8115
+ </xsl:variable>
8116
+
8049
8117
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
8050
8118
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
8051
8119
  </fo:block>
8052
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8053
- <xsl:call-template name="note"/>
8054
- </xsl:for-each>
8055
- <xsl:call-template name="fn_display_figure"/>
8120
+
8121
+ <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
8122
+ <xsl:call-template name="showFigureKey"/>
8123
+ </xsl:if>
8056
8124
 
8057
8125
  </fo:block-container>
8126
+
8127
+ </xsl:template>
8128
+
8129
+ <xsl:template name="showFigureKey">
8130
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8131
+ <xsl:call-template name="note"/>
8132
+ </xsl:for-each>
8133
+ <xsl:call-template name="fn_display_figure"/>
8058
8134
  </xsl:template>
8059
8135
 
8060
8136
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -8250,6 +8326,35 @@
8250
8326
  </xsl:if>
8251
8327
  </xsl:template>
8252
8328
 
8329
+ <xsl:template name="getImageSrc">
8330
+ <xsl:choose>
8331
+ <xsl:when test="not(starts-with(@src, 'data:'))">
8332
+ <xsl:call-template name="getImageSrcExternal"/>
8333
+ </xsl:when>
8334
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8335
+ </xsl:choose>
8336
+ </xsl:template>
8337
+
8338
+ <xsl:template name="getImageSrcExternal">
8339
+ <xsl:choose>
8340
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8341
+ <xsl:value-of select="@src"/>
8342
+ </xsl:when>
8343
+ <xsl:otherwise>
8344
+ <xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/>
8345
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/>
8346
+ <xsl:choose>
8347
+ <xsl:when test="$file_exists = 'true'">
8348
+ <xsl:value-of select="$src_with_basepath"/>
8349
+ </xsl:when>
8350
+ <xsl:otherwise>
8351
+ <xsl:value-of select="@src"/>
8352
+ </xsl:otherwise>
8353
+ </xsl:choose>
8354
+ </xsl:otherwise>
8355
+ </xsl:choose>
8356
+ </xsl:template>
8357
+
8253
8358
  <xsl:template name="getImageScale">
8254
8359
  <xsl:param name="indent"/>
8255
8360
  <xsl:variable name="indent_left">
@@ -8259,19 +8364,7 @@
8259
8364
  </xsl:choose>
8260
8365
  </xsl:variable>
8261
8366
  <xsl:variable name="img_src">
8262
- <xsl:choose>
8263
- <xsl:when test="not(starts-with(@src, 'data:'))">
8264
- <xsl:choose>
8265
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8266
- <xsl:value-of select="@src"/>
8267
- </xsl:when>
8268
- <xsl:otherwise>
8269
- <xsl:value-of select="concat($basepath, @src)"/>
8270
- </xsl:otherwise>
8271
- </xsl:choose>
8272
- </xsl:when>
8273
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8274
- </xsl:choose>
8367
+ <xsl:call-template name="getImageSrc"/>
8275
8368
  </xsl:variable>
8276
8369
 
8277
8370
  <xsl:variable name="image_width_effective">
@@ -8279,10 +8372,15 @@
8279
8372
  <xsl:value-of select="$width_effective - number($indent_left)"/>
8280
8373
 
8281
8374
  </xsl:variable>
8375
+ <xsl:variable name="image_height_effective" select="$height_effective - number($indent_left)"/>
8282
8376
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8283
8377
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8284
8378
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
8285
- <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8379
+ <xsl:variable name="scale">
8380
+
8381
+ <xsl:value-of select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8382
+
8383
+ </xsl:variable>
8286
8384
  <xsl:value-of select="$scale"/>
8287
8385
  </xsl:template>
8288
8386
 
@@ -8301,14 +8399,8 @@
8301
8399
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8302
8400
  </xsl:when>
8303
8401
  <xsl:when test="not(starts-with(@src, 'data:'))">
8304
- <xsl:choose>
8305
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8306
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8307
- </xsl:when>
8308
- <xsl:otherwise>
8309
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8310
- </xsl:otherwise>
8311
- </xsl:choose>
8402
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
8403
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
8312
8404
  </xsl:when>
8313
8405
  <xsl:otherwise>
8314
8406
  <xsl:value-of select="@src"/>
@@ -8329,16 +8421,8 @@
8329
8421
  </svg>
8330
8422
  </xsl:when>
8331
8423
  <xsl:when test="not(starts-with(@src, 'data:'))">
8332
- <xsl:variable name="src">
8333
- <xsl:choose>
8334
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8335
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8336
- </xsl:when>
8337
- <xsl:otherwise>
8338
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8339
- </xsl:otherwise>
8340
- </xsl:choose>
8341
- </xsl:variable>
8424
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
8425
+ <xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/>
8342
8426
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8343
8427
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
8344
8428
  <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
@@ -8835,20 +8919,48 @@
8835
8919
  <xsl:template match="*[local-name() = 'emf']"/>
8836
8920
 
8837
8921
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
8922
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
8923
+ <xsl:apply-templates mode="contents"/>
8924
+ <xsl:text> </xsl:text>
8925
+ </xsl:if>
8926
+ </xsl:template>
8927
+
8928
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="contents"/>
8929
+
8930
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fmt-name'] | *[local-name() = 'table']/*[local-name() = 'fmt-name'] | *[local-name() = 'permission']/*[local-name() = 'fmt-name'] | *[local-name() = 'recommendation']/*[local-name() = 'fmt-name'] | *[local-name() = 'requirement']/*[local-name() = 'fmt-name']" mode="contents">
8838
8931
  <xsl:apply-templates mode="contents"/>
8839
8932
  <xsl:text> </xsl:text>
8840
8933
  </xsl:template>
8841
8934
 
8842
8935
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name'] | *[local-name() = 'sourcecode']/*[local-name() = 'name']" mode="bookmarks">
8936
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
8937
+ <xsl:apply-templates mode="bookmarks"/>
8938
+ <xsl:text> </xsl:text>
8939
+ </xsl:if>
8940
+ </xsl:template>
8941
+
8942
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fmt-name'] | *[local-name() = 'table']/*[local-name() = 'fmt-name'] | *[local-name() = 'permission']/*[local-name() = 'fmt-name'] | *[local-name() = 'recommendation']/*[local-name() = 'fmt-name'] | *[local-name() = 'requirement']/*[local-name() = 'fmt-name'] | *[local-name() = 'sourcecode']/*[local-name() = 'fmt-name']" mode="bookmarks">
8843
8943
  <xsl:apply-templates mode="bookmarks"/>
8844
8944
  <xsl:text> </xsl:text>
8845
8945
  </xsl:template>
8846
8946
 
8847
8947
  <xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
8948
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
8949
+ <xsl:value-of select="."/>
8950
+ </xsl:if>
8951
+ </xsl:template>
8952
+
8953
+ <xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'fmt-name']/text()" mode="contents" priority="2">
8848
8954
  <xsl:value-of select="."/>
8849
8955
  </xsl:template>
8850
8956
 
8851
8957
  <xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'name']//text()" mode="bookmarks" priority="2">
8958
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
8959
+ <xsl:value-of select="."/>
8960
+ </xsl:if>
8961
+ </xsl:template>
8962
+
8963
+ <xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement' or local-name() = 'sourcecode']/*[local-name() = 'fmt-name']//text()" mode="bookmarks" priority="2">
8852
8964
  <xsl:value-of select="."/>
8853
8965
  </xsl:template>
8854
8966
 
@@ -8869,7 +8981,7 @@
8869
8981
  </xsl:template>
8870
8982
 
8871
8983
  <!-- special case: ignore section-title if @depth different than @depth of parent clause, or @depth of parent clause = 1 -->
8872
- <xsl:template match="*[local-name() = 'clause']/*[local-name() = 'p'][@type = 'section-title' and (@depth != ../*[local-name() = 'title']/@depth or ../*[local-name() = 'title']/@depth = 1)]" priority="3" mode="contents"/>
8984
+ <xsl:template match="*[local-name() = 'clause']/*[local-name() = 'p'][@type = 'section-title' and (@depth != ../*[local-name() = 'title' or local-name() = 'fmt-title']/@depth or ../*[local-name() = 'title' or local-name() = 'fmt-title']/@depth = 1)]" priority="3" mode="contents"/>
8873
8985
 
8874
8986
  <xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
8875
8987
  <xsl:variable name="level">
@@ -8881,6 +8993,9 @@
8881
8993
  <xsl:variable name="section">
8882
8994
  <xsl:choose>
8883
8995
  <xsl:when test="@type = 'section-title'"/>
8996
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
8997
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
8998
+ </xsl:when>
8884
8999
  <xsl:otherwise>
8885
9000
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8886
9001
  </xsl:otherwise>
@@ -8903,6 +9018,19 @@
8903
9018
 
8904
9019
  <xsl:variable name="title">
8905
9020
  <xsl:choose>
9021
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/770 -->
9022
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
9023
+ <xsl:choose>
9024
+ <xsl:when test="@type = 'section-title'">
9025
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9026
+ <xsl:text>: </xsl:text>
9027
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9028
+ </xsl:when>
9029
+ <xsl:otherwise>
9030
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9031
+ </xsl:otherwise>
9032
+ </xsl:choose>
9033
+ </xsl:when>
8906
9034
  <xsl:when test="*[local-name() = 'tab']">
8907
9035
  <xsl:choose>
8908
9036
  <xsl:when test="@type = 'section-title'">
@@ -8938,7 +9066,7 @@
8938
9066
  <xsl:apply-templates mode="bookmarks"/>
8939
9067
  </xsl:template>
8940
9068
 
8941
- <xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
9069
+ <xsl:template match="*[local-name() = 'title' or local-name() = 'name' or local-name() = 'fmt-title' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
8942
9070
  <xsl:apply-templates select="."/>
8943
9071
  </xsl:template>
8944
9072
 
@@ -8951,6 +9079,10 @@
8951
9079
  <xsl:apply-templates mode="contents"/>
8952
9080
  </xsl:template>
8953
9081
 
9082
+ <xsl:template match="*[local-name() = 'semx']" mode="contents">
9083
+ <xsl:apply-templates mode="contents"/>
9084
+ </xsl:template>
9085
+
8954
9086
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
8955
9087
  <xsl:apply-templates mode="bookmarks"/>
8956
9088
  </xsl:template>
@@ -8960,9 +9092,14 @@
8960
9092
  <xsl:apply-templates mode="bookmarks"/>
8961
9093
  </xsl:template>
8962
9094
 
9095
+ <xsl:template match="*[local-name() = 'semx']" mode="bookmarks">
9096
+ <xsl:apply-templates mode="bookmarks"/>
9097
+ </xsl:template>
9098
+
8963
9099
  <!-- Bookmarks -->
8964
9100
  <xsl:template name="addBookmarks">
8965
9101
  <xsl:param name="contents"/>
9102
+ <xsl:param name="contents_addon"/>
8966
9103
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
8967
9104
  <xsl:if test="$contents_nodes//item">
8968
9105
  <fo:bookmark-tree>
@@ -9060,6 +9197,9 @@
9060
9197
  </xsl:otherwise>
9061
9198
  </xsl:choose>
9062
9199
 
9200
+ <!-- for $namespace = 'nist-sp' $namespace = 'ogc' $namespace = 'ogc-white-paper' -->
9201
+ <xsl:copy-of select="$contents_addon"/>
9202
+
9063
9203
  </fo:bookmark-tree>
9064
9204
  </xsl:if>
9065
9205
  </xsl:template>
@@ -9213,6 +9353,16 @@
9213
9353
  <!-- ====== -->
9214
9354
  <!-- ====== -->
9215
9355
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
9356
+ <xsl:param name="mode">bookmarks</xsl:param>
9357
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-title'])">
9358
+ <xsl:apply-templates mode="contents_item">
9359
+ <xsl:with-param name="mode" select="$mode"/>
9360
+ </xsl:apply-templates>
9361
+ <!-- <xsl:text> </xsl:text> -->
9362
+ </xsl:if>
9363
+ </xsl:template>
9364
+
9365
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="contents_item">
9216
9366
  <xsl:param name="mode">bookmarks</xsl:param>
9217
9367
  <xsl:apply-templates mode="contents_item">
9218
9368
  <xsl:with-param name="mode" select="$mode"/>
@@ -9220,12 +9370,38 @@
9220
9370
  <!-- <xsl:text> </xsl:text> -->
9221
9371
  </xsl:template>
9222
9372
 
9373
+ <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim']" mode="contents_item" priority="3">
9374
+ <xsl:apply-templates mode="contents_item"/>
9375
+ </xsl:template>
9376
+
9377
+ <xsl:template match="*[local-name() = 'semx']" mode="contents_item">
9378
+ <xsl:apply-templates mode="contents_item"/>
9379
+ </xsl:template>
9380
+
9381
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="contents_item"/>
9382
+
9223
9383
  <xsl:template name="getSection">
9224
- <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9384
+ <xsl:choose>
9385
+ <xsl:when test="*[local-name() = 'fmt-title']">
9386
+ <xsl:variable name="fmt_title_section">
9387
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/preceding-sibling::node()[not(local-name() = 'review')]"/>
9388
+ </xsl:variable>
9389
+ <xsl:value-of select="normalize-space($fmt_title_section)"/>
9390
+ </xsl:when>
9391
+ <xsl:otherwise>
9392
+ <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9393
+ </xsl:otherwise>
9394
+ </xsl:choose>
9225
9395
  </xsl:template>
9226
9396
 
9227
9397
  <xsl:template name="getName">
9228
9398
  <xsl:choose>
9399
+ <xsl:when test="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']]">
9400
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/following-sibling::node()"/>
9401
+ </xsl:when>
9402
+ <xsl:when test="*[local-name() = 'fmt-title']">
9403
+ <xsl:copy-of select="*[local-name() = 'fmt-title']/node()"/>
9404
+ </xsl:when>
9229
9405
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
9230
9406
  <xsl:copy-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/following-sibling::node()"/>
9231
9407
  </xsl:when>
@@ -9332,6 +9508,15 @@
9332
9508
  </xsl:template>
9333
9509
 
9334
9510
  <xsl:template match="*[local-name() = 'name']" mode="contents_item">
9511
+ <xsl:param name="mode">bookmarks</xsl:param>
9512
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
9513
+ <xsl:apply-templates mode="contents_item">
9514
+ <xsl:with-param name="mode" select="$mode"/>
9515
+ </xsl:apply-templates>
9516
+ </xsl:if>
9517
+ </xsl:template>
9518
+
9519
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="contents_item">
9335
9520
  <xsl:param name="mode">bookmarks</xsl:param>
9336
9521
  <xsl:apply-templates mode="contents_item">
9337
9522
  <xsl:with-param name="mode" select="$mode"/>
@@ -10173,107 +10358,108 @@
10173
10358
  -->
10174
10359
  <xsl:template match="*[local-name() = 'example']">
10175
10360
 
10176
- <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10361
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10177
10362
 
10178
- <xsl:call-template name="setBlockSpanAll"/>
10363
+ <xsl:call-template name="setBlockSpanAll"/>
10179
10364
 
10180
- <xsl:call-template name="refine_example-style"/>
10365
+ <xsl:call-template name="refine_example-style"/>
10181
10366
 
10182
- <xsl:variable name="fo_element">
10183
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
10184
- inline
10185
- </xsl:variable>
10367
+ <xsl:variable name="fo_element">
10368
+ <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
10369
+ inline
10370
+ </xsl:variable>
10186
10371
 
10187
- <fo:block-container margin-left="0mm" role="SKIP">
10372
+ <fo:block-container margin-left="0mm" role="SKIP">
10188
10373
 
10189
- <xsl:choose>
10374
+ <xsl:choose>
10190
10375
 
10191
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
10376
+ <xsl:when test="contains(normalize-space($fo_element), 'block')">
10192
10377
 
10193
- <!-- display name 'EXAMPLE' in a separate block -->
10194
- <fo:block>
10195
- <xsl:apply-templates select="*[local-name()='name']">
10196
- <xsl:with-param name="fo_element" select="$fo_element"/>
10197
- </xsl:apply-templates>
10198
- </fo:block>
10199
-
10200
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10201
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10202
- <xsl:variable name="example_body">
10203
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10378
+ <!-- display name 'EXAMPLE' in a separate block -->
10379
+ <fo:block>
10380
+ <xsl:apply-templates select="*[local-name()='name']">
10204
10381
  <xsl:with-param name="fo_element" select="$fo_element"/>
10205
10382
  </xsl:apply-templates>
10383
+ </fo:block>
10384
+
10385
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10386
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10387
+ <xsl:variable name="example_body">
10388
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10389
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10390
+ </xsl:apply-templates>
10391
+ </xsl:variable>
10392
+ <xsl:choose>
10393
+ <xsl:when test="xalan:nodeset($example_body)/*">
10394
+ <xsl:copy-of select="$example_body"/>
10395
+ </xsl:when>
10396
+ <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
10397
+ </xsl:choose>
10398
+ </fo:block-container>
10399
+ </fo:block-container>
10400
+ </xsl:when> <!-- end block -->
10401
+
10402
+ <xsl:when test="contains(normalize-space($fo_element), 'list')">
10403
+
10404
+ <xsl:variable name="provisional_distance_between_starts_">
10405
+ 7
10206
10406
  </xsl:variable>
10207
- <xsl:choose>
10208
- <xsl:when test="xalan:nodeset($example_body)/*">
10209
- <xsl:copy-of select="$example_body"/>
10210
- </xsl:when>
10211
- <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
10212
- </xsl:choose>
10213
- </fo:block-container>
10214
- </fo:block-container>
10215
- </xsl:when> <!-- end block -->
10407
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10408
+ <xsl:variable name="indent_">
10409
+ 0
10410
+ </xsl:variable>
10411
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
10216
10412
 
10217
- <xsl:when test="contains(normalize-space($fo_element), 'list')">
10413
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10414
+ <fo:list-item>
10415
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
10416
+ <fo:block>
10417
+ <xsl:apply-templates select="*[local-name()='name']">
10418
+ <xsl:with-param name="fo_element">block</xsl:with-param>
10419
+ </xsl:apply-templates>
10420
+ </fo:block>
10421
+ </fo:list-item-label>
10422
+ <fo:list-item-body start-indent="body-start()">
10423
+ <fo:block>
10424
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10425
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10426
+ </xsl:apply-templates>
10427
+ </fo:block>
10428
+ </fo:list-item-body>
10429
+ </fo:list-item>
10430
+ </fo:list-block>
10431
+ </xsl:when> <!-- end list -->
10218
10432
 
10219
- <xsl:variable name="provisional_distance_between_starts_">
10220
- 7
10221
- </xsl:variable>
10222
- <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10223
- <xsl:variable name="indent_">
10224
- 0
10225
- </xsl:variable>
10226
- <xsl:variable name="indent" select="normalize-space($indent_)"/>
10433
+ <xsl:otherwise> <!-- inline -->
10227
10434
 
10228
- <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10229
- <fo:list-item>
10230
- <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
10231
- <fo:block>
10232
- <xsl:apply-templates select="*[local-name()='name']">
10233
- <xsl:with-param name="fo_element">block</xsl:with-param>
10234
- </xsl:apply-templates>
10235
- </fo:block>
10236
- </fo:list-item-label>
10237
- <fo:list-item-body start-indent="body-start()">
10238
- <fo:block>
10239
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10435
+ <!-- display 'EXAMPLE' and first element in the same line -->
10436
+ <fo:block>
10437
+ <xsl:apply-templates select="*[local-name()='name']">
10438
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10439
+ </xsl:apply-templates>
10440
+ <fo:inline>
10441
+ <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
10240
10442
  <xsl:with-param name="fo_element" select="$fo_element"/>
10241
10443
  </xsl:apply-templates>
10242
- </fo:block>
10243
- </fo:list-item-body>
10244
- </fo:list-item>
10245
- </fo:list-block>
10246
- </xsl:when> <!-- end list -->
10247
-
10248
- <xsl:otherwise> <!-- inline -->
10444
+ </fo:inline>
10445
+ </fo:block>
10249
10446
 
10250
- <!-- display 'EXAMPLE' and first element in the same line -->
10251
- <fo:block>
10252
- <xsl:apply-templates select="*[local-name()='name']">
10253
- <xsl:with-param name="fo_element" select="$fo_element"/>
10254
- </xsl:apply-templates>
10255
- <fo:inline>
10256
- <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
10257
- <xsl:with-param name="fo_element" select="$fo_element"/>
10258
- </xsl:apply-templates>
10259
- </fo:inline>
10260
- </fo:block>
10447
+ <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
10448
+ <!-- display further elements in blocks -->
10449
+ <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10450
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10451
+ <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
10452
+ <xsl:with-param name="fo_element" select="'block'"/>
10453
+ </xsl:apply-templates>
10454
+ </fo:block-container>
10455
+ </fo:block-container>
10456
+ </xsl:if>
10457
+ </xsl:otherwise> <!-- end inline -->
10261
10458
 
10262
- <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
10263
- <!-- display further elements in blocks -->
10264
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10265
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10266
- <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
10267
- <xsl:with-param name="fo_element" select="'block'"/>
10268
- </xsl:apply-templates>
10269
- </fo:block-container>
10270
- </fo:block-container>
10271
- </xsl:if>
10272
- </xsl:otherwise> <!-- end inline -->
10459
+ </xsl:choose>
10460
+ </fo:block-container>
10461
+ </fo:block-container>
10273
10462
 
10274
- </xsl:choose>
10275
- </fo:block-container>
10276
- </fo:block-container>
10277
10463
  </xsl:template>
10278
10464
 
10279
10465
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
@@ -10656,6 +10842,15 @@
10656
10842
 
10657
10843
  </xsl:template> <!-- tab -->
10658
10844
 
10845
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
10846
+ <xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
10847
+
10848
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
10849
+
10850
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
10851
+
10852
+ </xsl:template>
10853
+
10659
10854
  <xsl:template name="insertNonBreakSpaces">
10660
10855
  <xsl:param name="count"/>
10661
10856
  <xsl:if test="$count &gt; 0">
@@ -12191,6 +12386,10 @@
12191
12386
  <!-- - Remove semantic xml part -->
12192
12387
  <!-- - Remove image/emf (EMF vector image for Word) -->
12193
12388
  <!-- - add @id, redundant for table auto-layout algorithm -->
12389
+ <!-- - process 'passthrough' element -->
12390
+ <!-- - split math by element with @linebreak into maths -->
12391
+ <!-- - rename fmt-title to title, fmt-name to name and another changes to convert new presentation XML to -->
12392
+ <!-- - old XML without significant changes in XSLT -->
12194
12393
  <!-- =========================================================================== -->
12195
12394
  <xsl:template match="@*|node()" mode="update_xml_step1">
12196
12395
  <xsl:copy>
@@ -12198,6 +12397,12 @@
12198
12397
  </xsl:copy>
12199
12398
  </xsl:template>
12200
12399
 
12400
+ <xsl:template match="@*|node()" mode="update_xml_pres">
12401
+ <xsl:copy>
12402
+ <xsl:apply-templates select="@*|node()" mode="update_xml_pres"/>
12403
+ </xsl:copy>
12404
+ </xsl:template>
12405
+
12201
12406
  <!-- change section's order based on @displayorder value -->
12202
12407
  <xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
12203
12408
  <xsl:copy>
@@ -12274,7 +12479,7 @@
12274
12479
  </xsl:template>
12275
12480
 
12276
12481
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
12277
- <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
12482
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear' or @class = 'horizontal' or @class = 'norotate' or @class = 'halffontsize']" mode="update_xml_step1" priority="2">
12278
12483
  <xsl:copy>
12279
12484
  <xsl:copy-of select="@*"/>
12280
12485
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -12293,14 +12498,17 @@
12293
12498
 
12294
12499
  <!-- remove semantic xml -->
12295
12500
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
12501
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_pres"/>
12296
12502
 
12297
12503
  <!-- remove image/emf -->
12298
12504
  <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
12505
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_pres"/>
12299
12506
 
12300
12507
  <!-- remove preprocess-xslt -->
12301
12508
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
12509
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
12302
12510
 
12303
- <xsl:template match="*[local-name() = 'stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])] | *[local-name() = 'image'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'sourcecode'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'bibdata'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
12511
+ <xsl:template match="*[local-name() = 'stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])] | *[local-name() = 'image'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'sourcecode'][not(.//*[local-name() = 'passthrough']) and not(.//*[local-name() = 'fmt-name'])] | *[local-name() = 'bibdata'][not(.//*[local-name() = 'passthrough'])] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
12304
12512
  <xsl:copy-of select="."/>
12305
12513
  </xsl:template>
12306
12514
 
@@ -12332,7 +12540,9 @@
12332
12540
  <xsl:template name="add_id">
12333
12541
  <xsl:if test="not(@id)">
12334
12542
  <!-- add @id - first element with @id plus '_element_name' -->
12335
- <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
12543
+ <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
12544
+ <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>
12545
+ <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
12336
12546
  </xsl:if>
12337
12547
  </xsl:template>
12338
12548
 
@@ -12382,6 +12592,77 @@
12382
12592
  <xsl:copy-of select="$maths"/>
12383
12593
  </xsl:template>
12384
12594
 
12595
+ <!-- update new Presentation XML -->
12596
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_step1"/>
12597
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_pres"/>
12598
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_step1"/>
12599
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
12600
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
12601
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
12602
+
12603
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
12604
+ <xsl:copy>
12605
+ <xsl:apply-templates select="@*" mode="update_xml_step1"/>
12606
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
12607
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
12608
+ </xsl:copy>
12609
+ </xsl:template>
12610
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_pres">
12611
+ <xsl:copy>
12612
+ <xsl:apply-templates select="@*" mode="update_xml_pres"/>
12613
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
12614
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
12615
+ </xsl:copy>
12616
+ </xsl:template>
12617
+
12618
+ <xsl:template match="*[local-name() = 'fmt-title']"/>
12619
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
12620
+ <xsl:element name="title" namespace="{$namespace_full}">
12621
+ <xsl:copy-of select="@*"/>
12622
+ <xsl:apply-templates mode="update_xml_step1"/>
12623
+ </xsl:element>
12624
+ </xsl:template>
12625
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
12626
+ <xsl:element name="title" namespace="{$namespace_full}">
12627
+ <xsl:copy-of select="@*"/>
12628
+ <xsl:apply-templates mode="update_xml_pres"/>
12629
+ </xsl:element>
12630
+ </xsl:template>
12631
+
12632
+ <xsl:template match="*[local-name() = 'fmt-name']"/>
12633
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
12634
+ <xsl:element name="name" namespace="{$namespace_full}">
12635
+ <xsl:copy-of select="@*"/>
12636
+ <xsl:apply-templates mode="update_xml_step1"/>
12637
+ </xsl:element>
12638
+ </xsl:template>
12639
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres">
12640
+ <xsl:element name="name" namespace="{$namespace_full}">
12641
+ <xsl:copy-of select="@*"/>
12642
+ <xsl:apply-templates mode="update_xml_pres"/>
12643
+ </xsl:element>
12644
+ </xsl:template>
12645
+
12646
+ <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
12647
+ <xsl:apply-templates mode="update_xml_step1"/>
12648
+ </xsl:template>
12649
+ <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_pres" priority="3">
12650
+ <xsl:apply-templates mode="update_xml_pres"/>
12651
+ </xsl:template>
12652
+
12653
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_step1">
12654
+ <xsl:apply-templates mode="update_xml_step1"/>
12655
+ </xsl:template>
12656
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_pres">
12657
+ <xsl:apply-templates mode="update_xml_pres"/>
12658
+ </xsl:template>
12659
+
12660
+ <xsl:template match="*[local-name() = 'fmt-xref-label']"/>
12661
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_step1"/>
12662
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_pres"/>
12663
+
12664
+ <!-- END: update new Presentation XML -->
12665
+
12385
12666
  <!-- =========================================================================== -->
12386
12667
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
12387
12668
  <!-- =========================================================================== -->
@@ -12574,7 +12855,7 @@
12574
12855
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
12575
12856
  <xsl:variable name="regex_dots_units">((\b((<xsl:value-of select="$non_white_space"/>{1,3}\.<xsl:value-of select="$non_white_space"/>+)|(<xsl:value-of select="$non_white_space"/>+\.<xsl:value-of select="$non_white_space"/>{1,3}))\b)|(\.<xsl:value-of select="$non_white_space"/>{1,3})\b)</xsl:variable>
12576
12857
 
12577
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') or normalize-space() = '' )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
12858
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or ancestor::*[local-name() = 'svg'] or ancestor::*[local-name() = 'name'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') or normalize-space() = '' )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
12578
12859
 
12579
12860
  <xsl:variable name="parent" select="local-name(..)"/>
12580
12861
 
@@ -13153,6 +13434,7 @@
13153
13434
  </pdf:catalog>
13154
13435
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
13155
13436
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
13437
+ <!-- Commented after upgrade to Apache FOP 2.10
13156
13438
  <rdf:Description xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#" xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" rdf:about="">
13157
13439
  <pdfaExtension:schemas>
13158
13440
  <rdf:Bag>
@@ -13185,7 +13467,7 @@
13185
13467
  </rdf:li>
13186
13468
  </rdf:Bag>
13187
13469
  </pdfaExtension:schemas>
13188
- </rdf:Description>
13470
+ </rdf:Description> -->
13189
13471
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
13190
13472
  <!-- Dublin Core properties go here -->
13191
13473
  <dc:title>
@@ -13232,7 +13514,7 @@
13232
13514
  <xsl:variable name="dc_description">
13233
13515
  <xsl:variable name="abstract">
13234
13516
 
13235
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
13517
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'fmt-title']) and not(ancestor::*[local-name() = 'title']) and not(ancestor::*[local-name() = 'fmt-xref-label'])]"/>
13236
13518
 
13237
13519
  </xsl:variable>
13238
13520
  <rdf:Alt>
@@ -13565,6 +13847,7 @@
13565
13847
  <xsl:param name="formatted">false</xsl:param>
13566
13848
  <xsl:param name="lang"/>
13567
13849
  <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
13850
+ <xsl:param name="bibdata_updated"/>
13568
13851
 
13569
13852
  <xsl:variable name="curr_lang">
13570
13853
  <xsl:choose>
@@ -13578,6 +13861,9 @@
13578
13861
 
13579
13862
  <xsl:variable name="data_value">
13580
13863
  <xsl:choose>
13864
+ <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
13865
+ <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
13866
+ </xsl:when>
13581
13867
  <xsl:when test="$formatted = 'true'">
13582
13868
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
13583
13869
  </xsl:when>
@@ -13749,14 +14035,8 @@
13749
14035
  <xsl:value-of select="$src"/>
13750
14036
  </xsl:when>
13751
14037
  <xsl:otherwise>
13752
- <xsl:choose>
13753
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
13754
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
13755
- </xsl:when>
13756
- <xsl:otherwise>
13757
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13758
- </xsl:otherwise>
13759
- </xsl:choose>
14038
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
14039
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
13760
14040
  </xsl:otherwise>
13761
14041
  </xsl:choose>
13762
14042
  </xsl:template>
@@ -13777,31 +14057,173 @@
13777
14057
 
13778
14058
  <!-- END: insert cover page image -->
13779
14059
 
13780
- <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
14060
+ <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
14061
+ <xsl:variable name="regex_ja_spec_half_width_">
14062
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14063
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14064
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14065
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14066
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14067
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14068
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14069
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14070
+ </xsl:variable>
14071
+ <xsl:variable name="regex_ja_spec_half_width" select="translate(normalize-space($regex_ja_spec_half_width_), ' ', '')"/>
14072
+ <xsl:variable name="regex_ja_spec_">[
14073
+ <!-- Rotate 90° clockwise -->
14074
+ <xsl:value-of select="$regex_ja_spec_half_width"/>
14075
+ \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
14076
+ \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
14077
+ \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
14078
+ \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
14079
+ \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
14080
+ \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
14081
+ \u3010 <!-- U+3010 LEFT BLACK LENTICULAR BRACKET (【) -->
14082
+ \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
14083
+ \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
14084
+ \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
14085
+ \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
14086
+ \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
14087
+ \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
14088
+ \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
14089
+ \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
14090
+ \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
14091
+ \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
14092
+ \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
14093
+ \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
14094
+ \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
14095
+ \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
14096
+ \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
14097
+ \u301C <!-- U+301C WAVE DASH (〜) -->
14098
+ \u3030 <!-- U+3030 WAVY DASH (〰 )-->
14099
+ \u30FC <!-- U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK (ー) -->
14100
+ \u2329 <!-- U+2329 LEFT-POINTING ANGLE BRACKET (〈) -->
14101
+ \u232A <!-- U+232A RIGHT-POINTING ANGLE BRACKET (〉) -->
14102
+ \u3018 <!-- U+3018 LEFT WHITE TORTOISE SHELL BRACKET (〘) -->
14103
+ \u3019 <!-- U+3019 RIGHT WHITE TORTOISE SHELL BRACKET (〙) -->
14104
+ \u30A0 <!-- U+30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN (゠) -->
14105
+ \uFE59 <!-- U+FE59 SMALL LEFT PARENTHESIS (﹙) -->
14106
+ \uFE5A <!-- U+FE5A SMALL RIGHT PARENTHESIS (﹚) -->
14107
+ \uFE5B <!-- U+FE5B SMALL LEFT CURLY BRACKET (﹛) -->
14108
+ \uFE5C <!-- U+FE5C SMALL RIGHT CURLY BRACKET (﹜) -->
14109
+ \uFE5D <!-- U+FE5D SMALL LEFT TORTOISE SHELL BRACKET (﹝) -->
14110
+ \uFE5E <!-- U+FE5E SMALL RIGHT TORTOISE SHELL BRACKET (﹞) -->
14111
+ \uFF5C <!-- U+FF5C FULLWIDTH VERTICAL LINE (|) -->
14112
+ \uFF5F <!-- U+FF5F FULLWIDTH LEFT WHITE PARENTHESIS (⦅) -->
14113
+ \uFF60 <!-- U+FF60 FULLWIDTH RIGHT WHITE PARENTHESIS (⦆) -->
14114
+ \uFFE3 <!-- U+FFE3 FULLWIDTH MACRON ( ̄) -->
14115
+ \uFF3F <!-- U+FF3F FULLWIDTH LOW LINE (_) -->
14116
+ \uFF5E <!-- U+FF5E FULLWIDTH TILDE (~) -->
14117
+ <!-- Rotate 180° -->
14118
+ \u309C <!-- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜) -->
14119
+ \u3002 <!-- U+3002 IDEOGRAPHIC FULL STOP (。) -->
14120
+ \uFE52 <!-- U+FE52 SMALL FULL STOP (﹒) -->
14121
+ \uFF0E <!-- U+FF0E FULLWIDTH FULL STOP (.) -->
14122
+ ]</xsl:variable>
14123
+ <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
13781
14124
  <xsl:template name="insertVerticalChar">
13782
14125
  <xsl:param name="str"/>
14126
+ <xsl:param name="char_prev"/>
13783
14127
  <xsl:param name="writing-mode">lr-tb</xsl:param>
13784
14128
  <xsl:param name="reference-orientation">90</xsl:param>
13785
- <xsl:if test="string-length($str) &gt; 0">
13786
- <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">
13787
- <xsl:if test="normalize-space($writing-mode) != ''">
13788
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
13789
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
13790
- </xsl:if>
13791
- <xsl:variable name="char" select="substring($str,1,1)"/>
13792
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
13793
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
14129
+ <xsl:param name="add_zero_width_space">false</xsl:param>
14130
+ <xsl:choose>
14131
+ <xsl:when test="ancestor::*[local-name() = 'span'][@class = 'norotate']">
14132
+ <xsl:value-of select="$str"/>
14133
+ </xsl:when>
14134
+ <xsl:otherwise>
14135
+ <xsl:if test="string-length($str) &gt; 0">
14136
+
14137
+ <!-- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/> -->
14138
+ <xsl:variable name="char" select="substring($str,1,1)"/>
14139
+ <xsl:variable name="char_next" select="substring($str,2,1)"/>
14140
+
14141
+ <xsl:variable name="char_half_width" select="normalize-space(java:matches(java:java.lang.String.new($char), concat('([', $regex_ja_spec_half_width, ']{1,})')))"/>
14142
+
14143
+ <xsl:choose>
14144
+ <xsl:when test="$char_half_width = 'true'">
14145
+ <fo:inline>
14146
+ <xsl:attribute name="baseline-shift">7%</xsl:attribute>
14147
+ <xsl:value-of select="$char"/>
14148
+ </fo:inline>
14149
+ </xsl:when>
14150
+ <xsl:otherwise>
14151
+ <!-- namespace-uri(ancestor::*[local-name() = 'title']) != '' to skip title from $contents -->
14152
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_prev = '' and ../preceding-sibling::node())">
14153
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
14154
+ </xsl:if>
14155
+ <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">
14156
+ <xsl:if test="normalize-space($writing-mode) != ''">
14157
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14158
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14159
+ </xsl:if>
14160
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14161
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
14162
+ </xsl:if>
14163
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14164
+ <!-- Rotate 180°:
14165
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14166
+ U+3002 IDEOGRAPHIC FULL STOP (。)
14167
+ U+FE52 SMALL FULL STOP (﹒)
14168
+ U+FF0E FULLWIDTH FULL STOP (.)
14169
+ -->
14170
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14171
+ </xsl:if>
14172
+ <fo:block-container width="1em" role="SKIP"><!-- border="0.5pt solid blue" -->
14173
+ <fo:block line-height="1em" role="SKIP">
14174
+ <!-- <xsl:choose>
14175
+ <xsl:when test="$horizontal_mode = 'true'">
14176
+ <xsl:value-of select="$str"/>
14177
+ </xsl:when>
14178
+ <xsl:otherwise>
14179
+ <xsl:value-of select="$char"/>
14180
+ </xsl:otherwise>
14181
+ </xsl:choose> -->
14182
+ <xsl:value-of select="$char"/>
14183
+ </fo:block>
14184
+ </fo:block-container>
14185
+ </fo:inline-container>
14186
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_next != '' or ../following-sibling::node())">
14187
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
14188
+ </xsl:if>
14189
+ </xsl:otherwise>
14190
+ </xsl:choose>
14191
+
14192
+ <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>
14193
+ <!-- <xsl:if test="$horizontal_mode = 'false'"> -->
14194
+ <xsl:call-template name="insertVerticalChar">
14195
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14196
+ <xsl:with-param name="char_prev" select="$char"/>
14197
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
14198
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14199
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14200
+ </xsl:call-template>
14201
+ <!-- </xsl:if> -->
13794
14202
  </xsl:if>
13795
- <fo:block-container width="1em">
13796
- <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
13797
- </fo:block-container>
13798
- </fo:inline-container>
13799
- <xsl:call-template name="insertVerticalChar">
13800
- <xsl:with-param name="str" select="substring($str, 2)"/>
13801
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
13802
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
13803
- </xsl:call-template>
13804
- </xsl:if>
14203
+ </xsl:otherwise>
14204
+ </xsl:choose>
14205
+ </xsl:template>
14206
+
14207
+ <xsl:template name="insertHorizontalChars">
14208
+ <xsl:param name="str"/>
14209
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
14210
+ <xsl:param name="reference-orientation">90</xsl:param>
14211
+ <xsl:param name="add_zero_width_space">false</xsl:param>
14212
+ <xsl:choose>
14213
+ <xsl:otherwise>
14214
+ <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">
14215
+ <xsl:if test="normalize-space($writing-mode) != ''">
14216
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14217
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14218
+ </xsl:if>
14219
+ <fo:block-container width="1em" role="SKIP"> <!-- border="0.5pt solid green" -->
14220
+ <fo:block line-height="1em" role="SKIP">
14221
+ <xsl:value-of select="$str"/>
14222
+ </fo:block>
14223
+ </fo:block-container>
14224
+ </fo:inline-container>
14225
+ </xsl:otherwise>
14226
+ </xsl:choose>
13805
14227
  </xsl:template>
13806
14228
 
13807
14229
  <xsl:template name="number-to-words">