Hi Harry
Thanks so much for the answer, it makes my life a hell of a lot easier. Boy,
it was that easy to make it work. Too bad the Cocoon 1-FAQ (which everybody
quotes, even when people are using Cocoon 2), states:
The easiest way is
to simply replace <xsp:expr> with
<util:include-expr> (making sure to declare the util logicsheet namespace
in your <xsp:page> tag - instructions for this can be found in the XSP
documentation). You must either use the form <util:include-expr
expr="constant string"/> for literals or
<util:include-expr><util:expr>mymethod()</util:expr>
</util:include-expr> for methods and expressions which evaluate
to strings. However this is not necessarily the most efficient way, because it
invokes the installed XML parser to parse the string into an in-memory
representation used throughout Cocoon 1.x called a DOM (Document Object Model)
.
Best regards,
Jan Nielsen
> -----Oprindelig
meddelelse-----
> Fra: Lai, Harry [mailto:[EMAIL PROTECTED]]
>
Sendt: 16. februar 2002 00:04
> Til: '[EMAIL PROTECTED]'
>
Emne: RE: Again, why doesn't the util stylesheet work???
>
>
>
Hi Jan,
>
> You need to wrap your method call in an <xsp:expr>
element. So
> it would be:
>
>
<util:include-expr><util:expr>
>
<xsp:expr>mymethod()</xsp:expr>
>
</util:expr></util:include-expr>
>
> Hope that
helps!
>
> Harry
>
> -----Original Message-----
>
From: Jan Normann Nielsen [mailto:[EMAIL PROTECTED]]
> Sent:
Friday, February 15, 2002 4:53 PM
> To: Cocoon-users
> Subject:
Again, why doesn't the util stylesheet work???
>
>
> Hello
everybody
>
> I've seen many postings on problems with the
util-stylesheet. I
> can't get it
> to work. According to many posts
(and the Cocoon 1 FAQ), you want
> me to use:
>
>
<util:include-expr><util:expr>mymethod()</util:expr></util:include-expr>
>
>
to have the result of mymethod() output without HTML escaping. If that's
>
correct, shouldn't this example work?
>
> <?xml version="1.0"
encoding="ISO-8859-1"?>
> <xsp:page
>
language="java"
>
xmlns:util="http://apache.org/xsp/util/2.0"
>
xmlns:xsp="http://apache.org/xsp"
> >
>
<xsp:logic>
>
private String mymethod() { return
"<![CDATA[<body><h1>Test
>
page</h1></body>]]>"; }
>
</xsp:logic>
>
>
<html>
>
>
<util:include-expr><util:expr>mymethod()</util:expr></util:include-expr>
>
</html>
>
</xsp:page>
>
> In Cocoon 2.0, I get the following
error:
>
>
E:\Arbejde\JBoss-2.4.3_Tomcat-4.0\catalina\work\localhost\cocoon\c
>
ocoon-file
>
s\org\apache\cocoon\www\file_\E_\arbejde\test\cocoon_2_0_sub\sub\d
>
ocs\simple
> _xsp.java:111: ')'
expected.
>
new
>
StringReader(String.valueOf(this.characters("mymethod()");)));
>
>
Why doesn't it work???
>
> Best regards,
> Jan
Nielsen
>
>
>
>
>
---------------------------------------------------------------------
>
Please check that your question has not already been answered in the
> FAQ
before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To
unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For
additional commands, e-mail:
<[EMAIL PROTECTED]>
>
>
---------------------------------------------------------------------
>
Please check that your question has not already been answered in the
> FAQ
before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To
unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For
additional commands, e-mail:
<[EMAIL PROTECTED]>
>
>