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@51
|
22 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
franta-hg@51
|
23 |
exclude-result-prefixes="m">
|
franta-hg@53
|
24 |
|
franta-hg@53
|
25 |
<!--
|
franta-hg@54
|
26 |
Interní odkazy
|
franta-hg@54
|
27 |
**************
|
franta-hg@54
|
28 |
Slouží k vkládání odkazů na jiné stránky v rámci webu.
|
franta-hg@53
|
29 |
*
|
franta-hg@53
|
30 |
@href zadáváme jen název souboru bez přípony – s nezakódovanou češtinou a s mezerami
|
franta-hg@54
|
31 |
@typ nevyplňujeme
|
franta-hg@53
|
32 |
-->
|
franta-hg@54
|
33 |
<xsl:template match="m:a[not(@typ)]">
|
franta-hg@53
|
34 |
<a>
|
franta-hg@53
|
35 |
<xsl:copy-of select="@*"/>
|
franta-hg@53
|
36 |
<xsl:attribute name="href">
|
franta-hg@53
|
37 |
<xsl:value-of select="encode-for-uri(concat(@href, $výstupníPřípona))"/>
|
franta-hg@53
|
38 |
</xsl:attribute>
|
franta-hg@53
|
39 |
<xsl:apply-templates/>
|
franta-hg@53
|
40 |
</a>
|
franta-hg@53
|
41 |
</xsl:template>
|
franta-hg@53
|
42 |
|
franta-hg@53
|
43 |
<!--
|
franta-hg@53
|
44 |
Trac – wiki
|
franta-hg@53
|
45 |
***********
|
franta-hg@53
|
46 |
Odkazy na Trac našeho generátoru.
|
franta-hg@56
|
47 |
*
|
franta-hg@53
|
48 |
@href nečíselné parametry vedou do wiki
|
franta-hg@53
|
49 |
-->
|
franta-hg@53
|
50 |
<xsl:template match="m:a[@typ='trac' and not(number(@href))]">
|
franta-hg@53
|
51 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@53
|
52 |
<xsl:with-param name="url" select="
|
franta-hg@53
|
53 |
concat(
|
franta-hg@53
|
54 |
'https://trac.frantovo.cz/xml-web-generator/wiki/',
|
franta-hg@53
|
55 |
replace(encode-for-uri(@href), '%2F', '/')
|
franta-hg@53
|
56 |
)"/>
|
franta-hg@53
|
57 |
</xsl:call-template>
|
franta-hg@53
|
58 |
</xsl:template>
|
franta-hg@53
|
59 |
|
franta-hg@53
|
60 |
<!--
|
franta-hg@53
|
61 |
Trac – úkoly
|
franta-hg@53
|
62 |
************
|
franta-hg@53
|
63 |
Odkazy na Trac našeho generátoru.
|
franta-hg@56
|
64 |
*
|
franta-hg@53
|
65 |
@href číselné parametry vedou na úkoly
|
franta-hg@53
|
66 |
-->
|
franta-hg@53
|
67 |
<xsl:template match="m:a[@typ='trac' and number(@href)]">
|
franta-hg@53
|
68 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@53
|
69 |
<xsl:with-param name="url" select="
|
franta-hg@53
|
70 |
concat(
|
franta-hg@53
|
71 |
'https://trac.frantovo.cz/xml-web-generator/ticket/',
|
franta-hg@53
|
72 |
@href
|
franta-hg@53
|
73 |
)"/>
|
franta-hg@53
|
74 |
</xsl:call-template>
|
franta-hg@53
|
75 |
</xsl:template>
|
franta-hg@53
|
76 |
|
franta-hg@54
|
77 |
<!--
|
franta-hg@54
|
78 |
Wikipedia
|
franta-hg@56
|
79 |
*********
|
franta-hg@63
|
80 |
Stránka v encyklopedii.
|
franta-hg@56
|
81 |
*
|
franta-hg@54
|
82 |
@href název stránky
|
franta-hg@54
|
83 |
@jazyk kód jazyka (výchozí je čeština)
|
franta-hg@54
|
84 |
-->
|
franta-hg@54
|
85 |
<xsl:template match="m:a[@typ='wiki']">
|
franta-hg@54
|
86 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
87 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
88 |
concat(
|
franta-hg@54
|
89 |
'https://secure.wikimedia.org/wikipedia/', (@jazyk,'cs')[1], '/wiki/',
|
franta-hg@54
|
90 |
encode-for-uri(@href)
|
franta-hg@54
|
91 |
)"/>
|
franta-hg@54
|
92 |
</xsl:call-template>
|
franta-hg@54
|
93 |
</xsl:template>
|
franta-hg@54
|
94 |
|
franta-hg@63
|
95 |
<!--
|
franta-hg@63
|
96 |
Javadoc
|
franta-hg@63
|
97 |
*******
|
franta-hg@63
|
98 |
Dokumentace k javovským třídám.
|
franta-hg@63
|
99 |
*
|
franta-hg@63
|
100 |
@href jméno třídy včetně balíčku – např. java.lang.String
|
franta-hg@63
|
101 |
@verze verze Javy, výchozí: 7
|
franta-hg@63
|
102 |
-->
|
franta-hg@63
|
103 |
<xsl:template match="m:a[@typ='javadoc']">
|
franta-hg@63
|
104 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@63
|
105 |
<xsl:with-param name="url" select="
|
franta-hg@63
|
106 |
concat(
|
franta-hg@63
|
107 |
'http://docs.oracle.com/javase/', (@verze,'7')[1], '/docs/api/',
|
franta-hg@63
|
108 |
replace(@href, '\.', '/'),
|
franta-hg@63
|
109 |
'.html'
|
franta-hg@63
|
110 |
)"/>
|
franta-hg@63
|
111 |
</xsl:call-template>
|
franta-hg@63
|
112 |
</xsl:template>
|
franta-hg@63
|
113 |
|
franta-hg@53
|
114 |
<!--
|
franta-hg@53
|
115 |
Seznam.cz
|
franta-hg@53
|
116 |
*********
|
franta-hg@63
|
117 |
Vyhledávání pomocí Seznamu.
|
franta-hg@56
|
118 |
*
|
franta-hg@54
|
119 |
@href náš dotaz
|
franta-hg@53
|
120 |
-->
|
franta-hg@53
|
121 |
<xsl:template match="m:a[@typ='seznam']">
|
franta-hg@53
|
122 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
123 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
124 |
concat(
|
franta-hg@54
|
125 |
'http://search.seznam.cz/?q=',
|
franta-hg@54
|
126 |
encode-for-uri(@href)
|
franta-hg@54
|
127 |
)"/>
|
franta-hg@53
|
128 |
</xsl:call-template>
|
franta-hg@53
|
129 |
</xsl:template>
|
franta-hg@53
|
130 |
|
franta-hg@53
|
131 |
<!--
|
franta-hg@53
|
132 |
Google.com
|
franta-hg@53
|
133 |
**********
|
franta-hg@63
|
134 |
Vyhledávání pomocí Googlu.
|
franta-hg@56
|
135 |
*
|
franta-hg@54
|
136 |
@href náš dotaz
|
franta-hg@53
|
137 |
-->
|
franta-hg@53
|
138 |
<xsl:template match="m:a[@typ='google']">
|
franta-hg@53
|
139 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
140 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
141 |
concat(
|
franta-hg@54
|
142 |
'https://encrypted.google.com/search?q=',
|
franta-hg@54
|
143 |
encode-for-uri(@href)
|
franta-hg@54
|
144 |
)"/>
|
franta-hg@53
|
145 |
</xsl:call-template>
|
franta-hg@53
|
146 |
</xsl:template>
|
franta-hg@53
|
147 |
|
franta-hg@53
|
148 |
<!--
|
franta-hg@53
|
149 |
Request for comments
|
franta-hg@53
|
150 |
********************
|
franta-hg@63
|
151 |
Internetové standardy – RFC.
|
franta-hg@56
|
152 |
*
|
franta-hg@54
|
153 |
@href číslo RFCčka
|
franta-hg@53
|
154 |
-->
|
franta-hg@57
|
155 |
<xsl:template match="m:a[@typ='rfc' and number(@href)]">
|
franta-hg@53
|
156 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
157 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
158 |
concat(
|
franta-hg@54
|
159 |
'https://tools.ietf.org/html/rfc',
|
franta-hg@54
|
160 |
@href
|
franta-hg@54
|
161 |
)"/>
|
franta-hg@53
|
162 |
</xsl:call-template>
|
franta-hg@53
|
163 |
</xsl:template>
|
franta-hg@53
|
164 |
|
franta-hg@53
|
165 |
|
franta-hg@53
|
166 |
<xsl:template name="vložOdkaz">
|
franta-hg@53
|
167 |
<xsl:param name="url"/>
|
franta-hg@53
|
168 |
<a>
|
franta-hg@53
|
169 |
<xsl:copy-of select="@*"/>
|
franta-hg@53
|
170 |
<xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
|
franta-hg@53
|
171 |
<xsl:apply-templates/>
|
franta-hg@54
|
172 |
</a>
|
franta-hg@53
|
173 |
</xsl:template>
|
franta-hg@53
|
174 |
|
franta-hg@51
|
175 |
</xsl:stylesheet>
|