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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to