metanorma-jis 0.2.10 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 974d35a99bba52ce5fa4e6073e02443f565c2bd47dc832ade4ca7ef69477422e
4
- data.tar.gz: 50d6114af3794e0254f387d497d8e784b514043109b7a6085c317dfa12187ee3
3
+ metadata.gz: 1fd45b34656e8ad9ca11060ef7bd5de64e5d8140f56122d65a9b1a2c211d9f2f
4
+ data.tar.gz: f98c49a2d90f36fb4f9b408e2ce48f9d34c83c28ddc8e265746458bfa54b1ae2
5
5
  SHA512:
6
- metadata.gz: 710db35c6be4d09c66a2f50d4ccba657d5d565d890476cece59e4ec06fcae1e3421fde785a468f4ad95804bfbfbe0188528e29457654d902faecaea6526514e5
7
- data.tar.gz: 29296cef62c29fa2612319db0726b9499997720c6e11dd27bb00e80db7d57c3165fbbe6c8c59c41036d87e1cb73c680da9280e215fa072fb2704a2b089c302d8
6
+ metadata.gz: 338dac9a6839cf63f0b97c1d5d3d571ef230a73da1622f0fd2fb5cc54d7d799de9566dc31d9b3786a584499f55e58ddd40f2ee2344cfea89fe1772054b388a3e
7
+ data.tar.gz: 4cc95fc4ffc266b99695f45ae325645fdf176a0aab739dc2f60db983d4d1a02659f36f2e4f8c08f3fefde9beac8fa9a553f7e5934a6fbe89a42c52473eb3ae1e
@@ -1619,6 +1619,8 @@
1619
1619
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
1620
1620
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
1621
1621
 
1622
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="document_scheme" select="normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
1623
+
1622
1624
  <!-- external parameters -->
1623
1625
 
1624
1626
  <xsl:param xmlns:redirect="http://xml.apache.org/xalan/redirect" name="svg_images"/> <!-- svg images array -->
@@ -3296,56 +3298,9 @@
3296
3298
  </xsl:for-each>
3297
3299
  </xsl:template>
3298
3300
 
3299
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceSectionsDefault_items">
3300
-
3301
- <xsl:variable name="updated_xml_step_move_pagebreak">
3302
-
3303
- <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3304
-
3305
- <xsl:call-template name="copyCommonElements"/>
3306
-
3307
- <xsl:element name="preface" namespace="{$namespace_full}"> <!-- save context element -->
3308
- <xsl:element name="page_sequence" namespace="{$namespace_full}">
3309
- <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3310
- <xsl:sort select="@displayorder" data-type="number"/>
3311
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3312
- </xsl:for-each>
3313
- </xsl:element>
3314
- </xsl:element>
3315
- </xsl:element>
3316
- </xsl:variable>
3317
-
3318
- <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3319
- <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
3320
- <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3321
- <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3322
- <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3323
- </redirect:write>
3324
- <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3325
-
3326
- <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3327
-
3328
- <!-- TODO: instead of
3329
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
3330
- in each template, add removing empty page_sequence here
3331
- -->
3332
-
3333
- <xsl:if test="$debug = 'true'">
3334
- <redirect:write file="page_sequence_preface.xml">
3335
- <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3336
- </redirect:write>
3337
- </xsl:if>
3338
-
3339
- <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3340
- <xsl:call-template name="deleteFile">
3341
- <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3342
- </xsl:call-template>
3343
- <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3344
- </xsl:template> <!-- END: processPrefaceSectionsDefault_items -->
3345
-
3346
3301
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="copyCommonElements">
3347
3302
  <!-- copy bibdata, localized-strings, metanorma-extension and boilerplate -->
3348
- <xsl:copy-of select="/*/*[local-name() != 'preface' and local-name() != 'sections' and local-name() != 'annex' and local-name() != 'bibliography']"/>
3303
+ <xsl:copy-of select="/*/*[local-name() != 'preface' and local-name() != 'sections' and local-name() != 'annex' and local-name() != 'bibliography' and local-name() != 'indexsect']"/>
3349
3304
  </xsl:template>
3350
3305
 
3351
3306
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault">
@@ -3366,8 +3321,16 @@
3366
3321
  </xsl:for-each>
3367
3322
  </xsl:template><!-- END: processMainSectionsDefault -->
3368
3323
 
3369
- <!-- Example:
3324
+ <!-- Example:
3370
3325
  <iso-standard>
3326
+ <preface>
3327
+ <page_sequence>
3328
+ <clause...
3329
+ </page_sequence>
3330
+ <page_sequence>
3331
+ <clause...
3332
+ </page_sequence>
3333
+ </preface>
3371
3334
  <sections>
3372
3335
  <page_sequence>
3373
3336
  <clause...
@@ -3384,60 +3347,200 @@
3384
3347
  </page_sequence>
3385
3348
  </iso-standard>
3386
3349
  -->
3387
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processMainSectionsDefault_items">
3350
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processPrefaceAndMainSectionsDefault_items">
3388
3351
 
3389
3352
  <xsl:variable name="updated_xml_step_move_pagebreak">
3390
-
3391
3353
  <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3392
-
3393
3354
  <xsl:call-template name="copyCommonElements"/>
3355
+ <xsl:call-template name="insertPrefaceSectionsPageSequences"/>
3356
+ <xsl:call-template name="insertMainSectionsPageSequences"/>
3357
+ </xsl:element>
3358
+ </xsl:variable>
3394
3359
 
3395
- <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
3396
- <xsl:element name="page_sequence" namespace="{$namespace_full}">
3397
- <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3398
- <xsl:sort select="@displayorder" data-type="number"/>
3399
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3360
+ <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3400
3361
 
3401
- </xsl:for-each>
3402
- </xsl:element>
3362
+ <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3363
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3364
+ </redirect:write>
3365
+
3366
+ <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3367
+
3368
+ <xsl:if test="$debug = 'true'">
3369
+ <redirect:write file="page_sequence_preface_and_main.xml">
3370
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3371
+ </redirect:write>
3372
+ </xsl:if>
3373
+
3374
+ <xsl:call-template name="deleteFile">
3375
+ <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3376
+ </xsl:call-template>
3377
+ </xsl:template> <!-- END: processPrefaceAndMainSectionsDefault_items -->
3378
+
3379
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertPrefaceSectionsPageSequences">
3380
+ <xsl:element name="preface" namespace="{$namespace_full}"> <!-- save context element -->
3381
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3382
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3383
+ <xsl:sort select="@displayorder" data-type="number"/>
3384
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3385
+ </xsl:for-each>
3386
+ </xsl:element>
3387
+ </xsl:element>
3388
+ </xsl:template> <!-- END: insertPrefaceSectionsPageSequences -->
3389
+
3390
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertMainSectionsPageSequences">
3391
+ <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
3392
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3393
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3394
+ <xsl:sort select="@displayorder" data-type="number"/>
3395
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3396
+
3397
+ </xsl:for-each>
3398
+ </xsl:element>
3399
+ </xsl:element>
3400
+
3401
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3402
+ <xsl:for-each select="/*/*[local-name()='annex']">
3403
+ <xsl:sort select="@displayorder" data-type="number"/>
3404
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3405
+ </xsl:for-each>
3406
+ </xsl:element>
3407
+
3408
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3409
+ <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
3410
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3411
+ <xsl:sort select="@displayorder" data-type="number"/>
3412
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3413
+ </xsl:for-each>
3414
+ </xsl:element>
3415
+ </xsl:element>
3416
+ </xsl:template> <!-- END: insertMainSectionsPageSequences -->
3417
+
3418
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertMainSectionsInSeparatePageSequences">
3419
+ <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
3420
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3421
+ <xsl:sort select="@displayorder" data-type="number"/>
3422
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3423
+ <xsl:attribute name="main_page_sequence"/>
3424
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3403
3425
  </xsl:element>
3426
+ </xsl:for-each>
3427
+ </xsl:element>
3428
+
3429
+ <xsl:call-template name="insertAnnexInSeparatePageSequences"/>
3404
3430
 
3431
+ <xsl:call-template name="insertBibliographyInSeparatePageSequences"/>
3432
+
3433
+ <!-- <xsl:call-template name="insertIndexInSeparatePageSequences"/> -->
3434
+ </xsl:template> <!-- END: insertMainSectionsInSeparatePageSequences -->
3435
+
3436
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertAnnexInSeparatePageSequences">
3437
+ <xsl:for-each select="/*/*[local-name()='annex']">
3438
+ <xsl:sort select="@displayorder" data-type="number"/>
3439
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3440
+ <xsl:attribute name="main_page_sequence"/>
3441
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3442
+ </xsl:element>
3443
+ </xsl:for-each>
3444
+ </xsl:template>
3445
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertBibliographyInSeparatePageSequences">
3446
+ <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
3447
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3448
+ <xsl:sort select="@displayorder" data-type="number"/>
3405
3449
  <xsl:element name="page_sequence" namespace="{$namespace_full}">
3406
- <xsl:for-each select="/*/*[local-name()='annex']">
3407
- <xsl:sort select="@displayorder" data-type="number"/>
3408
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3409
- </xsl:for-each>
3450
+ <xsl:attribute name="main_page_sequence"/>
3451
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3410
3452
  </xsl:element>
3453
+ </xsl:for-each>
3454
+ </xsl:element>
3455
+ </xsl:template>
3456
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertIndexInSeparatePageSequences">
3457
+ <xsl:for-each select="/*/*[local-name()='indexsect']">
3458
+ <xsl:sort select="@displayorder" data-type="number"/>
3459
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3460
+ <xsl:attribute name="main_page_sequence"/>
3461
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3462
+ </xsl:element>
3463
+ </xsl:for-each>
3464
+ </xsl:template>
3411
3465
 
3466
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="processAllSectionsDefault_items">
3467
+ <xsl:variable name="updated_xml_step_move_pagebreak">
3468
+ <xsl:element name="{$root_element}" namespace="{$namespace_full}">
3469
+ <xsl:call-template name="copyCommonElements"/>
3412
3470
  <xsl:element name="page_sequence" namespace="{$namespace_full}">
3413
- <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
3414
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3415
- <xsl:sort select="@displayorder" data-type="number"/>
3416
- <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3417
- </xsl:for-each>
3418
- </xsl:element>
3471
+ <xsl:call-template name="insertPrefaceSections"/>
3472
+ <xsl:call-template name="insertMainSections"/>
3419
3473
  </xsl:element>
3420
3474
  </xsl:element>
3421
3475
  </xsl:variable>
3422
3476
 
3423
- <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3424
-
3477
+ <xsl:variable name="updated_xml_step_move_pagebreak_filename" select="concat($output_path,'_preface_and_main_', java:getTime(java:java.util.Date.new()), '.xml')"/>
3478
+ <!-- <xsl:message>updated_xml_step_move_pagebreak_filename=<xsl:value-of select="$updated_xml_step_move_pagebreak_filename"/></xsl:message>
3479
+ <xsl:message>start write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3425
3480
  <redirect:write file="{$updated_xml_step_move_pagebreak_filename}">
3426
3481
  <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3427
3482
  </redirect:write>
3483
+ <!-- <xsl:message>end write updated_xml_step_move_pagebreak_filename</xsl:message> -->
3428
3484
 
3429
3485
  <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3430
3486
 
3487
+ <!-- TODO: instead of
3488
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][normalize-space() != '' or .//image or .//svg]">
3489
+ in each template, add removing empty page_sequence here
3490
+ -->
3491
+
3431
3492
  <xsl:if test="$debug = 'true'">
3432
- <redirect:write file="page_sequence_main.xml">
3433
- <xsl:copy-of select="document($updated_xml_step_move_pagebreak_filename)"/>
3493
+ <redirect:write file="page_sequence_preface_and_main.xml">
3494
+ <xsl:copy-of select="$updated_xml_step_move_pagebreak"/>
3434
3495
  </redirect:write>
3435
3496
  </xsl:if>
3436
3497
 
3498
+ <!-- <xsl:message>start delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3437
3499
  <xsl:call-template name="deleteFile">
3438
3500
  <xsl:with-param name="filepath" select="$updated_xml_step_move_pagebreak_filename"/>
3439
3501
  </xsl:call-template>
3440
- </xsl:template> <!-- END: processMainSectionsDefault_items -->
3502
+ <!-- <xsl:message>end delete updated_xml_step_move_pagebreak_filename</xsl:message> -->
3503
+ </xsl:template> <!-- END: processAllSectionsDefault_items -->
3504
+
3505
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertPrefaceSections">
3506
+ <xsl:element name="preface" namespace="{$namespace_full}"> <!-- save context element -->
3507
+ <xsl:for-each select="/*/*[local-name()='preface']/*[not(local-name() = 'note' or local-name() = 'admonition')]">
3508
+ <xsl:sort select="@displayorder" data-type="number"/>
3509
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak">
3510
+ <xsl:with-param name="page_sequence_at_top">true</xsl:with-param>
3511
+ </xsl:apply-templates>
3512
+ </xsl:for-each>
3513
+ </xsl:element>
3514
+ </xsl:template>
3515
+
3516
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertMainSections">
3517
+ <xsl:element name="sections" namespace="{$namespace_full}"> <!-- save context element -->
3518
+
3519
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3520
+ <xsl:sort select="@displayorder" data-type="number"/>
3521
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak">
3522
+ <xsl:with-param name="page_sequence_at_top">true</xsl:with-param>
3523
+ </xsl:apply-templates>
3524
+
3525
+ </xsl:for-each>
3526
+ </xsl:element>
3527
+
3528
+ <xsl:for-each select="/*/*[local-name()='annex']">
3529
+ <xsl:sort select="@displayorder" data-type="number"/>
3530
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak">
3531
+ <xsl:with-param name="page_sequence_at_top">true</xsl:with-param>
3532
+ </xsl:apply-templates>
3533
+ </xsl:for-each>
3534
+
3535
+ <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
3536
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3537
+ <xsl:sort select="@displayorder" data-type="number"/>
3538
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak">
3539
+ <xsl:with-param name="page_sequence_at_top">true</xsl:with-param>
3540
+ </xsl:apply-templates>
3541
+ </xsl:for-each>
3542
+ </xsl:element>
3543
+ </xsl:template>
3441
3544
 
3442
3545
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="deleteFile">
3443
3546
  <xsl:param name="filepath"/>
@@ -3482,9 +3585,16 @@
3482
3585
  <xsl:value-of select="substring-before($text, $tag_open)"/>
3483
3586
  <!-- <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text> -->
3484
3587
  <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
3485
- <fo:inline keep-together.within-line="always">
3486
- <xsl:value-of select="substring-before($text_after, $tag_close)"/>
3487
- </fo:inline>
3588
+ <xsl:choose>
3589
+ <xsl:when test="local-name(..) = 'keep-together_within-line'"> <!-- prevent two nested <fo:inline keep-together.within-line="always"><fo:inline keep-together.within-line="always" -->
3590
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
3591
+ </xsl:when>
3592
+ <xsl:otherwise>
3593
+ <fo:inline keep-together.within-line="always" role="SKIP">
3594
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
3595
+ </fo:inline>
3596
+ </xsl:otherwise>
3597
+ </xsl:choose>
3488
3598
  <!-- <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text> -->
3489
3599
  <xsl:call-template name="replace_fo_inline_tags">
3490
3600
  <xsl:with-param name="tag_open" select="$tag_open"/>
@@ -4647,6 +4757,8 @@
4647
4757
  <xsl:with-param name="default">center</xsl:with-param>
4648
4758
  </xsl:call-template>
4649
4759
 
4760
+ <xsl:copy-of select="@keep-together.within-line"/>
4761
+
4650
4762
  <xsl:call-template name="refine_table-header-cell-style"/>
4651
4763
 
4652
4764
  <!-- experimental feature, see https://github.com/metanorma/metanorma-plateau/issues/30#issuecomment-2145461828 -->
@@ -4705,6 +4817,8 @@
4705
4817
  <xsl:with-param name="default">left</xsl:with-param>
4706
4818
  </xsl:call-template>
4707
4819
 
4820
+ <xsl:copy-of select="@keep-together.within-line"/>
4821
+
4708
4822
  <xsl:call-template name="refine_table-cell-style"/>
4709
4823
 
4710
4824
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
@@ -4830,7 +4944,7 @@
4830
4944
  <xsl:copy-of select="."/>
4831
4945
  </xsl:for-each>
4832
4946
 
4833
- <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
4947
+ <xsl:if test="following-sibling::node()[normalize-space() != ''][1][local-name() = 'fn']">
4834
4948
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
4835
4949
  </xsl:if>
4836
4950
 
@@ -4897,7 +5011,7 @@
4897
5011
  <xsl:copy-of select="node()"/>
4898
5012
  </fn>
4899
5013
  </xsl:for-each>
4900
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='bibliography']/*">
5014
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]//*[local-name()='bibliography']/*">
4901
5015
  <xsl:sort select="@displayorder" data-type="number"/>
4902
5016
  <!-- commented:
4903
5017
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
@@ -4982,6 +5096,11 @@
4982
5096
 
4983
5097
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="create_fn">
4984
5098
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5099
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5100
+ <xsl:attribute name="id">
5101
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5102
+ </xsl:attribute>
5103
+ </xsl:if>
4985
5104
 
4986
5105
  <xsl:apply-templates/>
4987
5106
  </fn>
@@ -5125,6 +5244,11 @@
5125
5244
  <xsl:call-template name="refine_fn-reference-style"/>
5126
5245
 
5127
5246
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5247
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5248
+ <xsl:attribute name="internal-destination">
5249
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5250
+ </xsl:attribute>
5251
+ </xsl:if>
5128
5252
 
5129
5253
  <xsl:value-of select="@reference"/>
5130
5254
 
@@ -6170,7 +6294,7 @@
6170
6294
 
6171
6295
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="recursiveSmallCaps">
6172
6296
  <xsl:param name="text"/>
6173
- <xsl:param name="ratio"/>
6297
+ <xsl:param name="ratio">0.75</xsl:param>
6174
6298
  <xsl:variable name="char" select="substring($text,1,1)"/>
6175
6299
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
6176
6300
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
@@ -8269,6 +8393,8 @@
8269
8393
  </xsl:choose>
8270
8394
  </xsl:variable>
8271
8395
 
8396
+ <xsl:variable name="isPrecedingTitle" select="normalize-space(ancestor::*[local-name() = 'figure']/preceding-sibling::*[1][local-name() = 'title'] and 1 = 1)"/>
8397
+
8272
8398
  <xsl:choose>
8273
8399
  <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
8274
8400
  <fo:block>
@@ -8415,7 +8541,14 @@
8415
8541
  <xsl:variable name="scale_y">
8416
8542
  <xsl:choose>
8417
8543
  <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8418
- <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8544
+ <xsl:variable name="height_effective_px_">
8545
+ <xsl:choose>
8546
+ <!-- title is 'keep-with-next' with following figure -->
8547
+ <xsl:when test="$isPrecedingTitle = 'true'"><xsl:value-of select="$height_effective_px - 80"/></xsl:when>
8548
+ <xsl:otherwise><xsl:value-of select="$height_effective_px"/></xsl:otherwise>
8549
+ </xsl:choose>
8550
+ </xsl:variable>
8551
+ <xsl:value-of select="$height_effective_px_ div ($svg_height * $scale_x)"/>
8419
8552
  </xsl:when>
8420
8553
  <xsl:otherwise>1</xsl:otherwise>
8421
8554
  </xsl:choose>
@@ -8834,7 +8967,7 @@
8834
8967
  </xsl:if>
8835
8968
 
8836
8969
  <xsl:for-each select="$contents_nodes/doc">
8837
- <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
8970
+ <fo:bookmark internal-destination="{contents/item[@display = 'true'][1]/@id}" starting-state="hide">
8838
8971
  <xsl:if test="@bundle = 'true'">
8839
8972
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
8840
8973
  </xsl:if>
@@ -10044,9 +10177,17 @@
10044
10177
 
10045
10178
  <fo:block-container xsl:use-attribute-sets="example-body-style" role="SKIP">
10046
10179
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
10047
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10048
- <xsl:with-param name="fo_element" select="$fo_element"/>
10049
- </xsl:apply-templates>
10180
+ <xsl:variable name="example_body">
10181
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
10182
+ <xsl:with-param name="fo_element" select="$fo_element"/>
10183
+ </xsl:apply-templates>
10184
+ </xsl:variable>
10185
+ <xsl:choose>
10186
+ <xsl:when test="xalan:nodeset($example_body)/*">
10187
+ <xsl:copy-of select="$example_body"/>
10188
+ </xsl:when>
10189
+ <xsl:otherwise><fo:block/><!-- prevent empty block-container --></xsl:otherwise>
10190
+ </xsl:choose>
10050
10191
  </fo:block-container>
10051
10192
  </fo:block-container>
10052
10193
  </xsl:when> <!-- end block -->
@@ -10581,7 +10722,22 @@
10581
10722
 
10582
10723
  <!-- note: @top-level added in mode=" update_xml_step_move_pagebreak" -->
10583
10724
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'sections']/*[local-name() = 'page_sequence']/*[not(@top-level)]" priority="2">
10584
- <xsl:call-template name="sections_node"/>
10725
+ <xsl:choose>
10726
+ <xsl:when test="local-name() = 'clause' and normalize-space() = '' and count(*) = 0"/>
10727
+ <xsl:otherwise>
10728
+ <xsl:call-template name="sections_node"/>
10729
+ </xsl:otherwise>
10730
+ </xsl:choose>
10731
+ </xsl:template>
10732
+
10733
+ <!-- page_sequence/sections/clause -->
10734
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'page_sequence']/*[local-name() = 'sections']/*[not(@top-level)]" priority="2">
10735
+ <xsl:choose>
10736
+ <xsl:when test="local-name() = 'clause' and normalize-space() = '' and count(*) = 0"/>
10737
+ <xsl:otherwise>
10738
+ <xsl:call-template name="sections_node"/>
10739
+ </xsl:otherwise>
10740
+ </xsl:choose>
10585
10741
  </xsl:template>
10586
10742
 
10587
10743
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="sections_element_style">
@@ -10598,8 +10754,24 @@
10598
10754
  </fo:block>
10599
10755
  </xsl:template>
10600
10756
 
10601
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'preface']/*[local-name() = 'page_sequence']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10602
- <xsl:call-template name="preface_node"/>
10757
+ <!-- preface/ page_sequence/clause -->
10758
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'preface']/*[local-name() = 'page_sequence']/*[not(@top-level)]" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10759
+ <xsl:choose>
10760
+ <xsl:when test="local-name() = 'clause' and normalize-space() = '' and count(*) = 0"/>
10761
+ <xsl:otherwise>
10762
+ <xsl:call-template name="preface_node"/>
10763
+ </xsl:otherwise>
10764
+ </xsl:choose>
10765
+ </xsl:template>
10766
+
10767
+ <!-- page_sequence/preface/clause -->
10768
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'page_sequence']/*[local-name() = 'preface']/*[not(@top-level)]" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10769
+ <xsl:choose>
10770
+ <xsl:when test="local-name() = 'clause' and normalize-space() = '' and count(*) = 0"/>
10771
+ <xsl:otherwise>
10772
+ <xsl:call-template name="preface_node"/>
10773
+ </xsl:otherwise>
10774
+ </xsl:choose>
10603
10775
  </xsl:template>
10604
10776
 
10605
10777
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'clause'][normalize-space() != '' or *[local-name() = 'figure'] or @id]" name="template_clause"> <!-- if clause isn't empty -->
@@ -11924,7 +12096,14 @@
11924
12096
  </redirect:write> -->
11925
12097
  </xsl:if>
11926
12098
 
12099
+ <!-- <xsl:if test="$debug = 'true'"><xsl:message>START copying updated_xml_step3</xsl:message></xsl:if>
12100
+ <xsl:variable name="startTime4" select="java:getTime(java:java.util.Date.new())"/> -->
11927
12101
  <xsl:copy-of select="$updated_xml_step3"/>
12102
+ <!-- <xsl:variable name="endTime4" select="java:getTime(java:java.util.Date.new())"/>
12103
+ <xsl:if test="$debug = 'true'">
12104
+ <xsl:message>DEBUG: processing time <xsl:value-of select="$endTime4 - $startTime4"/> msec.</xsl:message>
12105
+ <xsl:message>END copying updated_xml_step3</xsl:message>
12106
+ </xsl:if> -->
11928
12107
 
11929
12108
  </xsl:template>
11930
12109
 
@@ -12106,14 +12285,17 @@
12106
12285
  <!-- STEP MOVE PAGEBREAK: move <pagebreak/> at top level under 'preface' and 'sections' -->
12107
12286
  <!-- =========================================================================== -->
12108
12287
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="@*|node()" mode="update_xml_step_move_pagebreak">
12288
+ <xsl:param name="page_sequence_at_top">false</xsl:param>
12109
12289
  <xsl:copy>
12110
- <xsl:apply-templates select="@*|node()" mode="update_xml_step_move_pagebreak"/>
12290
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step_move_pagebreak">
12291
+ <xsl:with-param name="page_sequence_at_top" select="$page_sequence_at_top"/>
12292
+ </xsl:apply-templates>
12111
12293
  </xsl:copy>
12112
12294
  </xsl:template>
12113
12295
 
12114
12296
  <!-- replace 'pagebreak' by closing tags + page_sequence and opening page_sequence + tags -->
12115
12297
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'pagebreak'][not(following-sibling::*[1][local-name() = 'pagebreak'])]" mode="update_xml_step_move_pagebreak">
12116
-
12298
+ <xsl:param name="page_sequence_at_top"/>
12117
12299
  <!-- <xsl:choose>
12118
12300
  <xsl:when test="ancestor::*[local-name() = 'sections']">
12119
12301
 
@@ -12137,7 +12319,9 @@
12137
12319
  <xsl:variable name="orientation" select="normalize-space(@orientation)"/>
12138
12320
 
12139
12321
  <xsl:variable name="tree_">
12140
- <xsl:call-template name="makeAncestorsElementsTree"/>
12322
+ <xsl:call-template name="makeAncestorsElementsTree">
12323
+ <xsl:with-param name="page_sequence_at_top" select="$page_sequence_at_top"/>
12324
+ </xsl:call-template>
12141
12325
  </xsl:variable>
12142
12326
  <xsl:variable name="tree" select="xalan:nodeset($tree_)"/>
12143
12327
 
@@ -12159,12 +12343,26 @@
12159
12343
  </xsl:template>
12160
12344
 
12161
12345
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="makeAncestorsElementsTree">
12162
- <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12163
- <element pos="{position()}">
12164
- <xsl:copy-of select="@*[local-name() != 'id']"/>
12165
- <xsl:value-of select="name()"/>
12166
- </element>
12167
- </xsl:for-each>
12346
+ <xsl:param name="page_sequence_at_top"/>
12347
+
12348
+ <xsl:choose>
12349
+ <xsl:when test="$page_sequence_at_top = 'true'">
12350
+ <xsl:for-each select="ancestor::*[ancestor::*[contains(local-name(), '-standard')]]">
12351
+ <element pos="{position()}">
12352
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
12353
+ <xsl:value-of select="name()"/>
12354
+ </element>
12355
+ </xsl:for-each>
12356
+ </xsl:when>
12357
+ <xsl:otherwise>
12358
+ <xsl:for-each select="ancestor::*[ancestor::*[local-name() = 'preface'] or ancestor::*[local-name() = 'sections'] or ancestor-or-self::*[local-name() = 'annex']]">
12359
+ <element pos="{position()}">
12360
+ <xsl:copy-of select="@*[local-name() != 'id']"/>
12361
+ <xsl:value-of select="name()"/>
12362
+ </element>
12363
+ </xsl:for-each>
12364
+ </xsl:otherwise>
12365
+ </xsl:choose>
12168
12366
  </xsl:template>
12169
12367
 
12170
12368
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="insertClosingElements">
@@ -12202,11 +12400,14 @@
12202
12400
 
12203
12401
  <!-- move full page width figures, tables at top level -->
12204
12402
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'figure' or local-name() = 'table'][normalize-space(@width) != 'text-width']" mode="update_xml_step_move_pagebreak">
12403
+ <xsl:param name="page_sequence_at_top">false</xsl:param>
12205
12404
  <xsl:choose>
12206
12405
  <xsl:when test="$layout_columns != 1">
12207
12406
 
12208
12407
  <xsl:variable name="tree_">
12209
- <xsl:call-template name="makeAncestorsElementsTree"/>
12408
+ <xsl:call-template name="makeAncestorsElementsTree">
12409
+ <xsl:with-param name="page_sequence_at_top" select="$page_sequence_at_top"/>
12410
+ </xsl:call-template>
12210
12411
  </xsl:variable>
12211
12412
  <xsl:variable name="tree" select="xalan:nodeset($tree_)"/>
12212
12413
 
@@ -12354,81 +12555,140 @@
12354
12555
 
12355
12556
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="express_reference_separators">_.\</xsl:variable>
12356
12557
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/>
12558
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="regex_express_reference">(^([A-Za-z0-9_.\\]+)$)</xsl:variable>
12357
12559
 
12358
12560
  <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
12561
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12562
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12359
12563
 
12360
- <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" 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.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
12564
+ <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
12565
+ <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
12566
+ <!-- add &lt; and &gt; to \S -->
12567
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
12568
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
12361
12569
 
12362
- <!-- enclose standard's number into tag 'keep-together_within-line' -->
12363
- <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12364
- <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
12365
- <xsl:variable name="text__" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
12366
- <xsl:variable name="text_">
12367
- <xsl:choose>
12368
- <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
12369
- <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
12370
- </xsl:choose>
12371
- </xsl:variable>
12372
- <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
12570
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
12571
+ <xsl:variable xmlns:redirect="http://xml.apache.org/xalan/redirect" 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>
12572
+
12573
+ <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" 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">
12574
+
12575
+ <xsl:variable name="parent" select="local-name(..)"/>
12576
+
12577
+ <xsl:if test="1 = 2"> <!-- alternative variant -->
12578
+
12579
+ <xsl:variable name="regexs">
12580
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
12581
+ <xsl:if test="not(ancestor::*[local-name() = 'table'])"><regex><xsl:value-of select="$regex_standard_reference"/></regex></xsl:if>
12582
+ <!-- if EXPRESS reference -->
12583
+
12584
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
12585
+ <regex><xsl:value-of select="$regex_solidus_units"/></regex>
12586
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
12587
+ <xsl:if test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
12588
+ <regex><xsl:value-of select="$regex_dots_units"/></regex>
12589
+ </xsl:if>
12590
+ </xsl:variable>
12591
+
12592
+ <xsl:variable name="regex_replacement"><xsl:text>(</xsl:text>
12593
+ <xsl:for-each select="xalan:nodeset($regexs)/regex">
12594
+ <xsl:value-of select="."/>
12595
+ <xsl:if test="position() != last()">|</xsl:if>
12596
+ </xsl:for-each>
12597
+ <xsl:text>)</xsl:text>
12598
+ </xsl:variable>
12599
+
12600
+ <!-- regex_replacement='<xsl:value-of select="$regex_replacement"/>' -->
12601
+
12602
+ <xsl:variable name="text_replaced" select="java:replaceAll(java:java.lang.String.new(.), $regex_replacement, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
12603
+
12604
+ <!-- text_replaced='<xsl:value-of select="$text_replaced"/>' -->
12605
+
12606
+ <xsl:call-template name="replace_text_tags">
12373
12607
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
12374
12608
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
12375
- <xsl:with-param name="text" select="$text_"/>
12376
- </xsl:call-template></text></xsl:variable>
12609
+ <xsl:with-param name="text" select="$text_replaced"/>
12610
+ </xsl:call-template>
12611
+ </xsl:if>
12377
12612
 
12378
- <xsl:variable name="parent" select="local-name(..)"/>
12613
+ <xsl:if test="1 = 1">
12614
+
12615
+ <!-- enclose standard's number into tag 'keep-together_within-line' -->
12616
+ <xsl:variable name="text">
12617
+ <xsl:element name="text" namespace="{$namespace_full}">
12618
+ <xsl:choose>
12619
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
12620
+ <xsl:otherwise>
12621
+ <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
12622
+ <!-- <xsl:value-of select="$text__"/> -->
12623
+
12624
+ <xsl:call-template name="replace_text_tags">
12625
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
12626
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
12627
+ <xsl:with-param name="text" select="$text_"/>
12628
+ </xsl:call-template>
12629
+
12630
+ </xsl:otherwise>
12631
+ </xsl:choose>
12632
+ </xsl:element>
12633
+ </xsl:variable>
12379
12634
 
12380
12635
  <xsl:variable name="text2">
12381
- <text><xsl:for-each select="xalan:nodeset($text)/text/node()">
12636
+ <xsl:element name="text" namespace="{$namespace_full}">
12637
+ <xsl:for-each select="xalan:nodeset($text)/*[local-name() = 'text']/node()">
12382
12638
  <xsl:copy-of select="."/>
12383
- </xsl:for-each></text>
12639
+ </xsl:for-each>
12640
+ </xsl:element>
12384
12641
  </xsl:variable>
12385
12642
 
12386
12643
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
12387
- <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
12388
- <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
12389
- <!-- add &lt; and &gt; to \S -->
12390
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
12391
- <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
12392
12644
  <xsl:variable name="text3">
12393
- <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
12394
- <xsl:choose>
12395
- <xsl:when test="self::text()">
12396
- <xsl:variable name="text_units_" select="java:replaceAll(java:java.lang.String.new(.),$regex_solidus_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
12397
- <xsl:variable name="text_units"><text><xsl:call-template name="replace_text_tags">
12398
- <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
12399
- <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
12400
- <xsl:with-param name="text" select="$text_units_"/>
12401
- </xsl:call-template></text></xsl:variable>
12402
- <xsl:copy-of select="xalan:nodeset($text_units)/text/node()"/>
12403
- </xsl:when>
12404
- <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
12405
- </xsl:choose>
12406
- </xsl:for-each></text>
12645
+ <xsl:element name="text" namespace="{$namespace_full}">
12646
+ <xsl:for-each select="xalan:nodeset($text2)/*[local-name() = 'text']/node()">
12647
+ <xsl:choose>
12648
+ <xsl:when test="self::text()">
12649
+ <xsl:variable name="text_units" select="java:replaceAll(java:java.lang.String.new(.),$regex_solidus_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
12650
+ <!-- <xsl:variable name="text_units">
12651
+ <xsl:element name="text" namespace="{$namespace_full}"> -->
12652
+ <xsl:call-template name="replace_text_tags">
12653
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
12654
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
12655
+ <xsl:with-param name="text" select="$text_units"/>
12656
+ </xsl:call-template>
12657
+ <!-- </xsl:element>
12658
+ </xsl:variable>
12659
+ <xsl:copy-of select="xalan:nodeset($text_units)/*[local-name() = 'text']/node()"/> -->
12660
+ </xsl:when>
12661
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
12662
+ </xsl:choose>
12663
+ </xsl:for-each>
12664
+ </xsl:element>
12407
12665
  </xsl:variable>
12408
12666
 
12409
12667
  <xsl:choose>
12410
12668
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
12411
12669
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
12412
- <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
12413
- <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>
12414
- <xsl:for-each select="xalan:nodeset($text3)/text/node()">
12670
+ <xsl:for-each select="xalan:nodeset($text3)/*[local-name() = 'text']/node()">
12415
12671
  <xsl:choose>
12416
12672
  <xsl:when test="self::text()">
12417
- <xsl:variable name="text_dots_" select="java:replaceAll(java:java.lang.String.new(.),$regex_dots_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
12418
- <xsl:variable name="text_dots"><text><xsl:call-template name="replace_text_tags">
12419
- <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
12420
- <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
12421
- <xsl:with-param name="text" select="$text_dots_"/>
12422
- </xsl:call-template></text></xsl:variable>
12423
- <xsl:copy-of select="xalan:nodeset($text_dots)/text/node()"/>
12673
+ <xsl:variable name="text_dots" select="java:replaceAll(java:java.lang.String.new(.),$regex_dots_units,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
12674
+ <!-- <xsl:variable name="text_dots">
12675
+ <xsl:element name="text" namespace="{$namespace_full}"> -->
12676
+ <xsl:call-template name="replace_text_tags">
12677
+ <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
12678
+ <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
12679
+ <xsl:with-param name="text" select="$text_dots"/>
12680
+ </xsl:call-template>
12681
+ <!-- </xsl:element>
12682
+ </xsl:variable>
12683
+ <xsl:copy-of select="xalan:nodeset($text_dots)/*[local-name() = 'text']/node()"/> -->
12424
12684
  </xsl:when>
12425
12685
  <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> <!-- copy 'as-is' for <fo:inline keep-together.within-line="always" ... -->
12426
12686
  </xsl:choose>
12427
12687
  </xsl:for-each>
12428
12688
  </xsl:when>
12429
- <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/text/node()"/></xsl:otherwise>
12689
+ <xsl:otherwise><xsl:copy-of select="xalan:nodeset($text3)/*[local-name() = 'text']/node()"/></xsl:otherwise>
12430
12690
  </xsl:choose>
12431
-
12691
+ </xsl:if>
12432
12692
  </xsl:template>
12433
12693
 
12434
12694
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" match="*[local-name() = 'stem'] | *[local-name() = 'image']" mode="update_xml_enclose_keep-together_within-line">
@@ -12954,6 +13214,15 @@
12954
13214
  </xsl:otherwise>
12955
13215
  </xsl:choose>
12956
13216
  </xsl:for-each>
13217
+ <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13218
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13219
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13220
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13221
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
13222
+ <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
13223
+ <pdf:embedded-file src="{$url}" filename="{$filename_embedded}"/>
13224
+ </xsl:for-each>
13225
+ </xsl:if>
12957
13226
  </xsl:template> <!-- addPDFUAmeta -->
12958
13227
 
12959
13228
  <xsl:template xmlns:redirect="http://xml.apache.org/xalan/redirect" name="getId">
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.2.10".freeze
3
+ VERSION = "0.2.12".freeze
4
4
  end
5
5
  end
6
6
 
@@ -28,10 +28,10 @@ Gem::Specification.new do |spec|
28
28
  || f.match(%r{Rakefile|bin/rspec})
29
29
  end
30
30
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
31
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
31
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
32
32
 
33
33
  spec.add_dependency "japanese_calendar", "~> 0"
34
- spec.add_dependency "metanorma-iso", "~> 2.7.3"
34
+ spec.add_dependency "metanorma-iso", "~> 2.8.0"
35
35
  spec.add_dependency "pubid"
36
36
 
37
37
  spec.add_development_dependency "debug"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-17 00:00:00.000000000 Z
11
+ date: 2024-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: japanese_calendar
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.7.3
33
+ version: 2.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.7.3
40
+ version: 2.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pubid
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -313,7 +313,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
313
313
  requirements:
314
314
  - - ">="
315
315
  - !ruby/object:Gem::Version
316
- version: 2.7.0
316
+ version: 3.1.0
317
317
  required_rubygems_version: !ruby/object:Gem::Requirement
318
318
  requirements:
319
319
  - - ">="