Gary,

The easiest way is to change XConnection#query() method
in the SQL Extension code to return null. For me this usually
happens when an exception is thrown. As I said, the transformation
works correctly it is just Process that refuses to terminate. So I
get all my information including data added to the result tree
after query() returns null.

Attached is a sample Stylesheet I have been using, although it
does not really matter.

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