c:set with xpath expression value [message #43259] |
Sat, 15 March 2008 13:02  |
Eclipse User |
|
|
|
Hey,
while visiting my UML input model, I want to annotate certain elements,
here for example all "TypedElements". I do so, by just looking at every
element and applying a switch. For elements I'am not interested, my
switch returns an empty string, otherwise the name of their type.
In case the returned string is not empty, I add an attribute to the element:
<%-- Element: TypedElement; variable __type; Value: Name of the
Element's type --%>
<%TypeSwitch sw = new TypeSwitch();%>
<c:visitor select="/contents" var="_e">
<%
context.setVariable("__t",sw.doSwitch((EObject)context.getVariable( "_e")));%>
<c:visit test="$__t != ''">
<c:set select="$_e" name="__type"><c:get select="$__t"/></c:set>
</c:visit>
</c:visitor>
I am a little disturbed by the nested c:get tag:
<c:get select="$__t"/>
Wouldn't it be cool to have an extended <c:set> where one could directly
enter an xpath expression as the resulting value:
<c:set select="$_e" name="__type" value="$__type">
Felix
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10965 seconds