1 <?xml version="1.0" encoding="UTF-8"?> |
1 <?xml version="1.0" encoding="UTF-8"?> |
2 <xsl:stylesheet version="2.0" |
2 <xsl:stylesheet version="2.0" |
3 xmlns="http://www.w3.org/1999/xhtml" |
3 xmlns="http://www.w3.org/1999/xhtml" |
4 xmlns:h="http://www.w3.org/1999/xhtml" |
4 xmlns:h="http://www.w3.org/1999/xhtml" |
5 xmlns:g="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/prostor" |
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" |
6 xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro" |
7 xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro" |
7 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
8 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
8 xmlns:fn="http://www.w3.org/2005/xpath-functions" |
9 xmlns:fn="http://www.w3.org/2005/xpath-functions" |
9 xmlns:svg="http://www.w3.org/2000/svg" |
10 xmlns:svg="http://www.w3.org/2000/svg" |
10 xmlns:xs="http://www.w3.org/2001/XMLSchema" |
11 xmlns:xs="http://www.w3.org/2001/XMLSchema" |
11 exclude-result-prefixes="fn h g xs m"> |
12 exclude-result-prefixes="fn h s k xs m"> |
12 <xsl:output |
13 <xsl:output |
13 method="xml" |
14 method="xml" |
14 indent="yes" |
15 indent="yes" |
15 encoding="UTF-8" |
16 encoding="UTF-8" |
16 doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" |
17 doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" |
29 <html> |
30 <html> |
30 <head> |
31 <head> |
31 <xsl:if test="$podporaZaostalýchProhlížečů"> |
32 <xsl:if test="$podporaZaostalýchProhlížečů"> |
32 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> |
33 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> |
33 </xsl:if> |
34 </xsl:if> |
34 <title><xsl:value-of select="g:stránka/g:nadpis"/></title> |
35 <title><xsl:value-of select="s:stránka/s:nadpis"/></title> |
35 <link title="Novinky (Atom)" href="atom.xml" type="application/atom+xml" rel="alternate"/> |
36 <link title="Novinky (Atom)" href="atom.xml" type="application/atom+xml" rel="alternate"/> |
36 <link title="Novinky (RSS)" href="rss.xml" type="application/rss+xml" rel="alternate"/> |
37 <link title="Novinky (RSS)" href="rss.xml" type="application/rss+xml" rel="alternate"/> |
37 <xsl:apply-templates select="$konfigurace/g:web/g:js"/> |
38 <xsl:apply-templates select="$konfigurace/k:web/k:js"/> |
38 <xsl:apply-templates select="$konfigurace/g:web/g:css"/> |
39 <xsl:apply-templates select="$konfigurace/k:web/k:css"/> |
39 </head> |
40 </head> |
40 <body> |
41 <body> |
41 <div id="tělo"> |
42 <div id="tělo"> |
42 <div id="záhlaví"> |
43 <div id="záhlaví"> |
43 <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'záhlaví', $vsuvkováPřípona)))/g:stránka/h:text/node()"/> |
44 <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'záhlaví', $vsuvkováPřípona)))/s:stránka/h:text/node()"/> |
44 </div> |
45 </div> |
45 <div id="vnitřek"> |
46 <div id="vnitřek"> |
46 <h1><xsl:value-of select="g:stránka/g:nadpis"/></h1> |
47 <h1><xsl:value-of select="s:stránka/s:nadpis"/></h1> |
47 <ul id="nabídka"> |
48 <ul id="nabídka"> |
48 <xsl:for-each select="collection(concat('../vstup/?select=*', $vstupníPřípona))[g:stránka/g:pořadí]"> |
49 <xsl:for-each select="collection(concat('../vstup/?select=*', $vstupníPřípona))[s:stránka/s:pořadí]"> |
49 <xsl:sort select="empty(./g:stránka/g:pořadí)"/> |
50 <xsl:sort select="empty(./s:stránka/s:pořadí)"/> |
50 <xsl:sort select="./g:stránka/g:pořadí"/> |
51 <xsl:sort select="./s:stránka/s:pořadí"/> |
51 <li> |
52 <li> |
52 <xsl:variable name="xmlSoubor" select="tokenize(document-uri(.), '/')[last()]"/> |
53 <xsl:variable name="xmlSoubor" select="tokenize(document-uri(.), '/')[last()]"/> |
53 <xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, $vstupníPřípona, $výstupníPřípona)"/> |
54 <xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, $vstupníPřípona, $výstupníPřípona)"/> |
54 <a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./g:stránka/g:nadpis"/></a> |
55 <a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./s:stránka/s:nadpis"/></a> |
55 </li> |
56 </li> |
56 </xsl:for-each> |
57 </xsl:for-each> |
57 </ul> |
58 </ul> |
58 <div id="text"> |
59 <div id="text"> |
59 <xsl:apply-templates select="g:stránka/h:text/node()"/> |
60 <xsl:apply-templates select="s:stránka/h:text/node()"/> |
60 </div> |
61 </div> |
61 </div> |
62 </div> |
62 <div id="zápatí"> |
63 <div id="zápatí"> |
63 <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'zápatí', $vsuvkováPřípona)))/g:stránka/h:text/node()"/> |
64 <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'zápatí', $vsuvkováPřípona)))/s:stránka/h:text/node()"/> |
64 </div> |
65 </div> |
65 </div> |
66 </div> |
66 </body> |
67 </body> |
67 </html> |
68 </html> |
68 </xsl:template> |
69 </xsl:template> |
73 <xsl:copy-of select="@*"/> |
74 <xsl:copy-of select="@*"/> |
74 <xsl:apply-templates/> |
75 <xsl:apply-templates/> |
75 </xsl:element> |
76 </xsl:element> |
76 </xsl:template> |
77 </xsl:template> |
77 |
78 |
78 <!-- Odkazy na JavaScript a kaskádové styly --> |
79 <!-- Varování pro případ, že jsme v režimu podpory pro zaostalé prohlížeče --> |
79 <xsl:template name="varováníRetardace"> |
80 <xsl:template name="varováníRetardace"> |
80 <xsl:if test="$podporaZaostalýchProhlížečů"> |
81 <xsl:if test="$podporaZaostalýchProhlížečů"> |
81 <xsl:comment> |
82 <xsl:comment> |
82 Generátor byl spuštěn v režimu podpory zaostalých prohlížečů. |
83 Generátor byl spuštěn v režimu podpory zaostalých prohlížečů. |
83 Uživatelům doporučujeme upgrade na skutečný WWW prohlížeč, |
84 Uživatelům doporučujeme upgrade na skutečný WWW prohlížeč, |
84 jako je např. Firefox nebo Chromium (případně Opera či Safari). |
85 jako je např. Firefox nebo Chromium (případně Opera či Safari). |
85 </xsl:comment> |
86 </xsl:comment> |
86 </xsl:if> |
87 </xsl:if> |
87 </xsl:template> |
88 </xsl:template> |
88 <xsl:template match="g:web/g:js"> |
89 |
|
90 <!-- Odkazy na JavaScript a kaskádové styly --> |
|
91 <xsl:template match="k:web/k:js"> |
89 <script src="{text()}" type="text/javascript"> |
92 <script src="{text()}" type="text/javascript"> |
90 <xsl:call-template name="varováníRetardace"/> |
93 <xsl:call-template name="varováníRetardace"/> |
91 </script> |
94 </script> |
92 </xsl:template> |
95 </xsl:template> |
93 <xsl:template match="g:web/g:css"> |
96 <xsl:template match="k:web/k:css"> |
94 <link href="{text()}" type="text/css" rel="StyleSheet" /> |
97 <link href="{text()}" type="text/css" rel="StyleSheet" /> |
95 </xsl:template> |
98 </xsl:template> |
96 |
99 |
97 <!-- |
100 <!-- |
98 Makro pro převod interních odkazů: |
101 Makro pro převod interních odkazů: |
108 <xsl:apply-templates/> |
111 <xsl:apply-templates/> |
109 </a> |
112 </a> |
110 </xsl:template> |
113 </xsl:template> |
111 |
114 |
112 <!-- Ukázka vlastního „makra“: --> |
115 <!-- Ukázka vlastního „makra“: --> |
113 <xsl:template match="g:měřák"> |
116 <xsl:template match="m:měřák"> |
114 <xsl:variable name="hodnota" select="number(@hodnota)"/> |
117 <xsl:variable name="hodnota" select="number(@hodnota)"/> |
115 <xsl:variable name="šířkaGrafu" select="128"/> |
118 <xsl:variable name="šířkaGrafu" select="128"/> |
116 <xsl:choose> |
119 <xsl:choose> |
117 <xsl:when test="$hodnota >= 0 and $hodnota <= 100"> |
120 <xsl:when test="$hodnota >= 0 and $hodnota <= 100"> |
118 <div style="border: 1px solid black; width: {$šířkaGrafu}px; height: 16px; padding: 0px; text-align: center; background-color: #cfc;"> |
121 <div style="border: 1px solid black; width: {$šířkaGrafu}px; height: 16px; padding: 0px; text-align: center; background-color: #cfc;"> |