fergubru
New Member.
488 views

REST driver output transform - token-replace-all regex &

I'm trying to massage the output of the REST driver with an output transformation policy, one of the issues I'm having is with this DirXML tag:

<token-replace-all regex="("\],)" replace-with="&">

This winds up in the output document as &amp; - this is commonly done to render xml to html so that a simple '&' is displayed on the final web page.

However, it's going as-is into the rest query, causing every form entry after the first to have an erroneous 'amp;' as a prefix. (the first ampersand & code is properly seen as an entry delimiter, leaving the remaining amp; orphaned and treated as part of the name of the next key), like this:

<key>=<value>&<key>=<value> etc.

(raw code of the above is <key>=<value>&amp;<key>=<value>)

whereas the expected behavior is:
<key>=<value>&<key>=<value> etc.

(raw code of the above is <key>=<value>&<key>=<value>)

Is there a way to render just '&' in the output document, or to remove the additional 'amp;' once it is in the variable?
Labels (1)
0 Likes
1 Reply
fergubru
New Member.

Re: REST driver output transform - token-replace-all regex &

Managed to figure this one out, it had nothing to do with the replace token. The above token was nested within a token-XML-serialize token that proved not to be necessary in this use case. With that parent element removed, & produced the expected value in the output document.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.