Bug 21797: Update two-column templates with Bootstrap grid: Acquisitions part 5
[koha.git] / misc / maintenance / make_zebra_dom_cfg_from_record_abs
blob3518e653d259262566f91a9601cc2a1fe368312e
1 #!/usr/bin/perl
3 # Copyright (c) 2012 Equinox Software, Inc.
4 # This file is part of Koha.
6 # Koha is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # Koha is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Koha; if not, see <http://www.gnu.org/licenses>.
19 use strict;
20 use warnings;
21 use 5.010;
23 use Koha::Indexer::Utils;
25 use Getopt::Long;
27 my $input_file;
28 my $output_file;
29 my $want_help;
30 my $result = GetOptions(
31 'input:s' => \$input_file,
32 'output:s' => \$output_file,
33 'help|h' => \$want_help,
36 if ( not $result or $want_help or not defined $input_file or not defined $output_file ) {
37 print_usage();
38 exit 0;
41 open my $infh, '<', $input_file or die "$0: cannot open input file $input_file: $!\n";
42 open my $outfh, '>', $output_file or die "$0: cannot open output file $output_file: $!\n";
44 my $grs1_cfg = join('', <$infh>);
45 close $infh;
46 my $dom_cfg = Koha::Indexer::Utils::zebra_record_abs_to_dom($grs1_cfg);
47 print $outfh $dom_cfg;
48 close $outfh;
50 sub print_usage {
51 print <<_USAGE_;
52 $0: generate a DOM filter Zebra index config from a GRS-1 config
54 Given a Zebra record.abs file containing a set of index definitions for
55 Zebra's GRS-1 filter, write an equivalent DOM filter configuration.
57 To generate the XSLT that is to be used by Zebra, run something like
58 the following on the output of this utility:
60 xsltproc ZEBRA_CFG_DIR/xsl/koha-indexdefs-to-zebra.xsl \\
61 biblio-koha-indexdefs.xml \\
62 > ZEBRA_CFG_DIR/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl
64 The above example assumes that the output of the program was named
65 biblio-koha-indexdefs.xsl.
67 Parameters:
68 --input input file name
69 --output output file name
70 --help or -h show this message
71 _USAGE_