Thanks for your reply, but how to use that one for my problem. Because in
my xml data university name(same) occurred in two nodes so it skipping both
times if I use like this.
[% FOREACH st IN university %]
[% NEXT  IF st.isname %]
[% st.name %]

can you help what should I do now. because if two node have same university
name then skip the first occurred node and process next. is it possible?


On Fri, Nov 25, 2011 at 1:00 PM, <[email protected]>wrote:

> Send templates mailing list submissions to
>        [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.template-toolkit.org/mailman/listinfo/templates
> or, via email, send a message with subject or body 'help' to
>        [email protected]
>
> You can reach the person managing the list at
>        [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of templates digest..."
>
>
> Today's Topics:
>
>   1. help need with template toolkit process (veeru reddy)
>   2. Re: help need with template toolkit process (Chad Wallace)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 24 Nov 2011 18:09:49 +0100
> From: veeru reddy <[email protected]>
> Subject: [Templates] help need with template toolkit process
> To: [email protected]
> Message-ID:
>        <CA+JyuYU-oFoKcUGu0=x-jhkuyxx67beq1478t6-fpafzv_z...@mail.gmail.com
> >
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi everyone,
> I have one xml data and I through XML::simple then i stored in a string and
> processing using template. but my problem is I have some repeated nodes in
> xml data suppose university name is repeated then no need to process . how
> can i do with template if  if same name occurs twice then font process that
> one like that. I am converting xml data into pdf so same data occurring two
> times so i need to overcome this problem.
> <university>
> <name>svu</name>
>  <location>ravru</location>
>  <branch>
>   <electronics>
>     <student name="xxx" number="12">
>     <semester number="1"subjects="7" rank="2"/>
>     </student>
>     <student name="xxx" number="15">
>     <semester number="1" subjects="7" rank="10"/>
>     <semester number="2" subjects="4" rank="1"/>
>      </student>
>       <student name="xxx" number="16">
>       <semester number="1"subjects="7" rank="2"/>
>      <semester number="2"subjects="4" rank="2"/>
>       </student>
>    </electronics>
>  </branch>
>  </university>
>  <university>
>  <name>sku</name>
>  <location>ANTP</location>
>   <branch>
>     <electronics>
>       <student name="xxx" number="12">
>     <semester number="3"subjects="6" rank="20"/>
>        </section>
>    </electronics>
>  </branch>
>  </university>
>
> I used XML::Simple to store this data into one hash data structure variable
> $data and that information is like this
>
> $var1={
>        'university'=>{
>           'name'=>'svu',
>           'location'=>'ravru',
>            'branch'=>{
>                     'electronics'=>{
>                                'student'=>[
>                                         {
>                                        'name'=>'mikky',
>                                         'number'=>'12',
>                                           'semester'=>{
>                                                  'Number'=>'1',
>                                                  'subjects'=>'7',
>                                                   'rank'=>'1'
>                                                  }
>                                               },
>                                       {
>                                        'name'=>'vijju',
>                                         'number'=>'15',
>                                           'semester'=>[
>                                                {
>                                               'number'=>'1',
>                                                'subjects'=>'3',
>                                                 'rank'=>'10'
>                                                  },
>                                                 {
>                                                'number'=>'1',
>                                                'subjects'=>'2',
>                                                 'rank'=>'1'
>                                                  }
>                                                 ]
>                                               },
>                                            ]
>                                          }
>                                         }
>                                       };
>
>             'name'=>'sku',
>             'location'=>'ANTP',
>            'branch'=>{
>               'electronics'=>{
>                          'student'=>[
>                                     {
>                                     'name'=>'shyam',
>                                     'number'=>'12',
>                                       'semester'=>{
>                                                'Number'=>'3',
>                                                'subjects'=>'5',
>                                                'rank'=>'20'
>                                                  }
>                                               },
>
>                                             ]
>                                           }
>
>                                         }
>                                       };
>
> I written some script using template toolkit to genarate pdf file using
> pdflatex compiler.
>
> [% FOREACH st IN university %]
> [% st.name %]
> [%st.location%]
> studentdata:
> [% FOREACH student IN st.branch.electronics.student %]
> Component type: [%+ student.name +%][%+ student.number +%]
>       [% FOREACH semester IN student.semester %]
>   [%+ semester.number +%]
>   [%+ semester.subjects +%]
>   [%+  semester.rank +%]
>     [% END %]
>  [% END %]
> [% END %]
> can any one help me how to remove duplicate data .
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mail.template-toolkit.org/pipermail/templates/attachments/20111124/bebe2a76/attachment.html
>
> ------------------------------
>
> Message: 2
> Date: Thu, 24 Nov 2011 12:58:51 -0800
> From: Chad Wallace <[email protected]>
> Subject: Re: [Templates] help need with template toolkit process
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=US-ASCII
>
> On Thu, 24 Nov 2011 18:09:49 +0100
> veeru reddy <[email protected]> wrote:
>
> > Hi everyone,
> > I have one xml data and I through XML::simple then i stored in a
> > string and processing using template. but my problem is I have some
> > repeated nodes in xml data suppose university name is repeated then
> > no need to process . how can i do with template if  if same name
> > occurs twice then font process that one like that.
>
> Read Template::Manual::Directives, especially the NEXT directive.
>
>
> --
>
> C. Chad Wallace, B.Sc.
> The Lodging Company
> http://www.lodgingcompany.com/
> OpenPGP Public Key ID: 0x262208A0
>
>
>
>
> ------------------------------
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
>
>
> End of templates Digest, Vol 50, Issue 17
> *****************************************
>
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to