Skip to main content

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Use mode="literal" in the JSP tag pega:reference to eliminate leading and trailing spaces

Suggest edit Updated on May 3, 2020


A developer asks: Our application writes the result of an XML rule to a property value using the Property-Set-XML method. 

The result contains the correct property value, but with two leading and trailing spaces around each value. 

What causes these leading and trailing spaces, and what can we do about them?



Suggested Approach

Like HTML rules, XML rules are processed by stream processing. By default during stream processing, property references are padded with a single space before and after the value. 

To eliminate this padding, specify a mode of LITERAL in the reference directive:

{.myproperty literal}

In the JSP reference tag, specify this in the mode attribute.

<pega: reference name="myproperty" mode="literal" />

This works for XML, HTML rendered in a form, and HTML sent out as email or Word correspondence.


Did you find this content helpful? YesNo

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us