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