]> granicus.if.org Git - docbook-dsssl/commitdiff
Support PTC/Arbortext bookmarks
authorNorman Walsh <ndw@nwalsh.com>
Thu, 4 May 2006 12:27:31 +0000 (12:27 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Thu, 4 May 2006 12:27:31 +0000 (12:27 +0000)
xsl/fo/docbook.xsl
xsl/fo/ptc.xsl [new file with mode: 0644]

index 1f2b1923096a9ef38ad48ac0be782abbaae4b560..798debfa78c44d51e3555d8bdd5668cd88ae5588 100644 (file)
@@ -81,6 +81,7 @@
 <xsl:include href="passivetex.xsl"/>
 <xsl:include href="xep.xsl"/>
 <xsl:include href="axf.xsl"/>
+<xsl:include href="ptc.xsl"/>
 
 <xsl:param name="stylesheet.result.type" select="'fo'"/>
 
         </rx:outline>
       </xsl:if>
     </xsl:if>
+
+    <xsl:if test="$arbortext.extensions != 0 and $ati.xsl11.bookmarks != 0">
+      <xsl:variable name="bookmarks">
+       <xsl:apply-templates select="$document.element"
+                            mode="ati.xsl11.bookmarks"/>
+      </xsl:variable>
+      <xsl:if test="string($bookmarks) != ''">
+       <fo:bookmark-tree>
+         <xsl:copy-of select="$bookmarks"/>
+       </fo:bookmark-tree>
+      </xsl:if>
+    </xsl:if>
+
     <xsl:apply-templates select="$document.element"/>
   </fo:root>
 </xsl:template>
diff --git a/xsl/fo/ptc.xsl b/xsl/fo/ptc.xsl
new file mode 100644 (file)
index 0000000..f3e25e3
--- /dev/null
@@ -0,0 +1,76 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               xmlns:fo="http://www.w3.org/1999/XSL/Format"
+               version="1.0">
+
+<!-- ================================================================ -->
+<!--                                                                  -->
+<!-- PTC/Arbortext Code for XSL 1.1 bookmark support                  -->
+<!--                                                                  -->
+<!-- ================================================================ -->
+
+<xsl:param name="ati.xsl11.bookmarks" select="1"/>
+
+<xsl:variable name="ati-a-dia" select=
+"'&#257;&#259;&#261;&#263;&#265;&#267;&#269;&#271;&#273;&#275;&#277;&#279;&#281;&#283;&#339;&#285;&#287;&#289;&#291;&#293;&#295;&#297;&#299;&#301;&#303;&#305;&#309;&#311;&#314;&#316;&#318;&#320;&#322;&#324;&#326;&#328;&#331;&#333;&#335;&#337;&#341;&#343;&#345;&#347;&#349;&#351;&#353;&#355;&#357;&#359;&#361;&#363;&#365;&#367;&#369;&#371;&#373;&#375;&#378;&#380;&#382;&#256;&#258;&#260;&#262;&#264;&#266;&#268;&#270;&#272;&#274;&#276;&#278;&#280;&#282;&#338;&#284;&#286;&#288;&#290;&#292;&#294;&#296;&#298;&#300;&#302;&#304;&#308;&#310;&#313;&#315;&#317;&#319;&#321;&#323;&#325;&#327;&#330;&#332;&#334;&#336;&#340;&#342;&#344;&#346;&#348;&#350;&#352;&#354;&#356;&#358;&#360;&#362;&#364;&#366;&#368;&#370;&#372;&#374;&#376;&#377;&#379;&#381;'"/>
+
+<xsl:variable name="ati-a-asc" select=
+"'aaaccccddeeeeeegggghhiiiiijklllllnnnnooorrrsssstttuuuuuuwyzzzAAACCCCDDEEEEEEGGGGHHIIIIIJKLLLLLNNNNOOORRRSSSSTTTUUUUUUWYYZZZ'"/>
+
+<xsl:template match="*" mode="ati.xsl11.bookmarks">
+  <xsl:apply-templates select="*" mode="ati.xsl11.bookmarks"/>
+</xsl:template>
+
+<xsl:template match="set|book|part|reference|preface|chapter|appendix|article
+                     |glossary|bibliography|index|setindex
+                     |refentry
+                     |sect1|sect2|sect3|sect4|sect5|section"
+              mode="ati.xsl11.bookmarks">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+  <xsl:variable name="bookmark-label">
+    <xsl:apply-templates select="." mode="object.title.markup"/>
+  </xsl:variable>
+
+  <!-- Put the root element bookmark at the same level as its children -->
+  <!-- If the object is a set or book, generate a bookmark for the toc -->
+
+  <xsl:choose>
+    <xsl:when test="parent::*">
+      <fo:bookmark internal-destination="{$id}">
+        <fo:bookmark-title>
+          <xsl:value-of select="translate($bookmark-label, $ati-a-dia, $ati-a-asc)"/>
+        </fo:bookmark-title>
+        <xsl:apply-templates select="*" mode="ati.xsl11.bookmarks"/>
+      </fo:bookmark>
+    </xsl:when>
+    <xsl:otherwise>
+      <fo:bookmark internal-destination="{$id}">
+        <fo:bookmark-title>
+          <xsl:value-of select="translate($bookmark-label, $ati-a-dia, $ati-a-asc)"/>
+        </fo:bookmark-title>
+      </fo:bookmark>
+
+      <xsl:variable name="toc.params">
+        <xsl:call-template name="find.path.params">
+          <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:if test="contains($toc.params, 'toc')
+                    and section|sect1|refentry
+                        |article|bibliography|glossary
+                        |appendix">
+        <fo:bookmark internal-destination="toc...{$id}">
+          <fo:bookmark-title>
+            <xsl:call-template name="gentext">
+              <xsl:with-param name="key" select="'TableofContents'"/>
+            </xsl:call-template>
+          </fo:bookmark-title>
+        </fo:bookmark>
+      </xsl:if>
+      <xsl:apply-templates select="*" mode="ati.xsl11.bookmarks"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>