Show
Ignore:
Timestamp:
04/28/11 00:16:27 (15 years ago)
Author:
František Kučera <franta-hg@…>
Branch:
default
Message:

Volitelná podpora zaostalých prohlížečů (MSIE).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • šablona/stránka.xsl

    r12 r15  
    77        xmlns:fn="http://www.w3.org/2005/xpath-functions" 
    88        xmlns:svg="http://www.w3.org/2000/svg" 
    9         exclude-result-prefixes="fn h g"> 
     9        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
     10        exclude-result-prefixes="fn h g xs"> 
    1011        <xsl:output  
    1112                method="xml"  
     
    1718        <!-- Vstupní adresář: --> 
    1819        <xsl:param name="vstup" select="'../vstup/'"/> 
     20        <xsl:param name="vstupníPřípona" select="'.xml'"/> 
     21        <xsl:param name="výstupníPřípona" select="'.xhtml'"/> 
     22        <xsl:param name="vsuvkováPřípona" select="'.inc'"/> 
     23        <xsl:param name="podporaZaostalýchProhlížečů" select="false()" as="xs:boolean"/> 
    1924         
    2025        <!-- Celý dokument: --> 
     
    3237                                <div id="tělo"> 
    3338                                        <div id="záhlaví"> 
    34                                                 <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'záhlaví.inc')))/g:stránka/h:text/node()"/> 
     39                                                <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'záhlaví', $vsuvkováPřípona)))/g:stránka/h:text/node()"/> 
    3540                                        </div> 
    3641                                        <div id="vnitřek"> 
    3742                                                <h1><xsl:value-of select="g:stránka/g:nadpis"/></h1> 
    3843                                                <ul id="nabídka"> 
    39                                                         <xsl:for-each select="collection('../vstup/?select=*.xml')[g:stránka/g:pořadí]"> 
     44                                                        <xsl:for-each select="collection(concat('../vstup/?select=*', $vstupníPřípona))[g:stránka/g:pořadí]"> 
    4045                                                                <xsl:sort select="empty(./g:stránka/g:pořadí)"/> 
    4146                                                                <xsl:sort select="./g:stránka/g:pořadí"/> 
    4247                                                                <li> 
    4348                                                                        <xsl:variable name="xmlSoubor" select="tokenize(document-uri(.), '/')[last()]"/> 
    44                                                                         <xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, '.xml', '.xhtml')"/> 
     49                                                                        <xsl:variable name="xhtmlSoubor" select="replace($xmlSoubor, $vstupníPřípona, $výstupníPřípona)"/> 
    4550                                                                        <a href="{fn:encode-for-uri($xhtmlSoubor)}"><xsl:value-of select="./g:stránka/g:nadpis"/></a> 
    4651                                                                </li> 
     
    5257                                        </div> 
    5358                                        <div id="zápatí"> 
    54                                                 <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'zápatí.inc')))/g:stránka/h:text/node()"/> 
     59                                                <xsl:apply-templates select="document(fn:encode-for-uri(concat($vstup, 'zápatí', $vsuvkováPřípona)))/g:stránka/h:text/node()"/> 
    5560                                        </div> 
    5661                                </div> 
     
    6873     
    6974    <!-- Odkazy na JavaScript a kaskádové styly --> 
    70     <xsl:template match="g:web/g:js"> 
    71         <script src="{text()}" type="text/javascript" /> 
     75    <xsl:template name="varováníRetardace"> 
     76        <xsl:if test="$podporaZaostalýchProhlížečů"> 
     77                        <xsl:comment> 
     78                                Generátor byl spuštěn v režimu podpory zaostalých prohlížečů. 
     79                                Uživatelům doporučujeme upgrade na skutečný WWW prohlížeč, 
     80                                jako je např. Firefox nebo Chromium (případně Opera či Safari). 
     81                        </xsl:comment> 
     82        </xsl:if> 
     83    </xsl:template>     
     84    <xsl:template match="g:web/g:js">            
     85        <script src="{text()}" type="text/javascript"> 
     86                <xsl:call-template name="varováníRetardace"/> 
     87        </script> 
    7288    </xsl:template> 
    7389    <xsl:template match="g:web/g:css">