metanorma-jis 0.3.7 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -94,12 +94,12 @@
94
94
  </fo:simple-page-master>
95
95
 
96
96
  <fo:simple-page-master master-name="first_page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
97
- <xsl:if test="$vertical_layout = 'true'">
97
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
98
98
  <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
99
99
  <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
100
100
  </xsl:if>
101
101
  <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
102
- <xsl:if test="$vertical_layout = 'true'">
102
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
103
103
  <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
104
104
  </xsl:if>
105
105
  </fo:region-body>
@@ -109,12 +109,12 @@
109
109
  <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
110
110
  </fo:simple-page-master>
111
111
  <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
112
- <xsl:if test="$vertical_layout = 'true'">
112
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
113
113
  <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
114
114
  <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
115
115
  </xsl:if>
116
116
  <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
117
- <xsl:if test="$vertical_layout = 'true'">
117
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
118
118
  <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
119
119
  </xsl:if>
120
120
  </fo:region-body>
@@ -124,12 +124,12 @@
124
124
  <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
125
125
  </fo:simple-page-master>
126
126
  <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
127
- <xsl:if test="$vertical_layout = 'true'">
127
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
128
128
  <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
129
129
  <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
130
130
  </xsl:if>
131
131
  <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
132
- <xsl:if test="$vertical_layout = 'true'">
132
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
133
133
  <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
134
134
  </xsl:if>
135
135
  </fo:region-body>
@@ -145,7 +145,7 @@
145
145
  <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
146
146
  </xsl:if>
147
147
  <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
148
- <xsl:if test="$vertical_layout = 'true'">
148
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
149
149
  <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
150
150
  </xsl:if>
151
151
  </fo:region-body>
@@ -225,7 +225,11 @@
225
225
  fo:region-body/margin-right = top margin
226
226
  -->
227
227
  <!-- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2 + 40}mm" writing-mode="tb-rl" background-color="rgb(240,240,240)"/> -->
228
- <fo:region-body margin-top="{$marginLeftRight1}mm" margin-bottom="{$marginLeftRight2}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm" writing-mode="tb-rl"/> <!-- background-color="rgb(240,240,240)" -->
228
+ <fo:region-body margin-top="{$marginLeftRight1}mm" margin-bottom="{$marginLeftRight2}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm"> <!-- background-color="rgb(240,240,240)" -->
229
+ <xsl:if test="$isGenerateTableIF = 'false'">
230
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
231
+ </xsl:if>
232
+ </fo:region-body>
229
233
  <fo:region-before region-name="header" extent="{$marginTop}mm"/> <!-- background-color="yellow" -->
230
234
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/> <!-- background-color="green" -->
231
235
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/> <!-- background-color="blue" -->
@@ -240,7 +244,11 @@
240
244
  fo:region-body/margin-right = top margin
241
245
  -->
242
246
  <!-- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2 + 40}mm" writing-mode="tb-rl" background-color="rgb(240,240,240)"/> -->
243
- <fo:region-body margin-top="{$marginLeftRight1}mm" margin-bottom="{$marginLeftRight2}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm" writing-mode="tb-rl"/> <!-- background-color="rgb(240,240,240)" -->
247
+ <fo:region-body margin-top="{$marginLeftRight1}mm" margin-bottom="{$marginLeftRight2}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm"> <!-- background-color="rgb(240,240,240)" -->
248
+ <xsl:if test="$isGenerateTableIF = 'false'">
249
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
250
+ </xsl:if>
251
+ </fo:region-body>
244
252
  <fo:region-before region-name="header" extent="{$marginTop}mm"/> <!-- background-color="yellow" -->
245
253
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/> <!-- background-color="green" -->
246
254
  <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/> <!-- background-color="blue" -->
@@ -254,8 +262,16 @@
254
262
  fo:region-body/margin-right = top margin
255
263
  -->
256
264
  <!-- <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2 + 40}mm" writing-mode="tb-rl" background-color="rgb(240,240,240)"/> -->
257
- <fo:region-body margin-top="194mm" margin-bottom="{$marginLeftRight2}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm" writing-mode="tb-rl"/> <!-- background-color="rgb(240,240,240)" -->
258
- <fo:region-before region-name="header-last" extent="{$marginTop}mm" writing-mode="tb-rl"/> <!-- background-color="yellow" -->
265
+ <fo:region-body margin-top="194mm" margin-bottom="{$marginLeftRight2}mm" margin-left="{$marginBottom}mm" margin-right="{$marginTop}mm"> <!-- background-color="rgb(240,240,240)" -->
266
+ <xsl:if test="$isGenerateTableIF = 'false'">
267
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
268
+ </xsl:if>
269
+ </fo:region-body>
270
+ <fo:region-before region-name="header-last" extent="{$marginTop}mm"> <!-- background-color="yellow" -->
271
+ <xsl:if test="$isGenerateTableIF = 'false'">
272
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
273
+ </xsl:if>
274
+ </fo:region-before>
259
275
  <fo:region-after region-name="footer" extent="{$marginBottom}mm"/> <!-- background-color="green" -->
260
276
  <!-- for boilerplate:
261
277
  reserve paper space in left-region, but text will render in the header
@@ -272,12 +288,12 @@
272
288
  </fo:page-sequence-master>
273
289
 
274
290
  <fo:simple-page-master master-name="commentary_first_page_even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
275
- <xsl:if test="$vertical_layout = 'true'">
291
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
276
292
  <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
277
293
  <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
278
294
  </xsl:if>
279
295
  <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
280
- <xsl:if test="$vertical_layout = 'true'">
296
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
281
297
  <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
282
298
  </xsl:if>
283
299
  </fo:region-body>
@@ -288,12 +304,12 @@
288
304
  </fo:simple-page-master>
289
305
 
290
306
  <fo:simple-page-master master-name="commentary_first_page_odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
291
- <xsl:if test="$vertical_layout = 'true'">
307
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
292
308
  <xsl:attribute name="page-width"><xsl:value-of select="$pageHeight"/>mm</xsl:attribute>
293
309
  <xsl:attribute name="page-height"><xsl:value-of select="$pageWidth"/>mm</xsl:attribute>
294
310
  </xsl:if>
295
311
  <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm">
296
- <xsl:if test="$vertical_layout = 'true'">
312
+ <xsl:if test="$vertical_layout = 'true' and $isGenerateTableIF = 'false'">
297
313
  <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
298
314
  </xsl:if>
299
315
  </fo:region-body>
@@ -357,15 +373,41 @@
357
373
  <xsl:with-param name="contents" select="$contents"/>
358
374
  </xsl:call-template>
359
375
 
376
+ <xsl:if test="$debug = 'true'">
377
+ <redirect:write file="contents_.xml">
378
+ <xsl:copy-of select="$contents"/>
379
+ </redirect:write>
380
+ </xsl:if>
381
+
382
+ <xsl:variable name="updated_xml_step0">
383
+ <xsl:if test="$vertical_layout = 'true'">
384
+ <xsl:apply-templates mode="update_xml_step0"/>
385
+ </xsl:if>
386
+ </xsl:variable>
387
+ <xsl:if test="$debug = 'true'">
388
+ <redirect:write file="update_xml_step0.xml">
389
+ <xsl:copy-of select="$updated_xml_step0"/>
390
+ </redirect:write>
391
+ </xsl:if>
392
+
360
393
  <xsl:variable name="updated_xml_step1">
361
- <xsl:apply-templates mode="update_xml_step1"/>
394
+ <xsl:choose>
395
+ <xsl:when test="$vertical_layout = 'true'">
396
+ <xsl:apply-templates select="xalan:nodeset($updated_xml_step0)" mode="update_xml_step1"/>
397
+ </xsl:when>
398
+ <xsl:otherwise>
399
+ <xsl:apply-templates mode="update_xml_step1"/>
400
+ </xsl:otherwise>
401
+ </xsl:choose>
362
402
  </xsl:variable>
363
403
  <!-- DEBUG: updated_xml_step1=<xsl:copy-of select="$updated_xml_step1"/> -->
364
- <!-- <xsl:message>start redirect</xsl:message>
365
- <redirect:write file="update_xml_step1.xml">
366
- <xsl:copy-of select="$updated_xml_step1"/>
367
- </redirect:write>
368
- <xsl:message>end redirect</xsl:message> -->
404
+ <xsl:if test="$debug = 'true'">
405
+ <xsl:message>start redirect</xsl:message>
406
+ <redirect:write file="update_xml_step1.xml">
407
+ <xsl:copy-of select="$updated_xml_step1"/>
408
+ </redirect:write>
409
+ <xsl:message>end redirect</xsl:message>
410
+ </xsl:if>
369
411
 
370
412
  <xsl:variable name="updated_xml_step2_">
371
413
  <xsl:apply-templates select="xalan:nodeset($updated_xml_step1)" mode="update_xml_step2"/>
@@ -467,7 +509,7 @@
467
509
 
468
510
  <xsl:if test="$vertical_layout = 'true'">
469
511
  <xsl:attribute name="master-reference">document_toc_2024</xsl:attribute>
470
- <xsl:attribute name="format">二</xsl:attribute>
512
+ <xsl:attribute name="format">一</xsl:attribute>
471
513
  </xsl:if>
472
514
 
473
515
  <xsl:if test="position() = 1">
@@ -540,7 +582,7 @@
540
582
 
541
583
  <xsl:if test="$vertical_layout = 'true'">
542
584
  <xsl:attribute name="master-reference">document_2024</xsl:attribute>
543
- <xsl:attribute name="format">二</xsl:attribute>
585
+ <xsl:attribute name="format">一</xsl:attribute>
544
586
  </xsl:if>
545
587
 
546
588
  <xsl:if test="position() = 1">
@@ -660,6 +702,12 @@
660
702
 
661
703
  </xsl:variable>
662
704
 
705
+ <!-- <xsl:if test="$debug = 'true'">
706
+ <redirect:write file="structured_xml_.xml">
707
+ <xsl:copy-of select="$structured_xml_"/>
708
+ </redirect:write>
709
+ </xsl:if> -->
710
+
663
711
  <!-- page break before each section -->
664
712
  <xsl:variable name="structured_xml">
665
713
  <xsl:for-each select="xalan:nodeset($structured_xml_)/item[*]">
@@ -694,7 +742,7 @@
694
742
  <xsl:attribute name="master-reference">document_2024_with_last</xsl:attribute>
695
743
  </xsl:if>
696
744
 
697
- <xsl:attribute name="format">二</xsl:attribute>
745
+ <xsl:attribute name="format">一</xsl:attribute>
698
746
  <!-- <xsl:attribute name="fox:number-conversion-features">&#x30A2;</xsl:attribute> -->
699
747
  </xsl:when>
700
748
  <xsl:otherwise>
@@ -902,7 +950,7 @@
902
950
  </xsl:if>
903
951
  <xsl:choose>
904
952
  <xsl:when test="$vertical_layout = 'true'">
905
- <xsl:attribute name="provisional-distance-between-starts">10mm</xsl:attribute>
953
+ <xsl:attribute name="provisional-distance-between-starts">15mm</xsl:attribute> <!-- 10 isn't enought for 3 chars numbers -->
906
954
  </xsl:when>
907
955
  <xsl:otherwise>
908
956
  <xsl:variable name="provisional-distance-between-starts">
@@ -1503,11 +1551,11 @@
1503
1551
  <!-- ============================= -->
1504
1552
 
1505
1553
  <!-- element with title -->
1506
- <xsl:template match="*[jis:title]" mode="contents">
1554
+ <xsl:template match="*[jis:title or jis:fmt-title]" mode="contents">
1507
1555
 
1508
1556
  <xsl:variable name="level">
1509
1557
  <xsl:call-template name="getLevel">
1510
- <xsl:with-param name="depth" select="jis:title/@depth"/>
1558
+ <xsl:with-param name="depth" select="jis:fmt-title/@depth | jis:title/@depth"/>
1511
1559
  </xsl:call-template>
1512
1560
  </xsl:variable>
1513
1561
 
@@ -1585,6 +1633,7 @@
1585
1633
  <xsl:template match="*[local-name() = 'preface']/*[local-name() = 'clause']" priority="3">
1586
1634
  <fo:block>
1587
1635
  <xsl:call-template name="setId"/>
1636
+ <xsl:call-template name="addReviewHelper"/>
1588
1637
  <xsl:apply-templates/>
1589
1638
  </fo:block>
1590
1639
  </xsl:template>
@@ -1903,7 +1952,7 @@
1903
1952
 
1904
1953
  <xsl:template match="jis:termnote" priority="2">
1905
1954
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
1906
- <fo:list-block provisional-distance-between-starts="{14 + $text_indent}mm">
1955
+ <fo:list-block provisional-distance-between-starts="{18 + $text_indent}mm">
1907
1956
  <fo:list-item>
1908
1957
  <fo:list-item-label start-indent="{$text_indent}mm" end-indent="label-end()">
1909
1958
  <fo:block xsl:use-attribute-sets="note-name-style">
@@ -1947,6 +1996,12 @@
1947
1996
  <fo:inline font-weight="normal">)</fo:inline>
1948
1997
  <xsl:value-of select="substring-after($list_item_label,')')"/>
1949
1998
  </xsl:when>
1999
+ <xsl:when test="$vertical_layout = 'true' and ../@type = 'alphabet'">
2000
+ <xsl:call-template name="insertVerticalChar">
2001
+ <xsl:with-param name="str" select="substring-before($list_item_label,')')"/>
2002
+ </xsl:call-template>
2003
+ <fo:inline font-weight="normal">)</fo:inline>
2004
+ </xsl:when>
1950
2005
  <xsl:when test="contains($list_item_label, ')')">
1951
2006
  <xsl:value-of select="substring-before($list_item_label,')')"/>
1952
2007
  <fo:inline font-weight="normal">)</fo:inline>
@@ -2033,6 +2088,190 @@
2033
2088
  </fo:block-container>
2034
2089
  </xsl:template>
2035
2090
 
2091
+ <!-- =========================================================================== -->
2092
+ <!-- STEP 0: Replace characters with vertical form -->
2093
+ <!-- =========================================================================== -->
2094
+ <xsl:template match="@*|node()" mode="update_xml_step0">
2095
+ <xsl:copy>
2096
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step0"/>
2097
+ </xsl:copy>
2098
+ </xsl:template>
2099
+
2100
+ <xsl:template match="*[local-name() = 'metanorma-extension']" mode="update_xml_step0">
2101
+ <xsl:copy-of select="."/>
2102
+ </xsl:template>
2103
+
2104
+ <xsl:template match="text()" mode="SKIP_update_xml_step0">
2105
+ <!-- from https://github.com/metanorma/docs/blob/main/109.adoc -->
2106
+ <!--
2107
+ U+0028 LEFT PARENTHESIS (()
2108
+ U+FF08 FULLWIDTH LEFT PARENTHESIS (()
2109
+ to
2110
+ U+FE35 PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS (︵)
2111
+
2112
+ U+0029 RIGHT PARENTHESIS ())
2113
+ U+FF09 FULLWIDTH RIGHT PARENTHESIS ())
2114
+ to
2115
+ U+FE36 PRESENTATION FORM FOR VERTICAL RIGHT PARENTHESIS (︶)
2116
+ -->
2117
+ <xsl:variable name="text1" select="translate(.,'(())','︵︵︶︶')"/>
2118
+ <!--
2119
+ U+007B LEFT CURLY BRACKET ({)
2120
+ U+FF5B FULLWIDTH LEFT CURLY BRACKET ({)
2121
+ to
2122
+ U+FE37 PRESENTATION FORM FOR VERTICAL LEFT CURLY BRACKET (︷)
2123
+
2124
+ U+007D RIGHT CURLY BRACKET (})
2125
+ U+FF5D FULLWIDTH RIGHT CURLY BRACKET (})
2126
+ to
2127
+ U+FE38 PRESENTATION FORM FOR VERTICAL RIGHT CURLY BRACKET (︸)
2128
+ -->
2129
+ <xsl:variable name="text2" select="translate($text1,'{{}}','︷︷︸︸')"/>
2130
+
2131
+ <!--
2132
+ U+3014 LEFT TORTOISE SHELL BRACKET (〔)
2133
+ to
2134
+ U+FE39 PRESENTATION FORM FOR VERTICAL LEFT TORTOISE SHELL BRACKET (︹)
2135
+
2136
+ U+3015 RIGHT TORTOISE SHELL BRACKET (〕)
2137
+ to
2138
+ U+FE3A PRESENTATION FORM FOR VERTICAL RIGHT TORTOISE SHELL BRACKET (︺)
2139
+ -->
2140
+ <xsl:variable name="text3" select="translate($text2,'〔〕','︹︺')"/>
2141
+
2142
+ <!--
2143
+ U+3010 LEFT BLACK LENTICULAR BRACKET (【)
2144
+ to
2145
+ U+FE3B PRESENTATION FORM FOR VERTICAL LEFT BLACK LENTICULAR BRACKET (︻)
2146
+
2147
+ U+3011 RIGHT BLACK LENTICULAR BRACKET (】)
2148
+ to
2149
+ U+FE3C PRESENTATION FORM FOR VERTICAL RIGHT BLACK LENTICULAR BRACKET (︼)
2150
+ -->
2151
+ <xsl:variable name="text4" select="translate($text3,'【】','︻︼')"/>
2152
+
2153
+ <!--
2154
+ U+300A LEFT DOUBLE ANGLE BRACKET (《)
2155
+ to
2156
+ U+FE3D PRESENTATION FORM FOR VERTICAL LEFT DOUBLE ANGLE BRACKET (︽)
2157
+
2158
+ U+300B RIGHT DOUBLE ANGLE BRACKET (》)
2159
+ to
2160
+ U+FE3E PRESENTATION FORM FOR VERTICAL RIGHT DOUBLE ANGLE BRACKET (︾)
2161
+ -->
2162
+ <xsl:variable name="text5" select="translate($text4,'《》','︽︾')"/>
2163
+
2164
+ <!--
2165
+ U+FF62 HALFWIDTH LEFT CORNER BRACKET (「)
2166
+ U+300C LEFT CORNER BRACKET (「)
2167
+ to
2168
+ U+FE41 PRESENTATION FORM FOR VERTICAL LEFT CORNER BRACKET (﹁)
2169
+
2170
+ U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」)
2171
+ U+300D RIGHT CORNER BRACKET (」)
2172
+ to
2173
+ U+FE42 PRESENTATION FORM FOR VERTICAL RIGHT CORNER BRACKET (﹂)
2174
+ -->
2175
+ <xsl:variable name="text6" select="translate($text5,'「「」」','﹁﹁﹂﹂')"/>
2176
+
2177
+ <!--
2178
+ U+300E LEFT WHITE CORNER BRACKET (『)
2179
+ to
2180
+ U+FE43 PRESENTATION FORM FOR VERTICAL LEFT WHITE CORNER BRACKET (﹃)
2181
+
2182
+ U+300F RIGHT WHITE CORNER BRACKET (』)
2183
+ to
2184
+ U+FE44 PRESENTATION FORM FOR VERTICAL RIGHT WHITE CORNER BRACKET (﹄)
2185
+ -->
2186
+ <xsl:variable name="text7" select="translate($text6,'『』','﹃﹄')"/>
2187
+
2188
+ <!--
2189
+ U+005B LEFT SQUARE BRACKET ([)
2190
+ U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([)
2191
+ to
2192
+ U+FE47 PRESENTATION FORM FOR VERTICAL LEFT SQUARE BRACKET (﹇)
2193
+
2194
+ U+005D RIGHT SQUARE BRACKET (])
2195
+ U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (])
2196
+ to
2197
+ U+FE48 PRESENTATION FORM FOR VERTICAL RIGHT SQUARE BRACKET (﹈)
2198
+ -->
2199
+ <xsl:variable name="text8" select="translate($text7,'[[]]','﹇﹇﹈﹈')"/>
2200
+
2201
+ <!--
2202
+ U+3008 LEFT ANGLE BRACKET (〈)
2203
+ to
2204
+ U+FE3F PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET (︿)
2205
+
2206
+ U+3009 RIGHT ANGLE BRACKET (〉)
2207
+ to
2208
+ U+FE40 PRESENTATION FORM FOR VERTICAL RIGHT ANGLE BRACKET (﹀)
2209
+ -->
2210
+ <xsl:variable name="text9" select="translate($text8,'〈〉','︿﹀')"/>
2211
+
2212
+ <!--
2213
+ U+3016 LEFT WHITE LENTICULAR BRACKET (〖)
2214
+ to
2215
+ U+FE17 PRESENTATION FORM FOR VERTICAL LEFT WHITE LENTICULAR BRACKET (︗)
2216
+
2217
+ U+3017 RIGHT WHITE LENTICULAR BRACKET (〗)
2218
+ to
2219
+ U+FE18 PRESENTATION FORM FOR VERTICAL RIGHT WHITE LENTICULAR BRACKET (︘)
2220
+ -->
2221
+ <xsl:variable name="text10" select="translate($text9,'〖〗','︗︘')"/>
2222
+
2223
+ <xsl:value-of select="$text10"/>
2224
+ </xsl:template>
2225
+
2226
+ <xsl:template match="text()" mode="update_xml_step0">
2227
+ <!-- from https://github.com/metanorma/docs/blob/main/109.adoc -->
2228
+ <!--
2229
+ U+3001 IDEOGRAPHIC COMMA (、)
2230
+ to
2231
+ U+FE11 PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (︑)
2232
+
2233
+ U+FE50 SMALL COMMA (﹐)
2234
+ to
2235
+ U+FE10 PRESENTATION FORM FOR VERTICAL COMMA (︐)
2236
+
2237
+ U+FE51 SMALL IDEOGRAPHIC COMMA (﹑)
2238
+ to
2239
+ U+FE11 PRESENTATION FORM FOR VERTICAL IDEOGRAPHIC COMMA (︑)
2240
+
2241
+ U+FF0C FULLWIDTH COMMA (,)
2242
+ to
2243
+ U+FE10 PRESENTATION FORM FOR VERTICAL COMMA (︐)
2244
+ -->
2245
+ <xsl:variable name="text1" select="translate(.,'、﹐﹑,','︑︐︑︐')"/>
2246
+
2247
+ <!--
2248
+ U+FF1A FULLWIDTH COLON (:)
2249
+ to
2250
+ U+FE13 PRESENTATION FORM FOR VERTICAL COLON (︓)
2251
+
2252
+ U+FF1B FULLWIDTH SEMICOLON (;)
2253
+ to
2254
+ U+FE14 PRESENTATION FORM FOR VERTICAL SEMICOLON (︔)
2255
+ -->
2256
+ <xsl:variable name="text2" select="translate($text1,':;','︓︔')"/>
2257
+
2258
+ <!--
2259
+ U+FF01 FULLWIDTH EXCLAMATION MARK (!)
2260
+ to
2261
+ U+FE15 PRESENTATION FORM FOR VERTICAL EXCLAMATION MARK (︕)
2262
+
2263
+ U+FF1F FULLWIDTH QUESTION MARK (?)
2264
+ to
2265
+ U+FE16 PRESENTATION FORM FOR VERTICAL QUESTION MARK (︖)
2266
+ -->
2267
+ <xsl:variable name="text3" select="translate($text2,'!?','︕︖')"/>
2268
+ <xsl:value-of select="$text3"/>
2269
+ </xsl:template>
2270
+
2271
+ <!-- =========================================================================== -->
2272
+ <!-- END STEP 0: Replace characters with vertical form -->
2273
+ <!-- =========================================================================== -->
2274
+
2036
2275
  <xsl:template match="*[local-name() = 'span'][@class = 'surname' or @class = 'givenname' or @class = 'JIS' or @class = 'EffectiveYear' or @class = 'CommentaryEffectiveYear']" mode="update_xml_step1" priority="2">
2037
2276
  <xsl:copy>
2038
2277
  <xsl:apply-templates select="@* | node()" mode="update_xml_step1"/>
@@ -2119,7 +2358,9 @@
2119
2358
  <xsl:variable name="regex_en_">
2120
2359
  <xsl:choose>
2121
2360
  <!-- ( ) [ ] _ { } U+FF08 FULLWIDTH LEFT PARENTHESIS U+FF09 FULLWIDTH RIGHT PARENTHESIS-->
2122
- <xsl:when test="$vertical_layout = 'true'">((<xsl:value-of select="$regex_ja_spec"/>)|([^\u0028\u0029\u005B\u005D\u005F\u007B\u007D<xsl:value-of select="$regex_en_base"/>]){1,})</xsl:when>
2361
+ <!-- <xsl:when test="$vertical_layout = 'true'">((<xsl:value-of select="$regex_ja_spec"/>)|([^\u0028\u0029\u005B\u005D\u005F\u007B\u007D<xsl:value-of select="$regex_en_base"/>]){1,})</xsl:when> -->
2362
+ <!-- regex for find characters to rotation -->
2363
+ <xsl:when test="$vertical_layout = 'true'">((<xsl:value-of select="$regex_ja_spec"/>)|([^\u005F<xsl:value-of select="$regex_en_base"/>]){1,})</xsl:when> <!-- \u0028\u0029\u005B\u005D \u007B\u007D -->
2123
2364
  <xsl:otherwise>([^<xsl:value-of select="$regex_en_base"/>]{1,})</xsl:otherwise>
2124
2365
  </xsl:choose>
2125
2366
  </xsl:variable>
@@ -2131,9 +2372,52 @@
2131
2372
  <xsl:variable name="element_name_font_en_bold">font_en_bold</xsl:variable>
2132
2373
  <xsl:variable name="tag_font_en_bold_open">###<xsl:value-of select="$element_name_font_en_bold"/>###</xsl:variable>
2133
2374
  <xsl:variable name="tag_font_en_bold_close">###/<xsl:value-of select="$element_name_font_en_bold"/>###</xsl:variable>
2375
+ <xsl:variable name="element_name_font_en_vertical">font_en_vertical</xsl:variable>
2376
+ <xsl:variable name="tag_font_en_vertical_open">###<xsl:value-of select="$element_name_font_en_vertical"/>###</xsl:variable>
2377
+ <xsl:variable name="tag_font_en_vertical_close">###/<xsl:value-of select="$element_name_font_en_vertical"/>###</xsl:variable>
2378
+
2379
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata']) and not(ancestor::jis:p[@class = 'zzSTDTitle2'])]" mode="update_xml_step1">
2380
+ <xsl:choose>
2381
+ <xsl:when test="$vertical_layout = 'true'">
2382
+ <xsl:call-template name="enclose_text_in_vertical_tag"/>
2383
+ </xsl:when>
2384
+ <xsl:otherwise>
2385
+ <xsl:value-of select="."/>
2386
+ </xsl:otherwise>
2387
+ </xsl:choose>
2388
+ </xsl:template>
2389
+
2390
+ <xsl:template match="jis:p//text()[not(ancestor::jis:strong) and not(ancestor::jis:p[@class = 'zzSTDTitle2'])] | jis:dt/text() | jis:biblio-tag/text()" mode="update_xml_step1">
2391
+ <xsl:choose>
2392
+ <xsl:when test="$vertical_layout = 'true'">
2393
+ <xsl:call-template name="enclose_text_in_vertical_tag"/>
2394
+ </xsl:when>
2395
+ <xsl:otherwise>
2396
+ <xsl:call-template name="enclose_text_in_font_en_tag"/>
2397
+ </xsl:otherwise>
2398
+ </xsl:choose>
2399
+ </xsl:template>
2134
2400
 
2135
- <xsl:template match="jis:p//text()[not(ancestor::jis:strong) and not(ancestor::jis:p[@class = 'zzSTDTitle2'])] | jis:dt/text()" mode="update_xml_step1">
2136
- <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_font_en_open,'$1',$tag_font_en_close))"/>
2401
+ <xsl:template name="enclose_text_in_vertical_tag">
2402
+ <xsl:param name="text" select="."/>
2403
+ <xsl:param name="regex" select="$regex_en"/>
2404
+ <xsl:variable name="text_vertical_" select="java:replaceAll(java:java.lang.String.new($text), $regex, concat($tag_font_en_vertical_open,'$1',$tag_font_en_vertical_close))"/>
2405
+ <xsl:variable name="text_vertical">
2406
+ <xsl:element name="text" namespace="{$namespace_full}">
2407
+ <xsl:call-template name="replace_text_tags">
2408
+ <xsl:with-param name="tag_open" select="$tag_font_en_vertical_open"/>
2409
+ <xsl:with-param name="tag_close" select="$tag_font_en_vertical_close"/>
2410
+ <xsl:with-param name="text" select="$text_vertical_"/>
2411
+ </xsl:call-template>
2412
+ </xsl:element>
2413
+ </xsl:variable>
2414
+ <xsl:copy-of select="xalan:nodeset($text_vertical)/*[local-name() = 'text']/node()"/>
2415
+ </xsl:template>
2416
+
2417
+ <xsl:template name="enclose_text_in_font_en_tag">
2418
+ <xsl:param name="text" select="."/>
2419
+ <xsl:param name="regex" select="$regex_en"/>
2420
+ <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new($text), $regex, concat($tag_font_en_open,'$1',$tag_font_en_close))"/>
2137
2421
  <xsl:variable name="text_en">
2138
2422
  <xsl:element name="text" namespace="{$namespace_full}">
2139
2423
  <xsl:call-template name="replace_text_tags">
@@ -2146,11 +2430,10 @@
2146
2430
  <xsl:copy-of select="xalan:nodeset($text_en)/*[local-name() = 'text']/node()"/>
2147
2431
  </xsl:template>
2148
2432
 
2149
- <!-- jis:term/jis:preferred2//text() | -->
2150
-
2151
- <!-- <name>注記 1</name> to <name>注記<font_en> 1</font_en></name> -->
2152
- <xsl:template match="jis:title/text() | jis:term/jis:name/text() | jis:note/jis:name/text() | jis:termnote/jis:name/text() | jis:table/jis:name/text() | jis:figure/jis:name/text() | jis:termexample/jis:name/text() | jis:xref//text() | jis:origin/text()" mode="update_xml_step1">
2153
- <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
2433
+ <xsl:template name="enclose_text_in_font_en_bold_tag">
2434
+ <xsl:param name="text" select="."/>
2435
+ <xsl:param name="regex" select="$regex_en"/>
2436
+ <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new($text), $regex, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
2154
2437
  <xsl:variable name="text_en">
2155
2438
  <xsl:element name="text" namespace="{$namespace_full}">
2156
2439
  <xsl:call-template name="replace_text_tags">
@@ -2163,20 +2446,35 @@
2163
2446
  <xsl:copy-of select="xalan:nodeset($text_en)/*[local-name() = 'text']/node()"/>
2164
2447
  </xsl:template>
2165
2448
 
2449
+ <!-- jis:term/jis:preferred2//text() | -->
2450
+
2451
+ <!-- <name>注記 1</name> to <name>注記<font_en> 1</font_en></name> -->
2452
+ <xsl:template match="jis:title/text() | jis:term/jis:name/text() | jis:note/jis:name/text() | jis:termnote/jis:name/text() | jis:table/jis:name/text() | jis:figure/jis:name/text() | jis:termexample/jis:name/text() | jis:xref//text() | jis:origin/text()" mode="update_xml_step1">
2453
+ <xsl:choose>
2454
+ <xsl:when test="$vertical_layout = 'true'">
2455
+ <xsl:call-template name="enclose_text_in_vertical_tag"/>
2456
+ </xsl:when>
2457
+ <xsl:otherwise>
2458
+ <xsl:call-template name="enclose_text_in_font_en_bold_tag"/>
2459
+ </xsl:otherwise>
2460
+ </xsl:choose>
2461
+ </xsl:template>
2462
+
2166
2463
  <!-- for $contents -->
2167
2464
  <xsl:template match="title/text()">
2168
2465
  <xsl:variable name="regex_en_contents">([^\u00A0\u2002-\u200B\u3000-\u9FFF\uF900-\uFFFF\(\)]{1,})</xsl:variable>
2169
- <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en_contents, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
2170
- <xsl:variable name="text_en">
2171
- <xsl:element name="text" namespace="{$namespace_full}">
2172
- <xsl:call-template name="replace_text_tags">
2173
- <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
2174
- <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
2175
- <xsl:with-param name="text" select="$text_en_"/>
2466
+ <xsl:choose>
2467
+ <xsl:when test="$vertical_layout = 'true'">
2468
+ <xsl:call-template name="enclose_text_in_vertical_tag">
2469
+ <xsl:with-param name="regex" select="$regex_en_contents"/>
2176
2470
  </xsl:call-template>
2177
- </xsl:element>
2178
- </xsl:variable>
2179
- <xsl:apply-templates select="xalan:nodeset($text_en)/*[local-name() = 'text']/node()"/>
2471
+ </xsl:when>
2472
+ <xsl:otherwise>
2473
+ <xsl:call-template name="enclose_text_in_font_en_bold_tag">
2474
+ <xsl:with-param name="regex" select="$regex_en_contents"/>
2475
+ </xsl:call-template>
2476
+ </xsl:otherwise>
2477
+ </xsl:choose>
2180
2478
  </xsl:template>
2181
2479
 
2182
2480
  <!-- move example title to the first paragraph -->
@@ -2203,133 +2501,177 @@
2203
2501
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2204
2502
  </xsl:choose>
2205
2503
  </xsl:variable>
2206
- <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new($example_name), $regex_en, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
2207
- <xsl:variable name="text_en">
2208
- <xsl:element name="text" namespace="{$namespace_full}">
2209
- <xsl:call-template name="replace_text_tags">
2210
- <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
2211
- <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
2212
- <xsl:with-param name="text" select="$text_en_"/>
2504
+
2505
+ <xsl:choose>
2506
+ <xsl:when test="$vertical_layout = 'true'">
2507
+ <xsl:call-template name="enclose_text_in_vertical_tag">
2508
+ <xsl:with-param name="text" select="$example_name"/>
2213
2509
  </xsl:call-template>
2214
- </xsl:element>
2215
- </xsl:variable>
2216
- <xsl:copy-of select="xalan:nodeset($text_en)/*[local-name() = 'text']/node()"/>
2510
+ </xsl:when>
2511
+ <xsl:otherwise>
2512
+ <xsl:call-template name="enclose_text_in_font_en_bold_tag">
2513
+ <xsl:with-param name="text" select="$example_name"/>
2514
+ </xsl:call-template>
2515
+ </xsl:otherwise>
2516
+ </xsl:choose>
2217
2517
  </xsl:template>
2218
2518
 
2219
2519
  <xsl:template match="jis:eref//text()" mode="update_xml_step1">
2220
- <!-- Example: JIS Z 8301:2011 to <font_en_bold>JIS Z 8301</font_en_bold><font_en>:2011</font_en> -->
2221
- <xsl:variable name="parts">
2222
- <xsl:choose>
2223
- <xsl:when test="contains(., ':')">
2224
- <xsl:element name="{$element_name_font_en_bold}" namespace="{$namespace_full}"><xsl:value-of select="substring-before(., ':')"/></xsl:element>
2225
- <xsl:element name="{$element_name_font_en}" namespace="{$namespace_full}">:<xsl:value-of select="substring-after(., ':')"/></xsl:element>
2226
- </xsl:when>
2227
- <xsl:otherwise>
2228
- <xsl:element name="{$element_name_font_en_bold}" namespace="{$namespace_full}"><xsl:value-of select="."/></xsl:element>
2229
- </xsl:otherwise>
2230
- </xsl:choose>
2231
- </xsl:variable>
2232
- <xsl:for-each select="xalan:nodeset($parts)/*">
2233
- <xsl:variable name="tag_open">###<xsl:value-of select="local-name()"/>###</xsl:variable>
2234
- <xsl:variable name="tag_close">###/<xsl:value-of select="local-name()"/>###</xsl:variable>
2235
- <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_open,'$1',$tag_close))"/>
2236
- <xsl:variable name="text_en">
2237
- <xsl:element name="text" namespace="{$namespace_full}">
2238
- <xsl:call-template name="replace_text_tags">
2239
- <xsl:with-param name="tag_open" select="$tag_open"/>
2240
- <xsl:with-param name="tag_close" select="$tag_close"/>
2241
- <xsl:with-param name="text" select="$text_en_"/>
2242
- </xsl:call-template>
2243
- </xsl:element>
2244
- </xsl:variable>
2245
- <xsl:copy-of select="xalan:nodeset($text_en)/*[local-name() = 'text']/node()"/>
2246
- </xsl:for-each>
2520
+ <xsl:choose>
2521
+ <xsl:when test="$vertical_layout = 'true'">
2522
+ <xsl:call-template name="enclose_text_in_vertical_tag"/>
2523
+ </xsl:when>
2524
+ <xsl:otherwise>
2525
+ <!-- Example: JIS Z 8301:2011 to <font_en_bold>JIS Z 8301</font_en_bold><font_en>:2011</font_en> -->
2526
+ <xsl:variable name="parts">
2527
+ <xsl:choose>
2528
+ <xsl:when test="contains(., ':')">
2529
+ <xsl:element name="{$element_name_font_en_bold}" namespace="{$namespace_full}"><xsl:value-of select="substring-before(., ':')"/></xsl:element>
2530
+ <xsl:element name="{$element_name_font_en}" namespace="{$namespace_full}">:<xsl:value-of select="substring-after(., ':')"/></xsl:element>
2531
+ </xsl:when>
2532
+ <xsl:otherwise>
2533
+ <xsl:element name="{$element_name_font_en_bold}" namespace="{$namespace_full}"><xsl:value-of select="."/></xsl:element>
2534
+ </xsl:otherwise>
2535
+ </xsl:choose>
2536
+ </xsl:variable>
2537
+ <xsl:for-each select="xalan:nodeset($parts)/*">
2538
+ <xsl:variable name="tag_open">###<xsl:value-of select="local-name()"/>###</xsl:variable>
2539
+ <xsl:variable name="tag_close">###/<xsl:value-of select="local-name()"/>###</xsl:variable>
2540
+ <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_open,'$1',$tag_close))"/>
2541
+ <xsl:variable name="text_en">
2542
+ <xsl:element name="text" namespace="{$namespace_full}">
2543
+ <xsl:call-template name="replace_text_tags">
2544
+ <xsl:with-param name="tag_open" select="$tag_open"/>
2545
+ <xsl:with-param name="tag_close" select="$tag_close"/>
2546
+ <xsl:with-param name="text" select="$text_en_"/>
2547
+ </xsl:call-template>
2548
+ </xsl:element>
2549
+ </xsl:variable>
2550
+ <xsl:copy-of select="xalan:nodeset($text_en)/*[local-name() = 'text']/node()"/>
2551
+ </xsl:for-each>
2552
+ </xsl:otherwise>
2553
+ </xsl:choose>
2247
2554
  </xsl:template>
2248
2555
 
2249
2556
  <xsl:template match="jis:strong" priority="2" mode="update_xml_step1">
2250
2557
  <xsl:apply-templates mode="update_xml_step1"/>
2251
2558
  </xsl:template>
2252
2559
  <xsl:template match="jis:strong/text()" priority="2" mode="update_xml_step1">
2253
- <xsl:variable name="text_en_" select="java:replaceAll(java:java.lang.String.new(.), $regex_en, concat($tag_font_en_bold_open,'$1',$tag_font_en_bold_close))"/>
2254
- <xsl:variable name="text_en">
2255
- <xsl:element name="text" namespace="{$namespace_full}">
2256
- <xsl:call-template name="replace_text_tags">
2257
- <xsl:with-param name="tag_open" select="$tag_font_en_bold_open"/>
2258
- <xsl:with-param name="tag_close" select="$tag_font_en_bold_close"/>
2259
- <xsl:with-param name="text" select="$text_en_"/>
2260
- </xsl:call-template>
2261
- </xsl:element>
2262
- </xsl:variable>
2263
- <xsl:copy-of select="xalan:nodeset($text_en)/*[local-name() = 'text']/node()"/>
2560
+
2561
+ <xsl:choose>
2562
+ <xsl:when test="$vertical_layout = 'true'">
2563
+ <xsl:call-template name="enclose_text_in_vertical_tag"/>
2564
+ </xsl:when>
2565
+ <xsl:otherwise>
2566
+ <xsl:call-template name="enclose_text_in_font_en_bold_tag"/>
2567
+ </xsl:otherwise>
2568
+ </xsl:choose>
2569
+ </xsl:template>
2570
+
2571
+ <!-- add @provisional-distance-between-starts for 'ol' -->
2572
+ <xsl:template match="jis:ol" priority="2" mode="update_xml_step1">
2573
+ <xsl:copy>
2574
+ <xsl:copy-of select="@*"/>
2575
+ <xsl:if test="$vertical_layout = 'true'">
2576
+ <xsl:variable name="labels">
2577
+ <xsl:for-each select="*[local-name() = 'li']"><label_len><xsl:value-of select="string-length(@label)"/></label_len></xsl:for-each>
2578
+ </xsl:variable>
2579
+ <xsl:variable name="max_len_label_">
2580
+ <xsl:for-each select="xalan:nodeset($labels)//*">
2581
+ <xsl:sort select="." data-type="number" order="descending"/>
2582
+ <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
2583
+ </xsl:for-each>
2584
+ </xsl:variable>
2585
+ <xsl:variable name="max_len_label" select="number($max_len_label_)"/>
2586
+
2587
+ <xsl:choose>
2588
+ <xsl:when test="@type = 'arabic'">
2589
+ <xsl:attribute name="provisional-distance-between-starts">
2590
+ <xsl:choose>
2591
+ <xsl:when test="$max_len_label = 1">8.5mm</xsl:when>
2592
+ <xsl:when test="$max_len_label = 2">12mm</xsl:when>
2593
+ <xsl:when test="$max_len_label = 3">20mm</xsl:when>
2594
+ <xsl:otherwise>
2595
+ <xsl:value-of select="3 + number($max_len_label) * 4"/>mm
2596
+ </xsl:otherwise>
2597
+ </xsl:choose>
2598
+ </xsl:attribute>
2599
+ </xsl:when>
2600
+ <xsl:otherwise>
2601
+ <xsl:variable name="ol_styles">
2602
+ <styles xsl:use-attribute-sets="list-style"/>
2603
+ </xsl:variable>
2604
+ <xsl:for-each select="xalan:nodeset($ol_styles)//styles">
2605
+ <xsl:copy-of select="@*"/>
2606
+ </xsl:for-each>
2607
+ </xsl:otherwise>
2608
+ </xsl:choose>
2609
+ </xsl:if>
2610
+ <xsl:apply-templates mode="update_xml_step1"/>
2611
+ </xsl:copy>
2264
2612
  </xsl:template>
2265
2613
 
2614
+ <!-- bold English text in non-vertical layout -->
2266
2615
  <xsl:template match="*[local-name() = 'font_en_bold'][normalize-space() != '']">
2267
2616
  <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
2268
2617
  <fo:inline>
2269
- <xsl:if test="not($vertical_layout = 'true')">
2270
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2271
- <xsl:attribute name="font-weight">bold</xsl:attribute>
2272
- <xsl:if test="ancestor::*[local-name() = 'preferred']">
2273
- <xsl:attribute name="font-weight">normal</xsl:attribute>
2274
- </xsl:if>
2618
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2619
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2620
+ <xsl:if test="ancestor::*[local-name() = 'preferred']">
2621
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2275
2622
  </xsl:if>
2276
- <!-- <xsl:if test="$vertical_layout = 'true'">
2277
- <xsl:attribute name="font-size">18pt</xsl:attribute>
2278
- <xsl:attribute name="font-weight">bold</xsl:attribute>
2279
- </xsl:if> -->
2280
- <xsl:call-template name="insertEnglishText"/>
2623
+ <xsl:apply-templates/>
2281
2624
  </fo:inline>
2282
2625
  <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
2283
2626
  </xsl:template>
2284
2627
 
2285
- <xsl:template name="insertEnglishText">
2286
- <xsl:param name="reference-orientation">90</xsl:param>
2287
- <xsl:choose>
2288
- <xsl:when test="not($vertical_layout = 'true')">
2289
- <xsl:apply-templates/>
2290
- </xsl:when>
2291
- <xsl:otherwise> <!-- $vertical_layout = 'true' -->
2292
- <xsl:for-each select="node()">
2293
- <xsl:choose>
2294
- <xsl:when test="self::text()">
2295
- <!-- convert to vertical layout -->
2296
- <xsl:variable name="text">
2297
- <xsl:choose>
2298
- <xsl:when test="ancestor::*[local-name(../..) = 'note'] and ancestor::*[local-name(..) = 'name']">
2299
- <xsl:value-of select="concat(' ', normalize-space(.))"/>
2300
- </xsl:when>
2301
- <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2302
- </xsl:choose>
2303
- </xsl:variable>
2304
- <xsl:call-template name="insertVerticalChar">
2305
- <xsl:with-param name="str" select="$text"/>
2306
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
2307
- </xsl:call-template>
2308
- </xsl:when>
2309
- <xsl:otherwise>
2310
- <xsl:apply-templates select="."/>
2311
- </xsl:otherwise>
2312
- </xsl:choose>
2313
- </xsl:for-each>
2314
- </xsl:otherwise>
2315
- </xsl:choose>
2628
+ <!-- English text in non-vertical layout -->
2629
+ <xsl:template match="*[local-name() = 'font_en'][normalize-space() != '']">
2630
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
2631
+ <fo:inline>
2632
+ <xsl:if test="not(ancestor::jis:p[@class = 'zzSTDTitle2']) and not(ancestor::jis:span[@class = 'JIS'])">
2633
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2634
+ </xsl:if>
2635
+ <xsl:if test="ancestor::*[local-name() = 'preferred']">
2636
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2637
+ </xsl:if>
2638
+ <xsl:apply-templates/>
2639
+ </fo:inline>
2640
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
2316
2641
  </xsl:template>
2317
2642
 
2318
- <xsl:template match="*[local-name() = 'font_en'][normalize-space() != '']">
2643
+ <!-- English text in vertical layout -->
2644
+ <xsl:template match="*[local-name() = 'font_en_vertical'][normalize-space() != '']">
2319
2645
  <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
2320
2646
  <fo:inline>
2321
2647
  <xsl:if test="not(ancestor::jis:p[@class = 'zzSTDTitle2']) and not(ancestor::jis:span[@class = 'JIS'])">
2322
- <xsl:if test="not($vertical_layout = 'true')">
2323
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2324
- </xsl:if>
2325
2648
  </xsl:if>
2326
2649
  <xsl:if test="ancestor::*[local-name() = 'preferred']">
2327
2650
  <xsl:attribute name="font-weight">normal</xsl:attribute>
2328
2651
  </xsl:if>
2329
- <!-- <xsl:if test="$vertical_layout = 'true'">
2330
- <xsl:attribute name="font-size">16pt</xsl:attribute>
2331
- </xsl:if> -->
2332
- <xsl:call-template name="insertEnglishText"/>
2652
+ <xsl:for-each select="node()">
2653
+ <xsl:choose>
2654
+ <xsl:when test="self::text()">
2655
+ <!-- convert to vertical layout -->
2656
+ <xsl:variable name="text">
2657
+ <xsl:choose>
2658
+ <xsl:when test="(ancestor::*[local-name(../..) = 'note'] or ancestor::*[local-name(../..) = 'example'] ) and ancestor::*[local-name(..) = 'name']">
2659
+ <xsl:value-of select="concat(' ', normalize-space(.))"/>
2660
+ </xsl:when>
2661
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2662
+ </xsl:choose>
2663
+ </xsl:variable>
2664
+ <xsl:call-template name="insertVerticalChar">
2665
+ <xsl:with-param name="str" select="$text"/>
2666
+ <xsl:with-param name="reference-orientation">90</xsl:with-param>
2667
+ <xsl:with-param name="add_zero_width_space">true</xsl:with-param>
2668
+ </xsl:call-template>
2669
+ </xsl:when>
2670
+ <xsl:otherwise>
2671
+ <xsl:apply-templates select="."/>
2672
+ </xsl:otherwise>
2673
+ </xsl:choose>
2674
+ </xsl:for-each>
2333
2675
  </fo:inline>
2334
2676
  <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']"><xsl:value-of select="$zero_width_space"/></xsl:if>
2335
2677
  </xsl:template>
@@ -2339,7 +2681,7 @@
2339
2681
  <!-- ========================= -->
2340
2682
 
2341
2683
  <!-- patch for correct list-item-label rendering: enclose each char in inline-container -->
2342
- <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/text()" priority="3">
2684
+ <xsl:template match="*[local-name() = 'note' or local-name() = 'example']/*[local-name() = 'name']/text()" priority="3">
2343
2685
  <xsl:choose>
2344
2686
  <xsl:when test="not($vertical_layout = 'true')">
2345
2687
  <xsl:value-of select="."/>
@@ -2354,6 +2696,54 @@
2354
2696
  </xsl:choose>
2355
2697
  </xsl:template>
2356
2698
 
2699
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" priority="3">
2700
+ <xsl:param name="process">false</xsl:param>
2701
+
2702
+ <xsl:if test="normalize-space() != '' and (not($vertical_layout = 'true') or $process = 'true')">
2703
+ <fo:block xsl:use-attribute-sets="figure-name-style">
2704
+
2705
+ <xsl:call-template name="refine_figure-name-style"/>
2706
+
2707
+ <xsl:apply-templates/>
2708
+ </fo:block>
2709
+ </xsl:if>
2710
+ </xsl:template>
2711
+
2712
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@class = 'dl']" priority="3">
2713
+ <xsl:param name="process">false</xsl:param>
2714
+ <xsl:if test="normalize-space() != '' and (not($vertical_layout = 'true') or $process = 'true')">
2715
+ <fo:block>
2716
+ <xsl:apply-templates/>
2717
+ </fo:block>
2718
+ </xsl:if>
2719
+ </xsl:template>
2720
+
2721
+ <xsl:template match="*[local-name() = 'span'][@class = 'norotate']//text()" name="norotate" priority="3">
2722
+ <xsl:param name="str" select="."/>
2723
+ <xsl:choose>
2724
+ <xsl:when test="$vertical_layout = 'true'">
2725
+ <xsl:if test="string-length($str) &gt; 0">
2726
+ <xsl:variable name="char" select="substring($str,1,1)"/>
2727
+ <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" reference-orientation="0">
2728
+ <fo:block-container width="1em">
2729
+ <fo:block line-height="1em">
2730
+ <xsl:value-of select="$char"/>
2731
+ </fo:block>
2732
+ </fo:block-container>
2733
+ </fo:inline-container>
2734
+ <xsl:call-template name="norotate">
2735
+ <xsl:with-param name="str" select="substring($str, 2)"/>
2736
+ </xsl:call-template>
2737
+ </xsl:if>
2738
+ </xsl:when>
2739
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2740
+ </xsl:choose>
2741
+ </xsl:template>
2742
+
2743
+ <xsl:template match="*[local-name() = 'span'][@class = 'halffontsize']" priority="3">
2744
+ <fo:inline font-size="50%" baseline-shift="15%"><xsl:apply-templates/></fo:inline>
2745
+ </xsl:template>
2746
+
2357
2747
  <xsl:template name="insertHeaderFooter">
2358
2748
  <xsl:param name="docidentifier"/>
2359
2749
  <xsl:param name="hidePageNumber">false</xsl:param>
@@ -2555,7 +2945,10 @@
2555
2945
  </fo:block-container>
2556
2946
  </fo:block-container>
2557
2947
 
2558
- <fo:block-container font-size="9pt" color="white" height="5.5mm" writing-mode="tb-rl" margin-left="56mm" line-height="1.1">
2948
+ <fo:block-container font-size="9pt" color="white" height="5.5mm" margin-left="56mm" line-height="1.1">
2949
+ <xsl:if test="$isGenerateTableIF = 'false'">
2950
+ <xsl:attribute name="writing-mode">tb-rl</xsl:attribute>
2951
+ </xsl:if>
2559
2952
 
2560
2953
  <fo:block text-align-last="justify" margin-top="56mm" margin-bottom="3mm">
2561
2954
 
@@ -2685,7 +3078,7 @@
2685
3078
  </svg>
2686
3079
  </xsl:variable>
2687
3080
 
2688
- <xsl:strip-space elements="jis:xref"/>
3081
+ <!-- <xsl:strip-space elements="jis:xref"/> -->
2689
3082
 
2690
3083
  <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
2691
3084
  <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
@@ -3287,6 +3680,10 @@
3287
3680
  <xsl:if test="not($vertical_layout = 'true')">
3288
3681
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
3289
3682
  </xsl:if>
3683
+ <xsl:if test="$vertical_layout = 'true'">
3684
+ <xsl:attribute name="font-family">Noto Sans JP</xsl:attribute>
3685
+ <xsl:attribute name="font-weight">500</xsl:attribute>
3686
+ </xsl:if>
3290
3687
 
3291
3688
  </xsl:template>
3292
3689
 
@@ -3695,6 +4092,10 @@
3695
4092
 
3696
4093
  <xsl:template name="refine_termnote-name-style">
3697
4094
 
4095
+ <!-- <xsl:if test="$namespace = 'ieee'">
4096
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
4097
+ </xsl:if> -->
4098
+
3698
4099
  <xsl:if test="not($vertical_layout = 'true')">
3699
4100
  <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
3700
4101
  </xsl:if>
@@ -3769,6 +4170,67 @@
3769
4170
  <xsl:if test="ancestor::*[local-name() = 'example'] or ancestor::*[local-name() = 'note']">
3770
4171
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3771
4172
  </xsl:if>
4173
+ <xsl:if test="$vertical_layout = 'true' and not(*[local-name() = 'figure'])">
4174
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
4175
+ <xsl:attribute name="display-align">center</xsl:attribute>
4176
+ <!-- <xsl:attribute name="border">1pt solid blue</xsl:attribute> -->
4177
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
4178
+
4179
+ <!-- determine block-container width for rotated image -->
4180
+ <xsl:for-each select="*[local-name() = 'image'][1]"> <!-- set context to 'image' element -->
4181
+
4182
+ <xsl:variable name="width">
4183
+ <xsl:call-template name="setImageWidth"/>
4184
+ </xsl:variable>
4185
+
4186
+ <xsl:choose>
4187
+ <xsl:when test="normalize-space($width) != ''">
4188
+ <xsl:attribute name="width">
4189
+ <xsl:value-of select="$width"/>
4190
+ </xsl:attribute>
4191
+ </xsl:when>
4192
+ <xsl:when test="*[local-name() = 'svg']">
4193
+ <xsl:variable name="svg_content">
4194
+ <xsl:apply-templates select="*[local-name() = 'svg'][1]" mode="svg_update"/>
4195
+ </xsl:variable>
4196
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
4197
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
4198
+
4199
+ <xsl:variable name="scale_width">
4200
+ <xsl:choose>
4201
+ <xsl:when test="$svg_width &gt; $height_effective_px">
4202
+ <xsl:value-of select="$height_effective_px div $svg_width"/>
4203
+ </xsl:when>
4204
+ <xsl:otherwise>1</xsl:otherwise>
4205
+ </xsl:choose>
4206
+ </xsl:variable>
4207
+ <xsl:attribute name="width"><xsl:value-of select="$svg_width * $scale_width"/>px</xsl:attribute>
4208
+
4209
+ </xsl:when>
4210
+ <xsl:otherwise> <!-- determine image width programmatically -->
4211
+ <xsl:variable name="img_src">
4212
+ <xsl:call-template name="getImageSrc"/>
4213
+ </xsl:variable>
4214
+ <xsl:variable name="image_width_programmatically" select="java:org.metanorma.fop.utils.ImageUtils.getImageWidth($img_src, $height_effective, $width_effective)"/>
4215
+
4216
+ <xsl:variable name="scale">
4217
+ <xsl:call-template name="getImageScale"/>
4218
+ </xsl:variable>
4219
+
4220
+ <xsl:if test="normalize-space($image_width_programmatically) != '0'">
4221
+ <xsl:attribute name="width">
4222
+ <xsl:value-of select="concat($image_width_programmatically, 'mm')"/> <!-- * ($scale div 100) -->
4223
+ </xsl:attribute>
4224
+ <xsl:if test="$scale != 100">
4225
+ <xsl:attribute name="display-align">before</xsl:attribute>
4226
+ </xsl:if>
4227
+ </xsl:if>
4228
+ </xsl:otherwise>
4229
+ </xsl:choose>
4230
+ </xsl:for-each>
4231
+ <!-- end: $vertical_layout = 'true -->
4232
+ </xsl:if>
4233
+ <!-- end: $namespace = 'jis' -->
3772
4234
 
3773
4235
  </xsl:template>
3774
4236
 
@@ -3836,6 +4298,10 @@
3836
4298
 
3837
4299
  <xsl:template name="refine_image-style">
3838
4300
 
4301
+ <xsl:if test="$vertical_layout = 'true'">
4302
+ <xsl:attribute name="text-align">inherit</xsl:attribute>
4303
+ </xsl:if>
4304
+
3839
4305
  </xsl:template>
3840
4306
 
3841
4307
  <xsl:attribute-set name="figure-pseudocode-p-style">
@@ -4383,9 +4849,21 @@
4383
4849
  <xsl:template name="processTables_Contents">
4384
4850
  <tables>
4385
4851
  <xsl:for-each select="//*[local-name() = 'table'][not(ancestor::*[local-name() = 'metanorma-extension'])][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
4386
- <table id="{@id}" alt-text="{*[local-name() = 'name']}">
4387
- <xsl:copy-of select="*[local-name() = 'name']"/>
4388
- </table>
4852
+ <xsl:choose>
4853
+ <xsl:when test="*[local-name() = 'fmt-name']">
4854
+ <xsl:variable name="fmt_name">
4855
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
4856
+ </xsl:variable>
4857
+ <table id="{@id}" alt-text="{normalize-space($fmt_name)}">
4858
+ <xsl:copy-of select="$fmt_name"/>
4859
+ </table>
4860
+ </xsl:when>
4861
+ <xsl:otherwise>
4862
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
4863
+ <xsl:copy-of select="*[local-name() = 'name']"/>
4864
+ </table>
4865
+ </xsl:otherwise>
4866
+ </xsl:choose>
4389
4867
  </xsl:for-each>
4390
4868
  </tables>
4391
4869
  </xsl:template>
@@ -4393,9 +4871,21 @@
4393
4871
  <xsl:template name="processFigures_Contents">
4394
4872
  <figures>
4395
4873
  <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) != '']">
4396
- <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
4397
- <xsl:copy-of select="*[local-name() = 'name']"/>
4398
- </figure>
4874
+ <xsl:choose>
4875
+ <xsl:when test="*[local-name() = 'fmt-name']">
4876
+ <xsl:variable name="fmt_name">
4877
+ <xsl:apply-templates select="*[local-name() = 'fmt-name']" mode="update_xml_step1"/>
4878
+ </xsl:variable>
4879
+ <figure id="{@id}" alt-text="{normalize-space($fmt_name)}">
4880
+ <xsl:copy-of select="$fmt_name"/>
4881
+ </figure>
4882
+ </xsl:when>
4883
+ <xsl:otherwise>
4884
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
4885
+ <xsl:copy-of select="*[local-name() = 'name']"/>
4886
+ </figure>
4887
+ </xsl:otherwise>
4888
+ </xsl:choose>
4399
4889
  </xsl:for-each>
4400
4890
  </figures>
4401
4891
  </xsl:template>
@@ -6232,7 +6722,7 @@
6232
6722
  <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
6233
6723
  </xsl:if>
6234
6724
  <xsl:value-of select="@reference"/>
6235
- <fo:inline font-weight="normal">)</fo:inline>
6725
+ <!-- <fo:inline font-weight="normal">)</fo:inline> --> <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
6236
6726
  </fo:inline>
6237
6727
  </fo:block>
6238
6728
  </fo:list-item-label>
@@ -6247,7 +6737,7 @@
6247
6737
 
6248
6738
  </xsl:if>
6249
6739
  </xsl:for-each>
6250
- </xsl:template>
6740
+ </xsl:template> <!-- table_fn_display -->
6251
6741
 
6252
6742
  <xsl:template name="create_fn">
6253
6743
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -6275,8 +6765,10 @@
6275
6765
  <!-- EMD table's footnotes rendering -->
6276
6766
  <!-- ============================ -->
6277
6767
 
6768
+ <!-- ============================ -->
6278
6769
  <!-- figure's footnotes rendering -->
6279
- <xsl:template name="fn_display_figure">
6770
+ <!-- ============================ -->
6771
+ <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
6280
6772
 
6281
6773
  <!-- current figure id -->
6282
6774
  <xsl:variable name="figure_id_">
@@ -6389,9 +6881,28 @@
6389
6881
 
6390
6882
  </fo:block>
6391
6883
  </xsl:if>
6392
-
6393
6884
  </xsl:template> <!-- fn_display_figure -->
6394
6885
 
6886
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
6887
+ <!-- figure's footnote label -->
6888
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'dl'][@key = 'true']/*[local-name() = 'dt']/ *[local-name() = 'p'][count(node()[normalize-space() != '']) = 1]/*[local-name() = 'sup']" priority="3">
6889
+ <xsl:variable name="key_iso">
6890
+
6891
+ </xsl:variable>
6892
+ <xsl:if test="normalize-space($key_iso) = 'true'">
6893
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
6894
+
6895
+ </xsl:if>
6896
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
6897
+ <!-- <xsl:value-of select="@reference"/> -->
6898
+ <xsl:apply-templates/>
6899
+ </fo:inline>
6900
+ </xsl:template>
6901
+
6902
+ <!-- ============================ -->
6903
+ <!-- END: figure's footnotes rendering -->
6904
+ <!-- ============================ -->
6905
+
6395
6906
  <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
6396
6907
  <xsl:template match="*[local-name()='fn']">
6397
6908
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
@@ -6407,8 +6918,10 @@
6407
6918
 
6408
6919
  <xsl:value-of select="@reference"/>
6409
6920
 
6921
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
6922
+ <!-- <xsl:if test="$namespace = 'jis'">
6410
6923
  <fo:inline font-weight="normal">)</fo:inline>
6411
-
6924
+ </xsl:if> -->
6412
6925
  </fo:basic-link>
6413
6926
  </fo:inline>
6414
6927
  </xsl:template>
@@ -6535,17 +7048,22 @@
6535
7048
  </fo:block>
6536
7049
  </xsl:when> <!-- END: a few components -->
6537
7050
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
6538
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
7051
+ <!-- Presentation XML contains 'Key' caption, https://github.com/metanorma/isodoc/issues/607 -->
7052
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'p' and @keep-with-next])"> <!-- for old Presentation XML -->
6539
7053
 
6540
- <xsl:call-template name="refine_figure_key_style"/>
7054
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
6541
7055
 
6542
- <xsl:variable name="title-key">
6543
- <xsl:call-template name="getLocalizedString">
6544
- <xsl:with-param name="key">key</xsl:with-param>
6545
- </xsl:call-template>
6546
- </xsl:variable>
6547
- <xsl:value-of select="$title-key"/>
6548
- </fo:block>
7056
+ <xsl:call-template name="refine_figure_key_style"/>
7057
+
7058
+ <xsl:variable name="title-key">
7059
+ <xsl:call-template name="getLocalizedString">
7060
+ <xsl:with-param name="key">key</xsl:with-param>
7061
+ </xsl:call-template>
7062
+ </xsl:variable>
7063
+ <xsl:value-of select="$title-key"/>
7064
+ </fo:block>
7065
+
7066
+ </xsl:if>
6549
7067
  </xsl:when> <!-- END: definition list in a figure -->
6550
7068
  </xsl:choose>
6551
7069
 
@@ -6738,6 +7256,14 @@
6738
7256
 
6739
7257
  </xsl:template> <!-- END: dl -->
6740
7258
 
7259
+ <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
7260
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
7261
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
7262
+ <xsl:call-template name="refine_figure_key_style"/>
7263
+ <xsl:apply-templates/>
7264
+ </fo:block>
7265
+ </xsl:template>
7266
+
6741
7267
  <xsl:template name="refine_dl_formula_where_style">
6742
7268
 
6743
7269
  </xsl:template> <!-- refine_dl_formula_where_style -->
@@ -8781,6 +9307,39 @@
8781
9307
  </xsl:copy>
8782
9308
  </xsl:template>
8783
9309
 
9310
+ <xsl:template match="@*|node()" mode="mathml_linebreak">
9311
+ <xsl:copy>
9312
+ <xsl:apply-templates select="@*|node()" mode="mathml_linebreak"/>
9313
+ </xsl:copy>
9314
+ </xsl:template>
9315
+
9316
+ <!-- split math into two math -->
9317
+ <xsl:template match="mathml:mo[@linebreak] | mathml:mspace[@linebreak]" mode="mathml_linebreak">
9318
+ <xsl:variable name="math_elements_tree_">
9319
+ <xsl:for-each select="ancestor::*[ancestor-or-self::mathml:math]">
9320
+ <element pos="{position()}">
9321
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
9322
+ <xsl:value-of select="name()"/>
9323
+ </element>
9324
+ </xsl:for-each>
9325
+ </xsl:variable>
9326
+
9327
+ <xsl:variable name="math_elements_tree" select="xalan:nodeset($math_elements_tree_)"/>
9328
+
9329
+ <xsl:call-template name="insertClosingElements">
9330
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
9331
+ </xsl:call-template>
9332
+
9333
+ <xsl:element name="br" namespace="{$namespace_full}"/>
9334
+
9335
+ <xsl:call-template name="insertOpeningElements">
9336
+ <xsl:with-param name="tree" select="$math_elements_tree"/>
9337
+ <xsl:with-param name="xmlns">http://www.w3.org/1998/Math/MathML</xsl:with-param>
9338
+ <xsl:with-param name="add_continue">false</xsl:with-param>
9339
+ </xsl:call-template>
9340
+
9341
+ </xsl:template>
9342
+
8784
9343
  <!-- Examples:
8785
9344
  <stem type="AsciiMath">x = 1</stem>
8786
9345
  <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
@@ -9036,9 +9595,11 @@
9036
9595
  </xsl:template>
9037
9596
 
9038
9597
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
9598
+ <!-- https://github.com/metanorma/isodoc/issues/607
9039
9599
  <xsl:if test="normalize-space() != ''">
9040
- <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
9041
- </xsl:if>
9600
+ <xsl:text>(</xsl:text><xsl:apply-templates /><xsl:text>)</xsl:text>
9601
+ </xsl:if> -->
9602
+ <xsl:apply-templates/>
9042
9603
  </xsl:template>
9043
9604
 
9044
9605
  <!-- stem inside formula with name (with formula's number) -->
@@ -9158,10 +9719,6 @@
9158
9719
 
9159
9720
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
9160
9721
 
9161
- <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
9162
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
9163
- </xsl:if>
9164
-
9165
9722
  <xsl:call-template name="refine_termnote-name-style"/>
9166
9723
 
9167
9724
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
@@ -9187,6 +9744,17 @@
9187
9744
  </xsl:when>
9188
9745
  <xsl:otherwise>
9189
9746
 
9747
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
9748
+ <!-- <xsl:if test="$namespace = 'ieee'">
9749
+ <xsl:text>—</xsl:text> em dash &#x2014;
9750
+ </xsl:if> -->
9751
+ <!-- <xsl:if test="$namespace = 'iho' or $namespace = 'gb' or $namespace = 'm3d' or $namespace = 'unece-rec' or $namespace = 'unece' or $namespace = 'rsd'">
9752
+ <xsl:text>:</xsl:text>
9753
+ </xsl:if> -->
9754
+
9755
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp'">
9756
+ <xsl:text> – </xsl:text> en dash &#x2013;
9757
+ </xsl:if> -->
9190
9758
  </xsl:otherwise>
9191
9759
  </xsl:choose>
9192
9760
  </xsl:variable>
@@ -9205,6 +9773,16 @@
9205
9773
  </xsl:when>
9206
9774
  <xsl:otherwise>
9207
9775
 
9776
+ <!-- https://github.com/metanorma/isodoc/issues/607 -->
9777
+ <!-- <xsl:if test="$namespace = 'ieee'">
9778
+ <xsl:text>—</xsl:text> em dash &#x2014;
9779
+ </xsl:if> -->
9780
+ <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'iso' or $namespace = 'iec' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' or $namespace = 'rsd' or $namespace = 'jcgm'">
9781
+ <xsl:text>:</xsl:text>
9782
+ </xsl:if> -->
9783
+ <!-- <xsl:if test="$namespace = 'itu' or $namespace = 'nist-cswp' or $namespace = 'nist-sp' or $namespace = 'unece-rec' or $namespace = 'unece'">
9784
+ <xsl:text> – </xsl:text> en dash &#x2013;
9785
+ </xsl:if> -->
9208
9786
  </xsl:otherwise>
9209
9787
  </xsl:choose>
9210
9788
  </xsl:variable>
@@ -9287,17 +9865,46 @@
9287
9865
  <!-- Example: Dimensions in millimeters -->
9288
9866
  <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
9289
9867
 
9868
+ <xsl:variable name="show_figure_key_in_block_container">
9869
+
9870
+ <xsl:choose>
9871
+ <xsl:when test="$vertical_layout = 'true'">false</xsl:when>
9872
+ <xsl:otherwise>true</xsl:otherwise>
9873
+ </xsl:choose>
9874
+
9875
+ </xsl:variable>
9876
+
9290
9877
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
9291
9878
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
9292
9879
  </fo:block>
9293
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9294
- <xsl:call-template name="note"/>
9295
- </xsl:for-each>
9296
- <xsl:call-template name="fn_display_figure"/>
9880
+
9881
+ <xsl:if test="normalize-space($show_figure_key_in_block_container) = 'true'">
9882
+ <xsl:call-template name="showFigureKey"/>
9883
+ </xsl:if>
9297
9884
 
9298
9885
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
9299
9886
 
9300
9887
  </fo:block-container>
9888
+
9889
+ <xsl:if test="$vertical_layout = 'true'">
9890
+ <fo:block keep-with-previous="always">
9891
+ <xsl:apply-templates select="*[local-name() = 'p'][@class = 'dl']">
9892
+ <xsl:with-param name="process">true</xsl:with-param>
9893
+ </xsl:apply-templates>
9894
+ <xsl:call-template name="showFigureKey"/>
9895
+ </fo:block>
9896
+ <xsl:apply-templates select="*[local-name() = 'name']">
9897
+ <xsl:with-param name="process">true</xsl:with-param>
9898
+ </xsl:apply-templates>
9899
+ </xsl:if>
9900
+
9901
+ </xsl:template>
9902
+
9903
+ <xsl:template name="showFigureKey">
9904
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9905
+ <xsl:call-template name="note"/>
9906
+ </xsl:for-each>
9907
+ <xsl:call-template name="fn_display_figure"/>
9301
9908
  </xsl:template>
9302
9909
 
9303
9910
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -9493,6 +10100,22 @@
9493
10100
  </xsl:if>
9494
10101
  </xsl:template>
9495
10102
 
10103
+ <xsl:template name="getImageSrc">
10104
+ <xsl:choose>
10105
+ <xsl:when test="not(starts-with(@src, 'data:'))">
10106
+ <xsl:choose>
10107
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
10108
+ <xsl:value-of select="@src"/>
10109
+ </xsl:when>
10110
+ <xsl:otherwise>
10111
+ <xsl:value-of select="concat($basepath, @src)"/>
10112
+ </xsl:otherwise>
10113
+ </xsl:choose>
10114
+ </xsl:when>
10115
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
10116
+ </xsl:choose>
10117
+ </xsl:template>
10118
+
9496
10119
  <xsl:template name="getImageScale">
9497
10120
  <xsl:param name="indent"/>
9498
10121
  <xsl:variable name="indent_left">
@@ -9502,19 +10125,7 @@
9502
10125
  </xsl:choose>
9503
10126
  </xsl:variable>
9504
10127
  <xsl:variable name="img_src">
9505
- <xsl:choose>
9506
- <xsl:when test="not(starts-with(@src, 'data:'))">
9507
- <xsl:choose>
9508
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9509
- <xsl:value-of select="@src"/>
9510
- </xsl:when>
9511
- <xsl:otherwise>
9512
- <xsl:value-of select="concat($basepath, @src)"/>
9513
- </xsl:otherwise>
9514
- </xsl:choose>
9515
- </xsl:when>
9516
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9517
- </xsl:choose>
10128
+ <xsl:call-template name="getImageSrc"/>
9518
10129
  </xsl:variable>
9519
10130
 
9520
10131
  <xsl:variable name="image_width_effective">
@@ -9522,10 +10133,22 @@
9522
10133
  <xsl:value-of select="$width_effective - number($indent_left)"/>
9523
10134
 
9524
10135
  </xsl:variable>
10136
+ <xsl:variable name="image_height_effective" select="$height_effective - number($indent_left)"/>
9525
10137
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
9526
10138
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
9527
10139
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
9528
- <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
10140
+ <xsl:variable name="scale">
10141
+
10142
+ <xsl:choose>
10143
+ <xsl:when test="$vertical_layout = 'true'">
10144
+ <xsl:value-of select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_height_effective, $width_effective)"/>
10145
+ </xsl:when>
10146
+ <xsl:otherwise>
10147
+ <xsl:value-of select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
10148
+ </xsl:otherwise>
10149
+ </xsl:choose>
10150
+
10151
+ </xsl:variable>
9529
10152
  <xsl:value-of select="$scale"/>
9530
10153
  </xsl:template>
9531
10154
 
@@ -10077,21 +10700,49 @@
10077
10700
  <!-- ignore emf processing (Apache FOP doesn't support EMF) -->
10078
10701
  <xsl:template match="*[local-name() = 'emf']"/>
10079
10702
 
10080
- <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">
10703
+ <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">
10704
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
10705
+ <xsl:apply-templates mode="contents"/>
10706
+ <xsl:text> </xsl:text>
10707
+ </xsl:if>
10708
+ </xsl:template>
10709
+
10710
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="contents"/>
10711
+
10712
+ <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">
10081
10713
  <xsl:apply-templates mode="contents"/>
10082
10714
  <xsl:text> </xsl:text>
10083
10715
  </xsl:template>
10084
10716
 
10085
10717
  <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">
10718
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
10719
+ <xsl:apply-templates mode="bookmarks"/>
10720
+ <xsl:text> </xsl:text>
10721
+ </xsl:if>
10722
+ </xsl:template>
10723
+
10724
+ <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">
10086
10725
  <xsl:apply-templates mode="bookmarks"/>
10087
10726
  <xsl:text> </xsl:text>
10088
10727
  </xsl:template>
10089
10728
 
10090
10729
  <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">
10730
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
10731
+ <xsl:value-of select="."/>
10732
+ </xsl:if>
10733
+ </xsl:template>
10734
+
10735
+ <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">
10091
10736
  <xsl:value-of select="."/>
10092
10737
  </xsl:template>
10093
10738
 
10094
10739
  <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">
10740
+ <xsl:if test="not(../following-sibling::*[1][local-name() = 'fmt-name'])">
10741
+ <xsl:value-of select="."/>
10742
+ </xsl:if>
10743
+ </xsl:template>
10744
+
10745
+ <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">
10095
10746
  <xsl:value-of select="."/>
10096
10747
  </xsl:template>
10097
10748
 
@@ -10112,7 +10763,7 @@
10112
10763
  </xsl:template>
10113
10764
 
10114
10765
  <!-- special case: ignore section-title if @depth different than @depth of parent clause, or @depth of parent clause = 1 -->
10115
- <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"/>
10766
+ <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"/>
10116
10767
 
10117
10768
  <xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
10118
10769
  <xsl:variable name="level">
@@ -10124,6 +10775,9 @@
10124
10775
  <xsl:variable name="section">
10125
10776
  <xsl:choose>
10126
10777
  <xsl:when test="@type = 'section-title'"/>
10778
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
10779
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
10780
+ </xsl:when>
10127
10781
  <xsl:otherwise>
10128
10782
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
10129
10783
  </xsl:otherwise>
@@ -10146,6 +10800,19 @@
10146
10800
 
10147
10801
  <xsl:variable name="title">
10148
10802
  <xsl:choose>
10803
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/770 -->
10804
+ <xsl:when test="*[local-name() = 'span'][@class = 'fmt-caption-delim']">
10805
+ <xsl:choose>
10806
+ <xsl:when test="@type = 'section-title'">
10807
+ <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
10808
+ <xsl:text>: </xsl:text>
10809
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
10810
+ </xsl:when>
10811
+ <xsl:otherwise>
10812
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
10813
+ </xsl:otherwise>
10814
+ </xsl:choose>
10815
+ </xsl:when>
10149
10816
  <xsl:when test="*[local-name() = 'tab']">
10150
10817
  <xsl:choose>
10151
10818
  <xsl:when test="@type = 'section-title'">
@@ -10181,7 +10848,7 @@
10181
10848
  <xsl:apply-templates mode="bookmarks"/>
10182
10849
  </xsl:template>
10183
10850
 
10184
- <xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
10851
+ <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">
10185
10852
  <xsl:apply-templates select="."/>
10186
10853
  </xsl:template>
10187
10854
 
@@ -10194,6 +10861,10 @@
10194
10861
  <xsl:apply-templates mode="contents"/>
10195
10862
  </xsl:template>
10196
10863
 
10864
+ <xsl:template match="*[local-name() = 'semx']" mode="contents">
10865
+ <xsl:apply-templates mode="contents"/>
10866
+ </xsl:template>
10867
+
10197
10868
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
10198
10869
  <xsl:apply-templates mode="bookmarks"/>
10199
10870
  </xsl:template>
@@ -10203,9 +10874,14 @@
10203
10874
  <xsl:apply-templates mode="bookmarks"/>
10204
10875
  </xsl:template>
10205
10876
 
10877
+ <xsl:template match="*[local-name() = 'semx']" mode="bookmarks">
10878
+ <xsl:apply-templates mode="bookmarks"/>
10879
+ </xsl:template>
10880
+
10206
10881
  <!-- Bookmarks -->
10207
10882
  <xsl:template name="addBookmarks">
10208
10883
  <xsl:param name="contents"/>
10884
+ <xsl:param name="contents_addon"/>
10209
10885
  <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
10210
10886
  <xsl:if test="$contents_nodes//item">
10211
10887
  <fo:bookmark-tree>
@@ -10303,6 +10979,9 @@
10303
10979
  </xsl:otherwise>
10304
10980
  </xsl:choose>
10305
10981
 
10982
+ <!-- for $namespace = 'nist-sp' $namespace = 'ogc' $namespace = 'ogc-white-paper' -->
10983
+ <xsl:copy-of select="$contents_addon"/>
10984
+
10306
10985
  </fo:bookmark-tree>
10307
10986
  </xsl:if>
10308
10987
  </xsl:template>
@@ -10456,6 +11135,16 @@
10456
11135
  <!-- ====== -->
10457
11136
  <!-- ====== -->
10458
11137
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
11138
+ <xsl:param name="mode">bookmarks</xsl:param>
11139
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-title'])">
11140
+ <xsl:apply-templates mode="contents_item">
11141
+ <xsl:with-param name="mode" select="$mode"/>
11142
+ </xsl:apply-templates>
11143
+ <!-- <xsl:text> </xsl:text> -->
11144
+ </xsl:if>
11145
+ </xsl:template>
11146
+
11147
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="contents_item">
10459
11148
  <xsl:param name="mode">bookmarks</xsl:param>
10460
11149
  <xsl:apply-templates mode="contents_item">
10461
11150
  <xsl:with-param name="mode" select="$mode"/>
@@ -10463,12 +11152,38 @@
10463
11152
  <!-- <xsl:text> </xsl:text> -->
10464
11153
  </xsl:template>
10465
11154
 
11155
+ <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">
11156
+ <xsl:apply-templates mode="contents_item"/>
11157
+ </xsl:template>
11158
+
11159
+ <xsl:template match="*[local-name() = 'semx']" mode="contents_item">
11160
+ <xsl:apply-templates mode="contents_item"/>
11161
+ </xsl:template>
11162
+
11163
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="contents_item"/>
11164
+
10466
11165
  <xsl:template name="getSection">
10467
- <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
11166
+ <xsl:choose>
11167
+ <xsl:when test="*[local-name() = 'fmt-title']">
11168
+ <xsl:variable name="fmt_title_section">
11169
+ <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')]"/>
11170
+ </xsl:variable>
11171
+ <xsl:value-of select="normalize-space($fmt_title_section)"/>
11172
+ </xsl:when>
11173
+ <xsl:otherwise>
11174
+ <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
11175
+ </xsl:otherwise>
11176
+ </xsl:choose>
10468
11177
  </xsl:template>
10469
11178
 
10470
11179
  <xsl:template name="getName">
10471
11180
  <xsl:choose>
11181
+ <xsl:when test="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']]">
11182
+ <xsl:copy-of select="*[local-name() = 'fmt-title']//*[local-name() = 'span'][@class = 'fmt-caption-delim'][*[local-name() = 'tab']][1]/following-sibling::node()"/>
11183
+ </xsl:when>
11184
+ <xsl:when test="*[local-name() = 'fmt-title']">
11185
+ <xsl:copy-of select="*[local-name() = 'fmt-title']/node()"/>
11186
+ </xsl:when>
10472
11187
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
10473
11188
  <xsl:copy-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/following-sibling::node()"/>
10474
11189
  </xsl:when>
@@ -10575,6 +11290,15 @@
10575
11290
  </xsl:template>
10576
11291
 
10577
11292
  <xsl:template match="*[local-name() = 'name']" mode="contents_item">
11293
+ <xsl:param name="mode">bookmarks</xsl:param>
11294
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-name'])">
11295
+ <xsl:apply-templates mode="contents_item">
11296
+ <xsl:with-param name="mode" select="$mode"/>
11297
+ </xsl:apply-templates>
11298
+ </xsl:if>
11299
+ </xsl:template>
11300
+
11301
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="contents_item">
10578
11302
  <xsl:param name="mode">bookmarks</xsl:param>
10579
11303
  <xsl:apply-templates mode="contents_item">
10580
11304
  <xsl:with-param name="mode" select="$mode"/>
@@ -11370,7 +12094,7 @@
11370
12094
  <xsl:if test="normalize-space() != ''">
11371
12095
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
11372
12096
  <xsl:call-template name="refine_termexample-name-style"/>
11373
- <xsl:apply-templates/>
12097
+ <xsl:apply-templates/> <!-- commented $namespace = 'ieee', https://github.com/metanorma/isodoc/issues/614-->
11374
12098
  </fo:inline>
11375
12099
  </xsl:if>
11376
12100
  </xsl:template>
@@ -11411,107 +12135,55 @@
11411
12135
  -->
11412
12136
  <xsl:template match="*[local-name() = 'example']">
11413
12137
 
11414
- <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11415
-
11416
- <xsl:call-template name="setBlockSpanAll"/>
11417
-
11418
- <xsl:call-template name="refine_example-style"/>
11419
-
11420
- <xsl:variable name="fo_element">
11421
- <xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
11422
- list
11423
- </xsl:variable>
11424
-
11425
- <fo:block-container margin-left="0mm" role="SKIP">
11426
-
11427
- <xsl:choose>
12138
+ <fo:block id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
12139
+ <xsl:call-template name="setBlockSpanAll"/>
11428
12140
 
11429
- <xsl:when test="contains(normalize-space($fo_element), 'block')">
12141
+ <xsl:call-template name="refine_example-style"/>
11430
12142
 
11431
- <!-- display name 'EXAMPLE' in a separate block -->
11432
- <fo:block>
11433
- <xsl:apply-templates select="*[local-name()='name']">
11434
- <xsl:with-param name="fo_element" select="$fo_element"/>
11435
- </xsl:apply-templates>
11436
- </fo:block>
12143
+ <xsl:variable name="ol_adjust">
12144
+ <xsl:choose>
12145
+ <xsl:when test="$vertical_layout = 'true' and ancestor::*[local-name() = 'ol']/@provisional-distance-between-starts">
12146
+ <xsl:value-of select="number(translate(ancestor::*[local-name() = 'ol']/@provisional-distance-between-starts, 'mm', ''))"/>
12147
+ </xsl:when>
12148
+ <xsl:otherwise>0</xsl:otherwise>
12149
+ </xsl:choose>
12150
+ </xsl:variable>
12151
+ <xsl:variable name="provisional_distance_between_starts_">
12152
+ <xsl:value-of select="10 + $text_indent - $ol_adjust"/>
12153
+ </xsl:variable>
12154
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
12155
+ <xsl:variable name="indent_">
12156
+ <xsl:value-of select="$text_indent"/>
12157
+ </xsl:variable>
12158
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
11437
12159
 
11438
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11439
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11440
- <xsl:variable name="example_body">
12160
+ <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
12161
+ <xsl:if test="$vertical_layout = 'true'">
12162
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts + 2"/>mm</xsl:attribute>
12163
+ </xsl:if>
12164
+ <fo:list-item>
12165
+ <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
12166
+ <xsl:if test="$vertical_layout = 'true'">
12167
+ <xsl:attribute name="start-indent">0mm</xsl:attribute>
12168
+ </xsl:if>
12169
+ <fo:block>
12170
+ <xsl:apply-templates select="*[local-name()='name']">
12171
+ <xsl:with-param name="fo_element">block</xsl:with-param>
12172
+ </xsl:apply-templates>
12173
+ </fo:block>
12174
+ </fo:list-item-label>
12175
+ <fo:list-item-body start-indent="body-start()">
12176
+ <fo:block>
11441
12177
  <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11442
- <xsl:with-param name="fo_element" select="$fo_element"/>
12178
+ <xsl:with-param name="fo_element" select="'list'"/>
11443
12179
  </xsl:apply-templates>
11444
- </xsl:variable>
11445
- <xsl:choose>
11446
- <xsl:when test="xalan:nodeset($example_body)/*">
11447
- <xsl:copy-of select="$example_body"/>
11448
- </xsl:when>
11449
- <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
11450
- </xsl:choose>
11451
- </fo:block-container>
11452
- </fo:block-container>
11453
- </xsl:when> <!-- end block -->
11454
-
11455
- <xsl:when test="contains(normalize-space($fo_element), 'list')">
11456
-
11457
- <xsl:variable name="provisional_distance_between_starts_">
11458
- <xsl:value-of select="10 + $text_indent"/>
11459
- </xsl:variable>
11460
- <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
11461
- <xsl:variable name="indent_">
11462
- <xsl:value-of select="$text_indent"/>
11463
- </xsl:variable>
11464
- <xsl:variable name="indent" select="normalize-space($indent_)"/>
11465
-
11466
- <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
11467
- <fo:list-item>
11468
- <fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
11469
- <fo:block>
11470
- <xsl:apply-templates select="*[local-name()='name']">
11471
- <xsl:with-param name="fo_element">block</xsl:with-param>
11472
- </xsl:apply-templates>
11473
- </fo:block>
11474
- </fo:list-item-label>
11475
- <fo:list-item-body start-indent="body-start()">
11476
- <fo:block>
11477
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
11478
- <xsl:with-param name="fo_element" select="$fo_element"/>
11479
- </xsl:apply-templates>
11480
- </fo:block>
11481
- </fo:list-item-body>
11482
- </fo:list-item>
11483
- </fo:list-block>
11484
- </xsl:when> <!-- end list -->
11485
-
11486
- <xsl:otherwise> <!-- inline -->
11487
-
11488
- <!-- display 'EXAMPLE' and first element in the same line -->
11489
- <fo:block>
11490
- <xsl:apply-templates select="*[local-name()='name']">
11491
- <xsl:with-param name="fo_element" select="$fo_element"/>
11492
- </xsl:apply-templates>
11493
- <fo:inline>
11494
- <xsl:apply-templates select="*[not(local-name() = 'name')][1]">
11495
- <xsl:with-param name="fo_element" select="$fo_element"/>
11496
- </xsl:apply-templates>
11497
- </fo:inline>
11498
- </fo:block>
12180
+ </fo:block>
12181
+ </fo:list-item-body>
12182
+ </fo:list-item>
12183
+ </fo:list-block>
11499
12184
 
11500
- <xsl:if test="*[not(local-name() = 'name')][position() &gt; 1]">
11501
- <!-- display further elements in blocks -->
11502
- <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
11503
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11504
- <xsl:apply-templates select="*[not(local-name() = 'name')][position() &gt; 1]">
11505
- <xsl:with-param name="fo_element" select="'block'"/>
11506
- </xsl:apply-templates>
11507
- </fo:block-container>
11508
- </fo:block-container>
11509
- </xsl:if>
11510
- </xsl:otherwise> <!-- end inline -->
12185
+ </fo:block>
11511
12186
 
11512
- </xsl:choose>
11513
- </fo:block-container>
11514
- </fo:block-container>
11515
12187
  </xsl:template>
11516
12188
 
11517
12189
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
@@ -11526,9 +12198,7 @@
11526
12198
  <xsl:when test="contains(normalize-space($fo_element), 'block')">
11527
12199
  <fo:block xsl:use-attribute-sets="example-name-style">
11528
12200
 
11529
- <xsl:if test="not($vertical_layout = 'true')">
11530
- <xsl:attribute name="font-family">IPAexGothic</xsl:attribute>
11531
- </xsl:if>
12201
+ <xsl:call-template name="refine_example-name-style"/>
11532
12202
 
11533
12203
  <xsl:apply-templates/>
11534
12204
  </fo:block>
@@ -11536,7 +12206,7 @@
11536
12206
  <xsl:otherwise>
11537
12207
  <fo:inline xsl:use-attribute-sets="example-name-style">
11538
12208
  <xsl:call-template name="refine_example-name-style"/>
11539
- <xsl:apply-templates/>
12209
+ <xsl:apply-templates/> <!-- $namespace = 'ieee', see https://github.com/metanorma/isodoc/issues/614 -->
11540
12210
  </fo:inline>
11541
12211
  </xsl:otherwise>
11542
12212
  </xsl:choose>
@@ -11722,15 +12392,17 @@
11722
12392
 
11723
12393
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11724
12394
  <fo:block role="BlockQuote">
11725
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
12395
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source') and not(local-name() = 'attribution')]"/> <!-- process all nested nodes, except author and source -->
11726
12396
  </fo:block>
11727
12397
  </fo:block-container>
11728
12398
  </fo:block-container>
11729
- <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
12399
+ <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source'] or *[local-name() = 'attribution']">
11730
12400
  <fo:block xsl:use-attribute-sets="quote-source-style">
11731
12401
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
11732
12402
  <xsl:apply-templates select="*[local-name() = 'author']"/>
11733
12403
  <xsl:apply-templates select="*[local-name() = 'source']"/>
12404
+ <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
12405
+ <xsl:apply-templates select="*[local-name() = 'attribution']/*[local-name() = 'p']/node()"/>
11734
12406
  </fo:block>
11735
12407
  </xsl:if>
11736
12408
 
@@ -11757,9 +12429,13 @@
11757
12429
  </xsl:template>
11758
12430
 
11759
12431
  <xsl:template match="*[local-name() = 'author']">
11760
- <xsl:text>— </xsl:text>
12432
+ <xsl:if test="local-name(..) = 'quote'"> <!-- for old Presentation XML, https://github.com/metanorma/isodoc/issues/607 -->
12433
+ <xsl:text>— </xsl:text>
12434
+ </xsl:if>
11761
12435
  <xsl:apply-templates/>
11762
12436
  </xsl:template>
12437
+
12438
+ <xsl:template match="*[local-name() = 'quote']//*[local-name() = 'referenceFrom']"/>
11763
12439
  <!-- ====== -->
11764
12440
  <!-- ====== -->
11765
12441
 
@@ -11893,6 +12569,13 @@
11893
12569
 
11894
12570
  </xsl:template> <!-- tab -->
11895
12571
 
12572
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
12573
+ <xsl:template match="*[local-name() = 'termnote']/*[local-name() = 'name']/*[local-name() = 'tab']" priority="2"/>
12574
+
12575
+ <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
12576
+
12577
+ </xsl:template>
12578
+
11896
12579
  <xsl:template name="insertNonBreakSpaces">
11897
12580
  <xsl:param name="count"/>
11898
12581
  <xsl:if test="$count &gt; 0">
@@ -11950,8 +12633,12 @@
11950
12633
  </xsl:template>
11951
12634
 
11952
12635
  <xsl:template match="*[local-name() = 'domain']">
12636
+ <!-- https://github.com/metanorma/isodoc/issues/607
11953
12637
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
11954
- <xsl:text> </xsl:text>
12638
+ <xsl:text> </xsl:text> -->
12639
+ <xsl:if test="not(@hidden = 'true')">
12640
+ <xsl:apply-templates/>
12641
+ </xsl:if>
11955
12642
  </xsl:template>
11956
12643
 
11957
12644
  <xsl:template match="*[local-name() = 'admitted']">
@@ -11999,6 +12686,29 @@
11999
12686
  <!-- END definition -->
12000
12687
  <!-- ========== -->
12001
12688
 
12689
+ <xsl:variable name="reviews_">
12690
+ <xsl:for-each select="//*[local-name() = 'review'][@from]">
12691
+ <xsl:copy>
12692
+ <xsl:copy-of select="@from"/>
12693
+ <xsl:copy-of select="@id"/>
12694
+ </xsl:copy>
12695
+ </xsl:for-each>
12696
+ </xsl:variable>
12697
+ <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
12698
+
12699
+ <xsl:template name="addReviewHelper">
12700
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
12701
+ <xsl:variable name="curr_id" select="@id"/>
12702
+ <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
12703
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
12704
+ <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12705
+ </xsl:if>
12706
+ <!-- <fo:block>
12707
+ <curr_id><xsl:value-of select="$curr_id"/></curr_id>
12708
+ <xsl:copy-of select="$reviews"/>
12709
+ </fo:block> -->
12710
+ </xsl:template>
12711
+
12002
12712
  <!-- main sections -->
12003
12713
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
12004
12714
 
@@ -12007,6 +12717,8 @@
12007
12717
 
12008
12718
  <xsl:call-template name="sections_element_style"/>
12009
12719
 
12720
+ <xsl:call-template name="addReviewHelper"/>
12721
+
12010
12722
  <xsl:apply-templates/>
12011
12723
  </fo:block>
12012
12724
 
@@ -12042,6 +12754,7 @@
12042
12754
 
12043
12755
  <fo:block>
12044
12756
  <xsl:call-template name="setId"/>
12757
+ <xsl:call-template name="addReviewHelper"/>
12045
12758
  <xsl:apply-templates/>
12046
12759
  </fo:block>
12047
12760
  </xsl:template>
@@ -12078,6 +12791,8 @@
12078
12791
 
12079
12792
  <xsl:call-template name="refine_clause_style"/>
12080
12793
 
12794
+ <xsl:call-template name="addReviewHelper"/>
12795
+
12081
12796
  <xsl:apply-templates/>
12082
12797
  </fo:block>
12083
12798
  </xsl:template>
@@ -12130,6 +12845,23 @@
12130
12845
 
12131
12846
  <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
12132
12847
 
12848
+ <xsl:if test="1 = 1">
12849
+ <xsl:choose>
12850
+ <!-- if there isn't the attribute '@from', then -->
12851
+ <xsl:when test="$id_from = ''">
12852
+ <fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12853
+ </xsl:when>
12854
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
12855
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
12856
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12857
+ </xsl:when>
12858
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12859
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12860
+ </xsl:when>
12861
+ </xsl:choose>
12862
+ </xsl:if>
12863
+
12864
+ <xsl:if test="1 = 2">
12133
12865
  <xsl:choose>
12134
12866
  <!-- if there isn't the attribute '@from', then -->
12135
12867
  <xsl:when test="$id_from = ''">
@@ -12143,6 +12875,7 @@
12143
12875
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
12144
12876
  </xsl:when>
12145
12877
  </xsl:choose>
12878
+ </xsl:if>
12146
12879
 
12147
12880
  </xsl:template>
12148
12881
 
@@ -12455,26 +13188,7 @@
12455
13188
  <xsl:template name="refine_list-style_provisional-distance-between-starts">
12456
13189
 
12457
13190
  <xsl:if test="local-name() = 'ol' and $vertical_layout = 'true' and @type = 'arabic'">
12458
- <xsl:variable name="labels">
12459
- <xsl:for-each select="*[local-name() = 'li']"><label_len><xsl:value-of select="string-length(@label)"/></label_len></xsl:for-each>
12460
- </xsl:variable>
12461
- <xsl:variable name="max_len_label_">
12462
- <xsl:for-each select="xalan:nodeset($labels)//*">
12463
- <xsl:sort select="." data-type="number" order="descending"/>
12464
- <xsl:if test="position() = 1"><xsl:value-of select="."/></xsl:if>
12465
- </xsl:for-each>
12466
- </xsl:variable>
12467
- <xsl:variable name="max_len_label" select="number($max_len_label_)"/>
12468
- <xsl:attribute name="provisional-distance-between-starts">
12469
- <xsl:choose>
12470
- <xsl:when test="$max_len_label = 1">8.5mm</xsl:when>
12471
- <xsl:when test="$max_len_label = 2">12mm</xsl:when>
12472
- <xsl:when test="$max_len_label = 3">20mm</xsl:when>
12473
- <xsl:otherwise>
12474
- <xsl:value-of select="3 + number($max_len_label) * 4"/>mm
12475
- </xsl:otherwise>
12476
- </xsl:choose>
12477
- </xsl:attribute>
13191
+ <xsl:copy-of select="@provisional-distance-between-starts"/> <!-- add in update_xml_step1 -->
12478
13192
  </xsl:if>
12479
13193
 
12480
13194
  </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
@@ -12855,7 +13569,12 @@
12855
13569
  <xsl:template match="*[local-name() = 'references']">
12856
13570
  <xsl:if test="not(ancestor::*[local-name() = 'annex'])">
12857
13571
 
12858
- <fo:block break-after="page"/>
13572
+ <xsl:choose>
13573
+ <xsl:when test="following-sibling::*[local-name() = 'references'] or preceding-sibling::*[local-name() = 'references']"/>
13574
+ <xsl:otherwise>
13575
+ <fo:block break-after="page"/>
13576
+ </xsl:otherwise>
13577
+ </xsl:choose>
12859
13578
 
12860
13579
  </xsl:if>
12861
13580
 
@@ -13452,6 +14171,10 @@
13452
14171
  <!-- - Remove semantic xml part -->
13453
14172
  <!-- - Remove image/emf (EMF vector image for Word) -->
13454
14173
  <!-- - add @id, redundant for table auto-layout algorithm -->
14174
+ <!-- - process 'passthrough' element -->
14175
+ <!-- - split math by element with @linebreak into maths -->
14176
+ <!-- - rename fmt-title to title, fmt-name to name and another changes to convert new presentation XML to -->
14177
+ <!-- - old XML without significant changes in XSLT -->
13455
14178
  <!-- =========================================================================== -->
13456
14179
  <xsl:template match="@*|node()" mode="update_xml_step1">
13457
14180
  <xsl:copy>
@@ -13459,6 +14182,12 @@
13459
14182
  </xsl:copy>
13460
14183
  </xsl:template>
13461
14184
 
14185
+ <xsl:template match="@*|node()" mode="update_xml_pres">
14186
+ <xsl:copy>
14187
+ <xsl:apply-templates select="@*|node()" mode="update_xml_pres"/>
14188
+ </xsl:copy>
14189
+ </xsl:template>
14190
+
13462
14191
  <!-- change section's order based on @displayorder value -->
13463
14192
  <xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
13464
14193
  <xsl:copy>
@@ -13535,7 +14264,7 @@
13535
14264
  </xsl:template>
13536
14265
 
13537
14266
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
13538
- <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">
14267
+ <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">
13539
14268
  <xsl:copy>
13540
14269
  <xsl:copy-of select="@*"/>
13541
14270
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -13554,14 +14283,17 @@
13554
14283
 
13555
14284
  <!-- remove semantic xml -->
13556
14285
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_step1"/>
14286
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'metanorma']/*[local-name() = 'source']" mode="update_xml_pres"/>
13557
14287
 
13558
14288
  <!-- remove image/emf -->
13559
14289
  <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_step1"/>
14290
+ <xsl:template match="*[local-name() = 'image']/*[local-name() = 'emf']" mode="update_xml_pres"/>
13560
14291
 
13561
14292
  <!-- remove preprocess-xslt -->
13562
14293
  <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_step1"/>
14294
+ <xsl:template match="*[local-name() = 'preprocess-xslt']" mode="update_xml_pres"/>
13563
14295
 
13564
- <xsl:template match="*[local-name() = 'stem'] | *[local-name() = 'image'] | *[local-name() = 'sourcecode'] | *[local-name() = 'bibdata'] | *[local-name() = 'localized-strings']" mode="update_xml_step1">
14296
+ <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">
13565
14297
  <xsl:copy-of select="."/>
13566
14298
  </xsl:template>
13567
14299
 
@@ -13627,6 +14359,93 @@
13627
14359
  </xsl:choose>
13628
14360
  </xsl:template>
13629
14361
 
14362
+ <xsl:variable name="regex_passthrough">.*\bpdf\b.*</xsl:variable>
14363
+ <xsl:template match="*[local-name() = 'passthrough']" mode="update_xml_step1">
14364
+ <!-- <xsl:if test="contains(@formats, ' pdf ')"> -->
14365
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new(@formats), $regex_passthrough)) = 'true'">
14366
+ <xsl:apply-templates mode="update_xml_step1"/>
14367
+ </xsl:if>
14368
+ </xsl:template>
14369
+
14370
+ <!-- split math by element with @linebreak into maths -->
14371
+ <xsl:template match="mathml:math[.//mathml:mo[@linebreak] or .//mathml:mspace[@linebreak]]" mode="update_xml_step1">
14372
+ <xsl:variable name="maths">
14373
+ <xsl:apply-templates select="." mode="mathml_linebreak"/>
14374
+ </xsl:variable>
14375
+ <xsl:copy-of select="$maths"/>
14376
+ </xsl:template>
14377
+
14378
+ <!-- update new Presentation XML -->
14379
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_step1"/>
14380
+ <xsl:template match="*[local-name() = 'title'][following-sibling::*[1][local-name() = 'fmt-title']]" mode="update_xml_pres"/>
14381
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_step1"/>
14382
+ <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
14383
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
14384
+ <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
14385
+
14386
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
14387
+ <xsl:copy>
14388
+ <xsl:apply-templates select="@*" mode="update_xml_step1"/>
14389
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
14390
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
14391
+ </xsl:copy>
14392
+ </xsl:template>
14393
+ <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_pres">
14394
+ <xsl:copy>
14395
+ <xsl:apply-templates select="@*" mode="update_xml_pres"/>
14396
+ <xsl:copy-of select="preceding-sibling::*[1][local-name() = 'section-title']/@depth"/>
14397
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
14398
+ </xsl:copy>
14399
+ </xsl:template>
14400
+
14401
+ <xsl:template match="*[local-name() = 'fmt-title']"/>
14402
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
14403
+ <xsl:element name="title" namespace="{$namespace_full}">
14404
+ <xsl:copy-of select="@*"/>
14405
+ <xsl:apply-templates mode="update_xml_step1"/>
14406
+ </xsl:element>
14407
+ </xsl:template>
14408
+ <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
14409
+ <xsl:element name="title" namespace="{$namespace_full}">
14410
+ <xsl:copy-of select="@*"/>
14411
+ <xsl:apply-templates mode="update_xml_pres"/>
14412
+ </xsl:element>
14413
+ </xsl:template>
14414
+
14415
+ <xsl:template match="*[local-name() = 'fmt-name']"/>
14416
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
14417
+ <xsl:element name="name" namespace="{$namespace_full}">
14418
+ <xsl:copy-of select="@*"/>
14419
+ <xsl:apply-templates mode="update_xml_step1"/>
14420
+ </xsl:element>
14421
+ </xsl:template>
14422
+ <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_pres">
14423
+ <xsl:element name="name" namespace="{$namespace_full}">
14424
+ <xsl:copy-of select="@*"/>
14425
+ <xsl:apply-templates mode="update_xml_pres"/>
14426
+ </xsl:element>
14427
+ </xsl:template>
14428
+
14429
+ <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">
14430
+ <xsl:apply-templates mode="update_xml_step1"/>
14431
+ </xsl:template>
14432
+ <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">
14433
+ <xsl:apply-templates mode="update_xml_pres"/>
14434
+ </xsl:template>
14435
+
14436
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_step1">
14437
+ <xsl:apply-templates mode="update_xml_step1"/>
14438
+ </xsl:template>
14439
+ <xsl:template match="*[local-name() = 'semx']" mode="update_xml_pres">
14440
+ <xsl:apply-templates mode="update_xml_pres"/>
14441
+ </xsl:template>
14442
+
14443
+ <xsl:template match="*[local-name() = 'fmt-xref-label']"/>
14444
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_step1"/>
14445
+ <xsl:template match="*[local-name() = 'fmt-xref-label']" mode="update_xml_pres"/>
14446
+
14447
+ <!-- END: update new Presentation XML -->
14448
+
13630
14449
  <!-- =========================================================================== -->
13631
14450
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
13632
14451
  <!-- =========================================================================== -->
@@ -13730,6 +14549,8 @@
13730
14549
 
13731
14550
  <xsl:template name="insertOpeningElements">
13732
14551
  <xsl:param name="tree"/>
14552
+ <xsl:param name="xmlns"/>
14553
+ <xsl:param name="add_continue">true</xsl:param>
13733
14554
  <xsl:for-each select="$tree//element">
13734
14555
  <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
13735
14556
  <xsl:value-of select="."/>
@@ -13740,7 +14561,8 @@
13740
14561
  <xsl:value-of select="."/>
13741
14562
  <xsl:text>"</xsl:text>
13742
14563
  </xsl:for-each>
13743
- <xsl:if test="position() = 1"> continue="true"</xsl:if>
14564
+ <xsl:if test="position() = 1 and $add_continue = 'true'"> continue="true"</xsl:if>
14565
+ <xsl:if test="position() = 1 and $xmlns != ''"> xmlns="<xsl:value-of select="$xmlns"/>"</xsl:if>
13744
14566
  <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
13745
14567
  <xsl:if test="$debug = 'true'">
13746
14568
  <xsl:message>&lt;<xsl:value-of select="."/>&gt;</xsl:message>
@@ -13920,7 +14742,7 @@
13920
14742
  <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
13921
14743
  <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>
13922
14744
 
13923
- <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">
14745
+ <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">
13924
14746
 
13925
14747
  <xsl:variable name="parent" select="local-name(..)"/>
13926
14748
 
@@ -14502,6 +15324,7 @@
14502
15324
  </pdf:catalog>
14503
15325
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14504
15326
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
15327
+ <!-- Commented after upgrade to Apache FOP 2.10
14505
15328
  <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="">
14506
15329
  <pdfaExtension:schemas>
14507
15330
  <rdf:Bag>
@@ -14534,7 +15357,7 @@
14534
15357
  </rdf:li>
14535
15358
  </rdf:Bag>
14536
15359
  </pdfaExtension:schemas>
14537
- </rdf:Description>
15360
+ </rdf:Description> -->
14538
15361
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
14539
15362
  <!-- Dublin Core properties go here -->
14540
15363
  <dc:title>
@@ -14581,7 +15404,7 @@
14581
15404
  <xsl:variable name="dc_description">
14582
15405
  <xsl:variable name="abstract">
14583
15406
 
14584
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
15407
+ <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'])]"/>
14585
15408
 
14586
15409
  </xsl:variable>
14587
15410
  <rdf:Alt>
@@ -15124,31 +15947,123 @@
15124
15947
 
15125
15948
  <!-- END: insert cover page image -->
15126
15949
 
15127
- <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
15950
+ <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
15951
+ <xsl:variable name="regex_ja_spec_">[
15952
+ <!-- Rotate 90° clockwise -->
15953
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
15954
+ \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
15955
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
15956
+ \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
15957
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
15958
+ \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
15959
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
15960
+ \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
15961
+ \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
15962
+ \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
15963
+ \u3010 <!-- U+3010 LEFT BLACK LENTICULAR BRACKET (【) -->
15964
+ \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
15965
+ \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
15966
+ \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
15967
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
15968
+ \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
15969
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
15970
+ \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
15971
+ \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
15972
+ \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
15973
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
15974
+ \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
15975
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
15976
+ \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
15977
+ \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
15978
+ \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
15979
+ \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
15980
+ \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
15981
+
15982
+ \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
15983
+ \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
15984
+ \u301C <!-- U+301C WAVE DASH (〜) -->
15985
+ \u3030 <!-- U+3030 WAVY DASH (〰 )-->
15986
+ \u30FC <!-- U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK (ー) -->
15987
+ \u2329 <!-- U+2329 LEFT-POINTING ANGLE BRACKET (〈) -->
15988
+ \u232A <!-- U+232A RIGHT-POINTING ANGLE BRACKET (〉) -->
15989
+ \u3018 <!-- U+3018 LEFT WHITE TORTOISE SHELL BRACKET (〘) -->
15990
+ \u3019 <!-- U+3019 RIGHT WHITE TORTOISE SHELL BRACKET (〙) -->
15991
+ \u30A0 <!-- U+30A0 KATAKANA-HIRAGANA DOUBLE HYPHEN (゠) -->
15992
+ \uFE59 <!-- U+FE59 SMALL LEFT PARENTHESIS (﹙) -->
15993
+ \uFE5A <!-- U+FE5A SMALL RIGHT PARENTHESIS (﹚) -->
15994
+ \uFE5B <!-- U+FE5B SMALL LEFT CURLY BRACKET (﹛) -->
15995
+ \uFE5C <!-- U+FE5C SMALL RIGHT CURLY BRACKET (﹜) -->
15996
+ \uFE5D <!-- U+FE5D SMALL LEFT TORTOISE SHELL BRACKET (﹝) -->
15997
+ \uFE5E <!-- U+FE5E SMALL RIGHT TORTOISE SHELL BRACKET (﹞) -->
15998
+ \uFF5C <!-- U+FF5C FULLWIDTH VERTICAL LINE (|) -->
15999
+ \uFF5F <!-- U+FF5F FULLWIDTH LEFT WHITE PARENTHESIS (⦅) -->
16000
+ \uFF60 <!-- U+FF60 FULLWIDTH RIGHT WHITE PARENTHESIS (⦆) -->
16001
+ \uFFE3 <!-- U+FFE3 FULLWIDTH MACRON ( ̄) -->
16002
+ \uFF3F <!-- U+FF3F FULLWIDTH LOW LINE (_) -->
16003
+ \uFF5E <!-- U+FF5E FULLWIDTH TILDE (~) -->
16004
+ <!-- Rotate 180° -->
16005
+ \u309C <!-- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜) -->
16006
+ \u3002 <!-- U+3002 IDEOGRAPHIC FULL STOP (。) -->
16007
+ \uFE52 <!-- U+FE52 SMALL FULL STOP (﹒) -->
16008
+ \uFF0E <!-- U+FF0E FULLWIDTH FULL STOP (.) -->
16009
+ ]</xsl:variable>
16010
+ <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
15128
16011
  <xsl:template name="insertVerticalChar">
15129
16012
  <xsl:param name="str"/>
15130
16013
  <xsl:param name="writing-mode">lr-tb</xsl:param>
15131
16014
  <xsl:param name="reference-orientation">90</xsl:param>
15132
- <xsl:if test="string-length($str) &gt; 0">
15133
- <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">
15134
- <xsl:if test="normalize-space($writing-mode) != ''">
15135
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
15136
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
15137
- </xsl:if>
15138
- <xsl:variable name="char" select="substring($str,1,1)"/>
15139
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
15140
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
16015
+ <xsl:param name="add_zero_width_space">false</xsl:param>
16016
+ <xsl:choose>
16017
+ <xsl:when test="ancestor::*[local-name() = 'span'][@class = 'norotate']">
16018
+ <xsl:value-of select="$str"/>
16019
+ </xsl:when>
16020
+ <xsl:otherwise>
16021
+ <xsl:if test="string-length($str) &gt; 0">
16022
+ <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
16023
+ <xsl:variable name="char" select="substring($str,1,1)"/>
16024
+ <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">
16025
+ <xsl:if test="normalize-space($writing-mode) != ''">
16026
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
16027
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
16028
+ </xsl:if>
16029
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
16030
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
16031
+ </xsl:if>
16032
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
16033
+ <!-- Rotate 180°:
16034
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
16035
+ U+3002 IDEOGRAPHIC FULL STOP (。)
16036
+ U+FE52 SMALL FULL STOP (﹒)
16037
+ U+FF0E FULLWIDTH FULL STOP (.)
16038
+ -->
16039
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
16040
+ </xsl:if>
16041
+ <fo:block-container width="1em">
16042
+ <fo:block line-height="1em">
16043
+ <xsl:choose>
16044
+ <xsl:when test="$horizontal_mode = 'true'">
16045
+ <xsl:value-of select="$str"/>
16046
+ </xsl:when>
16047
+ <xsl:otherwise>
16048
+ <xsl:value-of select="$char"/>
16049
+ </xsl:otherwise>
16050
+ </xsl:choose>
16051
+ </fo:block>
16052
+ </fo:block-container>
16053
+ </fo:inline-container>
16054
+ <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>
16055
+
16056
+ <xsl:if test="$horizontal_mode = 'false'">
16057
+ <xsl:call-template name="insertVerticalChar">
16058
+ <xsl:with-param name="str" select="substring($str, 2)"/>
16059
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
16060
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
16061
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
16062
+ </xsl:call-template>
16063
+ </xsl:if>
15141
16064
  </xsl:if>
15142
- <fo:block-container width="1em">
15143
- <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
15144
- </fo:block-container>
15145
- </fo:inline-container>
15146
- <xsl:call-template name="insertVerticalChar">
15147
- <xsl:with-param name="str" select="substring($str, 2)"/>
15148
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
15149
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
15150
- </xsl:call-template>
15151
- </xsl:if>
16065
+ </xsl:otherwise>
16066
+ </xsl:choose>
15152
16067
  </xsl:template>
15153
16068
 
15154
16069
  <xsl:template name="number-to-words">