cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: C2 XSP SQL taglib
Date Fri, 01 Sep 2000 12:00:39 GMT
Per Kreipke wrote:
> 
> Donald, Stefano,
> 
> > > Interesting. I've been discussing with Ricardo a lot about this and I
> > > could not come up with a reasonable suggestion of something that
> > > required this functionality....
> > >
> > > But I'm open to change this for XSP 1.1 if you provide me with such
> > > meaningful example.
> > >
> > > To me, a compiled time element and attribute names means that you are
> > > looking for semantic troubles because you loose the contract between you
> > > and the stylesheet (unless, the stylesheet was written to use all
> > > possible cases of the result of the dynamic element name).
> >
> > simple example - suppose i want to use the column names of a sql query as
> > the names of the elements, and i don't want to have to type out all of the
> > columns. i might want to do this:
> >
> > <esql:execute-query>
> >  <esql:query>select * from department_table</esql:query>
> >  <esql:results>
> >   <esql:get-columns/>
> >  </esql:results>
> > </esql:execute-query>
> >
> > instead of
> >
> > <esql:execute-query>
> >  <esql:query>select * from department_table</esql:query>
> >  <esql:results>
> >   <id><esql:get-integer/></id>
> >   <name><esql:get-string/></name>
> >  </esql:results>
> > </esql:execute-query>
> >
> > i can conceive of people wanting that feature, and wanting it very much.
> > me, i'd say you get more flexibility using the latter approach, and it's
> > not really that much extra typing, but if i had a fifty column table, i
> > can see where it would be handy.
> 
> A concrete example of this would be a XSP script which displays database
> tables in their entirety. I would suggest a common (and more useful) example
> than the first one above is:
> 
> <xsp:page>
>  <mytable>
>   <esql:execute-query>
>    <esql:query>select * from <request:get-parameter
> name="table"/></esql:query>
>    <esql:results>
>     <esql:get-columns/>
>    </esql:results>
>   </esql:execute-query>
>  </mytable>
> </xsp:page>
> 
> Passing the table name as an argument generalizes the function. I use
> similar things under IIS/ASP and other platforms to view database tables in
> my browser. Sure, if there was a column that needed interpretation because
> of its type, this wouldn't handle it well. That's when I'd specialize the
> XSP file.
> 
> I'd use something similar to this to display the table (without specifics):
> 
> <xsl:template match="/*">
>   <xsl:if test="position() = first()">
>      <!-- header row with column names -->
>   </xsl:if>
>   <xsl:value-of select="name(.)"/>: <xsl:value-of
> select="."/></xsl:value-of>
> </xsl:template>
> 
> I don't think everyone will use Cocoon for externally viewed pages. We may
> be using Cocoon to compose XML documents behind our webserver to be styled
> either at the client or by another process on the webserver. I think the
> ability to use Cocoon in this fashion, with loose 'contracts' between the
> stages in the pipeline, is also valuable.

Hmmmm, interesting concept.

Well, to follow the exact terminology, there is no such thing as a
"loose contract": a contract is either there or not. It's digital not
analog.

But on the other hand, I totally understand what you are saying: in your
sense, a loose contract is something that is based on the "logic" rather
than on the "schema".

This is the interesting concept and, admittedly, I've been blinded by a
"every contract is a schema" anti-pattern.

Ok, I'm convinced... now we can talk about how to implement this in XSP.

Proposals welcome.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message