473,586 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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"?>

<EDS_CAL_XML>
<EDS_PAY_CALEND A>
<CLIENT_ID>1</CLIENT_ID>
<COMPANY>214</COMPANY>
<PAYGROUP>WK2 </PAYGROUP>
<PAY_END_DT>0 5/27/2007</PAY_END_DT>
<PAY_BEGIN_DT>0 5/14/2007</PAY_BEGIN_DT>
<CHECK_DT>06/01/2007</CHECK_DT>
<PERIOD_WEEKS>2 </PERIOD_WEEKS>
<PAY_PERIOD>1 </PAY_PERIOD>
<PAY_PDS_PER_YE AR>26</PAY_PDS_PER_YEA R>
</EDS_PAY_CALENDA >
<EDS_PAY_CALEND A>
<CLIENT_ID>1</CLIENT_ID>
<COMPANY>284</COMPANY>
<PAYGROUP>WK2 </PAYGROUP>
<PAY_END_DT>0 6/03/2007</PAY_END_DT>
<PAY_BEGIN_DT>0 5/28/2007</PAY_BEGIN_DT>
<CHECK_DT>06/08/2007</CHECK_DT>
<PERIOD_WEEKS>1 </PERIOD_WEEKS>
<PAY_PERIOD>2 </PAY_PERIOD>
<PAY_PDS_PER_YE AR>52</PAY_PDS_PER_YEA R>
</EDS_PAY_CALENDA >
</EDS_CAL_XML>

My Target Structure is like below.
-----------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<ns0:PayPeriod_ KCRS xmlns:ns0="http ://ehro.eds.com/KCRS/PayPeriod">
<PayPeriod>
<Recordid>1</Recordid>
<Client_id>1</Client_id>
<Company_code>2 14</Company_code>
<Pay_group>WK 2</Pay_group>
<Payend_date> 05/27/2007</Payend_date>
<Paybegin_date> 05/14/2007</Paybegin_date>
<Check_date>0 6/01/2007</Check_date>
<Period_weeks>2 </Period_weeks>
<Pay_period>1 </Pay_period>
<Pay_periods_pe r_year>26</Pay_periods_per _year>
</PayPeriod>
</ns0:PayPeriod_K CRS>
------------------------------------------

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
<COMPANY>214</COMPANY>
Record 2
<COMPANY>284</COMPANY>
Record 3
<COMPANY>314</COMPANY>
Record 4
<COMPANY>214</COMPANY>

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:
....
<RecordID>4<Rec ordID>
......

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:
....
<RecordID>2<Rec ordID>
......

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 1123

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

Similar topics

10
5475
by: Fabio | last post by:
Hi everyone, Is there anybody who can suggest me a link where I can find information about 'Persistent linked list' ? I need to implement a linked list where every node is a structure like the following: struct Node { int integer_value;
2
3487
by: Hans-Michael Rupp | last post by:
Hallo! How can find out the postion of a node with a particular content in the nodeset WITHOUT being in the context? I would like have something like <xsl:variable name="position" select="position(/foo/bar)"> of course position() does not work this way. Is there another way to solve this?
1
3730
by: chris yoker | last post by:
hiya, I succesfully return a "nodeList" thru the "xmlDoc.SelectNodes" method. This nodeList is taken from a repetitive, uniform xml doc. I can successfully append a child node at the correct position using the following code: <code> <!--Node inserted into corrrect position in nodeList(0)-->
5
6145
by: reddy | last post by:
I am trying to insert a node into an XMLFile. using XMLTextwriter. My Question is Is it possible to do without using XMLDocument. Because its loading all the the file into memory. I just want to insert in the front. My code is give below. Is it possible to do without using XMLDOcument? Dim masterDoc As String =...
6
1877
by: Eddy C | last post by:
Hi, I'm trying to get the value of another node using the position of another node or the name of the tag. Such that the current node is one of the contacts child nodes sec or prim and doing <xsl:value-of select="//cust/name"/>
4
3022
by: Alfred Taylor | last post by:
I essentially need a countif() function for xsl. Something to where I could do countif(node-set, condition). Rather than try to get too extreme, i decided to just write one for my countif() with the condition hardcoded. (this was also my first venture into creating "functions") Pseudo-code is essentially this: Look at the current node and...
4
11582
by: Phill | last post by:
Here's what I'm doing to make the right context mnue show up based on what node was cliked: private void tvwMenu_MouseUp(object sender, MouseEventArgs e) { //Select Node When Right Clicked & Set Context Menu To Use if( e.Button == MouseButtons.Right ) { TreeNode node = tvwMenu.GetNodeAt( new Point( e.X, e.Y ) ); if( node != null )
22
8026
by: joshc | last post by:
In an interview for an embedded software position recently I was asked to write code, in C, for printing the contents of a linked list backwards. After a few minutes I came up with the recursive solution. Being that recursion is frowned upon in embedded software, the answer was not what the interviewer expected, but alas it was correct. I...
2
2652
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. creating a method to search a tree to find the position of node and to return its pointer value basically i need to read in a text file... shown below H H,E,L E,B,F B,A,C A,null,null
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.