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. 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]>