

Cadet 2nd Class
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-09-12
06:57
627 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 & - 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>&<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?
<token-replace-all regex="("\],)" replace-with="&">
This winds up in the output document as & - 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>&<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?
1 Reply


Cadet 2nd Class
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-09-12
08:36
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.