lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.3.5 vs lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.3.6

- old
+ new

@@ -13,13 +13,18 @@ <xsl:key name="kfn" match="iho:fn[local-name(..) = 'p' or ancestor::*[local-name() = 'title']]" use="@reference"/> <xsl:variable name="debug">false</xsl:variable> - <xsl:variable name="pageWidth" select="'210mm'"/> - <xsl:variable name="pageHeight" select="'297mm'"/> + <xsl:variable name="pageWidth" select="210"/> + <xsl:variable name="pageHeight" select="297"/> + <xsl:variable name="marginLeftRight1" select="25.4"/> + <xsl:variable name="marginLeftRight2" select="25.4"/> + <xsl:variable name="marginTop" select="25.4"/> + <xsl:variable name="marginBottom" select="25.4"/> + <xsl:variable name="title-en" select="/iho:iho-standard/iho:bibdata/iho:title[@language = 'en']"/> <xsl:variable name="docidentifier" select="/iho:iho-standard/iho:bibdata/iho:docidentifier[@type = 'IHO']"/> <xsl:variable name="copyrightText" select="concat('© International Hydrographic Association ', /iho:iho-standard/iho:bibdata/iho:copyright/iho:from ,' – All rights reserved')"/> <xsl:variable name="lang"> @@ -41,48 +46,48 @@ <xsl:variable name="xslfo"> <fo:root font-family="Arial, Cambria Math" font-size="12pt" xml:lang="{$lang}"> <fo:layout-master-set> <!-- cover page --> - <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}"> + <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> <fo:region-body margin-top="0mm" margin-bottom="5mm" margin-left="0mm" margin-right="5mm"/> </fo:simple-page-master> - <fo:simple-page-master master-name="first" page-width="{$pageWidth}" page-height="{$pageHeight}"> - <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/> - <fo:region-before region-name="header" extent="25.4mm"/> - <fo:region-after region-name="footer-even" extent="25.4mm"/> - <fo:region-start region-name="left-region" extent="25.4mm"/> - <fo:region-end region-name="right-region" extent="25.4mm"/> + <fo:simple-page-master master-name="first" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> + <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/> + <fo:region-before region-name="header" extent="{$marginTop}mm"/> + <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/> + <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/> + <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/> </fo:simple-page-master> - <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}"> - <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/> - <fo:region-before region-name="header-odd" extent="25.4mm"/> - <fo:region-after region-name="footer-odd" extent="25.4mm"/> - <fo:region-start region-name="left-region" extent="25.4mm"/> - <fo:region-end region-name="right-region" extent="25.4mm"/> + <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> + <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/> + <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/> + <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/> + <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/> + <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/> </fo:simple-page-master> - <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}"> - <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/> - <fo:region-before region-name="header-odd" extent="25.4mm"/> - <fo:region-after region-name="footer-odd" extent="25.4mm"/> - <fo:region-start region-name="left-region" extent="25.4mm"/> - <fo:region-end region-name="right-region" extent="25.4mm"/> + <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm"> + <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/> + <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/> + <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/> + <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/> + <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/> </fo:simple-page-master> - <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}"> - <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/> - <fo:region-before region-name="header-even" extent="25.4mm"/> - <fo:region-after region-name="footer-even" extent="25.4mm"/> - <fo:region-start region-name="left-region" extent="25.4mm"/> - <fo:region-end region-name="right-region" extent="25.4mm"/> + <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> + <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/> + <fo:region-before region-name="header-even" extent="{$marginTop}mm"/> + <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/> + <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/> + <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/> </fo:simple-page-master> - <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}"> - <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/> - <fo:region-before region-name="header-even" extent="25.4mm"/> - <fo:region-after region-name="footer-even" extent="25.4mm"/> - <fo:region-start region-name="left-region" extent="25.4mm"/> - <fo:region-end region-name="right-region" extent="25.4mm"/> + <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm"> + <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/> + <fo:region-before region-name="header-even" extent="{$marginTop}mm"/> + <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/> + <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/> + <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/> </fo:simple-page-master> <!-- Preface pages --> <fo:page-sequence-master master-name="preface"> <fo:repeatable-page-master-alternatives> <fo:conditional-page-master-reference master-reference="first" page-position="first"/> @@ -1286,10 +1291,11 @@ + </xsl:attribute-set><xsl:attribute-set name="note-style"> @@ -1508,18 +1514,19 @@ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/> </xsl:template><xsl:template name="processMainSectionsDefault_Contents"> <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/> <!-- Normative references --> - <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/> + <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/> <!-- Terms and definitions --> <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/> <!-- Another main sections --> <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/> <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/> <!-- Bibliography --> - <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/> + <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/> + </xsl:template><xsl:template name="processPrefaceSectionsDefault"> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/> <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/> @@ -2296,10 +2303,11 @@ + <xsl:if test=".//*[local-name() = 'table']"> <xsl:attribute name="padding-right">1mm</xsl:attribute> </xsl:if> <xsl:if test="@colspan"> <xsl:attribute name="number-columns-spanned"> @@ -2327,10 +2335,11 @@ <xsl:attribute name="font-size">12pt</xsl:attribute> + <fo:inline padding-right="2mm"> <xsl:attribute name="font-size">11pt</xsl:attribute> <xsl:attribute name="padding-right">3mm</xsl:attribute> @@ -2373,10 +2382,11 @@ + <xsl:value-of select="@reference"/> </fo:inline> <fo:inline> @@ -2517,10 +2527,13 @@ + + + <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id--> <xsl:value-of select="@reference"/> @@ -3423,10 +3436,11 @@ </xsl:choose> </xsl:variable> <fo:inline xsl:use-attribute-sets="link-style"> + <xsl:choose> <xsl:when test="$target_text = ''"> <xsl:apply-templates/> </xsl:when> <xsl:otherwise> @@ -3775,10 +3789,238 @@ </xsl:template><xsl:template name="svg_cross"> <xsl:param name="width"/> <xsl:param name="height"/> <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/> <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/> + </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg"> + <xsl:param name="name"/> + + <xsl:variable name="svg_content"> + <xsl:apply-templates select="." mode="svg_update"/> + </xsl:variable> + + <xsl:variable name="alt-text"> + <xsl:choose> + <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''"> + <xsl:value-of select="../*[local-name() = 'name']"/> + </xsl:when> + <xsl:when test="normalize-space($name) != ''"> + <xsl:value-of select="$name"/> + </xsl:when> + <xsl:otherwise>Figure</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:choose> + <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]"> + <fo:block> + <xsl:variable name="width" select="@width"/> + <xsl:variable name="height" select="@height"/> + + <xsl:variable name="scale_x"> + <xsl:choose> + <xsl:when test="$width &gt; $width_effective_px"> + <xsl:value-of select="$width_effective_px div $width"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="scale_y"> + <xsl:choose> + <xsl:when test="$height * $scale_x &gt; $height_effective_px"> + <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="scale"> + <xsl:choose> + <xsl:when test="$scale_y != 1"> + <xsl:value-of select="$scale_x * $scale_y"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$scale_x"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="width_scale" select="round($width * $scale)"/> + <xsl:variable name="height_scale" select="round($height * $scale)"/> + + <fo:table table-layout="fixed" width="100%"> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-column column-width="{$width_scale}px"/> + <fo:table-column column-width="proportional-column-width(1)"/> + <fo:table-body> + <fo:table-row> + <fo:table-cell column-number="2"> + <fo:block> + <fo:block-container width="{$width_scale}px" height="{$height_scale}px"> + <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']"> + <fo:block line-height="0" font-size="0"> + <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']"> + <xsl:call-template name="bookmark"/> + </xsl:for-each> + </fo:block> + </xsl:if> + <fo:block text-depth="0" line-height="0" font-size="0"> + + <fo:instream-foreign-object fox:alt-text="{$alt-text}"> + <xsl:attribute name="width">100%</xsl:attribute> + <xsl:attribute name="content-height">100%</xsl:attribute> + <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute> + <xsl:attribute name="scaling">uniform</xsl:attribute> + + <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/> + </fo:instream-foreign-object> + </fo:block> + + <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links"> + <xsl:with-param name="scale" select="$scale"/> + </xsl:apply-templates> + </fo:block-container> + </fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:block> + + </xsl:when> + <xsl:otherwise> + <fo:block xsl:use-attribute-sets="image-style"> + <fo:instream-foreign-object fox:alt-text="{$alt-text}"> + <xsl:attribute name="width">100%</xsl:attribute> + <xsl:attribute name="content-height">100%</xsl:attribute> + <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute> + <!-- effective height 297 - 27.4 - 13 = 256.6 --> + <!-- effective width 210 - 12.5 - 25 = 172.5 --> + <!-- effective height / width = 1.48, 1.4 - with title --> + <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height --> + <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/> + <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute> + </xsl:if> + <xsl:attribute name="scaling">uniform</xsl:attribute> + <xsl:copy-of select="$svg_content"/> + </fo:instream-foreign-object> + </fo:block> + </xsl:otherwise> + </xsl:choose> + </xsl:template><xsl:template match="@*|node()" mode="svg_update"> + <xsl:copy> + <xsl:apply-templates select="@*|node()" mode="svg_update"/> + </xsl:copy> + </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update"> + <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2"> + <xsl:variable name="svg_content" select="document(@src)"/> + <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/> + <xsl:for-each select="xalan:nodeset($svg_content)/node()"> + <xsl:call-template name="image_svg"> + <xsl:with-param name="name" select="$name"/> + </xsl:call-template> + </xsl:for-each> + </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a"> + <xsl:copy> + <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/> + </xsl:copy> + </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a"> + <xsl:apply-templates mode="svg_remove_a"/> + </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links"> + <xsl:param name="scale"/> + <xsl:variable name="dest"> + <xsl:choose> + <xsl:when test="starts-with(@href, '#')"> + <xsl:value-of select="substring-after(@href, '#')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@href"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:for-each select="./*[local-name() = 'rect']"> + <xsl:call-template name="insertSVGMapLink"> + <xsl:with-param name="left" select="floor(@x * $scale)"/> + <xsl:with-param name="top" select="floor(@y * $scale)"/> + <xsl:with-param name="width" select="floor(@width * $scale)"/> + <xsl:with-param name="height" select="floor(@height * $scale)"/> + <xsl:with-param name="dest" select="$dest"/> + </xsl:call-template> + </xsl:for-each> + + <xsl:for-each select="./*[local-name() = 'polygon']"> + <xsl:variable name="points"> + <xsl:call-template name="split"> + <xsl:with-param name="pText" select="@points"/> + </xsl:call-template> + </xsl:variable> + <xsl:variable name="x_coords"> + <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]"> + <xsl:sort select="." data-type="number"/> + <x><xsl:value-of select="."/></x> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="y_coords"> + <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]"> + <xsl:sort select="." data-type="number"/> + <y><xsl:value-of select="."/></y> + </xsl:for-each> + </xsl:variable> + <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/> + <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/> + <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/> + <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/> + <xsl:call-template name="insertSVGMapLink"> + <xsl:with-param name="left" select="floor($x * $scale)"/> + <xsl:with-param name="top" select="floor($y * $scale)"/> + <xsl:with-param name="width" select="floor($width * $scale)"/> + <xsl:with-param name="height" select="floor($height * $scale)"/> + <xsl:with-param name="dest" select="$dest"/> + </xsl:call-template> + </xsl:for-each> + + <xsl:for-each select="./*[local-name() = 'circle']"> + <xsl:call-template name="insertSVGMapLink"> + <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/> + <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/> + <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/> + <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/> + <xsl:with-param name="dest" select="$dest"/> + </xsl:call-template> + </xsl:for-each> + <xsl:for-each select="./*[local-name() = 'ellipse']"> + <xsl:call-template name="insertSVGMapLink"> + <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/> + <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/> + <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/> + <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/> + <xsl:with-param name="dest" select="$dest"/> + </xsl:call-template> + </xsl:for-each> + </xsl:template><xsl:template name="insertSVGMapLink"> + <xsl:param name="left"/> + <xsl:param name="top"/> + <xsl:param name="width"/> + <xsl:param name="height"/> + <xsl:param name="dest"/> + <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px"> + <fo:block font-size="1pt"> + <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link"> + <fo:inline-container inline-progression-dimension="100%"> + <fo:block-container height="{$height - 1}px" width="100%"> + <!-- DEBUG <xsl:if test="local-name()='polygon'"> + <xsl:attribute name="background-color">magenta</xsl:attribute> + </xsl:if> --> + <fo:block> </fo:block></fo:block-container> + </fo:inline-container> + </fo:basic-link> + </fo:block> + </fo:block-container> </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="*[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"/> @@ -3803,32 +4045,43 @@ <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"> + <xsl:if test="@bundle = 'true'"> + <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute> + </xsl:if> <fo:bookmark-title> - <xsl:variable name="bookmark-title_"> - <xsl:call-template name="getLangVersion"> - <xsl:with-param name="lang" select="@lang"/> - <xsl:with-param name="doctype" select="@doctype"/> - <xsl:with-param name="title" select="@title-part"/> - </xsl:call-template> - </xsl:variable> <xsl:choose> - <xsl:when test="normalize-space($bookmark-title_) != ''"> - <xsl:value-of select="normalize-space($bookmark-title_)"/> - </xsl:when> - <xsl:otherwise> + <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml --> + <xsl:variable name="bookmark-title_"> + <xsl:call-template name="getLangVersion"> + <xsl:with-param name="lang" select="@lang"/> + <xsl:with-param name="doctype" select="@doctype"/> + <xsl:with-param name="title" select="@title-part"/> + </xsl:call-template> + </xsl:variable> <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: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> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@title-part"/> </xsl:otherwise> </xsl:choose> </fo:bookmark-title> + <xsl:apply-templates select="contents/item" mode="bookmark"/> <xsl:call-template name="insertFigureBookmarks"> <xsl:with-param name="contents" select="contents"/> </xsl:call-template> @@ -3923,20 +4176,27 @@ </xsl:when> <xsl:when test="$lang = 'de'">Deutsche</xsl:when> <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise> </xsl:choose> </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:choose> + <xsl:when test="@id != ''"> + <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:when> + <xsl:otherwise> + <xsl:apply-templates mode="bookmark"/> + </xsl:otherwise> + </xsl:choose> </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"> @@ -4493,9 +4753,10 @@ </xsl:if> <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}"> + <xsl:if test="normalize-space(@citeas) = ''"> <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute> </xsl:if> <xsl:if test="@type = 'inline'"> \ No newline at end of file