Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » JET2 - multiple input models
JET2 - multiple input models [message #9882] Tue, 03 April 2007 04:30 Go to next message
Eclipse User
Originally posted by: kim-chi.nguyen.velsys.com

Hi All,

I'm new to JET2 and have been following IBM's tutorial
http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/

I would like to know if it is possible to have more than one input model to
a template?

I have the following models:

1) profileA.xml
<app name="profileA">
<component name="c1"/>
<component name="c2"/>
</app>

2) component1.xml
<app name="c1">
<property name="p1" value="x"/>
<property name="p2" value="y"/>
</app>

Am I able to access the attributes(p1, p2, x, y) of component1.xml, given
that I can extract the attribute c1, from profileA.xml in my template file?

Is it possible to build up an input model incrementally like this,
consisting of many *.xml files?

When I go to Run > JET Transformation, I can only enter one file in the
"Transformation Input" field.

Regards,
Kim-Chi
Re: JET2 - multiple input models [message #9954 is a reply to message #9882] Wed, 04 April 2007 08:47 Go to previous messageGo to next message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
Kim-Chi:

There is no direct way to feed JET multiple models. However, JET is capable,
via its tag library of loading and navigating multiple models - see the
c:load tag.

You have several design choices:

1) infer additional input models from the specified input. For example,
given profileA.xml, you might decide that you will load c1.xml and c2.xml.

2) make additional input models explicit. For example, in profileX.xml,
have:
<app name="profileA">
<component name="c1" model="component1.xml"/>
<component name="c2" model="component2.xml"/>
</app>

As for using c:load in either circumstance, you need to compute the correct
value for the 'url' attribute. Any relative URL passed will be treated as a
workspace path (project name + path). JET has a number of predefined
variables describing the model loaded at startup. In particular,
$org.eclipse.jet.resource.parent.fullPath is the workspace path of the input
model's container. So, in the second case, you could do:

<c:load
url=" {$org.eclipse.jet.resource.parent.fullPath}/{$component/@mod el} "
var="component"/>

Paul


"Kim-Chi" <kim-chi.nguyen@velsys.com> wrote in message
news:eut3c8$45f$1@build.eclipse.org...
> Hi All,
>
> I'm new to JET2 and have been following IBM's tutorial
> http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/
>
> I would like to know if it is possible to have more than one input model
> to
> a template?
>
> I have the following models:
>
> 1) profileA.xml
> <app name="profileA">
> <component name="c1"/>
> <component name="c2"/>
> </app>
>
> 2) component1.xml
> <app name="c1">
> <property name="p1" value="x"/>
> <property name="p2" value="y"/>
> </app>
>
> Am I able to access the attributes(p1, p2, x, y) of component1.xml, given
> that I can extract the attribute c1, from profileA.xml in my template
> file?
>
> Is it possible to build up an input model incrementally like this,
> consisting of many *.xml files?
>
> When I go to Run > JET Transformation, I can only enter one file in the
> "Transformation Input" field.
>
> Regards,
> Kim-Chi
>
Re: JET2 - multiple input models [message #10090 is a reply to message #9954] Thu, 05 April 2007 09:31 Go to previous message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
FYI.

The predefined XPath variables that JET provides are found in the EMFT JET
Developer's guide:

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. jet.doc/references/xpath/predefinedVariables.xhtml

Paul

"Paul Elder" <pelder@ca.ibm.com> wrote in message
news:ev06ol$qou$1@build.eclipse.org...
> Kim-Chi:
>
> There is no direct way to feed JET multiple models. However, JET is
> capable, via its tag library of loading and navigating multiple models -
> see the c:load tag.
>
> You have several design choices:
>
> 1) infer additional input models from the specified input. For example,
> given profileA.xml, you might decide that you will load c1.xml and c2.xml.
>
> 2) make additional input models explicit. For example, in profileX.xml,
> have:
> <app name="profileA">
> <component name="c1" model="component1.xml"/>
> <component name="c2" model="component2.xml"/>
> </app>
>
> As for using c:load in either circumstance, you need to compute the
> correct value for the 'url' attribute. Any relative URL passed will be
> treated as a workspace path (project name + path). JET has a number of
> predefined variables describing the model loaded at startup. In
> particular, $org.eclipse.jet.resource.parent.fullPath is the workspace
> path of the input model's container. So, in the second case, you could do:
>
> <c:load
> url=" {$org.eclipse.jet.resource.parent.fullPath}/{$component/@mod el} "
> var="component"/>
>
> Paul
>
>
> "Kim-Chi" <kim-chi.nguyen@velsys.com> wrote in message
> news:eut3c8$45f$1@build.eclipse.org...
>> Hi All,
>>
>> I'm new to JET2 and have been following IBM's tutorial
>> http://www-128.ibm.com/developerworks/opensource/library/os- ecl-jet/
>>
>> I would like to know if it is possible to have more than one input model
>> to
>> a template?
>>
>> I have the following models:
>>
>> 1) profileA.xml
>> <app name="profileA">
>> <component name="c1"/>
>> <component name="c2"/>
>> </app>
>>
>> 2) component1.xml
>> <app name="c1">
>> <property name="p1" value="x"/>
>> <property name="p2" value="y"/>
>> </app>
>>
>> Am I able to access the attributes(p1, p2, x, y) of component1.xml,
>> given
>> that I can extract the attribute c1, from profileA.xml in my template
>> file?
>>
>> Is it possible to build up an input model incrementally like this,
>> consisting of many *.xml files?
>>
>> When I go to Run > JET Transformation, I can only enter one file in the
>> "Transformation Input" field.
>>
>> Regards,
>> Kim-Chi
>>
>
>
Previous Topic:Re: Suppress rather than override static JET templates
Next Topic:Calling JET Transform from RCP application
Goto Forum:
  


Current Time: Sat Apr 19 02:58:59 EDT 2014

Powered by FUDForum. Page generated in 0.01554 seconds