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']
AndBoth conditions must be true /*/Site//Page[@AssignedUser='author1' and @MarkedForPublish='false']
OrOne of the multiple conditions must be true /*/Site//Page[@AssignedUser='author1' or @AssignedUser='editor1']
contains()Value must contain text /*/Site//Page[contains(@AssignedUser,'author1')]
not()No value exists /*/Site//Page[not(@startDate)]

Ingeniux-Specific Attributes

AttributeDescription
NamePage name found in page properties; case-sensitive. /*/Site//Page[contains(@Name,'Student')]
IDxID found in page properties; case-sensitive. /*/Site//Page[starts-with(@ID,'x1')]
SchemaPage schema found in page properties; case-sensitive /*/Site//Page[@Schema='Image']
CheckedOutPage checked in or out; true=checked out, falue=checked in, case-sensitive /*/Site//Page[@CheckedOut='false']
MarkedForPublish Page marked or unmarked for publish; true=marked, false=unmarked /*/Site//Page[@MarkedForPublish='true']
AssignedUserPerson to whom page is currently assigned; looks at userID rather than username /*/Site//Page[contains(@AssignedUser,'author1')]
ChangedDate and time page was last checked in with changes. /*/Site//Page[ms:string-compare(@Changed,'%today%')=1]
CreatedDate and time page was created. /*/Site//Page[ms:string-compare(@Created,'%today%')=1]
StartDateDate and time page goes live. /*/Site//Page[not(@StartDate)]
EndDateDate and time page goes dead. /*/Site//Page[not(@EndDate)]

Simple XPath Queries

XPath QueryDescription
/*/Site//Page[@AssignedUser='admin']
Returns all pages assigned to user named admin.
/*/Site//Page[ms:string-compare(@Created, '20180420')]
Returns all pages created on date specified.
/*/Site//Page[contains(@Name,'Products')]
Returns all pages with term in name such as Products.
/*/Site//Page[starts-with(@ID,'x4')]
Returns results for specified ID.
/*/Site//Page[@Schema='Details']
Returns pages governed by schema, such as Details.
/*/Site//Page[@CheckedOut='false']
Returns results for all pages checked in.
/*/Site//Page[@CheckedOut='true']
Returns results for all pages checked out.
/*/Site//Page[ms:string-compare(@Changed, '20180420') = 1]
Returns pages changed on date provided.
/*/Site//Page[@StartDate]
Returns results for each page with a "go live" date/time.
/*/Site//Page[@EndDate]
Returns results for each page with an expiration date/time.
/*/Site//Page[contains(@StartDate,'20180418')]
Returns all pages with an assigned start date, the date when the page(s) go live.
/*/Site//Page[contains(@EndDate,'20180418')]
Returns all pages with an assigned end date, the date when the page(s) expire.

XPath expressions can be combined to return more complex result sets:

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

This XPath query references Reference.xml and TaxonomyAssociations.xml. It returns all descendant pages from a specified parent (e.g., x5) that are not tagged with taxonomy categories.

Parameterized XPath Queries

This XPath query contains two parameters: pageId and pubtarget.

/CombinedDocumentForReport/Site//Page[@ID='%pageId%']//Page[@ID = /CombinedDocumentForReport/PublishingTargets/PublishingTarget[@Name = '%pubtarget%']/Page/@ID]

The query references Reference.xml and publishingTargets.xml. It returns all descendants from a parent ID that share a publishing target name. This example may be useful if you want to find all pages assigned a particular publishing target within a branch of the Site Tree. Once you have configured the query, you would pass in the pageId and pubtarget parameter values from the View Results view.

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