lib/isodoc/gb/gb.recommendation.xsl in metanorma-gb-1.5.5 vs lib/isodoc/gb/gb.recommendation.xsl in metanorma-gb-1.5.6
- old
+ new
@@ -111,10 +111,14 @@
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<xsl:call-template name="addPDFUAmeta"/>
+
+ <xsl:call-template name="addBookmarks">
+ <xsl:with-param name="contents" select="$contents"/>
+ </xsl:call-template>
<fo:page-sequence master-reference="cover" force-page-count="no-force">
<fo:flow flow-name="xsl-region-body">
<fo:block-container>
<xsl:variable name="ccs" select="normalize-space(/gb:gb-standard/gb:bibdata/gb:ext/gb:ccs)"/>
@@ -327,23 +331,23 @@
<xsl:text disable-output-escaping="yes">--></xsl:text>
</xsl:if>
<fo:block line-height="220%">
<xsl:variable name="margin-left">12</xsl:variable>
- <xsl:for-each select="xalan:nodeset($contents)//item"><!-- [@display = 'true'][not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [@display = 'true'][not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
<fo:block text-align-last="justify">
<xsl:if test="@level =2">
<xsl:attribute name="margin-left">3.7mm</xsl:attribute>
</xsl:if>
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
<xsl:if test="normalize-space(@section) != ''">
<fo:inline>
<xsl:value-of select="@section"/>
</fo:inline>
<xsl:value-of select="$tab_zh"/>
</xsl:if>
- <xsl:apply-templates/>
+ <xsl:apply-templates select="title"/>
<fo:inline keep-together.within-line="always">
<fo:leader font-weight="normal" leader-pattern="dots"/>
<fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
</fo:inline>
</fo:basic-link>
@@ -454,20 +458,26 @@
<xsl:with-param name="depth" select="gb:title/@depth"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="display">
- <xsl:choose>
- <xsl:when test="ancestor-or-self::gb:bibitem">false</xsl:when>
- <xsl:when test="ancestor-or-self::gb:term">false</xsl:when>
+ <xsl:choose>
<xsl:when test="$level <= 2">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <xsl:if test="$display = 'true'">
+ <xsl:variable name="skip">
+ <xsl:choose>
+ <xsl:when test="ancestor-or-self::gb:bibitem">true</xsl:when>
+ <xsl:when test="ancestor-or-self::gb:term">true</xsl:when>
+ <xsl:otherwise>false</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$skip = 'false'">
+
<xsl:variable name="section">
<xsl:call-template name="getSection"/>
</xsl:variable>
<xsl:variable name="title">
@@ -476,14 +486,17 @@
<xsl:variable name="type">
<xsl:value-of select="local-name()"/>
</xsl:variable>
- <item id="{@id}" level="{$level}" section="{$section}" type="{$type}">
- <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" display="{$display}">
+ <title>
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
+ </title>
+ <xsl:apply-templates mode="contents"/>
</item>
- <xsl:apply-templates mode="contents"/>
+
</xsl:if>
</xsl:template>
@@ -1122,10 +1135,14 @@
<title-edition lang="en">
</title-edition>
+ <title-edition lang="fr">
+
+ </title-edition>
+
<title-toc lang="en">
@@ -1234,14 +1251,16 @@
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
</xsl:otherwise>
</xsl:choose>
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'
'"/><xsl:attribute-set name="link-style">
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'
'"/><xsl:attribute-set name="root-style">
+ </xsl:attribute-set><xsl:attribute-set name="link-style">
+
</xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
<xsl:attribute name="white-space">pre</xsl:attribute>
<xsl:attribute name="wrap-option">wrap</xsl:attribute>
<xsl:attribute name="font-family">Courier</xsl:attribute>
@@ -3220,16 +3239,105 @@
</xsl:choose>
</xsl:variable>
<fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
</fo:block>
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
<xsl:apply-templates mode="contents"/>
<xsl:text> </xsl:text>
- </xsl:template><xsl:template match="text()" mode="contents">
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
+ <xsl:apply-templates mode="bookmarks"/>
+ <xsl:text> </xsl:text>
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
<xsl:value-of select="."/>
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
+ <xsl:value-of select="."/>
+ </xsl:template><xsl:template match="node()" mode="contents">
+ <xsl:apply-templates mode="contents"/>
+ </xsl:template><xsl:template match="node()" mode="bookmarks">
+ <xsl:apply-templates mode="bookmarks"/>
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
+ <xsl:apply-templates select="."/>
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
+ <xsl:apply-templates mode="bookmarks"/>
+ </xsl:template><xsl:template name="addBookmarks">
+ <xsl:param name="contents"/>
+ <xsl:if test="xalan:nodeset($contents)//item">
+ <fo:bookmark-tree>
+ <xsl:choose>
+ <xsl:when test="xalan:nodeset($contents)/doc">
+ <xsl:choose>
+ <xsl:when test="count(xalan:nodeset($contents)/doc) > 1">
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
+ <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
+ <fo:bookmark-title>
+ <xsl:variable name="bookmark-title_">
+ <xsl:choose>
+ <xsl:when test="@lang = 'en'">
+
+
+ </xsl:when>
+ <xsl:when test="@lang = 'fr'">
+
+
+ </xsl:when>
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="@lang = 'en'">English</xsl:when>
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </fo:bookmark-title>
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
+ </fo:bookmark>
+
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+
+
+
+
+
+
+
+ </fo:bookmark-tree>
+ </xsl:if>
+ </xsl:template><xsl:template match="item" mode="bookmark">
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
+ <fo:bookmark-title>
+ <xsl:if test="@section != ''">
+ <xsl:value-of select="@section"/>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:value-of select="normalize-space(title)"/>
+ </fo:bookmark-title>
+ <xsl:apply-templates mode="bookmark"/>
+ </fo:bookmark>
+ </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
<xsl:if test="normalize-space() != ''">
<fo:block xsl:use-attribute-sets="figure-name-style">
<xsl:apply-templates/>
</fo:block>
@@ -3283,11 +3391,11 @@
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
- </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
+ </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
<xsl:text> </xsl:text>
</xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
<xsl:copy>
<xsl:apply-templates mode="contents_item"/>
</xsl:copy>
@@ -3881,26 +3989,35 @@
<xsl:apply-templates /> -->
</xsl:template><xsl:template match="*[local-name() = 'name']/text()">
<!-- 0xA0 to space replacement -->
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
</xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
- <fo:block-container margin-left="0mm">
- <xsl:if test="parent::*[local-name() = 'note']">
- <xsl:attribute name="margin-left">
- <xsl:choose>
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
-
- </xsl:if>
- <fo:block-container margin-left="0mm">
- <xsl:apply-templates select="." mode="ul_ol"/>
- </fo:block-container>
- </fo:block-container>
+ <xsl:choose>
+ <xsl:when test="parent::*[local-name() = 'note']">
+ <fo:block-container>
+ <xsl:attribute name="margin-left">
+ <xsl:choose>
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
+
+ <fo:block-container margin-left="0mm">
+ <fo:block>
+ <xsl:apply-templates select="." mode="ul_ol"/>
+ </fo:block>
+ </fo:block-container>
+ </fo:block-container>
+ </xsl:when>
+ <xsl:otherwise>
+ <fo:block>
+ <xsl:apply-templates select="." mode="ul_ol"/>
+ </fo:block>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:template><xsl:template match="*[local-name() = 'errata']">
<!-- <row>
<date>05-07-2013</date>
<type>Editorial</type>
<change>Changed CA-9 Priority Code from P1 to P2 in <xref target="tabled2"/>.</change>
@@ -4194,10 +4311,11 @@
<xsl:value-of select="document('')//*/namespace::gb"/>
+
</xsl:variable>
<xsl:if test="$documentNS != $XSLNS">
<xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
</xsl:if>
</xsl:template><xsl:template name="getLanguage">
@@ -4219,6 +4337,23 @@
<xsl:otherwise>
<xsl:value-of select="generate-id()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
+ </xsl:template><xsl:template name="add-letter-spacing">
+ <xsl:param name="text"/>
+ <xsl:param name="letter-spacing" select="'0.15'"/>
+ <xsl:if test="string-length($text) > 0">
+ <xsl:variable name="char" select="substring($text, 1, 1)"/>
+ <fo:inline padding-right="{$letter-spacing}mm">
+ <xsl:if test="$char = '®'">
+ <xsl:attribute name="font-size">58%</xsl:attribute>
+ <xsl:attribute name="baseline-shift">30%</xsl:attribute>
+ </xsl:if>
+ <xsl:value-of select="$char"/>
+ </fo:inline>
+ <xsl:call-template name="add-letter-spacing">
+ <xsl:with-param name="text" select="substring($text, 2)"/>
+ <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
+ </xsl:call-template>
+ </xsl:if>
</xsl:template></xsl:stylesheet>
\ No newline at end of file