cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Homeijer <M.Homei...@devote.nl>
Subject RE: [C2]determine stylesheet in XSP
Date Wed, 25 Apr 2001 07:35:53 GMT
This sounds great, but..
If I understand the solution correctly, I will end up with one XSP file with
the action logic for the sitemap and one XSP file with the normal XSP logic
for generation of the content of my page. In my situation, this will mean a
performance problem. My code looks as follows:
- get a list of product groups from a database based on criteria passed in
the url
- if the list of productgroups contains only one productgroup, retrieve a
list of productfamilies, output these in the resulting XML, change the
stylesheet to productfamilies.xsl to display the result.
- if the list of productgroups contains more than one, output this list in
XML and display it using productgroups.xsl.

Splitting this would mean execute a complex query twice, once to check the
number of productgroups returned in the action xsp and once to display the
list of productgroups in the normal xsp.

I have only played with Cocoon 2 for about a week and only now I am
beginning to understand the concept and the possibilities   of it, so it's
possible that I misunderstand your solution ;-(
(BTW: Are there any action samples?)

TIA,
Michael Homeijer

-----Original Message-----
From: Donald Ball [mailto:balld@webslingerZ.com]
Sent: dinsdag 24 april 2001 19:14
To: cocoon-users@xml.apache.org
Subject: Re: [C2]determine stylesheet in XSP


On Tue, 24 Apr 2001, Sylvain Wallez wrote:

> > > > Based on the logic in the XSP stylesheet (actually the amount of
data
> > > > retrieved in a query), I need to change the stylesheet that was
specified
> > > > for my request in the sitemap.
> > > > In C1, I could use <xsp:pi target="xml-stylesheet"> to get this
working, is
> > > > there an alternative in C2?
> > >
> > > It's done in the sitemap.  You have the concept of Matchers,
Selectors, and
> > > Actions which can all change the way the pipeline is built.  If you
change
> > > the stylesheet based on the type of browser, you can use the Browser
Selector
> > > to pick the stylesheet.  If you wan't to match on URI, you can nest
matchers.
> > > If you want your selection to be based on complex representations of
information
> > > such as a database query, then Actions are your answer.
> >
> > then we need to come up with a better way of writing actions. or hey,
why
> > can't xsp pages have the option of passing a Map back to the sitemap for
> > doing stuff like this?
> >
> > - donald
> >
> The problem with XSP in C2 is that their role as a generator is limited
> to producing content. If you consider ESQL (I know youd Donald know it
> well ;-) ), the logicsheet both processes request parameters (and should
> be a C2 action) and produces content (and should be a C2 generator).
>
> Taking further your idea of XSPs passing a Map back to the sitemap, it
> could be a XSPAction whose XML result is also returned as an entry in
> the Map containing serialized SAX events. After XSP execution, control
> is returned back to the sitemap flow (content generation from the
> XSPAction result, redirect to another URL, etc).
>
> What do you think about that ?

i think we should be able to write xsp components that act as actions. my
xsp action might look like this:

<xsp:action>
 <map>
  ...
  <esql:row-results>
   <foo><esql:get-string column="1"/></foo>
  </esql:row-results>
  ...
 </map>
</xsp:action>

and the map it returns would have a key named 'foo' with a value of the
the value of the first column. we could either mandate that the tree be
flat or extend the {} expression syntax a bit to allow stuff like this:

{foo/bar/bat}

to keep things simple, we could mandate that no two element siblings have
the same name.

- donald


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message