metanorma-itu 2.5.1 → 2.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -8880,6 +8880,12 @@
8880
8880
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8881
8881
  <attachment filename="{@name}"/>
8882
8882
  </xsl:for-each>
8883
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
8884
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
8885
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
8886
+ <attachment filename="{$attachment_path}"/>
8887
+ </xsl:for-each>
8888
+ </xsl:if>
8883
8889
  </xsl:variable>
8884
8890
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8885
8891
 
@@ -8892,7 +8898,7 @@
8892
8898
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8893
8899
  </xsl:when>
8894
8900
  <!-- link to the PDF attachment -->
8895
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8901
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8896
8902
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8897
8903
  </xsl:when>
8898
8904
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -9547,7 +9553,16 @@
9547
9553
  </xsl:variable>
9548
9554
  <xsl:variable name="img_src">
9549
9555
  <xsl:choose>
9550
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
9556
+ <xsl:when test="not(starts-with(@src, 'data:'))">
9557
+ <xsl:choose>
9558
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9559
+ <xsl:value-of select="@src"/>
9560
+ </xsl:when>
9561
+ <xsl:otherwise>
9562
+ <xsl:value-of select="concat($basepath, @src)"/>
9563
+ </xsl:otherwise>
9564
+ </xsl:choose>
9565
+ </xsl:when>
9551
9566
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9552
9567
  </xsl:choose>
9553
9568
  </xsl:variable>
@@ -9560,7 +9575,7 @@
9560
9575
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
9561
9576
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
9562
9577
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
9563
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9578
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9564
9579
  <xsl:value-of select="$scale"/>
9565
9580
  </xsl:template>
9566
9581
 
@@ -9579,7 +9594,14 @@
9579
9594
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
9580
9595
  </xsl:when>
9581
9596
  <xsl:when test="not(starts-with(@src, 'data:'))">
9582
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9597
+ <xsl:choose>
9598
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9599
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
9600
+ </xsl:when>
9601
+ <xsl:otherwise>
9602
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9603
+ </xsl:otherwise>
9604
+ </xsl:choose>
9583
9605
  </xsl:when>
9584
9606
  <xsl:otherwise>
9585
9607
  <xsl:value-of select="@src"/>
@@ -9601,7 +9623,14 @@
9601
9623
  </xsl:when>
9602
9624
  <xsl:when test="not(starts-with(@src, 'data:'))">
9603
9625
  <xsl:variable name="src">
9604
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9626
+ <xsl:choose>
9627
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9628
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
9629
+ </xsl:when>
9630
+ <xsl:otherwise>
9631
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9632
+ </xsl:otherwise>
9633
+ </xsl:choose>
9605
9634
  </xsl:variable>
9606
9635
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
9607
9636
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -14366,6 +14395,39 @@
14366
14395
  </pdf:catalog>
14367
14396
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14368
14397
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14398
+ <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="">
14399
+ <pdfaExtension:schemas>
14400
+ <rdf:Bag>
14401
+ <rdf:li rdf:parseType="Resource">
14402
+ <pdfaSchema:namespaceURI>http://www.aiim.org/pdfua/ns/id/</pdfaSchema:namespaceURI>
14403
+ <pdfaSchema:prefix>pdfuaid</pdfaSchema:prefix>
14404
+ <pdfaSchema:schema>PDF/UA identification schema</pdfaSchema:schema>
14405
+ <pdfaSchema:property>
14406
+ <rdf:Seq>
14407
+ <rdf:li rdf:parseType="Resource">
14408
+ <pdfaProperty:category>internal</pdfaProperty:category>
14409
+ <pdfaProperty:description>PDF/UA version identifier</pdfaProperty:description>
14410
+ <pdfaProperty:name>part</pdfaProperty:name>
14411
+ <pdfaProperty:valueType>Integer</pdfaProperty:valueType>
14412
+ </rdf:li>
14413
+ <rdf:li rdf:parseType="Resource">
14414
+ <pdfaProperty:category>internal</pdfaProperty:category>
14415
+ <pdfaProperty:description>PDF/UA amendment identifier</pdfaProperty:description>
14416
+ <pdfaProperty:name>amd</pdfaProperty:name>
14417
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
14418
+ </rdf:li>
14419
+ <rdf:li rdf:parseType="Resource">
14420
+ <pdfaProperty:category>internal</pdfaProperty:category>
14421
+ <pdfaProperty:description>PDF/UA corrigenda identifier</pdfaProperty:description>
14422
+ <pdfaProperty:name>corr</pdfaProperty:name>
14423
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
14424
+ </rdf:li>
14425
+ </rdf:Seq>
14426
+ </pdfaSchema:property>
14427
+ </rdf:li>
14428
+ </rdf:Bag>
14429
+ </pdfaExtension:schemas>
14430
+ </rdf:Description>
14369
14431
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
14370
14432
  <!-- Dublin Core properties go here -->
14371
14433
  <dc:title>
@@ -14376,33 +14438,57 @@
14376
14438
 
14377
14439
  </xsl:for-each>
14378
14440
  </xsl:variable>
14379
- <xsl:choose>
14380
- <xsl:when test="normalize-space($title) != ''">
14381
- <xsl:value-of select="$title"/>
14382
- </xsl:when>
14383
- <xsl:otherwise>
14384
- <xsl:text> </xsl:text>
14385
- </xsl:otherwise>
14386
- </xsl:choose>
14441
+ <rdf:Alt>
14442
+ <rdf:li xml:lang="x-default">
14443
+ <xsl:choose>
14444
+ <xsl:when test="normalize-space($title) != ''">
14445
+ <xsl:value-of select="$title"/>
14446
+ </xsl:when>
14447
+ <xsl:otherwise>
14448
+ <xsl:text> </xsl:text>
14449
+ </xsl:otherwise>
14450
+ </xsl:choose>
14451
+ </rdf:li>
14452
+ </rdf:Alt>
14387
14453
  </dc:title>
14388
- <dc:creator>
14454
+ <xsl:variable name="dc_creator">
14389
14455
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
14390
14456
 
14391
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
14392
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
14393
- <xsl:if test="position() != last()">; </xsl:if>
14394
- </xsl:for-each>
14457
+ <rdf:Seq>
14458
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
14459
+ <rdf:li>
14460
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
14461
+ </rdf:li>
14462
+ <!-- <xsl:if test="position() != last()">; </xsl:if> -->
14463
+ </xsl:for-each>
14464
+ </rdf:Seq>
14395
14465
 
14396
14466
  </xsl:for-each>
14397
- </dc:creator>
14398
- <dc:description>
14467
+ </xsl:variable>
14468
+ <xsl:if test="normalize-space($dc_creator) != ''">
14469
+ <dc:creator>
14470
+ <xsl:copy-of select="$dc_creator"/>
14471
+ </dc:creator>
14472
+ </xsl:if>
14473
+
14474
+ <xsl:variable name="dc_description">
14399
14475
  <xsl:variable name="abstract">
14400
14476
 
14401
14477
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
14402
14478
 
14403
14479
  </xsl:variable>
14404
- <xsl:value-of select="normalize-space($abstract)"/>
14405
- </dc:description>
14480
+ <rdf:Alt>
14481
+ <rdf:li xml:lang="x-default">
14482
+ <xsl:value-of select="normalize-space($abstract)"/>
14483
+ </rdf:li>
14484
+ </rdf:Alt>
14485
+ </xsl:variable>
14486
+ <xsl:if test="normalize-space($dc_description)">
14487
+ <dc:description>
14488
+ <xsl:copy-of select="$dc_description"/>
14489
+ </dc:description>
14490
+ </xsl:if>
14491
+
14406
14492
  <pdf:Keywords>
14407
14493
  <xsl:call-template name="insertKeywords">
14408
14494
  <xsl:with-param name="meta">true</xsl:with-param>
@@ -14417,26 +14503,37 @@
14417
14503
  </x:xmpmeta>
14418
14504
  <!-- add attachments -->
14419
14505
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14420
- <xsl:choose>
14421
- <xsl:when test="normalize-space() != ''">
14422
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
14423
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$src_attachment}" filename="{@name}"/>
14424
- </xsl:when>
14425
- <xsl:otherwise>
14426
- <!-- _{filename}_attachments -->
14427
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14428
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14429
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14430
- </xsl:otherwise>
14431
- </xsl:choose>
14506
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
14507
+
14508
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
14509
+ <xsl:attribute name="src">
14510
+ <xsl:choose>
14511
+ <xsl:when test="normalize-space() != ''">
14512
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
14513
+ <xsl:value-of select="$src_attachment"/>
14514
+ </xsl:when>
14515
+ <xsl:otherwise>
14516
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14517
+ <xsl:value-of select="$url"/>
14518
+ </xsl:otherwise>
14519
+ </xsl:choose>
14520
+ </xsl:attribute>
14521
+ <xsl:if test="$description != ''">
14522
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14523
+ </xsl:if>
14524
+ </pdf:embedded-file>
14432
14525
  </xsl:for-each>
14433
14526
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
14434
14527
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
14435
14528
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
14436
14529
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
14437
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
14438
- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
14439
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$filename_embedded}"/>
14530
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14531
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14532
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
14533
+ <xsl:if test="$description != ''">
14534
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14535
+ </xsl:if>
14536
+ </pdf:embedded-file>
14440
14537
  </xsl:for-each>
14441
14538
  </xsl:if>
14442
14539
  </xsl:template> <!-- addPDFUAmeta -->
@@ -14814,7 +14911,14 @@
14814
14911
  <xsl:value-of select="$src"/>
14815
14912
  </xsl:when>
14816
14913
  <xsl:otherwise>
14817
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14914
+ <xsl:choose>
14915
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
14916
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
14917
+ </xsl:when>
14918
+ <xsl:otherwise>
14919
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14920
+ </xsl:otherwise>
14921
+ </xsl:choose>
14818
14922
  </xsl:otherwise>
14819
14923
  </xsl:choose>
14820
14924
  </xsl:template>
@@ -8880,6 +8880,12 @@
8880
8880
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8881
8881
  <attachment filename="{@name}"/>
8882
8882
  </xsl:for-each>
8883
+ <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
8884
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
8885
+ <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
8886
+ <attachment filename="{$attachment_path}"/>
8887
+ </xsl:for-each>
8888
+ </xsl:if>
8883
8889
  </xsl:variable>
8884
8890
  <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8885
8891
 
@@ -8892,7 +8898,7 @@
8892
8898
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8893
8899
  </xsl:when>
8894
8900
  <!-- link to the PDF attachment -->
8895
- <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8901
+ <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8896
8902
  <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8897
8903
  </xsl:when>
8898
8904
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
@@ -9547,7 +9553,16 @@
9547
9553
  </xsl:variable>
9548
9554
  <xsl:variable name="img_src">
9549
9555
  <xsl:choose>
9550
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
9556
+ <xsl:when test="not(starts-with(@src, 'data:'))">
9557
+ <xsl:choose>
9558
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9559
+ <xsl:value-of select="@src"/>
9560
+ </xsl:when>
9561
+ <xsl:otherwise>
9562
+ <xsl:value-of select="concat($basepath, @src)"/>
9563
+ </xsl:otherwise>
9564
+ </xsl:choose>
9565
+ </xsl:when>
9551
9566
  <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
9552
9567
  </xsl:choose>
9553
9568
  </xsl:variable>
@@ -9560,7 +9575,7 @@
9560
9575
  <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
9561
9576
  <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
9562
9577
  <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
9563
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9578
+ <xsl:variable name="scale" select="java:org.metanorma.fop.utils.ImageUtils.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9564
9579
  <xsl:value-of select="$scale"/>
9565
9580
  </xsl:template>
9566
9581
 
@@ -9579,7 +9594,14 @@
9579
9594
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
9580
9595
  </xsl:when>
9581
9596
  <xsl:when test="not(starts-with(@src, 'data:'))">
9582
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9597
+ <xsl:choose>
9598
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9599
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
9600
+ </xsl:when>
9601
+ <xsl:otherwise>
9602
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9603
+ </xsl:otherwise>
9604
+ </xsl:choose>
9583
9605
  </xsl:when>
9584
9606
  <xsl:otherwise>
9585
9607
  <xsl:value-of select="@src"/>
@@ -9601,7 +9623,14 @@
9601
9623
  </xsl:when>
9602
9624
  <xsl:when test="not(starts-with(@src, 'data:'))">
9603
9625
  <xsl:variable name="src">
9604
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9626
+ <xsl:choose>
9627
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
9628
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
9629
+ </xsl:when>
9630
+ <xsl:otherwise>
9631
+ <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
9632
+ </xsl:otherwise>
9633
+ </xsl:choose>
9605
9634
  </xsl:variable>
9606
9635
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
9607
9636
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
@@ -14366,6 +14395,39 @@
14366
14395
  </pdf:catalog>
14367
14396
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
14368
14397
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
14398
+ <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="">
14399
+ <pdfaExtension:schemas>
14400
+ <rdf:Bag>
14401
+ <rdf:li rdf:parseType="Resource">
14402
+ <pdfaSchema:namespaceURI>http://www.aiim.org/pdfua/ns/id/</pdfaSchema:namespaceURI>
14403
+ <pdfaSchema:prefix>pdfuaid</pdfaSchema:prefix>
14404
+ <pdfaSchema:schema>PDF/UA identification schema</pdfaSchema:schema>
14405
+ <pdfaSchema:property>
14406
+ <rdf:Seq>
14407
+ <rdf:li rdf:parseType="Resource">
14408
+ <pdfaProperty:category>internal</pdfaProperty:category>
14409
+ <pdfaProperty:description>PDF/UA version identifier</pdfaProperty:description>
14410
+ <pdfaProperty:name>part</pdfaProperty:name>
14411
+ <pdfaProperty:valueType>Integer</pdfaProperty:valueType>
14412
+ </rdf:li>
14413
+ <rdf:li rdf:parseType="Resource">
14414
+ <pdfaProperty:category>internal</pdfaProperty:category>
14415
+ <pdfaProperty:description>PDF/UA amendment identifier</pdfaProperty:description>
14416
+ <pdfaProperty:name>amd</pdfaProperty:name>
14417
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
14418
+ </rdf:li>
14419
+ <rdf:li rdf:parseType="Resource">
14420
+ <pdfaProperty:category>internal</pdfaProperty:category>
14421
+ <pdfaProperty:description>PDF/UA corrigenda identifier</pdfaProperty:description>
14422
+ <pdfaProperty:name>corr</pdfaProperty:name>
14423
+ <pdfaProperty:valueType>Text</pdfaProperty:valueType>
14424
+ </rdf:li>
14425
+ </rdf:Seq>
14426
+ </pdfaSchema:property>
14427
+ </rdf:li>
14428
+ </rdf:Bag>
14429
+ </pdfaExtension:schemas>
14430
+ </rdf:Description>
14369
14431
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
14370
14432
  <!-- Dublin Core properties go here -->
14371
14433
  <dc:title>
@@ -14376,33 +14438,57 @@
14376
14438
 
14377
14439
  </xsl:for-each>
14378
14440
  </xsl:variable>
14379
- <xsl:choose>
14380
- <xsl:when test="normalize-space($title) != ''">
14381
- <xsl:value-of select="$title"/>
14382
- </xsl:when>
14383
- <xsl:otherwise>
14384
- <xsl:text> </xsl:text>
14385
- </xsl:otherwise>
14386
- </xsl:choose>
14441
+ <rdf:Alt>
14442
+ <rdf:li xml:lang="x-default">
14443
+ <xsl:choose>
14444
+ <xsl:when test="normalize-space($title) != ''">
14445
+ <xsl:value-of select="$title"/>
14446
+ </xsl:when>
14447
+ <xsl:otherwise>
14448
+ <xsl:text> </xsl:text>
14449
+ </xsl:otherwise>
14450
+ </xsl:choose>
14451
+ </rdf:li>
14452
+ </rdf:Alt>
14387
14453
  </dc:title>
14388
- <dc:creator>
14454
+ <xsl:variable name="dc_creator">
14389
14455
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
14390
14456
 
14391
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
14392
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
14393
- <xsl:if test="position() != last()">; </xsl:if>
14394
- </xsl:for-each>
14457
+ <rdf:Seq>
14458
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
14459
+ <rdf:li>
14460
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
14461
+ </rdf:li>
14462
+ <!-- <xsl:if test="position() != last()">; </xsl:if> -->
14463
+ </xsl:for-each>
14464
+ </rdf:Seq>
14395
14465
 
14396
14466
  </xsl:for-each>
14397
- </dc:creator>
14398
- <dc:description>
14467
+ </xsl:variable>
14468
+ <xsl:if test="normalize-space($dc_creator) != ''">
14469
+ <dc:creator>
14470
+ <xsl:copy-of select="$dc_creator"/>
14471
+ </dc:creator>
14472
+ </xsl:if>
14473
+
14474
+ <xsl:variable name="dc_description">
14399
14475
  <xsl:variable name="abstract">
14400
14476
 
14401
14477
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()[not(ancestor::*[local-name() = 'title'])]"/>
14402
14478
 
14403
14479
  </xsl:variable>
14404
- <xsl:value-of select="normalize-space($abstract)"/>
14405
- </dc:description>
14480
+ <rdf:Alt>
14481
+ <rdf:li xml:lang="x-default">
14482
+ <xsl:value-of select="normalize-space($abstract)"/>
14483
+ </rdf:li>
14484
+ </rdf:Alt>
14485
+ </xsl:variable>
14486
+ <xsl:if test="normalize-space($dc_description)">
14487
+ <dc:description>
14488
+ <xsl:copy-of select="$dc_description"/>
14489
+ </dc:description>
14490
+ </xsl:if>
14491
+
14406
14492
  <pdf:Keywords>
14407
14493
  <xsl:call-template name="insertKeywords">
14408
14494
  <xsl:with-param name="meta">true</xsl:with-param>
@@ -14417,26 +14503,37 @@
14417
14503
  </x:xmpmeta>
14418
14504
  <!-- add attachments -->
14419
14505
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14420
- <xsl:choose>
14421
- <xsl:when test="normalize-space() != ''">
14422
- <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
14423
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$src_attachment}" filename="{@name}"/>
14424
- </xsl:when>
14425
- <xsl:otherwise>
14426
- <!-- _{filename}_attachments -->
14427
- <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
14428
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14429
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
14430
- </xsl:otherwise>
14431
- </xsl:choose>
14506
+ <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
14507
+
14508
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
14509
+ <xsl:attribute name="src">
14510
+ <xsl:choose>
14511
+ <xsl:when test="normalize-space() != ''">
14512
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
14513
+ <xsl:value-of select="$src_attachment"/>
14514
+ </xsl:when>
14515
+ <xsl:otherwise>
14516
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
14517
+ <xsl:value-of select="$url"/>
14518
+ </xsl:otherwise>
14519
+ </xsl:choose>
14520
+ </xsl:attribute>
14521
+ <xsl:if test="$description != ''">
14522
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14523
+ </xsl:if>
14524
+ </pdf:embedded-file>
14432
14525
  </xsl:for-each>
14433
14526
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
14434
14527
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
14435
14528
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
14436
14529
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
14437
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, $attachment_path, ')')"/>
14438
- <xsl:variable name="filename_embedded" select="substring-after($attachment_path, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
14439
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$filename_embedded}"/>
14530
+ <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14531
+ <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14532
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
14533
+ <xsl:if test="$description != ''">
14534
+ <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14535
+ </xsl:if>
14536
+ </pdf:embedded-file>
14440
14537
  </xsl:for-each>
14441
14538
  </xsl:if>
14442
14539
  </xsl:template> <!-- addPDFUAmeta -->
@@ -14814,7 +14911,14 @@
14814
14911
  <xsl:value-of select="$src"/>
14815
14912
  </xsl:when>
14816
14913
  <xsl:otherwise>
14817
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14914
+ <xsl:choose>
14915
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
14916
+ <xsl:value-of select="concat('url(file:///', @src, ')')"/>
14917
+ </xsl:when>
14918
+ <xsl:otherwise>
14919
+ <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14920
+ </xsl:otherwise>
14921
+ </xsl:choose>
14818
14922
  </xsl:otherwise>
14819
14923
  </xsl:choose>
14820
14924
  </xsl:template>