root/šablona/stránka-společné.xsl @ 51:df1f942f7b69

Revision 51:df1f942f7b69, 2.2 KB (checked in by František Kučera <franta-hg@…>, 12 years ago)

Přesun maker do samostatných souborů #8 + automatické generování seznamu maker
→ nová makra není potřeba nikde registrovat, prostě vytvoříme nový soubor v adresáři

šablona/makra nebo
vstup/makra

a spustíme „ant makra“ – vygenruje se „šablona/.makra-seznam.xsl“ který se vloží do šablony stránky.

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="2.0"
3        xmlns="http://www.w3.org/1999/xhtml"
4        xmlns:h="http://www.w3.org/1999/xhtml"
5        xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
6        xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace"
7        xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
8        xmlns:j="java:cz.frantovo.xmlWebGenerator.Funkce"
9        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10        xmlns:fn="http://www.w3.org/2005/xpath-functions"
11        xmlns:svg="http://www.w3.org/2000/svg"
12        xmlns:xs="http://www.w3.org/2001/XMLSchema"
13        exclude-result-prefixes="fn h s k m j xs">
14       
15        <xsl:param name="vstup" select="'../vstup/'"/>
16        <xsl:param name="výstup" select="'../výstup/'"/>
17        <xsl:param name="vstupníPřípona" select="'.xml'"/>
18        <xsl:param name="výstupníPřípona" select="'.xhtml'"/>
19        <xsl:param name="vsuvkováPřípona" select="'.inc'"/>
20        <xsl:param name="podporaZaostalýchProhlížečů" select="false()" as="xs:boolean"/>
21
22        <xsl:variable name="konfigurace" select="document(concat($vstup, 'web.conf'))"/>
23       
24        <xsl:include href=".makra-seznam.xsl"/>
25       
26       
27        <!-- Kopírujeme elementy, ale vynecháme nepoužité xmlns deklarace: -->
28        <xsl:template match="*">
29                <xsl:element name="{name()}">
30                        <xsl:copy-of select="@*"/>
31                        <xsl:apply-templates/>
32                </xsl:element>
33    </xsl:template>
34   
35    <!-- Varování pro případ, že jsme v režimu podpory pro zaostalé prohlížeče -->
36    <xsl:template name="varováníRetardace">
37        <xsl:if test="$podporaZaostalýchProhlížečů">
38                        <xsl:comment>
39                                Generátor byl spuštěn v režimu podpory zaostalých prohlížečů.
40                                Uživatelům doporučujeme upgrade na skutečný WWW prohlížeč,
41                                jako je např. Firefox nebo Chromium (případně Opera či Safari).
42                        </xsl:comment>
43        </xsl:if>
44    </xsl:template>
45
46    <!-- Odkazy na JavaScript a kaskádové styly -->   
47    <xsl:template match="k:web/k:js">           
48        <script src="{text()}" type="text/javascript">
49                <xsl:call-template name="varováníRetardace"/>
50        </script>
51    </xsl:template>
52    <xsl:template match="k:web/k:css">
53        <link href="{text()}" type="text/css" rel="StyleSheet" />
54    </xsl:template>
55   
56</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.