Hi
I have again a very simple question. I am trying to use the xsp-guide
included in the cocoon-2.1.7. The examples is without sitemap.xmap, but I am
trying the make them work anyway.
Simple XSP Logicsheet
Example:
greeting3.xsp
<?xml
version="1.0"?>
<xsp:page
xmlns:xsp="http://apache.org/xsp"
xmlns:greeting="http://duke.edu/tutorial/greeting">
<greeting>
<greeting:hello-world/>
</greeting>
</xsp:page>
logicsheet.greeting.xsl
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsp="http://apache.org/xsp"
xmlns:greeting="http://duke.edu/tutorial/greeting"
version="1.0">
<xsl:template match="xsp:page">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="greeting:hello-world">
<!-- more complex XSLT is possible here as well -->
<xsp:logic>
// this could be arbitrarily complex Java code, JDBC queries, etc.
String msg = "Hello, world!";
</xsp:logic>
<xsp:expr>msg</xsp:expr>
</xsl:template>
<!-- This template simply copies stuff that doesn't match other -->
<!-- templates and applies templates to any children. -->
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
sitemap.xmap
<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline>
<map:match pattern="*.xsp">
<map:generate type="serverpages" src=""/>
<map:transform src="">
<map:parameter name="contextPath"
value="{request:contextPath}"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
The result I will get in the web browser
is:
// this could be arbitrarily complex Java
code, JDBC queries, etc. String msg = "Hello, world!"; msg
source code :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<greeting xmlns:xsp="http://apache.org/xsp" xmlns:greeting="http://duke.edu/tutorial/greeting">
<xsp:logic language="java">
// this could be arbitrarily complex Java code, JDBC queries, etc.
String msg = "Hello, world!";
</xsp:logic>
<xsp:expr>msg</xsp:expr>
</greeting>
<greeting xmlns:xsp="http://apache.org/xsp" xmlns:greeting="http://duke.edu/tutorial/greeting">
<xsp:logic language="java">
// this could be arbitrarily complex Java code, JDBC queries, etc.
String msg = "Hello, world!";
</xsp:logic>
<xsp:expr>msg</xsp:expr>
</greeting>
It seams like the xsp code does not evolve. Why ?
Can someone please help me.
When I am trying to use xsp in my xsl file,
when transforming an xml file to a html file, the same thing happens and all
html coding disappears.
Regards,
Kerstin
