Jason Johnston wrote:
So what you're wanting is a way to take the String contents of a form
widget and have it parsed into SAX events and inserted into the SAX
stream, correct?  Note that it's not as simple as just disabling escaping
of XML characters, because that's just a serialization concern, whereas
you want to actually have it parsed into SAX.  AFAIK there is no way using
the standard <ft:widget> mechanism or XSLT to achieve this.

I think JXTemplate is going to be your best bet.  I'm assuming you're
already using JXTemplateGenerator in your display pipeline; if you're
using FormsTemplateTransformer instead then I'd suggest switching to JX
(it's the preferred method nowadays).  Then you've got a couple choices:

1) If you're using the JX implementation from the 'template' block (cocoon
2.1.9+ only), then you can use the xmlize="true" attribute of jx:out:

  <jx:set var="xhtmlString"
value='${widget.getChild("myOutputWidget").getValue()}' />
  <jx:out value="${xhtmlString}" xmlize="true" />

  
Yes, I'm using 2.1.9 with the NewJXTemplategenerator. I didn't know of the the xmlize feature. It looks like the right approach, but it does not work because I use the widget in a repeater row. I get the following errors:

org.xml.sax.SAXParseException: Content is not allowed in prolog.

Fatal error parsing null (line 1 col. 1): Content is not allowed in prolog.
context://forms/firmenEditIITemplate.xml - 349:72

Fatal error parsing null (line 1 col. 1): Content is not allowed in prolog.
resource://org/apache/cocoon/forms/generation/jx-macros.xml - 241:27

{http://apache.org/cocoon/forms/1.0#template}repeater-rows: Fatal error parsing null (line 1 col. 1): Content is not allowed in prolog.
context://forms/firmenEditIITemplate.xml - 336:29

{http://apache.org/cocoon/forms/1.0#template}repeater-rows: Fatal error parsing null (line 1 col. 1): Content is not allowed in prolog.
resource://org/apache/cocoon/forms/generation/jx-macros.xml - 232:23

{http://apache.org/cocoon/forms/1.0#template}repeater: {http://apache.org/cocoon/forms/1.0#template}repeater-rows: Fatal error parsing null (line 1 col. 1): Content is not allowed in prolog.
context://forms/firmenEditIITemplate.xml - 324:38


Seams like the repeater makes it a little bit more complicated. Maybe I should explain why I want to put raw HTML in a repeater-widget. I use the repeater to let the user add comments to a form just like in the daisy cms at the bottom of each page. The user can edit and delete his comments. That is why I use the repeater to display the comment (=HTML) with the necessary buttons to edit and delete each comment.
Thanks for your help Jason!

Regards
Werner

2) If you're using the old JX implementation then you should be able to do
something similar, but you have to manually create an XMLizable object
from the String value first (cocoon provides a handy StringXMLizable class
for this purpose):

  <jx:set var="xhtmlString"
value='${widget.getChild("myOutputWidget").getValue()}' />
  <jx:out
value="${Packages.org.apache.cocoon.xml.StringXMLizable(xhtmlString)}"
/>

Hope that helps
--Jason


  
Thanks for your answer. But I found out that the contents of the fields
are already escaped before the stylesheets get applied. So the problem
is somewhere else.

Werner


Jeroen Reijn wrote:

    
Hi Werner,

i'm not sure, but you could modify the xsl that applies the output
widget and add something like:

<xsl:value-of select="fi:value" disable-output-escaping="yes"/>

I hope this helps.

Regards,

Reijn


werner wrote:

      
Dear Mailinglist!

I know this has been asked before, but I could not find a clean
solution. How can I display HTML in a output widget and prevent
escaping? i.e. <br/> should not be converted to &lt;br/&gt;

Thanks you
Werner

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

        
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

      
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


    



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  

Reply via email to