Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

XML:XSLT question

by spencerr1 (Novice)
on Jan 29, 2013 at 00:59 UTC ( #1015787=perlquestion: print w/ replies, xml ) Need Help??
spencerr1 has asked for the wisdom of the Perl Monks concerning the following question:

Is it possible to print the transformation to a file instead of the consol

#!/usr/bin/perl use XML::XSLT; my $xmlfile = "example.xml"; my $xslfile = "example.xsl"; my $parser = XML::XSLT->new ($xslfile, "FILE"); $parser->transform_document ($xmlfile, "FILE"); $parser->print_result();

Thank You

Comment on XML:XSLT question
Download Code
Re: XML::XSLT question
by runrig (Abbot) on Jan 29, 2013 at 00:52 UTC
    Is it possible to print the transformed results to a file

    Yes, open a file and use $parser->toString() to print the string to a file.

    But if at all possible, you should be using XML::LibXSLT instead, it is still actively maintained (though it can be harder to install since it requires libxml).

Re: XML:XSLT question
by choroba (Abbot) on Jan 29, 2013 at 08:46 UTC
    Yes. See open, print and close for more information.
    open my $OUT, '>', 'file.txt' or die $!; print $OUT $parser->toString; close $OUT or die $!;
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      Thank you soo much. code works as advertised. Thanks again. Hopefully some day I will be able to contribute. Thanks again.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1015787]
Approved by rovf
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-12-20 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls