Yes, you're right. There are some special hacks in WoodyTemplateTransformer to insert the styling element inside the expansion of the widget element. Although possible, it would be ugly to recreate these hacks in a macro. Probably what I would do if I were planning to fix this is to not use widget.generateSAXFragment() at all, and replace its behavior with equivalent jx macro code.

Why can't you use WoodyTemplateTransformer?

Regards,

Chris

Oguz Kologlu wrote:

Hi all,

I'm using the latest 2.1 JXTemplateGenerator (cvs tag 1.30) and the JX Macros Christopher Oliver orignally wrote.

There appears to be a problem with widgets that contains styling information
when the jxtemplategenerator processes them.

eg:
<wt:widget id="notes">
 <wi:styling type="textarea" rows="4" style="width:100%"/>
</wt:widget>

Will be processed as:

<wi:field id="notes" required="false"/>
<wi:styling type="textarea" rows="4" style="width:100%"/>

(NOTE: two seperate elements..)

It would appear that:

widget.generateSaxFragment(cocoon.consumer, locale)

in the macro is not outputing the <wi:styling ..> until
after it has finished processing <wt:widget ...> which then
results in the field being output as:

<input name="notes">

instead of the required:
<texterea name="notes">

Is there some workaround to this?

Thanks,
Oz


See full macro below: <jx:macro name="widget" \ targetNamespace="http://apache.org/cocoon/woody/template/1.0";> <jx:parameter \ name="id"/> <jx:set var="widget" value="${woodyCurrent.getWidget(id)}"/> <jx:choose> <jx:when test="${widget.getSize() != null}"> <!-- repeater --> <jx:set var="lastRow" value="${widget.getSize() - 1}"/> <jx:forEach varStatus="loop" begin="0" end="${lastRow}"> <jx:set var="woodyCurrent" value="${widget.getRow(loop.index)}"/> ${row.generateSaxFragment(cocoon.consumer, locale)} <jx:evalBody/> </jx:forEach> </jx:when> <jx:otherwise> ${widget.generateSaxFragment(cocoon.consumer, locale)} <jx:evalBody/> </jx:otherwise> </jx:choose> </jx:macro>








Reply via email to