Atom – zjednodušení, #2
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 03 Apr 2011 16:51:06 +0200
changeset 7 5b46493979c9
parent 6 801a8935caf7
child 8 ad0ee12d13fd
Atom – zjednodušení, #2
build.xml
šablona/atom.xsl
--- a/build.xml	Sun Apr 03 16:34:42 2011 +0200
+++ b/build.xml	Sun Apr 03 16:51:06 2011 +0200
@@ -21,14 +21,15 @@
 	</target>
 	
 	<target name="agregace" description="Vytvoří agregované výstupy: RSS, Atom, Sitemap.xml">
+		<!-- Atom -->
 		<xslt in="${vstup}/web.conf" out="${výstup}/atom.xml" style="${šablona}/atom.xsl">
-			<param name="konfigurák" expression="../vstup/web.conf"/>
 			<classpath location="/usr/share/java/saxonb-9.0.jar"/>
 			<classpath location="${funkce}"/>			
 			<factory name="net.sf.saxon.TransformerFactoryImpl">
 				<attribute name="http://saxon.sf.net/feature/allow-external-functions" value="true"/>				
 			</factory>
-		</xslt>	
+		</xslt>
+		
 	</target>
 	
 	<target name="kompiluj-funkce" description="">		
--- a/šablona/atom.xsl	Sun Apr 03 16:34:42 2011 +0200
+++ b/šablona/atom.xsl	Sun Apr 03 16:51:06 2011 +0200
@@ -8,24 +8,21 @@
 	exclude-result-prefixes="fn g j">
 	<xsl:output	method="xml" indent="yes" encoding="UTF-8"/>
 	
-	<xsl:param name="konfigurák"></xsl:param>
-	
-	<xsl:template match="/">
-		<!-- TODO: proměnná: -->
-		<xsl:variable name="konfigurace" select="document($konfigurák)"/>
+	<xsl:template match="/">		
 	
 		<feed>
-			<title><xsl:value-of select="$konfigurace/g:web/g:název"/></title>
-			<subtitle><xsl:value-of select="$konfigurace/g:web/g:podtitul"/></subtitle>
-			<link rel="self" href="{concat($konfigurace/g:web/g:url, 'atom.xml')}"/>
-			<link href="{$konfigurace/g:web/g:url}"/>			
+			<title><xsl:value-of select="g:web/g:název"/></title>
+			<subtitle><xsl:value-of select="g:web/g:podtitul"/></subtitle>
+			<link rel="self" href="{concat(g:web/g:url, 'atom.xml')}"/>
+			<link href="{g:web/g:url}"/>			
 			<updated><xsl:value-of select="current-dateTime()"/></updated>			
 			<author>
-				<name><xsl:value-of select="$konfigurace/g:web/g:autor/g:jméno"/></name>
-				<email><xsl:value-of select="$konfigurace/g:web/g:autor/g:email"/></email>
+				<name><xsl:value-of select="g:web/g:autor/g:jméno"/></name>
+				<email><xsl:value-of select="g:web/g:autor/g:email"/></email>
 			</author>
-			<id><xsl:value-of select="concat('urn:uuid:', $konfigurace/g:web/g:uuid)"/></id>
+			<id><xsl:value-of select="concat('urn:uuid:', g:web/g:uuid)"/></id>
 			
+			<xsl:variable name="konfigurace" select="/"/>
 			<xsl:for-each select="collection('../vstup/?select=*.xml')[empty(g:stránka/g:skrytá) or not(g:stránka/g:skrytá)]">
 				<entry>
 					<title><xsl:value-of select="g:stránka/g:nadpis"/></title>