šablona/makra/odkazy.xsl
changeset 54 15c66c9048f2
parent 53 7403128a8e0a
child 56 24e50902b58e
     1.1 --- a/šablona/makra/odkazy.xsl	Sat Jan 07 00:14:27 2012 +0100
     1.2 +++ b/šablona/makra/odkazy.xsl	Sat Jan 07 01:08:24 2012 +0100
     1.3 @@ -6,14 +6,14 @@
     1.4  	exclude-result-prefixes="m">
     1.5  
     1.6  	<!--
     1.7 -		Odkazy
     1.8 -		******
     1.9 -		Slouží hlavně k vkládání odkazů na jiné stránky v rámci webu.
    1.10 +		Interní odkazy
    1.11 +		**************
    1.12 +		Slouží k vkládání odkazů na jiné stránky v rámci webu.
    1.13  		*
    1.14  		@href zadáváme jen název souboru bez přípony – s nezakódovanou češtinou a s mezerami
    1.15 -		@typ jiné typy odkazů (výchozí jsou interní odkazy v rámci webu)
    1.16 +		@typ nevyplňujeme
    1.17  	-->
    1.18 -	<xsl:template match="m:a">
    1.19 +	<xsl:template match="m:a[not(@typ)]">
    1.20  		<a>
    1.21  			<xsl:copy-of select="@*"/>
    1.22  			<xsl:attribute name="href">
    1.23 @@ -55,14 +55,36 @@
    1.24  		</xsl:call-template>
    1.25  	</xsl:template>
    1.26  
    1.27 +	<!--
    1.28 +		Wikipedia
    1.29 +		************
    1.30 +		Stránka v encyklopedii 
    1.31 +		@href název stránky
    1.32 +		@jazyk kód jazyka (výchozí je čeština)
    1.33 +	-->
    1.34 +	<xsl:template match="m:a[@typ='wiki']">
    1.35 +		<xsl:call-template name="vložOdkaz">
    1.36 +			<xsl:with-param name="url" select="
    1.37 +				concat(
    1.38 +					'https://secure.wikimedia.org/wikipedia/', (@jazyk,'cs')[1], '/wiki/', 
    1.39 +					encode-for-uri(@href)
    1.40 +				)"/>
    1.41 +		</xsl:call-template>
    1.42 +	</xsl:template>
    1.43 +	
    1.44  	<!-- 
    1.45  		Seznam.cz
    1.46  		*********
    1.47  		Vyhledávání pomocí Seznamu
    1.48 +		@href náš dotaz
    1.49  	-->
    1.50  	<xsl:template match="m:a[@typ='seznam']">
    1.51  		<xsl:call-template name="vložOdkaz">
    1.52 -			<xsl:with-param name="url" select="concat('http://search.seznam.cz/?q=', encode-for-uri(@href))"/>
    1.53 +			<xsl:with-param name="url" select="
    1.54 +				concat(
    1.55 +					'http://search.seznam.cz/?q=', 
    1.56 +					encode-for-uri(@href)
    1.57 +				)"/>
    1.58  		</xsl:call-template>
    1.59  	</xsl:template>
    1.60  
    1.61 @@ -70,10 +92,15 @@
    1.62  		Google.com
    1.63  		**********
    1.64  		Vyhledávání pomocí Googlu
    1.65 +		@href náš dotaz
    1.66  	-->
    1.67  	<xsl:template match="m:a[@typ='google']">
    1.68  		<xsl:call-template name="vložOdkaz">
    1.69 -			<xsl:with-param name="url" select="concat('https://encrypted.google.com/search?q=', encode-for-uri(@href))"/>
    1.70 +			<xsl:with-param name="url" select="
    1.71 +				concat(
    1.72 +					'https://encrypted.google.com/search?q=', 
    1.73 +					encode-for-uri(@href)
    1.74 +				)"/>
    1.75  		</xsl:call-template>	
    1.76  	</xsl:template>
    1.77  	
    1.78 @@ -81,10 +108,15 @@
    1.79  		Request for comments
    1.80  		********************
    1.81  		Internetové standardy – RFC
    1.82 +		@href číslo RFCčka
    1.83  	-->
    1.84  	<xsl:template match="m:a[@typ='rfc']">
    1.85  		<xsl:call-template name="vložOdkaz">
    1.86 -			<xsl:with-param name="url" select="concat('https://tools.ietf.org/html/rfc', @href)"/>
    1.87 +			<xsl:with-param name="url" select="
    1.88 +				concat(
    1.89 +					'https://tools.ietf.org/html/rfc',
    1.90 +					@href
    1.91 +				)"/>
    1.92  		</xsl:call-template>
    1.93  	</xsl:template>
    1.94  	
    1.95 @@ -95,7 +127,7 @@
    1.96  			<xsl:copy-of select="@*"/>
    1.97  			<xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
    1.98  			<xsl:apply-templates/>
    1.99 -		</a>		
   1.100 +		</a>
   1.101  	</xsl:template>
   1.102  
   1.103  </xsl:stylesheet>