Skip to main content
XPath selector rule (policies)
Ben Chamness avatar
Written by Ben Chamness
Updated over a week ago

XPath is an incredibly powerful way to identify content on your site. Currently, Silktide supports XPath 1.0. The XPath selector rule will give you text input field that you can populate with your XPath rule.

Using XPath

It is hard to provide examples of how you could use XPath since it can select almost anything on your page. It may even be possible for you to write all of your policy rules solely using the XPath selector if you wanted. However, XPath requires a bit of technical knowledge to read, write, and understand. If you are considering using XPath for a policy, it may be best to see if one of our other policy rule types can accomplish the same task, and especially if the other method would be easier for your colleagues to understand.

As an example, the following XPath rule would find all links on your site that reference silktide.com.

//a[contains(@href,"silktide.com")]

Instead of using XPath for this, you may want to use our Link rule or even the HTML tag rule. Even if you understand this XPath example, think of how it would be modified for a more extensive search. Our other rule types would be much easier to maintain if you were searching for multiple web addresses in the link or if you were looking at other attributes of those links.

Learn more

You can use the links below to learn more about XPath and how it can be used to search for content on your site:

Did this answer your question?