lib/isodoc/mpfa/mpfd.circular.xsl in metanorma-mpfa-0.5.3 vs lib/isodoc/mpfa/mpfd.circular.xsl in metanorma-mpfa-0.5.4

- old
+ new

@@ -94,10 +94,14 @@ </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:static-content flow-name="cover-header"> <fo:block-container height="100%"> <fo:block font-size="10pt" padding-top="12.5mm"> <xsl:value-of select="$copyright"/> @@ -169,11 +173,11 @@ <xsl:with-param name="name" select="'title-toc'"/> </xsl:call-template> </xsl:variable> <fo:block font-size="14pt" margin-bottom="15.5pt"><xsl:value-of select="$title-toc"/></fo:block> <fo:block line-height="115%"> - <xsl:for-each select="xalan:nodeset($contents)//item"> + <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"> <fo:block> <xsl:if test="@level = 1"> <xsl:attribute name="margin-top">6pt</xsl:attribute> </xsl:if> <fo:list-block provisional-label-separation="3mm"> @@ -191,12 +195,12 @@ </xsl:if> </fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()"> <fo:block text-align-last="justify"> - <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 leader-pattern="dots"/> <fo:page-number-citation ref-id="{@id}"/> </fo:inline> </fo:basic-link> @@ -272,29 +276,38 @@ <xsl:variable name="type"> <xsl:value-of select="local-name()"/> </xsl:variable> <xsl:variable name="display"> - <xsl:choose> - <xsl:when test="ancestor-or-self::mpfd:bibitem">false</xsl:when> - <xsl:when test="ancestor-or-self::mpfd:term">false</xsl:when> + <xsl:choose> <xsl:when test="$level &gt;= 3">false</xsl:when> <xsl:otherwise>true</xsl:otherwise> </xsl:choose> </xsl:variable> - <xsl:if test="$display = 'true'"> + <xsl:variable name="skip"> + <xsl:choose> + <xsl:when test="ancestor-or-self::mpfd:bibitem">true</xsl:when> + <xsl:when test="ancestor-or-self::mpfd:term">true</xsl:when> + <xsl:otherwise>false</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:if test="$skip = 'false'"> <xsl:variable name="title"> <xsl:call-template name="getName"/> </xsl:variable> - <item level="{$level}" section="{$section}" type="{$type}"> + <item level="{$level}" section="{$section}" type="{$type}" display="{$display}"> <xsl:call-template name="setId"/> - <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/> + <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> <xsl:template match="mpfd:br" mode="contents_item" priority="2"> @@ -781,10 +794,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> @@ -887,12 +906,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="'&#8232;'"/><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="'&#8232;'"/><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> @@ -2780,16 +2801,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) &gt; 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> @@ -2843,11 +2953,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> @@ -3439,24 +3549,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> @@ -3746,10 +3865,11 @@ <xsl:value-of select="document('')//*/namespace::mpfd"/> + </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"> @@ -3771,6 +3891,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) &gt; 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