1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright © 2014 František Kučera (frantovo.cz)
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 <xsl:stylesheet version="2.0"
19 xmlns="http://www.w3.org/1999/xhtml"
20 xmlns:h="http://www.w3.org/1999/xhtml"
21 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
22 xmlns:fn="http://www.w3.org/2005/xpath-functions"
23 xmlns:svg="http://www.w3.org/2000/svg"
24 xmlns:xs="http://www.w3.org/2001/XMLSchema"
25 exclude-result-prefixes="fn h xs">
30 doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"/><!--
31 doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>-->
34 <xsl:param name="title"/>
35 <xsl:param name="headComment"/>
36 <xsl:param name="isRoot"/>
37 <xsl:param name="urlBase"/>
38 <xsl:param name="wwwRead"/>
39 <xsl:param name="wwwPost"/>
42 <!-- Celý dokument -->
43 <xsl:template match="/">
46 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
47 <xsl:if test="$urlBase">
48 <base href="{$urlBase}"/>
50 <xsl:if test="$title">
51 <title><xsl:value-of select="$title"/></title>
53 <xsl:if test="$headComment">
54 <xsl:comment><xsl:value-of select="$headComment"/></xsl:comment>
56 <style type="text/css">
58 font-family: sans-serif;
63 border-top: 2px solid grey;
69 background-color: #eee;
73 border-left: 3px solid silver;
77 background-color: #eee;
80 border-left: 3px solid #a00;
93 <xsl:if test="$title and $isRoot">
94 <h1><xsl:value-of select="$title"/></h1>
97 <xsl:apply-templates select="h:html/h:body"/>
99 <xsl:if test="$wwwRead or $wwwPost">
100 <div class="wwwLinks">
101 <p>Přístup přes síť www:</p>
103 <xsl:if test="$wwwRead"><li><a href="{$wwwRead}">číst tento příspěvek</a></li></xsl:if>
104 <xsl:if test="$wwwPost"><li><a href="{$wwwPost}">odpovědět na tento příspěvek</a></li></xsl:if>
114 <xsl:template match="h:a">
115 <xsl:element name="a">
116 <xsl:if test="@href"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute></xsl:if>
117 <xsl:if test="@title"><xsl:attribute name="title"><xsl:value-of select="@title"/></xsl:attribute></xsl:if>
118 <xsl:if test="@id"><xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute></xsl:if>
119 <xsl:apply-templates select="node()"/>
125 <xsl:template match="h:img">
126 <xsl:element name="img">
127 <xsl:if test="@src"><xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute></xsl:if>
128 <xsl:if test="@title"><xsl:attribute name="title"><xsl:value-of select="@title"/></xsl:attribute></xsl:if>
129 <xsl:if test="@alt"><xsl:attribute name="alt"><xsl:value-of select="@alt"/></xsl:attribute></xsl:if>
135 <xsl:template match="h:abbr">
136 <abbr title="{@title}"><xsl:apply-templates/></abbr>
141 <xsl:template match="h:blockquote[not(h:p)]">
144 <xsl:copy-of select="node()"/>
151 <xsl:template match="h:b">
153 <xsl:apply-templates select="node()"/>
158 <!-- Skloněné písmo -->
159 <xsl:template match="h:i">
161 <xsl:apply-templates select="node()"/>
166 <!-- Markdown dává do pre ještě code – to ale nepotřebujeme, stačí nám pre a v něm rovnou text -->
167 <xsl:template match="h:pre[h:code]">
168 <pre><xsl:apply-templates select="h:code/node()"/></pre>
173 Další povolené značky (jejich případné atributy zahodíme).
174 Ostatní elementy odfiltrujeme (zbude z nich jen text).
176 <xsl:template match="*">
200 name() = 'blockquote'">
201 <xsl:element name="{name()}">
202 <xsl:apply-templates select="node()"/>
206 <xsl:apply-templates/>