veerubiji has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I generated latex template using perl,and complied with MikTeX, its genarating pdf.But I have some problems. I written script like this
when I run it its generating pdf with like this#!/usr/bin/env perl use strict; use warnings; use XML::Fast; use Template; my $xml = <<'XML'; <student> <number>24</number> <education>bachelors</education> <specialization>computers </specialization> <address> <house_number="128"/> <street name="xxxx"/> <proddutoor/> </address> </student> <student> <number>23</number> <education>ph.d.</education> <specialization>physics </specialization> <address> <house_number="12"/> <street name="xxxx"/> <kadapa/> </address> </student> XML my $xml_hash = xml2hash $xml; my $template = Template->new(); my $filename = 'output.tex'; $template->process(\*DATA, $xml_hash, $filename) || die "Template process failed: ", $template->error(), "\n"; system( "pdflatex $filename" ); __DATA__ \documentclass{article} \title{Roster} \author{pavani} \begin{document} \maketitle [% FOREACH st IN student %] Student [% st.number %] is a [% st.specialization %] [% st.degree %] s +tudent and his address is[%address%][%house_number%][%street name%]. [% END %] \end{document}
but I need to print address also how to get the address element content also like thisstudent 24 is a computers student and his address is HASH(0x274b27c) student 23 is a computers student and his address is HASH(0x274b27c)
what should I need to change to print like this in pdf. 2)my second question is in my code i assigned only two students information to the variable $xml. But i have 150 students information in one file how can i print all students information in pdf. in this code i am printing only two students information. like this same format i have more number of stdents information in one file, I opened that file and assigned like thisstudent 24 is a computers student and his address is house_number="128"; street name="xxxx"; proddutoor. student 23 is a computers student and his address is house_number="12"; street name="xxxx"; kadapa.
but its not working when i given a file as input.my $file; open($file, 'formal.xml'); my $xml=$file; my $xml_hash = xml2hash $xml;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: errors in printing latex template output
by jethro (Monsignor) on Oct 22, 2011 at 12:40 UTC | |
by veerubiji (Sexton) on Oct 24, 2011 at 08:35 UTC | |
by jethro (Monsignor) on Oct 24, 2011 at 09:17 UTC | |
by veerubiji (Sexton) on Oct 24, 2011 at 10:11 UTC | |
by jethro (Monsignor) on Oct 24, 2011 at 10:48 UTC | |
|
Re: errors in printing latex template output
by keszler (Priest) on Oct 22, 2011 at 12:59 UTC | |
by veerubiji (Sexton) on Oct 24, 2011 at 08:47 UTC | |
by keszler (Priest) on Oct 24, 2011 at 11:00 UTC |