lib/isodoc/cc/cc.standard.xsl in metanorma-cc-2.4.2 vs lib/isodoc/cc/cc.standard.xsl in metanorma-cc-2.4.3
- old
+ new
@@ -584,10 +584,12 @@
<!-- external parameters -->
<xsl:param name="svg_images"/> <!-- svg images array -->
<xsl:variable name="images" select="document($svg_images)"/>
<xsl:param name="basepath"/> <!-- base path for images -->
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
<xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
<xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
<xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
<xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
@@ -636,10 +638,24 @@
<xsl:variable name="lang">
<xsl:call-template name="getLang"/>
</xsl:variable>
+ <xsl:variable name="inputxml_filename_prefix">
+ <xsl:choose>
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
+ </xsl:when>
+ <xsl:when test="contains($inputxml_filename, '.xml')">
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$inputxml_filename"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
<!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
You can put such conditions by using xslt construction `xsl:if test="..."` or <xsl:choose><xsl:when test=""></xsl:when><xsl:otherwiste></xsl:otherwiste></xsl:choose>,
BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
<!--
@@ -1533,10 +1549,14 @@
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_figure-block-style">
+
+ </xsl:template>
+
<xsl:attribute-set name="figure-style">
</xsl:attribute-set>
<xsl:attribute-set name="figure-name-style">
@@ -2428,11 +2448,11 @@
<xsl:call-template name="table_name_fn_display"/>
<xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
<xsl:variable name="colwidths">
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
<xsl:call-template name="calculate-column-widths">
<xsl:with-param name="cols-count" select="$cols-count"/>
<xsl:with-param name="table" select="$simple-table"/>
</xsl:call-template>
</xsl:if>
@@ -2540,10 +2560,15 @@
<xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
<xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
<fo:table-column column-width="{@width}"/>
</xsl:for-each>
</xsl:when>
+ <xsl:when test="@class = 'dl'">
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
+ <fo:table-column column-width="{@width}"/>
+ </xsl:for-each>
+ </xsl:when>
<xsl:otherwise>
<xsl:call-template name="insertTableColumnWidth">
<xsl:with-param name="colwidths" select="$colwidths"/>
</xsl:call-template>
</xsl:otherwise>
@@ -3815,10 +3840,11 @@
<!-- ===================== -->
<!-- ===================== -->
<!-- Definition List -->
<!-- ===================== -->
+
<xsl:template match="*[local-name()='dl']">
<xsl:variable name="isAdded" select="@added"/>
<xsl:variable name="isDeleted" select="@deleted"/>
<!-- <dl><xsl:copy-of select="."/></dl> -->
<fo:block-container xsl:use-attribute-sets="dl-block-style" role="SKIP">
@@ -4027,14 +4053,25 @@
<xsl:copy-of select="$dl_table"/>
</xsl:variable>
<xsl:variable name="colwidths">
- <xsl:call-template name="calculate-column-widths">
- <xsl:with-param name="cols-count" select="2"/>
- <xsl:with-param name="table" select="$simple-table"/>
- </xsl:call-template>
+ <xsl:choose>
+ <!-- dl from table[@class='dl'] -->
+ <xsl:when test="*[local-name() = 'colgroup']">
+ <autolayout/>
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="calculate-column-widths">
+ <xsl:with-param name="cols-count" select="2"/>
+ <xsl:with-param name="table" select="$simple-table"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:variable>
<!-- <xsl:text disable-output-escaping="yes"><!- -</xsl:text>
DEBUG
colwidths=<xsl:copy-of select="$colwidths"/>
@@ -6127,10 +6164,16 @@
<xsl:variable name="target">
<xsl:choose>
<xsl:when test="@updatetype = 'true'">
<xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
</xsl:when>
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
+ <!-- link to the PDF attachment -->
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
+ </xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(@target)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@@ -6532,10 +6575,11 @@
<xsl:template match="*[local-name() = 'figure']" name="figure">
<xsl:variable name="isAdded" select="@added"/>
<xsl:variable name="isDeleted" select="@deleted"/>
<fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
+ <xsl:call-template name="refine_figure-block-style"/>
<xsl:call-template name="setTrackChangesStyles">
<xsl:with-param name="isAdded" select="$isAdded"/>
<xsl:with-param name="isDeleted" select="$isDeleted"/>
</xsl:call-template>
@@ -10900,14 +10944,14 @@
</xsl:choose>
</xsl:template>
<xsl:template name="addPDFUAmeta">
<pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
- <pdf:dictionary type="normal" key="ViewerPreferences">
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
- </pdf:dictionary>
- </pdf:catalog>
+ <pdf:dictionary type="normal" key="ViewerPreferences">
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
+ </pdf:dictionary>
+ </pdf:catalog>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
<!-- Dublin Core properties go here -->
<dc:title>
@@ -10955,9 +10999,22 @@
<!-- XMP properties go here -->
<xmp:CreatorTool/>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
+ <!-- add attachments -->
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
+ <xsl:choose>
+ <xsl:when test="normalize-space() != ''">
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- _{filename}_attachments -->
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
</xsl:template> <!-- addPDFUAmeta -->
<xsl:template name="getId">
<xsl:choose>
<xsl:when test="../@id">
\ No newline at end of file