aboutsummaryrefslogtreecommitdiff
path: root/lib/WebCoso
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2008-10-02 12:04:22 +0000
committerdakkar <dakkar@luxion>2008-10-02 12:04:22 +0000
commit23b1ddb971a11119c849ffb16d8a0bc4a97bc6fa (patch)
tree72861a5526746f6c29aefc5b817f46b47a0f3f06 /lib/WebCoso
parentsome uniqs (diff)
downloadWebCoso-23b1ddb971a11119c849ffb16d8a0bc4a97bc6fa.tar.gz
WebCoso-23b1ddb971a11119c849ffb16d8a0bc4a97bc6fa.tar.bz2
WebCoso-23b1ddb971a11119c849ffb16d8a0bc4a97bc6fa.zip
fixed that damn title-related error
git-svn-id: svn://luxion/repos/WebCoso/trunk@388 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'lib/WebCoso')
-rw-r--r--lib/WebCoso/Common.pm2
-rw-r--r--lib/WebCoso/XSLT.pm17
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/WebCoso/Common.pm b/lib/WebCoso/Common.pm
index f36e924..31adfbc 100644
--- a/lib/WebCoso/Common.pm
+++ b/lib/WebCoso/Common.pm
@@ -62,6 +62,8 @@ sub getTitleFor {
my ($fc,$lang,$path,$name)=@_;
DEBUG("getTitleFor($lang,$path,$name)");
+ $name="$name"; # force it to a string, since it might be an XML Node
+
my $doc_name=$name;
$doc_name=~s{\.html$}{.du.xml};
$doc_name=~s{/$}{/document.$lang.du.xml};
diff --git a/lib/WebCoso/XSLT.pm b/lib/WebCoso/XSLT.pm
index ea12b38..70efc62 100644
--- a/lib/WebCoso/XSLT.pm
+++ b/lib/WebCoso/XSLT.pm
@@ -19,7 +19,7 @@ sub new {
$self->{xslt_proc}=XML::LibXSLT->new();
$self->{xslt_proc}->register_function($NS,'title-for',
- sub{WebCoso::Common::getTitleFor($self->{fc},@_)});
+ sub{$self->getTitleXML(WebCoso::Common::getTitleFor($self->{fc},@_))});
$self->{xslt_proc}->register_function($NS,'tagged',sub{$self->getTagsXML});
$self->{xslt_proc}->register_function($NS,'dates-for',
sub{$self->getDatesXML(WebCoso::Common::getDatesFor($self->{fc},@_))});
@@ -118,4 +118,19 @@ sub getDatesXML {
}
}
+sub getTitleXML {
+ my ($self,$title)=@_;
+
+ return $title if ref($title)
+ && ($title->isa('XML::LibXML::Node')
+ || $title->isa('XML::LibXML::NodeList'));
+
+ my $doc=XML::LibXML::Document->new();
+ my $de=$doc->createElement('paragraph');
+ $doc->setDocumentElement($de);
+ $de->appendTextNode($title);
+
+ return $doc;
+}
+
1;