This problem has come up before, but I don't recall seeing
this solution. Thought it might be useful or generate 
other thoughts (plus by depositing it here I will remember
where it is).

I needed to output data from an element containing an 
unescaped html anchor in a form output field (string 
datatype) and have the anchor appear as html. The form 
template is jx generated. I wasn’t able to spend enough 
time with the jx:set/jx:out method proposed a few months
ago: 
(http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=115407676302253&w=2)

to get it to work. However, I found that the html tag would

show up as desired if I serialized the data at binding.
.

The javascript flow is the a pipeline-generated DOM for the

data to be bound:
 var pipelineUtil =
cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
 var document = pipelineUtil.processToDOM(documentURI,
bizdata);
 cocoon.disposeObject("pipelineUtil");
 currentForm.load(document);  // simple binding
 
In the binding file, use javascript to bind the data:
 <fb:javascript id="Description" path="Description">
   <fb:load-form>
     // XMLUtils class is imported in the binding.js file
     var props = XMLUtils.createPropertiesForXML(true);
//no xml declaration  
     var formValue =
XMLUtils.serializeNode(jxpathPointer.getNode(), props);
     widget.setValue(formValue);
   </fb:load-form>
 </fb:javascript>

In the form template, use the normal widget for output. 
 <linkedText>
   <ft:widget id="Description" />
 </linkedText>
 
I wrapped the widget in a custom tag to escape the output
in
a downstream stylesheet so linked text shows up and css can

be applied: 
  <xsl:template match="linkedText">
     <linkedText>
        <xsl:value-of select="."
disable-output-escaping="yes"/>
     </linkedText>
  </xsl:template>

This was tested on 2.1.9 and BRANCH_2_1_X with the newjx 
transformer.


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

Reply via email to