-<?xml version='1.0'?>
+<?xml version='1.0' encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions"
(c) Stephane Bline Peregrine Systems 2001
Driver file to allow pdf bookmarking (based on fop implementation).
******************************************************************** -->
+<!--
+In PDF bookmarks can't be used characters with code>255. This version of file
+translates characters with code>255 back to ASCII.
+
+ Pavel Zampach (zampach@volny.cz)
+-->
+
+<xsl:variable name="a-dia" select=
+"'āăąćĉċčďđēĕėęěœĝğġģĥħĩīĭįıĵķĺļľŀłńņňŋōŏőŕŗřśŝşšţťŧũūŭůűųŵŷźżžĀĂĄĆĈĊČĎĐĒĔĖĘĚŒĜĞĠĢĤĦĨĪĬĮİĴĶĹĻĽĿŁŃŅŇŊŌŎŐŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽ'"/>
+<xsl:variable name="a-asc" select=
+"'aaaccccddeeeeeegggghhiiiiijklllllnnnnooorrrsssstttuuuuuuwyzzzAAACCCCDDEEEEEEGGGGHHIIIIIJKLLLLLNNNNOOORRRSSSSTTTUUUUUUWYYZZZ'"/>
+
<xsl:template match="set" mode="outline">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
- <fox:outline internal-destination="{$id}">
- <fox:label>
+ <xsl:variable name="bookmark-label">
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:apply-templates select="." mode="title.markup"/>
- </fox:label>
+ </xsl:variable>
+ <fox:outline internal-destination="{$id}">
+ <fox:label>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
+ </fox:label>
<xsl:if test="book">
<xsl:apply-templates select="book"
mode="outline"/>
<xsl:call-template name="object.id"/>
</xsl:variable>
- <fox:outline internal-destination="{$id}">
- <fox:label>
+ <xsl:variable name="bookmark-label">
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
+ <fox:outline internal-destination="{$id}">
+ <fox:label>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</fox:label>
<xsl:if test="part|preface|chapter|appendix">
<xsl:call-template name="object.id"/>
</xsl:variable>
- <fox:outline internal-destination="{$id}">
- <fox:label>
+ <xsl:variable name="bookmark-label">
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
+ <fox:outline internal-destination="{$id}">
+ <fox:label>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</fox:label>
<xsl:if test="chapter|appendix|preface|reference">
<xsl:call-template name="object.id"/>
</xsl:variable>
- <fox:outline internal-destination="{$id}">
- <fox:label>
+ <xsl:variable name="bookmark-label">
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
+ <fox:outline internal-destination="{$id}">
+ <fox:label>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</fox:label>
<xsl:if test="section|sect1">
<xsl:call-template name="object.id"/>
</xsl:variable>
- <fox:outline internal-destination="{$id}">
- <fox:label>
+ <xsl:variable name="bookmark-label">
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
+ <fox:outline internal-destination="{$id}">
+ <fox:label>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</fox:label>
<xsl:if test="section|sect2|sect3|sect4|sect5">
</fox:outline>
</xsl:template>
-<xsl:template match="bibliography|glossary|index"
+<!-- Added missing template for "article" -->
+<xsl:template match="article"
mode="outline">
<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
+ <xsl:variable name="bookmark-label">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
<fox:outline internal-destination="{$id}">
<fox:label>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
+ </fox:label>
+
+ <xsl:if test="section|sect1|appendix|bibliography|glossary|index">
+ <xsl:apply-templates select="section|sect1|appendix|bibliography|glossary|index"
+ mode="outline"/>
+ </xsl:if>
+ </fox:outline>
+</xsl:template>
+
+
+<xsl:template match="bibliography|glossary|index"
+ mode="outline">
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <xsl:variable name="bookmark-label">
<xsl:apply-templates select="." mode="label.markup"/>
<xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
+ <fox:outline internal-destination="{$id}">
+ <fox:label>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</fox:label>
</fox:outline>
</xsl:template>
<!-- ********************************************************************
Document information
- ******************************************************************** -->
+ In PDF bookmarks can't be used characters with code>255. This version of file
+ translates characters with code>255 back to ASCII.
+
+ Pavel Zampach (zampach@volny.cz)
+
+ ********************************************************************-->
<xsl:template name="xep-document-information">
<rx:meta-info>
</xsl:variable>
<rx:bookmark internal-destination="{$id}">
<rx:bookmark-label>
- <xsl:value-of select="$bookmark-label"/>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</rx:bookmark-label>
<xsl:if test="book">
<rx:bookmark internal-destination="{$id}">
<rx:bookmark-label>
- <xsl:value-of select="$bookmark-label"/>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</rx:bookmark-label>
<xsl:if test="part|preface|chapter|appendix">
<rx:bookmark internal-destination="{$id}">
<rx:bookmark-label>
- <xsl:value-of select="$bookmark-label"/>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</rx:bookmark-label>
<xsl:if test="chapter|appendix|preface|reference">
<rx:bookmark internal-destination="{$id}">
<rx:bookmark-label>
- <xsl:value-of select="$bookmark-label"/>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</rx:bookmark-label>
<xsl:if test="section|sect1">
<rx:bookmark internal-destination="{$id}">
<rx:bookmark-label>
- <xsl:value-of select="$bookmark-label"/>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</rx:bookmark-label>
<xsl:if test="section|sect2|sect3|sect4|sect5">
<rx:bookmark internal-destination="{$id}">
<rx:bookmark-label>
- <xsl:value-of select="$bookmark-label"/>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
+ </rx:bookmark-label>
+ </rx:bookmark>
+</xsl:template>
+<!-- Added missing template for "article" -->
+<xsl:template match="article"
+ mode="xep.outline">
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+ <xsl:variable name="bookmark-label">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:apply-templates select="." mode="title.markup"/>
+ </xsl:variable>
+
+ <rx:bookmark internal-destination="{$id}">
+ <rx:bookmark-label>
+ <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
</rx:bookmark-label>
+
+ <xsl:if test="section|sect1|appendix|bibliography|glossary|index">
+ <xsl:apply-templates select="section|sect1|appendix|bibliography|glossary|index"
+ mode="xep.outline"/>
+ </xsl:if>
</rx:bookmark>
</xsl:template>
+
+
<xsl:template match="title" mode="xep.outline">
<xsl:apply-templates/>
</xsl:template>