|
Re: Using 'dump.jet' for sub-files [message #64462 is a reply to message #64304] |
Tue, 14 July 2009 11:29 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Paul Elder![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=pelder%40ca.ibm.com) Messages: 849 Registered: July 2009 |
Senior Member |
|
|
Aart:
I'll start with the syntactic:
You wrote:
> ... The following Java code is used to set the build-path:
> <%
> String s1 =
> " {$org.eclipse.jet.resource.parent.projectRelativePath}/{$c/@ model}/ ";
> String s2 = (String) context.getVariable("x0");
> String myName = s1 + s2 + ".xml";
> %>
> And this is the code that does not pick up the varable 'myName':
> <ws:file template="templates/dump.jet" path="{$myName}"/>
The JET compiler produces Java code. Any Java code in <% %>, <%! %> or <%=
%> is written verbatim to that class - embedded XPath expressions are not
processed in embedded Java code.
So, rewrite you template like this:
<c:setVariable var="myName" select="
'{$org.eclipse.jet.resource.parent.projectRelativePath}/{$c/ @model}/{$x0}.xml'
" />
As for keeping track of your loaded models, I suggest creating a unique
variable for each loaded model, and store the variable name as an
annotation on the model element used to load the model:...
<%-- create a unique variable for the model load and
store is as the @cmodelVar attribute on $c --%>
<c:set select="$c" name="cmodelVar">cmodel<f:unique/></c:set>
<c:load
url=" {$org.eclipse.jet.resource.parent.projectRelativePath}/{$c/@ model} "
var="{$c/@cmodelVar}"/>
Each time you go through the above code, you'll get a different value for
'cmodelVar': cmodel0, cmodel1, cmodel2, ...
Then, in your dump.jet (I'm making the uber-dump XML format up - adjust as
needed):
<all>
<%-- dump the main model --%>
<c:dump select="/*" format="true" entities="true"/>
<%-- dump the cmodel models' --%>
<c:iterate select="...." var="c">
<cmodel var="<c:get select="$c/@cmodelVar"/>">
<c:dump select="$ {$c/@cmodelVar}/*" format="true" entities="true"/>
</cmodel>
</c:iterate>
</all>
Paul
|
|
|
|
Powered by
FUDForum. Page generated in 0.03162 seconds