Pages

Friday, May 27, 2011

Source Links property in BizTalk Maps

Here’s a cool mapping tip I found on working in BizTalk Mapping.

While mapping an element from the source schema to the target schema, it is possible to copy either the value contained within the element or the element name itself.

You achieve this by setting the Source Links property of the link connecting the elements as shown below.



In the above figure above the value mapped to the target element will be “CustomerName”.


The values that can be set are:
1. Copy text value – which is the default that copies the content of the element
2. Copy name – copies the name of the source node instead of its value
3. Copy text and subcontent value – concatenates the value of all child nodes

Now you might be wondering what is this 3rd value (Copy text and subcontent value) that can be set…
This is used if you want to concatenate all the child element values of the source node into a single element in the target as shown below.
 Here is an example:

Input Message

FirstName_0
LastName_0
Street_0
City_0


FirstName_1
LastName_1
Street_1
City_1


Output Message

FirstName_0LastName_0Street_0City_0


FirstName_1LastName_1Street_1City_1


Now here is another interesting mapping


The mapping above transforms the elements in the source schema into a key-value pair as shown below.

Each element node from the source schema links to the two elements in the target schema, one link copies the node name and the other copies the node value.

Input Message

FirstName_0
LastName_0
Street_0
City_0


Output Message

FirstName
FirstName_0


LastName
LastName_0


Street
Street_0


City
City_0

Friday, May 13, 2011

USING XSLT Call Template v/s Inline XSLT

SELECTING FROM AVAILABLE SCRIPTING LANGUAGES

An XSLT call template builds one or more output nodes from scratch. The two XSLT scripting methods differ in whether or not an input parameter can be used.

Inline XSLT, accepts input via XPATH queries but does not accept input parameters. XSLT call templates accept input via both methods. The XPATH query you will see in the inline XSLT discussion is the same type as would be used in the XSLT call template
 
Simple XPATH queries are especially useful when creating outbound EDI segments like the REF or DTM segments, because you can collect data from source nodes that are not in the current context node of your source data and use this data to create repeating instances of a single output node.
 
Inline XSLT scripts are different from those created with the other scripting languages, because they do not use input parameters.
 
Here are two notes to keep in mind when working with XSLT call templates and inline XSLT.

First, when input parameters are used in an XSLT call template, the input values arrive through links from the source nodes to the Scripting functoid. If the source data is in a loop, the value input to the Scripting functoid depends on how many times the loop has been accessed before the script is executed. Second, when you
need a system variable such as System Date as input, you may have to use a call template and not inline XSLT. Releases of BizTalk that do not use Version 2.0 or higher of XSLT do not have access to XSLT functions that can access system variables.