Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

M2T-JET-FAQ/How to I escape JET special characters?

JET recognizes a number of characters is lead-ins to tags, comments, directives and embedded XPath expressions. If you need to include these characters in your template output, you need to escape them. Different techniques are required for different types of characters:

Tag lead-in characters: < and </

To escape a < characters, place a backslash (\) in front of it. Example:

JET template text:

\<some text>

Template output:

<some text>

Comment lead-in and closing characters: <%-- and --%>

JET comment lead-in and closing characters can be escaped by placing a backslash (\) before the % sign on the lead-in and the > on the closing:

JET template text:

<\%-- this is not a JET comment --%\>

Template output:

<%-- this is not a JET comment --%>

Directive lead-in: <%@

The JET directive lead-in can be escaped by placing a backslash (\) before the % sign:

JET template text:

<\%@NOT a JET Directive%>

Template output:

<%@NOT a JET Directive%>

Embedded XPath expression lead-in: ${

The embedded XPath lead-in can be escaped by putting part or all of the lead-in into an enclosing embedded XPath expression that returns a string.

JET template text. Here ${'$'} is an embedded XPath expression ('$'), which returns a single character $:

The minimum needed: ${'$'}{someStaticText}

Template output:

The minimum needed: ${someStaticText}

JET template text. Here, an embedded XPath expression returns the entire string ${someStaticText}:

An alternative - quote the entire expression: ${'${someStaticText}'}

Template output:

An alternative - quote the entire expression: ${someStaticText}

Back to the top