Appendix : Legacy Presto components : Mashables and Mashups : Mashups in EMML : Advanced Mashup Techniques : Normalizing Data for Joins, Grouping or Filtering : Use the Custom XPath Function in Your Mashup or Macro
Use the Custom XPath Function in Your Mashup or Macro
To use the function, you must add a namespace for the class that contains this function. Add an xmlns attribute with a unique namespace prefix to the <mashup> or <macro> tag. For example:
<mashup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openmashup.org/schemas/v1.0/EMML/
../xsd/EMMLPrestoSpec.xsd"
xmlns="http://www.openmashup.org/schemas/v1.0/EMML"
xmlns:macro="http://www.openmashup.org/schemas/v1.0/EMMLMacro"
xmlns:presto="http://www.jackbe.com/v1.0/EMMLPrestoExtensions"
xmlns:finance="java:com.mycompany.mashups.MyFinanceFunctions"
name="MortgageComparisons">
...
</mashup>
Then simply use the custom function in the XPath expressions where you need data to be normalized. In this example, the custom XPath expression is used in a <join> statement:
...
<input name="feed1" type="document">
<feed>
<Product>5-Year ARM</Product>
<Rate>5.250%</Rate>
<APR>5.388%</APR>
</feed>
</input>
<input name="feed2" type="document">
<feed>
<Product>5/1 Orange Mortgage</Product>
<Rate>5.500%</Rate>
<APR>4.872%</APR>
</feed>
</input>
<output name="result" type="document"/>
<join outputvariable="$result"
joincondition="$feed1/feed/finance:mortgage(Product) =
$feed2/feed/finance:mortgage(Product)"/>
<display message="result =" expr="$result"/>
....
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback