JET2 Tag Escape Character [message #1076276] |
Wed, 31 July 2013 04:44  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03394 seconds