lib/isodoc/itu/itu.recommendation-supplement.xsl in metanorma-itu-1.3.5 vs lib/isodoc/itu/itu.recommendation-supplement.xsl in metanorma-itu-1.3.6

- old
+ new

@@ -12,12 +12,16 @@ <xsl:key name="kfn" match="itu:p/itu:fn" 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="20"/> + <xsl:variable name="marginLeftRight2" select="20"/> + <xsl:variable name="marginTop" select="20"/> + <xsl:variable name="marginBottom" select="20"/> <!-- Rec. ITU-T G.650.1 (03/2018) --> <xsl:variable name="footerprefix" select="'Rec. '"/> <xsl:variable name="docname"> <xsl:value-of select="substring-before(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/> @@ -131,37 +135,37 @@ </xsl:if> <fo:layout-master-set> <!-- Technical Report first page --> - <fo:simple-page-master master-name="TR-first-page" page-width="{$pageWidth}" page-height="{$pageHeight}"> + <fo:simple-page-master master-name="TR-first-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> <fo:region-body margin-top="21.6mm" margin-bottom="25.4mm" margin-left="20.1mm" margin-right="22.6mm"/> <fo:region-before region-name="TR-first-page-header" extent="21.6mm" display-align="center"/> <fo:region-after region-name="TR-first-page-footer" extent="25.4mm" display-align="center"/> <fo:region-start region-name="TR-first-page-left-region" extent="20.1mm"/> <fo:region-end region-name="TR-first-page-right-region" extent="22.6mm"/> </fo:simple-page-master> <!-- cover page --> - <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}"> + <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> <fo:region-body margin-top="19.2mm" margin-bottom="5mm" margin-left="19.2mm" margin-right="19.2mm"/> <fo:region-before region-name="cover-page-header" extent="19.2mm" display-align="center"/> <fo:region-after/> <fo:region-start region-name="cover-left-region" extent="19.2mm"/> <fo:region-end region-name="cover-right-region" extent="19.2mm"/> </fo:simple-page-master> <!-- contents pages --> <!-- odd pages Preface --> - <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}" page-height="{$pageHeight}"> + <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> <fo:region-body margin-top="19.2mm" margin-bottom="19.2mm" margin-left="19.2mm" margin-right="19.2mm"/> <fo:region-before region-name="header-odd" extent="19.2mm" display-align="center"/> <fo:region-after region-name="footer-odd" extent="19.2mm"/> <fo:region-start region-name="left-region" extent="19.2mm"/> <fo:region-end region-name="right-region" extent="19.2mm"/> </fo:simple-page-master> <!-- even pages Preface --> - <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}" page-height="{$pageHeight}"> + <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm"> <fo:region-body margin-top="19.2mm" margin-bottom="19.2mm" margin-left="19.2mm" margin-right="19.2mm"/> <fo:region-before region-name="header-even" extent="19.2mm" display-align="center"/> <fo:region-after region-name="footer-even" extent="19.2mm"/> <fo:region-start region-name="left-region" extent="19.2mm"/> <fo:region-end region-name="right-region" extent="19.2mm"/> @@ -171,24 +175,24 @@ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-preface"/> <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-preface"/> </fo:repeatable-page-master-alternatives> </fo:page-sequence-master> <!-- odd pages Body --> - <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}"> - <fo:region-body margin-top="20mm" margin-bottom="20mm" margin-left="20mm" margin-right="20mm"/> - <fo:region-before region-name="header-odd" extent="20mm" display-align="center"/> - <fo:region-after region-name="footer-odd" extent="20mm"/> - <fo:region-start region-name="left-region" extent="20mm"/> - <fo:region-end region-name="right-region" extent="20mm"/> + <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" display-align="center"/> + <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> <!-- even pages Body --> - <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}"> - <fo:region-body margin-top="20mm" margin-bottom="20mm" margin-left="20mm" margin-right="20mm"/> - <fo:region-before region-name="header-even" extent="20mm" display-align="center"/> - <fo:region-after region-name="footer-even" extent="20mm"/> - <fo:region-start region-name="left-region" extent="20mm"/> - <fo:region-end region-name="right-region" extent="20mm"/> + <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" display-align="center"/> + <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:page-sequence-master master-name="document"> <fo:repeatable-page-master-alternatives> <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/> <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/> @@ -2247,10 +2251,11 @@ </xsl:attribute-set><xsl:attribute-set name="eref-style"> + <xsl:attribute name="color">blue</xsl:attribute> <xsl:attribute name="text-decoration">underline</xsl:attribute> @@ -2467,18 +2472,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']"/> @@ -3259,10 +3265,11 @@ <xsl:attribute name="padding-right">1mm</xsl:attribute> </xsl:if> + <xsl:if test="ancestor::*[local-name()='preface']"> <xsl:attribute name="border">solid black 0pt</xsl:attribute> </xsl:if> <xsl:attribute name="display-align">before</xsl:attribute> @@ -3305,10 +3312,11 @@ + <fo:inline padding-right="2mm"> @@ -3355,10 +3363,11 @@ + <xsl:attribute name="padding-right">3mm</xsl:attribute> <xsl:attribute name="font-size">70%</xsl:attribute> @@ -3505,10 +3514,13 @@ <fo:inline font-size="80%" keep-with-previous.within-line="always"> + + + <xsl:attribute name="vertical-align">super</xsl:attribute> <xsl:attribute name="color">blue</xsl:attribute> @@ -4429,10 +4441,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> @@ -4785,10 +4798,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"/> @@ -4813,32 +5054,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> @@ -4933,20 +5185,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"> @@ -5488,9 +5747,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