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@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@66
|
24 |
exclude-result-prefixes="m 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@66
|
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@66
|
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@54
|
113 |
encode-for-uri(@href)
|
franta-hg@54
|
114 |
)"/>
|
franta-hg@54
|
115 |
</xsl:call-template>
|
franta-hg@54
|
116 |
</xsl:template>
|
franta-hg@54
|
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@63
|
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@53
|
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@53
|
187 |
|
franta-hg@53
|
188 |
|
franta-hg@53
|
189 |
<xsl:template name="vložOdkaz">
|
franta-hg@53
|
190 |
<xsl:param name="url"/>
|
franta-hg@53
|
191 |
<a>
|
franta-hg@66
|
192 |
<!-- Zachováme pouze povolené atributy: -->
|
franta-hg@66
|
193 |
|
franta-hg@66
|
194 |
<xsl:copy-of select="@charset"/>
|
franta-hg@66
|
195 |
<xsl:copy-of select="@coords"/>
|
franta-hg@66
|
196 |
<xsl:copy-of select="@hreflang"/>
|
franta-hg@66
|
197 |
<xsl:copy-of select="@name"/>
|
franta-hg@66
|
198 |
<xsl:copy-of select="@rel"/>
|
franta-hg@66
|
199 |
<xsl:copy-of select="@rev"/>
|
franta-hg@66
|
200 |
<xsl:copy-of select="@shape"/>
|
franta-hg@66
|
201 |
<xsl:copy-of select="@target"/> <!-- Pozor: nepatří do striktního XHTML -->
|
franta-hg@66
|
202 |
|
franta-hg@66
|
203 |
<xsl:copy-of select="@accesskey"/>
|
franta-hg@66
|
204 |
<xsl:copy-of select="@class"/>
|
franta-hg@66
|
205 |
<xsl:copy-of select="@dir"/>
|
franta-hg@66
|
206 |
<xsl:copy-of select="@id"/>
|
franta-hg@66
|
207 |
<xsl:copy-of select="@lang"/>
|
franta-hg@66
|
208 |
<xsl:copy-of select="@style"/>
|
franta-hg@66
|
209 |
<xsl:copy-of select="@tabindex"/>
|
franta-hg@66
|
210 |
<xsl:copy-of select="@title"/>
|
franta-hg@66
|
211 |
<xsl:copy-of select="@xml:lang"/>
|
franta-hg@66
|
212 |
|
franta-hg@66
|
213 |
<xsl:copy-of select="@onblur"/>
|
franta-hg@66
|
214 |
<xsl:copy-of select="@onclick"/>
|
franta-hg@66
|
215 |
<xsl:copy-of select="@ondblclick"/>
|
franta-hg@66
|
216 |
<xsl:copy-of select="@onfocus"/>
|
franta-hg@66
|
217 |
<xsl:copy-of select="@onmousedown"/>
|
franta-hg@66
|
218 |
<xsl:copy-of select="@onmousemove"/>
|
franta-hg@66
|
219 |
<xsl:copy-of select="@onmouseout"/>
|
franta-hg@66
|
220 |
<xsl:copy-of select="@onmouseover"/>
|
franta-hg@66
|
221 |
<xsl:copy-of select="@onmouseup"/>
|
franta-hg@66
|
222 |
<xsl:copy-of select="@onkeydown"/>
|
franta-hg@66
|
223 |
<xsl:copy-of select="@onkeypress"/>
|
franta-hg@66
|
224 |
<xsl:copy-of select="@onkeyup"/>
|
franta-hg@66
|
225 |
|
franta-hg@53
|
226 |
<xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
|
franta-hg@53
|
227 |
<xsl:apply-templates/>
|
franta-hg@54
|
228 |
</a>
|
franta-hg@53
|
229 |
</xsl:template>
|
franta-hg@53
|
230 |
|
franta-hg@51
|
231 |
</xsl:stylesheet>
|