Changeset 66:a8085dedd92b

Show
Ignore:
Timestamp:
01/07/12 17:34:57 (12 years ago)
Author:
František Kučera <franta-hg@…>
Branch:
default
Message:

Odkazy #16: oprava chyby: Zachováme pouze povolené atributy.

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • vstup/zdrojáky.xml

    r59 r66  
    5353</xmlDokument>]]></m:pre> 
    5454 
     55                <p>Další ukázka XML: <m:a href="šablona/makra/tabulka.xsl" typ="zdroják" řádek="25">tabulka.xsl</m:a>.</p> 
     56 
    5557                <h2>BASH</h2> 
    5658                 
  • šablona/makra/odkazy.xsl

    r63 r66  
    2020        xmlns="http://www.w3.org/1999/xhtml" 
    2121        xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro" 
     22        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    2223        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    23         exclude-result-prefixes="m"> 
     24        exclude-result-prefixes="m xs"> 
    2425 
    2526        <!-- 
     
    4142        </xsl:template> 
    4243 
     44        <xsl:variable name="tracURL" select="'https://trac.frantovo.cz/xml-web-generator'"/>     
     45 
    4346        <!-- 
    4447                Trac – wiki 
     
    5255                        <xsl:with-param name="url" select=" 
    5356                                concat( 
    54                                         'https://trac.frantovo.cz/xml-web-generator/wiki/',  
    55                                         replace(encode-for-uri(@href), '%2F', '/') 
     57                                        $tracURL, '/wiki/',  
     58                                        m:escapuj-url-zachovej-lomítka(@href) 
    5659                                )"/> 
    5760                </xsl:call-template>             
    5861        </xsl:template> 
    59          
     62 
    6063        <!-- 
    6164                Trac – úkoly 
     
    6972                        <xsl:with-param name="url" select=" 
    7073                                concat( 
    71                                         'https://trac.frantovo.cz/xml-web-generator/ticket/',  
     74                                        $tracURL, '/ticket/',  
    7275                                        @href 
    7376                                )"/> 
    7477                </xsl:call-template> 
    7578        </xsl:template> 
     79 
     80        <!-- 
     81                Zdroják 
     82                ******* 
     83                Odkazy zdrojový kód našeho generátoru. 
     84                * 
     85                @href název souboru 
     86                @řádek číslo řádku (volitelně) 
     87        --> 
     88        <xsl:template match="m:a[@typ='zdroják' and (not(@řádek) or number(@řádek))]"> 
     89                <xsl:call-template name="vložOdkaz"> 
     90                        <xsl:with-param name="url" select=" 
     91                                concat( 
     92                                        $tracURL, '/browser/',  
     93                                        m:escapuj-url-zachovej-lomítka(@href), 
     94                                        '#L', 
     95                                        (@řádek,'1')[1] 
     96                                )"/> 
     97                </xsl:call-template> 
     98        </xsl:template> 
     99         
     100        <xsl:function name="m:escapuj-url-zachovej-lomítka" as="xs:string"> 
     101                <xsl:param name="cesta"/> 
     102                <xsl:value-of select="replace(encode-for-uri($cesta), '%2F', '/')"/> 
     103        </xsl:function> 
    76104 
    77105        <!-- 
     
    167195                <xsl:param name="url"/> 
    168196                <a> 
    169                         <xsl:copy-of select="@*"/> 
     197                        <!-- Zachováme pouze povolené atributy: --> 
     198                         
     199                        <xsl:copy-of select="@charset"/> 
     200                        <xsl:copy-of select="@coords"/> 
     201                        <xsl:copy-of select="@hreflang"/> 
     202                        <xsl:copy-of select="@name"/> 
     203                        <xsl:copy-of select="@rel"/> 
     204                        <xsl:copy-of select="@rev"/> 
     205                        <xsl:copy-of select="@shape"/> 
     206                        <xsl:copy-of select="@target"/> <!-- Pozor: nepatří do striktního XHTML --> 
     207                         
     208                        <xsl:copy-of select="@accesskey"/> 
     209                        <xsl:copy-of select="@class"/> 
     210                        <xsl:copy-of select="@dir"/> 
     211                        <xsl:copy-of select="@id"/> 
     212                        <xsl:copy-of select="@lang"/> 
     213                        <xsl:copy-of select="@style"/> 
     214                        <xsl:copy-of select="@tabindex"/> 
     215                        <xsl:copy-of select="@title"/> 
     216                        <xsl:copy-of select="@xml:lang"/> 
     217                         
     218                        <xsl:copy-of select="@onblur"/> 
     219                        <xsl:copy-of select="@onclick"/> 
     220                        <xsl:copy-of select="@ondblclick"/> 
     221                        <xsl:copy-of select="@onfocus"/> 
     222                        <xsl:copy-of select="@onmousedown"/> 
     223                        <xsl:copy-of select="@onmousemove"/> 
     224                        <xsl:copy-of select="@onmouseout"/> 
     225                        <xsl:copy-of select="@onmouseover"/> 
     226                        <xsl:copy-of select="@onmouseup"/> 
     227                        <xsl:copy-of select="@onkeydown"/> 
     228                        <xsl:copy-of select="@onkeypress"/> 
     229                        <xsl:copy-of select="@onkeyup"/> 
     230                         
    170231                        <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute> 
    171232                        <xsl:apply-templates/>