franta-hg@51
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
franta-hg@51
|
2 |
<xsl:stylesheet version="2.0"
|
franta-hg@51
|
3 |
xmlns="http://www.w3.org/1999/xhtml"
|
franta-hg@51
|
4 |
xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
|
franta-hg@51
|
5 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
franta-hg@51
|
6 |
exclude-result-prefixes="m">
|
franta-hg@53
|
7 |
|
franta-hg@53
|
8 |
<!--
|
franta-hg@54
|
9 |
Interní odkazy
|
franta-hg@54
|
10 |
**************
|
franta-hg@54
|
11 |
Slouží k vkládání odkazů na jiné stránky v rámci webu.
|
franta-hg@53
|
12 |
*
|
franta-hg@53
|
13 |
@href zadáváme jen název souboru bez přípony – s nezakódovanou češtinou a s mezerami
|
franta-hg@54
|
14 |
@typ nevyplňujeme
|
franta-hg@53
|
15 |
-->
|
franta-hg@54
|
16 |
<xsl:template match="m:a[not(@typ)]">
|
franta-hg@53
|
17 |
<a>
|
franta-hg@53
|
18 |
<xsl:copy-of select="@*"/>
|
franta-hg@53
|
19 |
<xsl:attribute name="href">
|
franta-hg@53
|
20 |
<xsl:value-of select="encode-for-uri(concat(@href, $výstupníPřípona))"/>
|
franta-hg@53
|
21 |
</xsl:attribute>
|
franta-hg@53
|
22 |
<xsl:apply-templates/>
|
franta-hg@53
|
23 |
</a>
|
franta-hg@53
|
24 |
</xsl:template>
|
franta-hg@53
|
25 |
|
franta-hg@53
|
26 |
<!--
|
franta-hg@53
|
27 |
Trac – wiki
|
franta-hg@53
|
28 |
***********
|
franta-hg@53
|
29 |
Odkazy na Trac našeho generátoru.
|
franta-hg@56
|
30 |
*
|
franta-hg@53
|
31 |
@href nečíselné parametry vedou do wiki
|
franta-hg@53
|
32 |
-->
|
franta-hg@53
|
33 |
<xsl:template match="m:a[@typ='trac' and not(number(@href))]">
|
franta-hg@53
|
34 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@53
|
35 |
<xsl:with-param name="url" select="
|
franta-hg@53
|
36 |
concat(
|
franta-hg@53
|
37 |
'https://trac.frantovo.cz/xml-web-generator/wiki/',
|
franta-hg@53
|
38 |
replace(encode-for-uri(@href), '%2F', '/')
|
franta-hg@53
|
39 |
)"/>
|
franta-hg@53
|
40 |
</xsl:call-template>
|
franta-hg@53
|
41 |
</xsl:template>
|
franta-hg@53
|
42 |
|
franta-hg@53
|
43 |
<!--
|
franta-hg@53
|
44 |
Trac – úkoly
|
franta-hg@53
|
45 |
************
|
franta-hg@53
|
46 |
Odkazy na Trac našeho generátoru.
|
franta-hg@56
|
47 |
*
|
franta-hg@53
|
48 |
@href číselné parametry vedou na úkoly
|
franta-hg@53
|
49 |
-->
|
franta-hg@53
|
50 |
<xsl:template match="m:a[@typ='trac' and 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/ticket/',
|
franta-hg@53
|
55 |
@href
|
franta-hg@53
|
56 |
)"/>
|
franta-hg@53
|
57 |
</xsl:call-template>
|
franta-hg@53
|
58 |
</xsl:template>
|
franta-hg@53
|
59 |
|
franta-hg@54
|
60 |
<!--
|
franta-hg@54
|
61 |
Wikipedia
|
franta-hg@56
|
62 |
*********
|
franta-hg@56
|
63 |
Stránka v encyklopedii
|
franta-hg@56
|
64 |
*
|
franta-hg@54
|
65 |
@href název stránky
|
franta-hg@54
|
66 |
@jazyk kód jazyka (výchozí je čeština)
|
franta-hg@54
|
67 |
-->
|
franta-hg@54
|
68 |
<xsl:template match="m:a[@typ='wiki']">
|
franta-hg@54
|
69 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
70 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
71 |
concat(
|
franta-hg@54
|
72 |
'https://secure.wikimedia.org/wikipedia/', (@jazyk,'cs')[1], '/wiki/',
|
franta-hg@54
|
73 |
encode-for-uri(@href)
|
franta-hg@54
|
74 |
)"/>
|
franta-hg@54
|
75 |
</xsl:call-template>
|
franta-hg@54
|
76 |
</xsl:template>
|
franta-hg@54
|
77 |
|
franta-hg@53
|
78 |
<!--
|
franta-hg@53
|
79 |
Seznam.cz
|
franta-hg@53
|
80 |
*********
|
franta-hg@53
|
81 |
Vyhledávání pomocí Seznamu
|
franta-hg@56
|
82 |
*
|
franta-hg@54
|
83 |
@href náš dotaz
|
franta-hg@53
|
84 |
-->
|
franta-hg@53
|
85 |
<xsl:template match="m:a[@typ='seznam']">
|
franta-hg@53
|
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 |
'http://search.seznam.cz/?q=',
|
franta-hg@54
|
90 |
encode-for-uri(@href)
|
franta-hg@54
|
91 |
)"/>
|
franta-hg@53
|
92 |
</xsl:call-template>
|
franta-hg@53
|
93 |
</xsl:template>
|
franta-hg@53
|
94 |
|
franta-hg@53
|
95 |
<!--
|
franta-hg@53
|
96 |
Google.com
|
franta-hg@53
|
97 |
**********
|
franta-hg@53
|
98 |
Vyhledávání pomocí Googlu
|
franta-hg@56
|
99 |
*
|
franta-hg@54
|
100 |
@href náš dotaz
|
franta-hg@53
|
101 |
-->
|
franta-hg@53
|
102 |
<xsl:template match="m:a[@typ='google']">
|
franta-hg@53
|
103 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
104 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
105 |
concat(
|
franta-hg@54
|
106 |
'https://encrypted.google.com/search?q=',
|
franta-hg@54
|
107 |
encode-for-uri(@href)
|
franta-hg@54
|
108 |
)"/>
|
franta-hg@53
|
109 |
</xsl:call-template>
|
franta-hg@53
|
110 |
</xsl:template>
|
franta-hg@53
|
111 |
|
franta-hg@53
|
112 |
<!--
|
franta-hg@53
|
113 |
Request for comments
|
franta-hg@53
|
114 |
********************
|
franta-hg@53
|
115 |
Internetové standardy – RFC
|
franta-hg@56
|
116 |
*
|
franta-hg@54
|
117 |
@href číslo RFCčka
|
franta-hg@53
|
118 |
-->
|
franta-hg@57
|
119 |
<xsl:template match="m:a[@typ='rfc' and number(@href)]">
|
franta-hg@53
|
120 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
121 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
122 |
concat(
|
franta-hg@54
|
123 |
'https://tools.ietf.org/html/rfc',
|
franta-hg@54
|
124 |
@href
|
franta-hg@54
|
125 |
)"/>
|
franta-hg@53
|
126 |
</xsl:call-template>
|
franta-hg@53
|
127 |
</xsl:template>
|
franta-hg@53
|
128 |
|
franta-hg@53
|
129 |
|
franta-hg@53
|
130 |
<xsl:template name="vložOdkaz">
|
franta-hg@53
|
131 |
<xsl:param name="url"/>
|
franta-hg@53
|
132 |
<a>
|
franta-hg@53
|
133 |
<xsl:copy-of select="@*"/>
|
franta-hg@53
|
134 |
<xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
|
franta-hg@53
|
135 |
<xsl:apply-templates/>
|
franta-hg@54
|
136 |
</a>
|
franta-hg@53
|
137 |
</xsl:template>
|
franta-hg@53
|
138 |
|
franta-hg@51
|
139 |
</xsl:stylesheet>
|