re:test() XPath to HtmlAgilityPack (get all p tags with matched regex internal)
See the question and my original answer on StackOverflowThe error you have is due to the fact that the expression re:test
uses an XPATH function named test
(declared in a namespace whose prefix is re
), that is unknown to the XSLT context.
I don't know where you got that expression from, but it's not standard, so it means nothing in the Html Agility Pack context :-)
For indepth explanation, see this cool article here: Adding Custom Functions to XPath. Note you could make it work using these techniques.
That said, here a "pure" Html Agility Pack / XPATH implementation:
var pNodes = htmlDoc.DocumentNode.SelectNodes("//p[text()='=.+=']");
It uses a filter (between [ and ]) and the standard XPATH function text() which means "inner text".