cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khaja, Saif" <Saif.Kh...@icn.siemens.com>
Subject SQL XSP query and XSL formatting....
Date Thu, 03 Aug 2000 23:44:08 GMT
Hi all,

I was trying to execute separate queries based on some dynamic conditions in
my XSP page and display them into HTML using XSL. 
It successfully generates the XML output :) but it gives error when I try to
include XSL stylesheet with it..... :( 
It says XSLProcessorException....
Is there anything that I am doing wrong here....

I am sorry if this mail has become too long. But I wanted to make sure that
I am putting all the namespaces correct in their places.

Any suggestions will be a great help.

Thanx in advance.

Here are the code snippets.
*****************************************

********XSP SQL *********************************
<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="rctMain.xsl" type="text/xsl"?>

<xsp:page
  language="java"
  xmlns:sql="http://www.apache.org/1999/SQL"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core">

  <page title="SQL Search Results">

	<xsp:logic>
	String strValue = request.getParameter("sValue");
	String sQuote = request.getParameter("Quote");


	if (strValue.equals("Quote"))
	{
  	<sql:execute-query>
		<sql:driver>sun.jdbc.odbc.JdbcOdbcDriver</sql:driver>
		<sql:dburl>jdbc:odbc:Cr7DS</sql:dburl>
		<sql:username>sa</sql:username>
		<sql:password></sql:password>
		<sql:doc-element>Quote</sql:doc-element>
		<sql:row-element>QuoteRow</sql:row-element>
		<sql:tag-case>lower</sql:tag-case>
		<sql:null-indicator>yes</sql:null-indicator>
		<sql:id-attribute>QuoteID</sql:id-attribute>
		<sql:query>select QuoteID, QuoteDate, QuoteStatus from
SystemInfo  where QuoteID='<xsp:expr>sQuote</xsp:expr>'</sql:query>
		<sql:count-attribute>count</sql:count-attribute>
	</sql:execute-query>
	}
	</xsp:logic>

  </page>


</xsp:page>
*****************************************

****** XML generated is : ********************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<page title="SQL Search Results">

	<Quote count="1"><QuoteRow
quoteid="0"><quoteid>MKCA00901X</quoteid><quotedate>1999-11-14
00:00:00.0</quotedate><quotestatus>LOGGED</quotestatus></QuoteRow></Quote>

  </page>

<!-- This page was served in 1902 milliseconds by Cocoon 1.7.4 -->

*****************************************

*************XSL (rctMain.xsl)  is: *************************************
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="page">
	<xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
  <HTML>
     <HEAD>
	    <title>Architect Page</title>
     </HEAD>
      <BODY>
        <DIV>
	   <xsl:apply-templates/>
        </DIV>
      </BODY>
  </HTML>
  </xsl:template>

  <xsl:template match="Quote">
    <TABLE border="0" frame="border" cellpadding="5">
      <TR>     
        <TH>QuoteID</TH>
        <TH>QuoteDate</TH>
        <TH>QuoteStatus</TH>
      </TR>
	<xsl:apply-templates match="QuoteRow"/>
    </TABLE>
  </xsl:template>

    <xsl:template match="QuoteRow">
	<TR>
      <TD><strong> <xsl:number value="position()" format="1. "/>
</strong></TD>
      <TD> <xsl:value-of select="@quoteid"/> </TD>
      <TD> <xsl:value-of select="@quotedate"/> </TD>
      <TD> <xsl:value-of select="@quotestatus"/> </TD>
	</TR>      
    </xsl:template>

</xsl:stylesheet>
**********************************************************



Saif Khaja



Mime
View raw message