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(_at_)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