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 transform tag maybe configured with child tags to pass additional information to the XSLT as parameters:
The path in the repository or URL of the XSL file which is used to perform the transformation.
< 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.Pre-Defined Parameters
HyperContent 2 automatically provides 4 base urls to every XSL stylesheet
- rel-project-base
- equivalent to the 1.4 "baseurl", this is a relative string sequence of "." and "/" characters that points to the project root from the current path
- rel-server-base
- a relative path to the root of the server; primarily useful for common editor graphics, etc., and NOT for use on published output
- abs-project-base
- an absolute base url to the root of this project on the hypercontent server. This can be used to generate "edit" links on the published web site back to the hypercontent server
- abs-server-base
- an absolute base url to the root of the hypercontent 2 server. In our installation, this will always be "https://hypercontent.columbia.edu"