Stylesheet

Digest

stylesheet iconAn XSL Stylesheet is written with a set of rules defined by the eXtensible Stylesheet Language, and is used to transform data from an XML document into an XML document that can be presented in some meaningful manner.

In Cascade Server, XSL stylesheets are assigned to specific regions on a page along with a block (XML, XML Feed, or Index) to style the XML content from the block in a manner appropriate for that page. By using different stylesheets on different pages, the same XML content can be customized for multiple purposes.

Concept

Uses for XSL Stylesheets

In Cascade, Stylesheets are applied (along with a block) to a specific region in a page. Applying both the block and the stylesheet together ensures that the stylesheet will do its job – style the block’s XML content appropriately for that page before the block is substituted into a page region. Using XSL Stylesheets with blocks also makes blocks reusable, in the sense that one block can be styled in many different ways to output the same content with different looks and feels.

XSL stylesheets can also be assigned to the default region of pages using structured data definitions. In such a case, the XSL stylesheet styles the user-supplied structured content in a way that is meaningful for that page.

Technical

Further Insight Into XSL Stylesheets

stylesheet iconAn XSL Stylesheet is written with a set of rules defined by the eXtensible Stylesheet Language, and is used to transform data from an XML document into an XML document that can be presented in some meaningful manner.

In Cascade Server, XSL stylesheets are assigned to specific regions on a page along with a block (XML, XML Feed, or Index) to style the XML content from the block in a manner appropriate for that page. By using different stylesheets on different pages, the same XML content can be customized for multiple purposes.

XSL stylesheets can also be assigned to the default region of pages using structured data definitions. In such a case, the XSL stylesheet styles the user-supplied structured content in a way that is meaningful for that page.

Example XML document:


By applying the following stylesheet to the XML document above, an HTML/XHTML page will be created with the heading "Book library:" A table will be created on this page where each row represents a book from the XML document. For each row, the first column will display the book's title, the second column will display the book's author, and the third row will display the book's isbn.


Creating XSL Stylesheets

Stylesheets are used to format reusable content blocks.

To create a new Stylesheet:

  1. In the Home area, select New -> Default -> Stylesheet.

  2. On the Content pane:
             Enter your XSL.
  3. On the Metadata pane:
             Enter any Metadata desired.
  4. On the System pane:
    Name - Type in the name of your new stylesheet. Since most stylesheets are specific to a particular block, it's often best to give them matching names.
    Parent Folder - This is where the stylesheet will be stored. It's most useful to store stylesheets in a central or common location.
  5. Click Submit to save your stylesheet.

newstylesheet

XSL Stylesheets may be edited or deleted by selecting the stylesheet and choosing the appropriate tab.

Assigning Stylesheets

Assigning Stylesheets at the Page Level

The page level is the highest level in the block/stylesheet assignments hierarchy. Therefore, assignments that are inherited from configuration sets can be overridden at the page level with different blocks/stylesheets.

For pages needing unique block configurations, you can override any preset blocks or stylesheets at the page level. NOTE: Assignments made at the page level will produce a small * character next to the particular configuration that was overridden (i.e. HTML becomes HTML*) when viewing the page again.

Example

Your Site map uses a specific index block and unique stylesheet. Rather than setting up a configuration set that will only be used for one page, you can override the configurations on the actual page.

How to Assign

  1. Select your page from the left asset tree, and click Edit.

  2. Click on the Configurations tab for a list of current configurations.

  3. Select the desired configuration (i.e. HTML or PDF) by clicking the Edit icon.

  4. All of the currently defined regions appear, including file chooser icons to select blocks and stylesheets for each region.

  5. If the selected configuration has blocks or stylesheets already assigned to various regions, these will appear alongside the region names.

  6. To assign a block or stylesheet, click on the appropriate file chooser icon, and select the desired block or stylesheet from the pop-up asset menu. Any currently assigned blocks or stylesheets may be overridden by clicking on the delete icon, or by selecting a new file from the chooser.

  7. Click Submit to save your changes. These assignations will appear only on the current page.

Related Links