cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Homecentricity" ...@homecentricity.com>
Subject XSP tag library problem C1.8
Date Mon, 15 Jan 2001 21:35:37 GMT
I have been trying to build a simple example of an XML to XML to HTML
transformation incorporating XSP tag libraries. The steps are as follows:
business_default.xml --->XSLT (transform.xsl) --->temp generated XML
file--->XSLT (transformtoHTML.xsl)

I can not get the XSP tag libraries to work. I have, however, succeeded in
getting XSP to work when I embed the java logic code (not tags). This is
killing me to figure out. I need help...

I received the first error (below) when I requested business_default.xml. It
was looking for a semi-colon at the end of the method. I corrected this by
adding a semi-colon to the end of the 'template match' in the logicsheet. I
shouldn't have had to do this though since it isn't called for as part of
the syntax.
I get the second error (below the example of the first error), after adding
that semi-colon. Since I am getting the different errors, I'm sensing that
the logicsheet is being seen and read. The problem seems to be in the
compilation build phase. The java file in the repository directory of my
server does not include any of my logic or structure info near the beginning
of the document. Why? I've been up, down and around this for several days.
I've scoured the FAQs, mailing lists, and other XSP documentation and
examples and found nothing relative. It seems I'm doing everything right.
I've tried putting the logicsheet in a jar file, and pointing to it that
way, as well as using the logic sheet processing instruction. They both
generate the same errors.

Can anyone shed some much needed light on this problem? I've included all of
the source code, for anyone's review. All cocoon xsp examples run fine, as
well as various web site XSP examples I've looked at (including those that
use tag libraries). Help!!! I'm going nuts on this one...

I'm using Apache 1.3.4, Cocoon 1.8, JDK 1.3, and JRun 3.0. I'm running all
of this on Windows 98 -- my personal development platform :-).
-steve larsen

/****** First Error requesting business_default.xml **********
java.lang.Exception: XSP Java Compiler: Compilation failed for
_business_default.java
           101: ';' expected.
                           todaysDate(new Date(), "EEEE MM dd, yyyy")

^
           1 error
                   at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
vaProcessor.java:141)
                   at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:489)
                   at org.apache.cocoon.Engine.handle(Engine.java:359)
                   at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
                   at
javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
                   at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
                   at
allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
                   at
allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.jav
a:88)
                   at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1131)
                   at
allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:330)
                   at
allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java:354)
                   at allaire.jrun.ThreadPool.run(ThreadPool.java:267)
                   at allaire.jrun.WorkerThread.run(WorkerThread.java:74)
************** end First Error ***************/

/************* begin Second Error requesting business_default.xml
***********
java.lang.Exception: XSP Java Compiler: Compilation failed for
_business_default.java
      101: Method todaysDate(java.util.Date, java.lang.String) not found in
class _C_._apache._htdocs._hc_net._business_default.
                      todaysDate(new Date(), "EEEE MM dd, yyyy");
                                          ^
      1 error
              at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
vaProcessor.java:141)
              at
org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java:489)
              at org.apache.cocoon.Engine.handle(Engine.java:359)
              at org.apache.cocoon.Cocoon.service(Cocoon.java:167)
              at
javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
              at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1013)
              at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java:925)
              at
allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.jav
a:88)
              at allaire.jrun.servlet.JRunSE.service(JRunSE.java:1131)
              at
allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java:330)
              at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java:354)
              at allaire.jrun.ThreadPool.run(ThreadPool.java:267)
              at allaire.jrun.WorkerThread.run(WorkerThread.java:74)
************* end Second error *************/

Source files::

/****** begin business_default.xml source *********
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.0.7 (http://www.xmlspy.com) by Steven Larsen
(private) -->
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="transform.xsl" type="text/xsl"?>
<Page>
	<PageTitle>My Business</PageTitle>
	<PageType>Index4</PageType>
</Page>
****** end business_default.xml source **********/

/****** begin transform.xsl source **********
<?xml version="1.0" encoding="UTF-8"?>
<?cocoon-process type="xslt"?>
<xsl:stylesheet version="1.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:fo="http://www.w3.org/1999/XSL/Format"
		xmlns:xsp="http://www.apache.org/1999/XSP/Core"
		xmlns:hc="http://www.homecentricity.com/2001/XSP/Core"
>
<xsl:output media-type="text/xml" method="xml"/>
<xsl:template match="Page">
	<xsl:processing-instruction
name="cocoon-process">type="xsp"</xsl:processing-instruction>
	<xsl:processing-instruction
name="cocoon-process">type="xslt"</xsl:processing-instruction>
	<xsl:processing-instruction
name="xml-logicsheet">href="hc.xsl"</xsl:processing-instruction>
	<xsl:processing-instruction
name="xml-stylesheet">href="transformtoHTML.xsl"
type="text/xsl"</xsl:processing-instruction>
	<xsp:page language="java"
		xmlns:xsp="http://www.apache.org/1999/XSP/Core"
		xmlns:hc="http://www.homecentricity.com/2001/XSP/Core"
	>
		<Page>
			<PageTitle>
				<xsl:value-of select="PageTitle"/>
			</PageTitle>
			<xsl:element name="Date">
				<hc:todaysDate format="EEEE MM dd, yyyy"/>
			</xsl:element>
		</Page>
	</xsp:page>
</xsl:template>

</xsl:stylesheet>
******* end transform.xsl source **********/

/******* begin transformtoHTML.xsl source ********
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:xsp="http://www.apache.org/1999/XSP/Core"
		xmlns:hc="http://www.homecentricity.com/2001/XSP/Core"
>
<xsl:output media-type="text/html" method="html"/>

<xsl:template match="xsp:page">
	<xsl:apply-templates select="Page"/>
</xsl:template>

<xsl:template match="Page">
<html>
	<head>
		<title><xsl:value-of select="PageTitle"/></title>
	</head>
	<body>
		<xsl:apply-templates select="Date"/><br/>
		<xsl:apply-templates select="Session"/><br/>
		<xsl:apply-templates select="Browser"/><br/>
	</body>
</html>
</xsl:template>
<xsl:template match="Date">
Today's date is	<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Session">
	Session ID is <xsl:value-of select="Session"/>
</xsl:template>
<xsl:template match="Browser">
	Browser Type is <xsl:value-of select="Browser"/>
</xsl:template>
</xsl:stylesheet>
******** end transformtoHTML.xsl source ********/

/************ begin hc.xsl logicsheet source **************
<?xml version="1.0" encoding="UTF-8"?>
<?cocoon-process type="xsp"?>
<xsl:stylesheet version="1.0"
		xmlns:xsp="http://www.w3.org/1999/XSP/Core"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:hc="http://www.homecentricity.com/2001/XSP/Core"
>
<xsl:template match="xsp:page">
	<xsp:page>
		<xsl:apply-templates select="@*"/>

		<xsp:structure>
			<xsp:include>java.text.SimpleDateFormat</xsp:include>
		</xsp:structure>
		<xsp:logic>
			/* returns today's date with a specific format */
			private static String todaysDate(Date date, String pattern) {
				if (pattern == null || pattern.length() == 0) {
					pattern = "yyyy-MMM-dd";
				}
				return (new SimpleDateFormat(pattern)).format(date);
			}
		</xsp:logic>

		<xsl:apply-templates/>
	</xsp:page>
</xsl:template>
<xsl:template match="hc:todaysDate">
	<xsp:expr>
		todaysDate(new Date(), "<xsl:value-of select="@format"/>")
	</xsp:expr>
</xsl:template>
<xsl:template match="@* | * | text() | processing-instruction()">
	<xsl:copy>
		<xsl:apply-templates select="@* | * | text() | processing-instruction()"/>
	</xsl:copy>
</xsl:template>

</xsl:stylesheet>
************ end hc.xsl logicsheet source **************/



Mime
View raw message