cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Beyer <>
Subject Choosing an XSL dynamically
Date Tue, 23 May 2000 21:33:19 GMT
Can I do the following in Cocoon 1.7.4? ...

Have different portals (i.e. foo and bar)
and have test.xml?portal=foo ->
when portal foo is being accessed (e.g.
through a passed parameter), and
similarly have test.xml?portal=bar ->
when bar is being accessed.  You see
the XML data is always the same format,
but I want to present it different for
different portals.

I need to somehow dynamically decide
which XSL to use.  Problem is I need
a static line in test.xml like:
<?xml-stylesheet href="test.xsl" type="text/xsl"?>

Does it make sense to write a broker XSL like:
<?xml-stylesheet href="" type="text/xsl"?>
and have that copy the contents and call the
proper XSL (based on portal) dynamically?
I tried this, but can't quite get the broker to
invoke the 2nd XSL on the output of the 1st. maybe
my copy's not working right - because output of
my broker XSL looks like:
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="" type="text/xsl" ?>
<!-- This page was served in 82 milliseconds by Cocoon 1.7.4 -->
Notice how the <page> root element/tag is out of place.

If I can't do this, then does anyone have another
suggestion to pull off what I'm trying to do?

Do I have to go with Servlets/Xalan to pull this off,
or can I use XSP built-in funcs or utils, or Xinclude,
or whatever?  Or maybe there's something wrong with
my design because it seems like it should be a pretty
common problem.  I read that Cocoon 2 might support
this, but I can't really wait that long.


View raw message