FAQDOCSDOWNLOADSGALLERYJA-SIG LogoSourceForge.net Logo
Overview
Getting Started
Using the Content Manager
Authoring Content
Developing Sites
Project Definition Files
Filesystems
Path patterns
Content Types
XML Content
RDF: Extensible Metadata
Dublin Core Metadata
VCard Metadata
XML Includes
XSL Transformations
Filters
Non-XML Content
Editors
Ignored Directories
Permissions
Navigation and Site Maps
Optimizations
Glossary
Bibliography
XSLT is a language for transforming XML documents into other XML documents; it is intended to serve as a layer between structured data and presentation, allowing you to define rules which determine how structured data is rendered into a formatting language such as (X)HTML or XSL-FO (Formatting Objects, used to generate PDF files). XSLT uses a query language called XPath to access specific data from XML files. Background information with links to references for XSLT, XSL-FO and XPath is available at the W3C XSL site.

Defining XSL transformations

Any form of output of an xml-doc or xml-doctype in a HyperContent project definition can be configured with a transform tag which sets up an XSL transformation for that content. The content type of the output may influence the transformation filter; if "application/pdf" is selected, the XSL filter will automatically engage the Formatting Objects Processor to turn the XSL-FO output of the XSLT into a PDF.

< transform >

source =
The path in the repository or URL of the XSL file which is used to perform the transformation.
The transform tag maybe configured with child tags to pass additional information to the XSLT as parameters:

< with-param >

This tag allows you to pass arbitrary parameters to your XSLT. This can be used to pass contextual information to the XSLT, enabling context-sensitive results.

name =

The name of the parameter.
value =
The value of the parameter.

< with-baseurl >

You will usually want to create links in XHTML output to other pages in the site; the baseurl is determined for each output page at build time as a relative path prefix to the root of the site output. You can prepend the baseurl to any full repository path to create a link from the output page to the output of an other repository file. For example, you might construct a link in the context of processing an XML Include to the HTML output of that file: < a href = "{concat($baseurl,@directory,@basename,'.html')}"/>

as =
The name of the parameter expected in the XSLT which should contain the baseurl value. Defaults to "baseurl".

< with-filedate >

In the case you want to display a last modified time on an output page, you can use this tag to pass the formatted date string as a parameter to your XSLT.

as =
The name of the parameter expected in the XSLT which should contain the filedate value. Defaults to "filedate".

Referencing Repository Content within XSLT

XSLT provides three mechanisms for referencing external data; you can set up inheritance of templates from other XSLT files using an xsl:import or xsl:include command, and you can pull in data from XML documents besides the one being processed using the document() function. HyperContent makes it simple to use these commands to access other files in your project repository; simply use the path of the file in the repository you want to access, and HyperContent will provide it. You can also reference content using URLs, and any rules set up in your XML catalog will be followed in retrieving the content.