1.1 --- a/šablona/makra/odkazy.xsl Fri Jan 06 21:58:52 2012 +0100
1.2 +++ b/šablona/makra/odkazy.xsl Sat Jan 07 00:14:27 2012 +0100
1.3 @@ -4,20 +4,98 @@
1.4 xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
1.5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1.6 exclude-result-prefixes="m">
1.7 -
1.8 - <!--
1.9 - Makro pro převod interních odkazů:
1.10 - - doplnění správné přípony
1.11 - - URL kódování znaků
1.12 - -->
1.13 - <xsl:template match="m:a">
1.14 - <a>
1.15 - <xsl:copy-of select="@*"/>
1.16 - <xsl:attribute name="href">
1.17 - <xsl:value-of select="encode-for-uri(concat(@href, $výstupníPřípona))"/>
1.18 - </xsl:attribute>
1.19 - <xsl:apply-templates/>
1.20 - </a>
1.21 - </xsl:template>
1.22 -
1.23 +
1.24 + <!--
1.25 + Odkazy
1.26 + ******
1.27 + Slouží hlavně k vkládání odkazů na jiné stránky v rámci webu.
1.28 + *
1.29 + @href zadáváme jen název souboru bez přípony – s nezakódovanou češtinou a s mezerami
1.30 + @typ jiné typy odkazů (výchozí jsou interní odkazy v rámci webu)
1.31 + -->
1.32 + <xsl:template match="m:a">
1.33 + <a>
1.34 + <xsl:copy-of select="@*"/>
1.35 + <xsl:attribute name="href">
1.36 + <xsl:value-of select="encode-for-uri(concat(@href, $výstupníPřípona))"/>
1.37 + </xsl:attribute>
1.38 + <xsl:apply-templates/>
1.39 + </a>
1.40 + </xsl:template>
1.41 +
1.42 + <!--
1.43 + Trac – wiki
1.44 + ***********
1.45 + Odkazy na Trac našeho generátoru.
1.46 + @href nečíselné parametry vedou do wiki
1.47 + -->
1.48 + <xsl:template match="m:a[@typ='trac' and not(number(@href))]">
1.49 + <xsl:call-template name="vložOdkaz">
1.50 + <xsl:with-param name="url" select="
1.51 + concat(
1.52 + 'https://trac.frantovo.cz/xml-web-generator/wiki/',
1.53 + replace(encode-for-uri(@href), '%2F', '/')
1.54 + )"/>
1.55 + </xsl:call-template>
1.56 + </xsl:template>
1.57 +
1.58 + <!--
1.59 + Trac – úkoly
1.60 + ************
1.61 + Odkazy na Trac našeho generátoru.
1.62 + @href číselné parametry vedou na úkoly
1.63 + -->
1.64 + <xsl:template match="m:a[@typ='trac' and number(@href)]">
1.65 + <xsl:call-template name="vložOdkaz">
1.66 + <xsl:with-param name="url" select="
1.67 + concat(
1.68 + 'https://trac.frantovo.cz/xml-web-generator/ticket/',
1.69 + @href
1.70 + )"/>
1.71 + </xsl:call-template>
1.72 + </xsl:template>
1.73 +
1.74 + <!--
1.75 + Seznam.cz
1.76 + *********
1.77 + Vyhledávání pomocí Seznamu
1.78 + -->
1.79 + <xsl:template match="m:a[@typ='seznam']">
1.80 + <xsl:call-template name="vložOdkaz">
1.81 + <xsl:with-param name="url" select="concat('http://search.seznam.cz/?q=', encode-for-uri(@href))"/>
1.82 + </xsl:call-template>
1.83 + </xsl:template>
1.84 +
1.85 + <!--
1.86 + Google.com
1.87 + **********
1.88 + Vyhledávání pomocí Googlu
1.89 + -->
1.90 + <xsl:template match="m:a[@typ='google']">
1.91 + <xsl:call-template name="vložOdkaz">
1.92 + <xsl:with-param name="url" select="concat('https://encrypted.google.com/search?q=', encode-for-uri(@href))"/>
1.93 + </xsl:call-template>
1.94 + </xsl:template>
1.95 +
1.96 + <!--
1.97 + Request for comments
1.98 + ********************
1.99 + Internetové standardy – RFC
1.100 + -->
1.101 + <xsl:template match="m:a[@typ='rfc']">
1.102 + <xsl:call-template name="vložOdkaz">
1.103 + <xsl:with-param name="url" select="concat('https://tools.ietf.org/html/rfc', @href)"/>
1.104 + </xsl:call-template>
1.105 + </xsl:template>
1.106 +
1.107 +
1.108 + <xsl:template name="vložOdkaz">
1.109 + <xsl:param name="url"/>
1.110 + <a>
1.111 + <xsl:copy-of select="@*"/>
1.112 + <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
1.113 + <xsl:apply-templates/>
1.114 + </a>
1.115 + </xsl:template>
1.116 +
1.117 </xsl:stylesheet>