New in RPE 2.1: ReUse JavaScript functions in template

RPE 2.1 allows the template designer to define JavaScript libraries/functions within the RPE template. The functions defined in those libraries are visible in all the other elements within the same template.


To mark a JavaScript element as a library, enable “Library script” property. Once enabled, the element name changes to “JavaScript Library“. The functions defined in such JavaScript library is available to all other elements within the template.

Watch the video on JavaScript reuse  in RPE template, created by my colleague Subramanya Prasad.


  • The JavaScript element name changes to “JavaScript Library” if library script property is checked. Otherwise, the name remains as “JavaScript code“. See the above image.
  • Do not create duplicate functions (more than one function with the same name and argument list). The behavior could be unintended.
  • The JavaScript functions written within dynamically referenced templates will be availabe for use in the template referencing it.
  • Define reusable functions at one place at the top of the template
    • Feel free to break them under multiple javascript elements
  • If a document specification has more then one template, the function defined in template 1 is NOT visible in template 2.

Find more details on JavaScript template element here.


Author: Kumaraswamy M

Kumar is an architect for Rational Publishing Engine. He has been with the product for more than 4 years and has been involved in many releases of RPE. His expertise are in Web application development and API design. He loves going on a long ride on bike and conquering peaks during weekend treks.

One thought on “New in RPE 2.1: ReUse JavaScript functions in template”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s