You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Forge <fo...@neonics.com> on 2001/02/21 19:59:31 UTC
[c2] xsl during xsp generation state
Hi there,
Since I have multiple pages that all contain a menu,
I would like to be able to process my .xml (really an xsp page)
file with a stylesheet before it gets compiled into an XSP page.
I need this because there are several code-elements in the menu,
for instance all texts are languagekeys that get loaded from
a database.
Is there a general (nice) solution for this?
Thanks!
Re: Chaining XML->XSP->XML->XSP->etc.
Posted by Marcelo Ochoa <mo...@ieee.org>.
>>>>>>>>>>>>>>>>>> Mensaje original <<<<<<<<<<<<<<<<<<
El 21/2/01, 15.39.30, "Emilio Maldonado" <em...@cisco.com> escribió
sobre el tema Chaining XML->XSP->XML->XSP->etc.:
> Hi
> I'm trying to chain and process XML docs by using XSP's. (like the
> clean-page.xml example from the samples)
> I have followed the example and read the archives but looks like Cocoon
only
> supports the XSP processing once, so the chaining is not being
succesfull.
> Is this the right approach? or there's something else more powerful?
> I definitely need a pure-XML with data, and several layers chaining the
> logic before a final XSL renders the result. Where those logic layers
are:
> dynamic SQL generation, user permission validation, dynamic filtering of
> data, passing parameters, merging different XML files... etc,etc. I
don't
> see how to do all of that in one-step transformation and not being
> "monolitic"
> Any other suggestions/approaches?
Look for DB Prism (http://www.plenix.com/dbprism/) it has different
approach to make XML aware applications using Cocoon.
Unlike Cocoon XSP or Oracle XSQL Servlet, DB Prism makes the XML
content in the Database side through an Stored Procedure.
> Emilio
Best regards, Marcelo.
choose xsl dinamically stylesheet
Posted by Marco Magistrali <ma...@ariadne.it>.
Hi to everybody,
is it possible to choose xsl stylesheet like this:
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="../portlets/xsl/griglia.xsl"/>
<xsl:if test=" pippo='yes' ">
<xsl:include href="../portlets/xsl/toolbar_yes.xsl"/>
</xsl:if>
<xsl:if test=" pippo='no' ">
<xsl:include href="../portlets/xsl/toolbar_no.xsl"/>
</xsl:if>
<xsl:include href="../portlets/xsl/strumenti.xsl"/>
<xsl:output method="html"/>
<xsl:template match="page">.....
in which pippo is a variable that I put in xml file????
thanks
Marco
Re: Chaining XML->XSP->XML->XSP->etc.
Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 21 Feb 2001, Emilio Maldonado wrote:
> I don't find any formal documentation about logicsheets.
maybe you should check the web site:
http://xml.apache.org/cocoon/xsp.html
> However let's say that my XML is containing the following logicsheet
> definitions:
>
> <?xml version=3D"1.0"?>
> <?cocoon-process type=3D"xsp"?>
> <?xml-logicsheet href=3D"count.xsl" type=3D"text/xsl"?>
> <?xml-logicsheet href=3D"dbacess.xsl" type=3D"text/xsl"?>
> .....etc
>
> This means that the XML itself is going to be processed by the first
> "count.xsl" and the result of that immediately piped into "dbaccess.xsl" ?
> all in the same request and probably with xsp, taglib calls, logic and
> everything I potentially need embedded into the logicsheet targets? am I
> getting the concept ?
yep. logicsheets are just xsl stylesheets which transform elements in your
namespace into elements in the xsp and other namespaces, for instance:
<foo:get-data/>
-->
<element><xsp:expr>StaticFoo.getFoo()</xsp:expr></element>
fer instance. first all logicsheets called via PI's are applied, then
namespace-activated logicsheets are applied, then finally the xsp-java
logicsheet is applied to transform the final result into java source code.
then it's compiled and run.
- donald
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")
Re[2]: Chaining XML->XSP->XML->XSP->etc.
Posted by Sandor Spruit <sa...@cs.uu.nl>.
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: Chaining XML->XSP->XML->XSP->etc.
Posted by Luca Morandini <l....@tin.it>.
Emilio,
since I face your same problem (chaining XSPs adn XMLs), do you mind
sending me your solution, as soon as you have one ?
Thanks in advance,
---------------------------------------------
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
---------------------------------------------
Re: Chaining XML->XSP->XML->XSP->etc.
Posted by Emilio Maldonado <em...@cisco.com>.
I don't find any formal documentation about logicsheets.
However let's say that my XML is containing the following logicsheet
definitions:
<?xml version=3D"1.0"?>
<?cocoon-process type=3D"xsp"?>
<?xml-logicsheet href=3D"count.xsl" type=3D"text/xsl"?>
<?xml-logicsheet href=3D"dbacess.xsl" type=3D"text/xsl"?>
.....etc
This means that the XML itself is going to be processed by the first
"count.xsl" and the result of that immediately piped into "dbaccess.xsl" ?
all in the same request and probably with xsp, taglib calls, logic and
everything I potentially need embedded into the logicsheet targets? am I
getting the concept ?
Emilio
----- Original Message -----
From: "Donald Ball" <ba...@webslingerZ.com>
succesfull.
>
> it's a bad approach. use xsp logicsheets instead.
>
Re: Chaining XML->XSP->XML->XSP->etc.
Posted by Ulrich Mayring <ul...@denic.de>.
Donald Ball wrote:
>
> it's a bad approach. use xsp logicsheets instead.
>
> > I definitely need a pure-XML with data, and several layers chaining the
Pure XML is as of lately defined as namespace-aware XML. Meaning that
<sometags/>
is not pure XML anymore. Instead use
<mynamespaceprefix:sometags/>
Therefore - from a purity point of view - the lib-page model is now
better than the clean-page model. Its only disadvantage is that XSP
pages by definition are always dynamic, i.e. they need to be compiled
and then run as servlets. Static XML file serving is of course faster,
but doesn't give you as much flexibility and features.
Ulrich
--
Ulrich Mayring
DENIC eG, Systementwicklung
Re: Chaining XML->XSP->XML->XSP->etc.
Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 21 Feb 2001, Emilio Maldonado wrote:
> Hi
> I'm trying to chain and process XML docs by using XSP's. (like the
> clean-page.xml example from the samples)
> I have followed the example and read the archives but looks like Cocoon only
> supports the XSP processing once, so the chaining is not being succesfull.
> Is this the right approach? or there's something else more powerful?
it's a bad approach. use xsp logicsheets instead.
> I definitely need a pure-XML with data, and several layers chaining the
> logic before a final XSL renders the result. Where those logic layers are:
> dynamic SQL generation, user permission validation, dynamic filtering of
> data, passing parameters, merging different XML files... etc,etc. I don't
> see how to do all of that in one-step transformation and not being
> "monolitic"
>
> Any other suggestions/approaches?
use xsp logicsheets. that's what it's all about.
- donald
Chaining XML->XSP->XML->XSP->etc.
Posted by Emilio Maldonado <em...@cisco.com>.
Hi
I'm trying to chain and process XML docs by using XSP's. (like the
clean-page.xml example from the samples)
I have followed the example and read the archives but looks like Cocoon only
supports the XSP processing once, so the chaining is not being succesfull.
Is this the right approach? or there's something else more powerful?
I definitely need a pure-XML with data, and several layers chaining the
logic before a final XSL renders the result. Where those logic layers are:
dynamic SQL generation, user permission validation, dynamic filtering of
data, passing parameters, merging different XML files... etc,etc. I don't
see how to do all of that in one-step transformation and not being
"monolitic"
Any other suggestions/approaches?
Emilio