You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by KARANDIKAR Aditi / FTR&D <ad...@rd.francetelecom.com> on 2000/10/18 22:16:26 UTC
Xsp and XSL problems
I'm having problems with xsp and xsl.
I have a servlet from where I'm passing parameters to an xml page.
In the xml page I query some database and return the reslutset in xml using
xsp. I then need to format the resultset for which I am using an XSL
stylesheet. Everything is working fine ie I get the resultset back in xml,
but when I apply the stylesheet I get a blank screen. I've checked the xsl
and to my knowledge it looks ok. Can anyone let me know what's going on
here?
Here's the code for the files I'm using:
#######################################
zbsxsp.xml
#######################################
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="zbshtml.xsl" type="text/xsl"?>
<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:sql="http://www.apache.org/1999/SQL" >
<page>
<xsp:logic>
String req= request.getParameter("reqType");
System.out.println ("Request type is: " + req);
String menuChoice= request.getParameter("menuChoice");
String menuChoiceValue= request.getParameter("menuChoiceValue");
String subAction= request.getParameter("subAction");
String subActionValue=request.getParameter("subActionValue");
String username=request.getParameter("userName");
System.out.println ("Username is: " + username);
<sql:execute-query>
<sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
<sql:dburl>jdbc:oracle:thin:@u-freedev:1521:freedemo</sql:dburl>
<sql:username>system</sql:username>
<sql:password>manager</sql:password>
<sql:query>INSERT into temp_userpdetails values
('<xsp:expr>username</xsp:expr>', '<xsp:expr>menuChoice</xsp:expr>',
'<xsp:expr>menuChoiceValue</xsp:expr>', '<xsp:expr>subAction</xsp:expr>',
'<xsp:expr>subActionValue</xsp:expr>', zapsequence.nextval)</sql:query>
</sql:execute-query>
<sql:execute-query>
<sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
<sql:dburl>jdbc:oracle:thin:@u-freedev:1521:freedemo</sql:dburl>
<sql:username>system</sql:username>
<sql:password>manager</sql:password>
<sql:doc-element>Temp</sql:doc-element>
<sql:row-element>TempRow</sql:row-element>
<sql:query>SELECT userName, menuChoice,
menuChoiceValue, SubAction, SubActionValue, upc, rating, review, artist,
title, category, image, price from temp_userpdetails, upcdata where
menuChoiceValue = upc order by zapid desc</sql:query>
</sql:execute-query>
<sql:execute-query>
<sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
<sql:dburl>jdbc:oracle:thin:@u-freedev:1521:freedemo</sql:dburl>
<sql:username>system</sql:username>
<sql:password>manager</sql:password>
<sql:doc-element>Temp</sql:doc-element>
<sql:row-element>TempRow</sql:row-element>
<sql:query>SELECT userName, menuChoice,
menuChoiceValue, SubAction, SubActionValue, upc, rating, review, artist,
title, category, image, price from userpersonalizationdetails, upcdata where
menuChoiceValue = upc order by category,title </sql:query>
</sql:execute-query>
</xsp:logic>
</page>
</xsp:page>
##########################################################################
zbshtml.xsl
###########################################################################
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:template match="page">
<xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
<HTML>
<HEAD>
<title>alapage.com</title>
</HEAD>
<BODY>
<DIV>
<xsl:apply-templates/>
</DIV>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="Temp">
<TABLE width="300" border="0" height="80">
<TR>
</TR>
<xsl:apply-templates select="TempRow"/>
</TABLE>
</xsl:template>
<xsl:template match="TempRow">
<TR>
<TD width="15" height="80"> <FONT face="Verdana,Arial,Helvetica"
size="1" color="#0059ce"> <xsl:value-of select="@CATEGORY"/> </FONT>
</TD>
<TD> <xsl:value-of select="@IMAGE"/> </TD>
<TD width="125" height="80"> <FONT face="Verdana,Arial,Helvetica"
size="1" color="#0059ce"> <xsl:value-of select="@TITLE"/>
<xsl:value-of select="@ARTIST"/><B>List Price: </B>
<xsl:value-of select="@PRICE"/></FONT></TD>
<TD width="125" height="80"> <FONT face="Verdana,Arial,Helvetica"
size="1" color="#0059ce"> <xsl:value-of select="@REVIEW"/> </FONT> </TD>
</TR>
</xsl:template>
</xsl:stylesheet>
############################################################################
######################
Thanks,
Aditi
RE: Xsp and XSL problems
Posted by Per Kreipke <pe...@onclave.com>.
Xsp and XSL problemsBoy, I sure have to start reading more carefully....
What a useless reply earlier, sorry.
-----Original Message-----
From: Per Kreipke [mailto:per@onclave.com]
Sent: Wednesday, October 18, 2000 4:45 PM
To: cocoon-users@xml.apache.org
Subject: RE: Xsp and XSL problems
I don't think you should have the <sql:execute-query> inside the
<xsp:logic> block.
-----Original Message-----
From: KARANDIKAR Aditi / FTR&D
[mailto:aditi.karandikar@rd.francetelecom.com]
Sent: Wednesday, October 18, 2000 4:16 PM
To: 'cocoon-users@xml.apache.org'
Subject: Xsp and XSL problems
I'm having problems with xsp and xsl.
I have a servlet from where I'm passing parameters to an xml page.
In the xml page I query some database and return the reslutset in xml
using xsp. I then need to format the resultset for which I am using an XSL
stylesheet. Everything is working fine ie I get the resultset back in xml,
but when I apply the stylesheet I get a blank screen. I've checked the xsl
and to my knowledge it looks ok. Can anyone let me know what's going on
here?
Here's the code for the files I'm using:
#######################################
zbsxsp.xml
#######################################
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="zbshtml.xsl" type="text/xsl"?>
<xsp:page language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:sql="http://www.apache.org/1999/SQL" >
<page>
<xsp:logic>
String req= request.getParameter("reqType");
System.out.println ("Request type is: " + req);
String menuChoice= request.getParameter("menuChoice");
String menuChoiceValue= request.getParameter("menuChoiceValue");
String subAction= request.getParameter("subAction");
String subActionValue=request.getParameter("subActionValue");
String username=request.getParameter("userName");
System.out.println ("Username is: " + username);
<sql:execute-query>
<sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
<sql:dburl>jdbc:oracle:thin:@u-freedev:1521:freedemo</sql:dburl>
<sql:username>system</sql:username>
<sql:password>manager</sql:password>
<sql:query>INSERT into temp_userpdetails values
('<xsp:expr>username</xsp:expr>', '<xsp:expr>menuChoice</xsp:expr>',
'<xsp:expr>menuChoiceValue</xsp:expr>', '<xsp:expr>subAction</xsp:expr>',
'<xsp:expr>subActionValue</xsp:expr>', zapsequence.nextval)</sql:query>
</sql:execute-query>
<sql:execute-query>
<sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
<sql:dburl>jdbc:oracle:thin:@u-freedev:1521:freedemo</sql:dburl>
<sql:username>system</sql:username>
<sql:password>manager</sql:password>
<sql:doc-element>Temp</sql:doc-element>
<sql:row-element>TempRow</sql:row-element>
<sql:query>SELECT userName, menuChoice,
menuChoiceValue, SubAction, SubActionValue, upc, rating, review, artist,
title, category, image, price from temp_userpdetails, upcdata where
menuChoiceValue = upc order by zapid desc</sql:query>
</sql:execute-query>
<sql:execute-query>
<sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
<sql:dburl>jdbc:oracle:thin:@u-freedev:1521:freedemo</sql:dburl>
<sql:username>system</sql:username>
<sql:password>manager</sql:password>
<sql:doc-element>Temp</sql:doc-element>
<sql:row-element>TempRow</sql:row-element>
<sql:query>SELECT userName, menuChoice,
menuChoiceValue, SubAction, SubActionValue, upc, rating, review, artist,
title, category, image, price from userpersonalizationdetails, upcdata where
menuChoiceValue = upc order by category,title </sql:query>
</sql:execute-query>
</xsp:logic>
</page>
</xsp:page>
##########################################################################
zbshtml.xsl
###########################################################################
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:template match="page">
<xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
<HTML>
<HEAD>
<title>alapage.com</title>
</HEAD>
<BODY>
<DIV>
<xsl:apply-templates/>
</DIV>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="Temp">
<TABLE width="300" border="0" height="80">
<TR>
</TR>
<xsl:apply-templates select="TempRow"/>
</TABLE>
</xsl:template>
<xsl:template match="TempRow">
<TR>
<TD width="15" height="80"> <FONT face="Verdana,Arial,Helvetica"
size="1" color="#0059ce"> <xsl:value-of select="@CATEGORY"/> </FONT>
</TD>
<TD> <xsl:value-of select="@IMAGE"/> </TD>
<TD width="125" height="80"> <FONT face="Verdana,Arial,Helvetica"
size="1" color="#0059ce"> <xsl:value-of select="@TITLE"/>
<xsl:value-of select="@ARTIST"/><B>List Price: </B>
<xsl:value-of select="@PRICE"/></FONT></TD>
<TD width="125" height="80"> <FONT face="Verdana,Arial,Helvetica"
size="1" color="#0059ce"> <xsl:value-of select="@REVIEW"/> </FONT> </TD>
</TR>
</xsl:template>
</xsl:stylesheet>
############################################################################
######################
Thanks,
Aditi
RE: Xsp and XSL problems
Posted by Per Kreipke <pe...@onclave.com>.
Xsp and XSL problemsI don't think you should have the <sql:execute-query>
inside the <xsp:logic> block.
-----Original Message-----
From: KARANDIKAR Aditi / FTR&D
[mailto:aditi.karandikar@rd.francetelecom.com]
Sent: Wednesday, October 18, 2000 4:16 PM
To: 'cocoon-users@xml.apache.org'
Subject: Xsp and XSL problems
I'm having problems with xsp and xsl.
I have a servlet from where I'm passing parameters to an xml page.
In the xml page I query some database and return the reslutset in xml
using xsp. I then need to format the resultset for which I am using an XSL
stylesheet. Everything is working fine ie I get the resultset back in xml,
but when I apply the stylesheet I get a blank screen. I've checked the xsl
and to my knowledge it looks ok. Can anyone let me know what's going on
here?
Here's the code for the files I'm using:
#######################################
zbsxsp.xml
#######################################
<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="zbshtml.xsl" type="text/xsl"?>
<xsp:page language="java" xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:sql="http://www.apache.org/1999/SQL" >
<page>
<xsp:logic>
String req= request.getParameter("reqType");
System.out.println ("Request type is: " + req);
String menuChoice= request.getParameter("menuChoice");
String menuChoiceValue= request.getParameter("menuChoiceValue");
String subAction= request.getParameter("subAction");
String subActionValue=request.getParameter("subActionValue");
String username=request.getParameter("userName");
System.out.println ("Username is: " + username);
<sql:execute-query>
<sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
<sql:dburl>jdbc:oracle:thin:@u-freedev:1521:freedemo</sql:dburl>
<sql:username>system</sql:username>
<sql:password>manager</sql:password>
<sql:query>INSERT into temp_userpdetails values
('<xsp:expr>username</xsp:expr>', '<xsp:expr>menuChoice</xsp:expr>',
'<xsp:expr>menuChoiceValue</xsp:expr>', '<xsp:expr>subAction</xsp:expr>',
'<xsp:expr>subActionValue</xsp:expr>', zapsequence.nextval)</sql:query>
</sql:execute-query>
<sql:execute-query>
<sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
<sql:dburl>jdbc:oracle:thin:@u-freedev:1521:freedemo</sql:dburl>
<sql:username>system</sql:username>
<sql:password>manager</sql:password>
<sql:doc-element>Temp</sql:doc-element>
<sql:row-element>TempRow</sql:row-element>
<sql:query>SELECT userName, menuChoice,
menuChoiceValue, SubAction, SubActionValue, upc, rating, review, artist,
title, category, image, price from temp_userpdetails, upcdata where
menuChoiceValue = upc order by zapid desc</sql:query>
</sql:execute-query>
<sql:execute-query>
<sql:driver>oracle.jdbc.driver.OracleDriver</sql:driver>
<sql:dburl>jdbc:oracle:thin:@u-freedev:1521:freedemo</sql:dburl>
<sql:username>system</sql:username>
<sql:password>manager</sql:password>
<sql:doc-element>Temp</sql:doc-element>
<sql:row-element>TempRow</sql:row-element>
<sql:query>SELECT userName, menuChoice,
menuChoiceValue, SubAction, SubActionValue, upc, rating, review, artist,
title, category, image, price from userpersonalizationdetails, upcdata where
menuChoiceValue = upc order by category,title </sql:query>
</sql:execute-query>
</xsp:logic>
</page>
</xsp:page>
##########################################################################
zbshtml.xsl
###########################################################################
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:template match="page">
<xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
<HTML>
<HEAD>
<title>alapage.com</title>
</HEAD>
<BODY>
<DIV>
<xsl:apply-templates/>
</DIV>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="Temp">
<TABLE width="300" border="0" height="80">
<TR>
</TR>
<xsl:apply-templates select="TempRow"/>
</TABLE>
</xsl:template>
<xsl:template match="TempRow">
<TR>
<TD width="15" height="80"> <FONT face="Verdana,Arial,Helvetica"
size="1" color="#0059ce"> <xsl:value-of select="@CATEGORY"/> </FONT>
</TD>
<TD> <xsl:value-of select="@IMAGE"/> </TD>
<TD width="125" height="80"> <FONT face="Verdana,Arial,Helvetica"
size="1" color="#0059ce"> <xsl:value-of select="@TITLE"/>
<xsl:value-of select="@ARTIST"/><B>List Price: </B>
<xsl:value-of select="@PRICE"/></FONT></TD>
<TD width="125" height="80"> <FONT face="Verdana,Arial,Helvetica"
size="1" color="#0059ce"> <xsl:value-of select="@REVIEW"/> </FONT> </TD>
</TR>
</xsl:template>
</xsl:stylesheet>
############################################################################
######################
Thanks,
Aditi
Re: Xsp and XSL problems
Posted by Donald Ball <ba...@webslingerZ.com>.
yOn Wed, 18 Oct 2000, KARANDIKAR Aditi / FTR&D wrote:
> I'm having problems with xsp and xsl.
> I have a servlet from where I'm passing parameters to an xml page.
> In the xml page I query some database and return the reslutset in xml using
> xsp. I then need to format the resultset for which I am using an XSL
> stylesheet. Everything is working fine ie I get the resultset back in xml,
> but when I apply the stylesheet I get a blank screen. I've checked the xsl
> and to my knowledge it looks ok. Can anyone let me know what's going on
> here?
this is a general xsl question and should be directed to the xsl list on
mulberrytech - however, your xslt is trying to refer to attributes, while
your xml resultset consists of elements. i'd say that's a problem.
- donald