lib/isodoc/itu/itu.implementers-guide.xsl in metanorma-itu-2.5.4 vs lib/isodoc/itu/itu.implementers-guide.xsl in metanorma-itu-2.5.5
- old
+ new
@@ -6129,12 +6129,13 @@
<xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="current_fn_number_text">
- <xsl:value-of select="$current_fn_number"/>
+ <xsl:value-of select="$current_fn_number"/>
+
</xsl:variable>
<xsl:variable name="ref_id">
<xsl:choose>
<xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
@@ -6165,12 +6166,14 @@
<xsl:attribute name="padding-right">0.5mm</xsl:attribute>
</xsl:if>
<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
- <xsl:copy-of select="$current_fn_number_text"/>
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
+ <xsl:copy-of select="$current_fn_number_text"/>
+ </fo:inline>
</fo:basic-link>
</xsl:with-param>
</xsl:call-template>
</fo:inline>
</xsl:variable>
@@ -6453,11 +6456,11 @@
<xsl:template match="*[local-name()='fn']">
<fo:inline xsl:use-attribute-sets="fn-reference-style">
<xsl:call-template name="refine_fn-reference-style"/>
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
<xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
<xsl:attribute name="internal-destination">
<xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
</xsl:attribute>
</xsl:if>
@@ -7497,13 +7500,23 @@
<fo:inline background-color="yellow">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
+ <xsl:param name="txt"/>
<!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
- <xsl:variable name="text" select="."/>
+ <xsl:variable name="text">
+ <xsl:choose>
+ <xsl:when test="$txt != ''">
+ <xsl:value-of select="$txt"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<xsl:variable name="ratio_">
0.75
</xsl:variable>
<xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
<fo:inline font-size="{$ratio * 100}%" role="SKIP">
@@ -8945,13 +8958,16 @@
<xsl:choose>
<xsl:when test="$target_text = ''">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
+ <xsl:variable name="alt_text">
+ <xsl:call-template name="getAltText"/>
+ </xsl:variable>
<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
<xsl:if test="$isLinkToEmbeddedFile = 'true'">
<xsl:attribute name="role">Annot</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="normalize-space(.) = ''">
@@ -8974,10 +8990,18 @@
</xsl:otherwise>
</xsl:choose>
</fo:inline>
</xsl:template> <!-- link -->
+ <xsl:template name="getAltText">
+ <xsl:choose>
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
+ </xsl:choose>
+ </xsl:template>
+
<!-- ======================== -->
<!-- Appendix processing -->
<!-- ======================== -->
<xsl:template match="*[local-name()='appendix']">
<fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
@@ -9004,11 +9028,11 @@
</xsl:template>
<xsl:template match="*[local-name() = 'callout']">
<xsl:choose>
<xsl:when test="normalize-space(@target) = ''"><<xsl:apply-templates/>></xsl:when>
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}"><<xsl:apply-templates/>></fo:basic-link></xsl:otherwise>
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}"><<xsl:apply-templates/>></fo:basic-link></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*[local-name() = 'annotation']">
<xsl:variable name="annotation-id" select="@id"/>
@@ -9033,11 +9057,14 @@
</xsl:template>
<xsl:template match="*[local-name() = 'xref']">
<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
+ <xsl:variable name="alt_text">
+ <xsl:call-template name="getAltText"/>
+ </xsl:variable>
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
<xsl:if test="string-length(normalize-space()) < 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
</xsl:if>
<xsl:if test="parent::*[local-name() = 'add']">
<xsl:call-template name="append_add-style"/>
@@ -11521,16 +11548,18 @@
</fo:block-container>
</xsl:when> <!-- end block -->
<xsl:when test="contains(normalize-space($fo_element), 'list')">
- <xsl:variable name="provisional_distance_between_starts">
+ <xsl:variable name="provisional_distance_between_starts_">
7
</xsl:variable>
- <xsl:variable name="indent">
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
+ <xsl:variable name="indent_">
0
</xsl:variable>
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
<fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
<fo:list-item>
<fo:list-item-label start-indent="{$indent}mm" end-indent="label-end()">
<fo:block>
@@ -12258,18 +12287,21 @@
<xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
+ <xsl:variable name="type" select="../@type"/>
+
<xsl:variable name="label">
- <xsl:variable name="type" select="../@type"/>
-
<xsl:variable name="style_prefix_">
<xsl:if test="$type = 'roman'">
<!-- Example: (i) -->
</xsl:if>
+ <xsl:if test="$type = 'alphabet'">
+
+ </xsl:if>
</xsl:variable>
<xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
<xsl:variable name="style_suffix_">
<xsl:choose>
@@ -12291,17 +12323,19 @@
<xsl:variable name="style_suffix" select="normalize-space($style_suffix_)"/>
<xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
<xsl:value-of select="$style_prefix"/>
</xsl:if>
+
<xsl:value-of select="@label"/>
+
<xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
<xsl:value-of select="$style_suffix"/>
</xsl:if>
</xsl:variable>
- <xsl:value-of select="normalize-space($label)"/>
+ <xsl:value-of select="normalize-space($label)"/>
</xsl:when>
<xsl:otherwise> <!-- for ordered lists 'ol' -->
<!-- Example: for BSI <?list-start 2?> -->
@@ -14523,11 +14557,12 @@
<xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
<xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
<xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
<xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
<!-- Todo: need update -->
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
<pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="normalize-space() != ''">
@@ -14544,28 +14579,35 @@
<xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
</xsl:if>
<xsl:if test="$afrelationship != ''">
<xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
</xsl:if>
+ <xsl:if test="$volatile != ''">
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
+ </xsl:if>
</pdf:embedded-file>
</xsl:for-each>
<!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
<xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
<xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
<xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
<xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
<xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
<xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
<!-- Todo: need update -->
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
<pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
<xsl:if test="$description != ''">
<xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
</xsl:if>
<xsl:if test="$afrelationship != ''">
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
- </xsl:if>
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$volatile != ''">
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
+ </xsl:if>
</pdf:embedded-file>
</xsl:for-each>
</xsl:if>
</xsl:template> <!-- addPDFUAmeta -->
@@ -14608,21 +14650,42 @@
</xsl:when>
<xsl:when test="ancestor::*[local-name() = 'preface']">
<xsl:value-of select="$level_total - 2"/>
</xsl:when>
<xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
<xsl:choose>
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
+ <xsl:value-of select="number($curr_clause_depth)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$level_total - 2"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
+ <xsl:choose>
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$level_total - 2"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
<xsl:when test="ancestor::*[local-name() = 'sections']">
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
<xsl:choose>
<xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
<xsl:value-of select="number($upper_clause_depth + 1)"/>
</xsl:when>
<xsl:otherwise>
\ No newline at end of file