Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Xpand suppress return value output
Xpand suppress return value output [message #534171] Tue, 18 May 2010 05:39 Go to next message
Dennis  is currently offline Dennis
Messages: 2
Registered: May 2010
Junior Member
Hello everybody,

I'm quite new to this topic, and currently I am trying to create a small sample DSL for my Bachelor Thesis...

I succeeded in creating something like a Homepage-DSL for generating html files, and now I would like to develop another generator which creates .tex files from this Homepage DSL Model.

But I'm stuck with the problem of creating tex tables

The output of the generator should look something like:

\begin{tabular}{|l|l|}
Left upper corner&Right upper corner\\
Left lower corner&Right lower corner\\

This is a table with two columns => So i figured to use this:

«DEFINE column FOR Column»
«EXPAND element FOR elements.first()»
«elements.remove(elements.first())»
&«EXPAND element FOREACH elements»
«ENDDEFINE»

The problem is that elements.remove(elements.first()) will print [ ] to my tex code. How do I suppress this output?

Any idea? Thank you!

[Updated on: Tue, 18 May 2010 05:40]

Report message to a moderator

Re: Xpand suppress return value output [message #534187 is a reply to message #534171] Tue, 18 May 2010 06:20 Go to previous messageGo to next message
MaximeLecourt  is currently offline MaximeLecourt
Messages: 108
Registered: February 2010
Location: France
Senior Member
I don't really know how to help you, but you can use
elements.withoutFirst() instead of elements.remove(elements.first())

From my experience, [ ] is the sign of a List.

Can you paste what exact text output you get ?


One day I shall master M2T, but that day has yet to come...
Re: Xpand suppress return value output [message #534200 is a reply to message #534187] Tue, 18 May 2010 06:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6198
Registered: July 2009
Senior Member
Hello,

have a look at the xtend function toString("SeptaratorString") on a list so {"1","2"}.toStrring("&") delivers 1 & 2

on the other hand why don't you use the SEPARATOR flag on expand:

<<EXPAND element FOEACH elements SEPARATOR "&">>

~Christian
Re: Xpand suppress return value output [message #534231 is a reply to message #534171] Tue, 18 May 2010 08:37 Go to previous message
Dennis  is currently offline Dennis
Messages: 2
Registered: May 2010
Junior Member
@Maxime & Christian

Thank you so much for your quick response!

Both approaches solved my problem!
Previous Topic:[JET] how to show the details in progress bar
Next Topic:[check]
Goto Forum:
  


Current Time: Wed Aug 20 14:50:44 EDT 2014

Powered by FUDForum. Page generated in 0.01692 seconds