cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: how to apply xsl transforms to xsp-generated xml
Date Tue, 22 Feb 2000 06:31:59 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>

of course, you're doing it inside an XSP, not inside Java code, but the
same principle applies. Could you post your XSP source code and we'll have
a look? 

- donald

On Mon, 21 Feb 2000, Rick Tyler wrote:

> I asked this question already, but I didn't get any answers
> so I am will assume that no-one understood the question and
> ask it in a different way:
> 
> How can I generate XML using XSP and have XSL transformations
> applied to the generated XML?  In other words, I have some
> java included via XSP directives in my XML file which constructs
> and stores a stream of XML in a java String variable.  I then
> attempt to send the generated XML string to the XSL
> transformation engine by referencing the String variable name
> within an <xsp:expr/> block.
> 
> The problem I am encountering is that the special characters
> '<', '>' and '"' are being silently converted to "&lt;", "&gt;",
> and "&quot;" BEFORE the XSL engine receives them.  As a result,
> any tags (i.e. <foo>) included in my generated XML are not
> recognized by the XSL engine, which means that my transformations
> don't happen.
> 
> What component of Cocoon is doing this (converting "<foo>bar</foo>"
> to "&lt;foo&gt;bar&lt;/foo&gt;") and why?  Is there a way to
> suppress this behavior?
> 
> As a bit of background, I got to where I am because I have an
> existing (legacy I suppose is the word) CGI/C++ application
> which which I need to adapt to work with Cocoon's XML/XSL
> processing capabilities.  I know that Cocoon is not meant as
> a front end for CGI systems, but it is simply not practical
> to rewrite my existing system in the short term, so I need 
> to find out a way to layer Cocoon over it.
> 
> To this end, I first made a simple modification to my CGI
> program so that it now generates XML instead of HTML.  Next
> I used the following syntax to pull the generated XML file
> into the Cocoon:
> 
> <!DOCTYPE page [ <!ENTITY myxml SYSTEM "http://localhost/legacy.cgi"> ]>
> ...
> <page>
> &myxml
> </page>
> 
> That works like a charm, but it doesn't allow me to pass
> arguments to the CGI program.  To enable the passing of
> arguments, I am using XSP to instantiating a URL object
> (constructed such that any arguments passed to the XML
> file via the QUERY_STRING are included in the URL for
> the CGI).  This works too, EXCEPT that when I read the
> output into the String variable and send it to the XSL engine,
> I run into the problem of having '<' '>' ad '"' translated
> before the XSL engine receives the output stream.
> 
> Help!
> 
> - RT
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 


Mime
View raw message