On Thu, 12 Oct 2006, phil.swenson / gmail.com wrote:


> small_image_url = XPath.first(item, "SmallImage/URL").text
> small_image_height = XPath.first(item, "SmallImage/Height Units").text
> small_image_width = XPath.first(item, "SmallImage/Width Units").text

> medium_image_url = XPath.first(item, "MediumImage/URL").text
> medium_image_height = XPath.first(item, "MediumImage/Height Units").text
> medium_image_width = XPath.first(item, "MediumImage/Width Units").text

> large_image_url = XPath.first(item, "LargeImage/URL").text
> large_image_height = XPath.first(item, "LargeImage/Height Units").text
> large_image_width = XPath.first(item, "LargeImage/Width Units").text


key4 = lambda{|key| key.downcase.gsub(%r/[^a-zA-Z0-9]+/,'_')}

images =
   [ "Small", "Medium", "Large" ].inject({}) do |h, which|
     h.update key4[which] =>

       [ "URL", "Height Units", "Width Units" ].inject({}) do |h, attr|
         h.update key4[attr] =>

           XPath.first(item, "#{ which }Image/#{ attr }").text
       end
   end


p images['medium']['height_units']
p images['large']['url']

-a
-- 
my religion is very simple.  my religion is kindness. -- the dalai lama