Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » JET2 Tag Escape Character(What is the escape character for JET2 tags?)
JET2 Tag Escape Character [message #1076276] Wed, 31 July 2013 04:44 Go to next message
Phillip Drew is currently offline Phillip DrewFriend
Messages: 77
Registered: October 2012
Member
I need to use JET2 templates to write JET2 template which means I need to escape JET2 tags.

What does JET2 use for an escape character? Presumably something along the lines of

<\c:setVariable .../> where the first backslash means that <c:setVariable .../> is printed to the result, not evaluated by the initial transformation.

Thanks
Re: JET2 Tag Escape Character [message #1076465 is a reply to message #1076276] Wed, 31 July 2013 12:40 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Phillip:

There is no backslash escaping for custom tags, in spite of what it says in the JET FAQ (which I'll modify shortly).

Your choices are the following alternatives:

If you are working with JET 1.0 or later, you can escape the leading < character with the compact XPath expression ${'<'} :

${'<'}c:iterate>...${'<'}/c:iterate>

See Compact alternative to c:get, for more details.

Alternatively, you can use the taglib directive to change the namespace of your tags.

You can change the namespace of the tags you emit:
<%-- Your template uses c:, but emits cc: for control tags --%>
<%-- emit tag so that the output tags are bound to cc. This needs to be escaped --%>
<\%@taglib prefix="cc" id="org.eclipse.jet.controlTags" %>
...
<c:if test="someCondition">
   <cc:iterate select="...">...</cc:iterate>
</c:if>

Or, you can change the namespace of your template's tags:
<%-- Your template uses cc:, but emits c: for control tags --%>
<%-- Indicate that this templates uses cc prefix for control tags --%>
<%@taglib prefix="cc" id="org.eclipse.jet.controlTags" %>
...
<cc:if test="someCondition">
   <c:iterate select="...">...</c:iterate>
</cc:if>

JET you used the later technique since inception to generate new JET projects.

Paul
Previous Topic:[acceleo] Training in NE US
Next Topic:[Acceleo] Access to siblings of resource roots
Goto Forum:
  


Current Time: Tue Dec 23 04:27:06 GMT 2014

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

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