I don't think your construct would work in Cocoon 1.8.x. Here is what would work (notice the xsp:expr around o.getName()).
<tag>
<xsp:logic>
try {
<ns:list>
Collection list = ...
for (Iterator iterator = list.iterator();
iterator.hasNext();) {
MyObj o = (MyObj) iterator.next();
<ns:MyObj>
<ns:name><xsp:expr>o.getName()</xsp:expr></ns:name>
</ns:MyObj>
}
</ns:list>
}
catch(Exception e) {
<xsp:content>Error:
<xsp:expr>String.valueOf(e)</xsp:expr></xsp:content>
}
</xsp:logic>
</tag>
> -----Original Message-----
> From: Torsten Curdt [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 10, 2002 11:25 AM
> To: [EMAIL PROTECTED]
> Subject: XSP bug?
>
>
> Shouldn't the following construct work?
>
> ...
> <tag>
> <xsp:logic>
> try {
>
> <ns:list>
> Collection list = ...
>
> for (Iterator iterator = list.iterator();
> iterator.hasNext();) {
> MyObj o = (MyObj) iterator.next();
>
> <ns:MyObj>
> <ns:name>o.getName()</ns:name>
> </ns:MyObj>
>
> }
> </ns:list>
>
> }
> catch(Exception e) {
> <xsp:content>Error:
> <xsp:expr>String.valueOf(e)</xsp:expr></xsp:content>
> }
> </xsp:logic>
> </tag>
> ...
>
> Referring to some old C1 documentation
http://xml.apache.org/cocoon1/xsp.html
(paragraph "logic tags") this should work.
And I think this should work the same way in C2!
One could use <xsp:element> (like e.g. esql does) to work around this.
But that's a not quite nice sollution. Can we aggree that this should
work?
Unfortunately the current implementation will treat any java code
within a tag inside the xsp logic tag as text nodes - not as java.
If we can aggree that this behaviour is wrong I'd like to change
the xsp.xsl accordingly.
--
Torsten
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]