]> granicus.if.org Git - docbook-dsssl/commitdiff
Initial cut at bookmark and info support for RenderX's XEP--doesn't work yet
authorNorman Walsh <ndw@nwalsh.com>
Fri, 22 Jun 2001 12:31:35 +0000 (12:31 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Fri, 22 Jun 2001 12:31:35 +0000 (12:31 +0000)
xsl/fo/param.xsl
xsl/fo/xep.xsl [new file with mode: 0644]

index 668af6d16ed48945600ef128e5839333fbd0e246..37d6585f24228f35cfb9484d8503278708f22e0b 100644 (file)
@@ -1144,6 +1144,19 @@ extensions will be used. At present, this consists of PDF bookmarks.
 </refdescription>
 </doc:param>
 
+<!-- ==================================================================== -->
+<xsl:param name="xep.extensions" select="0" doc:type='boolean'/>
+
+<doc:param name="xep.extensions" xmlns="">
+<refpurpose>Enable XEP extensions?</refpurpose>
+<refdescription>
+<para>If non-zero,
+<ulink url="http://www.renderx.com/">XEP</ulink>
+extensions will be used. XEP extensions consists of PDF bookmarks and document information.
+</para>
+</refdescription>
+</doc:param>
+
 <!-- ==================================================================== -->
 <xsl:param name="default.units" select="'pt'" doc:type='list'
            doc:list='cm mm in pt pc px em'/>
diff --git a/xsl/fo/xep.xsl b/xsl/fo/xep.xsl
new file mode 100644 (file)
index 0000000..e1c3a02
--- /dev/null
@@ -0,0 +1,175 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                xmlns:rx="http://www.renderx.com/XSL/Extensions"
+                version='1.0'>
+
+<!-- ********************************************************************
+     $Id$
+     ********************************************************************
+     (c) Stephane Bline Peregrine Systems 2001
+     Implementation of xep extensions:
+       * Pdf bookmarks (based on the XEP 2.5 implementation)
+       * Document information (XEP 2.5 meta information extensions)
+     ******************************************************************** -->
+
+<!-- ********************************************************************
+     Document information
+     ******************************************************************** -->
+
+<xsl:template name="document-information">
+  <xsl:param name="document-title" select="//title[1]"/>
+  <rx:meta-info>
+    <xsl:element name="rx:meta-field">
+      <xsl:attribute name="name">author</xsl:attribute>
+      <xsl:attribute name="value">
+        <xsl:choose>
+          <xsl:when test="bookinfo/author">
+            <xsl:value-of select="bookinfo/author"/>
+          </xsl:when>
+          <xsl:otherwise>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:element>
+    <xsl:element name="rx:meta-field">
+      <xsl:attribute name="name">title</xsl:attribute>
+        <xsl:attribute name="value">
+            <xsl:value-of select="$document-title"/>
+        </xsl:attribute>
+    </xsl:element>
+  </rx:meta-info>
+</xsl:template>
+
+<!-- ********************************************************************
+     Pdf bookmarks
+     ******************************************************************** -->
+<xsl:template match="set" 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.content"/>
+    <xsl:apply-templates select="." mode="title.content"/>
+  </xsl:variable>
+  <rx:bookmark internal-destination="{$id}">
+    <rx:bookmark-label>
+      <xsl:value-of select="$bookmark-label"/>
+    </rx:bookmark-label>
+
+  <xsl:if test="book">
+      <xsl:apply-templates select="book"
+                           mode="xep.outline"/>
+  </xsl:if>
+  </rx:bookmark>
+</xsl:template>
+
+<xsl:template match="book" 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.content"/>
+    <xsl:apply-templates select="." mode="title.content"/>
+  </xsl:variable>
+
+  <rx:bookmark internal-destination="{$id}">
+    <rx:bookmark-label>
+      <xsl:value-of select="$bookmark-label"/>
+    </rx:bookmark-label>
+
+  <xsl:if test="part|preface|chapter|appendix">
+      <xsl:apply-templates select="part|preface|chapter|appendix"
+                           mode="xep.outline"/>
+  </xsl:if>
+  </rx:bookmark>
+</xsl:template>
+
+
+<xsl:template match="part" 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.content"/>
+    <xsl:apply-templates select="." mode="title.content"/>
+  </xsl:variable>
+
+  <rx:bookmark internal-destination="{$id}">
+    <rx:bookmark-label>
+      <xsl:value-of select="$bookmark-label"/>
+    </rx:bookmark-label>
+
+  <xsl:if test="chapter|appendix|preface|reference">
+      <xsl:apply-templates select="chapter|appendix|preface|reference"
+                           mode="xep.outline"/>
+  </xsl:if>
+  </rx:bookmark>
+</xsl:template>
+
+<xsl:template match="preface|chapter|appendix"
+              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.content"/>
+    <xsl:apply-templates select="." mode="title.content"/>
+  </xsl:variable>
+
+  <rx:bookmark internal-destination="{$id}">
+    <rx:bookmark-label>
+      <xsl:value-of select="$bookmark-label"/>
+    </rx:bookmark-label>
+
+  <xsl:if test="section|sect1">
+      <xsl:apply-templates select="section|sect1"
+                           mode="xep.outline"/>
+  </xsl:if>
+  </rx:bookmark>
+</xsl:template>
+
+<xsl:template match="section|sect1|sect2|sect3|sect4|sect5"
+              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.content"/>
+    <xsl:apply-templates select="." mode="title.content"/>
+  </xsl:variable>
+
+  <rx:bookmark internal-destination="{$id}">
+    <rx:bookmark-label>
+      <xsl:value-of select="$bookmark-label"/>
+    </rx:bookmark-label>
+
+  <xsl:if test="section|sect2|sect3|sect4|sect5">
+      <xsl:apply-templates select="section|sect2|sect3|sect4|sect5"
+                           mode="xep.outline"/>
+  </xsl:if>
+  </rx:bookmark>
+</xsl:template>
+
+<xsl:template match="bibliography|glossary|index"
+              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.content"/>
+    <xsl:apply-templates select="." mode="title.content"/>
+  </xsl:variable>
+
+  <rx:bookmark internal-destination="{$id}">
+    <rx:bookmark-label>
+      <xsl:value-of select="$bookmark-label"/>
+    </rx:bookmark-label>
+  </rx:bookmark>
+</xsl:template>
+
+<xsl:template match="title" mode="xep.outline">
+  <xsl:apply-templates/>
+</xsl:template>
+
+</xsl:stylesheet>