šablona/stránka.xsl
changeset 15 cfb2fc0ca242
parent 12 3719b121c3c4
child 16 addd255c39c9
     1.1 --- a/šablona/stránka.xsl	Thu Apr 28 00:16:00 2011 +0200
     1.2 +++ b/šablona/stránka.xsl	Thu Apr 28 00:16:27 2011 +0200
     1.3 @@ -6,7 +6,8 @@
     1.4  	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     1.5  	xmlns:fn="http://www.w3.org/2005/xpath-functions"
     1.6  	xmlns:svg="http://www.w3.org/2000/svg"
     1.7 -	exclude-result-prefixes="fn h g">
     1.8 +	xmlns:xs="http://www.w3.org/2001/XMLSchema"
     1.9 +	exclude-result-prefixes="fn h g xs">
    1.10  	<xsl:output 
    1.11  		method="xml" 
    1.12  		indent="yes" 
    1.13 @@ -16,6 +17,10 @@
    1.14  	
    1.15  	<!-- Vstupní adresář: -->
    1.16  	<xsl:param name="vstup" select="'../vstup/'"/>
    1.17 +	<xsl:param name="vstupníPřípona" select="'.xml'"/>
    1.18 +	<xsl:param name="výstupníPřípona" select="'.xhtml'"/>
    1.19 +	<xsl:param name="vsuvkováPřípona" select="'.inc'"/>
    1.20 +	<xsl:param name="podporaZaostalýchProhlížečů" select="false()" as="xs:boolean"/>
    1.21  	
    1.22  	<!-- Celý dokument: -->
    1.23  	<xsl:template match="/">
    1.24 @@ -31,17 +36,17 @@
    1.25  			<body>
    1.26  				<div id="tělo">
    1.27  					<div id="záhlaví">
    1.28 -						<xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'záhlaví.inc')))/g:stránka/h:text/node()"/>
    1.29 +						<xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'záhlaví', $vsuvkováPřípona)))/g:stránka/h:text/node()"/>
    1.30  					</div>
    1.31  					<div id="vnitřek">
    1.32  						<h1><xsl:value-of select="g:stránka/g:nadpis"/></h1>
    1.33  						<ul id="nabídka">
    1.34 -							<xsl:for-each select="collection('../vstup/?select=*.xml')[g:stránka/g:pořadí]">
    1.35 +							<xsl:for-each select="collection(concat('../vstup/?select=*', $vstupníPřípona))[g:stránka/g:pořadí]">
    1.36  								<xsl:sort select="empty(./g:stránka/g:pořadí)"/>
    1.37  								<xsl:sort select="./g:stránka/g:pořadí"/>
    1.38  								<li>
    1.39  									<xsl:variable name="xmlSoubor" select="tokenize(document-uri(.), '/')[last()]"/>
    1.40 -									<xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, '.xml', '.xhtml')"/>
    1.41 +									<xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, $vstupníPřípona, $výstupníPřípona)"/>
    1.42  									<a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./g:stránka/g:nadpis"/></a>
    1.43  								</li>
    1.44  							</xsl:for-each>
    1.45 @@ -51,7 +56,7 @@
    1.46  						</div>
    1.47  					</div>
    1.48  					<div id="zápatí">
    1.49 -						<xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'zápatí.inc')))/g:stránka/h:text/node()"/>
    1.50 +						<xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'zápatí', $vsuvkováPřípona)))/g:stránka/h:text/node()"/>
    1.51  					</div>
    1.52  				</div>
    1.53  			</body>
    1.54 @@ -67,8 +72,19 @@
    1.55      </xsl:template>
    1.56      
    1.57      <!-- Odkazy na JavaScript a kaskádové styly -->
    1.58 -    <xsl:template match="g:web/g:js">
    1.59 -    	<script src="{text()}" type="text/javascript" />
    1.60 +    <xsl:template name="varováníRetardace">
    1.61 +    	<xsl:if test="$podporaZaostalýchProhlížečů">
    1.62 +			<xsl:comment>
    1.63 +				Generátor byl spuštěn v režimu podpory zaostalých prohlížečů.
    1.64 +				Uživatelům doporučujeme upgrade na skutečný WWW prohlížeč,
    1.65 +				jako je např. Firefox nebo Chromium (případně Opera či Safari).
    1.66 +			</xsl:comment>
    1.67 +    	</xsl:if>
    1.68 +    </xsl:template>    
    1.69 +    <xsl:template match="g:web/g:js">    	
    1.70 +    	<script src="{text()}" type="text/javascript">
    1.71 +    		<xsl:call-template name="varováníRetardace"/>
    1.72 +    	</script>
    1.73      </xsl:template>
    1.74      <xsl:template match="g:web/g:css">
    1.75      	<link href="{text()}" type="text/css" rel="StyleSheet" />