šablona/makra/šifra.xsl
changeset 84 f866267d7b3c
child 88 e856711b66e9
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/šablona/makra/šifra.xsl	Wed Jan 11 17:01:59 2012 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!--
     1.6 +XML Web generátor – program na generování webových stránek
     1.7 +Copyright © 2012 František Kučera (frantovo.cz)
     1.8 +
     1.9 +This program is free software: you can redistribute it and/or modify
    1.10 +it under the terms of the GNU General Public License as published by
    1.11 +the Free Software Foundation, either version 3 of the License, or
    1.12 +(at your option) any later version.
    1.13 +
    1.14 +This program is distributed in the hope that it will be useful,
    1.15 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.17 +GNU General Public License for more details.
    1.18 +
    1.19 +You should have received a copy of the GNU General Public License
    1.20 +along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.21 +-->
    1.22 +<xsl:stylesheet version="2.0"
    1.23 +	xmlns="http://www.w3.org/1999/xhtml"
    1.24 +	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
    1.25 +	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    1.26 +	xmlns:xs="http://www.w3.org/2001/XMLSchema"
    1.27 +	exclude-result-prefixes="m xs">
    1.28 +
    1.29 +	<!--
    1.30 +		Šifrování (Rot13)
    1.31 +		*****************
    1.32 +		Umožňuje vkládat „zašifrované“ části textu.
    1.33 +		Použijeme např. pro text, který vyzrazuje, jak skončí film.
    1.34 +		Pro zobrazení v čitelném tvaru je potřeba kliknout na tlačítko a text „dešifrovat“,
    1.35 +		takže si ho nepřečteme omylem, aniž bychom chtěli.
    1.36 +		*
    1.37 +		@algoritmus zatím je výchozím a jediným algoritmem Rot13
    1.38 +	-->
    1.39 +	<xsl:template match="m:šifra">
    1.40 +		<xsl:variable name="šifra-id">šifra-<xsl:number level="any"/></xsl:variable>
    1.41 +		<span class="rot13" title="Tento text je „zašifrován“ algoritmem Rot13, abyste si ho omylem nepřečetli. Pokud číst chcete, klikněte na tlačítko…">
    1.42 +			<span id="{$šifra-id}"><xsl:value-of select="m:rot13(text())"/></span>
    1.43 +			<a onclick="javascipt:xwg.rot13('{$šifra-id}'); return false;" href="#{encode-for-uri(' &gt;&gt; zobrazí „zašifrovaný“ text &lt;&lt;')}">↹</a>
    1.44 +		</span>
    1.45 +	</xsl:template>
    1.46 +
    1.47 +	<xsl:function name="m:rot13" as="xs:string">
    1.48 +		<xsl:param name="vstup"/>
    1.49 +		<xsl:value-of select="translate($vstup, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM')"/>
    1.50 +	</xsl:function>
    1.51 +
    1.52 +</xsl:stylesheet>
    1.53 +