Modern Campus Catalog Emblem Modern Campus CMS Emblem Modern Campus Curriculum Emblem Modern Campus Involve Emblem Modern Campus Lifelong Learning Extended Education Emblem Modern Campus Message Emblem Modern Campus Navigate Emblem Modern Campus Schedule Emblem Modern Campus Virtual Tours & Maps Emblem Modern Campus Lifelong Learning Workforce and Community Emblem Site Menu Open Site Menu Close

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 OptionDescriptionExample
ancestorSelects all ancestors of the specified node including parent nodes, parent of parent nodes, etc.
<xsl:copy-of select="ancestor::p" />
ancestor-or-selfSelects the specified nodes and all ancestor nodes.
<xsl:copy-of select="ancestor-or-self::p" />
attributeSelects the specified nodes attributes.
<xsl:copy-of select="p/attribute()" />
childSelects the immediate child nodes of the specified node.
<xsl:copy-of select="child::p" />
descendantSelects all descendants of the specified node including child nodes, child of child nodes, etc.
<xsl:copy-of select="descendant::p" />
descendant-or-selfSelects the specified nodes and all descendent nodes.
<xsl:copy-of select="descendant-or-self::p"/>
followingSelects all nodes that appear after the specified node but excludes any direct ancestors.
<xsl:copy-of select="following::p" />
following-siblingsSelects all nodes that appear after the specified node and are at the same depth within the file's tree structure.
<xsl:copy-of select="following-sibling::p" />
parentSelects all the parents of the specified node.
<xsl:copy-of select="parent::p" />
precedingSelects all nodes that appear before the specified node but excludes any direct ancestors.
<xsl:copy-of select="preceding::p" />
preceding-siblingsSelects all nodes that appear before the specified node and are at the same depth within the file's tree structure.
<xsl:copy-of select="preceding-sibling::p" />

Abbreviated Axis Selection OptionsLink to this section

Some of the axis selections above have abbreviations to make the XSL easier to follow.

Axis OptionAbbreviation
attribute
<xsl:copy-of select="p/@" />
descendant-or-self
<xsl:copy-of select="//p" />
parent
<xsl:copy-of select=".." />
self
<xsl:copy-of select="." />
An element of any name
<xsl:copy-of select="*" />
The nth element
<xsl:copy-of select="//p[n]" />

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.

FunctionDescriptionOutput
concat()

Takes two or more arguments, converts each into a string, and combines them into a single string on output.

<xsl:variable name="index-filename" select="concat($index-file, '.' , $extension)"/>

default.html
upper-case()

Converts lowercase characters into a string of uppercase characters.

<xsl:value-of select="upper-case('Gallena University')"/>
GALLENA UNIVERSITY
lower-case()

Converts uppercase characters into a string of lowercase characters.

<xsl:value-of select="lower-case('Gopher News')"/>

gopher news
substring-after()

Returns the portion of a string located after the first instance of a delimiter.

<xsl:value-of select="substring-after('index.html', '.')"/>
html
substring-before()

Returns the portion of a string located before the first instance of a delimiter.

<xsl:value-of select="substring-before('index.html', '.')"/>
index
tokenize()

Splits a string into a sequence of substrings at each instance of a delimiter.

<xsl:value-of select="tokenize('one, two, three', ',')"/>
one two three

By continuing to use this site, you agree to the storing of first- and third-party cookies on your device to enhance site navigation; analyze site, product, and service usage; and assist in our marketing and promotional efforts. Cookie Policy