Skip to Content
   As the need arose in a customer’s PI scenario to have a parameterized XSLT mapping, I started trying to get this to work. Searching the PI forum on SDN showed that I wasn’t the only one struggling with this, so I decided to write this blog for the community. Hope you like it, it’s my first 😉   The concept of this alternative to pass a parameter to an XSLT mapping is simple: we can access the +DynamicConfiguration+ object in an XSLT mapping is, so we need to pass the desired parameters to this object. This is done by a Java mapping. This said, you can now go on to an overview of the complete solution, a detailed description, and the necessary code. Configure.. and go !    h3. the Design: Operation Mapping   We prepend a Java mapping to the XSLT mapping to which we want to pass parameters, the +PutDynConfMapper+. This class passes the payload untouched to the next step, and puts the parameters in the XI Context. image   We define 4 import parameters in the Operation Mapping. These are: ** InputParameterNames: a meta-parameter containing the Binding names of the parameters we want to pass **  InputParameterNamespace: a second optional meta-parameter, containing the Namespace to use for the +DynamicConfigurationKey+image    These parameters need to be bound to the Java mapping step. Notice that the names here do not have to be the same, but take a note of the +Mapping Step parameter names +on the left-hand as you will need them in the next step.image    Here the names of the Java Mapping Step mapping parameters become important. +The ParameterNames parameter is obligatory, and must contain the literal names for this solution to work+. You can see the example in the Operation Mapping test scenario below. image
To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Daniel Graversen
    Hi,
    I was wandering how to use parameters in XSLT. But thought that it was not possible. This seems to be a solution. Though the XSLT mapping should be used on many different mappings for it to justify the use of this extra java mapping step.
    If you just needed two different sets of paramets, you would proabably be better op with overloading some of the XSLT mappings steps.
    (0) 
  2. Prasad Babu Nemalikanti
    Hi
    This is nice to see a blog on parameterized xslt mapping.I have a doubt that java mapping is required prior to xslt mapping?.

    I think you have set the parameters in DynamicConfiguration with help of java mapping so that the parameters will be accessed in xslt mapping.

    So without java mapping, can xslt mapping access parameters?

    Please clarify me.

    Thanks
    Prasad Nemalikanti

    (0) 
  3. Dieter Bauer
    Hi Peter,

    this is a great blog and of use for a lot of people. However I do believe that this is not working in PI 7.11. As far as I know one can not use java.util.map to get to the Dynamic configuration and therefore has to write a another Java class that can be called from the XSLT to fetch the values.

    I might be wrong here and would be interested to know if anybody implemented this as is in 7.11.

    Thanks. Dieter

    (0) 

Leave a Reply