cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George M. Pieri" <george.pi...@wcom.com>
Subject RE: Need "disable-output-escaping" or alternative
Date Tue, 24 Apr 2001 19:53:29 GMT



I too have an XML element that I'm trying to not escape or output as HTML.

e.g. Within the stylesheet I have

       <xsl:value-of  select="BODY"  disable-output-escaping="yes" />

   //Show the Body as HTML with <BR /> characters actually breaking


It appears from the FAQ that instead of disable-output-escaping I should
put the following

<?cocoon-format type="text/html/loose"?>

in both the XML and XSL files OR just the stylesheet !?!

I tried both with NO success and still can only display the content as text.
How can I get the body to display as HTML ?

Thanks in advance!


-----Original Message-----
From: William Bagby [mailto:williamb@adone.com]
Sent: Tuesday, April 24, 2001 2:49 PM
To: Cocoon Users Mailing List (E-mail)
Subject: Need "disable-output-escaping" or alternative


>From the Cocoon FAQ:

--------------------------------------------------------------------------
Why doesn't disable-output-escaping="yes" work?

This is similar to the above - we believe this is bad programming practice.
It's like using GOTOs. There are usually other ways to do what you want to
do - though you may have to spend some time getting your head round them.
Ask on cocoon-users@xml.apache.org  <mailto:cocoon-users@xml.apache.org>,
specifying exactly what you want to do - we can't help you if you only say
"disable-output-escaping doesn't work".
--------------------------------------------------------------------------

While I completely understand the reason why it wasn't implemented in
Cocoon, I have a situation where I think "disable-output-escaping" is
necessary.  Here's the scenario:

I am using an HTTP request to get an XML fragment, which consists of data
from a database, using a custom logicsheet tag which is similar to
<util:get-url-contents>.  I have control over the format of the data, but
not the data itself.  Let me illustrate this with an example:

Suppose #CITY#, #STATE# and #COMMENTS# represent three data fields.  I can
create a template like this:

<user>
	...
	<city>#CITY#</city>
	<state>#STATE#</state>
	<comments>#COMMENTS#</comments>
	...
</user>

and the appropriate values will be filled in at request time.  The problem
is that #COMMENTS# may have embedded HTML (which may or may not be
well-formed, but for the sake of this example let's make the assumption that
it is), and other characters which should be escaped such as &, <, >, etc.
Here's an example:

Looking for SWF > 40, tall & althletic.  Must be <b>non-smoker</b>.  E-mail
me <a href="mailto:studguy@yahoo.com">here</a>.

Because of the > and &, I MUST put it in a CDATA block:

<comments><![CDATA[#COMMENTS#]]></comments>

But when I do this, the embedded HTML code also gets escaped, so that it
shows up in the browser as HTML code, which is not what I want.  Seems to me
that "disable-output-escaping" would do the trick.  Of course, this means
that the > and & in the above example would be literal > and &, NOT
character entities &gt; and &amp;, in the HTML output, which is generally
bad form, but most browsers will render it as intended anyway, so I can live
with it.

In conclusion:
1. Is there another way to get around this without
"disable-output-escaping"?
2. If not, how could I implement it?
3. Where can I find the Xalan source that Cocoon uses?
4. What are the ramifications of re-building Cocoon with a modified Xalan?
4. Would I be better off using Saxon?

Oh, I'm using Cocoon 1.8.2 & Weblogic 5.1.0.  PLEASE ask if you need furthur
clarification.

Thanks,

William.

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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