Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » Recommended approach for generating XHTML from model data at runtime - XSLT/Xpand/?
Recommended approach for generating XHTML from model data at runtime - XSLT/Xpand/? [message #528231] Mon, 19 April 2010 14:46 Go to next message
Eclipse UserFriend
Hi,

what approach do you recommend for generating XHTML documents from a EMF model instances
at runtime? So far I have tried:

- XSLT: As of now, I'm serializing the model to a XMLResource and use the resulting
document as input for an XSLT transformation, mainly because I had a set of existing XSLT
templates before I started to utilize EMF to define the input data structure. This works,
but gets tricky as soon as there are references because I found no way to follow these in
a XSLT template.

- Xpand: I tried to use Xpand to cut down the additional transformation step and directly
work with the model data. Is it possible to use Xpand as template engine at runtime
independent from code generation / generator workflows? Is there an API / examples how to
apply a .xpand template to a model instances? I found org.eclipse.xpand2.Generator but
this doesn't look like a class that is supposed to be used outside of generator steps
executed in the IDE.

- Anything else which is better suited for this task?

Greetings,

Ralf


--
Learn how to contribute to Eclipse here: http://eclipse.org/contribute/
Read my Blog here: http://www.ralfebert.de/blog/
Follow me on Twitter here: http://twitter.com/ralfebert/
Re: Recommended approach for generating XHTML from model data at runtime - XSLT/Xpand/? [message #528238 is a reply to message #528231] Mon, 19 April 2010 15:33 Go to previous messageGo to next message
Eclipse UserFriend
Hello Ralf,

you can call Xpand without a workflow using the XpandFacade Class. A sample usage was shown by Peter Friese in his Blog http://www.peterfriese.de/using-xpand-in-your-eclipse-wizard s/

~Christian
Re: Recommended approach for generating XHTML from model data at runtime - XSLT/Xpand/? [message #528288 is a reply to message #528238] Mon, 19 April 2010 19:14 Go to previous message
Eclipse UserFriend
Hi Christian,

> you can call Xpand without a workflow using the XpandFacade Class. A
> sample usage was shown by Peter Friese in his Blog
> http://www.peterfriese.de/using-xpand-in-your-eclipse-wizard s/

thanks, works great!

btw, I wrote a little utility bundle for my specific use case so I can set up XpandFacade
easily & similar to a template engine:

XpandTemplateEngine engine = new XpandTemplateEngine();
engine.addPackages(SomePackage.eINSTANCE);
engine.generate(this.getClass(), "MyTemplate::main", myEmfObject, new File("/tmp/output"));

http://github.com/ralfebert/de.ralfebert.xpand.engine

Greetings,

Ralf

--
Learn how to contribute to Eclipse here: http://eclipse.org/contribute/
Read my Blog here: http://www.ralfebert.de/blog/
Follow me on Twitter here: http://twitter.com/ralfebert/
Previous Topic:XPand for modifying arbitrary textfiles!
Next Topic:Using the xpand collection utilities from java
Goto Forum:
  


Current Time: Wed Jul 30 18:53:57 EDT 2025

Powered by FUDForum. Page generated in 0.03645 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top