veerubiji has asked for the wisdom of the Perl Monks concerning the following question:
Hi I have xml file from that using XML::LiBXML I extracted and stored in a hash. after that using template I am generating pdf file. I written script like this
but it generating pdf file without any information.I tried to print hash %nums it printing like this#!/usr/bin/perl use warnings; use strict; use Data::Dumper; use Template; use XML::LibXML::Reader; my $file; open( $file, 'DTC_Specification_transformed.xml'); my $reader = XML::LibXML::Reader->new( IO => $file ) or die ("unab +le to open file"); my %nums; my $num=0; while ($reader->nextElement( 'DATA' ) ) { $num=$num+1; $reader->nextElement( 'Test' ); my $information = $reader->readOuterXml(); $reader->nextElement( 'testinfo' ); my $testnumber = $reader->readOuterXml(); $nums{$infortion}= $testnumber; } print %nums; close($file); my $template = Template->new(); my $filename = 'output.tex'; $template->process(\*DATA, %nums, $filename) || die "Template process failed: ", $template->error(), "\n"; system( "pdflatex $filename" ); __DATA__ \documentclass{article} \title{testinformation of each data} \author{michel\\ \begin{document} \maketitle [% FOREACH st IN test %] DTC number:[% st.test %] \\ test information[% st.testinfo.temperature%] [%st.testinfo.humidity %] [% END %] \end{document}
I need to print like this in pdf$var1={ <test>1<test>'=>'<testinfo> <temperature="23"/> <humidity="80"/> </testinfo> <test>2<test>'=>'<testinfo> <temperature="27"/> <humidity="75"/> </testinfo>........so many tests }
but it not printing like that, it generating empty pdf . how to print pdf like this.testnumber= 1, testinfo: temperature= "23", humidity="80" testnumber= 2, testinfo: temperature= "27", humidity="75"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pdf file using perl latex template.
by Corion (Patriarch) on Oct 24, 2011 at 16:17 UTC | |
|
Re: pdf file using perl latex template.
by keszler (Priest) on Oct 24, 2011 at 16:30 UTC | |
|
Re: pdf file using perl latex template.
by CountZero (Bishop) on Oct 24, 2011 at 18:15 UTC | |
by veerubiji (Sexton) on Oct 24, 2011 at 19:21 UTC | |
by CountZero (Bishop) on Oct 24, 2011 at 20:45 UTC | |
by veerubiji (Sexton) on Oct 25, 2011 at 07:04 UTC |