cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT Mapping scenario

Former Member
0 Kudos

Hi

we have graphical mapping in Xi.. but most of them going for XSLT mapping.. i did't understood in what situation we need to go for XSLT mapping... is there any special features which are not possible in Graphical Mapping.. can you please suggest what are those.. and exactly when can go for XSLT mapping..

Thanks

Babu

Accepted Solutions (1)

Accepted Solutions (1)

GabrielSagaya
Active Contributor
0 Kudos

A few example in which an XSLT mapping can be used:-

When the required output is other than XML like Text, Html or XHTML (html displayed as XML)

When default namespace coming from graphical mapping is not required or is to be changed as per requirements.

When data is to be filtered based on certain fields (considering File as source)

When data is to be sorted based on certain field (considering File as source)

When data is to be grouped based on certain field (considering File as source)

Advantages of using XSLT mapping

XSLT program itself defines its own target structure.

XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.

XSLT provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.

File content conversion at receiver side can be avoided in case of text or html output.

Multiple occurrences of node within tree (source XML) can be handled easily.

XSLT can be used in combination with graphical mapping.

Multi-mapping is also possible using xslt.

XSLT can be used with ABAP and JAVA Extensions.

Disadvantages of using XSLT mapping

Resultant XML payload can not be viewed in SXMB_MONI if not in XML format (for service packs < SP14).

Interface mapping testing does not show proper error description. So errors in XSLT programs are difficult to trace in XI but can be easily identified outside XI using browser.

XSLT mapping requires more memory than mapping classes generated in Java.

XSLT program become lengthier as source structure fields grows in numbers.

XSLT program sometimes become complex to meet desired functionality.

Some XSL functions are dependent on version of browser.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi babu

> SAP recommends that you use message mappings. But in some cases we found graphical mapping falls short of capability to map complex requirements

>So, in exceptional cases it may be advisable to use different mapping programs, for example, because you can apply XSLT or Java mapping programs

>XSLT mapping is basically used when you need to reference different

node inside the XML structure. So using XPATH query it is relatively easy to do with.XSLT can also use Java Program which may be virtually impossible by graphical mapping.It also transform one structure to other like XML to HTMl easily.

***Reward points if it helps u understand

aashish_sinha
Active Contributor
0 Kudos

Hi,

Interface descriptions are in the form of XML documents. XSL Transformation (XSLT) is a member of the XML family of languages. It describes how an XML structure is transformed into another XML structure.

You can define mappings using XSLT together with XPath. XPath is also a specification of the XML family. Using XPath you can address any node in an XML document. XSLT implements XPath expressions to select substructures of an XML document. Using templates in XSLT you can define the mapping rules for the selected substructures.

You can use the XSLT tags <xsl:include> and <xsl:import> to include predefined templates for substructures in a complete mapping definition. In this way, you can reuse mappings for data types.

Moreover, using an XSLT definition you can call external Java methods to convert XML structures. This procedure gives you more flexibility when defining mappings.

You can refer to this link for more information and also for the examples.

http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm

Hope this will help you.

Regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos

Hi Babu,

1) What is XSLT

XSLT stands for EXtensible Stylesheet Language Transformations. It is an XML based language for transforming XML documents into any other formats suitable for browser to display, on the basis of set of well-defined rules.

It can be used to transform

• XML to XML - From one XML data format to another

• XML to Text

• XML to HTML/XHTML

• XML to PDF

How is XSLT mapping different from Graphical, Java and ABAP mapping?

Graphical mapping is a common approach followed by everyone for generating desired target structure. It involves simple drag-n-drop to correlate respective nodes (fields) from source and target structure. It hardly involves coding. (Exception – User defined functions). But sometimes with graphical mapping it is difficult to produce required output. For example … text/html output, namespace change, sorting or grouping of records etc. A person comfortable with Object Oriented ABAP can go for ABAP mapping instead. One can also think of Java mapping as another option but it is a bit complex and required knowledge of Java. In such cases, XSLT mapping can be the best approach to meet the requirements.

A few example cases in which an XSLT mapping can be used:-

&#61692; When the required output is other than XML like Text, Html or XHTML (html displayed as XML )

&#61692; When default namespace coming from graphical mapping is not required or is to be changed as per requirements.

&#61692; When data is to be filtered based on certain fields (considering File as source)

&#61692; When data is to be sorted based on certain field (considering File as source)

&#61692; When data is to be grouped based on certain field (considering File as source)

Advantages of using XSLT mapping

&#61692; XSLT program itself defines its own target structure.

&#61692; XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.

&#61692; XSLT provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.

&#61692; File content conversion at receiver side can be avoided in case of text or html output.

&#61692; Multiple occurrences of node within tree (source XML) can be handled easily.

&#61692; XSLT can be used in combination with graphical mapping.

&#61692; Multi-mapping is also possible using xslt.

&#61692; XSLT can be used with ABAP and JAVA Extensions.

I hope u got the idea.

Thanks and Regards,

Chirag

prateek
Active Contributor
0 Kudos

Usually XSL mapping is used when the structures to map are very large and complex.

Other thing is the development perspective. Some organizations have XSL experts who may perform mapping outside the XI without XI expertise. They are frequent XSL mapping users.

Regards,

Prateek