-
Notifications
You must be signed in to change notification settings - Fork 34
Metamorph functions
Functions take as input name-value pairs, subsequently written as (name, value)
and output zero to n name-value pairs.
For more information, see also:
Filtering based on a blacklist. See also Data Lookup.
in: ("a","rabbit")("b","turtle")("c","hamster") ...
<blacklist>
<entry name="hamster"/>
<entry name="rabbit"/>
</blacklist>
out: ("b","turtle") ...
Wraps the value in a prefix and postfix.
in: ("a","b")("c","d") ...
<compose prefix="Hello, " postfix="!"/>
out: ("a","Hello b!")("c","Hello d!") ...
Replaces the value with a constant string.
in: ("a","b")("c","d") ...
<constant value="V"/>
out: ("a","V")("c","V") ...
Filtering based on containing.
in: ("a","hamster in the house")("b","turtle in the house") ...
<contains string="hamster"/>
out: ("a","hamster in the house") ...
Counts occurrences.
in: ("a","b")("c","d") ...
<count/>
out: ("a","1")("c","2") ...
Formats dates
in: ("a","2018-08-26")
<dateformat inputformat="yyyy-MM-dd" outputformat="FULL" era="AD" removeLeadingZeros="false" language="de"/>
out:("a","Sonntag\, 26. August 2018")
Filtering based on equality.
in: ("a","hamster")("b","turtle") ...
<equals string="hamster"/>
out: ("a","hamster") ...
create an HTML anchor tag.
ISBN cleaning, checkdigit verification and transformation between ISBN 10 and ISBN 13.
Lookup and replace based on a data table. See also Data Lookup.
in: ("a","en")("b","es")("c","xy") ...
<lookup>
<entry name="en" value="english"/>
<entry name="es" value="spanish"/>
</lookup>
out: ("a","english")("c","spanish") ...
UTF-8 normalization. Brings Umlauts into canonical form.
Filtering based on not containing.
in: ("a","hamster in the house")("b","turtle in the house") ...
<not-contains string="hamster"/>
out: ("b","turtle in the house") ...
Filtering based on inequality.
in: ("a","hamster")("b","turtle") ...
<not-equals string="hamster"/>
out: ("b","turtle") ...
filtering based on occurrence.
in: ("a","hamster")("b","turtle")("c","butterfly") ...
< occurrence only="2"/>
out: ("b","turtle") ...
in: ("a","hamster")("b","turtle")("c","butterfly") ...
< occurrence only="moreThan 2"/>
out: ("c","butterfly") ...
Regexp matching. Returns first occurrence of a pattern. The pattern is a Java regex Pattern (see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html).
in: ("a","baum")("b","pflaume")("d","apfel") ...
<regexp match="a.m"/>
out: ("a","baum")("b","pflaume") ...
The optional format argument is used to address match groups.
in: ("a","from 1789 to 1900") ...
<regexp match="(\d\d\d\d) to (\d\d\d\d)" format="${1}-${2}"/>
out: ("b","1789-1900") ...
Replaces a pattern with a string. The pattern is a Java regex Pattern (see http://docs. oracle.com/javase/6/docs/api/java/util/regex/Pattern.html).
in: ("a","abcde")("c","efg") ...
<replace pattern="[ace]" with="X"/>
out: ("a","XbXdX")("c","Xfg") ...
processing the value with a JavaScript function or a Java class. See Integration of Java and JavaScript.
Replaces multiple strings. The mapping from string to replacement is defined in a map, just as done in the lookup function. See also Data Lookup.
in: ("a","written in $en")("c","$es-speaking") ...
<setreplace>
<entry name="$en" value="english"/>
<entry name="$es" value="spanish"/>
</setreplace>
out: ("a","written in english")("c","spanish-speaking") ...
splitting based on a regexp.
in: ("data","Oahu,Hawaii,Maui") ...
<split delimiter=","/>
out: ("data","Oahu")("data","Hawaii")("data","Maui") ...
Extraction of a substring.
in: ("a","012345") ...
<substring start="3" end="5"/>
out: ("a","34") ...
Exchanges name and value.
in: ("hamster","Rodriguez")("cat","Felix") ...
<switch-name-value/>
out: ("Rodriguez","hamster")("Felix","cat") ...
If you wish to set the name of the resulting named values, use the following code:
in: ("hamster","Rodriguez")("cat","Felix") ...
<constant value="animal"/>
<switch-name-value/>
out: ("animal","hamster")("animal","cat") ...
Trim the value.
in: ("a"," hamster ")("b","turtle ") ...
<trim string="hamster"/>
out: ("a","hamster")("b","turtle") ...
Filtering based on a whitelist. See also Data Lookup
in: ("a","rabbit")("b","turtle")("c","hamster") ...
<whitelist>
<entry name="hamster"/>
<entry name="rabbit"/>
</whitelist>
out: ("a","rabbit")("c","hamster") ...
Fix or Metamorph - you can choose between one of them. Fix is recommended for the most users.
Metamorph or Fix - you can choose between one of them. Fix is recommended for the most users.