You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Lamb, Mark" <Ma...@spirent.com> on 2004/01/12 15:18:34 UTC

XSP Generator Problem

Hi all,

I have the following problem that is driving me crazy.

I have an xsp file called runtest.xsp that has a series of commands
something like this

<test:command>myCommand</test:command>

This file includes a logicsheet logic.xsl. This file essentialy calls
functions from a Java library based on the commands in the xsp file. The
relevant extract is below.

<xsl:template match="test:command">
<xsp:expr>javaLib.executeCommand("<xsl:apply-templates/>")</xsp:expr>
</xsl:template>

javaLib.executeCommand() returns a String in xml format. I then have a
stylesheet html-format.xsl that attempts to transform the returned xml in to
html. My sitemap is as follows.

<map:match pattern="dotest">
  <map:generate src="runtest.xsp" type="serverpages"/>
  <map:transform src="html-format.xsl"/>
  <map:serialize/>
</map:match>

When I run the test I get a blank screen. I look at the source for the
returned page and it is blank between the <body> tags which is where it is
supposed to parse the results of the java command. The stylesheet is good
because I have tested it with the results of the java function saved to a
seperate xml file.

When I change the sitemap to this:

<map:match pattern="dotest">
  <map:generate src="runtest.xsp" type="serverpages"/>
  <map:serialize type="xml"/>
</map:match>

I get the xml from the java function displayed on screen, but when I look at
the source it looks something like

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-session="http://apache.org/xsp/session/2.0">
&lt;results&gt;
&lt;copyright&gt;

Where &lt;results&gt; etc. is the xml being returned from the Java function.

Does anyway have any idea why this is not working correctly.

Thanks,
Mark.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: XSP Generator Problem

Posted by Olivier Billard <ob...@rennes.jouve.fr>.
Your fonction return Strings containing < and > characters, that are escaped by <xsp:expr>...

In this case you could use a custom transformer to transform your tags to calls and return 
Sax events. A simple transformer is easy to write

--
Olivier



On 12/01/2004 15:18, Lamb, Mark wrote:
> Hi all,
> 
> I have the following problem that is driving me crazy.
> 
> I have an xsp file called runtest.xsp that has a series of commands
> something like this
> 
> <test:command>myCommand</test:command>
> 
> This file includes a logicsheet logic.xsl. This file essentialy calls
> functions from a Java library based on the commands in the xsp file. The
> relevant extract is below.
> 
> <xsl:template match="test:command">
> <xsp:expr>javaLib.executeCommand("<xsl:apply-templates/>")</xsp:expr>
> </xsl:template>
> 
> javaLib.executeCommand() returns a String in xml format. I then have a
> stylesheet html-format.xsl that attempts to transform the returned xml in to
> html. My sitemap is as follows.
> 
> <map:match pattern="dotest">
>   <map:generate src="runtest.xsp" type="serverpages"/>
>   <map:transform src="html-format.xsl"/>
>   <map:serialize/>
> </map:match>
> 
> When I run the test I get a blank screen. I look at the source for the
> returned page and it is blank between the <body> tags which is where it is
> supposed to parse the results of the java command. The stylesheet is good
> because I have tested it with the results of the java function saved to a
> seperate xml file.
> 
> When I change the sitemap to this:
> 
> <map:match pattern="dotest">
>   <map:generate src="runtest.xsp" type="serverpages"/>
>   <map:serialize type="xml"/>
> </map:match>
> 
> I get the xml from the java function displayed on screen, but when I look at
> the source it looks something like
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <page xmlns:xsp="http://apache.org/xsp"
> xmlns:xsp-session="http://apache.org/xsp/session/2.0">
> &lt;results&gt;
> &lt;copyright&gt;
> 
> Where &lt;results&gt; etc. is the xml being returned from the Java function.
> 
> Does anyway have any idea why this is not working correctly.
> 
> Thanks,
> Mark.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org