#!/usr/bin/perl

use Env;

sub x_1 {
  my ($inFile, $xslFile, $outFile) = @_;

  die "XSL does not exist: $xslFile" if ! (-e $xslFile);
  die "XML does not exist: $inFile"  if ! (-e $xslFile);

  my $x = "java -cp lib/xalan.jar org.apache.xalan.xslt.Process -IN $inFile -XSL $xslFile -OUT $outFile";
  print "$x \n";
  print `$x`;

  die "Could not run XSL\n" if $?;

}

 @ documents = (
	"APE",     "APHP",   "APS",   "CRD",   "CTNN",
	"DSC",     "EDPN",   "EDR",   "EHCP",  "ENS",
	"ETC",     "IC",     "LDHP",  "LDS",   "MCHCGS",
	"MCHHBS",  "MDS",    "NDS",   "NN",    "PPOC",
	"PPVS",    "PRPHCA", "TN",    "XDSMSDischarge",
	"XDSMSReferral",
	"XPHRExtract",
	"XPHRUpdate"
 );
 foreach $d(@documents) {
  print "$d\n";
  x_1(	"cda-gen/$d" . "_generated.xml",
	"xsl-eval/$d" . "_eval.xsl",
	"html-eval/$d" . "_eval.html");
 }

