cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurent Eskenazi" <lesken...@mail.inforama.fr>
Subject Generated XML formating
Date Wed, 02 Feb 2000 18:14:36 GMT
Hi!

I've got a problem with java generated XML included in a XML file.
I've got a class which can describe itself in XML, and I'd like to have it
included in XML files and the result XML parsed with XSLT.
My problem is that every "<" or ">" is being replaced by a "&lt;" or "&gt;",
and so, the result string isn't parsed with XSLT as I expected. I tried to
use the <!CDATA[[]]> trick, but it was no use.

Does anybody know how to do such a thing ?

Thanks per advance.

Laurent

Here are some code samples to understand the problem:


Foo.java:

class Foo
{
String toString()
    {
        String tmp=new String();
        tmp+="<foo>";
        tmp+="<bar>";
        tmp+="xyzABCD";
        tmp+="</bar>";
        tmp+="</foo>;
    }
}



Foo.xml:

<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<xsp:page language="java" xmlns:xsp=http://www.apache.org/1999/XSP/Core>
<xsp:structure>
 <xsp:include>Foo</xsp:include>
</xsp:structure>
<xsp:logic>Foo foo=new Foo();</xsp:logic>
<page>
<xsp:expr>foo</xsp:expr>
<!-- I'd like the XML code to be included here using the toString()
ethod  -->
</page>
</xsp:page>



Foo.xsl:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="page">
<html>
<body bgcolor="#ffffff"><font face="Verdana, Arial, Helvetica, sans-serif">
<xsl:apply-templates/>
</font></body>
</html>
</xsl:template>

<xsl:template match="event">
<p><font size="1"><xsl:value-of select="bar"></p>
</xsl:template>

</xsl:stylesheet>




Mime
View raw message