BizTalk Mapper – Set repeating record & current Date Time using INLINE XSLT

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

xsltThe Map looks as below –

xslt1.png

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”

xslt2

SCRIPT FUNCTOID – “INLINE XSLT”

xslt3.png

Now the final step would be to test the Map and have a look at the output.

INPUT

xslt4

OUTPUT

xslt5

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.

 

 

 

 

Advertisements

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s