lib/isodoc/cc/cc.standard.xsl in metanorma-cc-2.4.12 vs lib/isodoc/cc/cc.standard.xsl in metanorma-cc-2.5.0

- old
+ new

@@ -2443,17 +2443,39 @@ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/> </xsl:element> </xsl:for-each> </xsl:element> - <xsl:call-template name="insertAnnexInSeparatePageSequences"/> + <xsl:call-template name="insertAnnexAndBibliographyInSeparatePageSequences"/> - <xsl:call-template name="insertBibliographyInSeparatePageSequences"/> + <!-- <xsl:call-template name="insertBibliographyInSeparatePageSequences"/> --> <!-- <xsl:call-template name="insertIndexInSeparatePageSequences"/> --> </xsl:template> <!-- END: insertMainSectionsInSeparatePageSequences --> + <xsl:template name="insertAnnexAndBibliographyInSeparatePageSequences"> + <xsl:for-each select="/*/*[local-name()='annex'] | /*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]] | /*/*[local-name()='indexsect']"> + <xsl:sort select="@displayorder" data-type="number"/> + <xsl:choose> + <xsl:when test="local-name() = 'annex' or local-name() = 'indexsect'"> + <xsl:element name="page_sequence" namespace="{$namespace_full}"> + <xsl:attribute name="main_page_sequence"/> + <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/> + </xsl:element> + </xsl:when> + <xsl:otherwise> <!-- bibliography --> + <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element --> + <xsl:element name="page_sequence" namespace="{$namespace_full}"> + <xsl:attribute name="main_page_sequence"/> + <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/> + </xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:template> + <xsl:template name="insertAnnexInSeparatePageSequences"> <xsl:for-each select="/*/*[local-name()='annex']"> <xsl:sort select="@displayorder" data-type="number"/> <xsl:element name="page_sequence" namespace="{$namespace_full}"> <xsl:attribute name="main_page_sequence"/> @@ -11263,14 +11285,16 @@ </xsl:template> <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1"> <xsl:copy> <xsl:copy-of select="@*"/> - <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/> - <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/> - <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist --> - <xsl:value-of select="."/> + <xsl:if test="1 = 2"> <!-- remove attachment/text(), because attachments added in the template 'addPDFUAmeta' before applying 'update_xml_step1' --> + <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/> + <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/> + <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist --> + <xsl:value-of select="normalize-space(.)"/> + </xsl:if> </xsl:if> </xsl:copy> </xsl:template> <!-- add @id, mandatory for table auto-layout algorithm --> @@ -12141,10 +12165,11 @@ </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:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks --> + <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$src_attachment}" filename="{@name}"/> </xsl:when> <xsl:otherwise> <!-- _{filename}_attachments --> <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> --> <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/> \ No newline at end of file