Hi,

Just a question, if XHTML is XML then is it possible to use XML serializer?
If not, why?

Roman

Vadim Gritsenko wrote:

> > From: Justin Fagnani-Bell [mailto:[EMAIL PROTECTED]]
> >
> > Hi list,
> >
> >   I have a page with a form generated by Cocoon. There's a textarea in
> > the form where you can edit some xml (possibly xhtml). Because the
> form
> > is an HTML form I'm using an HTMLSerializer. But I want to keep the
> > serializer from altering the markup in the textarea, because if it's
> > xhtml content it will turn <br/>'s into <br>'s. Then when the text is
> > saved and you visit the form again, or view the page the text is on, I
> > get a parsing error.
> >
> > My xml fil looks somethng like this:
> >
> > <node name="test" title="Test">
> >    <text name="content">
> >      <p>
> >        Here's some text that will get messed up by HTMLSerializer
> >        <br/>
> >        Then I'll get an error.
> >      </p>
> >    </text>
> > </node>
> >
> > I use an xslt template to turn this into my form that looks likt this:
> >
> > <xsl:template match="text>
> >    <textarea name="@name"><xsl:copy-of select="* |
> text()"/></textarea>
> > </xsl:template>
> >
> > I've tried a few things with no luck so far. I added a
> > xmlns="http://www.w3.org/1999/xhtml"; attribute to the text element
> > hoping that HTMLSerializer would then leave it alone, but my
> stylesheet
> > won't copy the text now.
>
> <xsl:template match="x:text" xmlns:x="http://www.w3.org/1999/xhtml";>
>   <textarea name="@name"><xsl:copy-of select="* | text()"/></textarea>
> </xsl:template>
>
> But it won't help you.
>
> Try xhtml serializer, it comes with default sitemap.
>
> Vadim
>
> > I tried copying the xml serializer component in
> > <map:serializers>, renaming it "xhtml" and changing the mime-type to
> > text/html, but the browser wouldn't render it.
> >
> > (Along a similar line, I was trying to use jTidy to turn html into
> > xhtml, in case the user didn't enter well-formed xml. But I'm dealing
> > with html fragments and jTidy kept wraping everything in <html><body>,
> > etc...)
> >
> > Any ideas?
> >
> > Thanks,
> >    Justin
> =
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

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

Reply via email to