cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhi liu <liuzh...@yahoo.com>
Subject HELP, XSP and Tag Library in [C2]
Date Sun, 18 Feb 2001 17:27:58 GMT
Dear Sirs: 
I think you are both Cocoon-experts and 
Cocoon-promoters. 
Here I really need help from you. I tried dozens of
time to use Tag Library feature with XSP under  [C2].
It just fails.
All I tested is just the simplest Time-of-Day Tag
Library example  under cocoon-xsp page:
http://xml.apache.org/cocoon/xsp.html
but I never work it out ! That means it doesn't work.
I really hope anyone in this maillinglist can help me
out of this essential
function of XSP under Cocoon.
Following are some configuration of my [C2] 
enviorment. 
In cocoon.xconf  I have added following : 
------cut here-------------- 
<builtin-logicsheet> 
<parameter name="prefix" value="tod"/> 
<parameter name="uri" > 
value="<http://localhost:9095/cocoon/xsp/tod>"/> 
<parameter name="href" >
 value="context://docs/samples/xsp/eins.xsl"/>
</builtin-logicsheet> 
------ cut here ----------- 
In sitemap.xmap following are added: 
------cut here-------------- 
<map:match pattern="xsp/tod"> 
<map:generate type="serverpages" > 
src="docs/samples/xsp/tod.xsp"/>
<map:transform src="docs/samples/xsp/eins.xsl"/>
<map:serialize/>
</map:match> 
-------------------------------------- 

 my tod.xsp which in
~/jakarta-tomcat-4.0-b1/webapps/cocoon/docs/samples/xsp
 is following: 
 ----------------------- 
<?xml version="1.0" encoding="ISO-8859-1"?> 
<xsp:page > 
language="java" 
xmlns:xsp="<http://apache.org/xsp>" 
xmlns:xsp-request="<http://apache.org/xsp/request>" 
xmlns:xsp-response="<http://apache.org/xsp/response>" 
xmlns:tod="<http://localhost:9095/cocoon/xsp/tod>" 
<page> 
<title>TOD Page</title> 
<content> 
 <p> 
 To the best of my knowledge, it's now > 
<!-- Substitute time of day here --> 
 <tod:time-of-day format="hh:mm:ss"/> 
 </p> 
 </content>
</page>
</xsp:page>
------------------------------------------------ 
The eins.xsl which in the same path as tod.xsp efined
the time-of-day  <tod> tag lib is following: 
 ------------------------------------- 
 <?xml version="1.0"?>
<xsl:stylesheet > version="1.0" >
xmlns:xsl="<http://www.w3.org/1999/XSL/Transform>" 
xmlns:tod="<http://localhost:9095/cocoon/xsp/tod>" 
xmlns:xsp-request="<http://apache.org/xsp/request>"
xmlns:xsp="<http://apache.org/xsp>"
<xsl:template match="xsp:page">
<xsp:page> 
<xsl:copy> 
<xsl:apply-templates select="@*"/>
</xsl:copy>
<xsp:structure>
<xsp:include>java.util.Date</xsp:include> 
<xsp:include>java.text.SimpleDateFormat</xsp:include>
</xsp:structure> 
<xsp:logic>
 /* "TOD" Class Level Logic */ 
private static String formatDate(Date > date, String
pattern) 
{ 
   if (pattern == null || pattern.length() > == 0) 
	{ 
             pattern = "yyyy/MM/dd hh:mm:ss aa"; 
	} 
	return (new >
SimpleDateFormat(pattern)).format(date); 
} 
</xsp:logic> 
<xsl:apply-templates/> 
</xsp:page> 
</xsl:template>
<xsl:template match="tod:time-of-day">
<xsl:expr>
 formatDate(new Date(), "<xsl:value-of >
select="@format"/>") 
 </xsl:expr>
</xsl:template>
<xsl:template match="@*|node()" priority="-1">
<xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy> 
</xsl:template> 
</xsl:stylesheet>
--------------------------------------------------- 
 actually the eins.xsl and tod.xsp are almost the same
 as those on the cocoon-xsp page. My question is how
can I make this tag lib example WORK! Can anyone check
where I 'm wrong ?  All I need is a working
self-defined taglib example. 

thank you for your attention. 

sincerely yours 
--Zhi

p.s: other examples in cocoon works but this one.

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

Mime
View raw message