[Koha-cvs] koha/C4 Record.pm
Joshua Ferraro
jmf at kados.org
Sun Jun 18 19:46:33 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Changes by: Joshua Ferraro <kados> 06/06/18 17:46:33
Modified files:
C4 : Record.pm
Log message:
Adds Dublin Core and MODS support (incomplete)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Record.pm?cvsroot=koha&r1=1.3&r2=1.4
Patches:
Index: Record.pm
===================================================================
RCS file: /sources/koha/koha/C4/Record.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Record.pm 29 May 2006 17:41:44 -0000 1.3
+++ Record.pm 18 Jun 2006 17:46:33 -0000 1.4
@@ -18,7 +18,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
#
-# $Id: Record.pm,v 1.3 2006/05/29 17:41:44 kados Exp $
+# $Id: Record.pm,v 1.4 2006/06/18 17:46:33 kados Exp $
#
use strict; use warnings; #FIXME: turn off warnings before release
@@ -26,12 +26,13 @@
use MARC::Record; # marc2marcxml, marcxml2marc, html2marc, changeEncoding
use MARC::File::XML; # marc2marcxml, marcxml2marc, html2marcxml, changeEncoding
use MARC::Crosswalk::DublinCore; # marc2dcxml
+#use MODS::Record; # marc2modsxml
use Unicode::Normalize; # _entity_encode
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.3 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.4 $' =~ /\d+/g;
shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
@ISA = qw(Exporter);
@@ -261,8 +262,31 @@
=cut
sub marc2modsxml {
+ use XML::XSLT;
+ #use XML::LibXSLT;
my ($marc) = @_;
- return ("Feature not yet implemented\n");
+ my $error;
+ my $marcxml;
+
+ # open some files for testing
+ open MARCBIG21MARC21SLIM,"/home/koha/head/koha/C4/MARC21slim2MODS3-1.xsl" or die $!;
+ my $marcbig2marc21_slim; # = scalar (MARC21MARC8);
+ foreach my $line (<MARCBIG21MARC21SLIM>) {
+ $marcbig2marc21_slim .= $line;
+ }
+
+ # set some defailts
+ my $to_encoding = "UTF-8";
+ my $flavour = "MARC21";
+
+ # first convert our ISO-2709 to MARCXML
+ ($error,$marcxml) = marc2marcxml($marc,$to_encoding,$flavour);
+ my $xslt_obj = XML::XSLT->new ($marcbig2marc21_slim, warnings => 1);
+ $xslt_obj->transform ($marcxml);
+ my $xslt_string = $xslt_obj->toString;
+ $xslt_obj->dispose();
+ warn $xslt_string;
+ return ($error,$xslt_string);
}
=head2 html2marcxml
@@ -546,6 +570,6 @@
=head1 MODIFICATIONS
-# $Id: Record.pm,v 1.3 2006/05/29 17:41:44 kados Exp $
+# $Id: Record.pm,v 1.4 2006/06/18 17:46:33 kados Exp $
=cut
More information about the Koha-cvs
mailing list