Re: onix to marc

[email protected] (Galen Charlton)
Newsgroups perl.perl4lib
Message-ID <[email protected]>
Hi Sharif,

On Tue, Apr 20, 2010 at 12:08 PM, Sharif Islam <[email protected]> wrote:
> Hi,
>
> Has anyone used the XML::XSLT module to convert onix data to marc.
>
> I tried using the xsl from the loc:
> http://www.loc.gov/standards/marcxml/xslt/ONIX2MARC21slim.xsl
>
> #!/usr/bin/perl
> use strict;
> use XML::XSLT ;
>
> my $xmlFilename = "onix.xml" ;
> my $xslFilename =  "ONIX2MARC21slim.xsl" ;
>
> my $xslt = XML::XSLT->new($xslFilename, warnings => 1);
> $xslt->transform($xmlFilename);

To get a MARC record, assuming you want the ISO2709 serialization, the
program could continue as follows:

my $marcxml = $xslt->toString;
use MARC::Record;
use MARC::File::XML;
my $marcrec = MARC::Record->new_from_xml($marcxml, 'UTF-8');
print $marcrec->as_usmarc();

Regards,

Galen
-- 
Galen Charlton
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.