#!/usr/local/bin/perl -w use strict; use warnings; use File::Path; use File::Spec; use File::Basename; use XML::LibXSLT; use XML::LibXML; my $isfile; my ($xmlfile,$xsltfile,$samplefile) = qw/ Example.xml trans.xsl sample.xml/; if(-f $samplefile) { $isfile = "true"; print "File is present\n"; } else { $isfile = "false"; print "File is absent\n"; } my %args = ( "isfile" => $isfile ); my $xslt = XML::LibXSLT->new; my $stylesheet = $xslt->parse_stylesheet_file($xsltfile); my $results = $stylesheet->transform_file($xmlfile,XML::LibXSLT::xpath_to_string(%{args})); 0;