cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich Mayring <u...@denic.de>
Subject Complex: how to do SQL and dynamic XSP?
Date Tue, 29 Aug 2000 16:20:23 GMT
Hi folks,

up to now either the SQL processor or the SQL taglib has worked for me,
but now they're both out of luck. Here's the situation:

I have a pure XML file, whose stylesheet creates a dynamic XSP file,
whose stylesheet is a regular XSLT file producing HTML. This is modelled
after the clean-page.xml sample. Now I want to do an SQL query. Here's
what I tried:

1) Use the SQL processor in the XML file. Returns the correct result the
first time it is called, after that the result never changes. Why?
Because the SQL processor runs, its result is forwarded to the dynamic
XSP page, which is compiled and cached. The second time around cocoon
pulls the old XSP page from the cache, because no files in this workflow
have changed. The XSP file, however, contains the result of the query,
not the query itself (due to the SQL processor running first).

2) Use the SQL taglib in the XML file, thereby making it an XSP file.
Result: cocoon hangs. This is probably because it first compiles the
original XSP page with the SQL taglib instructions and writes them to
the repository. Then it makes the XSP pass accessing the database, which
still works probably. Then comes the XSLT pass, which really creates a
dynamic XSP page. This dynamic XSP page can't be compiled anymore,
because it has the same name as the already existing XSP file in the
repository. I deduced that from the fact the .java file in the
repository contains the XSP code from the first XSP file, but not the
code from the dynamically generated XSP. Also, dynamically generated XSP
files always have the name of the original XML file - not a problem if
they are not XSP, but, apparently one if they are.

3) Use the SQL taglib in the dynamically generated XSP. To that end I
put a tag <myquery/> in the original XML and made a template of that
name in its XSL stylesheet (which also generates the dynamic XSP). In
that template I wrote my <sql:execute-query> thing. Result: The
<sql:execute-query> tags are included in the output as text nodes.
Probably obvious, because the stylesheet generates tags and in between
executes Java - but it cannot execute a taglib. For this route to work
I'd probably have to include the pure Java code that would be generated
by the XSP processor, if it were given the <sql:execute-query> tags. Not
neat, especially if you have to change the query now and then :-)

4) Generate SQL processor tags and a processing instruction for the SQL
processor in the dynamic XSP. Result: The SQL processor's <query> tag is
not evaluated and sent unchanged to the output. I believe this is my
best chance, because at least the <query> tag is generated correctly,
but the processing instruction seems in the wrong place. I put it before
(and after) the XSP processing instruction in the dynamically generated
XSP. Strangely, the XSP PI gets executed, but not the SQL processor PI.

So, am I missing something or is this the end of the line?

Well, of course the easiest thing would be to forego generating dynamic
XSP entirely and go back to regular XSP pages. But I'd really prefer to
keep my source files pure XML. I have a pretty large investment in pure
XML source files and it would be a dreadful amount of work to convert
everything into XSP files.

Anyway, I hope you guys are not getting fed up with the esoteric
problems I keep digging up... thanks very much in advance for any
pointers,

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

Mime
View raw message