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@53
|
30 |
@href nečíselné parametry vedou do wiki
|
franta-hg@53
|
31 |
-->
|
franta-hg@53
|
32 |
<xsl:template match="m:a[@typ='trac' and not(number(@href))]">
|
franta-hg@53
|
33 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@53
|
34 |
<xsl:with-param name="url" select="
|
franta-hg@53
|
35 |
concat(
|
franta-hg@53
|
36 |
'https://trac.frantovo.cz/xml-web-generator/wiki/',
|
franta-hg@53
|
37 |
replace(encode-for-uri(@href), '%2F', '/')
|
franta-hg@53
|
38 |
)"/>
|
franta-hg@53
|
39 |
</xsl:call-template>
|
franta-hg@53
|
40 |
</xsl:template>
|
franta-hg@53
|
41 |
|
franta-hg@53
|
42 |
<!--
|
franta-hg@53
|
43 |
Trac – úkoly
|
franta-hg@53
|
44 |
************
|
franta-hg@53
|
45 |
Odkazy na Trac našeho generátoru.
|
franta-hg@53
|
46 |
@href číselné parametry vedou na úkoly
|
franta-hg@53
|
47 |
-->
|
franta-hg@53
|
48 |
<xsl:template match="m:a[@typ='trac' and number(@href)]">
|
franta-hg@53
|
49 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@53
|
50 |
<xsl:with-param name="url" select="
|
franta-hg@53
|
51 |
concat(
|
franta-hg@53
|
52 |
'https://trac.frantovo.cz/xml-web-generator/ticket/',
|
franta-hg@53
|
53 |
@href
|
franta-hg@53
|
54 |
)"/>
|
franta-hg@53
|
55 |
</xsl:call-template>
|
franta-hg@53
|
56 |
</xsl:template>
|
franta-hg@53
|
57 |
|
franta-hg@54
|
58 |
<!--
|
franta-hg@54
|
59 |
Wikipedia
|
franta-hg@54
|
60 |
************
|
franta-hg@54
|
61 |
Stránka v encyklopedii
|
franta-hg@54
|
62 |
@href název stránky
|
franta-hg@54
|
63 |
@jazyk kód jazyka (výchozí je čeština)
|
franta-hg@54
|
64 |
-->
|
franta-hg@54
|
65 |
<xsl:template match="m:a[@typ='wiki']">
|
franta-hg@54
|
66 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
67 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
68 |
concat(
|
franta-hg@54
|
69 |
'https://secure.wikimedia.org/wikipedia/', (@jazyk,'cs')[1], '/wiki/',
|
franta-hg@54
|
70 |
encode-for-uri(@href)
|
franta-hg@54
|
71 |
)"/>
|
franta-hg@54
|
72 |
</xsl:call-template>
|
franta-hg@54
|
73 |
</xsl:template>
|
franta-hg@54
|
74 |
|
franta-hg@53
|
75 |
<!--
|
franta-hg@53
|
76 |
Seznam.cz
|
franta-hg@53
|
77 |
*********
|
franta-hg@53
|
78 |
Vyhledávání pomocí Seznamu
|
franta-hg@54
|
79 |
@href náš dotaz
|
franta-hg@53
|
80 |
-->
|
franta-hg@53
|
81 |
<xsl:template match="m:a[@typ='seznam']">
|
franta-hg@53
|
82 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
83 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
84 |
concat(
|
franta-hg@54
|
85 |
'http://search.seznam.cz/?q=',
|
franta-hg@54
|
86 |
encode-for-uri(@href)
|
franta-hg@54
|
87 |
)"/>
|
franta-hg@53
|
88 |
</xsl:call-template>
|
franta-hg@53
|
89 |
</xsl:template>
|
franta-hg@53
|
90 |
|
franta-hg@53
|
91 |
<!--
|
franta-hg@53
|
92 |
Google.com
|
franta-hg@53
|
93 |
**********
|
franta-hg@53
|
94 |
Vyhledávání pomocí Googlu
|
franta-hg@54
|
95 |
@href náš dotaz
|
franta-hg@53
|
96 |
-->
|
franta-hg@53
|
97 |
<xsl:template match="m:a[@typ='google']">
|
franta-hg@53
|
98 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
99 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
100 |
concat(
|
franta-hg@54
|
101 |
'https://encrypted.google.com/search?q=',
|
franta-hg@54
|
102 |
encode-for-uri(@href)
|
franta-hg@54
|
103 |
)"/>
|
franta-hg@53
|
104 |
</xsl:call-template>
|
franta-hg@53
|
105 |
</xsl:template>
|
franta-hg@53
|
106 |
|
franta-hg@53
|
107 |
<!--
|
franta-hg@53
|
108 |
Request for comments
|
franta-hg@53
|
109 |
********************
|
franta-hg@53
|
110 |
Internetové standardy – RFC
|
franta-hg@54
|
111 |
@href číslo RFCčka
|
franta-hg@53
|
112 |
-->
|
franta-hg@53
|
113 |
<xsl:template match="m:a[@typ='rfc']">
|
franta-hg@53
|
114 |
<xsl:call-template name="vložOdkaz">
|
franta-hg@54
|
115 |
<xsl:with-param name="url" select="
|
franta-hg@54
|
116 |
concat(
|
franta-hg@54
|
117 |
'https://tools.ietf.org/html/rfc',
|
franta-hg@54
|
118 |
@href
|
franta-hg@54
|
119 |
)"/>
|
franta-hg@53
|
120 |
</xsl:call-template>
|
franta-hg@53
|
121 |
</xsl:template>
|
franta-hg@53
|
122 |
|
franta-hg@53
|
123 |
|
franta-hg@53
|
124 |
<xsl:template name="vložOdkaz">
|
franta-hg@53
|
125 |
<xsl:param name="url"/>
|
franta-hg@53
|
126 |
<a>
|
franta-hg@53
|
127 |
<xsl:copy-of select="@*"/>
|
franta-hg@53
|
128 |
<xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
|
franta-hg@53
|
129 |
<xsl:apply-templates/>
|
franta-hg@54
|
130 |
</a>
|
franta-hg@53
|
131 |
</xsl:template>
|
franta-hg@53
|
132 |
|
franta-hg@51
|
133 |
</xsl:stylesheet>
|