Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] Controlling Whitespaces
[Xpand] Controlling Whitespaces [message #545893] Fri, 09 July 2010 14:32 Go to next message
Eclipse UserFriend
Originally posted by: pete.cheyne.yahoo.com

Hi,

I am wondering whether there is any good way to control the whitespaces
within an Xpand template. It seems to me that either the structure of
the template is readable _or_ it produces the output that you want, but
you cannot have both. Essentially, I am maybe looking for something that
allows me do it like in XSLT with the <xsl:text> </xsl:text> tags which
allow me to format the template as I like and just have the literal text
inbetween these tags. Or simply some other way to preserve the
control-flow structure within the template by formatting without
destroying the output.

All that I have read in the documentation is the pointer to use a pretty
printer, but such a pretty printer is not always available, especially
not as an MWE workflow component.

Do you know how Acceleo or Jet deal with this problem? Are they better
in this regard?

Cheers,
Peter
Re: [Xpand] Controlling Whitespaces [message #546567 is a reply to message #545893] Tue, 13 July 2010 11:50 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

I don't know of a good way to have both at the same time. The main
problem is that all text characters make their way to the file. A
debatable workaround is using the following:
a) put additional white spaces whithin the tags in order to achieve
indentation << IF expression->>
b) use dummy tags in order to achieve indentation whithout producing
white spaces in the output
<<"" ->>Text

A code beautifyer will almost always be the best alternative.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Previous Topic:[Xtend] Problem with JAVA Extension -> static initializer -> EFactory
Next Topic:[MWE2] How to run from command line?
Goto Forum:
  


Current Time: Fri Apr 26 06:42:32 GMT 2024

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

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

Back to the top