MashZone NextGen 10.2 | Appendix | Legacy Presto components | Mashables and Mashups | Mashups in EMML | Advanced Mashup Techniques | Adding Special Characters to Data
 
Adding Special Characters to Data
 
XML Character Entities
When you transform data in EMML, you may need to add white space, control or other special characters to data. For example, transforming data into a URL that has parameters and uses the & character or adding line feed characters in a string.
Because EMML is XML, you can do this using XML character entities for the special characters and XPath functions to append the characters.
The next example shows an <assign> statement that adds a line feed to the end of a string:
<assign fromexpr="concat($line,'&#010;')" outputvariable="$line" />
The second string, &#010;, is the XML character entity for a line feed character.
The next example loops through an XML variable with parameters to add to a URL:
...
<!-- If there are parameters, add ? -->
<if condition="$svcResult/parameters/parameter">
<assign fromexpr="concat($thisUrl, ’?’)" outputvariable="$thisUrl"/>
</if>

<foreach variable="thisParam" items="$svcResult/parameters/parameter">
<assign fromexpr="concat($thisURL, $thisParam/name, ’=’, $thisParam/value)"
outputvariable="$thisUrl"/>
<!-- If there are more parameters, add & -->
<if condition="$thisParam/following-sibling::parameter">
<assign fromexpr="concat($thisUrl,’&amp;’)" outputvariable="$thisURL"/>
</if>
</foreach>
...

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release