cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: C2 XSP SQL taglib
Date Thu, 31 Aug 2000 06:29:21 GMT
On Thu, 31 Aug 2000, Stefano Mazzocchi wrote:

> 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.

> Example:
> 
>  <xsp:element>
>  
> <xsp:element-name><xsp:expr>System.currentTimeMillis()</xsp:expr></xsp:element-name>
>   <xsp:element-value>Hello!</xsp:element-value>
>  </xsp:element>
> 
> will generate something like
> 
>  <4847099857984>Hello!</4847099857984>
> 
> How can you transform something like this?

<xsl:template match="/*">
 <xsl:value-of select="name(.)"/>: </xsl:value-of select="."/>
</xsl:template>

sure, it's inelegant, but it's certainly possible - just like the XSP used
to generate it.

> Ok, this is a pretty dense example, but this is a general thing: you
> don't want to let hooks for people to mess around with the XML schema
> which is your only contract with the rest of the pipeline stages.

suppose i _know_ that my sql or oql query is going to return data in the
format my schema expects? why make me do all of that extra typing?

i'm really not heavily opinionated or the other since _i_ don't think i'll
ever use the shortcut get-columns method myself (i'm a verbose kinda guy),
but i coded it in by manipulating the xsp dom objects directly. my concern
is that the xsp language is incomplete as it lacks this feature. the
purpose of xsp in this context is to transform a set of instructions into
a set of data at runtime, right? why inhibit the methods by which an xsp
page can achieve that?

- donald


Mime
View raw message