šablona/makra/odkazy.xsl
changeset 66 a8085dedd92b
parent 63 75ee09ccc0ec
child 71 895757141bff
     1.1 --- a/šablona/makra/odkazy.xsl	Sat Jan 07 15:29:47 2012 +0100
     1.2 +++ b/šablona/makra/odkazy.xsl	Sat Jan 07 17:34:57 2012 +0100
     1.3 @@ -19,8 +19,9 @@
     1.4  <xsl:stylesheet version="2.0"
     1.5  	xmlns="http://www.w3.org/1999/xhtml"
     1.6  	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
     1.7 +	xmlns:xs="http://www.w3.org/2001/XMLSchema"
     1.8  	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     1.9 -	exclude-result-prefixes="m">
    1.10 +	exclude-result-prefixes="m xs">
    1.11  
    1.12  	<!--
    1.13  		Interní odkazy
    1.14 @@ -40,6 +41,8 @@
    1.15  		</a>
    1.16  	</xsl:template>
    1.17  
    1.18 +	<xsl:variable name="tracURL" select="'https://trac.frantovo.cz/xml-web-generator'"/>	
    1.19 +
    1.20  	<!--
    1.21  		Trac – wiki
    1.22  		***********
    1.23 @@ -51,12 +54,12 @@
    1.24  		<xsl:call-template name="vložOdkaz">
    1.25  			<xsl:with-param name="url" select="
    1.26  				concat(
    1.27 -					'https://trac.frantovo.cz/xml-web-generator/wiki/', 
    1.28 -					replace(encode-for-uri(@href), '%2F', '/')
    1.29 +					$tracURL, '/wiki/', 
    1.30 +					m:escapuj-url-zachovej-lomítka(@href)
    1.31  				)"/>
    1.32  		</xsl:call-template>		
    1.33  	</xsl:template>
    1.34 -	
    1.35 +
    1.36  	<!--
    1.37  		Trac – úkoly
    1.38  		************
    1.39 @@ -68,13 +71,38 @@
    1.40  		<xsl:call-template name="vložOdkaz">
    1.41  			<xsl:with-param name="url" select="
    1.42  				concat(
    1.43 -					'https://trac.frantovo.cz/xml-web-generator/ticket/', 
    1.44 +					$tracURL, '/ticket/', 
    1.45  					@href
    1.46  				)"/>
    1.47  		</xsl:call-template>
    1.48  	</xsl:template>
    1.49  
    1.50  	<!--
    1.51 +		Zdroják
    1.52 +		*******
    1.53 +		Odkazy zdrojový kód našeho generátoru.
    1.54 +		*
    1.55 +		@href název souboru
    1.56 +		@řádek číslo řádku (volitelně)
    1.57 +	-->
    1.58 +	<xsl:template match="m:a[@typ='zdroják' and (not(@řádek) or number(@řádek))]">
    1.59 +		<xsl:call-template name="vložOdkaz">
    1.60 +			<xsl:with-param name="url" select="
    1.61 +				concat(
    1.62 +					$tracURL, '/browser/', 
    1.63 +					m:escapuj-url-zachovej-lomítka(@href),
    1.64 +					'#L',
    1.65 +					(@řádek,'1')[1]
    1.66 +				)"/>
    1.67 +		</xsl:call-template>
    1.68 +	</xsl:template>
    1.69 +	
    1.70 +	<xsl:function name="m:escapuj-url-zachovej-lomítka" as="xs:string">
    1.71 +		<xsl:param name="cesta"/>
    1.72 +		<xsl:value-of select="replace(encode-for-uri($cesta), '%2F', '/')"/>
    1.73 +	</xsl:function>
    1.74 +
    1.75 +	<!--
    1.76  		Wikipedia
    1.77  		*********
    1.78  		Stránka v encyklopedii.
    1.79 @@ -166,7 +194,40 @@
    1.80  	<xsl:template name="vložOdkaz">
    1.81  		<xsl:param name="url"/>
    1.82  		<a>
    1.83 -			<xsl:copy-of select="@*"/>
    1.84 +			<!-- Zachováme pouze povolené atributy: -->
    1.85 +			
    1.86 +			<xsl:copy-of select="@charset"/>
    1.87 +			<xsl:copy-of select="@coords"/>
    1.88 +			<xsl:copy-of select="@hreflang"/>
    1.89 +			<xsl:copy-of select="@name"/>
    1.90 +			<xsl:copy-of select="@rel"/>
    1.91 +			<xsl:copy-of select="@rev"/>
    1.92 +			<xsl:copy-of select="@shape"/>
    1.93 +			<xsl:copy-of select="@target"/> <!-- Pozor: nepatří do striktního XHTML -->
    1.94 +			
    1.95 +			<xsl:copy-of select="@accesskey"/>
    1.96 +			<xsl:copy-of select="@class"/>
    1.97 +			<xsl:copy-of select="@dir"/>
    1.98 +			<xsl:copy-of select="@id"/>
    1.99 +			<xsl:copy-of select="@lang"/>
   1.100 +			<xsl:copy-of select="@style"/>
   1.101 +			<xsl:copy-of select="@tabindex"/>
   1.102 +			<xsl:copy-of select="@title"/>
   1.103 +			<xsl:copy-of select="@xml:lang"/>
   1.104 +			
   1.105 +			<xsl:copy-of select="@onblur"/>
   1.106 +			<xsl:copy-of select="@onclick"/>
   1.107 +			<xsl:copy-of select="@ondblclick"/>
   1.108 +			<xsl:copy-of select="@onfocus"/>
   1.109 +			<xsl:copy-of select="@onmousedown"/>
   1.110 +			<xsl:copy-of select="@onmousemove"/>
   1.111 +			<xsl:copy-of select="@onmouseout"/>
   1.112 +			<xsl:copy-of select="@onmouseover"/>
   1.113 +			<xsl:copy-of select="@onmouseup"/>
   1.114 +			<xsl:copy-of select="@onkeydown"/>
   1.115 +			<xsl:copy-of select="@onkeypress"/>
   1.116 +			<xsl:copy-of select="@onkeyup"/>
   1.117 +			
   1.118  			<xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute>
   1.119  			<xsl:apply-templates/>
   1.120  		</a>