annotate xsl/base-html-stylesheet.xsl @ 663:0d5935744f87

Switch from LaTeX to XML for examples.
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 09 Mar 2009 21:39:23 -0700
parents 23dc79421e06
children 40025381bded
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
656
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
2
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
3 <xsl:param name="html.stylesheet">/support/styles.css</xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
4 <xsl:param name="toc.section.depth">3</xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
5 <xsl:param name="annotate.toc">0</xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
6
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
7 <xsl:param name="generate.id.attributes" select="1"></xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
8 <xsl:param name="header.rule" select="0"></xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
9 <xsl:param name="footer.rule" select="0"></xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
10 <xsl:param name="html.cleanup" select="1"></xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
11 <xsl:param name="admon.style"><xsl:text></xsl:text></xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
12 <xsl:param name="admon.graphics" select="1"></xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
13 <xsl:param name="admon.graphics.path">/support/figs/</xsl:param>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
14
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
15 <xsl:template match="sect1" mode="toc">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
16 <xsl:param name="toc-context" select="."/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
17 <xsl:call-template name="subtoc">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
18 <xsl:with-param name="toc-context" select="$toc-context"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
19 <xsl:with-param name="nodes"
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
20 select="sect2|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
21 </xsl:call-template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
22 </xsl:template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
23
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
24 <xsl:template match="sect2" mode="toc">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
25 <xsl:param name="toc-context" select="."/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
26
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
27 <xsl:call-template name="subtoc">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
28 <xsl:with-param name="toc-context" select="$toc-context"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
29 <xsl:with-param name="nodes"
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
30 select="sect3|refentry|bridgehead[$bridgehead.in.toc != 0]"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
31 </xsl:call-template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
32 </xsl:template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
33
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
34 <!-- Add id attributes to <p> tags. This is mostly a copy of the
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
35 base XSL. -->
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
36 <xsl:template name="paragraph">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
37 <xsl:param name="class" select="''"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
38 <xsl:param name="content"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
39
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
40 <xsl:variable name="p">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
41 <p>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
42 <xsl:call-template name="dir"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
43 <xsl:if test="$class != ''">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
44 <xsl:apply-templates select="." mode="class.attribute">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
45 <xsl:with-param name="class" select="$class"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
46 </xsl:apply-templates>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
47 </xsl:if>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
48 <!-- Here we go. -->
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
49 <xsl:if test="$generate.id.attributes != 0">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
50 <xsl:attribute name="id">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
51 <xsl:call-template name="object.id"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
52 </xsl:attribute>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
53 </xsl:if>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
54 <xsl:copy-of select="$content"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
55 </p>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
56 </xsl:variable>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
57
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
58 <xsl:choose>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
59 <xsl:when test="$html.cleanup != 0">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
60 <xsl:call-template name="unwrap.p">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
61 <xsl:with-param name="p" select="$p"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
62 </xsl:call-template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
63 </xsl:when>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
64 <xsl:otherwise>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
65 <xsl:copy-of select="$p"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
66 </xsl:otherwise>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
67 </xsl:choose>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
68 </xsl:template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
69
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
70 <!-- Add id attributes to <programlisting> and <screen> tags. Once
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
71 again, this is mostly a copy of the base XSL, although rather
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
72 trimmed down. -->
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
73 <xsl:template match="programlisting|screen">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
74 <xsl:param name="suppress-numbers" select="'0'"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
75
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
76 <xsl:call-template name="anchor"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
77
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
78 <pre>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
79 <!-- Here we go. -->
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
80 <xsl:if test="$generate.id.attributes != 0">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
81 <xsl:attribute name="id">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
82 <xsl:call-template name="object.id"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
83 </xsl:attribute>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
84 </xsl:if>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
85
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
86 <xsl:apply-templates select="." mode="class.attribute"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
87 <xsl:call-template name="apply-highlighting"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
88 </pre>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
89 </xsl:template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
90
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
91 <!-- The default stylesheet generates a little TOC at the beginning
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
92 of each qandaset. Uh, no thanks. -->
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
93 <xsl:template name="process.qanda.toc"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
94
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
95 <xsl:template name="user.header.navigation">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
96 <div class="navheader"><h2 class="booktitle"><a href="/">Mercurial: The Definitive Guide</a> <span class="authors">by Bryan O'Sullivan</span></h2></div>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
97 </xsl:template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
98
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
99 <xsl:template name="user.head.content">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
100 <link rel="alternate" type="application/atom+xml" title="Comments"
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
101 href="/feeds/comments/"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
102 <link rel="shortcut icon" type="image/png" href="/support/figs/favicon.png"/>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
103 <script type="text/javascript" src="/support/jquery-min.js"></script>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
104 <script type="text/javascript" src="/support/form.js"></script>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
105 <script type="text/javascript" src="/support/hsbook.js"></script>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
106 </xsl:template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
107
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
108 <xsl:template name="user.footer.content">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
109 <div class="rwhfooter">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
110 <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>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
111 <p>Copyright 2009, Bryan O'Sullivan.
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
112 Icons by <a href="mailto:mattahan@gmail.com">Paul Davey</a> aka <a href="http://mattahan.deviantart.com/">Mattahan</a>.</p>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
113 </div>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
114 </xsl:template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
115
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
116 <xsl:template name="user.footer.navigation">
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
117 <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
118 <script type="text/javascript">_uacct = "UA-1805907-3"; urchinTracker();</script>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
119 </xsl:template>
23dc79421e06 Add XSL stylesheets
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
120 </xsl:stylesheet>