cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Fellenz <BFell...@mmrd.com>
Subject XSP is encoding an XML string generated by Java code
Date Thu, 12 Oct 2000 20:58:14 GMT
Given the following .xml and .xsp files [respectively]:
 
----- example-page.xml ----------------------------------------
 
<?xml version="1.0"?>
 
<!-- Author: Alan Uhl" uhlda@mmrd.com <mailto:uhlda@mmrd.com> " -->
<!-- Version: $Id: example-page.xml,v 1.2 2000/10/12 Uhl $ -->
 
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="page-xsp.xsl" type="text/xsl"?>
 
<page>
 
    <foobartag/>
 
</page>
 

----- page-xsp.xml ----------------------------------------
 
<?xml version="1.0"?>
 
<xsl:stylesheet version="1.0"
   xmlns:xsl="  <http://www.w3.org/1999/XSL/Transform> http://www.w3.org/1999/XSL/Transform"
   xmlns:xsp="  <http://www.apache.org/1999/XSP/Core> http://www.apache.org/1999/XSP/Core"
>
 
  <xsl:template match="page">
 
<xsl:processing-instruction name="cocoon-process">type="xsp"</xsl:processing
-instruction>
 
    <xsp:page language="java" xmlns:xsp="  <http://www.apache.org/1999/XSP/Core>
http://www.apache.org/1999/XSP/Core">
 
 <xsp:logic>
 
      private synchronized String foofunc() {
        String retval = <![CDATA["<foobar><name>Asmodius</name><age>99yo</age><g
ender>F</gender></foobar>"]]>;
        return retval;
      }
 
    </xsp:logic>
 
    <xsl:copy>
      <xsl:apply-templates/>
    </xsl:copy>
 
   </xsp:page>
 
  </xsl:template>
 
  <xsl:template match="foobartag">
    <xsp:expr>foofunc()</xsp:expr>
  </xsl:template>
 
</xsl:stylesheet>
 
---------------------------------------------------------
 
what we get is:
&lt;foobar&gt;&lt;name&gt;Asmodius&lt;/name&gt;&lt;age&gt;
99yo&lt;/age&gt;&lt;gender&gt;F&lt;/gender&gt;&lt;/foobar&gt;
 

what we would like:
<foobar><name>Asmodius</name><age>99yo</age><gender>F</gender>
</foobar>
 
The "foofunc()" is a mockup function that, in real life, will 
return data from some external datasource [such as MySQL]. 
Prior to being returned from foofunc(), the data will be 
wrapped in XML tags. We would like to have the data remain 
"as is" for processing by a secondary XSL transformation, 
yielding the HTML product. But, as you can see, the 
beginning and ending brackets ("<", ">") are being converted 
to &lt and &gt.
 
-Bob
bob@mmrd.com <mailto:bob@mmrd.com> 

Mime
View raw message