cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ricardo Rocha <rica...@apache.org>
Subject Re: C2 XSP SQL taglib
Date Fri, 01 Sep 2000 23:51:17 GMT
Stefano Mazzocchi wrote:
> All right. So this means that you have
> 
>  <xsp:element>
>   <xsp:element-name><xsp:expr>someMethod()</xsp:expr></xsp:element-name>
>   <xsp:attribute>
> 
> <xsp:attribute-name><xsp:expr>someAttMethod()</xsp:expr></xsp:attribute-name>
>    <xsp:expr>someOtherAttMethod()</xsp:expr>
>   </xsp:attribute>
>   <xsp:expr>someOtherMethod()</xsp:expr>
>  </xsp:element>
> 
> if you have both name and content of both element and attribute dynamic.
> 
> Is this correct?
> 
> Ricardo, please speak up on this since I understand it but still don't
> like it at all, it's all but elegant. :/

I definitely think XSP should allow for this level of dynamism!
There are many scenarios where you may legitimatelly need to choose a
tagname dynamically at request time.

There are valid cases where a namespaces and tagnames themselves may
be parameters to some XSP dynamic tag. Let's consider, for example,
Donald's SQL logicsheet and processor, where the user specifies what
namespace and tagname he wants to use to wrap his database stuff.

We may also consider XSLT's own use of <xsl:element> where attribute
name can take a dynamic XPath expression:

  <xsl:element name="{@tagname}">...</xsl:element>

Since XSP doesn't support XSLT's {...} idiom inside attributes, we
may need to do something like:

  <xsp:element namespace="http://localhost/foo">
    <xsp:name><xsp:expr>
      "new" + tagName
    </xsp:expr></xsp:name>
  </xsp:element>

==========================================================================
Stefano Mazzocchi wrote:
> 
> Donald Ball wrote:
> >
> > On Fri, 1 Sep 2000, Stefano Mazzocchi wrote:
> >
> > > 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.
> >
> > normal syntax is:
> >
> > <xsp:element name="foo"/>
> >
> > but we want the name to be possibly chosen at runtime. this could work:
> >
> > <xsp:element>
> >  <xsp:element-name>...</xsp:element-name>
> > </xsp:element>
> >
> > e.g.
> >
> > <xsp:element>
> >  <xsp:element-name><xsp:expr>rs.getString(1)</xsp:expr></xsp:element-name>
> > </xsp:element>
> >
> > yeah, it's ugly, but then again, this isn't a feature we're going to be
> > encouraging people to use (i think we can all agree on that).
> 
> All right. So this means that you have
> 
>  <xsp:element>
>   <xsp:element-name><xsp:expr>someMethod()</xsp:expr></xsp:element-name>
>   <xsp:attribute>
> 
> <xsp:attribute-name><xsp:expr>someAttMethod()</xsp:expr></xsp:attribute-name>
>    <xsp:expr>someOtherAttMethod()</xsp:expr>
>   </xsp:attribute>
>   <xsp:expr>someOtherMethod()</xsp:expr>
>  </xsp:element>
> 
> if you have both name and content of both element and attribute dynamic.
> 
> Is this correct?
> 
> Ricardo, please speak up on this since I understand it but still don't
> like it at all, it's all but elegant. :/

Mime
View raw message