| ||
![]() |
Using Multiple Stylesheets for the Same Content | |
|
There are three good methods for using multiple stylesheets for the same content:
All three methods work. A Usecase does most of the work in a separate file, so it is the easiest to maintain. InstructionsThis creates a Usecase that allows the doctype to be overridden if the specified XSLT exists, then passes control to the main pipeline, so any customization of the main pipeline is obeyed.NOTE: {DifferentXSLT} should be replace by your chosen name for the style, and should be all lowercase without braces {}. 1. Add this match to {pub}/publication-sitemap.xmap: <map:match pattern="*/lenyabody-**">
2. Add the XSL Usecase. NEW FILE: {pub}/usecase-xsl.xmap <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
This is meant for multiple versions for display of data, so it only applies to the Live Area, and does not include code from the main entry Pipeine for the "resource-exists" and "language-exists" checks, the authoring GUI, and caching. You can copy the appropriate code from the <map:match pattern="**.html"> Pipeline in publication-sitemap.xmap. As an example, to make it work with the Authoring GUI, add these lines:
<map:match pattern="authoring/**.html">
Just before each of the two lines: <map:transform src="../../xslt/util/strip_namespaces.xsl"/>
3. Create the new stylesheets: FILE: {pub}/xslt/page2xhtml-{DifferentXSL}.xsl This is where you do some work. You should probably start by copying page2xhtml.xsl. 4. Create a translation for each new stylesheet: FILE: {pub}/xslt/{DifferentXSL}2xhtml.xsl You can copy homepage2xhtml.xsl: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="xhtml2xhtml.xsl"/> </xsl:stylesheet> 5. To change the xsl, add "&xsl={DifferentXSLT}" to a link. To add the link in your XSLT, use: <A HREF="{$root}/{$url}?lenya.usecase=xsl&xsl={DifferentXSLT}">
|