| 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"> |
|---|
| 7 | |
|---|
| 8 | <!-- |
|---|
| 9 | Interní odkazy |
|---|
| 10 | ************** |
|---|
| 11 | Slouží k vkládání odkazů na jiné stránky v rámci webu. |
|---|
| 12 | * |
|---|
| 13 | @href zadáváme jen název souboru bez přípony – s nezakódovanou češtinou a s mezerami |
|---|
| 14 | @typ nevyplňujeme |
|---|
| 15 | --> |
|---|
| 16 | <xsl:template match="m:a[not(@typ)]"> |
|---|
| 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 | * |
|---|
| 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. |
|---|
| 47 | * |
|---|
| 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 | |
|---|
| 60 | <!-- |
|---|
| 61 | Wikipedia |
|---|
| 62 | ********* |
|---|
| 63 | Stránka v encyklopedii |
|---|
| 64 | * |
|---|
| 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 | |
|---|
| 78 | <!-- |
|---|
| 79 | Seznam.cz |
|---|
| 80 | ********* |
|---|
| 81 | Vyhledávání pomocí Seznamu |
|---|
| 82 | * |
|---|
| 83 | @href náš dotaz |
|---|
| 84 | --> |
|---|
| 85 | <xsl:template match="m:a[@typ='seznam']"> |
|---|
| 86 | <xsl:call-template name="vložOdkaz"> |
|---|
| 87 | <xsl:with-param name="url" select=" |
|---|
| 88 | concat( |
|---|
| 89 | 'http://search.seznam.cz/?q=', |
|---|
| 90 | encode-for-uri(@href) |
|---|
| 91 | )"/> |
|---|
| 92 | </xsl:call-template> |
|---|
| 93 | </xsl:template> |
|---|
| 94 | |
|---|
| 95 | <!-- |
|---|
| 96 | Google.com |
|---|
| 97 | ********** |
|---|
| 98 | Vyhledávání pomocí Googlu |
|---|
| 99 | * |
|---|
| 100 | @href náš dotaz |
|---|
| 101 | --> |
|---|
| 102 | <xsl:template match="m:a[@typ='google']"> |
|---|
| 103 | <xsl:call-template name="vložOdkaz"> |
|---|
| 104 | <xsl:with-param name="url" select=" |
|---|
| 105 | concat( |
|---|
| 106 | 'https://encrypted.google.com/search?q=', |
|---|
| 107 | encode-for-uri(@href) |
|---|
| 108 | )"/> |
|---|
| 109 | </xsl:call-template> |
|---|
| 110 | </xsl:template> |
|---|
| 111 | |
|---|
| 112 | <!-- |
|---|
| 113 | Request for comments |
|---|
| 114 | ******************** |
|---|
| 115 | Internetové standardy – RFC |
|---|
| 116 | * |
|---|
| 117 | @href číslo RFCčka |
|---|
| 118 | --> |
|---|
| 119 | <xsl:template match="m:a[@typ='rfc' and number(@href)]"> |
|---|
| 120 | <xsl:call-template name="vložOdkaz"> |
|---|
| 121 | <xsl:with-param name="url" select=" |
|---|
| 122 | concat( |
|---|
| 123 | 'https://tools.ietf.org/html/rfc', |
|---|
| 124 | @href |
|---|
| 125 | )"/> |
|---|
| 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/> |
|---|
| 136 | </a> |
|---|
| 137 | </xsl:template> |
|---|
| 138 | |
|---|
| 139 | </xsl:stylesheet> |
|---|