XSL, XSLT AND BizTalk Map – First Look

  • What is XSL and XSLT?
    • There is no difference between XSL and XSLT both are same and these also called XSL stylesheets. I can say these are synonyms.
    • It is a one type of Language in computer world which contains different Types of Languages. And this type of language is also called stylesheet language or functional language.
    • Like any language has its own syntax, instructions and rules for writing code\script, XSL also have its own instructions and rules.
    • XSL Format and syntax looks like same as html\xml formats.
    • You can open\create\write\edit XSL file in Notepad, notepad++, text Pad, Visual Studio, Edit Plus, like almost in all editors.
    • These stylesheets can be identified or saved as ‘.xsl’ or ‘.xslt’ extension. Visual studio defaults to ‘.xslt’ extension and some other extensions defaults to ‘.xsl’. while running you have to check which extension is suitable to your work\application.
    • The full form of XSL is ‘extensible stylish Language’ and XSLT full form is ‘extensible stylish language transformations. It simply means this stylesheet contains transformation code. In other way it transforms XML file from one format to another format.
    • As the name showing as stylish, yes, we use XSL for styling. Styling to mainly for XML documents (files). Here styling means transforming. Stylesheet mainly used to transform one xml document (one xml file) to another xml document (another xml file).
    • Generally, the input to this style sheet is called ‘source’ xml and out of this stylesheet is ‘target’ xml.
    • To run XSL\XSLT, it requires some run time. And these stylesheets you can call from almost from all the programming and scripting languages. That’s reason XSL is powerful in transformation.
  • By using XSL Stylesheets, you can
    • Assign values from one xml element to another xml element
    • Copy nodes\elements from one xml to another xml node.
    • Looping recursive xml nodes to get values of each nodes.
    • Check conditions like if condition.
    • Use Xpath\Xqury language.
    • Add constant values
    • Concatenate values
    • Inside you can call JavaScript, J#, c#, etc…
    • Etc…
  • XSLT looks like1.jpg
  • BizTalk and XSL
    • If you know little bit about BizTalk, then you must have heard about BizTalk Map, which file extension is ‘ btm’ and used to transform one message (xml) to another message (xml) in BizTalk Projects.
    • See below the Sample Btm file :-2.jpg
    • After created schemas and map, Build the Application once. After you build the application, Biztalk creates .’cs’ files in solution (physical) folder.
    • Right click on Project name -> click on ‘Open Folder in File Explorer’.3.jpg
    • You can see ‘.btm.cs’ files. This is a c# class file.4.jpg
    • Let’s see what is the inside ‘.btm.cs’ file.
    • Double click btm.cs file or open it in Visual Studio or any other editors. I opened in visual studio and I can see file as below.5.jpg
    • If you observe in the ‘.btm.cs’ file where I highlighted in the above screen that is a XSL code assigned to a ‘_strMap’ string variable in BizTalk map class file.
    • This is what I want to show you, the map whatever appearing is only GUI, back-end it is coded with c#, it’s an editor. And in run time C# class files are called and C# class file and C# class file uses XSL code for transformations.
    • And of course, it uses different functions\methods in C# to run business logic.
    • Yes, Map is a combination of C# and XSLT.

 

Advertisements

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