šablona/stránka.xsl
changeset 11 78a8dd1eeb2b
parent 10 4e70453a027f
child 12 3719b121c3c4
equal deleted inserted replaced
10:4e70453a027f 11:78a8dd1eeb2b
    11 		method="xml" 
    11 		method="xml" 
    12 		indent="yes" 
    12 		indent="yes" 
    13 		encoding="UTF-8"		
    13 		encoding="UTF-8"		
    14 		doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" 
    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"/>
    15 		doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>
    16 		
    16 	
    17 	<xsl:param name="konfigurák"/>
    17 	<!-- Vstupní adresář: -->
       
    18 	<xsl:param name="vstup" select="'../vstup/'"/>
    18 	
    19 	
    19 	<!-- Celý dokument: -->
    20 	<!-- Celý dokument: -->
    20 	<xsl:template match="/">
    21 	<xsl:template match="/">
    21 		<xsl:variable name="konfigurace" select="document($konfigurák)"/>
    22 		<xsl:variable name="konfigurace" select="document(concat($vstup, 'web.conf'))"/>
    22 		<html>
    23 		<html>
    23 			<head>
    24 			<head>
    24 				<title><xsl:value-of select="g:stránka/g:nadpis"/></title>
    25 				<title><xsl:value-of select="g:stránka/g:nadpis"/></title>
    25 				<link title="Novinky (Atom)" href="atom.xml" type="application/atom+xml" rel="alternate"/>
    26 				<link title="Novinky (Atom)" href="atom.xml" type="application/atom+xml" rel="alternate"/>
    26 				<link title="Novinky (RSS)"  href="rss.xml"  type="application/rss+xml"  rel="alternate"/>
    27 				<link title="Novinky (RSS)"  href="rss.xml"  type="application/rss+xml"  rel="alternate"/>
    27 				<xsl:apply-templates select="$konfigurace/g:web/g:js"/>
    28 				<xsl:apply-templates select="$konfigurace/g:web/g:js"/>
    28 				<xsl:apply-templates select="$konfigurace/g:web/g:css"/>				
    29 				<xsl:apply-templates select="$konfigurace/g:web/g:css"/>				
    29 			</head>
    30 			</head>
    30 			<body>
    31 			<body>
    31 				<xsl:apply-templates select="document(fn:encode-for-uri('../vstup/záhlaví.inc'))/g:stránka/h:text/node()"/>			
    32 				<xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'záhlaví.inc')))/g:stránka/h:text/node()"/>			
    32 				<h1><xsl:value-of select="g:stránka/g:nadpis"/></h1>
    33 				<h1><xsl:value-of select="g:stránka/g:nadpis"/></h1>
    33 				<xsl:apply-templates select="g:stránka/h:text/node()"/>
    34 				<xsl:apply-templates select="g:stránka/h:text/node()"/>
    34 				<ul id="nabídka">
    35 				<ul id="nabídka">
    35 					<xsl:for-each select="collection('../vstup/?select=*.xml')[g:stránka/g:pořadí]">
    36 					<xsl:for-each select="collection('../vstup/?select=*.xml')[g:stránka/g:pořadí]">
    36 						<xsl:sort select="empty(./g:stránka/g:pořadí)"/>
    37 						<xsl:sort select="empty(./g:stránka/g:pořadí)"/>
    40 							<xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, '.xml', '.xhtml')"/>
    41 							<xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, '.xml', '.xhtml')"/>
    41 							<a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./g:stránka/g:nadpis"/></a>
    42 							<a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./g:stránka/g:nadpis"/></a>
    42 						</li>
    43 						</li>
    43 					</xsl:for-each>
    44 					</xsl:for-each>
    44 				</ul>
    45 				</ul>
    45 				<xsl:apply-templates select="document(fn:encode-for-uri('../vstup/zápatí.inc'))/g:stránka/h:text/node()"/>				
    46 				<xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'zápatí.inc')))/g:stránka/h:text/node()"/>				
    46 			</body>
    47 			</body>
    47 		</html>
    48 		</html>
    48 	</xsl:template>
    49 	</xsl:template>
    49 	
    50 	
    50 	<!-- Kopírujeme elementy, ale vynecháme nepoužité xmlns deklarace: -->
    51 	<!-- Kopírujeme elementy, ale vynecháme nepoužité xmlns deklarace: -->
    53 			<xsl:copy-of select="@*"/>
    54 			<xsl:copy-of select="@*"/>
    54 			<xsl:apply-templates/>
    55 			<xsl:apply-templates/>
    55 		</xsl:element>
    56 		</xsl:element>
    56     </xsl:template>
    57     </xsl:template>
    57     
    58     
       
    59     <!-- Odkazy na JavaScript a kaskádové styly -->
    58     <xsl:template match="g:web/g:js">
    60     <xsl:template match="g:web/g:js">
    59     	<script src="{text()}" type="text/javascript" />
    61     	<script src="{text()}" type="text/javascript" />
    60     </xsl:template>
    62     </xsl:template>
    61     <xsl:template match="g:web/g:css">
    63     <xsl:template match="g:web/g:css">
    62     	<link href="{text()}" type="text/css" rel="StyleSheet" />
    64     	<link href="{text()}" type="text/css" rel="StyleSheet" />