[Omaha.pm] get_xpath via Perl, Template Toolkit (XML::Twig)
Jay Hannah
jay at jays.net
Fri Mar 7 13:26:50 PST 2008
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
More information about the Omaha-pm
mailing list