/usr/bin/go-apply-xslt is in libgo-perl 0.15-5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | #!/usr/bin/perl
# TODO: allow other xslt processors; eg xalan
if (system("which xsltproc > /dev/null")) {
print <<EOM
You need xsltproc (part of libxslt) for this.
See http://www.godatabase.org/dev/xml/xsl
[This script can easily be modified so that other xslt processors can
be used; eg java Xalan. I believe xsltproc to be the fastest. If you would
like this script to be extended to use a different xslt processor, please
email the gmod-ontol-sw-devel list]
EOM
;
exit 1;
}
if (!@ARGV || $ARGV[0] =~ /^\-\-help/) {
print usage();
exit 0;
}
my $xsl = shift @ARGV;
my @files = ();
while ($ARGV[0] && $ARGV[0] !~ /^\-(.+)/) {
push(@files, shift @ARGV);
}
if (!$xsl) {
print "You must specify an XSLT logical name!\n";
exit 1;
}
#if (!@files) {
# print "You must specify an xml file to process!\n";
# exit 1;
#}
if (!@files) {
@files = ('-');
}
# if GO_ROOT is set then this specifies the location of the xslt dir
# if it is not set, assume we are using an installed version of go-perl,
# in which case, the xslts will be located along with the perl modules
my $xslt_file;
my $GO_ROOT = $ENV{GO_ROOT};
if ($GO_ROOT) {
# env var takes precedence;
# developers should use this
$xslt_file = "$GO_ROOT/xml/xsl/$xsl.xsl";
}
# default location is with perl modules
if (!$xslt_file || !-f $xslt_file) {
# user-mode; xsl will be wherever the GO modules are installed
require "GO/Parser.pm";
my $dir = $INC{'GO/Parser.pm'};
$dir =~ s/Parser\.pm/xsl/;
$xslt_file = "$dir/$xsl.xsl";
}
if (!-f $xslt_file) {
print <<EOM
I expected to find a file: "$xslt_file"
You may need to download the XSLT files from the go-dev distribution;
see
http://www.godatabase.org/dev/xml/xsl
Set the env var GO_ROOT to point to the directory containing the "xml"
rdirectory
EOM
;
exit 1;
}
my $cmd = "xsltproc @ARGV $xslt_file @files";
if (system($cmd)) {
print STDERR "problem running: $cmd\n";
exit 1;
}
exit 0;
sub usage {
print <<EOM
go-apply-xslt XSLT-NAME [XML FILE...] [XSLTPROC-OPTIONS...]
processes Obo-XML files through an XSLT pipeline
examples:
go-apply-xslt oboxml_to_owl my.obo-xml
go-apply-xslt oboxml_filter my.obo-xml --stringparam namespace cell
If your input format is not obo-xml, you can transform it in a pipeline:
go2obo_xml so.obo | go-apply-xslt text_html -
Which is the same as:
go2xml -x text_html so.obo
EOM
;
}
__END__
=head1 NAME
go-apply-xslt - apply GO XSL on OBO-XML
=head1 DESCRIPTION
Will apply a GO XSL transform (by name) on an OBO-XML file
For a full list of XSLs available, see <http://www.godatabase.org/xml/xsl>
=head1 SEE ALSO
L<go-perl>
|