hgbook
diff stylesheets/base-html-stylesheet.xsl @ 1045:575a3d411be2
refine translated
author | Zhaoping Sun <zhaopingsun@gmail.com> |
---|---|
date | Mon Nov 09 23:00:07 2009 -0500 (2009-11-09) |
parents | c3c5b964901e 1c13ed2130a7 |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/stylesheets/base-html-stylesheet.xsl Mon Nov 09 23:00:07 2009 -0500 1.3 @@ -0,0 +1,127 @@ 1.4 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'> 1.5 + 1.6 + <xsl:param name="html.stylesheet">/support/styles.css</xsl:param> 1.7 + <xsl:param name="toc.section.depth">3</xsl:param> 1.8 + <xsl:param name="annotate.toc">0</xsl:param> 1.9 + 1.10 + <xsl:param name="generate.id.attributes" select="1"></xsl:param> 1.11 + <xsl:param name="header.rule" select="0"></xsl:param> 1.12 + <xsl:param name="footer.rule" select="0"></xsl:param> 1.13 + <xsl:param name="html.cleanup" select="1"></xsl:param> 1.14 + <xsl:param name="admon.style"><xsl:text></xsl:text></xsl:param> 1.15 + <xsl:param name="admon.graphics" select="1"></xsl:param> 1.16 + <xsl:param name="admon.graphics.path">/support/figs/</xsl:param> 1.17 + 1.18 + <xsl:template match="sect1" mode="toc"> 1.19 + <xsl:param name="toc-context" select="."/> 1.20 + <xsl:call-template name="subtoc"> 1.21 + <xsl:with-param name="toc-context" select="$toc-context"/> 1.22 + <xsl:with-param name="nodes" 1.23 + select="sect2|refentry|bridgehead[$bridgehead.in.toc != 0]"/> 1.24 + </xsl:call-template> 1.25 + </xsl:template> 1.26 + 1.27 + <xsl:template match="sect2" mode="toc"> 1.28 + <xsl:param name="toc-context" select="."/> 1.29 + 1.30 + <xsl:call-template name="subtoc"> 1.31 + <xsl:with-param name="toc-context" select="$toc-context"/> 1.32 + <xsl:with-param name="nodes" 1.33 + select="sect3|refentry|bridgehead[$bridgehead.in.toc != 0]"/> 1.34 + </xsl:call-template> 1.35 + </xsl:template> 1.36 + 1.37 + <!-- Add id attributes to <p> tags. This is mostly a copy of the 1.38 + base XSL. --> 1.39 + <xsl:template name="paragraph"> 1.40 + <xsl:param name="class" select="''"/> 1.41 + <xsl:param name="content"/> 1.42 + 1.43 + <xsl:variable name="p"> 1.44 + <p> 1.45 + <xsl:call-template name="dir"/> 1.46 + <xsl:if test="$class != ''"> 1.47 + <xsl:apply-templates select="." mode="class.attribute"> 1.48 + <xsl:with-param name="class" select="$class"/> 1.49 + </xsl:apply-templates> 1.50 + </xsl:if> 1.51 + <!-- Here we go. --> 1.52 + <xsl:if test="$generate.id.attributes != 0"> 1.53 + <xsl:attribute name="id"> 1.54 + <xsl:call-template name="object.id"/> 1.55 + </xsl:attribute> 1.56 + </xsl:if> 1.57 + <xsl:copy-of select="$content"/> 1.58 + </p> 1.59 + </xsl:variable> 1.60 + 1.61 + <xsl:choose> 1.62 + <xsl:when test="$html.cleanup != 0"> 1.63 + <xsl:call-template name="unwrap.p"> 1.64 + <xsl:with-param name="p" select="$p"/> 1.65 + </xsl:call-template> 1.66 + </xsl:when> 1.67 + <xsl:otherwise> 1.68 + <xsl:copy-of select="$p"/> 1.69 + </xsl:otherwise> 1.70 + </xsl:choose> 1.71 + </xsl:template> 1.72 + 1.73 + <!-- Add id attributes to <programlisting> and <screen> tags. Once 1.74 + again, this is mostly a copy of the base XSL, although rather 1.75 + trimmed down. --> 1.76 + <xsl:template match="programlisting|screen"> 1.77 + <xsl:param name="suppress-numbers" select="'0'"/> 1.78 + 1.79 + <xsl:call-template name="anchor"/> 1.80 + 1.81 + <pre> 1.82 + <!-- Here we go. --> 1.83 + <xsl:if test="$generate.id.attributes != 0"> 1.84 + <xsl:attribute name="id"> 1.85 + <xsl:call-template name="object.id"/> 1.86 + </xsl:attribute> 1.87 + </xsl:if> 1.88 + 1.89 + <xsl:apply-templates select="." mode="class.attribute"/> 1.90 + <xsl:call-template name="apply-highlighting"/> 1.91 + </pre> 1.92 + </xsl:template> 1.93 + 1.94 + <!-- The default stylesheet generates a little TOC at the beginning 1.95 + of each qandaset. Uh, no thanks. --> 1.96 + <xsl:template name="process.qanda.toc"/> 1.97 + 1.98 + <xsl:template name="user.header.navigation"> 1.99 + <div class="navheader"><h2 class="booktitle"><a href="/">Mercurial: The Definitive Guide</a> <span class="authors">by Bryan O'Sullivan</span></h2></div> 1.100 + </xsl:template> 1.101 + 1.102 + <xsl:template name="user.head.content"> 1.103 + <link rel="alternate" type="application/atom+xml" title="Comments" 1.104 + href="/feeds/comments/"/> 1.105 + <link rel="shortcut icon" type="image/png" href="/support/figs/favicon.png"/> 1.106 + <script type="text/javascript" src="/support/jquery-min.js"></script> 1.107 + <script type="text/javascript" src="/support/form.js"></script> 1.108 + <script type="text/javascript" src="/support/hsbook.js"></script> 1.109 + </xsl:template> 1.110 + 1.111 + <xsl:template name="user.footer.content"> 1.112 + <div class="hgfooter"> 1.113 + <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> 1.114 + <p>Copyright 2006, 2007, 2008, 2009 Bryan O'Sullivan. 1.115 + Icons by <a href="mailto:mattahan@gmail.com">Paul Davey</a> aka <a href="http://mattahan.deviantart.com/">Mattahan</a>.</p> 1.116 + </div> 1.117 + </xsl:template> 1.118 + 1.119 + <xsl:template name="user.footer.navigation"> 1.120 + <script type="text/javascript"> 1.121 + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); 1.122 + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); 1.123 + </script> 1.124 + <script type="text/javascript"> 1.125 + try { 1.126 + var pageTracker = _gat._getTracker("UA-1805907-5"); 1.127 + pageTracker._trackPageview(); 1.128 + } catch(err) {}</script> 1.129 + </xsl:template> 1.130 +</xsl:stylesheet>