Hi Paula, Xalan v2.4 and some of the 2.3 developer releases have a bug which affects the SQL extension in its default mode. Here is what's going on.
The SQL extension operates in two modes, streaming and non streaming. The context of the term streaming is a little different here than in other cases. In Streaming mode, while you traverse the data set, the row / column data for all the rows will only occupy the space needed for one row. This allows you to execute the 1M row query and use very little memory in the SQL extension. In Non Streaming mode, the data is processed incrementally. I.e. when you do a query/pquery, the whole record set is not read before returning, it is read incrementally. The difference here is that the previous rows of data are retained in memory, as you walk each row the document will get incrementally larger. This is important if you need to access previous rows either to re-traverse the data or even peek back at the previous row using the ancestor axis. The Bug is that Xalan is unnecessarily sorting the SQLDocument and the default mode is Streaming ON. Hence you are only left with the last row. There are however two workarounds available. 1) Turn Streaming Off with the statement <xsl:value-of select="sql:disableStreaming($db)" /> This work around will have the side effect of requiring more memory but in some cases this may be a desirable effect. 2) When you apply templates select only on the sql/row-set and NOT sql/row-set/row. Then write a dummy template as follows. <xsl:template match="row" > <xsl:apply-templates select="row" /> </xsl:apply-templates> What happens here is that Xalan still tries to sort but is sorts on a portion of the document that only contains one element "row-set". If you use relitive XPath statements from there, Xalan will assume that the document is pre sorted and won't try to perform further sorting. Both work around's will continue to function once the bug has been fixed. Hope that helps John G "McClain, Paula S." wrote: > John, > I am running the basicConnection sample and am only getting a single row > of data in my output HTML file even though the database has multiple rows. > I fixed it by using hard coded indexes for the result rows, but cannot > figure out how to use variable indexes to the rows in the loop. Is there a > way to do this without using indexes? If not how can I use variable > indexes? Thanks a lot. > > Paula > > Here is a code snippet including my modifications: > <TR> > > <xsl:for-each select="$table/sql/metadata/column-header"> > > <TH><xsl:value-of select="@column-label"/></TH> > > </xsl:for-each> > > </TR> > > <xsl:for-each select="$table/sql/row-set"> > > <!--start of my mod--> > <xsl:variable name="counter" select="0"/> > <xsl:for-each select="$table/sql/row-set/row"> > > <!--xsl:apply-templates > select="$table/sql/row-set/row[($counter)+1]"/--> > <xsl:apply-templates select="$table/sql/row-set/row"/> > </xsl:for-each> > <!--end of my mod--> > > </xsl:for-each> > </TABLE>
