By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,078 Members | 2,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,078 IT Pros & Developers. It's quick & easy.

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

P: 1
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="">

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
Share this question for a faster answer!
Share on Google+

Post your reply

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