https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14645

David Cook <dc...@prosentient.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dc...@prosentient.com.au

--- Comment #4 from David Cook <dc...@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.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to