XPath Search in Pages

This is an advanced built-in script. Use XPath Search in Pages to search each page’s source using the provided XPath expression.

XPath Search in Pages is more powerful than the built-in Confluence search, especially when it comes to identifying hidden structural problems in your content. But that power comes at the cost of speed and efficiency. It is best only to run this built-in script on a single space. It takes about 1.5 seconds to search a space with 2,500 pages.

To use XPath Search in Pages, you should be reasonably familiar with the Confluence XHTML storage format, and/or be prepared to examine a page’s source with the Confluence Source Editor in order to work out what expression you need.

Run the script

Follow these steps to run the built-in script:

  1. Fill out the Space where you wanted to view the content. 
  2. Select the Page(s) you want to work with.
  3. Enter the expression in Xpath Query.
    Select Show Examples for common expressions to use with this built-in script.

  4. Select Run.

Results

Once you run the script, the results appear.

Example

Search for pages with images in a certain space

You could use this script if you require a high degree of control over the presentation of your wiki pages, and you want to make sure everything is correct. You could run the following script to see all pages with images: 

  1. Select Demonstration Space for the Space. 
  2. Select all of the Page(s). 
  3. Enter //ac:image or select Pages with images from Show Examples for the Xpath Query
  4. Select Run

Results

The script returns the pages with images in the Demonstration Space. Each page appears as a link. 


On this page