[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] get_xpath via Perl, Template Toolkit (XML::Twig)




On Fri, 7 Mar 2008, Jay Hannah wrote:
Using Template Toolkit:
[%
 FOREACH d IN twig.get_xpath('b/c[@jay="rules" and @justin="rules too"]/d');
    d.text;
 END;
%]

Just to give everyone a taste of our real-world pain (in Template Toolkit syntax):

xpath = 'AvailResponseSegments/a:AvailResponseSegment/a:RoomStayList/hc:RoomStay/hc:RoomRates/hc:RoomRate[@ratePlanCode="' _ ratePlanCode _ '" and @roomTypeCode=" _ roomTypeCode _ "]/hc:Rates/hc:Rate/hc:Base';
   FOREACH Base IN AvailabilityResponse.get_xpath(xpath);
      # ...

Evil laugh,

j