root/šablona/stránka.xsl @ 4:1bb39595a51c

Revision 4:1bb39595a51c, 1.8 KB (checked in by František Kučera <franta-hg@…>, 13 years ago)

genrování hlavní nabídky #1
Stránky, které mají být v nabídce, musí obsahovat značku <pořadí>123</pořadí>,
podle které se pak položky řadí.

RevLine 
[1]1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="2.0"
3        xmlns="http://www.w3.org/1999/xhtml"
[2]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        exclude-result-prefixes="fn h g">
9        <xsl:output 
10                method="xml" 
11                indent="yes" 
12                encoding="UTF-8"               
13                doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" 
14                doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>
[1]15       
16        <xsl:template match="/">
17                <html>
18                        <head>
[2]19                                <title><xsl:value-of select="g:stránka/g:nadpis"/></title>                             
[1]20                        </head>
21                        <body>
[3]22                                <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/záhlaví.inc'))/g:stránka/h:text/node()"/>                     
23                                <h1><xsl:value-of select="g:stránka/g:nadpis"/></h1>
[2]24                                <xsl:apply-templates select="g:stránka/h:text/node()"/>
[4]25                                <ul id="nabídka">
26                                        <xsl:for-each select="collection('../vstup/?select=*.xml')[g:stránka/g:pořadí]">
27                                                <xsl:sort select="empty(./g:stránka/g:pořadí)"/>
28                                                <xsl:sort select="./g:stránka/g:pořadí"/>
29                                                <li>
30                                                        <xsl:variable name="xmlSoubor" select="tokenize(document-uri(.), '/')[last()]"/>
31                                                        <xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, '.xml', '.xhtml')"/>
32                                                        <a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./g:stránka/g:nadpis"/></a>
33                                                </li>
34                                        </xsl:for-each>
35                                </ul>
[3]36                                <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/zápatí.inc'))/g:stránka/h:text/node()"/>                             
[1]37                        </body>
38                </html>
39        </xsl:template>
40       
41        <xsl:template match="node()|@*">
[2]42                <xsl:copy>
43                        <xsl:apply-templates select="node()|@*"/>
44                </xsl:copy>
45        </xsl:template>
[1]46
47</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.