cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <>
Subject Re: Xhtml and go!!
Date Fri, 28 Jul 2006 07:44:02 GMT
again, you are the man!! I will await your final bug fixes.



On 28/07/06, Jason Johnston <> wrote:
> Andrew wrote:
> > Hi,
> > can someone please tell me why when setting ajax="true" in my CForm and
> > serializing the document as xhtml (Strict) the following line in the
> > xhtml output should break the page?:
> Which xhtml serializer are you using?  The default one configured in the
> main sitemap distributed with Cocoon (which is just the XMLSerializer
> with a special doctype configured), or the XHTMLSeralizer from the
> serializers block?  I'm guessing the former.
> Remember that just adding an XHTML doctype to a HTML document does not
> make it XHTML.  It also has to be well-formed XML, and be in the
> namespace.  My hunch is that your content,
> though well-formed, is not in the XHTML namespace, so the browser does
> not recognize those elements as HTML and therefore does not apply the
> default styles that are normally applied to HTML.  This is why the page
> layout "breaks" as you say.
> Getting your CForms content into the XHTML namespace is a little tricky
> since the forms-*-styling.xsl transforms produce output in the null
> namespace.  So you need something that changes that output into the
> XHTML namespace.
> There are two options I know of for this:
> 1) Add a transform before the serializer that changes the namespace of
> all elements... could be something as simple as a single template:
> <xsl:template match="*">
>    <xsl:element name="{local-name()}"
> namespace="">
>      <xsl:copy-of select="@*" />
>      <xsl:apply-templates />
>    </xsl:element>
> </xsl:template>
> 2) Use the XHTMLSerializer from the serializers block.  This serializer
> adds the XHTML namespace to un-namespaced elements automatically.  In
> addition it also does other XHTML-specific things like making sure
> <script></script> tags are not collapsed, so I would recommend this
> approach.
> Once you've got that working, you will need to be aware that changing to
> a strict XHTML doctype will trigger strict mode in certain browsers, so
> you will need to be much more careful about other things as well, such
> as the mime-types of supporting CSS files and differences in the DOM for
> scripts.  In fact I'm not sure if the Dojo/AJAX code even takes those
> DOM differences into account.
> Also, and this is a pet peeve of mine: the CForms AJAX framework
> currently does not produce valid HTML/XHTML, in that there are some
> custom attributes used to support the AJAX code (dojoType="CFormsForm"
> on <form> in particular) which will prevent the document from
> validating.  Which begs the question: why are you trying to produce
> XHTML in the first place?  If it's an attempt to enforce some sort of
> stricter document validation then you're going to have trouble.
> ...
> OK, so I just gave it a quick try, using the XHTML serializer from the
> serializers block.  The page style/layout is fixed, but it turns out
> those DOM differences I mentioned earlier are indeed causing problems in
> the CForms/Dojo client-side Javascript code.  I'll be submitting a patch
> soon for some of them, hopefully I can fix them all.  But in the
> meantime, you need to know that it won't work out of the box.  Sorry!
> --Jason
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message