franta-hg@51
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
franta-hg@61
|
2 |
<!--
|
franta-hg@61
|
3 |
XML Web generátor – program na generování webových stránek
|
franta-hg@61
|
4 |
Copyright © 2012 František Kučera (frantovo.cz)
|
franta-hg@61
|
5 |
|
franta-hg@61
|
6 |
This program is free software: you can redistribute it and/or modify
|
franta-hg@61
|
7 |
it under the terms of the GNU General Public License as published by
|
franta-hg@61
|
8 |
the Free Software Foundation, either version 3 of the License, or
|
franta-hg@61
|
9 |
(at your option) any later version.
|
franta-hg@61
|
10 |
|
franta-hg@61
|
11 |
This program is distributed in the hope that it will be useful,
|
franta-hg@61
|
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
franta-hg@61
|
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
franta-hg@61
|
14 |
GNU General Public License for more details.
|
franta-hg@61
|
15 |
|
franta-hg@61
|
16 |
You should have received a copy of the GNU General Public License
|
franta-hg@61
|
17 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
franta-hg@61
|
18 |
-->
|
franta-hg@51
|
19 |
<xsl:stylesheet version="2.0"
|
franta-hg@51
|
20 |
xmlns="http://www.w3.org/1999/xhtml"
|
franta-hg@51
|
21 |
xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
|
franta-hg@93
|
22 |
xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace"
|
franta-hg@66
|
23 |
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
franta-hg@51
|
24 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
franta-hg@93
|
25 |
exclude-result-prefixes="m k xs">
|
franta-hg@53
|
26 |
|
franta-hg@53
|
27 |
<!--
|
franta-hg@54
|
28 |
Interní odkazy
|
franta-hg@54
|
29 |
**************
|
franta-hg@54
|
30 |
Slouží k vkládání odkazů na jiné stránky v rámci webu.
|
franta-hg@53
|
31 |
*
|
franta-hg@53
|
32 |
@href zadáváme jen název souboru bez přípony – s nezakódovanou češtinou a s mezerami
|
franta-hg@54
|
33 |
@typ nevyplňujeme
|
franta-hg@53
|
34 |
-->
|
franta-hg@54
|
35 |
<xsl:template match="m:a[not(@typ)]">
|
franta-hg@53
|
36 |
<a>
|
franta-hg@53
|
37 |
<xsl:copy-of select="@*"/>
|
franta-hg@53
|
38 |
<xsl:attribute name="href">
|
franta-hg@53
|
39 |
<xsl:value-of select="encode-for-uri(concat(@href, $výstupníPřípona))"/>
|
franta-hg@53
|
40 |
</xsl:attribute>
|
franta-hg@53
|
41 |
<xsl:apply-templates/>
|
franta-hg@53
|
42 |
</a>
|
franta-hg@53
|
43 |
</xsl:template>
|
franta-hg@53
|
44 |
|
franta-hg@66
|
45 |
<xsl:variable name="tracURL" select="'https://trac.frantovo.cz/xml-web-generator'"/>
|
franta-hg@66
|
46 |
|
franta-hg@53
|
47 |
<!--
|
franta-hg@53
|
48 |
Trac – wiki
|
franta-hg@53
|
49 |
***********
|
franta-hg@53
|
50 |
Odkazy na Trac našeho generátoru.
|
franta-hg@56
|
51 |
*
|
franta-hg@53
|
52 |
@href nečíselné parametry vedou do wiki
|
franta-hg@53
|
53 |
-->
|
franta-hg@53
|
54 |
<xsl:template match="m:a[@typ='trac' and not(number(@href))]">
|
franta-hg@53
|
55 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@53
|
56 |
<xsl:with-param name="url" select="
|
franta-hg@53
|
57 |
concat(
|
franta-hg@66
|
58 |
$tracURL, '/wiki/',
|
franta-hg@66
|
59 |
m:escapuj-url-zachovej-lomítka(@href)
|
franta-hg@53
|
60 |
)"/>
|
franta-hg@53
|
61 |
</xsl:call-template>
|
franta-hg@53
|
62 |
</xsl:template>
|
franta-hg@66
|
63 |
|
franta-hg@53
|
64 |
<!--
|
franta-hg@53
|
65 |
Trac – úkoly
|
franta-hg@53
|
66 |
************
|
franta-hg@53
|
67 |
Odkazy na Trac našeho generátoru.
|
franta-hg@56
|
68 |
*
|
franta-hg@53
|
69 |
@href číselné parametry vedou na úkoly
|
franta-hg@53
|
70 |
-->
|
franta-hg@53
|
71 |
<xsl:template match="m:a[@typ='trac' and number(@href)]">
|
franta-hg@53
|
72 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@53
|
73 |
<xsl:with-param name="url" select="
|
franta-hg@53
|
74 |
concat(
|
franta-hg@66
|
75 |
$tracURL, '/ticket/',
|
franta-hg@53
|
76 |
@href
|
franta-hg@53
|
77 |
)"/>
|
franta-hg@53
|
78 |
</xsl:call-template>
|
franta-hg@53
|
79 |
</xsl:template>
|
franta-hg@53
|
80 |
|
franta-hg@54
|
81 |
<!--
|
franta-hg@66
|
82 |
Zdroják
|
franta-hg@66
|
83 |
*******
|
franta-hg@66
|
84 |
Odkazy zdrojový kód našeho generátoru.
|
franta-hg@66
|
85 |
*
|
franta-hg@66
|
86 |
@href název souboru
|
franta-hg@66
|
87 |
@řádek číslo řádku (volitelně)
|
franta-hg@66
|
88 |
-->
|
franta-hg@66
|
89 |
<xsl:template match="m:a[@typ='zdroják' and (not(@řádek) or number(@řádek))]">
|
franta-hg@66
|
90 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@66
|
91 |
<xsl:with-param name="url" select="
|
franta-hg@66
|
92 |
concat(
|
franta-hg@66
|
93 |
$tracURL, '/browser/',
|
franta-hg@66
|
94 |
m:escapuj-url-zachovej-lomítka(@href),
|
franta-hg@66
|
95 |
'#L',
|
franta-hg@66
|
96 |
(@řádek,'1')[1]
|
franta-hg@66
|
97 |
)"/>
|
franta-hg@66
|
98 |
</xsl:call-template>
|
franta-hg@66
|
99 |
</xsl:template>
|
franta-hg@93
|
100 |
|
franta-hg@66
|
101 |
<!--
|
franta-hg@54
|
102 |
Wikipedia
|
franta-hg@56
|
103 |
*********
|
franta-hg@63
|
104 |
Stránka v encyklopedii.
|
franta-hg@56
|
105 |
*
|
franta-hg@54
|
106 |
@href název stránky
|
franta-hg@54
|
107 |
@jazyk kód jazyka (výchozí je čeština)
|
franta-hg@54
|
108 |
-->
|
franta-hg@54
|
109 |
<xsl:template match="m:a[@typ='wiki']">
|
franta-hg@54
|
110 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
111 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
112 |
concat(
|
franta-hg@54
|
113 |
'https://secure.wikimedia.org/wikipedia/', (@jazyk,'cs')[1], '/wiki/',
|
franta-hg@81
|
114 |
m:escapuj-url-zachovej-lomítka(@href)
|
franta-hg@54
|
115 |
)"/>
|
franta-hg@54
|
116 |
</xsl:call-template>
|
franta-hg@54
|
117 |
</xsl:template>
|
franta-hg@93
|
118 |
|
franta-hg@63
|
119 |
<!--
|
franta-hg@63
|
120 |
Javadoc
|
franta-hg@63
|
121 |
*******
|
franta-hg@63
|
122 |
Dokumentace k javovským třídám.
|
franta-hg@63
|
123 |
*
|
franta-hg@63
|
124 |
@href jméno třídy včetně balíčku – např. java.lang.String
|
franta-hg@63
|
125 |
@verze verze Javy, výchozí: 7
|
franta-hg@63
|
126 |
-->
|
franta-hg@63
|
127 |
<xsl:template match="m:a[@typ='javadoc']">
|
franta-hg@63
|
128 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@63
|
129 |
<xsl:with-param name="url" select="
|
franta-hg@63
|
130 |
concat(
|
franta-hg@63
|
131 |
'http://docs.oracle.com/javase/', (@verze,'7')[1], '/docs/api/',
|
franta-hg@63
|
132 |
replace(@href, '\.', '/'),
|
franta-hg@63
|
133 |
'.html'
|
franta-hg@63
|
134 |
)"/>
|
franta-hg@63
|
135 |
</xsl:call-template>
|
franta-hg@63
|
136 |
</xsl:template>
|
franta-hg@93
|
137 |
|
franta-hg@53
|
138 |
<!--
|
franta-hg@53
|
139 |
Seznam.cz
|
franta-hg@53
|
140 |
*********
|
franta-hg@63
|
141 |
Vyhledávání pomocí Seznamu.
|
franta-hg@56
|
142 |
*
|
franta-hg@54
|
143 |
@href náš dotaz
|
franta-hg@53
|
144 |
-->
|
franta-hg@53
|
145 |
<xsl:template match="m:a[@typ='seznam']">
|
franta-hg@53
|
146 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
147 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
148 |
concat(
|
franta-hg@54
|
149 |
'http://search.seznam.cz/?q=',
|
franta-hg@54
|
150 |
encode-for-uri(@href)
|
franta-hg@54
|
151 |
)"/>
|
franta-hg@53
|
152 |
</xsl:call-template>
|
franta-hg@53
|
153 |
</xsl:template>
|
franta-hg@53
|
154 |
|
franta-hg@53
|
155 |
<!--
|
franta-hg@53
|
156 |
Google.com
|
franta-hg@53
|
157 |
**********
|
franta-hg@63
|
158 |
Vyhledávání pomocí Googlu.
|
franta-hg@56
|
159 |
*
|
franta-hg@54
|
160 |
@href náš dotaz
|
franta-hg@53
|
161 |
-->
|
franta-hg@53
|
162 |
<xsl:template match="m:a[@typ='google']">
|
franta-hg@53
|
163 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
164 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
165 |
concat(
|
franta-hg@54
|
166 |
'https://encrypted.google.com/search?q=',
|
franta-hg@54
|
167 |
encode-for-uri(@href)
|
franta-hg@54
|
168 |
)"/>
|
franta-hg@53
|
169 |
</xsl:call-template>
|
franta-hg@53
|
170 |
</xsl:template>
|
franta-hg@93
|
171 |
|
franta-hg@53
|
172 |
<!--
|
franta-hg@53
|
173 |
Request for comments
|
franta-hg@53
|
174 |
********************
|
franta-hg@63
|
175 |
Internetové standardy – RFC.
|
franta-hg@56
|
176 |
*
|
franta-hg@54
|
177 |
@href číslo RFCčka
|
franta-hg@53
|
178 |
-->
|
franta-hg@57
|
179 |
<xsl:template match="m:a[@typ='rfc' and number(@href)]">
|
franta-hg@53
|
180 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
181 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
182 |
concat(
|
franta-hg@54
|
183 |
'https://tools.ietf.org/html/rfc',
|
franta-hg@54
|
184 |
@href
|
franta-hg@54
|
185 |
)"/>
|
franta-hg@53
|
186 |
</xsl:call-template>
|
franta-hg@53
|
187 |
</xsl:template>
|
franta-hg@93
|
188 |
|
franta-hg@93
|
189 |
<!--
|
franta-hg@93
|
190 |
E-mail
|
franta-hg@93
|
191 |
******
|
franta-hg@93
|
192 |
Odkaz na e-mail v „obfuskovaném“ tvaru,
|
franta-hg@93
|
193 |
aby spamovací roboti nemohli tak snadno sbírat e-mailové adresy z webů.
|
franta-hg@93
|
194 |
Ale zároveň klikatelný, aby ho uživatel nemusel opisovat (vyžaduje JavaScript).
|
franta-hg@93
|
195 |
Obsah elementu je nepovinný – pokud chybí, vloží se e-mailová adresa.
|
franta-hg@93
|
196 |
*
|
franta-hg@93
|
197 |
@href e-mailová adresa (bez „mailto:“)
|
franta-hg@93
|
198 |
-->
|
franta-hg@93
|
199 |
<xsl:template match="m:a[@typ='email']">
|
franta-hg@93
|
200 |
<xsl:variable name="česky" select="replace(replace(@href, '@', ' zavináč '), '\.', ' tečka ')"/>
|
franta-hg@93
|
201 |
<xsl:variable name="klíč" select="concat(tokenize($konfigurace/k:web/k:uuid/text(), '-')[1], '9df1')"/>
|
franta-hg@93
|
202 |
<xsl:variable name="pořadí"><xsl:number level="any"/></xsl:variable>
|
franta-hg@93
|
203 |
<xsl:variable name="idSpanu" select="concat('c', $klíč, $pořadí)"/>
|
franta-hg@93
|
204 |
<span title="{text()}" id="{$idSpanu}">
|
franta-hg@93
|
205 |
<xsl:value-of select="$česky"/>
|
franta-hg@93
|
206 |
</span>
|
franta-hg@93
|
207 |
<span id="{$idSpanu}b" style="display: none">
|
franta-hg@93
|
208 |
<xsl:apply-templates/>
|
franta-hg@93
|
209 |
</span>
|
franta-hg@93
|
210 |
<script type="text/javascript">
|
franta-hg@93
|
211 |
xwg.odkazNaElektronickouPoštu("<xsl:value-of select="$idSpanu"/>");
|
franta-hg@93
|
212 |
</script>
|
franta-hg@93
|
213 |
</xsl:template>
|
franta-hg@93
|
214 |
|
franta-hg@93
|
215 |
|
franta-hg@53
|
216 |
<xsl:template name="vložOdkaz">
|
franta-hg@53
|
217 |
<xsl:param name="url"/>
|
franta-hg@53
|
218 |
<a>
|
franta-hg@66
|
219 |
<!-- Zachováme pouze povolené atributy: -->
|
franta-hg@66
|
220 |
|
franta-hg@66
|
221 |
<xsl:copy-of select="@charset"/>
|
franta-hg@66
|
222 |
<xsl:copy-of select="@coords"/>
|
franta-hg@66
|
223 |
<xsl:copy-of select="@hreflang"/>
|
franta-hg@66
|
224 |
<xsl:copy-of select="@name"/>
|
franta-hg@66
|
225 |
<xsl:copy-of select="@rel"/>
|
franta-hg@66
|
226 |
<xsl:copy-of select="@rev"/>
|
franta-hg@66
|
227 |
<xsl:copy-of select="@shape"/>
|
franta-hg@66
|
228 |
<xsl:copy-of select="@target"/> <!-- Pozor: nepatří do striktního XHTML -->
|
franta-hg@66
|
229 |
|
franta-hg@66
|
230 |
<xsl:copy-of select="@accesskey"/>
|
franta-hg@66
|
231 |
<xsl:copy-of select="@class"/>
|
franta-hg@66
|
232 |
<xsl:copy-of select="@dir"/>
|
franta-hg@66
|
233 |
<xsl:copy-of select="@id"/>
|
franta-hg@66
|
234 |
<xsl:copy-of select="@lang"/>
|
franta-hg@66
|
235 |
<xsl:copy-of select="@style"/>
|
franta-hg@66
|
236 |
<xsl:copy-of select="@tabindex"/>
|
franta-hg@66
|
237 |
<xsl:copy-of select="@title"/>
|
franta-hg@66
|
238 |
<xsl:copy-of select="@xml:lang"/>
|
franta-hg@66
|
239 |
|
franta-hg@66
|
240 |
<xsl:copy-of select="@onblur"/>
|
franta-hg@66
|
241 |
<xsl:copy-of select="@onclick"/>
|
franta-hg@66
|
242 |
<xsl:copy-of select="@ondblclick"/>
|
franta-hg@66
|
243 |
<xsl:copy-of select="@onfocus"/>
|
franta-hg@66
|
244 |
<xsl:copy-of select="@onmousedown"/>
|
franta-hg@66
|
245 |
<xsl:copy-of select="@onmousemove"/>
|
franta-hg@66
|
246 |
<xsl:copy-of select="@onmouseout"/>
|
franta-hg@66
|
247 |
<xsl:copy-of select="@onmouseover"/>
|
franta-hg@66
|
248 |
<xsl:copy-of select="@onmouseup"/>
|
franta-hg@66
|
249 |
<xsl:copy-of select="@onkeydown"/>
|
franta-hg@66
|
250 |
<xsl:copy-of select="@onkeypress"/>
|
franta-hg@66
|
251 |
<xsl:copy-of select="@onkeyup"/>
|
franta-hg@66
|
252 |
|
franta-hg@53
|
253 |
<xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
|
franta-hg@53
|
254 |
<xsl:apply-templates/>
|
franta-hg@54
|
255 |
</a>
|
franta-hg@53
|
256 |
</xsl:template>
|
franta-hg@53
|
257 |
|
franta-hg@51
|
258 |
</xsl:stylesheet>
|
franta-hg@87
|
259 |
|