cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Beyer <...@metatec.com>
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 -> test.foo.xsl
when portal foo is being accessed (e.g.
through a passed parameter), and
similarly have test.xml?portal=bar -> test.bar.xsl
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="test.broker.xsl" type="text/xsl"?>
and have that copy the contents and call the
proper XSL (based on portal) dynamically?
<note>
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:
<page>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="test.foo.xsl" type="text/xsl" ?>
              <test>
                Hello!
              </test>
</page>
<!-- This page was served in 82 milliseconds by Cocoon 1.7.4 -->
Notice how the <page> root element/tag is out of place.
</note>

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.

Thanks-
Ken




Mime
View raw message