Sitemap.xml agregace, vyřešeno #2
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 03 Apr 2011 18:44:35 +0200
changeset 971275159d985
parent 8 ad0ee12d13fd
child 10 4e70453a027f
Sitemap.xml agregace, vyřešeno #2
build.xml
šablona/rss.xsl
šablona/sitemap.xsl
     1.1 --- a/build.xml	Sun Apr 03 17:44:58 2011 +0200
     1.2 +++ b/build.xml	Sun Apr 03 18:44:35 2011 +0200
     1.3 @@ -21,10 +21,12 @@
     1.4  	</target>
     1.5  	
     1.6  	<target name="agregace" description="Vytvoří agregované výstupy: RSS, Atom, Sitemap.xml">
     1.7 +		<!-- TODO: sloučit, zjednodušit, parametrizovat -->
     1.8 +	
     1.9  		<!-- Atom -->
    1.10  		<xslt in="${vstup}/web.conf" out="${výstup}/atom.xml" style="${šablona}/atom.xsl">
    1.11  			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    1.12 -			<classpath location="${funkce}"/>			
    1.13 +			<classpath location="${funkce}"/>
    1.14  			<factory name="net.sf.saxon.TransformerFactoryImpl">
    1.15  				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    1.16  			</factory>
    1.17 @@ -33,13 +35,20 @@
    1.18  		<!-- RSS --> 
    1.19  		<xslt in="${výstup}/atom.xml" out="${výstup}/rss.xml" style="${šablona}/rss.xsl">			
    1.20  			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    1.21 -			<classpath location="${funkce}"/>			
    1.22 +			<classpath location="${funkce}"/>
    1.23  			<factory name="net.sf.saxon.TransformerFactoryImpl">
    1.24  				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    1.25  			</factory>
    1.26  		</xslt>
    1.27  		
    1.28  		<!-- TODO: Sitemap.xml -->
    1.29 +		<xslt in="${výstup}/atom.xml" out="${výstup}/sitemap.xml" style="${šablona}/sitemap.xsl">			
    1.30 +			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
    1.31 +			<classpath location="${funkce}"/>
    1.32 +			<factory name="net.sf.saxon.TransformerFactoryImpl">
    1.33 +				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
    1.34 +			</factory>
    1.35 +		</xslt>
    1.36  		
    1.37  	</target>
    1.38  	
     2.1 --- a/šablona/rss.xsl	Sun Apr 03 17:44:58 2011 +0200
     2.2 +++ b/šablona/rss.xsl	Sun Apr 03 18:44:35 2011 +0200
     2.3 @@ -1,11 +1,11 @@
     2.4  <?xml version="1.0" encoding="UTF-8"?>
     2.5  <xsl:stylesheet version="2.0"
     2.6  	xmlns:a="http://www.w3.org/2005/Atom"
     2.7 +	xmlns:atom="http://www.w3.org/2005/Atom"
     2.8  	xmlns:g="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/prostor"
     2.9  	xmlns:j="java:cz.frantovo.xmlWebGenerator.Funkce"
    2.10  	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    2.11  	xmlns:fn="http://www.w3.org/2005/xpath-functions"
    2.12 -	xmlns:atom="http://www.w3.org/2005/Atom"
    2.13  	exclude-result-prefixes="fn g j a">
    2.14  	<xsl:output	method="xml" indent="yes" encoding="UTF-8"/>
    2.15  	
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/šablona/sitemap.xsl	Sun Apr 03 18:44:35 2011 +0200
     3.3 @@ -0,0 +1,25 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<xsl:stylesheet version="2.0"
     3.6 +	xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
     3.7 +	xmlns:a="http://www.w3.org/2005/Atom"
     3.8 +	xmlns:g="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/prostor"
     3.9 +	xmlns:j="java:cz.frantovo.xmlWebGenerator.Funkce"
    3.10 +	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    3.11 +	xmlns:fn="http://www.w3.org/2005/xpath-functions"
    3.12 +	exclude-result-prefixes="fn g j a">
    3.13 +	<xsl:output	method="xml" indent="yes" encoding="UTF-8"/>
    3.14 +	
    3.15 +	<xsl:template match="/">
    3.16 +		<urlset>
    3.17 +			<xsl:apply-templates select="a:feed/a:entry"/>
    3.18 +		</urlset>
    3.19 +	</xsl:template>
    3.20 +	
    3.21 +	<xsl:template match="a:entry">
    3.22 +		<url>
    3.23 +			<loc><xsl:value-of select="a:link/@href"/></loc>
    3.24 +			<lastmod><xsl:value-of select="a:updated"/></lastmod>
    3.25 +		</url>
    3.26 +	</xsl:template>
    3.27 +	
    3.28 +</xsl:stylesheet>