cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT mapping in sap pi

Former Member
0 Kudos


Hi Experts,

I am new to xslt mapping in sap pi.

We have a requirement in our current project to develop xslt maps.

I have gone through various threads and got a broad idea how to implement the xslt in sap pi. Also have developed basic knowledge of xslt and xpath

However have few question.

1. How to develop xslt style sheets which are to be imported in ESR.

2. Best suitable tool for developing style sheets wrt Sap PI.

3. Tutorials of xslt specific to xslt mapping development in sap pi

4. Would really appreciate if I can get some examples of when to use xslt over graphical or java mapping.

Regards

Rishabh

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor

HI Rishabh,


1. How to develop xslt style sheets which are to be imported in ESR.

There a lot of information about this in SCN and internet:

XSLT Mapping in SAP PI – An Introduction and How to Guide


2. Best suitable tool for developing style sheets wrt Sap PI.

You can use external tools like XMLSY, even online one like this XSLT Transformation - Online Toolz


3. Tutorials of xslt specific to xslt mapping development in sap pi

You can search in the SCN and to find the information as well:

Check this wiki the XSLT part, PI 7.0 and 7.1 Mapping - Blogs, Articles, Wiki, Code Samples and Videos Collections - Process Integr...


4. Would really appreciate if I can get some examples of when to use xslt over graphical or java

There are not straight answer for this, i usually try to follow the next rul, first i try with message mapping, when i couldn't get the right mapping i try with XSLT and when i can't with XSLT i try with java.

Hope this helps

Regards.

Answers (2)

Answers (2)

Former Member

Hi Rishabh,

Regarding 2)

You can develop and test XSLT as well with Netweaver Developer Studio which you might already have installed.

Otherwise there are quite a few good commercial products out there like Stylusstudio, Oxygen XML developer or Altova xmlspy.

Regarding 3)

Inaki already provided some good starting points for you.

I would like to add that (if you are not on the latest release and don't want to use a custom XLST processor for XLST 2.0) you can use add ons to XSLT like EXSLT.org in order to enrich the function set and have more elaborate mapping options. A very useful for example would be the node-set() function to allow multi step processing.

An example usage for fix values:


<xsl:stylesheet ... xmlns:exslt="http://exslt.org/common"

    extension-element-prefixes="exslt"> 

   

    <!-- FixValues PARVW -> D_3035 -->

    <xsl:variable name="PARVW_TO_D_3035_">

        <item PARVW="AG" D_3035="BY"/>

        <item PARVW="WE" D_3035="DP"/>

    </xsl:variable>

   

    <!-- FixValues adaptions -->

    <xsl:variable name="PARVW_TO_D_3035"

        select="exslt:node-set($PARVW_TO_D_3035_)"/>

As you also see, the fix value "table" is added on top of the stylesheet. This should be a good practice in order to keep an overview over your XSLT and not to have multiple conditions defined somewhere deeper in your stylesheet.

You can then later easily read the values for your target fields:


<xsl:variable name="D_3035"

     select="$PARVW_TO_D_3035/item[@PARVW=current()/PARVW]/@D_3035"/>

Regarding 4)

Personally I would say that XSLT is good for rather complex structure changes like packaging hierarchies.

Additionally you might mix graphical and XSLT mappings where XSLT parts do some pre- or post processing like sorting, namespace handling, indenting or similar. In the end it might also be a strategical ('save of investment') decision for your client which mapping technology to use.

former_member249399
Active Participant
0 Kudos

YOu can try online test tool to check youXSLT mapping like Online XSLT Test Tool