From nuprn1 at gmail.com Mon Feb 12 15:02:05 2007 From: nuprn1 at gmail.com (rich fuller) Date: Mon, 12 Feb 2007 18:02:05 -0500 Subject: [Greasemonkey] XPath Help: Selecting items before a tag within a span Message-ID: <8ca7f43d0702121502y7ae68975p3cbe54e26bdcc1c5@mail.gmail.com> Hello All, I have what seems a fairly simple question but I'm not well versed in xpath. I have a greasemonkey script used on a forum which takes youtube urls and rewrites them into embed. The issue is some signatures have youtube urls so I want to exclude those from the rules. The problem is that the only thing which signifies a signatures in a post is a hr tag like so: This is my post youtube some most post stuff. more youtoube.
start of my sig

Best vid ever
which repeats over. Here is my current xpath: //span[@class='posttext']/a[contains(@HREF, 'youtube.com/watch?v')] Is it possible to only select the needed urls before the hr tag only? (there could be multiple youtube urls in a posttext span) TIA Rich From boogs at youngpup.net Mon Feb 12 15:53:14 2007 From: boogs at youngpup.net (Aaron Boodman) Date: Mon, 12 Feb 2007 15:53:14 -0800 Subject: [Greasemonkey] XPath Help: Selecting items before a tag within a span In-Reply-To: <8ca7f43d0702121502y7ae68975p3cbe54e26bdcc1c5@mail.gmail.com> References: <8ca7f43d0702121502y7ae68975p3cbe54e26bdcc1c5@mail.gmail.com> Message-ID: > Here is my current xpath: > //span[@class='posttext']/a[contains(@HREF, 'youtube.com/watch?v')] //span[@class='posttext']/a[contains(@HREF, 'youtube.com/watch?v') and not(preceding-sibling::hr)] ? (untested, but something like ought to work) > > Is it possible to only select the needed urls before the hr tag only? (there > could be multiple youtube urls in a posttext span) > > TIA > Rich > _______________________________________________ > Greasemonkey mailing list > Greasemonkey at mozdev.org > http://mozdev.org/mailman/listinfo/greasemonkey >