diff options
author | dakkar <dakkar@luxion> | 2009-01-07 12:59:49 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2009-01-07 12:59:49 +0000 |
commit | 53b3268dbd0d3a13b89243c28215ff071ce99bb5 (patch) | |
tree | 4b2b6c1bc122b0223165a8c6d29ab7604742de38 | |
parent | feed fatti, e pure col test (diff) | |
download | WebCoso-53b3268dbd0d3a13b89243c28215ff071ce99bb5.tar.gz WebCoso-53b3268dbd0d3a13b89243c28215ff071ce99bb5.tar.bz2 WebCoso-53b3268dbd0d3a13b89243c28215ff071ce99bb5.zip |
messi i tag / category nel feed
git-svn-id: svn://luxion/repos/WebCoso/trunk@403 fcb26f47-9200-0410-b104-b98ab5b095f3
-rw-r--r-- | lib/WebCoso/Common.pm | 19 | ||||
-rw-r--r-- | t/test-site/src/common/fillFeed.xsl | 6 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/WebCoso/Common.pm b/lib/WebCoso/Common.pm index eed6f3a..46f63b6 100644 --- a/lib/WebCoso/Common.pm +++ b/lib/WebCoso/Common.pm @@ -138,6 +138,25 @@ sub getDatesFor { } } +sub getTagsFor { + my ($fc,$lang,$path,$name)=@_; + + DEBUG("getTagsFor($lang,$path,$name)"); + my $doc_name=srcXMLFor($lang,$path,$name); + my $doc=$fc->get($doc_name); + unless ($doc) { + LOGWARN("No document for <$doc_name>, returning <>"); + return; + } + + my @tags=map {$_->textContent} + $xpath->findnodes( + q{/document/docinfo/field[field_name='tags']/field_body/*/list_item|/document/docinfo/field[field_name='tags']/field_body/paragraph}, + $doc); + chomp for @tags; + return @tags; +} + sub getDates { my ($fc,@docs)=@_; diff --git a/t/test-site/src/common/fillFeed.xsl b/t/test-site/src/common/fillFeed.xsl index 04a6de3..30d167b 100644 --- a/t/test-site/src/common/fillFeed.xsl +++ b/t/test-site/src/common/fillFeed.xsl @@ -30,7 +30,6 @@ <x:template match="a:entry"> <a:entry> - <x:copy-of select="a:category"/> <x:copy-of select="a:id"/> <x:copy-of select="a:published"/> <x:copy-of select="a:updated"/> @@ -50,6 +49,11 @@ <x:apply-templates select="wc:document($language,$filename,.)/document/node()"/> </div> </a:content> + <x:for-each select="wc:document($language,$filename,.)/document/docinfo/field[field_name='tags']/field_body"> + <x:for-each select="*/list_item|paragraph"> + <a:category term="{normalize-space(.)}" label="{normalize-space(string(wc:title-for($language,$filename,concat('/tags/',normalize-space(.),'/'))))}"/> + </x:for-each> + </x:for-each> </x:template> </x:stylesheet>
\ No newline at end of file |