# HG changeset patch # User František Kučera <franta-hg@frantovo.cz> # Date 1301764845 -7200 # Node ID a05c6f3cbc3e71450c608d5fa630d1ede63ae0f9 # Parent 1c851d31624abdf5937a8ad510d43651d28681f8 základ, první verze diff -r 1c851d31624a -r a05c6f3cbc3e .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sat Apr 02 19:20:45 2011 +0200 @@ -0,0 +1,5 @@ +temp/* +výstup/* +šablona/funkce/build/* + +analýza/princip.png diff -r 1c851d31624a -r a05c6f3cbc3e analýza/princip.dot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/analýza/princip.dot Sat Apr 02 19:20:45 2011 +0200 @@ -0,0 +1,11 @@ +digraph princip { + rankdir=LR + + gen [label="Generátor" shape="box" labelURL="xxxxxxxx"] + xml [label="Texty v XML"] + xhtml [label="XHTML web"] + xslt [label="XSLT šablona"] + + xml -> gen -> xhtml; + xslt -> gen; +} diff -r 1c851d31624a -r a05c6f3cbc3e build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build.xml Sat Apr 02 19:20:45 2011 +0200 @@ -0,0 +1,13 @@ +<project name="xhtml-web" basedir="." default="generuj"> + + <!-- Používané adresáře (pravděpodobně nepotřebujete měnit) --> + <property name="vstup" value="vstup"/> + <property name="výstup" value="výstup"/> + <property name="šablona" value="šablona"/> + <property name="temp" value="temp"/> + + <target name="generuj" description=""> + <xslt basedir="${vstup}" destdir="${výstup}" includes="*.xml" extension=".xhtml" style="${šablona}/stránka.xsl"></xslt> + </target> + +</project> diff -r 1c851d31624a -r a05c6f3cbc3e vstup/index.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vstup/index.xml Sat Apr 02 19:20:45 2011 +0200 @@ -0,0 +1,8 @@ +<stránka titulek="Chovatelská stanice"> + + <p> + Vítejte na našich stránkách :-) + Jsme chovatelská stanice zaměřená na chov tučňáků. + </p> + +</stránka> diff -r 1c851d31624a -r a05c6f3cbc3e šablona/stránka.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/šablona/stránka.xsl Sat Apr 02 19:20:45 2011 +0200 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="2.0" + xmlns="http://www.w3.org/1999/xhtml" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <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"/> + + <xsl:template match="/"> + <html> + <head> + <title><xsl:value-of select="stránka/@titulek"/></title> + </head> + <body> + <xsl:choose> + <xsl:when test="stránka/nadpis"> + <!-- + Element nadpis je nepovinný, můžeme ho použít, pokud zde chceme formátovaný text + nebo prostě jiný text než v titulku stránky. + --> + <h1><xsl:value-of select="stránka/nadpis"/></h1> + </xsl:when> + <xsl:otherwise> + <h1><xsl:value-of select="stránka/@titulek"/></h1> + </xsl:otherwise> + </xsl:choose> + + <!-- + Vložíme obsah stránky: + --> + <xsl:apply-templates select="stránka/node()"/> + </body> + </html> + </xsl:template> + + + <xsl:template match="node()|@*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + +</xsl:stylesheet>