1 <?xml version="1.0" encoding="US-ASCII"?>
 
   2 <!--This file was created automatically by xsl2profile-->
 
   3 <!--from the DocBook XSL stylesheets.-->
 
   4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook" xmlns:exslt="http://exslt.org/common" exslt:dummy="dummy" ng:dummy="dummy" db:dummy="dummy" extension-element-prefixes="exslt" exclude-result-prefixes="db ng exsl exslt" version="1.0">
 
   6 <!-- It is important to use indent="no" here, otherwise verbatim -->
 
   7 <!-- environments get broken by indented tags...at least when the -->
 
   8 <!-- callout extension is used...at least with some processors -->
 
   9 <xsl:output method="xml" indent="no"/>
 
  11 <!-- ********************************************************************
 
  12      $Id: docbook.xsl 8913 2010-10-01 04:44:57Z bobstayton $
 
  13      ********************************************************************
 
  15      This file is part of the XSL DocBook Stylesheet distribution.
 
  16      See ../README or http://docbook.sf.net/release/xsl/current/ for
 
  17      copyright and other information.
 
  19      ******************************************************************** -->
 
  21 <!-- ==================================================================== -->
 
  23 <xsl:include href="../VERSION"/>
 
  24 <xsl:include href="param.xsl"/>
 
  25 <xsl:include href="../lib/lib.xsl"/>
 
  26 <xsl:include href="../common/l10n.xsl"/>
 
  27 <xsl:include href="../common/common.xsl"/>
 
  28 <xsl:include href="../common/utility.xsl"/>
 
  29 <xsl:include href="../common/labels.xsl"/>
 
  30 <xsl:include href="../common/titles.xsl"/>
 
  31 <xsl:include href="../common/subtitles.xsl"/>
 
  32 <xsl:include href="../common/gentext.xsl"/>
 
  33 <xsl:include href="../common/olink.xsl"/>
 
  34 <xsl:include href="../common/targets.xsl"/>
 
  35 <xsl:include href="../common/pi.xsl"/>
 
  36 <xsl:include href="autotoc.xsl"/>
 
  37 <xsl:include href="autoidx.xsl"/>
 
  38 <xsl:include href="lists.xsl"/>
 
  39 <xsl:include href="callout.xsl"/>
 
  40 <xsl:include href="verbatim.xsl"/>
 
  41 <xsl:include href="graphics.xsl"/>
 
  42 <xsl:include href="xref.xsl"/>
 
  43 <xsl:include href="formal.xsl"/>
 
  44 <xsl:include href="table.xsl"/>
 
  45 <xsl:include href="htmltbl.xsl"/>
 
  46 <xsl:include href="sections.xsl"/>
 
  47 <xsl:include href="inline.xsl"/>
 
  48 <xsl:include href="footnote.xsl"/>
 
  49 <xsl:include href="fo.xsl"/>
 
  50 <xsl:include href="fo-rtf.xsl"/>
 
  51 <xsl:include href="info.xsl"/>
 
  52 <xsl:include href="keywords.xsl"/>
 
  53 <xsl:include href="division.xsl"/>
 
  54 <xsl:include href="index.xsl"/>
 
  55 <xsl:include href="toc.xsl"/>
 
  56 <xsl:include href="refentry.xsl"/>
 
  57 <xsl:include href="math.xsl"/>
 
  58 <xsl:include href="admon.xsl"/>
 
  59 <xsl:include href="component.xsl"/>
 
  60 <xsl:include href="biblio.xsl"/>
 
  61 <xsl:include href="biblio-iso690.xsl"/>
 
  62 <xsl:include href="glossary.xsl"/>
 
  63 <xsl:include href="block.xsl"/>
 
  64 <xsl:include href="task.xsl"/>
 
  65 <xsl:include href="qandaset.xsl"/>
 
  66 <xsl:include href="synop.xsl"/>
 
  67 <xsl:include href="titlepage.xsl"/>
 
  68 <xsl:include href="titlepage.templates.xsl"/>
 
  69 <xsl:include href="pagesetup.xsl"/>
 
  70 <xsl:include href="pi.xsl"/>
 
  71 <xsl:include href="spaces.xsl"/>
 
  72 <xsl:include href="ebnf.xsl"/>
 
  73 <xsl:include href="../html/chunker.xsl"/>
 
  74 <xsl:include href="annotations.xsl"/>
 
  75 <xsl:include href="../common/stripns.xsl"/>
 
  77 <xsl:include href="fop.xsl"/>
 
  78 <xsl:include href="fop1.xsl"/>
 
  79 <xsl:include href="passivetex.xsl"/>
 
  80 <xsl:include href="xep.xsl"/>
 
  81 <xsl:include href="axf.xsl"/>
 
  82 <xsl:include href="ptc.xsl"/>
 
  84 <xsl:param name="stylesheet.result.type" select="'fo'"/>
 
  86 <!-- ==================================================================== -->
 
  88 <xsl:key name="id" match="*" use="@id|@xml:id"/>
 
  90 <!-- ==================================================================== -->
 
  92 <xsl:template match="*">
 
  94     <xsl:text>Element </xsl:text>
 
  95     <xsl:value-of select="local-name(.)"/>
 
  96     <xsl:text> in namespace '</xsl:text>
 
  97     <xsl:value-of select="namespace-uri(.)"/>
 
  98     <xsl:text>' encountered</xsl:text>
 
  99     <xsl:if test="parent::*">
 
 100       <xsl:text> in </xsl:text>
 
 101       <xsl:value-of select="name(parent::*)"/>
 
 103     <xsl:text>, but no template matches.</xsl:text>
 
 106   <fo:block color="red">
 
 107     <xsl:text><</xsl:text>
 
 108     <xsl:value-of select="name(.)"/>
 
 109     <xsl:text>></xsl:text>
 
 110     <xsl:apply-templates/> 
 
 111     <xsl:text></</xsl:text>
 
 112     <xsl:value-of select="name(.)"/>
 
 113     <xsl:text>></xsl:text>
 
 117 <!-- Update this list if new root elements supported -->
 
 118 <xsl:variable name="root.elements" select="' appendix article bibliography book chapter colophon dedication glossary index part preface qandaset refentry reference sect1 section set setindex '"/>
 
 120 <xslo:include xmlns:xslo="http://www.w3.org/1999/XSL/Transform" href="../profiling/profile-mode.xsl"/><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-content"><xslo:choose><xslo:when test="*/self::ng:* or */self::db:*"><xslo:message>Note: namesp. cut : stripped namespace before processing</xslo:message><xslo:variable name="stripped-content"><xslo:apply-templates select="/" mode="stripNS"/></xslo:variable><xslo:message>Note: namesp. cut : processing stripped document</xslo:message><xslo:apply-templates select="exslt:node-set($stripped-content)" mode="profile"/></xslo:when><xslo:otherwise><xslo:apply-templates select="/" mode="profile"/></xslo:otherwise></xslo:choose></xslo:variable><xslo:variable xmlns:xslo="http://www.w3.org/1999/XSL/Transform" name="profiled-nodes" select="exslt:node-set($profiled-content)"/><xsl:template match="/">
 
 121   <!-- * Get a title for current doc so that we let the user -->
 
 122   <!-- * know what document we are processing at this point. -->
 
 123   <xsl:variable name="doc.title">
 
 124     <xsl:call-template name="get.doc.title"/>
 
 127     <!-- Hack! If someone hands us a DocBook V5.x or DocBook NG document,
 
 128          toss the namespace and continue.  Use the docbook5 namespaced
 
 129          stylesheets for DocBook5 if you don't want to use this feature.-->
 
 130     <xsl:when test="false()"/>
 
 131     <!-- Can't process unless namespace removed -->
 
 132     <xsl:when test="false()"/>
 
 135         <xsl:when test="$rootid != ''">
 
 136           <xsl:variable name="root.element" select="key('id', $rootid)"/>
 
 138             <xsl:when test="count($root.element) = 0">
 
 139               <xsl:message terminate="yes">
 
 140                 <xsl:text>ID '</xsl:text>
 
 141                 <xsl:value-of select="$rootid"/>
 
 142                 <xsl:text>' not found in document.</xsl:text>
 
 145             <xsl:when test="not(contains($root.elements, concat(' ', local-name($root.element), ' ')))">
 
 146               <xsl:message terminate="yes">
 
 147                 <xsl:text>ERROR: Document root element ($rootid=</xsl:text>
 
 148                 <xsl:value-of select="$rootid"/>
 
 149                 <xsl:text>) for FO output </xsl:text>
 
 150                 <xsl:text>must be one of the following elements:</xsl:text>
 
 151                 <xsl:value-of select="$root.elements"/>
 
 154             <!-- Otherwise proceed -->
 
 156               <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
 
 157                 <xsl:apply-templates select="$root.element" mode="collect.targets"/>
 
 159               <xsl:if test="$collect.xref.targets != 'only'">
 
 160                 <xsl:apply-templates select="$root.element" mode="process.root"/>
 
 165         <!-- Otherwise process the document root element -->
 
 167           <xsl:variable name="document.element" select="*[1]"/>
 
 169             <xsl:when test="not(contains($root.elements,                      concat(' ', local-name($document.element), ' ')))">
 
 170               <xsl:message terminate="yes">
 
 171                 <xsl:text>ERROR: Document root element for FO output </xsl:text>
 
 172                 <xsl:text>must be one of the following elements:</xsl:text>
 
 173                 <xsl:value-of select="$root.elements"/>
 
 176             <!-- Otherwise proceed -->
 
 178               <xsl:if test="$collect.xref.targets = 'yes' or                             $collect.xref.targets = 'only'">
 
 179                 <xsl:apply-templates select="$profiled-nodes" mode="collect.targets"/>
 
 181               <xsl:if test="$collect.xref.targets != 'only'">
 
 182                 <xsl:apply-templates select="$profiled-nodes" mode="process.root"/>
 
 192 <xsl:template match="*" mode="process.root">
 
 193   <xsl:variable name="document.element" select="self::*"/>
 
 195   <xsl:call-template name="root.messages"/>
 
 197   <xsl:variable name="title">
 
 199       <xsl:when test="$document.element/title[1]">
 
 200         <xsl:value-of select="$document.element/title[1]"/>
 
 202       <xsl:otherwise>[could not find document title]</xsl:otherwise>
 
 206   <!-- Include all id values in XEP output -->
 
 207   <xsl:if test="$xep.extensions != 0">
 
 208     <xsl:processing-instruction name="xep-pdf-drop-unused-destinations">false</xsl:processing-instruction>
 
 211   <fo:root xsl:use-attribute-sets="root.properties">
 
 212     <xsl:attribute name="language">
 
 213       <xsl:call-template name="l10n.language">
 
 214         <xsl:with-param name="target" select="/*[1]"/>
 
 218     <xsl:if test="$xep.extensions != 0">
 
 219       <xsl:call-template name="xep-pis"/>
 
 220       <xsl:call-template name="xep-document-information"/>
 
 222     <xsl:if test="$axf.extensions != 0">
 
 223       <xsl:call-template name="axf-document-information"/>
 
 226     <xsl:call-template name="setup.pagemasters"/>
 
 228     <xsl:if test="$fop.extensions != 0">
 
 229       <xsl:apply-templates select="$document.element" mode="fop.outline"/>
 
 232     <xsl:if test="$fop1.extensions != 0">
 
 233       <xsl:call-template name="fop1-document-information"/>
 
 234       <xsl:variable name="bookmarks">
 
 235         <xsl:apply-templates select="$document.element" mode="fop1.outline"/>
 
 237       <xsl:if test="string($bookmarks) != ''">
 
 239           <xsl:copy-of select="$bookmarks"/>
 
 242       <xsl:apply-templates select="$document.element" mode="fop1.foxdest"/>
 
 245     <xsl:if test="$xep.extensions != 0">
 
 246       <xsl:variable name="bookmarks">
 
 247         <xsl:apply-templates select="$document.element" mode="xep.outline"/>
 
 249       <xsl:if test="string($bookmarks) != ''">
 
 250         <rx:outline xmlns:rx="http://www.renderx.com/XSL/Extensions">
 
 251           <xsl:copy-of select="$bookmarks"/>
 
 256     <xsl:if test="$arbortext.extensions != 0 and $ati.xsl11.bookmarks != 0">
 
 257       <xsl:variable name="bookmarks">
 
 258         <xsl:apply-templates select="$document.element" mode="ati.xsl11.bookmarks"/>
 
 260       <xsl:if test="string($bookmarks) != ''">
 
 262           <xsl:copy-of select="$bookmarks"/>
 
 267     <xsl:apply-templates select="$document.element"/>
 
 271 <xsl:template name="root.messages">
 
 272   <!-- redefine this any way you'd like to output messages -->
 
 273   <!-- DO NOT OUTPUT ANYTHING FROM THIS TEMPLATE -->
 
 275     <xsl:text>Making </xsl:text>
 
 276     <xsl:value-of select="$page.orientation"/>
 
 277     <xsl:text> pages on </xsl:text>
 
 278     <xsl:value-of select="$paper.type"/>
 
 279     <xsl:text> paper (</xsl:text>
 
 280     <xsl:value-of select="$page.width"/>
 
 281     <xsl:text>x</xsl:text>
 
 282     <xsl:value-of select="$page.height"/>
 
 283     <xsl:text>)</xsl:text>
 
 287 <!-- ==================================================================== -->