lib/isodoc/ogc/ogc.reference-model.xsl in metanorma-ogc-2.0.7 vs lib/isodoc/ogc/ogc.reference-model.xsl in metanorma-ogc-2.0.8
- old
+ new
@@ -128,11 +128,17 @@
</xsl:variable>
<xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
<xsl:template match="/">
<xsl:call-template name="namespaceCheck"/>
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
+ <fo:root xml:lang="{$lang}">
+ <xsl:variable name="root-style">
+ <root-style xsl:use-attribute-sets="root-style"/>
+ </xsl:variable>
+ <xsl:call-template name="insertRootStyle">
+ <xsl:with-param name="root-style" select="$root-style"/>
+ </xsl:call-template>
<fo:layout-master-set>
<!-- Cover page -->
<fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
<fo:region-body margin-top="16.5mm" margin-bottom="10mm" margin-left="16.5mm" margin-right="14mm"/>
<fo:region-before region-name="cover-page-header" extent="16.5mm"/>
@@ -1602,12 +1608,35 @@
<xsl:attribute name="color"><xsl:value-of select="$color_main"/></xsl:attribute>
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
+ <xsl:param name="root-style"/>
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
+ <xsl:variable name="additional_fonts_">
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
+
+ <xsl:for-each select="$root-style_/root-style/@*">
+ <xsl:choose>
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
+ <xsl:attribute name="{local-name()}">
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
+
<xsl:attribute name="font-size">8pt</xsl:attribute>
<xsl:attribute name="line-height">125%</xsl:attribute>
</xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
@@ -2193,11 +2222,11 @@
<xsl:attribute name="margin-top">12pt</xsl:attribute>
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -4632,28 +4661,32 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template><xsl:template name="add-zero-spaces-equal">
<xsl:param name="text" select="."/>
<xsl:variable name="zero-space-after-equals">==========</xsl:variable>
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
<xsl:variable name="zero-space-after-equal">=</xsl:variable>
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
<xsl:variable name="zero-space"></xsl:variable>
<xsl:choose>
<xsl:when test="contains($text, $zero-space-after-equals)">
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
<xsl:value-of select="$zero-space-after-equals"/>
<xsl:value-of select="$zero-space"/>
<xsl:call-template name="add-zero-spaces-equal">
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
- </xsl:call-template>
+ </xsl:call-template> -->
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
</xsl:when>
<xsl:when test="contains($text, $zero-space-after-equal)">
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
<xsl:value-of select="$zero-space-after-equal"/>
<xsl:value-of select="$zero-space"/>
<xsl:call-template name="add-zero-spaces-equal">
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
- </xsl:call-template>
+ </xsl:call-template> -->
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
@@ -5129,11 +5162,16 @@
</xsl:template><xsl:template match="*[local-name() = 'termnote']">
<fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
<fo:inline xsl:use-attribute-sets="termnote-name-style">
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
+ </xsl:if>
+
+
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
<!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
<xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
<xsl:call-template name="append_add-style"/>
@@ -6138,31 +6176,53 @@
<!-- 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:call-template name="split_for_interspers">
<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:for-each select="xalan:nodeset($text_step4)/node()">
<xsl:choose>
- <xsl:when test="string-length() > 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
+ <xsl:when test="local-name() = 'interspers'"> <!-- 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:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
+ <xsl:param name="pText" select="."/>
+ <xsl:param name="sep" select="','"/>
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
+ <xsl:call-template name="replace_tag_interspers">
+ <xsl:with-param name="text" select="$text"/>
+ </xsl:call-template>
+ </xsl:template><xsl:template name="replace_tag_interspers">
+ <xsl:param name="text"/>
+ <xsl:choose>
+ <xsl:when test="contains($text, $interspers_tag_open)">
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
+ <interspers>
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
+ </interspers>
+ <xsl:call-template name="replace_tag_interspers">
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
+ </xsl:choose>
</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)"/>
@@ -6616,10 +6676,10 @@
<xsl:text>]</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose> -->
</fo:block>
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
<xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
</xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
<xsl:if test="normalize-space() != ''">
<xsl:value-of select="."/>
</xsl:if>
\ No newline at end of file