lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.5.3 vs lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.5.4
- old
+ new
@@ -14,10 +14,18 @@
<xsl:variable name="debug">false</xsl:variable>
<xsl:variable name="contents">
<contents>
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
+
+ <xsl:apply-templates select="/un:un-standard/un:sections/*" mode="contents"/>
+ <xsl:apply-templates select="/un:un-standard/un:annex" mode="contents"/>
+ <xsl:apply-templates select="/un:un-standard/un:bibliography/un:references" mode="contents"/>
</contents>
</xsl:variable>
<xsl:variable name="lang">
<xsl:call-template name="getLang"/>
@@ -64,10 +72,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-page" force-page-count="no-force">
<fo:flow flow-name="xsl-region-body">
<fo:block-container border-bottom="0.5pt solid black" margin-bottom="6pt">
<fo:block text-align-last="justify">
@@ -171,24 +183,26 @@
<fo:block font-size="10pt" text-align="left">
<xsl:value-of select="/un:un-standard/un:bibdata/un:docidentifier"/>
</fo:block>
<fo:block padding-top="1mm">
- <fo:instream-foreign-object fox:alt-text="Barcode">
- <barcode:barcode message="{$code}">
- <barcode:code39>
- <barcode:height>8.5mm</barcode:height>
- <barcode:module-width>0.24mm</barcode:module-width>
- <barcode:human-readable>
- <barcode:placement>none</barcode:placement>
- <!--<barcode:pattern>* _ _ _ _ _ _ _ _ _ *</barcode:pattern>
- <barcode:font-name>Arial</barcode:font-name>
- <barcode:font-size>9.7pt</barcode:font-size> -->
- </barcode:human-readable>
- </barcode:code39>
- </barcode:barcode>
- </fo:instream-foreign-object>
+ <xsl:if test="normalize-space($code) != ''">
+ <fo:instream-foreign-object fox:alt-text="Barcode">
+ <barcode:barcode message="{$code}">
+ <barcode:code39>
+ <barcode:height>8.5mm</barcode:height>
+ <barcode:module-width>0.24mm</barcode:module-width>
+ <barcode:human-readable>
+ <barcode:placement>none</barcode:placement>
+ <!--<barcode:pattern>* _ _ _ _ _ _ _ _ _ *</barcode:pattern>
+ <barcode:font-name>Arial</barcode:font-name>
+ <barcode:font-size>9.7pt</barcode:font-size> -->
+ </barcode:human-readable>
+ </barcode:code39>
+ </barcode:barcode>
+ </fo:instream-foreign-object>
+ </xsl:if>
</fo:block>
<fo:block padding-top="-0.8mm" text-align="left" font-family="Arial" font-size="8pt" letter-spacing="1.8mm">
<xsl:value-of select="concat('*', $code, '*')"/>
</fo:block>
</fo:block-container>
@@ -198,18 +212,20 @@
<fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Recycle))}" width="26mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Recycle"/>
</fo:block>
</fo:block-container>
<fo:block-container absolute-position="fixed" left="170mm" top="253mm">
<fo:block>
- <fo:instream-foreign-object fox:alt-text="Barcode">
- <barcode:barcode message="{concat('http://undocs.org/', /un:un-standard/un:bibdata/un:ext/un:session/un:id)}">
- <barcode:qr>
- <barcode:module-width>0.55mm</barcode:module-width>
- <barcode:ec-level>M</barcode:ec-level>
- </barcode:qr>
- </barcode:barcode>
- </fo:instream-foreign-object>
+ <xsl:if test="normalize-space(/un:un-standard/un:bibdata/un:ext/un:session/un:id) != ''">
+ <fo:instream-foreign-object fox:alt-text="Barcode">
+ <barcode:barcode message="{concat('http://undocs.org/', /un:un-standard/un:bibdata/un:ext/un:session/un:id)}">
+ <barcode:qr>
+ <barcode:module-width>0.55mm</barcode:module-width>
+ <barcode:ec-level>M</barcode:ec-level>
+ </barcode:qr>
+ </barcode:barcode>
+ </fo:instream-foreign-object>
+ </xsl:if>
</fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
@@ -260,12 +276,71 @@
</fo:root>
</xsl:template>
+
+ <!-- ============================= -->
+ <!-- CONTENTS -->
+ <!-- ============================= -->
+ <xsl:template match="node()" mode="contents">
+ <xsl:apply-templates mode="contents"/>
+ </xsl:template>
+
+ <!-- element with title -->
+ <xsl:template match="*[un:title]" mode="contents">
+ <xsl:variable name="level">
+ <xsl:call-template name="getLevel">
+ <xsl:with-param name="depth" select="un:title/@depth"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="display">
+ <xsl:choose>
+ <xsl:when test="$level > 3">false</xsl:when>
+ <xsl:otherwise>true</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="skip">
+ <xsl:choose>
+ <xsl:when test="ancestor-or-self::un:bibitem">true</xsl:when>
+ <xsl:when test="ancestor-or-self::un:term">true</xsl:when>
+ <xsl:when test="@inline-header = 'true'">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">
+ <xsl:call-template name="getName"/>
+ </xsl:variable>
+
+ <xsl:variable name="type">
+ <xsl:value-of select="local-name()"/>
+ </xsl:variable>
+
+ <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:if>
+
+ </xsl:template>
+ <xsl:template match="un:references[not(@normative='true')]/un:bibitem" mode="contents"/>
<!-- ============================= -->
+ <!-- ============================= -->
+
+
+ <!-- ============================= -->
<!-- PARAGRAPHS -->
<!-- ============================= -->
<xsl:template match="un:preface/un:abstract" priority="3">
<fo:block>
@@ -1102,10 +1177,16 @@
<xsl:text>Edition </xsl:text>
</title-edition>
+ <title-edition lang="fr">
+
+ <xsl:text>Édition </xsl:text>
+
+ </title-edition>
+
<title-toc lang="en">
@@ -1208,14 +1289,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>
@@ -3148,16 +3231,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>
@@ -3211,11 +3383,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>
@@ -3822,24 +3994,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>
@@ -4131,10 +4312,11 @@
+
</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">
@@ -4156,6 +4338,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