Stylesheet Descriptors & Preferences

The portal rendering pipeline makes use of XSLT for incremental transformation of the users layout into the final HTML page. The XSLT component uses runtime data to configure the output properties, parameters and layout attributes used when performing the transform. The XSL stylesheets and the properties, parameters and attributes they support are configured in the portal by IStylesheetDescriptor. The user specific runtime data is sourced from the IStylesheetUserPreferences.

IStylesheetDescriptor

Describes the XSL with a unique name and an optional description. The XSL location is specified as a valid Spring Resource String.

Stylesheet Data

There are three types of stylesheet data with different runtime uses. They do share most of the same properties

  • Scope - REQUEST, SESSION, or PERSISTENT. This is the scope at which the portal will track user customizations to the data.
  • Default Value - An optional default value the portal will use if the user has made no customizations to the data

Output Properties

Output properties are used with the Transformer.setOutputProperties(Properties) API to configure the transformer.

Stylesheet Parameters

Parameters are used with the Transformer.setParameter(String, Object) API to provided data to the XSL.

Layout Attributes

Layout attributes aren't directly involved with the Transformer but the rendering pipeline uses them to add XML attributes to specific nodes in the users layout immediately before the transform runs. Layout attributes have an additional targetElement field that the other two data types do not. This configured which element types in the layout XML the attribute will be applied do. Multiple targetElements may be specified.

Example Data File

Expand the section below for an example portal data file (used in the import process) for the DLM themes and columns structure transformation.

 Click here to expand...
<stylesheet-descriptor
    xmlns="https://source.jasig.org/schemas/uportal/io/stylesheet-descriptor"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://source.jasig.org/schemas/uportal/io/stylesheet-descriptor https://source.jasig.org/schemas/uportal/io/stylesheet-descriptor/stylesheet-descriptor-4.0.xsd"
    script="classpath://org/jasig/portal/io/jaxb-import_v4-0.crn"
    version="4.0"
>
    <name>DLMTabsColumns</name>
    <description>Presents the DLM layout in terms of tabs and columns</description>
    <uri>classpath:/layout/structure/columns/columns.xsl</uri>
    <stylesheet-parameter>
        <name>userLayoutRoot</name>
        <scope>REQUEST</scope>
        <description>The id of the focused layout element</description>
    </stylesheet-parameter>
    <stylesheet-parameter>
        <name>focusedTabID</name>
        <scope>REQUEST</scope>
        <description>The number of the DLM tab that is currently active</description>
    </stylesheet-parameter>
    <stylesheet-parameter>
        <name>defaultTab</name>
        <default-value>1</default-value>
        <scope>PERSISTENT</scope>
        <description>The number of the DLM tab that is initially active</description>
    </stylesheet-parameter>
    <layout-attribute>
        <name>name</name>
        <scope>SESSION</scope>
        <description>Allow renaming a folder without having to reload the underlying layout DOM (this seems like a hack)</description>
        <targetElement>folder</targetElement>
    </layout-attribute>
    <layout-attribute>
        <name>externalId</name>
        <scope>PERSISTENT</scope>
        <description>Identifier used to reference a tab externally, such as within a URL</description>
        <targetElement>folder</targetElement>
    </layout-attribute>
    <layout-attribute>
        <name>tabGroup</name>
        <default-value>DEFAULT_TABGROUP</default-value>
        <scope>PERSISTENT</scope>
        <description>Allows the theme to sort tabs into groups (optional feature)</description>
        <targetElement>folder</targetElement>
    </layout-attribute>
    <layout-attribute>
        <name>width</name>
        <default-value>100%</default-value>
        <scope>PERSISTENT</scope>
        <description>Width of a DLM column</description>
        <targetElement>folder</targetElement>
    </layout-attribute>
</stylesheet-descriptor>

IStylesheetUserPreferences

Accessed via the IStylesheetUserPreferencesService this class stores customizations the user has made to the stylesheet output properties, parameters and layout attributes. The scope configuration of the IStylesheetDescriptor is handled automatically by the implementations.

For any data set on the IStylesheetUserPreferences to actually be stored the appropriate attribute/property MUST be defined on the IStylesheetDescriptor for the preferences. If data is set that does not have a definition a WARN level log message is issued but no exception is thrown.

Output Properties & Stylesheet Parameters

Simply set the name/value pairs to be stored.

Layout Attributes

In addition to a name and a value a layout nodeId is required when storing layout attributes. The value for the named attribute will only be added to the layout node with the specified id.