XPath Query Examples for Reports


Common XPath Operators, Expressions, and Functions

SymbolDescription
[]Contains a filter string
@Indicates an attribute instead of an element
*Wildcard returns all values
=Equal to /*/Site//Page[@AssignedUser='author1']
!=Not equal to /*/Site//Page[@AssignedUser!='author1']
aBoth conditions must be true /*/Site//Page[@AssignedUser='author1' and @MarkedForPublish='false']
orAt least one condition must be true /*/Site//Page[@AssignedUser='author1' or @AssignedUser='editor1']
contains()Value must contain the specific text /*/Site//Page[contains(@AssignedUser,'author1')]
not()No value exists /*/Site//Page[not(@startDate)]

Ingeniux-Specific Attributes

AttributeDescription
NamePage name in page properties. Case-sensitive. /*/Site//Page[contains(@Name,'Student')]
IDxID in page properties. Case-sensitive. /*/Site//Page[starts-with(@ID,'x1')]
SchemaPage schema in page properties. Case-sensitive. /*/Site//Page[@Schema='Image']
CheckedOutPage check-out status: true=checked out, false=checked in. Case-sensitive. /*/Site//Page[@CheckedOut='false']
MarkedForPublish Page publish marking status: true=marked, false=unmarked. /*/Site//Page[@MarkedForPublish='true']
AssignedUserUser currently assigned to the page. Retrieves the user ID, not the username. /*/Site//Page[contains(@AssignedUser,'author1')]
ChangedDate and time the page was last checked in with changes. /*/Site//Page[ms:string-compare(@Changed,'%today%')=1]
CreatedDate and time the page was created. /*/Site//Page[ms:string-compare(@Created,'%today%')=1]
StartDateDate and time the page goes live. /*/Site//Page[not(@StartDate)]
EndDateDate and time the page expires. /*/Site//Page[not(@EndDate)]

Simple XPath Queries

XPath QueryDescription
User assignment query
/*/Site//Page[@AssignedUser='admin']
Returns all pages assigned to the user ID admin.
Page creation date query
/*/Site//Page[ms:string-compare(@Created, '20180420')]
Returns all pages created on the specified date.
Page name query
/*/Site//Page[contains(@Name,'Products')]
Returns all pages whose names contain the specified text, such as Products.
Page ID query
/*/Site//Page[starts-with(@ID,'x4')]
Returns all pages whose IDs start with the specified text, such as x4.
Page schema query
/*/Site//Page[@Schema='Details']
Returns all pages that use the specified schema, such as Details.
Checked-in pages query
/*/Site//Page[@CheckedOut='false']
Returns all checked-in pages.
Checked-out pages query
/*/Site//Page[@CheckedOut='true']
Returns all checked-out pages.
Page change date query
/*/Site//Page[ms:string-compare(@Changed, '20180420') = 1]
Returns all pages changed on the specified date.
Page with start date query
/*/Site//Page[@StartDate]
Returns all pages with a "go live" date/time.
Page with end date query
/*/Site//Page[@EndDate]
Returns all pages with an end (expiration) date/time.
Start date query
/*/Site//Page[contains(@StartDate,'20180418')]
Returns all pages that go live on the specified date.
End date query
/*/Site//Page[contains(@EndDate,'20180418')]
Returns all pages that expire on the specified date.

You can combine XPath expressions to return more complex results:

Untagged descendant pages query
/CombinedDocumentForReport/Site//Page[@ID='x5']//Page[not(@ID = /CombinedDocumentForReport/TaxonomyAssociations/Associations/A/@P)]

This query returns all descendants of a parent page, such as x5, that have no taxonomy categories. The query references Reference.xml and TaxonomyAssociations.xml.

Parameterized XPath Queries

This query uses two parameters: pageId and pubtarget.

Publishing target in a branch query
/CombinedDocumentForReport/Site//Page[@ID='%pageId%']//Page[@ID = /CombinedDocumentForReport/PublishingTargets/PublishingTarget[@Name = '%pubtarget%']/Page/@ID]

This query returns all descendants of a parent page that are assigned to a specific publishing target. Use this query to find the pages for one publishing target within a branch of the site tree. The query references Reference.xml and publishingTargets.xml. After you configure the query, enter the pageId and pubtarget values on the View Results tab.

For more examples of parameterized XPath queries, see Pre-Defined Reports.