Most of the BizTalk mapping we worked with gets easily implemented with the inbuilt functioids provided by Microsoft. You may come across few scenarios which need us to implement the mapping using XSLT (Inline XSLT or XSLT call template).
Below is one such scenario where we need to populate DateTime record twice with different values.
Under DateTime record we have 3 fields,
- timestampId (hardcoded for both the records)
- timestampSign (hardcoded for both the records)
- timestampDate (set current date time for one record field and other we will extract from the source schema.
For the first two bullet points we just set a hardcoded value in the XSLT. The Last bullet point we use XPATH to get one value from the Source Schema and populate the Current Date Time for other record using Inline C# and all it in our XSLT.
Let’s first have a quick look at the Source and Destination Schema.
- Left Side – Source Schema
- Right Side – Destination Schema
The Map looks as below –
As you can see we have a direct one-to-one mapping for Name and Registration No. The DateTime is linked to a Script functoid with INLINE XSLT and the other script functoid is used to set the current date time.
SCRIPT FUNCTOID: “CurrentDateTime”
SCRIPT FUNCTOID – “INLINE XSLT”
Now the final step would be to test the Map and have a look at the output.
This was a simple XSLT example and you can have much more complex XSLT mapping in your solution. Sometimes setting up XSLT mapping can be quite challenging.