You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Christopher Oliver <re...@verizon.net> on 2004/04/25 01:51:35 UTC

Re: JXTG jx:attribute

Leszek Gawron wrote:

>Sorry to bother you privately but I did not get the answer on cocoon group and
>I see you're the main JXTG developer.
>
>My question is: Is there any real reason that jx:attribute is not implemented?
>Something that would work as xsl:attribute or xsp:attribute to allow
>generation of dynamic content of an attribute?
>	lg
>
>  
>
Please direct all questions to the dev list. The only reason is that it 
seems hard to implement it efficiently. Consider:

<foo>
  <jx:attribute name="bar" namespace="http://www.bar.org" value="${bar}"/>
  <jx:if test="{$fubaz > 1}">
       <jx:attribute name="xyz" value="100"/>
   </jx:if>
   <jx:forEach var="item" items="${items}"/>
       <jx:attribute name="${item.name}" value="${item.value}"/>
   </jx:forEach>
   ...
</foo>

The start element event for <foo> must be buffered until all potential 
jx:attribute tags have been processed. Since these are within 
conditional blocks and loops determining when that is the case in an 
efficient way isn't easy.

Chris

Re: JXTG jx:attribute

Posted by Leszek Gawron <ou...@wlkp.org>.
On Sat, Apr 24, 2004 at 04:51:35PM -0700, Christopher Oliver wrote:
> Leszek Gawron wrote:
> 
> >Sorry to bother you privately but I did not get the answer on cocoon group 
> >and
> >I see you're the main JXTG developer.
> >
> >My question is: Is there any real reason that jx:attribute is not 
> >implemented?
> >Something that would work as xsl:attribute or xsp:attribute to allow
> >generation of dynamic content of an attribute?
> >	lg
> >
> > 
> >
> Please direct all questions to the dev list. The only reason is that it 
> seems hard to implement it efficiently. Consider:
> 
> <foo>
>  <jx:attribute name="bar" namespace="http://www.bar.org" value="${bar}"/>
>  <jx:if test="{$fubaz > 1}">
>       <jx:attribute name="xyz" value="100"/>
>   </jx:if>
>   <jx:forEach var="item" items="${items}"/>
>       <jx:attribute name="${item.name}" value="${item.value}"/>
>   </jx:forEach>
>   ...
> </foo>
> 
> The start element event for <foo> must be buffered until all potential 
> jx:attribute tags have been processed. Since these are within 
> conditional blocks and loops determining when that is the case in an 
> efficient way isn't easy
After a longer thinking it really does not look so easy. As it is not known if
an element has dynamic attributes or not the start element on the output would
have to be postponed for EVERY elemeny till we reach startElement for a child
node a endElement for current one.

Still I do not see any efficiency issuses here: only one element has to be
cached so it does not impart neither speed nor memory requirements.
	lg

-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/       ouzo@wlkp.org           _\\()//_
         .'/()\'.     Phone: +48(501)720812     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


Re: JXTG jx:attribute

Posted by Leszek Gawron <ou...@wlkp.org>.
On Sat, Apr 24, 2004 at 04:51:35PM -0700, Christopher Oliver wrote:
> Leszek Gawron wrote:
> 
> >Sorry to bother you privately but I did not get the answer on cocoon group 
> >and
> >I see you're the main JXTG developer.
> >
> >My question is: Is there any real reason that jx:attribute is not 
> >implemented?
> >Something that would work as xsl:attribute or xsp:attribute to allow
> >generation of dynamic content of an attribute?
> >	lg
> >
> > 
> >
> Please direct all questions to the dev list. The only reason is that it 
> seems hard to implement it efficiently. Consider:
> 
> <foo>
>  <jx:attribute name="bar" namespace="http://www.bar.org" value="${bar}"/>
>  <jx:if test="{$fubaz > 1}">
>       <jx:attribute name="xyz" value="100"/>
>   </jx:if>
>   <jx:forEach var="item" items="${items}"/>
>       <jx:attribute name="${item.name}" value="${item.value}"/>
>   </jx:forEach>
>   ...
> </foo>
> 
> The start element event for <foo> must be buffered until all potential 
> jx:attribute tags have been processed. Since these are within 
> conditional blocks and loops determining when that is the case in an 
> efficient way isn't easy.
It looks like you have to buffer <foo> until you reach another startElement or
get a endElement for </foo>.Am I missing sth?
	lg
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/       ouzo@wlkp.org           _\\()//_
         .'/()\'.     Phone: +48(501)720812     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |