You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sandor Spruit <sa...@cs.uu.nl> on 2001/02/23 10:48:23 UTC

Re[2]: Chaining XML->XSP->XML->XSP->etc.

Luca,

On Friday, February 23, 2001, 10:16:00 AM, you wrote:

Luca> Emilio,

Luca> since I face your same problem (chaining XSPs adn XMLs), do you
Luca> mind sending me your solution, as soon as you have one ?

I had roughly the same problem earlier this week. Some web searching
yielded this little tutorial:

http://www.suranyami.com/XSPtutorial/

The pictures were *very* useful to improve my understanding of what's
going on with XSP pages, XML, XSL, logicsheets, taglibs and relations
between them. In fact, I had my own solution worked out half an hour
after I'd studied these and looking at my own Cocoon installation.

I have attached two files to this e-mail:

- student-list.xml;
- student-list.xsl;

First file:

It gets processed by - see the two processing instructions at the
beginning of the file - (1) the xsp processor (2) the xslt processor,
where the stylesheet will be "student-list.xsl". The key thing to see
is, that there's another file involved: the esql tab library declared
at the top of the file, listed in your Cocoon.properties. This library
is yet another stylesheet (esql.xsl) tucked away in Cocoon files. So,
it's: student-list.xml -> esql.xsl -> student-list.xsl.

The ESQL taglibrary (stylesheet) uses Java code embedded in it to, in
this case, query a database and transform a document e.g. by inserting
extra elements. In my case, the large 'esql:connection' element gets
transformed into series of 'student', 'name', 'student-nr' tags filled
with information from a phony student database.

Second file:

This stylesheet takes the student/name/student_nr tags produced by the
first (ESQL) transformation and turns them into an HTML table. Some
basic layout information gets added to it along the way.

Hope this helps,
Cheers,
Sandor

-- 
ir A.G.L. Spruit, Utrecht University, the Netherlands
Institute of information and computing sciences
"There is a bit of magic in everything, and then some
loss to even things out" (from: Lou Reed, "Magic and Loss")

Re: Re[2]: Chaining XML->XSP->XML->XSP->etc.

Posted by Emilio Maldonado <em...@cisco.com>.
Luca,
Yes, that's the case. I haven't found a solution and I think there's no one.
Cocoon 1.X can not process more than one XSP on the same request (so you can
not chain your RESULTS and apply another layer of java logic).
Cocoon 2 introduces another concept to do that (Sitemap) but is still alpha,
if at least were Beta I'd feel  more tempted, besides I need to come with
something soon.

Giant taglib? I'm considering that, but have 2 concerns:
1. How would you match/manipulate your xml elements after some java logic
without relying on stylesheets (remember you need to apply the second layer
of logic so you can not exit to xsl unles is your ultimate xml), would you
parse your _intermediate_  XMLs within your taglib with java code?
(monolitic right?)

2. Any implications about caching? a big taglib is compiled the first time
and  then cached as any other pages?

Any comments? I'm sure there's more people here that can suggest approaches.

Emilio

p.s. Sandor, really appreciated  your feedback.


----- Original Message -----
From: "Luca Morandini" <l....@tin.it>
To: <co...@xml.apache.org>; "Sandor Spruit" <sa...@cs.uu.nl>
Sent: Friday, February 23, 2001 6:17 AM
Subject: RE: Re[2]: Chaining XML->XSP->XML->XSP->etc.


> Sandor,
>
> ahem... this was not *exactly* the problem I face; to make things clear,
> let's suppose you have more than one XSP page to go through, like:
>
> XML (query parameters) --> ESQL taglib (retrieves data from database) -->
> XML (retrieved data)   --> PROC taglib (does something on data) -->
> XML (processed data)   --> XSL (renders processed data) -->
> HTML (shown to the user)
>
> How you do this ?
>
> The idea, basically, is to have a more complex pipeline than just the
usual
> XML --> XSP --> XSL --> HTML. I'd like to have a pipeline with more XSP
> pages / taglibs in between.
>
> Sure, you can always build a giant taglib custom-made for your
application;
> a taglib which does everything inside it... but then, how to re-use all
> those specialized taglibs you can find (or develop yourself) when the next
> application comes ?
>
> Best regards,



RE: Re[4]: Chaining XML->XSP->XML->XSP->etc.

Posted by Luca Morandini <l....@tin.it>.
> You can't. It's said somewhere, either on this list or in the docs,
> that you cannot call on the XSP processor more then once per request.
>

	Yes, but I was toying with the idea of serial requests...

	I tried even to trigger them from the browser (writing, at the same time,
one XML and a small HTML whose only purpose is to display a "Wait" message
and call the XML page just written), it worked but...

	how to let processing instructions be ignored from the first XML and be
processed by the second ?

	Moreover...	how to let custom-made tags be ignored from the first XML and
be processed by the second ?

	I think I should wait for Cocoon 2 to be completed...

Best regards,


P.S.
	by the way, I forgot to thank you for your help !
It always moves me when people help complete strangers :)

 
---------------------------------------------
               Luca Morandini
               GIS Consultant
            lmorandini@ieee.org
          +39 (0)744  59 85  1 Office
          +39 0335 681 02 12 Mobile
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: Sandor Spruit [mailto:sandor@cs.uu.nl]
> Sent: lunedì 26 febbraio 2001 10.28
> To: Luca Morandini
> Subject: Re[4]: Chaining XML->XSP->XML->XSP->etc.
>
>
>
> Luca,
>
> On Friday, February 23, 2001, 3:17:22 PM, you wrote:
>
> Luca> Sandor,
>
> Luca> ahem... this was not *exactly* the problem I face; to make
> Luca> things clear, let's suppose you have more than one XSP page to
> Luca> go through, like:
>
> I see your point.
>
> [example snipped]
>
> Luca>         How you do this ?
>
> Luca> The idea, basically, is to have a more complex pipeline than
> Luca> just the usual XML -->> XSP --> XSL --> HTML. I'd like to have a
> Luca> pipeline with more XSP pages / taglibs in between.
>
> Personally, I'm not too fond of the XSP mechanism :) I can see it's
> merits alright, but there are also weaknesses - like the one that
> shows up in your example.
>
> Luca> Sure, you can always build a giant taglib custom-made for your
> Luca> application; a taglib which does everything inside it... but
> Luca> then, how to re-use all those specialized taglibs you can find
> Luca> (or develop yourself) when the next application comes ?
>
> Good point. Nice issue to chew on :)
>
> Regards,
> Sandor
>
> --
> ir A.G.L. Spruit, Utrecht University, the Netherlands
> Institute of information and computing sciences
> "There is a bit of magic in everything, and then some
> loss to even things out" (from: Lou Reed, "Magic and Loss")
>
>
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


Re[4]: Chaining XML->XSP->XML->XSP->etc.

Posted by Sandor Spruit <sa...@cs.uu.nl>.
Luca,

On Friday, February 23, 2001, 3:17:22 PM, you wrote:

Luca> Sandor,

Luca> ahem... this was not *exactly* the problem I face; to make
Luca> things clear, let's suppose you have more than one XSP page to
Luca> go through, like:

I see your point.

[example snipped]

Luca>         How you do this ?

You can't. It's said somewhere, either on this list or in the docs,
that you cannot call on the XSP processor more then once per request.

Luca> The idea, basically, is to have a more complex pipeline than
Luca> just the usual XML -->> XSP --> XSL --> HTML. I'd like to have a
Luca> pipeline with more XSP pages / taglibs in between.

Personally, I'm not too fond of the XSP mechanism :) I can see it's
merits alright, but there are also weaknesses - like the one that
shows up in your example.

Luca> Sure, you can always build a giant taglib custom-made for your
Luca> application; a taglib which does everything inside it... but
Luca> then, how to re-use all those specialized taglibs you can find
Luca> (or develop yourself) when the next application comes ?

Good point. Nice issue to chew on :)

Regards,
Sandor

-- 
ir A.G.L. Spruit, Utrecht University, the Netherlands
Institute of information and computing sciences
"There is a bit of magic in everything, and then some
loss to even things out" (from: Lou Reed, "Magic and Loss")



RE: Re[2]: Chaining XML->XSP->XML->XSP->etc.

Posted by Luca Morandini <l....@tin.it>.
Sandor,

	ahem... this was not *exactly* the problem I face; to make things clear,
let's suppose you have more than one XSP page to go through, like:

XML (query parameters) --> ESQL taglib (retrieves data from database) -->
XML (retrieved data)   --> PROC taglib (does something on data) -->
XML (processed data)   --> XSL (renders processed data) -->
HTML (shown to the user)

	How you do this ?

	The idea, basically, is to have a more complex pipeline than just the usual
XML --> XSP --> XSL --> HTML. I'd like to have a pipeline with more XSP
pages / taglibs in between.

	Sure, you can always build a giant taglib custom-made for your application;
a taglib which does everything inside it... but then, how to re-use all
those specialized taglibs you can find (or develop yourself) when the next
application comes ?

Best regards,
 
---------------------------------------------
               Luca Morandini
               GIS Consultant
            lmorandini@ieee.org
          +39 (0)744  59 85  1 Office
          +39 0335 681 02 12 Mobile
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: Sandor Spruit [mailto:sandor@cs.uu.nl]
> Sent: venerdì 23 febbraio 2001 10.48
> To: Luca Morandini
> Cc: cocoon-users@xml.apache.org; lmorandini@ieee.org
> Subject: Re[2]: Chaining XML->XSP->XML->XSP->etc.
>
>
>
> Luca,
>
> On Friday, February 23, 2001, 10:16:00 AM, you wrote:
>
> Luca> Emilio,
>
> Luca> since I face your same problem (chaining XSPs adn XMLs), do you
> Luca> mind sending me your solution, as soon as you have one ?
>
> I had roughly the same problem earlier this week. Some web searching
> yielded this little tutorial:
>
> http://www.suranyami.com/XSPtutorial/
>
> The pictures were *very* useful to improve my understanding of what's
> going on with XSP pages, XML, XSL, logicsheets, taglibs and relations
> between them. In fact, I had my own solution worked out half an hour
> after I'd studied these and looking at my own Cocoon installation.
>
> I have attached two files to this e-mail:
>
> - student-list.xml;
> - student-list.xsl;
>
> First file:
>
> It gets processed by - see the two processing instructions at the
> beginning of the file - (1) the xsp processor (2) the xslt processor,
> where the stylesheet will be "student-list.xsl". The key thing to see
> is, that there's another file involved: the esql tab library declared
> at the top of the file, listed in your Cocoon.properties. This library
> is yet another stylesheet (esql.xsl) tucked away in Cocoon files. So,
> it's: student-list.xml -> esql.xsl -> student-list.xsl.
>
> The ESQL taglibrary (stylesheet) uses Java code embedded in it to, in
> this case, query a database and transform a document e.g. by inserting
> extra elements. In my case, the large 'esql:connection' element gets
> transformed into series of 'student', 'name', 'student-nr' tags filled
> with information from a phony student database.
>
> Second file:
>
> This stylesheet takes the student/name/student_nr tags produced by the
> first (ESQL) transformation and turns them into an HTML table. Some
> basic layout information gets added to it along the way.
>
> Hope this helps,
> Cheers,
> Sandor
>
> --
> ir A.G.L. Spruit, Utrecht University, the Netherlands
> Institute of information and computing sciences
> "There is a bit of magic in everything, and then some
> loss to even things out" (from: Lou Reed, "Magic and Loss")