john --

I only get query() called once because it only prints "query()" once
which is right after writing "Connection make OK".  The output is pretty
wierd though because it shows two normal looking <row-set> groups (even
though there should only be one) and then some column-headers and rows
at the top level.  But that's another story.

Note: Your XSLT that you supplied had two calls two query() in it. 
Maybe this is causing the confusion.  Is that it?

Gary

John Gentilin wrote:
> 
> Gary,
> 
> Can you take a look at another one for me. If I execute the folowing code
> <xsl:copy-of select="$table" /> , the query() function is called twice. Now
> if I add anything to the XPath statement like select="$table/row-set", it
> is only called once.
> 
> Thanks
> John G
> 
> Gary L Peskin wrote:
> 
> > John --
> >
> > Here is the diff that will fix your XPath problems:
> >
> > cvs diff SQLDocument.java (in directory
> > C:\Xalan-dev\xml-xalan\java\src\org\apache\xalan\lib\sql\)
> > Index: SQLDocument.java
> > ===================================================================
> > RCS file:
> > /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/SQLDocument.java,v
> > retrieving revision 1.7
> > diff -r1.7 SQLDocument.java
> > 806c806
> > <     if (nodeIdx != DTM.NULL) return m_attribute.elementAt(nodeIdx);
> > ---
> > >     if (nodeIdx != DTM.NULL) return m_attribute.elementAt(nodeIdx) | m_dtmIdent;
> > 868c868
> > <     if (nodeIdx != DTM.NULL) return m_nextsib.elementAt(nodeIdx);
> > ---
> > >     if (nodeIdx != DTM.NULL) return m_nextsib.elementAt(nodeIdx) | m_dtmIdent;
> >
> > What was happening was that in getFirstAttribute and getNextAttribute
> > you were returning the raw node number (ie 0x00000004) instead of the
> > full node number which included the DTM id (ie 0x00300004).
> >
> > You may have this problem in some other methods as well but these were
> > the ones I found off the bat and they fixed the original problem.  Since
> > you're much more familiar with the code, perhaps you could check other
> > similar methods and make sure they return the full node number.
> >
> > Also, I haven't committed anything since I didn't want to step on any of
> > your changes.  I saw that Joe gave you some suggestions regarding
> > tracking down the hanging thread.  If you need assistance on that,
> > please come back to me and I'll have a look.
> >
> > Gary
> >
> > John Gentilin wrote:
> > > ...
> > > If you have the time to look at this, I am also having another
> > > problem that is really hanging me up. If I execute an XPath
> > > statement and the select specifies the extent on a tree, it
> > > will result in an exception. So if I have the code
> > >
> > > <xsl:copy-of select="$table/row-set/row/column" />
> > >
> > > An exception will occur where as if I execute the following.
> > >
> > > <xsl:copy-of select="$table/row-set/row" />
> > > Not only will the exception NOT occur, the data is transferred
> > > to the result tree just fine.
> > >
> > > The same occurs for the following code pair
> > > <xsl:copy-of select="$table/row-set/column-header" />
> > > and
> > > <xsl:copy-of select="$table/row-set" />
> > >
> > > The only difference I can see is that the XPath statement
> > > specifies all the elements in the selected branch.
> > >
> > > Regards
> > > John G
> > >
> > > Gary L Peskin wrote:
> > >
> > > > John --
> > > >
> > > > I can't think of anything in the extension mechanism that would make
> > > > this happen.  If null is returned from an extension element, nothing
> > > > happens.  If returned from an extension function, it just turns into an
> > > > XNull.  If you can't figure it out, please post what I would need to
> > > > recreate the situation.
> > > >
> > > > Thanks,
> > > > Gary
> > > >
> > > > John Gentilin wrote:
> > > > >
> > > > > If my extension returns null, the transformation seems to
> > > > > complete as expected but Process never seems to terminate,
> > > > > like some background thread is just keeping the program
> > > > > hung up.
> > >
> > >   ------------------------------------------------------------------------
> > > <?xml version="1.0"?>
> > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> > >                 version="1.0"
> > >                 xmlns:sql="org.apache.xalan.lib.sql.XConnection"
> > >                 extension-element-prefixes="sql">
> > >
> > > <xsl:output method="html" indent="yes"/>
> > >
> > > <xsl:param name="driver" select="'org.enhydra.instantdb.jdbc.idbDriver'"/>
> > > <xsl:param name="datasource" select="'jdbc:idb:./instantdb/sample.prp'"/>
> > > <xsl:param name="query" select="'SELECT * FROM import1'"/>
> > >
> > > <xsl:template match="/">
> > >     <xsl:variable name="db" select="sql:new($driver, $datasource)"/>
> > >     <!-- xsl:if test="sql:connect($db, $driver, $datasource)" -->
> > >       <xsl:text> Connection make OK</xsl:text>
> > >     <!-- /xsl:if -->
> > >     <xsl:variable name="table" select='sql:query($db, $query)'/>
> > >     <!--
> > >       <xsl:for-each select="$table/row-set/column-header">
> > >         <xsl:value-of select="@column-label"/></TH>
> > >       </xsl:for-each>
> > >     -->
> > >     <xsl:variable name="table" select='sql:query($db, $query)'/>
> > >     <xsl:copy-of select="$table/row-set/" />
> > >     <xsl:value-of select="sql:close($db)"/>
> > >
> > > </xsl:template>
> > >
> > > </xsl:stylesheet>

Reply via email to