author | František Kučera <franta-hg@frantovo.cz> |
Mon, 17 Oct 2011 13:55:28 +0200 | |
changeset 88 | cbf1a1153313 |
parent 85 | a76b94bcec92 |
child 90 | 2ed2497d4559 |
permissions | -rwxr-xr-x |
franta-hg@76 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
franta-hg@77 | 2 |
<xsl:stylesheet version="2.0" |
franta-hg@76 | 3 |
xmlns="http://www.w3.org/1999/xhtml" |
franta-hg@76 | 4 |
xmlns:h="http://www.w3.org/1999/xhtml" |
franta-hg@76 | 5 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
franta-hg@76 | 6 |
xmlns:fn="http://www.w3.org/2005/xpath-functions" |
franta-hg@76 | 7 |
xmlns:svg="http://www.w3.org/2000/svg" |
franta-hg@76 | 8 |
xmlns:xs="http://www.w3.org/2001/XMLSchema" |
franta-hg@76 | 9 |
exclude-result-prefixes="fn h xs"> |
franta-hg@76 | 10 |
<xsl:output |
franta-hg@76 | 11 |
method="xml" |
franta-hg@76 | 12 |
indent="yes" |
franta-hg@76 | 13 |
encoding="UTF-8" |
franta-hg@88 | 14 |
doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"/><!-- |
franta-hg@88 | 15 |
doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>--> |
franta-hg@76 | 16 |
|
franta-hg@76 | 17 |
|
franta-hg@76 | 18 |
<xsl:param name="title"/> |
franta-hg@83 | 19 |
<xsl:param name="headComment"/> |
franta-hg@76 | 20 |
<xsl:param name="isRoot"/> |
franta-hg@76 | 21 |
<xsl:param name="urlBase"/> |
franta-hg@76 | 22 |
<xsl:param name="wwwRead"/> |
franta-hg@76 | 23 |
<xsl:param name="wwwPost"/> |
franta-hg@76 | 24 |
|
franta-hg@76 | 25 |
|
franta-hg@76 | 26 |
<!-- Celý dokument --> |
franta-hg@76 | 27 |
<xsl:template match="/"> |
franta-hg@76 | 28 |
<html> |
franta-hg@76 | 29 |
<head> |
franta-hg@76 | 30 |
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> |
franta-hg@76 | 31 |
<xsl:if test="$urlBase"> |
franta-hg@76 | 32 |
<base href="{$urlBase}"/> |
franta-hg@76 | 33 |
</xsl:if> |
franta-hg@76 | 34 |
<xsl:if test="$title"> |
franta-hg@76 | 35 |
<title><xsl:value-of select="$title"/></title> |
franta-hg@76 | 36 |
</xsl:if> |
franta-hg@83 | 37 |
<xsl:if test="$headComment"> |
franta-hg@83 | 38 |
<xsl:comment><xsl:value-of select="$headComment"/></xsl:comment> |
franta-hg@83 | 39 |
</xsl:if> |
franta-hg@76 | 40 |
<style type="text/css"> |
franta-hg@76 | 41 |
body { |
franta-hg@76 | 42 |
font-family: sans-serif; |
franta-hg@76 | 43 |
font-size: 16px; |
franta-hg@76 | 44 |
} |
franta-hg@76 | 45 |
|
franta-hg@76 | 46 |
.wwwLinks { |
franta-hg@76 | 47 |
border-top: 2px solid grey; |
franta-hg@76 | 48 |
margin-top: 16px; |
franta-hg@76 | 49 |
font-size: 66%; |
franta-hg@76 | 50 |
} |
franta-hg@76 | 51 |
|
franta-hg@76 | 52 |
blockquote { |
franta-hg@76 | 53 |
background-color: #eee; |
franta-hg@76 | 54 |
font-style: italic; |
franta-hg@76 | 55 |
padding: 2px 20px; |
franta-hg@76 | 56 |
margin: 10px 32px; |
franta-hg@76 | 57 |
border-left: 3px solid silver; |
franta-hg@76 | 58 |
} |
franta-hg@76 | 59 |
|
franta-hg@76 | 60 |
pre { |
franta-hg@76 | 61 |
background-color: #eee; |
franta-hg@76 | 62 |
padding: 2px 20px; |
franta-hg@76 | 63 |
margin: 10px 32px; |
franta-hg@76 | 64 |
border-left: 3px solid #a00; |
franta-hg@76 | 65 |
} |
franta-hg@76 | 66 |
|
franta-hg@76 | 67 |
img { |
franta-hg@76 | 68 |
margin: 8px; |
franta-hg@76 | 69 |
} |
franta-hg@76 | 70 |
|
franta-hg@76 | 71 |
a img { |
franta-hg@76 | 72 |
border: none; |
franta-hg@76 | 73 |
} |
franta-hg@76 | 74 |
</style> |
franta-hg@76 | 75 |
</head> |
franta-hg@76 | 76 |
<body> |
franta-hg@76 | 77 |
<xsl:if test="$title and $isRoot"> |
franta-hg@76 | 78 |
<h1><xsl:value-of select="$title"/></h1> |
franta-hg@76 | 79 |
</xsl:if> |
franta-hg@83 | 80 |
|
franta-hg@83 | 81 |
<xsl:apply-templates select="h:html/h:body"/> |
franta-hg@76 | 82 |
|
franta-hg@76 | 83 |
<xsl:if test="$wwwRead or $wwwPost"> |
franta-hg@76 | 84 |
<div class="wwwLinks"> |
franta-hg@76 | 85 |
<p>Přístup přes síť www:</p> |
franta-hg@76 | 86 |
<ul> |
franta-hg@76 | 87 |
<xsl:if test="$wwwRead"><li><a href="{$wwwRead}">číst tento příspěvek</a></li></xsl:if> |
franta-hg@76 | 88 |
<xsl:if test="$wwwPost"><li><a href="{$wwwPost}">odpovědět na tento příspěvek</a></li></xsl:if> |
franta-hg@76 | 89 |
</ul> |
franta-hg@76 | 90 |
</div> |
franta-hg@76 | 91 |
</xsl:if> |
franta-hg@76 | 92 |
</body> |
franta-hg@76 | 93 |
</html> |
franta-hg@76 | 94 |
</xsl:template> |
franta-hg@76 | 95 |
|
franta-hg@76 | 96 |
|
franta-hg@76 | 97 |
<!-- Odkazy --> |
franta-hg@76 | 98 |
<xsl:template match="h:a"> |
franta-hg@76 | 99 |
<a href="{@href}" title="{@title}"><xsl:apply-templates/></a> |
franta-hg@76 | 100 |
</xsl:template> |
franta-hg@76 | 101 |
|
franta-hg@76 | 102 |
|
franta-hg@76 | 103 |
<!-- Obrázky --> |
franta-hg@76 | 104 |
<xsl:template match="h:img"> |
franta-hg@76 | 105 |
<img src="{@src}" alt="{@alt}" title="{@title}"><xsl:apply-templates/></img> |
franta-hg@76 | 106 |
</xsl:template> |
franta-hg@76 | 107 |
|
franta-hg@76 | 108 |
<!-- Zkratky --> |
franta-hg@76 | 109 |
<xsl:template match="h:abbr"> |
franta-hg@76 | 110 |
<abbr title="{@title}"><xsl:apply-templates/></abbr> |
franta-hg@76 | 111 |
</xsl:template> |
franta-hg@76 | 112 |
|
franta-hg@76 | 113 |
|
franta-hg@76 | 114 |
<!-- Další povolené značky – ostatní odfiltrujeme (zbude z nich jen text) --> |
franta-hg@76 | 115 |
<xsl:template match="*"> |
franta-hg@76 | 116 |
<xsl:choose> |
franta-hg@76 | 117 |
<xsl:when test=" |
franta-hg@76 | 118 |
name() = 'h1' or |
franta-hg@76 | 119 |
name() = 'h2' or |
franta-hg@76 | 120 |
name() = 'h3' or |
franta-hg@76 | 121 |
name() = 'h4' or |
franta-hg@76 | 122 |
name() = 'h5' or |
franta-hg@76 | 123 |
name() = 'h6' or |
franta-hg@76 | 124 |
name() = 'p' or |
franta-hg@76 | 125 |
name() = 'div' or |
franta-hg@76 | 126 |
name() = 'br' or |
franta-hg@88 | 127 |
name() = 'hr' or |
franta-hg@76 | 128 |
name() = 'strong' or |
franta-hg@76 | 129 |
name() = 'em' or |
franta-hg@76 | 130 |
name() = 'sub' or |
franta-hg@76 | 131 |
name() = 'sup' or |
franta-hg@76 | 132 |
name() = 'del' or |
franta-hg@76 | 133 |
name() = 'ul' or |
franta-hg@76 | 134 |
name() = 'ol' or |
franta-hg@76 | 135 |
name() = 'li' or |
franta-hg@76 | 136 |
name() = 'pre' or |
franta-hg@76 | 137 |
name() = 'code' or |
franta-hg@76 | 138 |
name() = 'blockquote'"> |
franta-hg@76 | 139 |
<xsl:element name="{name()}"> |
franta-hg@85 | 140 |
<xsl:copy-of select="./node()"/> |
franta-hg@76 | 141 |
</xsl:element> |
franta-hg@76 | 142 |
</xsl:when> |
franta-hg@76 | 143 |
<xsl:otherwise> |
franta-hg@83 | 144 |
<xsl:apply-templates/> |
franta-hg@76 | 145 |
</xsl:otherwise> |
franta-hg@76 | 146 |
</xsl:choose> |
franta-hg@76 | 147 |
</xsl:template> |
franta-hg@77 | 148 |
|
franta-hg@76 | 149 |
</xsl:stylesheet> |