šablona/stránka.xsl
author František Kučera <franta-hg@frantovo.cz>
Sun Apr 03 17:44:58 2011 +0200 (2011-04-03)
changeset 8 ad0ee12d13fd
parent 6 801a8935caf7
child 10 4e70453a027f
permissions -rw-r--r--
RSS agregace, #2
franta-hg@1
     1
<?xml version="1.0" encoding="UTF-8"?>
franta-hg@1
     2
<xsl:stylesheet version="2.0"
franta-hg@1
     3
	xmlns="http://www.w3.org/1999/xhtml"
franta-hg@2
     4
	xmlns:h="http://www.w3.org/1999/xhtml"
franta-hg@2
     5
	xmlns:g="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/prostor"
franta-hg@2
     6
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
franta-hg@2
     7
	xmlns:fn="http://www.w3.org/2005/xpath-functions"
franta-hg@5
     8
	xmlns:svg="http://www.w3.org/2000/svg"
franta-hg@2
     9
	exclude-result-prefixes="fn h g">
franta-hg@2
    10
	<xsl:output 
franta-hg@2
    11
		method="xml" 
franta-hg@2
    12
		indent="yes" 
franta-hg@2
    13
		encoding="UTF-8"		
franta-hg@2
    14
		doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" 
franta-hg@2
    15
		doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>
franta-hg@1
    16
	
franta-hg@5
    17
	<!-- Celý dokument: -->
franta-hg@1
    18
	<xsl:template match="/">
franta-hg@1
    19
		<html>
franta-hg@1
    20
			<head>
franta-hg@6
    21
				<title><xsl:value-of select="g:stránka/g:nadpis"/></title>
franta-hg@8
    22
				<link title="Novinky (Atom)" href="atom.xml" type="application/atom+xml" rel="alternate"/>
franta-hg@8
    23
				<link title="Novinky (RSS)"  href="rss.xml"  type="application/rss+xml"  rel="alternate"/>				
franta-hg@1
    24
			</head>
franta-hg@1
    25
			<body>
franta-hg@3
    26
				<xsl:apply-templates select="document(fn:encode-for-uri('../vstup/záhlaví.inc'))/g:stránka/h:text/node()"/>			
franta-hg@3
    27
				<h1><xsl:value-of select="g:stránka/g:nadpis"/></h1>
franta-hg@2
    28
				<xsl:apply-templates select="g:stránka/h:text/node()"/>
franta-hg@4
    29
				<ul id="nabídka">
franta-hg@4
    30
					<xsl:for-each select="collection('../vstup/?select=*.xml')[g:stránka/g:pořadí]">
franta-hg@4
    31
						<xsl:sort select="empty(./g:stránka/g:pořadí)"/>
franta-hg@4
    32
						<xsl:sort select="./g:stránka/g:pořadí"/>
franta-hg@4
    33
						<li>
franta-hg@4
    34
							<xsl:variable name="xmlSoubor" select="tokenize(document-uri(.), '/')[last()]"/>
franta-hg@4
    35
							<xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, '.xml', '.xhtml')"/>
franta-hg@4
    36
							<a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./g:stránka/g:nadpis"/></a>
franta-hg@4
    37
						</li>
franta-hg@4
    38
					</xsl:for-each>
franta-hg@4
    39
				</ul>
franta-hg@3
    40
				<xsl:apply-templates select="document(fn:encode-for-uri('../vstup/zápatí.inc'))/g:stránka/h:text/node()"/>				
franta-hg@1
    41
			</body>
franta-hg@1
    42
		</html>
franta-hg@1
    43
	</xsl:template>
franta-hg@1
    44
	
franta-hg@5
    45
	<!-- Kopírujeme elementy, ale vynecháme nepoužité xmlns deklarace: -->
franta-hg@5
    46
	<xsl:template match="*">
franta-hg@5
    47
		<xsl:element name="{name()}">
franta-hg@5
    48
			<xsl:copy-of select="@*"/>
franta-hg@5
    49
			<xsl:apply-templates/>
franta-hg@5
    50
		</xsl:element>
franta-hg@5
    51
    </xsl:template>
franta-hg@1
    52
franta-hg@1
    53
</xsl:stylesheet>