Subject: [xsl] Re: How to implement Divide and Conquer Algo on this template !! Getting Callstack overflow error From: Dipesh Khakhkhar <dkhakhkh@xxxxxxxxxxxxxxx> Date: Fri, 19 Sep 2003 13:46:42 -0400 |
Hi, To avoid the Callstack error for huge input files. I have to change my algorithm to find unique names. I do it for finding unique attribute names and unique attribute values. Now using Munechian method how do i find unique values for the TableName and for each TableName how do i find unique ColumnName in the following xml. Input ----- <Root> <FNode> <SNode> <Table TableName="fName> <Row> <Column Name="ColName1"/> <Column Name="ColName2"/> </Row> <Row> <Column Name="ColName1"/> <Column Name="ColName3"/> <Column Name="ColName4"/> </Row> </Table> <Table TableName="SecondTname"> <Row> <Column Name="ColName1"/> <Column Name="ColName2"/> <Column Name="ColName3"/> <Column Name="ColName4"/> </Row> <Row> <Column Name="ColName1"/> <Column Name="ColName5"/> <Column Name="ColName6"/> </Row> </Table> </SNode> <SNode> <Table TableName="fName> <Row> <Column Name="ColName1"/> <Column Name="ColName2"/> </Row> <Row> <Column Name="ColName1"/> <Column Name="ColName5"/> <Column Name="ColName6"/> </Row> </Table> <Table TableName="SecondTname"> <Row> <Column Name="ColName2"/> <Column Name="ColName3"/> </Row> <Row> <Column Name="ColName7"/> <Column Name="ColName8"/> </Row> </Table> <Table TableName="ThirdTname"> <Row> <Column Name="ColName1"/> <Column Name="ColName2"/> </Row> </Table> </SNode> </FNode> </Root> There can be any number of Table nodes within SNode and there will be any number of SNodes within FNode. My previous logic was to find the unique table names and then for each table name find unique Column names. As pointed out, I was using inefficient code to the same, it was working fine when there were limited number of Table nodes but i got Callstack overflow error when number of Table node increased. As Dimitre told, then i moved to implement grouping using xsl:key. I am formin xml file as output. For the above xml file the output will be Desired output -------------- <Root> <Tables> <Table Name="FNode"> <!-- Here column node corresponding to unique attribute names for FNode will be written. For simplicity this is dropped from the current xml. I am able to get this output --> </Table> <!-- Similarly for second table --> <Table Name="SNode"> </Table> <Table Name="fName"> <Column Name="ColName1"/> <Column Name="ColName2"/> <Column Name="ColName3"/> <Column Name="ColName4"/> <Column Name="ColName5"/> <Column Name="ColName6"/> </Table> <Table Name="SecondTname"> <Column Name="ColName1"/> <Column Name="ColName2"/> <Column Name="ColName3"/> <Column Name="ColName4"/> <Column Name="ColName5"/> <Column Name="ColName6"/> <Column Name="ColName7"/> <Column Name="ColName8"/> </Table> <Table Name="ThirdTname"> <Column Name="ColName1"/> <Column Name="ColName2"/> </Table> </Tables> </Root> I hope, I am clear in explaining my problem. Any help to get the solution in efficent way will be highly appreciated. I wrote the solution but it is not efficient thats why i have to change the entire xsl now. Eagerly waiting for reply. Regards, Dipesh XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: How to implement Divide a, Dimitre Novatchev | Thread | [xsl] Re: How to implement Divide a, Dimitre Novatchev |
[xsl] Re: How to implement Divide a, Dimitre Novatchev | Date | [xsl] javascript- variable question, Bruce Rojas-Rennke |
Month |