I think your reference to XQuery here is a red herring - the example uses XSLT and the Saxon SQL extension.
Saxon's error message here is very unhelpful, but it occurs when the stylesheet has decided (at compile time) to take the xsl:fallback route because it cannot locate the implementation of the SQL extension instructions. Generally this is a classpath problem.
See what happens when you use the same classpath and do
javap -classpath XXXX net.sf.saxon.sql.SQLQuery
This will tell you whether the classpath is correct or not.
Michael Kay

From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Srikumar.Kareti
Sent: 06 October 2004 17:43
To: saxon-help@lists.sourceforge.net
Subject: [saxon] problem running one of the examples:books-sql

Guys, I need help!
I downloaded SaxonB version 8. I tried running the example which uses XQuery.
I did not make any changes to the code, I just wanted to run it and see if it tries
to make a connection to the non-existing database. I got a compile error.
Am I missing something.
Here is my run.
C:\Tools\SaxonB\samples>C:\j2sdk1.4.2_05\bin\java -classpath "c:\Tools\SaxonB\sa
am Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Fil
es\Microsoft SQL Server 2000 Driver for JDBC\lib\msutils.jar;C:\Program Files\Mi
crosoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;" net.sf.saxon.Trans
form data\books.xml styles\books-sql.xsl
Error at xsl:variable on line 28 of file:/C:/Tools/SaxonB/samples/styles/books-s
  XP0006: An empty sequence is not allowed as the value of variable $connection
Failed to compile stylesheet. 1 error detected.
Thanks, SriKumar.