lib/isodoc/mpfa/mpfa.guidelines.xsl in metanorma-mpfa-0.8.5 vs lib/isodoc/mpfa/mpfa.guidelines.xsl in metanorma-mpfa-0.8.6
- old
+ new
@@ -568,11 +568,11 @@
</fo:block-container>
</fo:static-content>
</xsl:template>
-<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:key name="bibitems" match="*[local-name() = 'bibitem']" use="@id"/><xsl:key name="bibitems_hidden" match="*[local-name() = 'bibitem'][@hidden='true'] | *[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']" use="@id"/><xsl:variable name="lang">
+<xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
<xsl:call-template name="getLang"/>
</xsl:variable><xsl:variable name="pageWidth_">
210
</xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
297
@@ -5000,11 +5000,55 @@
<xsl:variable name="text_step2">
<xsl:call-template name="add-zero-spaces-java">
<xsl:with-param name="text" select="$text_step1"/>
</xsl:call-template>
</xsl:variable>
- <xsl:value-of select="$text_step2"/>
+
+ <!-- <xsl:value-of select="$text_step2"/> -->
+
+ <!-- add zero-width space after space -->
+ <xsl:variable name="text_step3" select="java:replaceAll(java:java.lang.String.new($text_step2),' ',' ')"/>
+
+ <!-- split text by zero-width space -->
+ <xsl:variable name="text_step4">
+ <xsl:call-template name="split">
+ <xsl:with-param name="pText" select="$text_step3"/>
+ <xsl:with-param name="sep" select="$zero_width_space"/>
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
+ <xsl:with-param name="keep_sep">true</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:for-each select="xalan:nodeset($text_step4)/item">
+ <xsl:choose>
+ <xsl:when test="string-length() > 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
+ <xsl:call-template name="interspers">
+ <xsl:with-param name="str" select="."/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+
+ </xsl:template><xsl:template name="interspers">
+ <xsl:param name="str"/>
+ <xsl:param name="char" select="$zero_width_space"/>
+ <xsl:if test="$str != ''">
+ <xsl:value-of select="substring($str, 1, 1)"/>
+
+ <xsl:variable name="next_char" select="substring($str, 2, 1)"/>
+ <xsl:if test="not(contains(concat(' -.:=_— ', $char), $next_char))">
+ <xsl:value-of select="$char"/>
+ </xsl:if>
+
+ <xsl:call-template name="interspers">
+ <xsl:with-param name="str" select="substring($str, 2)"/>
+ <xsl:with-param name="char" select="$char"/>
+ </xsl:call-template>
+ </xsl:if>
</xsl:template><xsl:template match="*" mode="syntax_highlight">
<xsl:apply-templates mode="syntax_highlight"/>
</xsl:template><xsl:variable name="syntax_highlight_styles_">
<style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
<style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
@@ -5508,15 +5552,28 @@
<xsl:apply-templates/>
</fo:basic-link>
</xsl:template><xsl:template match="*[local-name() = 'author']">
<xsl:text>— </xsl:text>
<xsl:apply-templates/>
- </xsl:template><xsl:template match="*[local-name() = 'eref']">
+ </xsl:template><xsl:variable name="bibitems_">
+ <xsl:for-each select="//*[local-name() = 'bibitem']">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </xsl:variable><xsl:variable name="bibitems" select="xalan:nodeset($bibitems_)"/><xsl:variable name="bibitems_hidden_">
+ <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']">
+ <xsl:copy-of select="."/>
+ </xsl:for-each>
+ </xsl:variable><xsl:variable name="bibitems_hidden" select="xalan:nodeset($bibitems_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
<xsl:variable name="current_bibitemid" select="@bibitemid"/>
- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
+ <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
+ <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
<xsl:choose>
- <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
+ <!-- <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> --> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
+ <xsl:when test="$external-destination != '' or not($bibitems_hidden/*[local-name() ='bibitem'][@id = $current_bibitemid])"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
<fo:inline xsl:use-attribute-sets="eref-style">
<xsl:if test="@type = 'footnote'">
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
<xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
<xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -6620,11 +6677,11 @@
</xsl:copy>
</xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
<xsl:copy>
<xsl:copy-of select="@*"/>
<!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
- <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
+ <xsl:for-each select="*[not(@normative='true') and not(*[@normative='true'])]">
<xsl:sort select="@displayorder" data-type="number"/>
<xsl:apply-templates select="." mode="update_xml_step1"/>
</xsl:for-each>
</xsl:copy>
</xsl:template><xsl:template name="convertDate">
@@ -6869,25 +6926,28 @@
</xsl:choose>
</xsl:template><xsl:template name="split">
<xsl:param name="pText" select="."/>
<xsl:param name="sep" select="','"/>
<xsl:param name="normalize-space" select="'true'"/>
+ <xsl:param name="keep_sep" select="'false'"/>
<xsl:if test="string-length($pText) >0">
- <item>
- <xsl:choose>
- <xsl:when test="$normalize-space = 'true'">
- <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
- </xsl:otherwise>
- </xsl:choose>
- </item>
- <xsl:call-template name="split">
- <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
- <xsl:with-param name="sep" select="$sep"/>
- <xsl:with-param name="normalize-space" select="$normalize-space"/>
- </xsl:call-template>
+ <item>
+ <xsl:choose>
+ <xsl:when test="$normalize-space = 'true'">
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </item>
+ <xsl:if test="$keep_sep = 'true' and contains($pText, $sep)"><item><xsl:value-of select="$sep"/></item></xsl:if>
+ <xsl:call-template name="split">
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
+ <xsl:with-param name="sep" select="$sep"/>
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
+ <xsl:with-param name="keep_sep" select="$keep_sep"/>
+ </xsl:call-template>
</xsl:if>
</xsl:template><xsl:template name="getDocumentId">
<xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
</xsl:template><xsl:template name="namespaceCheck">
<xsl:variable name="documentNS" select="namespace-uri(/*)"/>
\ No newline at end of file