[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Number of scans required ??


Subject: RE: [xsl] Number of scans required ??
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 7 Aug 2003 16:37:51 +0100

> 
> 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



Current Thread
Keywords