Show
Ignore:
Files:
2 added
3 modified

Legend:

Unmodified
Added
Removed
  • build.xml

    r1 r2  
    11<project name="xhtml-web" basedir="." default="generuj"> 
    22 
    3         <!-- Používané adresáře (pravděpodobně nepotřebujete měnit) --> 
     3        <!-- Používané adresáře – např. zde můžete vstup a výstup nasměrovat do jiného verzovaného úložiště --> 
    44        <property name="vstup" value="vstup"/> 
    55        <property name="výstup" value="výstup"/> 
    66        <property name="šablona" value="šablona"/> 
    77        <property name="temp" value="temp"/> 
     8        <property name="funkce" value="${šablona}/funkce/build/classes"/> 
    89         
    9         <target name="generuj" description="">           
    10                 <xslt basedir="${vstup}" destdir="${výstup}" includes="*.xml" extension=".xhtml" style="${šablona}/stránka.xsl"></xslt> 
     10        <target name="generuj" description="Vygeneruje XHTML webové stránky.">           
     11                <xslt basedir="${vstup}" destdir="${výstup}" includes="*.xml" extension=".xhtml" style="${šablona}/stránka.xsl"> 
     12                        <classpath location="/usr/share/java/saxonb-9.0.jar"/> 
     13            <classpath location="${funkce}"/> 
     14                         
     15            <factory name="net.sf.saxon.TransformerFactoryImpl"> 
     16                                <attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/> 
     17                        </factory> 
     18                         
     19                        <sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/> 
     20                        <sysproperty key="javax.xml.parsers.SAXParserFactory" value="org.apache.xerces.jaxp.SAXParserFactoryImpl"/> 
     21                        <sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration" value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>                   
     22                </xslt> 
    1123        </target> 
    1224         
  • vstup/index.xml

    r1 r2  
    1 <stránka titulek="Chovatelská stanice"> 
    2      
    3     <p> 
    4         Vítejte na našich stránkách :-) 
    5         Jsme chovatelská stanice zaměřená na chov tučňáků. 
    6     </p> 
     1<stránka xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/prostor"> 
     2        <nadpis>Chovatelská stanice</nadpis> 
     3        <perex>Úvodní stránka našeho webu.</perex> 
     4         
     5        <text xmlns="http://www.w3.org/1999/xhtml"> 
     6                <p> 
     7                        Vítejte na našich stránkách :-) 
     8                        Jsme chovatelská stanice zaměřená na chov tučňáků. 
     9                </p> 
     10    </text> 
    711     
    812</stránka> 
  • šablona/stránka.xsl

    r1 r3  
    22<xsl:stylesheet version="2.0" 
    33        xmlns="http://www.w3.org/1999/xhtml" 
    4         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    5         <xsl:output method="xml" indent="yes" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/> 
     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" 
     8        exclude-result-prefixes="fn h g"> 
     9        <xsl:output  
     10                method="xml"  
     11                indent="yes"  
     12                encoding="UTF-8"                 
     13                doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"  
     14                doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/> 
    615         
    716        <xsl:template match="/"> 
    817                <html> 
    918                        <head> 
    10                                 <title><xsl:value-of select="stránka/@titulek"/></title> 
     19                                <title><xsl:value-of select="g:stránka/g:nadpis"/></title>                               
    1120                        </head> 
    1221                        <body> 
    13                                 <xsl:choose> 
    14                                         <xsl:when test="stránka/nadpis">                                                 
    15                                                 <!-- 
    16                                                         Element nadpis je nepovinný, můžeme ho použít, pokud zde chceme formátovaný text 
    17                                                         nebo prostě jiný text než v titulku stránky.                                             
    18                                                 --> 
    19                                                 <h1><xsl:value-of select="stránka/nadpis"/></h1> 
    20                                         </xsl:when> 
    21                                         <xsl:otherwise> 
    22                                                 <h1><xsl:value-of select="stránka/@titulek"/></h1> 
    23                                         </xsl:otherwise> 
    24                                 </xsl:choose> 
    25                          
    26                                 <!-- 
    27                                         Vložíme obsah stránky: 
    28                                 -->                              
    29                                 <xsl:apply-templates select="stránka/node()"/> 
     22                                <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/záhlaví.inc'))/g:stránka/h:text/node()"/>                      
     23                                <h1><xsl:value-of select="g:stránka/g:nadpis"/></h1> 
     24                                <xsl:apply-templates select="g:stránka/h:text/node()"/> 
     25                                <xsl:apply-templates select="document(fn:encode-for-uri('../vstup/zápatí.inc'))/g:stránka/h:text/node()"/>                               
    3026                        </body> 
    3127                </html> 
    3228        </xsl:template> 
    3329         
    34          
    3530        <xsl:template match="node()|@*"> 
    36           <xsl:copy> 
    37                 <xsl:apply-templates select="node()|@*"/> 
    38           </xsl:copy> 
    39         </xsl:template> 
     31                <xsl:copy> 
     32                        <xsl:apply-templates select="node()|@*"/> 
     33                </xsl:copy> 
     34        </xsl:template> 
    4035 
    4136</xsl:stylesheet>