root/šablona/stránka.xsl @ 5:0a7c6c9357d3

Revision 5:0a7c6c9357d3, 1.9 KB (checked in by František Kučera <franta-hg@…>, 13 years ago)

Při kopírování elementů vynecháme nepoužité xmlns deklarace.

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:g="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/prostor"
6        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7        xmlns:fn="http://www.w3.org/2005/xpath-functions"
8        xmlns:svg="http://www.w3.org/2000/svg"
9        exclude-result-prefixes="fn h g">
10        <xsl:output 
11                method="xml" 
12                indent="yes" 
13                encoding="UTF-8"               
14                doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" 
15                doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>
16       
17        <!-- Celý dokument: -->
18        <xsl:template match="/">
19                <html>
20                        <head>
21                                <title><xsl:value-of select="g:stránka/g:nadpis"/></title>                             
22                        </head>
23                        <body>
24                                <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/záhlaví.inc'))/g:stránka/h:text/node()"/>                     
25                                <h1><xsl:value-of select="g:stránka/g:nadpis"/></h1>
26                                <xsl:apply-templates select="g:stránka/h:text/node()"/>
27                                <ul id="nabídka">
28                                        <xsl:for-each select="collection('../vstup/?select=*.xml')[g:stránka/g:pořadí]">
29                                                <xsl:sort select="empty(./g:stránka/g:pořadí)"/>
30                                                <xsl:sort select="./g:stránka/g:pořadí"/>
31                                                <li>
32                                                        <xsl:variable name="xmlSoubor" select="tokenize(document-uri(.), '/')[last()]"/>
33                                                        <xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, '.xml', '.xhtml')"/>
34                                                        <a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./g:stránka/g:nadpis"/></a>
35                                                </li>
36                                        </xsl:for-each>
37                                </ul>
38                                <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/zápatí.inc'))/g:stránka/h:text/node()"/>                             
39                        </body>
40                </html>
41        </xsl:template>
42       
43        <!-- Kopírujeme elementy, ale vynecháme nepoužité xmlns deklarace: -->
44        <xsl:template match="*">
45                <xsl:element name="{name()}">
46                        <xsl:copy-of select="@*"/>
47                        <xsl:apply-templates/>
48                </xsl:element>
49    </xsl:template>
50
51</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.