cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Sparkes <pe...@didm.co.uk>
Subject Re: xhtml serialization and form textarea
Date Mon, 03 Sep 2007 21:34:45 GMT
Hi Tobia,

Thanks for your suggestion, I have not had time to try it yet and am 
away for the next few days, will try it when I come back. In the mean 
time Jasha suggestion to use 
org.apache.cocoon.components.serializers.XHTMLSerializer works

Peter
> Peter Sparkes wrote:
>   
>> If I serialize it as html the output is :
>>
>> <textarea ...></textarea>
>>
>> However when I serialize as XHTML 1.0 Strict the xhtml output is:
>>
>> <textarea .../>
>>     
>
> What you say is true and also happens with <div/>, <script/>, and a
> few other elements.  My advice is to avoid the "xhtml" serializer
> altogether, as defined in the root sitemap.  The problem is that it
> outputs XML (in fact it uses the XML serializer) but with a "text/html"
> mime type, and that confuses browsers.
>
> You can either use the "xhtml11" serializer, which is correctly defined
> to output an "application/xhtml+xml" mime type and that means the output
> will be parsed as XML; or use the "html" serializer and work with HTML 4.
>
> What I do is use "xhtml11" on browsers that support XHTML (nearly all)
> and "html" on the legacy ones (IE, wget, lynx):
>
> 	<selector name="accept"
> 	    src="org.apache.cocoon.selection.RegexpHeaderSelector">
> 	  <pattern name="xhtml">application/xhtml\+xml</pattern>
> 	  <header-name>Accept</header-name>
> 	</selector>
>
> ...
>
> 	<select type="accept">
> 	  <when test="xhtml">
> 	    <serialize type="xhtml11"/>
> 	  </when>
> 	  <otherwise>
> 	    <transform src="html-fix.xsl"/>
> 	    <serialize type="html"/>
> 	  </otherwise>
> 	</select>
>
> Notice how it parses the Accept header and thus works on browsers old,
> new, and yet to come, without the need to do user-agent sniffing.
>
> html-fix.xsl adds the following element to <head/>, which is needed in
> legacy mode but does harm in XHTML mode:
>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
>
>
> HTH
> Tobia
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>   


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


Mime
View raw message