AnsweredAssumed Answered

Freemarker Template Process XML Document

Question asked by parrym on Aug 26, 2009
Latest reply on Aug 27, 2009 by parrym
I am having trouble processing an XML document with a Freemarker template within a Web Script. I have given a stripped down example below:

var doc1 = userhome.createFile("transform_me4.txt");
doc1.mimetype = "text/xml";
doc1.content = "<category><article>see me</article></category>";;
var temp1 = "<h3>Can you ${category.article}</h3>";
var result = doc1.processTemplate(temp1);
model.result = result;


Message:   07260344 Wrapped Exception (with status template): 07260343 Failed to execute script '/schema/getContent.get.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts)': 07260342 Error during processing of the template 'Expression category is undefined on line 1, column 15 in string://fixed.'. Please contact your system administrator.
Exception:   freemarker.core.InvalidReferenceException - Expression category is undefined on line 1, column 15 in string://fixed.

I also have a problem including
<#assign doc = alf.parseXMLDocument(article.include_portal)>
as alf is undefined.

My xml file and ftl template work in a web form, is there a way to emulate that with a webscript?