Changeset 12605


Ignore:
Timestamp:
2006-08-30T11:31:53+12:00 (18 years ago)
Author:
shaoqun
Message:

added code that supports the mapping_file option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugouts/MARCXMLPlugout.pm

    r12330 r12605  
    4343                   'deft' => "0",
    4444           'reqd' => "no",   
     45           'hiddengli' => "no"},
     46         { 'name' => "mapping_file",
     47           'desc' => "{MARCXMLPlugout.mapping_file}",
     48           'type' => "string",
     49           'deft' => "$ENV{'GSDLHOME'}/etc/dc2marc-mapping.xml",
     50           'reqd' => "yes",   
    4551           'hiddengli' => "no"}
    4652                ];
     
    6672   $self->{'buffered_output'} ="";
    6773
     74    if (!defined $self->{'mapping_file'} ||  (defined $self->{'mapping_file'} && $self->{'mapping_file'} eq "")){
     75    $self->{'mapping_file'} = "$ENV{'GSDLHOME'}/etc/dc2marc-mapping.xml";
     76    }
     77   
     78    if (!defined $self->{'xslt_file'} || (defined $self->{'xslt_file'} && $self->{'xslt_file'} eq "")){
     79    $self->{'xslt_file'} = "$ENV{'GSDLHOME'}/etc/dc2marc.xsl";
     80    }
     81 
     82    if(defined $self->{'mapping_file'} &&  $self->{'mapping_file'} ne "")
     83    {
     84    print STDERR "Can not find $self->{'mapping_file'}, please make sure you have supplied the correct file path\n" and  die "\n" unless (-e $self->{'mapping_file'});
     85    }
     86
     87    if(defined $self->{'xslt_file'} &&  $self->{'xslt_file'} ne "")
     88    {
     89    print STDERR "Can not find $self->{'xslt_file'}, please make sure you have supplied the correct file path\n" and  die "\n" unless (-e $self->{'xslt_file'});
     90    }
     91
    6892   return bless $self, $class;
    6993}
     
    7296    my $self = shift (@_);
    7397    my ($doc_obj,$doc_dir) = @_;
    74  
     98
     99   
    75100    if ($self->{'group'}){
    76         $self->{buffered_output} .= $doc_obj->get_top_metadata_list()."\n";  
     101        $self->{buffered_output} .= $doc_obj->get_top_metadata_list()."\n";
    77102        return;
    78103    }
     104   
    79105 
    80106    my $output_dir = $self->get_output_dir();
Note: See TracChangeset for help on using the changeset viewer.