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

  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.                 version="1.0">
  4.  
  5. <xsl:template name="chunk">
  6.   <xsl:param name="node" select="."/>
  7.   <!-- returns 1 if $node is a chunk -->
  8.  
  9.   <!-- ==================================================================== -->
  10.   <!-- What's a chunk?
  11.  
  12.        The root element
  13.        appendix
  14.        article
  15.        bibliography  in article or book
  16.        book
  17.        chapter
  18.        colophon
  19.        glossary      in article or book
  20.        index         in article or book
  21.        part
  22.        preface
  23.        refentry
  24.        reference
  25.        sect{1,2,3,4,5}  if position()>1 && depth < chunk.section.depth
  26.        section          if position()>1 && depth < chunk.section.depth
  27.        set
  28.        setindex
  29.                                                                             -->
  30.   <!-- ==================================================================== -->
  31.  
  32. <!--
  33.   <xsl:message>
  34.     <xsl:text>chunk: </xsl:text>
  35.     <xsl:value-of select="name($node)"/>
  36.     <xsl:text>(</xsl:text>
  37.     <xsl:value-of select="$node/@id"/>
  38.     <xsl:text>)</xsl:text>
  39.     <xsl:text> csd: </xsl:text>
  40.     <xsl:value-of select="$chunk.section.depth"/>
  41.     <xsl:text> cfs: </xsl:text>
  42.     <xsl:value-of select="$chunk.first.sections"/>
  43.     <xsl:text> ps: </xsl:text>
  44.     <xsl:value-of select="count($node/parent::section)"/>
  45.     <xsl:text> prs: </xsl:text>
  46.     <xsl:value-of select="count($node/preceding-sibling::section)"/>
  47.   </xsl:message>
  48. -->
  49.  
  50.   <xsl:choose>
  51.     <xsl:when test="not($node/parent::*)">1</xsl:when>
  52.  
  53.     <xsl:when test="local-name($node) = 'sect1'
  54.                     and $chunk.section.depth >= 1
  55.                     and ($chunk.first.sections != 0
  56.                          or count($node/preceding-sibling::sect1) > 0)">
  57.       <xsl:text>1</xsl:text>
  58.     </xsl:when>
  59.     <xsl:when test="local-name($node) = 'sect2'
  60.                     and $chunk.section.depth >= 2
  61.                     and ($chunk.first.sections != 0
  62.                          or count($node/preceding-sibling::sect2) > 0)">
  63.       <xsl:call-template name="chunk">
  64.         <xsl:with-param name="node" select="$node/parent::*"/>
  65.       </xsl:call-template>
  66.     </xsl:when>
  67.     <xsl:when test="local-name($node) = 'sect3'
  68.                     and $chunk.section.depth >= 3
  69.                     and ($chunk.first.sections != 0
  70.                          or count($node/preceding-sibling::sect3) > 0)">
  71.       <xsl:call-template name="chunk">
  72.         <xsl:with-param name="node" select="$node/parent::*"/>
  73.       </xsl:call-template>
  74.     </xsl:when>
  75.     <xsl:when test="local-name($node) = 'sect4'
  76.                     and $chunk.section.depth >= 4
  77.                     and ($chunk.first.sections != 0
  78.                          or count($node/preceding-sibling::sect4) > 0)">
  79.       <xsl:call-template name="chunk">
  80.         <xsl:with-param name="node" select="$node/parent::*"/>
  81.       </xsl:call-template>
  82.     </xsl:when>
  83.     <xsl:when test="local-name($node) = 'sect5'
  84.                     and $chunk.section.depth >= 5
  85.                     and ($chunk.first.sections != 0
  86.                          or count($node/preceding-sibling::sect5) > 0)">
  87.       <xsl:call-template name="chunk">
  88.         <xsl:with-param name="node" select="$node/parent::*"/>
  89.       </xsl:call-template>
  90.     </xsl:when>
  91.     <xsl:when test="local-name($node) = 'section'
  92.                     and $chunk.section.depth >= count($node/ancestor::section)+1
  93.                     and ($chunk.first.sections != 0
  94.                          or count($node/preceding-sibling::section) > 0)">
  95.       <xsl:call-template name="chunk">
  96.         <xsl:with-param name="node" select="$node/parent::*"/>
  97.       </xsl:call-template>
  98.     </xsl:when>
  99.  
  100.     <xsl:when test="name($node)='preface'">1</xsl:when>
  101.     <xsl:when test="name($node)='chapter'">1</xsl:when>
  102.     <xsl:when test="name($node)='appendix'">1</xsl:when>
  103.     <xsl:when test="name($node)='article'">1</xsl:when>
  104.     <xsl:when test="name($node)='part'">1</xsl:when>
  105.     <xsl:when test="name($node)='reference'">1</xsl:when>
  106.     <xsl:when test="name($node)='refentry'">1</xsl:when>
  107.     <xsl:when test="name($node)='index'
  108.                     and (name($node/parent::*) = 'article'
  109.                          or name($node/parent::*) = 'book')">1</xsl:when>
  110.     <xsl:when test="name($node)='bibliography'
  111.                     and (name($node/parent::*) = 'article'
  112.                          or name($node/parent::*) = 'book')">1</xsl:when>
  113.     <xsl:when test="name($node)='glossary'
  114.                     and (name($node/parent::*) = 'article'
  115.                          or name($node/parent::*) = 'book')">1</xsl:when>
  116.     <xsl:when test="name($node)='colophon'">1</xsl:when>
  117.     <xsl:when test="name($node)='book'">1</xsl:when>
  118.     <xsl:when test="name($node)='set'">1</xsl:when>
  119.     <xsl:when test="name($node)='setindex'">1</xsl:when>
  120.     <xsl:otherwise>0</xsl:otherwise>
  121.   </xsl:choose>
  122. </xsl:template>
  123.  
  124. <!-- ==================================================================== -->
  125.  
  126. <xsl:template match="*" mode="chunk-filename">
  127.   <xsl:variable name="fn">
  128.     <xsl:apply-templates select="." mode="recursive-chunk-filename"/>
  129.   </xsl:variable>
  130.  
  131.   <xsl:if test="$fn != ''">
  132.     <xsl:call-template name="dbhtml-dir"/>
  133.   </xsl:if>
  134.  
  135.   <xsl:value-of select="$fn"/>
  136.   <xsl:value-of select="$html.ext"/>
  137. </xsl:template>
  138.  
  139. <xsl:template match="*" mode="recursive-chunk-filename">
  140.   <xsl:param name="recursive" select="false()"/>
  141.  
  142.   <!-- returns the filename of a chunk -->
  143.   <xsl:variable name="ischunk">
  144.     <xsl:call-template name="chunk"/>
  145.   </xsl:variable>
  146.  
  147.   <xsl:variable name="dbhtml-filename">
  148.     <xsl:call-template name="dbhtml-filename"/>
  149.   </xsl:variable>
  150.  
  151.   <xsl:variable name="filename">
  152.     <xsl:choose>
  153.       <xsl:when test="$dbhtml-filename != ''">
  154.         <xsl:value-of select="$dbhtml-filename"/>
  155.       </xsl:when>
  156.       <!-- if this is the root element, use the root.filename -->
  157.       <xsl:when test="not(parent::*) and $root.filename != ''">
  158.         <xsl:value-of select="$root.filename"/>
  159.       </xsl:when>
  160.       <!-- if there's no dbhtml filename, and if we're to use IDs as -->
  161.       <!-- filenames, then use the ID to generate the filename. -->
  162.       <xsl:when test="@id and $use.id.as.filename != 0">
  163.         <xsl:value-of select="@id"/>
  164.       </xsl:when>
  165.       <xsl:otherwise></xsl:otherwise>
  166.     </xsl:choose>
  167.   </xsl:variable>
  168.  
  169.   <xsl:choose>
  170.     <xsl:when test="$ischunk='0'">
  171.       <!-- if called on something that isn't a chunk, walk up... -->
  172.       <xsl:choose>
  173.         <xsl:when test="count(parent::*)>0">
  174.           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  175.             <xsl:with-param name="recursive" select="$recursive"/>
  176.           </xsl:apply-templates>
  177.         </xsl:when>
  178.         <!-- unless there is no up, in which case return "" -->
  179.         <xsl:otherwise></xsl:otherwise>
  180.       </xsl:choose>
  181.     </xsl:when>
  182.  
  183.     <xsl:when test="not($recursive) and $filename != ''">
  184.       <!-- if this chunk has an explicit name, use it -->
  185.       <xsl:value-of select="$filename"/>
  186.     </xsl:when>
  187.  
  188.     <xsl:when test="name(.)='set'">
  189.       <xsl:value-of select="$root.filename"/>
  190.     </xsl:when>
  191.  
  192.     <xsl:when test="name(.)='book'">
  193.       <xsl:text>bk</xsl:text>
  194.       <xsl:number level="any" format="01"/>
  195.     </xsl:when>
  196.  
  197.     <xsl:when test="name(.)='article'">
  198.       <xsl:if test="/set">
  199.         <!-- in a set, make sure we inherit the right book info... -->
  200.         <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  201.           <xsl:with-param name="recursive" select="true()"/>
  202.         </xsl:apply-templates>
  203.       </xsl:if>
  204.  
  205.       <xsl:text>ar</xsl:text>
  206.       <xsl:number level="any" format="01" from="book"/>
  207.     </xsl:when>
  208.  
  209.     <xsl:when test="name(.)='preface'">
  210.       <xsl:if test="/set">
  211.         <!-- in a set, make sure we inherit the right book info... -->
  212.         <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  213.           <xsl:with-param name="recursive" select="true()"/>
  214.         </xsl:apply-templates>
  215.       </xsl:if>
  216.  
  217.       <xsl:text>pr</xsl:text>
  218.       <xsl:number level="any" format="01" from="book"/>
  219.     </xsl:when>
  220.  
  221.     <xsl:when test="name(.)='chapter'">
  222.       <xsl:if test="/set">
  223.         <!-- in a set, make sure we inherit the right book info... -->
  224.         <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  225.           <xsl:with-param name="recursive" select="true()"/>
  226.         </xsl:apply-templates>
  227.       </xsl:if>
  228.  
  229.       <xsl:text>ch</xsl:text>
  230.       <xsl:number level="any" format="01" from="book"/>
  231.     </xsl:when>
  232.  
  233.     <xsl:when test="name(.)='appendix'">
  234.       <xsl:if test="/set">
  235.         <!-- in a set, make sure we inherit the right book info... -->
  236.         <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  237.           <xsl:with-param name="recursive" select="true()"/>
  238.         </xsl:apply-templates>
  239.       </xsl:if>
  240.  
  241.       <xsl:text>ap</xsl:text>
  242.       <xsl:number level="any" format="a" from="book"/>
  243.     </xsl:when>
  244.  
  245.     <xsl:when test="name(.)='part'">
  246.       <xsl:choose>
  247.         <xsl:when test="/set">
  248.           <!-- in a set, make sure we inherit the right book info... -->
  249.           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  250.             <xsl:with-param name="recursive" select="true()"/>
  251.           </xsl:apply-templates>
  252.         </xsl:when>
  253.         <xsl:otherwise>
  254.         </xsl:otherwise>
  255.       </xsl:choose>
  256.  
  257.       <xsl:text>pt</xsl:text>
  258.       <xsl:number level="any" format="01" from="book"/>
  259.     </xsl:when>
  260.  
  261.     <xsl:when test="name(.)='reference'">
  262.       <xsl:choose>
  263.         <xsl:when test="/set">
  264.           <!-- in a set, make sure we inherit the right book info... -->
  265.           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  266.             <xsl:with-param name="recursive" select="true()"/>
  267.           </xsl:apply-templates>
  268.         </xsl:when>
  269.         <xsl:otherwise>
  270.         </xsl:otherwise>
  271.       </xsl:choose>
  272.  
  273.       <xsl:text>rn</xsl:text>
  274.       <xsl:number level="any" format="01" from="book"/>
  275.     </xsl:when>
  276.  
  277.     <xsl:when test="name(.)='refentry'">
  278.       <xsl:choose>
  279.         <xsl:when test="parent::reference">
  280.           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  281.             <xsl:with-param name="recursive" select="true()"/>
  282.           </xsl:apply-templates>
  283.         </xsl:when>
  284.         <xsl:otherwise>
  285.         </xsl:otherwise>
  286.       </xsl:choose>
  287.  
  288.       <xsl:text>re</xsl:text>
  289.       <xsl:number level="any" format="01" from="book"/>
  290.     </xsl:when>
  291.  
  292.     <xsl:when test="name(.)='colophon'">
  293.       <xsl:choose>
  294.         <xsl:when test="/set">
  295.           <!-- in a set, make sure we inherit the right book info... -->
  296.           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  297.             <xsl:with-param name="recursive" select="true()"/>
  298.           </xsl:apply-templates>
  299.         </xsl:when>
  300.         <xsl:otherwise>
  301.         </xsl:otherwise>
  302.       </xsl:choose>
  303.  
  304.       <xsl:text>co</xsl:text>
  305.       <xsl:number level="any" format="01" from="book"/>
  306.     </xsl:when>
  307.  
  308.     <xsl:when test="local-name(.) = 'sect1'
  309.                     or local-name(.) = 'sect2'
  310.                     or local-name(.) = 'sect3'
  311.                     or local-name(.) = 'sect4'
  312.                     or local-name(.) = 'sect5'
  313.                     or local-name(.) = 'section'">
  314.       <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  315.         <xsl:with-param name="recursive" select="true()"/>
  316.       </xsl:apply-templates>
  317.       <xsl:text>s</xsl:text>
  318.       <xsl:number format="01"/>
  319.     </xsl:when>
  320.  
  321.     <xsl:when test="name(.)='sect1' or name(.)='section'">
  322.       <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  323.         <xsl:with-param name="recursive" select="true()"/>
  324.       </xsl:apply-templates>
  325.       <xsl:text>s</xsl:text>
  326.       <xsl:number level="any" format="01" from="preface|chapter|appendix"/>
  327.     </xsl:when>
  328.  
  329.     <xsl:when test="name(.)='bibliography'">
  330.       <xsl:choose>
  331.         <xsl:when test="/set">
  332.           <!-- in a set, make sure we inherit the right book info... -->
  333.           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  334.             <xsl:with-param name="recursive" select="true()"/>
  335.           </xsl:apply-templates>
  336.         </xsl:when>
  337.         <xsl:otherwise>
  338.         </xsl:otherwise>
  339.       </xsl:choose>
  340.  
  341.       <xsl:text>bi</xsl:text>
  342.       <xsl:number level="any" format="01" from="book"/>
  343.     </xsl:when>
  344.  
  345.     <xsl:when test="name(.)='glossary'">
  346.       <xsl:choose>
  347.         <xsl:when test="/set">
  348.           <!-- in a set, make sure we inherit the right book info... -->
  349.           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  350.             <xsl:with-param name="recursive" select="true()"/>
  351.           </xsl:apply-templates>
  352.         </xsl:when>
  353.         <xsl:otherwise>
  354.         </xsl:otherwise>
  355.       </xsl:choose>
  356.  
  357.       <xsl:text>go</xsl:text>
  358.       <xsl:number level="any" format="01" from="book"/>
  359.     </xsl:when>
  360.  
  361.     <xsl:when test="name(.)='index'">
  362.       <xsl:choose>
  363.         <xsl:when test="/set">
  364.           <!-- in a set, make sure we inherit the right book info... -->
  365.           <xsl:apply-templates mode="recursive-chunk-filename" select="parent::*">
  366.             <xsl:with-param name="recursive" select="true()"/>
  367.           </xsl:apply-templates>
  368.         </xsl:when>
  369.         <xsl:otherwise>
  370.         </xsl:otherwise>
  371.       </xsl:choose>
  372.  
  373.       <xsl:text>ix</xsl:text>
  374.       <xsl:number level="any" format="01" from="book"/>
  375.     </xsl:when>
  376.  
  377.     <xsl:when test="name(.)='setindex'">
  378.       <xsl:text>si</xsl:text>
  379.       <xsl:number level="any" format="01" from="set"/>
  380.     </xsl:when>
  381.  
  382.     <xsl:otherwise>
  383.       <xsl:text>chunk-filename-error-</xsl:text>
  384.       <xsl:value-of select="name(.)"/>
  385.       <xsl:number level="any" format="01" from="set"/>
  386.     </xsl:otherwise>
  387.   </xsl:choose>
  388. </xsl:template>
  389.  
  390. <!-- ==================================================================== -->
  391.  
  392. <xsl:template name="href.target.uri">
  393.   <xsl:param name="object" select="."/>
  394.   <xsl:variable name="ischunk">
  395.     <xsl:call-template name="chunk">
  396.       <xsl:with-param name="node" select="$object"/>
  397.     </xsl:call-template>
  398.   </xsl:variable>
  399.  
  400.   <xsl:apply-templates mode="chunk-filename" select="$object"/>
  401.  
  402.   <xsl:if test="$ischunk='0'">
  403.     <xsl:text>#</xsl:text>
  404.     <xsl:call-template name="object.id">
  405.       <xsl:with-param name="object" select="$object"/>
  406.     </xsl:call-template>
  407.   </xsl:if>
  408. </xsl:template>
  409.  
  410. <xsl:template name="href.target">
  411.   <xsl:param name="context" select="."/>
  412.   <xsl:param name="object" select="."/>
  413.  
  414.   <xsl:variable name="href.to.uri">
  415.     <xsl:call-template name="href.target.uri">
  416.       <xsl:with-param name="object" select="$object"/>
  417.     </xsl:call-template>
  418.   </xsl:variable>
  419.  
  420.   <xsl:variable name="href.from.uri">
  421.     <xsl:call-template name="href.target.uri">
  422.       <xsl:with-param name="object" select="$context"/>
  423.     </xsl:call-template>
  424.   </xsl:variable>
  425.  
  426.   <xsl:variable name="href.to">
  427.     <xsl:call-template name="trim.common.uri.paths">
  428.       <xsl:with-param name="uriA" select="$href.to.uri"/>
  429.       <xsl:with-param name="uriB" select="$href.from.uri"/>
  430.       <xsl:with-param name="return" select="'A'"/>
  431.     </xsl:call-template>
  432.   </xsl:variable>
  433.  
  434.   <xsl:variable name="href.from">
  435.     <xsl:call-template name="trim.common.uri.paths">
  436.       <xsl:with-param name="uriA" select="$href.to.uri"/>
  437.       <xsl:with-param name="uriB" select="$href.from.uri"/>
  438.       <xsl:with-param name="return" select="'B'"/>
  439.     </xsl:call-template>
  440.   </xsl:variable>
  441.  
  442.   <xsl:variable name="depth">
  443.     <xsl:call-template name="count.uri.path.depth">
  444.       <xsl:with-param name="filename" select="$href.from"/>
  445.     </xsl:call-template>
  446.   </xsl:variable>
  447.  
  448.   <xsl:variable name="href">
  449.     <xsl:call-template name="copy-string">
  450.       <xsl:with-param name="string" select="'../'"/>
  451.       <xsl:with-param name="count" select="$depth"/>
  452.     </xsl:call-template>
  453.     <xsl:value-of select="$href.to"/>
  454.   </xsl:variable>
  455.  
  456. <!--
  457.   <xsl:message>
  458.     <xsl:text>In </xsl:text>
  459.     <xsl:value-of select="name(.)"/>
  460.     <xsl:text> (</xsl:text>
  461.     <xsl:value-of select="$href.from"/>
  462.     <xsl:text>,</xsl:text>
  463.     <xsl:value-of select="$depth"/>
  464.     <xsl:text>) </xsl:text>
  465.     <xsl:value-of select="name($object)"/>
  466.     <xsl:text> href=</xsl:text>
  467.     <xsl:value-of select="$href"/>
  468.   </xsl:message>
  469. -->
  470.  
  471.   <xsl:value-of select="$href"/>
  472. </xsl:template>
  473.  
  474. <!-- ==================================================================== -->
  475.  
  476. <xsl:template name="html.head">
  477.   <xsl:param name="prev" select="/foo"/>
  478.   <xsl:param name="next" select="/foo"/>
  479.   <xsl:variable name="this" select="."/>
  480.   <xsl:variable name="home" select="/*[1]"/>
  481.   <xsl:variable name="up" select="parent::*"/>
  482.  
  483.   <head>
  484.     <xsl:call-template name="head.content"/>
  485.     <xsl:call-template name="user.head.content"/>
  486.  
  487.     <xsl:if test="$home">
  488.       <link rel="home">
  489.         <xsl:attribute name="href">
  490.           <xsl:call-template name="href.target">
  491.             <xsl:with-param name="object" select="$home"/>
  492.           </xsl:call-template>
  493.         </xsl:attribute>
  494.         <xsl:attribute name="title">
  495.           <xsl:apply-templates select="$home"
  496.                                mode="object.title.markup.textonly"/>
  497.         </xsl:attribute>
  498.       </link>
  499.     </xsl:if>
  500.  
  501.     <xsl:if test="$up">
  502.       <link rel="up">
  503.         <xsl:attribute name="href">
  504.           <xsl:call-template name="href.target">
  505.             <xsl:with-param name="object" select="$up"/>
  506.           </xsl:call-template>
  507.         </xsl:attribute>
  508.         <xsl:attribute name="title">
  509.           <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
  510.         </xsl:attribute>
  511.       </link>
  512.     </xsl:if>
  513.  
  514.     <xsl:if test="$prev">
  515.       <link rel="previous">
  516.         <xsl:attribute name="href">
  517.           <xsl:call-template name="href.target">
  518.             <xsl:with-param name="object" select="$prev"/>
  519.           </xsl:call-template>
  520.         </xsl:attribute>
  521.         <xsl:attribute name="title">
  522.           <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
  523.         </xsl:attribute>
  524.       </link>
  525.     </xsl:if>
  526.  
  527.     <xsl:if test="$next">
  528.       <link rel="next">
  529.         <xsl:attribute name="href">
  530.           <xsl:call-template name="href.target">
  531.             <xsl:with-param name="object" select="$next"/>
  532.           </xsl:call-template>
  533.         </xsl:attribute>
  534.         <xsl:attribute name="title">
  535.           <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
  536.         </xsl:attribute>
  537.       </link>
  538.     </xsl:if>
  539.  
  540.     <xsl:if test="$html.extra.head.links != 0">
  541.       <xsl:for-each select="//part
  542.                             |//reference
  543.                             |//preface
  544.                             |//chapter
  545.                             |//article
  546.                             |//refentry
  547.                             |//appendix[not(parent::article)]|appendix
  548.                             |//glossary[not(parent::article)]|glossary
  549.                             |//index[not(parent::article)]|index">
  550.         <link rel="{local-name(.)}">
  551.           <xsl:attribute name="href">
  552.             <xsl:call-template name="href.target">
  553.               <xsl:with-param name="context" select="$this"/>
  554.               <xsl:with-param name="object" select="."/>
  555.             </xsl:call-template>
  556.           </xsl:attribute>
  557.           <xsl:attribute name="title">
  558.             <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
  559.           </xsl:attribute>
  560.         </link>
  561.       </xsl:for-each>
  562.  
  563.       <xsl:for-each select="section|sect1|refsection|refsect1">
  564.         <link>
  565.           <xsl:attribute name="rel">
  566.             <xsl:choose>
  567.               <xsl:when test="local-name($this) = 'section'
  568.                               or local-name($this) = 'refsection'">
  569.                 <xsl:value-of select="'subsection'"/>
  570.               </xsl:when>
  571.               <xsl:otherwise>
  572.                 <xsl:value-of select="'section'"/>
  573.               </xsl:otherwise>
  574.             </xsl:choose>
  575.           </xsl:attribute>
  576.           <xsl:attribute name="href">
  577.             <xsl:call-template name="href.target">
  578.               <xsl:with-param name="context" select="$this"/>
  579.               <xsl:with-param name="object" select="."/>
  580.             </xsl:call-template>
  581.           </xsl:attribute>
  582.           <xsl:attribute name="title">
  583.             <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
  584.           </xsl:attribute>
  585.         </link>
  586.       </xsl:for-each>
  587.  
  588.       <xsl:for-each select="sect2|sect3|sect4|sect5|refsect2|refsect3">
  589.         <link rel="subsection">
  590.           <xsl:attribute name="href">
  591.             <xsl:call-template name="href.target">
  592.               <xsl:with-param name="context" select="$this"/>
  593.               <xsl:with-param name="object" select="."/>
  594.             </xsl:call-template>
  595.           </xsl:attribute>
  596.           <xsl:attribute name="title">
  597.             <xsl:apply-templates select="." mode="object.title.markup.textonly"/>
  598.           </xsl:attribute>
  599.         </link>
  600.       </xsl:for-each>
  601.     </xsl:if>
  602.   </head>
  603. </xsl:template>
  604.  
  605. <!-- ==================================================================== -->
  606.  
  607. <xsl:template name="header.navigation">
  608.   <xsl:param name="prev" select="/foo"/>
  609.   <xsl:param name="next" select="/foo"/>
  610.   <xsl:param name="nav.context"/>
  611.  
  612.   <xsl:variable name="home" select="/*[1]"/>
  613.   <xsl:variable name="up" select="parent::*"/>
  614.  
  615.   <xsl:variable name="row1" select="$navig.showtitles != 0"/>
  616.   <xsl:variable name="row2" select="count($prev) > 0
  617.                                     or (count($up) > 0 
  618.                                         and $up != $home
  619.                                         and $navig.showtitles != 0)
  620.                                     or count($next) > 0"/>
  621.  
  622.   <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
  623.     <div class="navheader">
  624.       <xsl:if test="$row1 or $row2">
  625.         <table width="100%" summary="Navigation header">
  626.           <xsl:if test="$row1">
  627.             <tr>
  628.               <th colspan="3" align="center">
  629.                 <xsl:apply-templates select="." mode="object.title.markup"/>
  630.               </th>
  631.             </tr>
  632.           </xsl:if>
  633.  
  634.           <xsl:if test="$row2">
  635.             <tr>
  636.               <td width="20%" align="left">
  637.                 <xsl:if test="count($prev)>0">
  638.                   <a accesskey="p">
  639.                     <xsl:attribute name="href">
  640.                       <xsl:call-template name="href.target">
  641.                         <xsl:with-param name="object" select="$prev"/>
  642.                       </xsl:call-template>
  643.                     </xsl:attribute>
  644.                     <xsl:call-template name="navig.content">
  645.                       <xsl:with-param name="direction" select="'prev'"/>
  646.                     </xsl:call-template>
  647.                   </a>
  648.                 </xsl:if>
  649.                 <xsl:text> </xsl:text>
  650.               </td>
  651.               <th width="60%" align="center">
  652.                 <xsl:choose>
  653.                   <xsl:when test="count($up) > 0
  654.                                   and $up != $home
  655.                                   and $navig.showtitles != 0">
  656.                     <xsl:apply-templates select="$up" mode="object.title.markup"/>
  657.                   </xsl:when>
  658.                   <xsl:otherwise> </xsl:otherwise>
  659.                 </xsl:choose>
  660.               </th>
  661.               <td width="20%" align="right">
  662.                 <xsl:text> </xsl:text>
  663.                 <xsl:if test="count($next)>0">
  664.                   <a accesskey="n">
  665.                     <xsl:attribute name="href">
  666.                       <xsl:call-template name="href.target">
  667.                         <xsl:with-param name="object" select="$next"/>
  668.                       </xsl:call-template>
  669.                     </xsl:attribute>
  670.                     <xsl:call-template name="navig.content">
  671.                       <xsl:with-param name="direction" select="'next'"/>
  672.                     </xsl:call-template>
  673.                   </a>
  674.                 </xsl:if>
  675.               </td>
  676.             </tr>
  677.           </xsl:if>
  678.         </table>
  679.       </xsl:if>
  680.       <xsl:if test="$header.rule != 0">
  681.         <hr/>
  682.       </xsl:if>
  683.     </div>
  684.   </xsl:if>
  685. </xsl:template>
  686.  
  687. <!-- ==================================================================== -->
  688.  
  689. <xsl:template name="footer.navigation">
  690.   <xsl:param name="prev" select="/foo"/>
  691.   <xsl:param name="next" select="/foo"/>
  692.   <xsl:param name="nav.context"/>
  693.  
  694.   <xsl:variable name="home" select="/*[1]"/>
  695.   <xsl:variable name="up" select="parent::*"/>
  696.  
  697.   <xsl:variable name="row1" select="count($prev) > 0
  698.                                     or count($up) > 0
  699.                                     or count($next) > 0"/>
  700.  
  701.   <xsl:variable name="row2" select="($prev and $navig.showtitles != 0)
  702.                                     or ($home != . or $nav.context = 'toc')
  703.                                     or ($chunk.tocs.and.lots != 0
  704.                                         and $nav.context != 'toc')
  705.                                     or ($next and $navig.showtitles != 0)"/>
  706.  
  707.   <xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
  708.     <div class="navfooter">
  709.       <xsl:if test="$footer.rule != 0">
  710.         <hr/>
  711.       </xsl:if>
  712.  
  713.       <xsl:if test="$row1 or $row2">
  714.         <table width="100%" summary="Navigation footer">
  715.           <xsl:if test="$row1">
  716.             <tr>
  717.               <td width="40%" align="left">
  718.                 <xsl:if test="count($prev)>0">
  719.                   <a accesskey="p">
  720.                     <xsl:attribute name="href">
  721.                       <xsl:call-template name="href.target">
  722.                         <xsl:with-param name="object" select="$prev"/>
  723.                       </xsl:call-template>
  724.                     </xsl:attribute>
  725.                     <xsl:call-template name="navig.content">
  726.                       <xsl:with-param name="direction" select="'prev'"/>
  727.                     </xsl:call-template>
  728.                   </a>
  729.                 </xsl:if>
  730.                 <xsl:text> </xsl:text>
  731.               </td>
  732.               <td width="20%" align="center">
  733.                 <xsl:choose>
  734.                   <xsl:when test="count($up)>0">
  735.                     <a accesskey="u">
  736.                       <xsl:attribute name="href">
  737.                         <xsl:call-template name="href.target">
  738.                           <xsl:with-param name="object" select="$up"/>
  739.                         </xsl:call-template>
  740.                       </xsl:attribute>
  741.                       <xsl:call-template name="navig.content">
  742.                         <xsl:with-param name="direction" select="'up'"/>
  743.                       </xsl:call-template>
  744.                     </a>
  745.                   </xsl:when>
  746.                   <xsl:otherwise> </xsl:otherwise>
  747.                 </xsl:choose>
  748.               </td>
  749.               <td width="40%" align="right">
  750.                 <xsl:text> </xsl:text>
  751.                 <xsl:if test="count($next)>0">
  752.                   <a accesskey="n">
  753.                     <xsl:attribute name="href">
  754.                       <xsl:call-template name="href.target">
  755.                         <xsl:with-param name="object" select="$next"/>
  756.                       </xsl:call-template>
  757.                     </xsl:attribute>
  758.                     <xsl:call-template name="navig.content">
  759.                       <xsl:with-param name="direction" select="'next'"/>
  760.                     </xsl:call-template>
  761.                   </a>
  762.                 </xsl:if>
  763.               </td>
  764.             </tr>
  765.           </xsl:if>
  766.  
  767.           <xsl:if test="$row2">
  768.             <tr>
  769.               <td width="40%" align="left" valign="top">
  770.                 <xsl:if test="$navig.showtitles != 0">
  771.                   <xsl:apply-templates select="$prev" mode="object.title.markup"/>
  772.                 </xsl:if>
  773.                 <xsl:text> </xsl:text>
  774.               </td>
  775.               <td width="20%" align="center">
  776.                 <xsl:choose>
  777.                   <xsl:when test="$home != . or $nav.context = 'toc'">
  778.                     <a accesskey="h">
  779.                       <xsl:attribute name="href">
  780.                         <xsl:call-template name="href.target">
  781.                           <xsl:with-param name="object" select="$home"/>
  782.                         </xsl:call-template>
  783.                       </xsl:attribute>
  784.                       <xsl:call-template name="navig.content">
  785.                         <xsl:with-param name="direction" select="'home'"/>
  786.                       </xsl:call-template>
  787.                     </a>
  788.                     <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
  789.                       <xsl:text> | </xsl:text>
  790.                     </xsl:if>
  791.                   </xsl:when>
  792.                   <xsl:otherwise> </xsl:otherwise>
  793.                 </xsl:choose>
  794.  
  795.                 <xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
  796.                   <a accesskey="t">
  797.                     <xsl:attribute name="href">
  798.                       <xsl:apply-templates select="/*[1]"
  799.                                            mode="recursive-chunk-filename"/>
  800.                       <xsl:text>-toc</xsl:text>
  801.                       <xsl:value-of select="$html.ext"/>
  802.                     </xsl:attribute>
  803.                     <xsl:call-template name="gentext">
  804.                       <xsl:with-param name="key" select="'nav-toc'"/>
  805.                     </xsl:call-template>
  806.                   </a>
  807.                 </xsl:if>
  808.               </td>
  809.               <td width="40%" align="right" valign="top">
  810.                 <xsl:text> </xsl:text>
  811.                 <xsl:if test="$navig.showtitles != 0">
  812.                   <xsl:apply-templates select="$next" mode="object.title.markup"/>
  813.                 </xsl:if>
  814.               </td>
  815.             </tr>
  816.           </xsl:if>
  817.         </table>
  818.       </xsl:if>
  819.     </div>
  820.   </xsl:if>
  821. </xsl:template>
  822.  
  823. <!-- ==================================================================== -->
  824.  
  825. <xsl:template name="navig.content">
  826.     <xsl:param name="direction" select="next"/>
  827.     <xsl:variable name="navtext">
  828.         <xsl:choose>
  829.         <xsl:when test="$direction = 'prev'">
  830.         <xsl:call-template name="gentext.nav.prev"/>
  831.         </xsl:when>
  832.         <xsl:when test="$direction = 'next'">
  833.         <xsl:call-template name="gentext.nav.next"/>
  834.         </xsl:when>
  835.         <xsl:when test="$direction = 'up'">
  836.         <xsl:call-template name="gentext.nav.up"/>
  837.         </xsl:when>
  838.         <xsl:when test="$direction = 'home'">
  839.         <xsl:call-template name="gentext.nav.home"/>
  840.         </xsl:when>
  841.         <xsl:otherwise>
  842.         <xsl:text>xxx</xsl:text>
  843.         </xsl:otherwise>
  844.     </xsl:choose>
  845.     </xsl:variable>
  846.  
  847.     <xsl:choose>
  848.     <xsl:when test="$navig.graphics != 0">
  849.         <img>
  850.         <xsl:attribute name="src">
  851.             <xsl:value-of select="$navig.graphics.path"/>
  852.             <xsl:value-of select="$direction"/>
  853.             <xsl:value-of select="$navig.graphics.extension"/>
  854.         </xsl:attribute>
  855.         <xsl:attribute name="alt">
  856.             <xsl:value-of select="$navtext"/>
  857.         </xsl:attribute>
  858.         </img>
  859.     </xsl:when>
  860.     <xsl:otherwise>
  861.         <xsl:value-of select="$navtext"/>
  862.     </xsl:otherwise>
  863.     </xsl:choose>
  864. </xsl:template>
  865.  
  866. <!-- ==================================================================== -->
  867.  
  868. <xsl:template match="processing-instruction('dbhtml')">
  869.   <!-- nop -->
  870. </xsl:template>
  871.  
  872. <!-- ==================================================================== -->
  873.  
  874. <xsl:template name="chunk-element-content">
  875.   <xsl:param name="prev"/>
  876.   <xsl:param name="next"/>
  877.   <xsl:param name="nav.context"/>
  878.   <xsl:param name="content"/>
  879.  
  880.   <html>
  881.     <xsl:call-template name="html.head">
  882.       <xsl:with-param name="prev" select="$prev"/>
  883.       <xsl:with-param name="next" select="$next"/>
  884.     </xsl:call-template>
  885.  
  886.     <body>
  887.       <xsl:call-template name="body.attributes"/>
  888.       <xsl:call-template name="user.header.navigation"/>
  889.  
  890.       <xsl:call-template name="header.navigation">
  891.     <xsl:with-param name="prev" select="$prev"/>
  892.     <xsl:with-param name="next" select="$next"/>
  893.     <xsl:with-param name="nav.context" select="$nav.context"/>
  894.       </xsl:call-template>
  895.  
  896.       <xsl:call-template name="user.header.content"/>
  897.  
  898.       <xsl:choose>
  899.         <xsl:when test="$content">
  900.           <xsl:copy-of select="$content"/>
  901.         </xsl:when>
  902.         <xsl:otherwise>
  903.           <xsl:apply-imports/>
  904.         </xsl:otherwise>
  905.       </xsl:choose>
  906.  
  907.       <xsl:call-template name="user.footer.content"/>
  908.  
  909.       <xsl:call-template name="footer.navigation">
  910.     <xsl:with-param name="prev" select="$prev"/>
  911.     <xsl:with-param name="next" select="$next"/>
  912.     <xsl:with-param name="nav.context" select="$nav.context"/>
  913.       </xsl:call-template>
  914.  
  915.       <xsl:call-template name="user.footer.navigation"/>
  916.     </body>
  917.   </html>
  918. </xsl:template>
  919.  
  920. </xsl:stylesheet>
  921.