cancel
Showing results for 
Search instead for 
Did you mean: 

Run a simple XSL transform?

randomman
Champ in-the-making
Champ in-the-making
The quick question: What's the best way to run an XSL transform on an xml document held in the repository?

A bit of background…

My aim is to create a fully automated Word to xhtml transformation. I'm not worried about images and the one to many nature of that transform as I'm using it as a mark-up helper tool.

So far, I've got a word file going into Alfresco and xhtml being created. I also have an XSLT file that can transform auto-created xhtml into xhtml i'm happy with. Now I just need to fill in that missing link and run a transform inside Alfresco.

I was thinking I could run a script on the file as part of a content rule, but after taking another look at the Javascript API, it's looking like I can only use a FreeMarker template and not XSL.

Any thoughts, anyone?
3 REPLIES 3

gavinc
Champ in-the-making
Champ in-the-making
There are 2 ways you can do this, either implement a content transformer or implement a custom action.

Have a read of these 2 pages for further information:

http://wiki.alfresco.com/wiki/Content_Transformations
http://wiki.alfresco.com/wiki/Custom_Actions

randomman
Champ in-the-making
Champ in-the-making
I've already implemented a content transformer to do the DOC to XHTML conversion. I've solved the XSL problem by adding a line into my command line transformation script that uses xsltproc to apply XSL to the result of the previous transformation.

Using a Content Transformer for XSLT seems a bit bodgy though as I'll presumably need to set up a new one for each stylesheet I use. The Javascript API appears to have exactly what I need but only uses freemarker templates instead of freemarker or XSL:

string processTemplate(ScriptNode template)
Execute a FreeMarker template file against the node. The node is used as the context for the 'document' or 'space' object in the templating default model. The result of the template execution is returned as a string.

I guess Custom Actions must be the way forward although it seems a bit longwinded compared to using processTemplate. Are there any plans to add XSL transformation as a standard action?

gavinc
Champ in-the-making
Champ in-the-making
I don't believe so but feel free to add it is a new feature request on JIRA.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.