You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Dan Hertz <da...@danhertz.com> on 2007/09/28 16:02:04 UTC

XHTML Serializer bug?

I hope someone can help me debug my HTML Serializer issue:

I've trying to generate strict XHTML code where all tags are closed (eg: 
<image/>, <meta/>).

If I set the sitemap serializer to 
org.apache.cocoon.serialization.XMLSerializer, the tags get closed, but 
my Javascripts don't load.

If I set it to org.apache.cocoon.serialization.HTMLSerializer, then my 
Javascripts load fine, but the tags aren't closed.

Does anyone have a suggestion or fix?

I rebuilt Cocoon 2.1.10 using the latest subversion nightly build.

Dan


Re: XHTML Serializer bug?

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Andrew Stevens wrote:
> Okay, let's try this again, stripping out the less than signs... You'd 
> think hotmail were deliberately trying to get me to switch to google 
> mail ;-) > Date: Tue, 9 Oct 2007 09:27:57 +0200 > From: 
> j.joachimsthal@hippo.nl > ... > > You can work around this by using 
> xsl:comment instead of CDATA. > This will not work if there's a JX 
> generation or transformation after > the xsl:comment because it will 
> remove all information in the > xsl:comment. > > Regards, > > Jasha 
> Joachimsthal Just a random thought - if hiding script tags' contents 
> with comment tags is still "best practice", couldn't the (X)HTML 
> serializers be changed to add those automatically if not present (with, 
> say, a configuration parameter to disable it if needed)? That way, you 
> can just put the javascript directly in the element in your XSL and 
> still have it properly hidden, without having to mess around with CDATA 
> or xsl:comment and with no worries that it might be considered a comment 
> and removed by a later transformer or c/xinclude? Andrew. -- 
> http://pseudoq.sourceforge.net/ Open source java Sudoku app
> ------------------------------------------------------------------------
> The next generation of MSN Hotmail has arrived - Windows Live Hotmail 
> <http://www.newhotmail.co.uk>

Hmmm I guess you'd have to switch :)

Vadim

RE: XHTML Serializer bug?

Posted by Andrew Stevens <at...@hotmail.com>.
Okay, let's try this again, stripping out the less than signs...
You'd think hotmail were deliberately trying to get me to switch
to google mail ;-)

> Date: Tue, 9 Oct 2007 09:27:57 +0200
> From: j.joachimsthal@hippo.nl
>
...
>
> You can work around this by using xsl:comment instead of CDATA.
> This will not work if there's a JX generation or transformation after
> the xsl:comment because it will remove all information in the
> xsl:comment.
>
> Regards,
>
> Jasha Joachimsthal

Just a random thought - if hiding script tags' contents with comment tags 
is still "best practice", couldn't the (X)HTML serializers be changed to add 
those automatically if not present (with, say, a configuration parameter to 
disable it if needed)?  That way, you can just put the javascript directly in 
the element in your XSL and still have it properly hidden, without having to 
mess around with CDATA or xsl:comment and with no worries that it might 
be considered a comment and removed by a later transformer or c/xinclude?


Andrew.
-- 
http://pseudoq.sourceforge.net/  Open source java Sudoku app

_________________________________________________________________
100’s of Music vouchers to be won with MSN Music
https://www.musicmashup.co.uk

RE: XHTML Serializer bug?

Posted by Andrew Stevens <at...@hotmail.com>.
> Date: Tue, 9 Oct 2007 16:23:06 +0200
> From: j.reijn@hippo.nl
>
> I get the feeling, you are not able to read Jasha's text? Have a look at:

Actually, I could read it fine.  But when Hotmail quoted it in my reply,
even after switching to plain text, anything looking like embedded XML 
or HTML got stripped out on sending.  It never did that before they 
switched to the new "windows live" interface :-(


Andrew.
-- 
http://pseudoq.sourceforge.net/

>
> http://marc.info/?l=xml-cocoon-dev&m=119191492309518&w=2
>
> Regards,
>
> Jeroen Reijn
>
> Andrew Stevens wrote:
>>> Date: Tue, 9 Oct 2007 09:27:57 +0200
>>> From: j.joachimsthal@hippo.nl
>>>
>> ...
>>> You can work around this by using instead of

_________________________________________________________________
Feel like a local wherever you go.
http://www.backofmyhand.com

Re: XHTML Serializer bug?

Posted by Jeroen Reijn <j....@hippo.nl>.
I get the feeling, you are not able to read Jasha's text? Have a look at:

http://marc.info/?l=xml-cocoon-dev&m=119191492309518&w=2

Regards,

Jeroen Reijn

Andrew Stevens wrote:
>> Date: Tue, 9 Oct 2007 09:27:57 +0200
>> From: j.joachimsthal@hippo.nl
>>
> ...
>> You can work around this by using  instead of 
> _________________________________________________________________
> Celeb spotting – Play CelebMashup and win cool prizes
> https://www.celebmashup.com


RE: XHTML Serializer bug?

Posted by Andrew Stevens <at...@hotmail.com>.
> Date: Tue, 9 Oct 2007 09:27:57 +0200
> From: j.joachimsthal@hippo.nl
>
...
>
> You can work around this by using  instead of 
_________________________________________________________________
Celeb spotting – Play CelebMashup and win cool prizes
https://www.celebmashup.com

RE: XHTML Serializer bug?

Posted by Jasha Joachimsthal <j....@hippo.nl>.
 

> -----Original Message-----
> From: Insight 49, LLC [mailto:insight49@gmail.com] 
> Sent: dinsdag 9 oktober 2007 3:42
> To: dev@cocoon.apache.org
> Subject: Re: XHTML Serializer bug?
> 
> Vadim Gritsenko wrote:
> > Dan Hertz wrote:
> >> I hope someone can help me debug my HTML Serializer issue:
> >>
> >> I've trying to generate strict XHTML code where all tags are closed
> >> (eg: <image/>, <meta/>).
> >>
> >> If I set the sitemap serializer to
> >> org.apache.cocoon.serialization.XMLSerializer, the tags 
> get closed, 
> >> but my Javascripts don't load.
> >
> >> If I set it to 
> org.apache.cocoon.serialization.HTMLSerializer, then 
> >> my Javascripts load fine, but the tags aren't closed.
> >
> > Did you try 
> org.apache.cocoon.components.serializers.XHTMLSerializer?
> >
> > Vadim
> >
> 
> Thanks for your XHTMLSerializer suggestion. It closes the 
> elements nicely, but changes my quotes ( " ) to &quot;
> 
> That's why my scripts aren't running! (ah-ha!)
> 
> Funny thing is...even if I wrap my <script> sections in 
> <![CDATA[  (in my stylesheets), the xhtmlserializer still 
> changes my ( " ) to &quot;
> 
> Any suggestions?
> 
> Dan
> 
> Thyanks!

Hi Dan,

You can work around this by using <xsl:comment> instead of <![CDATA[.
This will not work if there's a JX generation or transformation after
the <xsl:comment> because it will remove all information in the
<xsl:comment>.

Regards,

Jasha Joachimsthal

Hippo
Oosteinde 11
1017 WT Amsterdam
The Netherlands
+31 (0)20 5224466
www.hippo.nl


> 

Re: XHTML Serializer bug?

Posted by "Insight 49, LLC" <in...@gmail.com>.
Vadim Gritsenko wrote:
> Dan Hertz wrote:
>> I hope someone can help me debug my HTML Serializer issue:
>>
>> I've trying to generate strict XHTML code where all tags are closed 
>> (eg: <image/>, <meta/>).
>>
>> If I set the sitemap serializer to 
>> org.apache.cocoon.serialization.XMLSerializer, the tags get closed, 
>> but my Javascripts don't load.
>
>> If I set it to org.apache.cocoon.serialization.HTMLSerializer, then 
>> my Javascripts load fine, but the tags aren't closed.
>
> Did you try org.apache.cocoon.components.serializers.XHTMLSerializer?
>
> Vadim
>

Thanks for your XHTMLSerializer suggestion. It closes the elements 
nicely, but changes my quotes ( " ) to &quot;

That's why my scripts aren't running! (ah-ha!)

Funny thing is...even if I wrap my <script> sections in <![CDATA[  (in 
my stylesheets), the xhtmlserializer still changes my ( " ) to &quot;

Any suggestions?

Dan

Thyanks!

Re: XHTML Serializer bug?

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Dan Hertz wrote:
> I hope someone can help me debug my HTML Serializer issue:
> 
> I've trying to generate strict XHTML code where all tags are closed (eg: 
> <image/>, <meta/>).
> 
> If I set the sitemap serializer to 
> org.apache.cocoon.serialization.XMLSerializer, the tags get closed, but 
> my Javascripts don't load.

Just a guess but probably browser (which ones have you tried?) freaking out on 
<script /> elements - try adding &#160;


> If I set it to org.apache.cocoon.serialization.HTMLSerializer, then my 
> Javascripts load fine, but the tags aren't closed.

Did you try org.apache.cocoon.components.serializers.XHTMLSerializer?

Vadim