Trending September 2023 # How Mapping Work In Xslt With Examples &Amp; Advantages? # Suggested October 2023 # Top 9 Popular | Speedmintonvn.com

Trending September 2023 # How Mapping Work In Xslt With Examples &Amp; Advantages? # Suggested October 2023 # Top 9 Popular

You are reading the article How Mapping Work In Xslt With Examples &Amp; Advantages? updated in September 2023 on the website Speedmintonvn.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested October 2023 How Mapping Work In Xslt With Examples &Amp; Advantages?

Introduction to XSLT mapping

Web development, programming languages, Software testing & others

Syntax

How mapping work in XSLT?

The term mapping refers dynamic transformation of one application to another application that represents different schema schedules. XSLT serves as a mediator for mapping sources to target in a flexible manner. A very simple example to narrate the definition of XSLT mapping. We normally receive a particular invoice for the product from the user in one format, but we transform this format to the system’s structure. To put the message in context, let’s see the next sections.   

The Next Step is to select the format with the reader Description. Adding to it, we include XSLT, which is fully editable, and all the editing process is reflected in the mapping tab.

The second Mapper we use is Stylus Studio XSLT Mapper that does visual model and Source Code edit. It takes input from any of the sources like Instance Documents, DTDs, Web services, or any other Databases. Other beautify is it supports Multiple Data Sources.

Even XSLT mapping could be implemented with java. let’s see now:

The steps include:

Implement a class with static methods for the respective documents. Inside that, import the message as a tracking Object.

Give a method call in the program.

Let’s take a Source file as

And now the target instance would be

Using concat() method we can merge the two strings for the target file. And the mapping declares the value param for the input.

public static String concat(String name, String add, Map inputparam) { trace.addInfo("concat(): nvehicle-name = " + name + "n vehicle_add = " + add ); return name + ' ' + add ; } }

In the next section, we shall see how to map files without repeating XML elements and saved them in the same location to access. We have different mapping tools like Altova, Oracle data Manager for B2B, Denodo XSLT mapper, and Stylus Studio. Here I have executed the implementation in XSLT mapper Open Source.

Examples of XSLT mapping Example #1

XML code as the source input

The XSL stylesheet is given as

;DEN=Denmark;ALB=Albania;DZA=Algeria;AND=Andorra;AGO=Angola;ATG=Antigua and Barbuda;ARG=Argentina;ARM=Armenia;AUS=Australia;AUT=Austria;AZE=Azerbaijan;BHS=Bahamas, The;BHR=Bahrain;BGD=Bangladesh;BRB=Barbados;BLR=Belarus;BEL=Belgium;BLZ=Belize;BEN=Benin;BTN=Bhutan;BOL=Bolivia;BIH=Bosnia and Herzegovina;BWA=Botswana;BRA=Brazil;BRN=Brunei;BGR=Bulgaria;BFA=Burkina Faso;BDI=Burundi;KHM=Cambodia;CMR=Cameroon;CAN=Canada;CPV=Cape Verde;CAF=Central African Republic;TCD=Chad;CHL=Chile;CHN=China, People’s Republic of;COL=Colombia;COM=Comoros;COD=Congo, Democratic Republic of the (Congo – Kinshasa);COG=Congo, Republic of the (Congo – Brazzaville);CRI=Costa Rica;DEU=Germany;GHA=Ghana;GRC=Greece;GRD=Grenada;GTM=Guatemala;GIN=Guinea;GNB=Guinea-Bissau;GUY=Guyana;HTI=Haiti;HND=Honduras;HUN=Hungary;ISL=Iceland;IND=India;IDN=Indonesia;IRN=Iran;IRQ=Iraq;IRL=Ireland;ISR=Israel;ITA=Italy;JAM=Jamaica;JPN=Japan;JOR=Jordan;KAZ=Kazakhstan;KEN=Kenya;KIR=Kiribati;PRK=Korea, Democratic People’s Republic of (North Korea);KOR=Korea, Republic of  (South Korea);KWT=Kuwait;KGZ=Kyrgyzstan;LAO=Laos;LVA=Latvia;LBN=Lebanon;LSO=Lesotho;LBR=Liberia;LBY=Libya;LIE=Liechtenstein;LTU=Lithuania;LUX=Luxembourg;MKD=Macedonia;MDG=Madagascar;MWI=Malawi;MYS=Malaysia;MDV=Maldives;MLI=Mali;MLT=Malta;MHL=Marshall Islands;MRT=Mauritania;MUS=Mauritius;MEX=Mexico;FSM=Micronesia;MDA=Moldova;MCO=Monaco;MNG=Mongolia;MNE=Montenegro;MAR=Morocco;MOZ=Mozambique;MMR=Myanmar (Burma);NAM=Namibia;NRU=Nauru;NPL=Nepal;NLD=Netherlands;NZL=New Zealand;NIC=Nicaragua;NER=Niger;NGA=Nigeria;NOR=Norway;OMN=Oman;PAK=Pakistan;PLW=Palau;PAN=Panama;PNG=Papua New Guinea;PRY=Paraguay;PER=Peru;PHL=Philippines;POL=Poland;PRT=Portugal;QAT=Qatar;ROU=Romania;RUS=Russia;RWA=Rwanda;KNA=Saint Kitts and Nevis;LCA=Saint Lucia;VCT=Saint Vincent and the Grenadines;WSM=Samoa;SMR=San Marino;STP=Sao Tome and Principe;SAU=Saudi Arabia;SEN=Senegal;SRB=Serbia;SYC=Seychelles;SLE=Sierra Leone;SGP=Singapore;SVK=Slovakia;SVN=Slovenia;SLB=Solomon Islands;SOM=Somalia;ZAF=South Africa;ESP=Spain;LKA=Sri Lanka;SDN=Sudan;SUR=Suriname;SWZ=Swaziland;SWE=Sweden;CHE=Switzerland;SYR=Syria;TJK=Tajikistan;TZA=Tanzania;THA=Thailand;TLS=Timor-Leste (East Timor);TGO=Togo;TON=Tonga;TTO=Trinidad and Tobago;TUN=Tunisia;TUR=Turkey;TKM=Turkmenistan;TUV=Tuvalu;UGA=Uganda;UKR=Ukraine;ARE=United Arab Emirates;GBR=United Kingdom;USA=United States;URY=Uruguay;UZB=Uzbekistan;VUT=Vanuatu;VAT=Vatican City;VEN=Venezuela;VNM=Vietnam;YEM=Yemen;ZMB=Zambia;ZWE=Zimbabwe;GEO=Abkhazia;TWN=China, Republic of (Taiwan);AZE=Nagorno-Karabakh;CYP=Northern Cyprus;MDA=Pridnestrovie (Transnistria);SOM=Somaliland;GEO=South Ossetia;

Explanation

 The above XSL file includes a key-value string in the template to get the concerned value. Here is a country code value that does the external mapping.

Output:

Example #2

XML

XSL

Explanation

Output:

Example #3

XML

XSL

<xsl:stylesheet version="1.0"

Explanation

The above code maps each element in the source to the element in the target code. To achieve this functionality, we have used a select statement which maps multiple elements to a single element Newcase in our case in target result using XSLT.

Output:

Advantages

It drops the namespaces or any prefix in the document but keeps the structure.

The Mapping tools used here provide good debugging of XSLT code to understand the structure.

The only solution for request/response messages. Even it helps in updating the target tables of a relational database.

Conclusion

Therefore, to the end, the mapping that handles the structure in B2B is quite complex; in such a case, we use integrations of the best cases. Mapping, in general, is a tricky process though we use different tools; when we suppose to map 100 fields, it sucks. Though many of the commercial tools are available, I probably use Altova for a simple mapping task.

Recommended Articles

This is a guide to XSLT mapping. Here we discuss How mapping work in XSLT and its Advantages, along with the examples and outputs. You may also have a look at the following articles to learn more –

You're reading How Mapping Work In Xslt With Examples &Amp; Advantages?

Update the detailed information about How Mapping Work In Xslt With Examples &Amp; Advantages? on the Speedmintonvn.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!