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'] |
| a | Both conditions must be true /*/Site//Page[@AssignedUser='author1' and
@MarkedForPublish='false'] |
| or | At 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
| Attribute | Description |
|---|---|
| Name | Page name in page properties. Case-sensitive.
/*/Site//Page[contains(@Name,'Student')] |
| ID | xID in page properties. Case-sensitive.
/*/Site//Page[starts-with(@ID,'x1')] |
| Schema | Page schema in page properties. Case-sensitive.
/*/Site//Page[@Schema='Image'] |
| CheckedOut | Page 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'] |
| AssignedUser | User currently assigned to the page. Retrieves the user ID, not the username.
/*/Site//Page[contains(@AssignedUser,'author1')] |
| Changed | Date and time the page was last checked in with changes.
/*/Site//Page[ms:string-compare(@Changed,'%today%')=1] |
| Created | Date and time the page was created.
/*/Site//Page[ms:string-compare(@Created,'%today%')=1] |
| StartDate | Date and time the page goes live.
/*/Site//Page[not(@StartDate)] |
| EndDate | Date and time the page expires.
/*/Site//Page[not(@EndDate)] |
Simple XPath Queries
| XPath Query | Description |
|---|---|
| Returns all pages assigned to the user ID admin. |
| Returns all pages created on the specified date. |
| Returns all pages whose names contain the specified text, such as Products. |
| Returns all pages whose IDs start with the specified text, such as x4. |
| Returns all pages that use the specified schema, such as Details. |
| Returns all checked-in pages. |
| Returns all checked-out pages. |
| Returns all pages changed on the specified date. |
| Returns all pages with a "go live" date/time. |
| Returns all pages with an end (expiration) date/time. |
| Returns all pages that go live on the specified date. |
| Returns all pages that expire on the specified date. |
You can combine XPath expressions to return more complex results:
/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.
/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.