XPath Everywhere

My head is still reeling from this. Today I looked at a question on the Pipes message boards that included a link to the user’s (Tikkie) pipe – http://pipes.yahoo.com/pipes/pipe.edit?_id=ab21ecfcd00b90a64c2dd6be258210ed

I noticed that the Rename module was using Xpath expressions. "Well that won’t work" I thought. But actually it did! Using XPath expressions to define an element can greatly simplify that definition. For instance, the traditional way of defining the first element in the Rename module would be ‘item.div.div.div.0.div.div.1.div.p’ (it was an effort working that out). Compare that to ‘item.//*[@id="more-description"]/p’.

Here’s a link to my copy of that pipe with a few more uses of Xpath to define elements in other modules:


I’ve contacted the Pipes team about this. They’re hoping that this can be a supported feature.

Update: This use of XPath expressions is supported. I quote from Paul Donnelly ‘it’s baked into Pipes’.

Update: We can use ‘//*[@id="more-description"]/p’ instead of ”item.//*[@id="more-description"]/p’ (thanks to Paul Donnelly for this tip).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: