[Koha-bugs] [Bug 14645] Koha::RecordProcessor should deal with Koha::MetadataRecord objects
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Jun 6 07:09:23 CEST 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14645
David Cook <dcook at prosentient.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dcook at prosentient.com.au
--- Comment #4 from David Cook <dcook at prosentient.com.au> ---
I wonder too if we could implement a Koha::Filter::XML::XSLT class.
Unfortunately, since XML::LibXSLT returns a new XML::LibXML::Document object
and Koha::RecordProcessor returns the original object, we'd need to do
something like this to make that work:
sub filter {
my $self = shift;
my $record = shift;
my $xslt = XML::LibXSLT->new();
my $style_doc = XML::LibXML->load_xml(location => "path_to_xslt.xsl");
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $filtered_record = $stylesheet->transform($record);
my $new_root = $filtered_record->documentElement;
my $newest = $new_root->cloneNode(1);
$record->removeChildNodes();
$record->setDocumentElement($newest);
return $record;
}
I imagine cloneNode isn't very efficient, although I don't know the specifics.
I thought about implementing this class for my work on bug 10662, but I think
I'll just write my own few lines for now...
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list