root/šablona/makra/odkazy.xsl @ 56:24e50902b58e

Revision 56:24e50902b58e, 3.2 KB (checked in by František Kučera <franta-hg@…>, 12 years ago)

Odkazy – jen dokumentační komentáře.

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