cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <>
Subject Re: dynamic selection of stylesheet
Date Thu, 25 Nov 2004 10:41:44 GMT

It seems you should be able to do element matching in
your stylesheets, based on the doctype/namespace of
the document itself - eg. see the oblique reference at:

This would remove the need to do any kind of flowscript
or pipeline macthing.   Having said that, I cannot get a 
sample to work & have posted for help on the XSL mail


>>> 2004/11/24 12:18:11 PM >>>

I'm new to cocoon and was trying to do a simple test application 
reimplementing the core of some php application we are running.

The application consists of a search for xml articles, displaying
a hit list and displaying the articles itself using xslt.
The articles have different but similar doctypes and we have one
default xslt stylesheet and for some of the doctypes specialized 
stylesheets that extend the default stylesheet (calling the default
stylesheet via xsl:import and overwrite some of the templates).

Most things worked fine but I'm having problems, how to choose the
right stylesheet.
I have the xml document and its doctype and have to check if there
is a specialized stylesheet. If I find one, that's the stylesheet to
use, otherwise the default stylesheet should be used.

How would that be done in cocoon?

The solution I found so far, is to have a flowscript checking for
the file. This has two problems: 
a) I had to use the absolute path to the file instead of a relative 
   pathname (currently in the flowscript itself. I guess it wouldn't
   a problem to move that to some parameter. But as long as I need
   the absolute path, it's ugly anyway). Any way to avoid that?
b) If I use the flowscript to select the stylesheet itself returning 
   a call to a pipeline reading the stylesheet and serializing it as
   xml, I can select the default stylesheet, but the specialized
   break since they cannot import the relative adressed default
   any longer. Seems the base path got lost, when the stylesheet was
   by a file generator.
   So instead I have two pipelines for handling the article content
   one of them using 
	<map:transform src="xslt/html/{request-param:doctype}.xsl">
   the other 
        <map:transform src="xslt/html/default.xsl">
   and the flowscript selects which one to use for the article 
   That doesn't look like a reasonable solution to me, though.

Another problem I didn't look into so far is, how to get the doctype
the articles dynamically. Currently it's provided by the search result
but it would be nicer, if I could read it from the xml instance

Thanks for your help

To unsubscribe, e-mail: 
For additional commands, e-mail: 

This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message