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

RE: Number of scans required ??

Subject: RE: Number of scans required ??
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 8 Aug 2003 12:03:23 +0100
xsl scan
> 
> Thanks a lot for replying.
> 
> Well my document is big enough thats why i haven't pasted it 
> there. But i can generailize how it is and then i think it 
> will give you proper idea.
> 
> <RootNode>
>   <FirstChild> Some Attributes which are columns : </FirstChild>
>       <A> More column names as attributes.
>           <B> More column for this table (corresponding to DB)
>             One or two more level of identations like this.
>           </B>
>       </A>
>    </FirstChild>

No, I'm afraid this doesn't give me a proper idea at all. Are your
columns represented by attributes or elements? You've said attributes,
but in that case why aren't they within the start tag?

Secondly you have a structure here that is four levels deep (plus one or
two), yet you are using the terminology of tables and columns to
describe it. That doesn't fit.

Please producce a cut-down example of your actual document. Or perhaps a
schema/DTD. I don't understand it from this description at all.

Finally, I don't know what you mean by a "scan". I suggest you
concentrate on writing some correct code first, and then worry about how
many times the XSLT processor is scanning your source document. Apart
from anything else, since the data is in memory, the number of times the
document is scanned is not necessarily critical to performance.

Michael Kay

> 
>    <NodeNameSameASFirstChild>
>        <A>
>           <B>
>              <C> Can have this new table </C>
>            </B>
>        </A>
>     </NodeNameSameAsFirstChild>
> 
>      |
>      |
>  </Root>
> 
> 
> So actually i m trying to get the column names(Attributes) of 
> all the tables 
> (elements). In this Root contains 6 elements and within this 
> six element there 
> is the possibility that some table names might come twice or 
> more than that 
> and some will come once once or sometable name might not come.
> 
> I m forming text output like this
> 
> RootID,FirstColOfRoot,SecondColOfRoot,
> FirstChildID,RootID, (Link to parent i..e Primary Key , 
> Foriegn Key) FirstChildFirstTable'sID, FirstChildID, 
> FirstChildFirstTableCol1, 
> FirstChildFirstTableCol2, 
> FirstChildSecondTable'sID, FirstChildID, 
> FirstChildSecondTableCol1, FirstChildSeconDTableCol2 and so on.
> 
> For the above example
> 
> RootID,FCID,RootCol1,RootCol2,FCID,RootID,AID,FCID,Acol1,ACol2,BID, 
> FCID,BCol1,BCol2,BCol3,CID,FCID,CCol1,CCol2, ...so on...
> 
> Well as you can make out i m generating unique key value for 
> every table and 
> relation child to its parent. For this i have used 
> generateid() function. So 
> basically i want to read all the tables in the given xsl only 
> once and get all 
> the column names in my first line.
> So in the first line there will be only column names of the 
> data which is 
> going to follow. I have used comma as a sepertor. And as i 
> shown you above 
> there is the possiblity that one table name will appear under 
> some element and 
> in another it wont. I HOPE I M NOT CONFUSING.
> 
> Since the requirment is like this thats why i asked do i hv 
> to scan it twice 
> or what ?
> 
> Further as i have aske this question seperately about 
> generate-id function 
> will i get the same id bcos my input is going to same for the 
> 6 scans. I m 
> forming 6 output files. (If i need to scan it twice i will 
> need to run it 12 
> times this is not the question) THEN IS IT POSSIBLE THAT I 
> WONT GET UNIQUE ID 
> FOR MY NODES ??
> 
> I hope i have not confused the community with the complicated 
> email like this 
> but i m trying to achieve the result thru better solution.
> 
> Eagerly waiting for your reply.
> 
> Regards,
> 
> 
> 
> 
> Date: Thu, 7 Aug 2003 16:37:51 +0100
> From: "Michael Kay" <mhk@xxxxxxxxx>
> Subject: RE:  Number of scans required ??
> 
> >
> > I am trying to put the name of the elements which 
> corresponds to table 
> > or column names in my database as my topmost line the 
> output txt file.
> >
> > Then i have to get the data for all columns and these files are big 
> > i.e. average 20 MBS.
> >
> > SO DO I REQUIRE TO HAVE TWO SCANS FOR THIS ?? OR IS IT POSSIBLE TO 
> > ACHIEVE IT IN ONE SCAN ??
> 
> You haven't shown your document structure so I'm making guesses here.
> 
> If all the column names are present in the first row, then 
> you can output them as, for example,
> 
> <xsl:for-each select="row[1]/*">
> <th><xsl:value-of select="name(.)"/></th>
> </xsl:for-each>
> 
> Any half-decent XSLT processor will be able to do this 
> without scanning the whole document.
> 
> 
> <
> >
> > And in both the cases, I would be able to append the output 
> of second 
> > scan to the first using insertion operation i.e. something like ">>"
> > or is there some
> > other way to do this ?
> >
> 
> No, you don't want to use text concatenation for this. Think of it as
> building a result tree, with the structure:
> 
> TABLE
> HEADING
> COLUMN1
> COLUMN2
> BODY
> ROW1
> CELL1,1
> CELL1,2
> 
> and then serializing this result tree as text.
> 
> Michael Kay
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 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.