Skip to Content

Description

This weblog explains the usage and syntax of various xpath functions like translate(),concat(),Subsrting(),sum(),count() string() in xslt mapping with an example…

Here I would like explain the syntax and number of parameters accepted by each xpath funtion.

substring()

This Function is used to extract some portions of the string from the original string.It takes a specified number of characters out of a string

syntax:

substring(“PRASAD BABU”,1,6)

translate()

The translate function takes the string in the value argument,replaces all occurrecnes of a string specified in the string1 argument with substitue characters specified in string2 argument and returns the modified string.

syntax:

translate(“prasad babu”,”abcdefghijklmnopqrstuvwxyz”,”ABCDEFGHIJKLMNOPQRSTUVWXYZ”)

string()

The string function converts the input to a string.

syntax:

string(“prasad babu”)

concat()

The concat function takes all the individual arguments,concatenates them together in order,and returns the resultstant string

syntax:

concat(“prasad”,”babu”)

sum()

The sum function converts PCDATA text to a numeric value

syntax:

sum(p2:marks/score)

count()

This function is used to count the nodes

syntax:

count(p2:marks/subjects)

Target Message Type

image

Source Message Type

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. raj kumar
    Hi Prasad,

    Thanks for writing up the blog. It’s very interesting to me. I’m a beginner, it is not very clear to me how to use the xslt. Can you post an example of how it can be used. My guess is it would be imported in to integration repository and be used as a mapping instead of defining it there. Can you please post a brief step-by-step example? I’m sure it will be helpful to newbies like me…

    Many thanks to you again!
    Raj

    (0) 
    1. Guido Koopmann
      Raj,
      When you have an XSLT, it’s easy to import it into XI.

      1. Save your XSL file as a ZIP file
      2. GoTo XI, create a new Imported Archive and Import the zip file.
      3. In your Interface mapping, select the source & target interface, click on read interfaces and at the section mapping program select tye type XSL and look for your uploaded XSL-T zip file.

      That’s all

      (0) 

Leave a Reply