u'//course[@year=2008 or @year=2010]'
Isn't it a valid xpath sentence?
[1]
[snip] raise RuntimeError("unhandled instruction: %r" % instr)
RuntimeError: unhandled instruction: <instr at 0xa3608ec:
opname='<block 1, offset 0>', oparg=None, target=None>
Saludos,
-- luismiguel
xml_select raises an error [1] with this xpath sentence:
u'//course[@year=2008 or @year=2010]'
Isn't it a valid xpath sentence?
-- luismiguel
2012/2/2 Uche Ogbuji <uc...@ogbuji.net>:
> On Wed, Feb 1, 2012 at 4:42 PM, Luis Miguel Morillas <mori...@gmail.com>
> wrote:
>>
>> xml_select raises an error [1] with this xpath sentence:
>>
>> u'//course[@year=2008 or @year=2010]'
>>
>> Isn't it a valid xpath sentence?
>
>
> I think that should be valid. But I don't expect it to ever *work*.
>
> You are comparing an atribute value, always a string, with a number. XPath
> doesn't do those automatic conversions for you. How about:
>
> u'//course[@year="2008" or @year="2010"]'
>
>
Ok. So it is a bug, isn't it? See the complete example:
http://paste2.org/p/1891546
-- lm
> --
> Uche Ogbuji http://uche.ogbuji.net
> Weblog: http://copia.ogbuji.net
> Poetry ed @TNB: http://www.thenervousbreakdown.com/author/uogbuji/
> Founding Partner, Zepheira http://zepheira.com
> Linked-in: http://www.linkedin.com/in/ucheogbuji
> Articles: http://uche.ogbuji.net/tech/publications/
> Friendfeed: http://friendfeed.com/uche
> Twitter: http://twitter.com/uogbuji
> http://www.google.com/profiles/uche.ogbuji
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akara Developers" group.
> To post to this group, send email to akar...@googlegroups.com.
> To unsubscribe from this group, send email to
> akara-dev+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/akara-dev?hl=en.
I'm confused. What about section 3.4 in the spec[0]:
"Otherwise, if at least one object to be compared is a number, then
each object to be compared is converted to a number as if by applying
the number function."
Even so, I thought @year would select the 'year' attribute (and not
its value), so this sentence is more relevant:
"If one object to be compared is a node-set and the other is a number,
then the comparison will be true if and only if there is a node in the
node-set such that the result of performing the comparison on the
number to be compared and on the result of converting the string-value
of that node to a number using the number function is true."
Peace,
John
[0] http://www.w3.org/TR/xpath/#booleans
--
PLEASE NOTE that this message is not digitally signed. As a result,
you have no strong evidence that this message was actually sent by me.
Upon request I can provide a digitally signed receipt for this
message or other evidence validating its contents if you need such
evidence.
On Wed, Feb 1, 2012 at 11:39 PM, Uche Ogbuji <uc...@ogbuji.net> wrote:I'm confused. What about section 3.4 in the spec[0]:
> On Wed, Feb 1, 2012 at 4:42 PM, Luis Miguel Morillas <mori...@gmail.com>
> wrote:
>>
>> xml_select raises an error [1] with this xpath sentence:
>>
>> u'//course[@year=2008 or @year=2010]'
>>
>> Isn't it a valid xpath sentence?
>
>
> I think that should be valid. But I don't expect it to ever *work*.
>
> You are comparing an atribute value, always a string, with a number. XPath
> doesn't do those automatic conversions for you.
"Otherwise, if at least one object to be compared is a number, then
each object to be compared is converted to a number as if by applying
the number function."
Even so, I thought @year would select the 'year' attribute (and not
its value), so this sentence is more relevant:
"If one object to be compared is a node-set and the other is a number,
then the comparison will be true if and only if there is a node in the
node-set such that the result of performing the comparison on the
number to be compared and on the result of converting the string-value
of that node to a number using the number function is true."
Sure, I'll send you a bundle next weekend.
-- luismiguel
>
> --
> Uche Ogbuji http://uche.ogbuji.net
> Weblog: http://copia.ogbuji.net
> Poetry ed @TNB: http://www.thenervousbreakdown.com/author/uogbuji/
> Founding Partner, Zepheira http://zepheira.com
> Linked-in: http://www.linkedin.com/in/ucheogbuji
> Articles: http://uche.ogbuji.net/tech/publications/
> Friendfeed: http://friendfeed.com/uche
> Twitter: http://twitter.com/uogbuji
> http://www.google.com/profiles/uche.ogbuji
>