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