bos@557: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
bos@557: 
bos@557:   <xsl:param name="html.stylesheet">/support/styles.css</xsl:param>
bos@557:   <xsl:param name="toc.section.depth">3</xsl:param>
bos@557:   <xsl:param name="annotate.toc">0</xsl:param>
bos@557: 
bos@557:   <xsl:param name="generate.id.attributes" select="1"></xsl:param>
bos@557:   <xsl:param name="header.rule" select="0"></xsl:param>
bos@557:   <xsl:param name="footer.rule" select="0"></xsl:param>
bos@557:   <xsl:param name="html.cleanup" select="1"></xsl:param>
bos@557:   <xsl:param name="admon.style"><xsl:text></xsl:text></xsl:param>
bos@557:   <xsl:param name="admon.graphics" select="1"></xsl:param>
bos@557:   <xsl:param name="admon.graphics.path">/support/figs/</xsl:param>
bos@557: 
bos@557:   <xsl:template match="sect1" mode="toc">
bos@557:     <xsl:param name="toc-context" select="."/>
bos@557:     <xsl:call-template name="subtoc">
bos@557:       <xsl:with-param name="toc-context" select="$toc-context"/>
bos@557:       <xsl:with-param name="nodes" 
bos@557:         select="sect2|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
bos@557:     </xsl:call-template>
bos@557:   </xsl:template>
bos@557: 
bos@557:   <xsl:template match="sect2" mode="toc">
bos@557:     <xsl:param name="toc-context" select="."/>
bos@557: 
bos@557:     <xsl:call-template name="subtoc">
bos@557:       <xsl:with-param name="toc-context" select="$toc-context"/>
bos@557:       <xsl:with-param name="nodes" 
bos@557:         select="sect3|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
bos@557:     </xsl:call-template>
bos@557:   </xsl:template>
bos@557: 
bos@557:   <!-- Add id attributes to <p> tags. This is mostly a copy of the
bos@557:        base XSL. -->
bos@557:   <xsl:template name="paragraph">
bos@557:     <xsl:param name="class" select="''"/>
bos@557:     <xsl:param name="content"/>
bos@557: 
bos@557:     <xsl:variable name="p">
bos@557:       <p>
bos@557:         <xsl:call-template name="dir"/>
bos@557:         <xsl:if test="$class != ''">
bos@557:           <xsl:apply-templates select="." mode="class.attribute">
bos@557:             <xsl:with-param name="class" select="$class"/>
bos@557:           </xsl:apply-templates>
bos@557:         </xsl:if>
bos@557:         <!-- Here we go. -->
bos@557:         <xsl:if test="$generate.id.attributes != 0">
bos@557:           <xsl:attribute name="id">
bos@557:             <xsl:call-template name="object.id"/>
bos@557:           </xsl:attribute>
bos@557:         </xsl:if>
bos@557:         <xsl:copy-of select="$content"/>
bos@557:       </p>
bos@557:     </xsl:variable>
bos@557: 
bos@557:     <xsl:choose>
bos@557:       <xsl:when test="$html.cleanup != 0">
bos@557:         <xsl:call-template name="unwrap.p">
bos@557:           <xsl:with-param name="p" select="$p"/>
bos@557:         </xsl:call-template>
bos@557:       </xsl:when>
bos@557:       <xsl:otherwise>
bos@557:         <xsl:copy-of select="$p"/>
bos@557:       </xsl:otherwise>
bos@557:     </xsl:choose>
bos@557:   </xsl:template>
bos@557: 
bos@557:   <!-- Add id attributes to <programlisting> and <screen> tags. Once
bos@557:        again, this is mostly a copy of the base XSL, although rather
bos@557:        trimmed down. -->
bos@557:   <xsl:template match="programlisting|screen">
bos@557:     <xsl:param name="suppress-numbers" select="'0'"/>
bos@557: 
bos@557:     <xsl:call-template name="anchor"/>
bos@557: 
bos@557:     <pre>
bos@557:       <!-- Here we go. -->
bos@557:       <xsl:if test="$generate.id.attributes != 0">
bos@557:         <xsl:attribute name="id">
bos@557:           <xsl:call-template name="object.id"/>
bos@557:         </xsl:attribute>
bos@557:       </xsl:if>
bos@557: 
bos@557:       <xsl:apply-templates select="." mode="class.attribute"/>
bos@557:       <xsl:call-template name="apply-highlighting"/>
bos@557:     </pre>
bos@557:   </xsl:template>
bos@557: 
bos@557:   <!-- The default stylesheet generates a little TOC at the beginning
bos@557:        of each qandaset.  Uh, no thanks. -->
bos@557:   <xsl:template name="process.qanda.toc"/>
bos@557: 
bos@557:   <xsl:template name="user.header.navigation">
bos@557:     <div class="navheader"><h2 class="booktitle"><a href="/">Mercurial: The Definitive Guide</a> <span class="authors">by Bryan O'Sullivan</span></h2></div>
bos@557:   </xsl:template>
bos@557: 
bos@557:   <xsl:template name="user.head.content">
bos@557:     <link rel="alternate" type="application/atom+xml" title="Comments"
bos@557:       href="/feeds/comments/"/>
bos@557:     <link rel="shortcut icon" type="image/png" href="/support/figs/favicon.png"/>
bos@557:     <script type="text/javascript" src="/support/jquery-min.js"></script>
bos@557:     <script type="text/javascript" src="/support/form.js"></script>
bos@557:     <script type="text/javascript" src="/support/hsbook.js"></script>
bos@557:   </xsl:template>
bos@557: 
bos@557:   <xsl:template name="user.footer.content">
bos@597:     <div class="hgfooter">
bos@557:       <p><img src="/support/figs/rss.png"/> Want to stay up to date? Subscribe to the comment feed for <a id="chapterfeed" class="feed" href="/feeds/comments/">this chapter</a>, or the <a class="feed" href="/feeds/comments/">entire book</a>.</p>
bos@573:       <p>Copyright 2006, 2007, 2008, 2009 Bryan O'Sullivan.
bos@557:       Icons by <a href="mailto:mattahan@gmail.com">Paul Davey</a> aka <a href="http://mattahan.deviantart.com/">Mattahan</a>.</p>
bos@557:     </div>
bos@557:   </xsl:template>
bos@557: 
bos@557:   <xsl:template name="user.footer.navigation">
bos@601:     <script type="text/javascript">
bos@601:     var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
bos@601:     document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
bos@601:     </script>
bos@601:     <script type="text/javascript">
bos@601:     try {
bos@601:     var pageTracker = _gat._getTracker("UA-1805907-5");
bos@601:     pageTracker._trackPageview();
bos@601:     } catch(err) {}</script>
bos@557:   </xsl:template>
bos@557: </xsl:stylesheet>