cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT

Former Member
0 Kudos
190

where I can learn XSLT & how to use this mapping in XI

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

XSLT mapping is just a mapping similar to Message mapping available in the SAP XI, the xml mapped file is said to be XSLT mapping, A tool available from Stylus studio . it will be graphical one and very easy one.assume if u want to add zero in front of the

field we have to add that many zeros in that field thats it.. similar kind of lot of functions ready made available.

this will make the performance of the system bit slow.. if we use XSLT mapping and BPM then the interface is in Task ( will have performance impact a lot )

Advantage is we can mappe as we wish and import the file that it.

see the below links

XSLT Mapping

/people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping

/people/sreekanth.babu2/blog/2005/01/05/design-time-value-mappings-in-xslt

/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping

XSLT Mapping with java enhancement

/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners

XSLT - /people/dirk.roeckmann/blog/2006/07/26/grouping-xml-with-xslt--from-muenchian-method-to-xslt-20

Dynamically sending a mail to the PO creator using XSLT- ABAP Mapping -

/people/rahul.nawale2/blog/2006/11/01/dynamically-sending-a-mail-to-the-po-creator-using-xslt-abap-mapping

xpath functions in xslt mapping -/people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping

Lookups with XSLT - https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8e7daa90-0201-0010-9499-cd347ffb...

Using XSLT Mapping within the J2EE Adapter Framework -https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3823 [original link is broken] [original link is broken] [original link is broken]

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb9...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8...

http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm

So go with XMLSpy or Stylus Studio editors for the XSLT Mapping.

You can get XSLT Tutorial from the Stylus Stutdio site. Refer

http://www.stylusstudio.com/xml_product_index.html

Thanks

VIkrnath

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Rahul Singh ,

The following r excellent websites on XSLT mapping containing PDF docs:

Generic XSLT Mapping for SAP XI,Part I

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2e...

Generic XSLT Mapping for SAP XI,Part II

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923...

XSLT: Recursive Templates

/people/udo.martens/blog/2006/04/26/xslt-recursive-templates

Easy RFC lookup from XSLT mappings using a Java helper class

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc...

cheers!

gyanaraj

        • reward points if u find this helpful

aashish_sinha
Active Contributor
0 Kudos

Hi,

Use w3schools.com for learning XSLT.

For how to use it with XI please refer these 2 blogs

/people/aashish.sinha/blog/2008/01/17/step-150-by-150-step-simple-approach-for-xslt-mapping

/people/aashish.sinha/blog/2008/01/21/xslt-mapping-for-multiple-segments-of-xml

Regards

Aashish Sinha

PS : reward points if helpful

Former Member
0 Kudos
Former Member
0 Kudos

HI

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

u2022XML to XML - From one XML data format to another

u2022XML to Text

u2022XML to HTML/XHTML

u2022XML to PDF

Pre-requisite for XSLT

Writing an XSL program to transform XML document into desired format is not a difficult task though it seems to be in the beginning. It requires basic knowledge of XML tags, basic XPath concepts and HTML.

We will concentrate more on use of XSLT in XI (EXchange Infrastructure) for mapping.

Before starting with XSLT letu2019s get familiar with the following terms:-

u2022XML

u2022HTML

u2022XPath

XSLT: Extensible style sheet language transformation. It enables the definition of mappings for messages with different structures. Provides the transformation requirements for an inbound message to create an outbound message.

XSLT mappings can be imported into the Integration Repository; java methods can be called from within the XSLT style sheet. Advantages of this mapping are: open standard, portable, extensible via Java user-defined functions.

XSLT MAPPING:

Steps required for developing XSLT Mapping

u2022 Create a source data type and a target data type

u2022 Create Message types for the source and target data types.

u2022 Create Message Interfaces includes Inbound Message interface and Outbound Message interface.

u2022 XSLT Mapping does not require creation of Message mapping, so donu2019t create any Message mapping.

u2022 Create an .XSL file which converts source data type into target data type.

u2022 Zip that .xsl file and import it into Integration Repository under Imported Archives.

u2022 In Interface Mapping choose mapping program as XSL and specify this zip program. (Through search help you will get XSL Mapping programs that you imported under Imported Archives, select your corresponding XSL Program)

u2022 Test this mapping program by navigating to Test tab.

By having look at above steps you can easily find out that this mapping is no where different from other mapping programs, here the challenging lies in creating an XSLT file. If you spend couple of minutes in studying XPATH tutorial you would be in ideal position to create an XSL Transformation (.xsl extension).

If you still find difficulties in generating XSL Transformation, then you can make use of a tool u201CAltova MapForceu201D which will create XSL file for you.

Steps for creating XSL file using this tool:

1. Open the Alto MapForce, import the source .xml and .xsd file in it

2. Similarly import the target .xml and .xsd in MapForce.

3. These two data files should match with source and target data types in Integration Repository.

4. Complete the graphical mapping using extensive list of XSLT functions available there.

5. Save the mapping file.

6. Click the XSLT tab. You will have the entire xslt logic there.

7. Copy that content and save it as .xsl file.

8. Zip above .xsl file and import the same into IR under Imported Archives

For XSLT Mapping:

http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm

Error handling in XSLT Mapping:

http://help.sap.com/saphelp_nw04/helpdata/en/8a/7672f7d7e444439fd7024f806221a4/frameset.htm

XSLT MAPPING:

Generic XSLT Mapping for SAP XI,Part I

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2e...

Generic XSLT Mapping for SAP XI,Part II

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923...

XSLT: Recursive Templates

/people/udo.martens/blog/2006/04/26/xslt-recursive-templates

Easy RFC lookup from XSLT mappings using a Java helper class

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc...

Step u2013 By u2013 Step Simple Approach for XSLT Mapping

/people/aashish.sinha/blog/2008/01/17/step-150-by-150-step-simple-approach-for-xslt-mapping

cheers

former_member537867
Active Contributor
0 Kudos

Hi Rahul,

A few example cases 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.

Procedure:

Steps required for developing XSLT Mapping

u2022 Create a source data type and a target data type

u2022 Create Message types for the source and target data types.

u2022 Create Message Interfaces includes Inbound Message interface and Outbound Message interface.

u2022 XSLT Mapping does not require creation of Message mapping, so donu2019t create any Message mapping.

u2022 Create an .XSL file which converts source data type into target data type.

u2022 Zip that .xsl file and import it into Integration Repository under Imported Archives.

u2022 In Interface Mapping choose mapping program as XSL and specify this zip program. (Through search help you will get XSL Mapping programs that you imported under Imported Archives, select your corresponding XSL Program)

u2022 Test this mapping program by navigating to Test tab.

By having look at above steps you can easily find out that this mapping is no where different from other mapping programs, here the challenging lies in creating an XSLT file. If you spend couple of minutes in studying XPATH tutorial you would be in ideal position to create an XSL Transformation (.xsl extension).

If you still find difficulties in generating XSL Transformation, then you can make use of a tool u201CAltova MapForceu201D which will create XSL file for you.

Steps for creating XSL file using this tool:

1. Open the Alto MapForce, import the source .xml and .xsd file in it

2. Similarly import the target .xml and .xsd in MapForce.

3. These two data files should match with source and target data types in Integration Repository.

4. Complete the graphical mapping using extensive list of XSLT functions available there.

5. Save the mapping file.

6. Click the XSLT tab. You will have the entire xslt logic there.

7. Copy that content and save it as .xsl file.

8. Zip above .xsl file and import the same into IR under Imported Archives.

Example:

Input XML

<?xml version="1.0"?>

<Customer>

<Fname>SDN</Fname>

<Mname>User</Mname>

</Customer>

XSLT Code

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:variable name="fn">

<xsl:value-of select="Customer/Fname"/>

</xsl:variable>

<xsl:variable name="ln">

<xsl:value-of select="Customer/Mname"/>

</xsl:variable>

<xsl:template match="/">

<Customer>

<Name><xsl:value-of select="concat($fn,' ',$ln)"/></Name>

</Customer>

</xsl:template>

</xsl:stylesheet>

OutputMessage.xml

<?xml version='1.0' ?>

<Customer>

<Name>SDN User</Name>

</Customer>

Go through these

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb9...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8...

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/006aa890-0201-0010-1eb1-afc5cbae...

Some scenarios

/people/sap.user72/blog/2005/03/15/using-xslt-mapping-in-a-ccbpm-scenario

/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping

Regards,

Vinod.