root/šablona/stránka.xsl @ 8:ad0ee12d13fd

Revision 8:ad0ee12d13fd, 2.1 KB (checked in by František Kučera <franta-hg@…>, 13 years ago)

RSS agregace, #2

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"
[5]8        xmlns:svg="http://www.w3.org/2000/svg"
[2]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"/>
[1]16       
[5]17        <!-- Celý dokument: -->
[1]18        <xsl:template match="/">
19                <html>
20                        <head>
[6]21                                <title><xsl:value-of select="g:stránka/g:nadpis"/></title>
[8]22                                <link title="Novinky (Atom)" href="atom.xml" type="application/atom+xml" rel="alternate"/>
23                                <link title="Novinky (RSS)"  href="rss.xml"  type="application/rss+xml"  rel="alternate"/>                             
[1]24                        </head>
25                        <body>
[3]26                                <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/záhlaví.inc'))/g:stránka/h:text/node()"/>                     
27                                <h1><xsl:value-of select="g:stránka/g:nadpis"/></h1>
[2]28                                <xsl:apply-templates select="g:stránka/h:text/node()"/>
[4]29                                <ul id="nabídka">
30                                        <xsl:for-each select="collection('../vstup/?select=*.xml')[g:stránka/g:pořadí]">
31                                                <xsl:sort select="empty(./g:stránka/g:pořadí)"/>
32                                                <xsl:sort select="./g:stránka/g:pořadí"/>
33                                                <li>
34                                                        <xsl:variable name="xmlSoubor" select="tokenize(document-uri(.), '/')[last()]"/>
35                                                        <xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, '.xml', '.xhtml')"/>
36                                                        <a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./g:stránka/g:nadpis"/></a>
37                                                </li>
38                                        </xsl:for-each>
39                                </ul>
[3]40                                <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/zápatí.inc'))/g:stránka/h:text/node()"/>                             
[1]41                        </body>
42                </html>
43        </xsl:template>
44       
[5]45        <!-- Kopírujeme elementy, ale vynecháme nepoužité xmlns deklarace: -->
46        <xsl:template match="*">
47                <xsl:element name="{name()}">
48                        <xsl:copy-of select="@*"/>
49                        <xsl:apply-templates/>
50                </xsl:element>
51    </xsl:template>
[1]52
53</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.