Hi Michel,
Excellent. Many thanks for looking into this. And thank you for the work
around.
You're right about my path: I was trying to constrain the aspect ratio
between 2:1 and 1:2, and obviously inverted both side of the second
equation; I feel dumb! :)
I'll look out for an update hitting CPAN give that a whirl.
Many, many thanks,
James
On 7/03/2011 9:53 PM, xmltwig@gmail.com via RT wrote:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=66371 >
>
> On 03/07/2011 01:36 PM, James Bromberger via RT wrote:
>> (//div[@class="KonaBody"]//img[(not(@width) or @width>30) and
>> (not(@height) or @height>30) and ((not(@width) and not(@height)) or
>> (@width/@height> 0.5 and @height/@width< 2))]/@src)[1]
> Oh, I see. It does fail for me too.
>
> The problem is the @width/@height > 0.5, which indeed is resooved using
> a call to getAttributes on an attribute.
>
> I have a patched version, I'll test it later and upload it to CPAN.
>
> In the mean time you can avoid the problem by separating the attributes:
>
> my $img= $tree->findnodes( q{(//div[@class="KonaBody"]//img[(not(@width)
> or @width>30) and
> (not(@height) or @height>30) and ((not(@width) and not(@height)) or
> (@width > @height * 0.5 and @height < @width * 2))]/@src)[1]
> });
>
> also,, I believe the last 2 tests are redundant: @width/@height > 0.5
> and @height/@width < 2 test exactly the same thing, so
>
>
> (//div[@class="KonaBody"]//img[(not(@width) or @width>30) and
> (not(@height) or @height>30) and ((not(@width) and not(@height)) or
> (@width > @height * 0.5 ))]/@src)[1]
>
> I also have to investigate why on Earth the parser doesn't like '@width
> > @height / 2', which triggers a syntax error on the XPath.
>
--
Mobile: +61 422 166 708, Email: james_AT_rcpt.to