[Greasemonkey] XPath n00b help

Roderick McGuire mcguire at telerama.com
Sat Feb 11 21:27:11 EST 2006

Roderick McGuire wrote:

> First off, I believe text selects a text node. It isn't a function that 
> returns the text of a node. so for the first part you want:
>  //strong/text()[., contains('Item:')]
> I would make the search a little more constrained by as:
>  //span [@class='galheader']/strong/text()[., contains('Item:')]
> But I don't understand why you are doing that. Actually what you want is 
> the text node under a galheader preceded by a strong image count.
> I would write that as:
>  //span [@class='galheader']/text()[preceding-sibling::strong//text()[., 
> contains('Image')]]
> I've had proroblems with the various axis declarations in XPATH and I'm 
> not sure which of them are actually implemented in Firefox.

Woops, the XPATHS should really be:

  //strong/text()[contains(., 'Item:')]

//span [@class='galheader']/strong/text()[contains(., 'Item:')]


More information about the Greasemonkey mailing list