XPath Query Examples for Reports
Common XPath Operators, Expressions, and Functions
Symbol | Description |
---|---|
[] | 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'] |
And | Both conditions must be true /*/Site//Page[@AssignedUser='author1' and
@MarkedForPublish='false'] |
Or | One 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
Attribute | Description |
---|---|
Name | Page name found in page properties; case-sensitive.
/*/Site//Page[contains(@Name,'Student')] |
ID | xID found in page properties; case-sensitive.
/*/Site//Page[starts-with(@ID,'x1')] |
Schema | Page schema found in page properties; case-sensitive
/*/Site//Page[@Schema='Image'] |
CheckedOut | Page 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'] |
AssignedUser | Person to whom page is currently assigned; looks at userID rather than username
/*/Site//Page[contains(@AssignedUser,'author1')] |
Changed | Date and time page was last checked in with changes.
/*/Site//Page[ms:string-compare(@Changed,'%today%')=1] |
Created | Date and time page was created.
/*/Site//Page[ms:string-compare(@Created,'%today%')=1] |
StartDate | Date and time page goes live.
/*/Site//Page[not(@StartDate)] |
EndDate | Date and time page goes dead.
/*/Site//Page[not(@EndDate)] |
Simple XPath Queries
XPath Query | Description |
---|---|
| Returns all pages assigned to user named admin. |
| Returns all pages created on date specified. |
| Returns all pages with term in name such as Products. |
| Returns results for specified ID. |
| Returns pages governed by schema, such as Details. |
| Returns results for all pages checked in. |
| Returns results for all pages checked out. |
| Returns pages changed on date provided. |
| Returns results for each page with a "go live" date/time. |
| Returns results for each page with an expiration date/time. |
| Returns all pages with an assigned start date, the date when the page(s) go live. |
| 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.