Skip to content

Commit

Permalink
Merge pull request #219 from metanorma/feature/xslt-update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Oct 2, 2024
2 parents 06ad908 + 19892f5 commit ab84212
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions lib/isodoc/jis/jis.international-standard.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -5134,8 +5134,10 @@

<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>
Expand Down Expand Up @@ -5427,7 +5429,7 @@

<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)"/>
Expand Down Expand Up @@ -7888,9 +7890,12 @@
<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>
Expand All @@ -7917,6 +7922,14 @@
</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 -->
<!-- ======================== -->
Expand Down Expand Up @@ -7947,7 +7960,7 @@
<xsl:template match="*[local-name() = 'callout']">
<xsl:choose>
<xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
<xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
<xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
</xsl:choose>
</xsl:template>

Expand Down Expand Up @@ -7976,7 +7989,10 @@
<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()) &lt; 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>
Expand Down

0 comments on commit ab84212

Please sign in to comment.