cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Tyler <r...@ticketweb.com>
Subject Re: how to apply xsl transforms to xsp-generated xml
Date Tue, 22 Feb 2000 20:44:11 GMT
> It looks like when you're generating XML in your XSP page you're trying to
> essentially, do this:
> 
> document.createTextNode("<tag>whee</tag>");
> 
> instead of
> 
> document.createElement("tag").appendChild(createTextNode("whee"));
> 
> The former ends up as:
> 
> &lt;tag&gt;whee&lt;/tag&gt;
> 
> while the latter is what you want:
> 
> <tag>whee</tag>
>
>...
>
> Could you post your XSP source code and we'll have a look? 

You understoood my question!

Samples .xml and .xsl files follow.

- RT


--- begin foo.xml ---

<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>

<?xml-stylesheet href="foo.xsl" type="text/xsl"?>

<xsp:page language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
  <page>
    <xsp:logic>
      String xmlBuf = <![CDATA["<foo>bar</foo>"]]>;
    </xsp:logic>
    <xsp:expr>xmlBuf</xsp:expr>
  </page>
</xsp:page>

--- end foo.xml ---


--- begin foo.xsl ---

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="page">
  <html>
   <body>
    <xsl:apply-templates select="foo"/>
   </body>
  </html>
 </xsl:template>

 <xsl:template match="foo">
  <font color="#ff0000">
   <xsl:apply-templates/>
  </font>
 </xsl:template>

</xsl:stylesheet> 

--- end foo.xsl ---

Mime
View raw message