home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _6DBE0C92D30C435A83172D913D4D0128 < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-04  |  4.5 KB  |  119 lines

  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
  4.                 xmlns:rx="http://www.renderx.com/XSL/Extensions"
  5.                 version='1.0'>
  6.  
  7. <!-- ********************************************************************
  8.      $Id: xep.xsl,v 1.1.2.1 2002/09/04 14:25:51 jdj Exp $
  9.      ********************************************************************
  10.      (c) Stephane Bline Peregrine Systems 2001
  11.      Implementation of xep extensions:
  12.        * Pdf bookmarks (based on the XEP 2.5 implementation)
  13.        * Document information (XEP 2.5 meta information extensions)
  14.      ******************************************************************** -->
  15.  
  16. <!-- ********************************************************************
  17.      Document information
  18.      In PDF bookmarks can't be used characters with code>255. This version of file
  19.      translates characters with code>255 back to ASCII.
  20.  
  21.         Pavel Zampach (zampach@volny.cz)
  22.  
  23.      ********************************************************************-->
  24.  
  25. <!-- FIXME: Norm, I changed things so that the top-level element (book or set)
  26.      does not appear in the TOC. Is this the right thing? -->
  27.  
  28. <xsl:template name="xep-document-information">
  29.   <rx:meta-info>
  30.     <xsl:if test="//author[1]">
  31.       <xsl:element name="rx:meta-field">
  32.         <xsl:attribute name="name">author</xsl:attribute>
  33.         <xsl:attribute name="value">
  34.           <xsl:call-template name="person.name">
  35.             <xsl:with-param name="node" select="//author[1]"/>
  36.           </xsl:call-template>
  37.         </xsl:attribute>
  38.       </xsl:element>
  39.     </xsl:if>
  40.  
  41.     <xsl:variable name="title">
  42.       <xsl:apply-templates select="/*[1]" mode="label.markup"/>
  43.       <xsl:apply-templates select="/*[1]" mode="title.markup"/>
  44.     </xsl:variable>
  45.  
  46.     <xsl:element name="rx:meta-field">
  47.       <xsl:attribute name="name">title</xsl:attribute>
  48.       <xsl:attribute name="value">
  49.         <xsl:value-of select="$title"/>
  50.       </xsl:attribute>
  51.     </xsl:element>
  52.   </rx:meta-info>
  53. </xsl:template>
  54.  
  55. <!-- ********************************************************************
  56.      Pdf bookmarks
  57.      ******************************************************************** -->
  58.  
  59. <xsl:template match="*" mode="xep.outline">
  60.   <xsl:apply-templates select="*" mode="xep.outline"/>
  61. </xsl:template>
  62.  
  63. <xsl:template match="set|book|part|reference|preface|chapter|appendix|article
  64.                      |glossary|bibliography|index|setindex
  65.                      |refentry
  66.                      |sect1|sect2|sect3|sect4|sect5|section"
  67.               mode="xep.outline">
  68.   <xsl:variable name="id">
  69.     <xsl:call-template name="object.id"/>
  70.   </xsl:variable>
  71.   <xsl:variable name="bookmark-label">
  72.     <xsl:apply-templates select="." mode="object.title.markup"/>
  73.   </xsl:variable>
  74.  
  75.   <!-- Put the root element bookmark at the same level as its children -->
  76.   <!-- If the object is a set or book, generate a bookmark for the toc -->
  77.  
  78.   <xsl:choose>
  79.     <xsl:when test="parent::*">
  80.       <rx:bookmark internal-destination="{$id}">
  81.         <rx:bookmark-label>
  82.           <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
  83.         </rx:bookmark-label>
  84.         <xsl:apply-templates select="*" mode="xep.outline"/>
  85.       </rx:bookmark>
  86.     </xsl:when>
  87.     <xsl:otherwise>
  88.       <xsl:if test="$bookmark-label != ''">
  89.         <rx:bookmark internal-destination="{$id}">
  90.           <rx:bookmark-label>
  91.             <xsl:value-of select="translate($bookmark-label, $a-dia, $a-asc)"/>
  92.           </rx:bookmark-label>
  93.         </rx:bookmark>
  94.       </xsl:if>
  95.  
  96.       <xsl:variable name="toc.params">
  97.         <xsl:call-template name="find.path.params">
  98.           <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
  99.         </xsl:call-template>
  100.       </xsl:variable>
  101.       <xsl:if test="contains($toc.params, 'toc')
  102.                     and set|book|part|reference|section|sect1|refentry
  103.                         |article|bibliography|glossary
  104.                         |appendix">
  105.         <rx:bookmark internal-destination="toc...{$id}">
  106.           <rx:bookmark-label>
  107.             <xsl:call-template name="gentext">
  108.               <xsl:with-param name="key" select="'TableofContents'"/>
  109.             </xsl:call-template>
  110.           </rx:bookmark-label>
  111.         </rx:bookmark>
  112.       </xsl:if>
  113.       <xsl:apply-templates select="*" mode="xep.outline"/>
  114.     </xsl:otherwise>
  115.   </xsl:choose>
  116. </xsl:template>
  117.  
  118. </xsl:stylesheet>
  119.