
<xsl:stylesheet xmlns:sql="java:/net.sf.saxon.sql.SQLElementFactory" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon sql">

	<!-- insert your database details here, or supply them in parameters -->
	<xsl:param name="driver" select="'oracle.jdbc.OracleDriver'"/>
	<xsl:param name="database" select="'xxxxxxxxxxxxxxxxxxxxxxxx'"/>
	<xsl:param name="user" select="'xxxxxxxxxx'"/>
	<xsl:param name="password" select="'xxxxxxxx'"/>




	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:if test="not(element-available('sql:connect'))">
			<xsl:message>sql:connect is not available</xsl:message>
		</xsl:if>

		<xsl:message>Connecting to <xsl:value-of select="$database"/>...</xsl:message>

		<xsl:variable name="connection" as="java:java.sql.Connection" xmlns:java="http://saxon.sf.net/java-type">
			<sql:connect driver="{$driver}" database="{$database}" user="{$user}" password="{$password}">
				<xsl:fallback>
					<xsl:message terminate="yes">SQL extensions are not installed</xsl:message>
				</xsl:fallback>
			</sql:connect>
		</xsl:variable>

		<xsl:message>Connected...</xsl:message>


		<xsl:variable name="book-table">
			<sql:query connection="$connection" table="M2CM3.M2CM_REPORT_DEFINITIONS" column="*" row-tag="Lines" column-tag="col">
				<where>SELECT * FROM M2CM3.M2CM_REPORT_DEFINITIONS</where>
			</sql:query>
		</xsl:variable>



		<xsl:message>There are now <xsl:value-of select="count($book-table//Lines)"/> books.</xsl:message>
<xsl:copy-of select="$book-table//*"/>
		<sql:close connection="$connection"/>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="file:///z:/kpn_eai/mobile/dev/hawk/hawkhttp/xsl/colors.xml" htmlbaseurl="" outputurl="" processortype="saxon8" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition></MapperMetaTag>
</metaInformation>
-->