Hi Marc,
I am trying to achieve the following:

1. Determine, in my sitemap, whether a browser is XHTML 1.1 compatible. If it is, the XHTML 1.1 serializer is used, which when view sourced in the browser you see:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">

Now, as part of the XHTML 1.1 specification you also need to say the following in the <html> tag:

<html xmlns="http://www.w3.org/1999/xhtml">

I have not found a way in the serialization process of writing the xmlns line into the <html> tag if the browser viewing the site is XHTML 1.1 compatible, so I thought maybe if I specify UTF-8 as the encoding type for XHTML 1.1 browsers and a different encoding type for non 1.1 browsers, I could then dynamically write the xmlns line into the tag if the browser was XHTML 1.1 compatible.

Do you know of a more efficient way I could probably do this?

Peter

p.s.

sitemap snippet:

<map:serializer name="xhtml" src="org.apache.cocoon.serialization.XMLSerializer" mime-type="text/html" logger="sitemap.serializer.xhtml" pool-grow="2" pool-max="64" pool-min="2">

<doctype-public>-//W3C//DTD XHTML 1.1 //EN</doctype-public>

</doctype-system>

</encoding>

</indent>
</map:serializer>
<map:serializer name="html" mime-type="text/html" src="org.apache.cocoon.serialization.HTMLSerializer">

</indent>
<encoding></encoding>

</omit-xml-declaration>

<doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>

</doctype-system>
</map:serializer>
........
<map:resource name="serialize">
<map:select type="browser">
<map:when test="safari">
<map:serialize type="html"/>
</map:when>
<map:otherwise>
<map:serialize type="xhtml"/>
</map:otherwise>
</map:select>
</map:resource>

.......

<map:match pattern="unsupport/menu">
<map:generate type="serverpages" src="xsp/menu2.xsp"/>
<map:call resource="serialize"/>
</map:match>

On 27 Mar 2004, at 07:30, Marc Portier wrote:

Peter,

sorry for the bad advice then, but you lost me,
pls elaborate on where you see what and how your setup is looking
and what you try to achieve

regards,
-marc=

beyaNet Consultancy wrote:

Marc,
I am using Cocoon version 2.1.4. I have made the changes you mentioned, but nothing has really changed. If I now <xsp-request:get-character-encoding> and change the encoding in the page so that it now reads <?xml version="1.0" encoding="ISO-8859-1"?> i still only get what is specified in the web.xml document and not in the web-page. Any ideas?
Peter
On 26 Mar 2004, at 23:08, Marc Portier wrote:
beyaNet Consultancy wrote:
Hi,
I am trying to obtain the encoding type as specified in at the
top of my site page when you view source the page. At the moment
the encoding type is specified as:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 //EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
<html>
I was under the impression that if i used
<xsp-request:get-character-encoding> that it would return UTF-8,
in this instance. At the moment it is returning ISO-8859-1 which
is the encoding type of the server. How do I get the encoding
type as specified within my page?
which version of cocoon are you using?
pre 2.1.3 there was a possible mismatch between the encoding used in
the html-generation (encoding) and the one used in the
request-parameter-processing (decoding)
this should be fixed per

http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java?rev=1.6&view=markup

http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=1.20&view=markup
prior to this you can manually assure that both sides are in sync:
just make sure the encoding set-up in your <serializer> (see it's
config in sitemap.xmap) is matching the setting in the web.xml (see
init-param 'form-encoding' to the cocoon servlet)
HTH,
-marc=
many thanks in advance
Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-- Marc Portier http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at http://blogs.cocoondev.org/mpo/
[EMAIL PROTECTED] [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Marc Portier http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at http://blogs.cocoondev.org/mpo/
[EMAIL PROTECTED] [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to