# HG changeset patch # User František Kučera <franta-hg@frantovo.cz> # Date 1325954097 -3600 # Node ID a8085dedd92beb914a15d8374eb34c2fa51300c6 # Parent 0b00c324e64472d761d098c1a52bfb4286e67f1b Odkazy #16: oprava chyby: Zachováme pouze povolené atributy. diff -r 0b00c324e644 -r a8085dedd92b vstup/zdrojáky.xml --- a/vstup/zdrojáky.xml Sat Jan 07 17:34:33 2012 +0100 +++ b/vstup/zdrojáky.xml Sat Jan 07 17:34:57 2012 +0100 @@ -52,6 +52,8 @@ <element1>toto je <strong>pěkné</strong> XML!!!</element1> </xmlDokument>]]></m:pre> + <p>Další ukázka XML: <m:a href="šablona/makra/tabulka.xsl" typ="zdroják" řádek="25">tabulka.xsl</m:a>.</p> + <h2>BASH</h2> <m:pre jazyk="bash" src="matrixový-spořič.sh" odkaz="ano"/> diff -r 0b00c324e644 -r a8085dedd92b šablona/makra/odkazy.xsl --- a/šablona/makra/odkazy.xsl Sat Jan 07 17:34:33 2012 +0100 +++ b/šablona/makra/odkazy.xsl Sat Jan 07 17:34:57 2012 +0100 @@ -19,8 +19,9 @@ <xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro" + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - exclude-result-prefixes="m"> + exclude-result-prefixes="m xs"> <!-- Interní odkazy @@ -40,6 +41,8 @@ </a> </xsl:template> + <xsl:variable name="tracURL" select="'https://trac.frantovo.cz/xml-web-generator'"/> + <!-- Trac – wiki *********** @@ -51,12 +54,12 @@ <xsl:call-template name="vložOdkaz"> <xsl:with-param name="url" select=" concat( - 'https://trac.frantovo.cz/xml-web-generator/wiki/', - replace(encode-for-uri(@href), '%2F', '/') + $tracURL, '/wiki/', + m:escapuj-url-zachovej-lomítka(@href) )"/> </xsl:call-template> </xsl:template> - + <!-- Trac – úkoly ************ @@ -68,13 +71,38 @@ <xsl:call-template name="vložOdkaz"> <xsl:with-param name="url" select=" concat( - 'https://trac.frantovo.cz/xml-web-generator/ticket/', + $tracURL, '/ticket/', @href )"/> </xsl:call-template> </xsl:template> <!-- + Zdroják + ******* + Odkazy zdrojový kód našeho generátoru. + * + @href název souboru + @řádek číslo řádku (volitelně) + --> + <xsl:template match="m:a[@typ='zdroják' and (not(@řádek) or number(@řádek))]"> + <xsl:call-template name="vložOdkaz"> + <xsl:with-param name="url" select=" + concat( + $tracURL, '/browser/', + m:escapuj-url-zachovej-lomítka(@href), + '#L', + (@řádek,'1')[1] + )"/> + </xsl:call-template> + </xsl:template> + + <xsl:function name="m:escapuj-url-zachovej-lomítka" as="xs:string"> + <xsl:param name="cesta"/> + <xsl:value-of select="replace(encode-for-uri($cesta), '%2F', '/')"/> + </xsl:function> + + <!-- Wikipedia ********* Stránka v encyklopedii. @@ -166,7 +194,40 @@ <xsl:template name="vložOdkaz"> <xsl:param name="url"/> <a> - <xsl:copy-of select="@*"/> + <!-- Zachováme pouze povolené atributy: --> + + <xsl:copy-of select="@charset"/> + <xsl:copy-of select="@coords"/> + <xsl:copy-of select="@hreflang"/> + <xsl:copy-of select="@name"/> + <xsl:copy-of select="@rel"/> + <xsl:copy-of select="@rev"/> + <xsl:copy-of select="@shape"/> + <xsl:copy-of select="@target"/> <!-- Pozor: nepatří do striktního XHTML --> + + <xsl:copy-of select="@accesskey"/> + <xsl:copy-of select="@class"/> + <xsl:copy-of select="@dir"/> + <xsl:copy-of select="@id"/> + <xsl:copy-of select="@lang"/> + <xsl:copy-of select="@style"/> + <xsl:copy-of select="@tabindex"/> + <xsl:copy-of select="@title"/> + <xsl:copy-of select="@xml:lang"/> + + <xsl:copy-of select="@onblur"/> + <xsl:copy-of select="@onclick"/> + <xsl:copy-of select="@ondblclick"/> + <xsl:copy-of select="@onfocus"/> + <xsl:copy-of select="@onmousedown"/> + <xsl:copy-of select="@onmousemove"/> + <xsl:copy-of select="@onmouseout"/> + <xsl:copy-of select="@onmouseover"/> + <xsl:copy-of select="@onmouseup"/> + <xsl:copy-of select="@onkeydown"/> + <xsl:copy-of select="@onkeypress"/> + <xsl:copy-of select="@onkeyup"/> + <xsl:attribute name="href"><xsl:value-of select="$url"/></xsl:attribute> <xsl:apply-templates/> </a>