AnsweredAssumed Answered

Using 'rendition-destination-node' parameter

Question asked by swithun on May 19, 2010
I'd like to pass a node to an XSLT rendering definition, as the destination of the transformation. I can use destination-path-template no problem. But when I use rendition-destination-node, I get this error:

Failed to create content due to error: 04190028 Failed to execute script 'workspace://SpacesStore/153e54e1-a642-4da1-8c19-190d78b029e2': 04190027 A rendition of type: {http://www.alfresco.org/model/content/1.0}adHocRenditionDef should have been created for source node: workspace://SpacesStore/07cbdcab-3326-4cd5-a681-0a167a440938

The code is this Javascript rule:

var renditionDefName = "cm:adHocRenditionDef";
var renderingEngineName = "xsltRenderingEngine";
var xsltNode = "workspace://SpacesStore/6d01184c-50ce-4d2b-bc66-bb83e72735b0";

var props = new Array();
props["cm:name"] = document.name + ".rendered";
props["cm:title"] = "rendered version";

var renderedNode = document.createNode(null, "cm:content", props, "rps:rendered");

var renditionDef = renditionService.createRenditionDefinition(renditionDefName, renderingEngineName);
renditionDef.parameters["template_node"] = search.findNode(xsltNode);
renditionDef.parameters["rendition-destination-node"] = renderedNode;

renditionDef.execute(document);

The aim is to create a child node of the current document, and then populate the child node with an XSLT rendering of the document. I don't know if this is connected to a problem I've described in this other thread to do with child associations. Is there a better way to achieve my aim?

Outcomes