- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2019 09:06 PM
Hi team,
I have XML code to display some data in HTML knowledge article template.
However the output has <div> tags in it. How can i remove those?
Here is the sample code:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate object="true" var="jvar_statements">
var stmt = new GlideRecord('sn_compliance_policy_statement');
var qr = stmt.addJoinQuery('sn_compliance_m2m_policy_policy_statement', 'sys_id', 'content');
qr.addCondition('document', current.sys_id + '');
qr.orderBy('order');
stmt.query();
stmt;
<p>${current.policy_text}</p>
<j:while test="${jvar_statements.next()}">
<p style="font-weight: bold;"> ${jvar_statements.getValue('name')}</p>
<p>${jvar_statements.getValue('description')}</p>
</j:while>
</j:jelly>
Now the "description" is a HTML field and i need exactly the HTML output.
Expected:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2019 07:00 AM
This is Jelly so you need to escape all of the chars that it does not like. Here is a place to start with your reading.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2019 09:12 PM
Hi
Can you try using the below regex in your code where you are getting the description - .replace(/<\/?[^>]+(>|$)/g, "");
Something like this -
<p>${jvar_statements.getValue('description').toString().replace(/<\/?[^>]+(>|$)/g, "")}</p>
Hope this helps.
Regards
Omkar Mone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2019 09:25 PM
When i am trying to save, getting below error:
"The content of elements must consist of well-formed character data or markup."

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2019 09:49 PM
Hi
That is because we did it in the <p> tag of html. Try this in the javascript script of yours, and set the processed value there in the <p> tag.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2019 09:54 PM