You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Moser, Martin (Bbn)" <mm...@hp.com> on 2004/12/09 17:08:26 UTC
Cocoon-Actions returning xm
Hi all,
I am using cocoon 2.0.4 and have some troubles with the return values of my actions.
The action returns a string, containing xml. This xml should be parsed in an xsl sheet, which is revieving the return value of this action.
But I am not able to access the xml tags in the style sheet.
Here is a sample code of the action:
:
String str = "<test>text</test>";
map.put("MSG", str);
return (map);
The code in the according style sheet:
<xsl:param name="MSG"/>
:
<tr><td> <xsl:value-of select="$MSG"/> </td></tr>
:
Now the browser is printing: "<test>text</test>"
If I have a look at the source of this html, via "View source Code" from the browser, I can see that the '<' and '>' signs are replaced by '>' and '<'.
But I want to have '<' and '>' and not '<' or '>'.
Is there any special way to configure actions to make them returning xml?
Thanks in advance!
Regards,
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cocoon-Actions returning xm
Posted by Ralph Goers <Ra...@dslextreme.com>.
Moser, Martin (Bbn) wrote:
>The action returns a string, containing xml. This xml should be parsed in an xsl sheet, which is revieving the return value of this action.
>But I am not able to access the xml tags in the style sheet.
>
>
Other folks have given you this answer, but I'm not sure its clear.
Cocoon, and xslt, don't process XML per-se. They process SAX events
and/or DOM. As such, you can't manipulate a string containing XML in
the manner you are trying to do. Since '<' and '>' aren't allowed in
"data" in XML, they are converted to < and >. A way around this
is to use aggregation, although this would most likely mean converting
your action into a generator. This would then be aggregated into the XML
being fed to your stylesheet where you could manipulate it as you wish.
In a way, this is more efficient because your generator doesn't need to
actually generate XML, but can generate SAX events.
Ralph
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org