Hi,
I am looking for help in this problem I have data like this after using
XML::Simple with forcearray for repeated elements.
$var1={

      'studentaddres'=>{
                     'address'=>[
                                {
                               'name'=>'mikky',
                               'number'=>'12',
                               'adress'=>' badvel,kadapa,a.p,india',
                                },

                               {
                               'name'=>'vijju',
                               'number'=>'12',
                               'adress'=>' raipur,ananthapur,a.p,india',
                                },

                               {
                               'name'=>'shyam',
                               'number'=>'12',
                               'adress'=>' raighad,rajsthan,india',
                                },
                              ],

                     'Subjects'=>[
                                 {
                                  'subjects'=>'7',
                                  'names'=>'EDC,PDc,OS,CN,ITNM,CDS,ENGLISH',
                                  }
                                  {
                                  'subjects'=>'3',
                                  'names'=>'EDC,CDS,ENGLISH',
                                  }
                                 {
                                  'subjects'=>'2',
                                  'names'=>'EDC,PDc',
                                  }
                                 {
                                  'subjects'=>'5',
                                  'names'=>'EDC,PDc,OS,CN,ITNM',
                                  }
                                 ]
                               },

        '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'
                                                  }
                                               },

                                             ]
                                           }

                                         }
                                       };
by using template toolkit I am able to print university elements by using
this script
[% 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 %]

but now I am printing only student name and number and also semester
subjects and number and rank. but now I need to search according student
name and number in other element  like studentaddress, If I found the same
student name and number then get the address of student and print along
with sutdent name and number . How can I implement this in template toolkit
please reply me.
thanks in advance.
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to