aboutsummaryrefslogtreecommitdiff
path: root/lib/WebCoso/XSLT.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WebCoso/XSLT.pm')
-rw-r--r--lib/WebCoso/XSLT.pm25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/WebCoso/XSLT.pm b/lib/WebCoso/XSLT.pm
index 9cbeab0..28643c5 100644
--- a/lib/WebCoso/XSLT.pm
+++ b/lib/WebCoso/XSLT.pm
@@ -20,7 +20,7 @@ sub new {
$self->{xslt_proc}=XML::LibXSLT->new();
$self->{xslt_proc}->register_function($NS,'title-for',
- sub{$self->getTitleXML(WebCoso::Common::getTitleFor($self->{fc},@_))});
+ sub{$self->getTitleForXML(@_)});
$self->{xslt_proc}->register_function($NS,'dst-uri-for',
sub{WebCoso::Common::dstUriFor(@_)});
$self->{xslt_proc}->register_function($NS,'tagged',sub{$self->getTagsXML});
@@ -158,6 +158,29 @@ sub getDatesXML {
}
}
+sub getTitleForXML {
+ my ($self,$lang,$path,$name)=@_;
+
+ my $lang_cleaned;
+ if (ref($lang) && $lang->can('get_nodelist')) {
+ DEBUG('getTitleForXML with multple languages');
+ for my $node ($lang->get_nodelist) {
+ my $val=$node->findvalue('normalize-space(string(.))');
+ DEBUG(" <$val>");
+ push @{$lang_cleaned},$val if length($val)>0;
+ }
+ }
+ else {
+ DEBUG('getTitleForXML with a single language');
+ $lang_cleaned=$lang;
+ }
+ return $self->getTitleXML(WebCoso::Common::getTitleFor(
+ $self->{fc},
+ $lang_cleaned,
+ $path,
+ $name));
+}
+
sub getTitleXML {
my ($self,$title)=@_;