[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

implementing for-each for comparision

Subject: implementing for-each for comparision
From: Dipesh Khakhkhar <dkhakhkh@xxxxxxxxxxxxxxx>
Date: Thu, 2 Oct 2003 21:13:57 -0400
foreach exit loop
Hi,

I am having xml like this.
Input xml (File1)
----------
<Root>
 <Tables>
   <Table Name="T1" Value="tableName1">
    <Column Name="col1" Value="colVal1" Datatype="char"/>
    <Column Name="col2" Value="colVal2" Datatype="char"/>
    <Column Name="col3" Value="colVal3" Datatype="date"/>
    <Column Name="col5" Value="colVal5" Datatype="char"/>
   </Table>
 </Table>
<Root>

===================================================================

I am reding one more xml file for mapping columns. I am reading it using 
document function. This xml gives me the name of the column for which data is 
available in the datafile.

Document Mapping xml  (File2)
--------------------
<Root>
<FixedTables>
  <Table Name="T1">
    <Column Name="Col1" />
    <Column Name="Col2" />
    <Column Name="Col3" />
    <Column Name="Col4" />
    <Column Name="Col5" />
</Table>
</Root>


I am creating a text file(basically control file which i am feeding to sql 
loader) out of it and needs output like this. I am showing a part of my 
desired output.

Desried output (File3)
--------------
INTO TABLE tableName1
(
colVal1,
colVal2,
colVal3 Date "MM/DD/YYYY HH:MI:SS AM",
col4 FILLER char terminated by '`',
colVal5
)

====================================================================

I am able to get the output properly if there is no col4 in the mapping file 
i.e. file2 then not writing line 5 above in the output.

I want to implement something like
 1) Read each column from the File1.
 2) Match it will all the columns of File2
 3) If name of column is same then get the value of column from file1 and 
check if datatype attribute is date then output "Date MM:DD:YYYY HH:MI:SS AM" 
otherwise don't do anything.
 4) If match exit from the for loop (is this possible in xsl)
 5) After doing match for all the columns of file1, whichever columns of file2 
are not matched shall be written within parenthesis like
"Column@Name (from file2) FILLER char terminated by '`'. As shown in the above 
desired output col4 came only once in the output for matching all the columns 
of File1 with that of file2.

I hope i am clear in explaining my problem.
Any help to implement the above logic would be highly appreciated.

Eagerly waiting for reply.

Regards,
Dipesh


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.