-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog.xslt
186 lines (175 loc) · 8.02 KB
/
blog.xslt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2009-2010, Wolfgang Keller
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:exslt="http://exslt.org/common"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes="exslt msxsl">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<xsl:include href="data/common/xslt/ie.xslt"/>
<xsl:include href="header_footer.xslt"/>
<xsl:include href="blog_head_elements.xslt"/>
<xsl:include href="blog_articles.xslt"/>
<xsl:include href="util_html.xslt"/>
<xsl:template name="print_pages_list">
<xsl:param name="lang"/>
<ul>
<li class="selected">
<xsl:call-template name="show_home_a">
<xsl:with-param name="lang" select="$lang"/>
</xsl:call-template>
</li>
</ul>
</xsl:template>
<xsl:template name="print_categories_list">
<xsl:param name="lang"/>
<ul>
<xsl:for-each select="document('categories.xml')/categories/category">
<xsl:sort select="."/>
<xsl:variable name="articles-of-category">
<xsl:call-template name="articles-from-category-id">
<xsl:with-param name="category-id" select="@id"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="article-count" select="count(exslt:node-set($articles-of-category)/articles/article)"/>
<xsl:if test="$article-count>0">
<!-- For current current category add 'current-cat' after 'cat-item' -->
<li class="cat-item">
<xsl:call-template name="show_all_articles_of_category_a">
<xsl:with-param name="id" select="@id"/>
<xsl:with-param name="category" select="."/>
<xsl:with-param name="lang" select="$lang"/>
</xsl:call-template>
<xsl:text> (</xsl:text>
<xsl:value-of select="$article-count"/>
<xsl:text>)</xsl:text>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template name="print_authors_list">
<xsl:param name="lang"/>
<ul>
<xsl:for-each select="document('authors.xml')/authors/author">
<xsl:sort select="surname"/>
<xsl:sort select="prename"/>
<xsl:variable name="articles-of-author">
<xsl:call-template name="articles-from-author-id">
<xsl:with-param name="author-id" select="@id"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="article-count" select="count(exslt:node-set($articles-of-author)/articles/article)"/>
<xsl:if test="$article-count>0">
<li>
<xsl:call-template name="show_all_articles_of_author_a">
<xsl:with-param name="id" select="@id"/>
<xsl:with-param name="prename" select="prename"/>
<xsl:with-param name="surname" select="surname"/>
<xsl:with-param name="lang" select="$lang"/>
</xsl:call-template>
<xsl:text> (</xsl:text>
<xsl:value-of select="$article-count"/>
<xsl:text>)</xsl:text>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
<!-- Call main template -->
<xsl:template match="/">
<xsl:apply-templates select="document('page.xml')/page"/>
</xsl:template>
<!-- Main template -->
<xsl:template match="/page">
<xsl:variable name="lang">
<xsl:call-template name="get-language"/>
</xsl:variable>
<html>
<head>
<xsl:call-template name="canonical_head_elements"/>
<xsl:call-template name="blog_head_elements" />
</head>
<body>
<xsl:call-template name="body-onload">
<xsl:with-param name="xmlUrl">blog.xml</xsl:with-param>
<xsl:with-param name="xsltUrl">blog_articles.xslt</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="header"/>
<div id="page">
<div id="wrap">
<div id="sidebar">
<h2>
<xsl:call-template name="print-string">
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="id">search</xsl:with-param>
</xsl:call-template>
</h2>
<form method="get" id="searchform" action="javascript:alert('Searching is not yet implemented.')">
<div>
<input type="text" name="s" id="s" />
</div>
</form>
<br/>
<h2>
<xsl:call-template name="print-string">
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="id">pages</xsl:with-param>
</xsl:call-template>
</h2>
<xsl:call-template name="print_pages_list">
<xsl:with-param name="lang" select="$lang"/>
</xsl:call-template>
<br/>
<h2>
<xsl:call-template name="print-string">
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="id">categories</xsl:with-param>
</xsl:call-template>
</h2>
<xsl:call-template name="print_categories_list">
<xsl:with-param name="lang" select="$lang"/>
</xsl:call-template>
<br/>
<h2>
<xsl:call-template name="print-string">
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="id">authors</xsl:with-param>
</xsl:call-template>
</h2>
<xsl:call-template name="print_authors_list">
<xsl:with-param name="lang" select="$lang"/>
</xsl:call-template>
<br />
</div>
</div>
<div id="content">
<div class="navigation">
<div class="alignleft"/>
<div class="alignright"/>
</div>
<div id="articleContainerDiv">
<xsl:call-template name="print-articles">
<xsl:with-param name="lang" select="$lang"/>
</xsl:call-template>
</div>
<div class="navigation">
<div class="alignleft"/>
<div class="alignright"/>
</div>
</div>
<xsl:call-template name="footer"/>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>