home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _014D37B7A9074C7298D7409C867B7A7C < prev    next >
Encoding:
Extensible Markup Language  |  2002-08-30  |  6.9 KB  |  226 lines

  1. <?xml version="1.0" encoding="US-ASCII"?>
  2. <!--This file was created automatically by html2xhtml-->
  3. <!--from the HTML stylesheets. Do not edit this file.-->
  4. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" version="1.0" exclude-result-prefixes="doc">
  5.  
  6. <xsl:import href="docbook.xsl"/>
  7. <xsl:import href="chunk-common.xsl"/>
  8.  
  9. <xsl:template name="chunk">
  10.   <xsl:param name="node" select="."/>
  11.   <!-- returns 1 if $node is a chunk -->
  12.  
  13.   <xsl:variable name="id">
  14.     <xsl:call-template name="object.id">
  15.       <xsl:with-param name="object" select="$node"/>
  16.     </xsl:call-template>
  17.   </xsl:variable>
  18.  
  19.   <xsl:variable name="chunks" select="document($chunk.toc,$node)"/>
  20.  
  21.   <xsl:choose>
  22.     <xsl:when test="$chunks//tocentry[@linkend=$id]">1</xsl:when>
  23.     <xsl:otherwise>0</xsl:otherwise>
  24.   </xsl:choose>
  25. </xsl:template>
  26.  
  27. <!-- ==================================================================== -->
  28.  
  29. <xsl:template match="*" mode="chunk-filename">
  30.   <!-- returns the filename of a chunk -->
  31.  
  32.   <xsl:variable name="id">
  33.     <xsl:call-template name="object.id"/>
  34.   </xsl:variable>
  35.  
  36.   <xsl:variable name="chunks" select="document($chunk.toc,.)"/>
  37.  
  38.   <xsl:variable name="chunk" select="$chunks//tocentry[@linkend=$id]"/>
  39.   <xsl:variable name="filename">
  40.     <xsl:call-template name="dbhtml-filename">
  41.       <xsl:with-param name="pis" select="$chunk/processing-instruction('dbhtml')"/>
  42.     </xsl:call-template>
  43.   </xsl:variable>
  44.  
  45.   <xsl:choose>
  46.     <xsl:when test="$chunk">
  47.       <xsl:value-of select="$filename"/>
  48.     </xsl:when>
  49.     <xsl:otherwise>
  50.       <xsl:apply-templates select="parent::*" mode="chunk-filename"/>
  51.     </xsl:otherwise>
  52.   </xsl:choose>
  53. </xsl:template>
  54.  
  55. <!-- ==================================================================== -->
  56.  
  57. <xsl:template name="process-chunk">
  58.   <xsl:variable name="id">
  59.     <xsl:call-template name="object.id"/>
  60.   </xsl:variable>
  61.  
  62.   <xsl:variable name="chunks" select="document($chunk.toc,.)"/>
  63.  
  64.   <xsl:variable name="chunk" select="$chunks//tocentry[@linkend=$id]"/>
  65.   <xsl:variable name="prev-id" select="($chunk/preceding::tocentry                          |$chunk/ancestor::tocentry)[last()]/@linkend"/>
  66.   <xsl:variable name="next-id" select="($chunk/following::tocentry                          |$chunk/child::tocentry)[1]/@linkend"/>
  67.  
  68.   <xsl:variable name="prev" select="key('id',$prev-id)"/>
  69.   <xsl:variable name="next" select="key('id',$next-id)"/>
  70.  
  71.   <xsl:variable name="ischunk">
  72.     <xsl:call-template name="chunk"/>
  73.   </xsl:variable>
  74.  
  75.   <xsl:variable name="chunkfn">
  76.     <xsl:if test="$ischunk='1'">
  77.       <xsl:apply-templates mode="chunk-filename" select="."/>
  78.     </xsl:if>
  79.   </xsl:variable>
  80.  
  81.   <xsl:variable name="filename">
  82.     <xsl:call-template name="make-relative-filename">
  83.       <xsl:with-param name="base.dir" select="$base.dir"/>
  84.       <xsl:with-param name="base.name" select="$chunkfn"/>
  85.     </xsl:call-template>
  86.   </xsl:variable>
  87.  
  88.   <xsl:choose>
  89.     <xsl:when test="$ischunk = 0">
  90.       <xsl:apply-imports/>
  91.     </xsl:when>
  92.  
  93.     <xsl:otherwise>
  94.       <xsl:call-template name="write.chunk">
  95.         <xsl:with-param name="filename" select="$filename"/>
  96.         <xsl:with-param name="content">
  97.           <xsl:call-template name="chunk-element-content">
  98.             <xsl:with-param name="prev" select="$prev"/>
  99.             <xsl:with-param name="next" select="$next"/>
  100.           </xsl:call-template>
  101.         </xsl:with-param>
  102.         <xsl:with-param name="quiet" select="$chunk.quietly"/>
  103.       </xsl:call-template>
  104.     </xsl:otherwise>
  105.   </xsl:choose>
  106. </xsl:template>
  107.  
  108. <!-- ==================================================================== -->
  109.  
  110. <xsl:template match="set">
  111.   <xsl:call-template name="process-chunk"/>
  112. </xsl:template>
  113.  
  114. <xsl:template match="book">
  115.   <xsl:call-template name="process-chunk"/>
  116. </xsl:template>
  117.  
  118. <xsl:template match="book/appendix">
  119.   <xsl:call-template name="process-chunk"/>
  120. </xsl:template>
  121.  
  122. <xsl:template match="book/glossary">
  123.   <xsl:call-template name="process-chunk"/>
  124. </xsl:template>
  125.  
  126. <xsl:template match="book/bibliography">
  127.   <xsl:call-template name="process-chunk"/>
  128. </xsl:template>
  129.  
  130. <xsl:template match="dedication" mode="dedication">
  131.   <xsl:call-template name="process-chunk"/>
  132. </xsl:template>
  133.  
  134. <xsl:template match="preface|chapter">
  135.   <xsl:call-template name="process-chunk"/>
  136. </xsl:template>
  137.  
  138. <xsl:template match="part|reference">
  139.   <xsl:call-template name="process-chunk"/>
  140. </xsl:template>
  141.  
  142. <xsl:template match="refentry">
  143.   <xsl:call-template name="process-chunk"/>
  144. </xsl:template>
  145.  
  146. <xsl:template match="colophon">
  147.   <xsl:call-template name="process-chunk"/>
  148. </xsl:template>
  149.  
  150. <xsl:template match="article">
  151.   <xsl:call-template name="process-chunk"/>
  152. </xsl:template>
  153.  
  154. <xsl:template match="article/appendix">
  155.   <xsl:call-template name="process-chunk"/>
  156. </xsl:template>
  157.  
  158. <xsl:template match="article/glossary">
  159.   <xsl:call-template name="process-chunk"/>
  160. </xsl:template>
  161.  
  162. <xsl:template match="article/bibliography">
  163.   <xsl:call-template name="process-chunk"/>
  164. </xsl:template>
  165.  
  166. <xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
  167.   <xsl:variable name="ischunk">
  168.     <xsl:call-template name="chunk"/>
  169.   </xsl:variable>
  170.  
  171.   <xsl:choose>
  172.     <xsl:when test="$ischunk != 0">
  173.       <xsl:call-template name="process-chunk"/>
  174.     </xsl:when>
  175.     <xsl:otherwise>
  176.       <xsl:apply-imports/>
  177.     </xsl:otherwise>
  178.   </xsl:choose>
  179. </xsl:template>
  180.  
  181. <xsl:template match="setindex                      |book/index                      |article/index">
  182.   <!-- some implementations use completely empty index tags to indicate -->
  183.   <!-- where an automatically generated index should be inserted. so -->
  184.   <!-- if the index is completely empty, skip it. -->
  185.   <xsl:if test="count(*)>0 or $generate.index != '0'">
  186.     <xsl:call-template name="process-chunk"/>
  187.   </xsl:if>
  188. </xsl:template>
  189.  
  190. <!-- ==================================================================== -->
  191.  
  192. <xsl:template match="/">
  193.   <xsl:choose>
  194.     <xsl:when test="$chunk.toc = ''">
  195.       <xsl:message terminate="yes">
  196.         <xsl:text>The chunk.toc file is not set.</xsl:text>
  197.       </xsl:message>
  198.     </xsl:when>
  199.  
  200.     <xsl:when test="$rootid != ''">
  201.       <xsl:choose>
  202.         <xsl:when test="count(key('id',$rootid)) = 0">
  203.           <xsl:message terminate="yes">
  204.             <xsl:text>ID '</xsl:text>
  205.             <xsl:value-of select="$rootid"/>
  206.             <xsl:text>' not found in document.</xsl:text>
  207.           </xsl:message>
  208.         </xsl:when>
  209.         <xsl:otherwise>
  210.           <xsl:apply-templates select="key('id',$rootid)"/>
  211.         </xsl:otherwise>
  212.       </xsl:choose>
  213.     </xsl:when>
  214.  
  215.     <xsl:otherwise>
  216.       <xsl:apply-templates select="/" mode="process.root"/>
  217.     </xsl:otherwise>
  218.   </xsl:choose>
  219. </xsl:template>
  220.  
  221. <xsl:template match="*" mode="process.root">
  222.   <xsl:apply-templates select="."/>
  223. </xsl:template>
  224.  
  225. </xsl:stylesheet>
  226.