cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject Re: XSP -> XSLT -> XSP
Date Tue, 14 Nov 2000 17:26:36 GMT
Berin Loritsch wrote:

> > Is it possibile to have an XSP page that produces another XSP page via
> > an XSLT stylesheet and have this second page processed automatically,
> > possibly transforming its output again via XSLT to produce HTML?
> >
> > This would be something like the clean-page sample, the only difference
> > being that the starting page is an XSP document and not a static file.
> 
> With Cocoon 1, it would be possible.  With Cocoon 2 it is not possible
> by design.  Basically you are forcing the server to do a whole lot more
> work than it has to using that approach.  Things that would be better
> served with Session variables and state management shouldn't require
> a recompile every access.  When you consider that the average compile
> on an Athlon 700 with 256 MB of RAM costs you up to 3 seconds per access,
> and on an P-II 233 with 128 MB of RAM costs you up to 20 seconds per
> access, it really isn't as elegant as it might originally seem.

I agree that it is neither elegant nor fast. I just would like to know
if it is possible at all, since even using Cocoon 1.8, if I have an XSP
page that is transformed into another XSP page by inserting 

<xsl:preocessing-instruction
name="cocoon-process">type="xsp"</xsl:processing-instruction>

and such, like in the clean-page example, what happens is that Cocoon
tries to loop forever, apparently processing the first XSP page again
and again, until I kill it.

> In short, rethink the purpose of what you are trying to do.  What is
> changing between XSP layers?  Is there any way you can merge all logic
> into one layer, and then transform out unneeded elements?

I'll explain what I am trying to accomplish. I have an LDAP repository
that stores connection info for a group of Oracle databases (hostname,
SID, username, password, etc.). I need to fetch these LDAP entries,
execute an SQL query against each one of the databases and format the
results ad a series of tables in a single HTML (or PDF) document.

For the LDAP part, I have a taglib derived from the one posted here by
Renzo Estrella. For the SQL part, I plan to use Donald Ball's ESQL
Taglib.

My question basically is: how do I reuse the value of the elements
generated by the LDAP taglib as content for the ESQL tags that specify
the JDBC connection parameters?

Keep in mind that I don't know in advance how many entries will I find
in the LDAP repository.

This is the LDAP query, more or less:

 <jndi:execute-query>
   <jndi:provider-url>ldap://localhost/</jndi:provider-url>
   <jndi:base>dc=cbim,dc=it</jndi:base>
   <jndi:scope>sub</jndi:scope>
   <jndi:filter>(objectclass=CBIMoracleInstance)</jndi:filter>
   <jndi:attributes>cn,description,hostName</jndi:attributes>
 </jndi:execute-query>

This produces results in DSML format, like this:

  <dsml:dsml>
    <dsml:directory-entries>
      <dsml:entry dn="...">
        <dsml:attribute name="hostName">
          <dsml:value>server1</dsml:value>
        </dsml:attribute>
        ...
      </dsml:entry>
      <dsml:entry dn="...">
        ...
      </dsml:entry>
       ...
    </dsml:directory-entries>
  </dsml:dsml>

How can I extract the value of the "hostName" attribute for every
returned entry, reuse it as the value of esql tags, possibly using a
single XSP page? I could use just the ESQL taglib and a lot of Java code
for the JNDI part, but it would be a duplication of efforts.

What do you think?

--
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it

Mime
View raw message