You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by yuryx <yu...@mobicomk.donpac.ru> on 2002/02/05 10:05:22 UTC
use xscript in xsp
For generation xml with xsp I have use any stylesheets for any tags.
I define:
simple.xsp:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:xscript="http://apache.org/xsp/xscript/1.0"
>
<page>
<title>Inline XScript variable(include xml)</title>
<content>
<xscript:variable name="var1" scope="session">
<para1>it a second line!!!</para1>
</xscript:variable>
<xscript:variable name="mystyle" href="work/test/simple.xsl"
scope="global"/>
<xscript:variable name="my-var" href="work/test/simple.xml"/>
<xscript:variable name="result">
<xscript:transform name="var1" stylesheet="mystyle"/>
</xscript:variable>
<xscript:get name="my-var"/>
<xscript:get name="result"/>
<xscript:remove name="my-var"/>
<xscript:remove name="var1"/>
<xscript:remove name="result"/>
</content>
</page>
</xsp:page>
simple.xml:
<?xml version="1.0"?>
<including>
<para>This is my first Cocoon page!</para>
<para>this line including from external file</para>
</including>
simple.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="para1">
<h1><xsl:value-of select="."/></h1>
</xsl:template>
</xsl:stylesheet>
simple2html.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsp-request="http://apache.org/xsp/request/2.0">
<xsl:template match="page">
<html>
<head>
<title>
<xsl:value-of select="title"/>
</title>
</head>
<body bgcolor="white" alink="red" link="blue" vlink="blue">
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="para">
<h4><xsl:value-of select="."/></h4>
</xsl:template>
<xsl:template match="@*|node()"
priority="-2"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
<xsl:template match="text()" priority="-1"><xsl:value-of
select="."/></xsl:template>
</xsl:stylesheet>
and next line in sitemap.xmap:
<map:match pattern="test/*">
<map:generate type="serverpages" src="work/test/{1}.xsp"/>
<map:transform src="work/test/simple2html.xsl"/>
<map:serialize/>
</map:match>
And I have next error:
/
Error in running Transformation/
More precisely:
/org.apache.cocoon.ProcessingException: Error in running Transformation:
java.lang.NullPointerException/
Original exception : java.lang.NullPointerException
at
org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(TransformerImpl.java:1007)
Does anyone have any ideas what I'm doing wrong?
Thanx.
Yury
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>