OU Campus XSLT Variables

OU Campus provides a number of XSLT variables that allow developers to create powerful and robust XSL templates. They are used in conjunction with xsl:param.


The ou:action variable allows developers to determine the current state of the document in OU Campus. There are four states in the OU Campus system, preview (prv), publish (pub), edit (edt) and compare (cmp). With the ou:action variable, developers can choose to provide different code blocks at different stages of a page by using this variable in conjunction with <xsl:if> and <xsl:otherwise> statements. 

<xsl:param name="ou:action" />
<xsl:if test="$ou:action='prv'">
      This is preview mode

The following example shows the use of XSL to fetch the output of an executed PHP script in preview, edit, and compare. When the page is being published, the XSL code outputs the PHP call that performs the same operation on the production server.


<xsl:when test="not($ou:action=pub)">

<xsl:value-of disable-output-escaping="yes" select="unparsed-text('http://gallenauniversity.com/_resources/php/mrss.php')"/>


include ($_SERVER['DOCUMENT_ROOT']. "/_resources/php/mrss.php")




The ou:dirname variable outputs the location of the existing working folder.

<xsl:param name="ou:dirname" />
<xsl:value-of select="$ou:dirname"/>
<!-- Output: /level1 -->


The ou:email variable outputs the user’s email address. 

<xsl:param name="ou:email" />
<xsl:value-of select="$ou:email"/>
<!-- Output: jdoe@gallenauniversity.com -->


The ou:feed variable outputs the RSS feed assigned to a document (if any).

<xsl:param name="ou:feed" />
<xsl:value-of select="$ou:feed"/>
<!-- Output: /rss/feed.xml -->


The ou:filename variable outputs the name of the output file on the production server. 

<xsl:param name="ou:filename" />
<xsl:value-of select="$ou:filename"/>
<!-- Output: index.html -->


The ou:firstname variable outputs the user’s first name.

<xsl:param name="ou:firstname" />
<xsl:value-of select="$ou:firstname"/>
<!-- Output: John -->


The ou:ftpdir variable outputs the subdirectory of FTP home where users are placed by default.

<xsl:param name="ou:ftpdir" />
<xsl:value-of select="$ou:ftpdir"/>
<!-- Output: /public_html -->


The ou:ftphome variable outputs the FTP home defined in the site setup. 

<xsl:param name="ou:ftphome" />
<xsl:value-of select="$ou:ftphome"/>
<!-- Output: /public_html --> 


The ou:ftproot variable outputs the FTP root defined in the site setup. 

<xsl:param name="ou:ftproot" />
<xsl:value-of select="$ou:ftproot"/>
<!-- Output: /public_html -->


The ou:httproot variable outputs the HTTP root defined in the site setup.

<xsl:param name="ou:httproot" />
<xsl:value-of select="$ou:httproot"/>
<!-- Output: http://www.gallenauniversity.com/ -->


The ou:lastname variable outputs the user’s last name. 

<xsl:param name="ou:lastname" />
<xsl:value-of select="$ou:lastname"/>
<!-- Output: Doe -->


The ou:modified variable outputs the most recent modified date of a document. 

<xsl:param name="ou:modified" />
<xsl:value-of select="$ou:modified"/>

<!-- Output: 2011-11-21T22:08:00Z -->


The ou:path variable outputs the root-relative path to the file on the production server.

<xsl:param name="ou:path" />
<xsl:value-of select="$ou:path"/>
<!-- Output: /level1/index.html -->


The ou:root variable allows users to determine the path from the system root in OU Campus.

<xsl:param name="ou:root" />
<xsl:value-of select="$ou:root"/>

<!-- Output: /usr/local/oucampus/main_site/ -->


The ou:servername variable outputs the domain of the host server.

<xsl:param name="ou:servername" />
<xsl:value-of select="$ou:servername"/>

<!-- Output: http://cms.gallenauniversity.com -->


The ou:site variable outputs the name of the existing site.

<xsl:param name="ou:site" />
<xsl:value-of select="$ou:site"/>
<!-- Output: main_site -->


The ou:stagingpath variable outputs the root-relative path to the file on the staging server.

<xsl:param name="ou:stagingpath" />
<xsl:value-of select="$ou:stagingpath"/>
<!-- Output: /level1/index.pcf -->


The ou:target variable gives the site name of the production server that the page is published to (Note: the name given to the primary production server is the same as the name given to the site name for the OU Campus staging server). Used with Multi-Target Publish.

<xsl:param name="ou:target" /
<xsl:value-of select="$ou:target"/>

<!-- Output: publish_target -->


The ou:username variable outputs the user’s username.

<xsl:param name="ou:username" />
<xsl:value-of select="$ou:username"/>
<!-- Output: jdoe -->


The ou:uuid variable returns a string of characters, representing a unique identifier, to the file in question, which will not change when the file is moved or renamed.

<xsl:param name="ou:uuid" />
<xsl:value-of select="$ou:uuid"/>
<!-- Output: 1a0e54b0-fa7a-4a1d-8d7e-fd39749b9192 -->

The values for ou:site, ou:ftproot, ou:httproot, ou:ftphome, and ou:ftpdir can be defined by administrators from Setup > Sites > Site Settings, as shown in the screenshot below:

Values for XSLT Variables in Site Settings