471,897 Members | 2,240 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,897 software developers and data experts.

** Problem to print node no using position() fucntion for selective records

Hi Friends,

I am working in SAP XI Platform. In this, we use XSLT Mapping.

I am facing one problem to print in field 'RecordID' starts from 1,2,3 in the target structure for those records received in the target side based on condition

I explain my problem clearly.

My source strucutre (with data) is like below.
<?xml version="1.0" encoding="UTF-8"?>


My Target Structure is like below.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:PayPeriod_KCRS xmlns:ns0="http://ehro.eds.com/KCRS/PayPeriod">

Now, the requirement is, Source Structure may contain any number of records like 2 sample records above. We have to send only those records which are having COMPANY = 214 fields from source to target. Then, in the target side we should print record no in the Recordid field. It should be for the first record = 1, 2nd record = 2 like this.

I use for..each loop to filter records from source for the company code. But, to print recordid i use 'position()' function. When use this function, we get the actual position of the source record in this field.
For examle,
If source records look like below.

Record 1
Record 2
Record 3
Record 4

When we filter records for Company Code = 214, we will get in the target side Record 1 & 4. When we use position() function we get the output like below

Target Records:

Rec 1:
<RecordID> 1</RecordID>
Rec 2:

But, we want the output like below. Because, only 2 records matched the condition and we get those records in the output

Rec 1:
<RecordID> 1</RecordID>
Rec 2:

I tried many ways to achieve this (call-template, param, etc). But they didn't work.

Friends, Kindly help me to solve this problem.

Expecting your reply.

Thank you.
Jegathees P.
Jul 4 '07 #1
0 1071

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Hans-Michael Rupp | last post: by
4 posts views Thread by Alfred Taylor | last post: by
22 posts views Thread by joshc | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.