lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.2.3 vs lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.2.4
- old
+ new
@@ -109,10 +109,14 @@
</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>
+
<!-- =========================== -->
<!-- Cover Page -->
<fo:page-sequence master-reference="cover">
<fo:flow flow-name="xsl-region-body">
<fo:block-container position="absolute" left="14.25mm" top="28.20mm">
@@ -215,11 +219,11 @@
DEBUG
contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
<xsl:text disable-output-escaping="yes">--></xsl:text>
</xsl:if>
- <xsl:for-each select="xalan:nodeset($contents)//item"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
<fo:block>
<xsl:if test="@level = 1">
<xsl:attribute name="margin-top">6pt</xsl:attribute>
</xsl:if>
@@ -241,12 +245,12 @@
</xsl:if>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
- <xsl:apply-templates/>
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
+ <xsl:apply-templates select="title"/>
<fo:inline keep-together.within-line="always">
<fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
<fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
</fo:inline>
</fo:basic-link>
@@ -359,20 +363,26 @@
<xsl:with-param name="depth" select="iho:title/@depth"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="display">
- <xsl:choose>
- <xsl:when test="ancestor-or-self::iho:bibitem">false</xsl:when>
- <xsl:when test="ancestor-or-self::iho: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::iho:bibitem">true</xsl:when>
+ <xsl:when test="ancestor-or-self::iho: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">
@@ -386,14 +396,17 @@
<xsl:variable name="root">
<xsl:if test="ancestor-or-self::iho:preface">preface</xsl:if>
<xsl:if test="ancestor-or-self::iho:annex">annex</xsl:if>
</xsl:variable>
- <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}">
- <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" 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>
@@ -952,10 +965,16 @@
<xsl:text>Edition </xsl:text>
</title-edition>
+ <title-edition lang="fr">
+
+ <xsl:text>Édition </xsl:text>
+
+ </title-edition>
+
<title-toc lang="en">
<xsl:text>Contents</xsl:text>
@@ -1060,12 +1079,14 @@
</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 name="color">blue</xsl:attribute>
<xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -3006,16 +3027,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>
@@ -3069,11 +3179,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>
@@ -3675,24 +3785,33 @@
<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: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>
+
+ <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>
@@ -4085,10 +4204,11 @@
<xsl:value-of select="document('')//*/namespace::iho"/>
+
</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">
@@ -4110,6 +4230,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