You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jan Sundin <ja...@sundin.com> on 2000/03/20 17:04:22 UTC

I'm using a <![CDATA[]]> element that holds HTLM-tags, i do not want the
content of the element to be escaped or modified in any way.
But when using Cocoon 1.7.1-dev, xalan_0_20_0, xerces_1_0_3. A
<![CDATA[<DIV>]]> gets output as "&lt;DIV&gt;". I had expected to get <DIV>.

Have i missunderstood something?

Regards

Jan Sundin


Re:

Posted by Stefano Mazzocchi <st...@apache.org>.
Alex Muc wrote:
> 
> On the cocoon-users list there is another message for this thread which indicates
> that the output escaping isn't operating correctly and that it is supposed to be
> fixed in the next release for cocoon (1.7.1).  Has this bug been fixed in
> 1.7.1dev?  Is it accessible from the CVS?  If not, if someone can give me a
> little background info I'll take a look at trying to fix it.  In particular, is
> this a cocoon, xerces or xalan problem?

This is a xerces problem. Cocoon uses Xerces serializers to output the
DOM and those classes perform the output escaping.

I've been told that they are fixed in current Xerces CVS module, but I
haven't tried it yet.

Of course, I'll upgrade the cocoon library as soon as Xerces 1.0.4 is
released. But not before.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Re:

Posted by Alex Muc <al...@utoronto.ca>.
On the cocoon-users list there is another message for this thread which indicates
that the output escaping isn't operating correctly and that it is supposed to be
fixed in the next release for cocoon (1.7.1).  Has this bug been fixed in
1.7.1dev?  Is it accessible from the CVS?  If not, if someone can give me a
little background info I'll take a look at trying to fix it.  In particular, is
this a cocoon, xerces or xalan problem?

Thanks
Alex

Jonathan Stimmel wrote:

> On Mon, Mar 20, 2000 at 05:04:22PM +0100, Jan Sundin wrote:
>
> > I'm using a <![CDATA[]]> element that holds HTLM-tags, i do not want the
> > content of the element to be escaped or modified in any way.
> > But when using Cocoon 1.7.1-dev, xalan_0_20_0, xerces_1_0_3. A
> > <![CDATA[<DIV>]]> gets output as "&lt;DIV&gt;". I had expected to get <DIV>.
> >
> > Have i missunderstood something?
>
> Yes, I believe you have. CDATA is needed if you need characters such
> as "<", ">", and "&" preserved. I find it most useful in xsp pages (as
> described in the xsp intro documentation):
>
>   <xsp:logic><![CDATA[
>     int i;
>     for (i=0; i < 10; i++) { } // the "<" would generate an error w/o CDATA
>   ]]></xsp:logic>
>
> rather than:
>
>   <xsp:logic>
>     int i;
>     for (i=0; i &lt; 10; i++) { }  // Note the use of "&lt;"
>   </xsp:logic>
>
> I don't know what you're trying to accomplish, but I suspect that
> what you really need to do is use "<DIV/>" (to turn it into a
> valid, empty xml tag). You'll likely find that cocoon strips
> out the extra "/" before it reaches the browser.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


RE:

Posted by Gabor Dolla <ag...@mezon.net>.
> I realize i could have explained this better the first time.
> I have a Cocoon-producer creating some XML-stuff that then gets transformd
> into HTML. For some reasons i want to embed HTML-tags in the XML file (i
> know this isnt the "right thing" to do, but some of the data i want to
> display is already in HTML-form). To preserve characters such as < > & i
> embed this HTML-fragmet in CDATA, just like you do in your example above.

you need disable-output-escaping imho ( I need this feature too)
it doesn't work at the moment but last week the author of that part of the
software promised a working version ...

Gabor




RE:

Posted by Jan Sundin <ja...@sundin.com>.
> On Mon, Mar 20, 2000 at 05:04:22PM +0100, Jan Sundin wrote:
>
> > I'm using a <![CDATA[]]> element that holds HTLM-tags, i do not want the
> > content of the element to be escaped or modified in any way.
> > But when using Cocoon 1.7.1-dev, xalan_0_20_0, xerces_1_0_3. A
> > <![CDATA[<DIV>]]> gets output as "&lt;DIV&gt;". I had expected
> to get <DIV>.
> >
> > Have i missunderstood something?
>
> Yes, I believe you have. CDATA is needed if you need characters such
> as "<", ">", and "&" preserved. I find it most useful in xsp pages (as
> described in the xsp intro documentation):
>
>   <xsp:logic><![CDATA[
>     int i;
>     for (i=0; i < 10; i++) { } // the "<" would generate an error
> w/o CDATA
>   ]]></xsp:logic>
>
> rather than:
>
>   <xsp:logic>
>     int i;
>     for (i=0; i &lt; 10; i++) { }  // Note the use of "&lt;"
>   </xsp:logic>
>
>
> I don't know what you're trying to accomplish, but I suspect that
> what you really need to do is use "<DIV/>" (to turn it into a
> valid, empty xml tag). You'll likely find that cocoon strips
> out the extra "/" before it reaches the browser.
>

I realize i could have explained this better the first time.
I have a Cocoon-producer creating some XML-stuff that then gets transformd
into HTML. For some reasons i want to embed HTML-tags in the XML file (i
know this isnt the "right thing" to do, but some of the data i want to
display is already in HTML-form). To preserve characters such as < > & i
embed this HTML-fragmet in CDATA, just like you do in your example above.

Example, the following XML-file:

	<?xml version="1.0"?>
	<?xml-stylesheet href="jan.xsl" type="text/xsl"?>
	<?cocoon-process type="xslt"?>
	<samples><![CDATA[<DIV id="collapse"></DIV>]]>
	</samples>

and the stylesheet:

	<?xml version="1.0"?>
	<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="samples">
	<html>
      	  <xsl:apply-templates/>
	</html>
	</xsl:template>
	</xsl:stylesheet>

generates the output:

	<html>&lt;DIV id=&quot;collapse&quot;&gt;&lt;/DIV&gt;
	</html>
Is this really correct?

I expected to get :
	<html><DIV id="collapse"></DIV>;
	</html>

Regards
Jan Sundin


Re:

Posted by Jonathan Stimmel <jo...@stimmel.net>.
On Mon, Mar 20, 2000 at 05:04:22PM +0100, Jan Sundin wrote:

> I'm using a <![CDATA[]]> element that holds HTLM-tags, i do not want the
> content of the element to be escaped or modified in any way.
> But when using Cocoon 1.7.1-dev, xalan_0_20_0, xerces_1_0_3. A
> <![CDATA[<DIV>]]> gets output as "&lt;DIV&gt;". I had expected to get <DIV>.
> 
> Have i missunderstood something?

Yes, I believe you have. CDATA is needed if you need characters such
as "<", ">", and "&" preserved. I find it most useful in xsp pages (as
described in the xsp intro documentation):

  <xsp:logic><![CDATA[
    int i;
    for (i=0; i < 10; i++) { } // the "<" would generate an error w/o CDATA
  ]]></xsp:logic>

rather than:

  <xsp:logic>
    int i;
    for (i=0; i &lt; 10; i++) { }  // Note the use of "&lt;"
  </xsp:logic>


I don't know what you're trying to accomplish, but I suspect that
what you really need to do is use "<DIV/>" (to turn it into a
valid, empty xml tag). You'll likely find that cocoon strips
out the extra "/" before it reaches the browser.