XPath
XPath, XML Path Language, is a language used to identify specific tags and nodes within an XML document. In Modern Campus CMS, the XML document is modeled as a tree structure with a single root node defined as <document>
.
Axis Selection OptionsLink to this section
An axis is a relationship between a specific node identified using XPath and other nodes within the file's tree structure. Below is a listing of commonly used axis options within Modern Campus CMS.
Axis Option | Description | Example |
---|---|---|
ancestor | Selects all ancestors of the specified node including parent nodes, parent of parent nodes, etc. |
|
ancestor-or-self | Selects the specified nodes and all ancestor nodes. |
|
attribute | Selects the specified nodes attributes. |
|
child | Selects the immediate child nodes of the specified node. |
|
descendant | Selects all descendants of the specified node including child nodes, child of child nodes, etc. |
|
descendant-or-self | Selects the specified nodes and all descendent nodes. |
|
following | Selects all nodes that appear after the specified node but excludes any direct ancestors. |
|
following-siblings | Selects all nodes that appear after the specified node and are at the same depth within the file's tree structure. |
|
parent | Selects all the parents of the specified node. |
|
preceding | Selects all nodes that appear before the specified node but excludes any direct ancestors. |
|
preceding-siblings | Selects all nodes that appear before the specified node and are at the same depth within the file's tree structure. |
|
Abbreviated Axis Selection OptionsLink to this section
Some of the axis selections above have abbreviations to make the XSL easier to follow.
Axis Option | Abbreviation |
---|---|
attribute |
|
descendant-or-self |
|
parent |
|
self |
|
An element of any name |
|
The nth element |
|
XPath FunctionsLink to this section
XPath functions add flexibility and enhance values returned using XPath. Below is a listing of commonly used XPath functions within Modern Campus CMS. More functions can be found on the W3C XPath and XQuery Functions page.
Function | Description | Output |
---|---|---|
concat() |
Takes two or more arguments, converts each into a string, and combines them into a single string on output.
|
|
upper-case() |
Converts lowercase characters into a string of uppercase characters.
|
|
lower-case() |
Converts uppercase characters into a string of lowercase characters.
|
|
substring-after() |
Returns the portion of a string located after the first instance of a delimiter.
|
|
substring-before() |
Returns the portion of a string located before the first instance of a delimiter.
|
|
tokenize() |
Splits a string into a sequence of substrings at each instance of a delimiter.
|
|