|
Re: Is it possibile to control the well-formed XML produced by kupu?: msg#00015web.kupu.devel
Alessandra Donnini wrote: > I would like to produce with kupu a part of a document not an entire > document. In other words I would like that the document provided by kupu > doesn't contain the head and the body html tags. Is it possible? > Thanks, > Alessandra Donnini > Yes, you just have to strip out the content from inside the body tag. Have a look near the end of kupuploneeditor.js to see one way to do this. Basically: // Get the edited text and apply the cleanup filters var transform = this._filterContent(this.getInnerDocument().documentElement); // Get the body tag as XML var contents = kupu.getXMLBody(transform); // Mozilla et al. insert a nearly empty paragraph if you start off with // nothing at all, so it is best to strip that off. if (/^<body[^>]*>(<\/?(p|br)[^>]*>|\ )*<\/body>$/.test(contents)) { contents = ''; /* Ignore nearly empty contents */ } // Remove the body tag(s) contents = contents.replace(/<\/?body[^>]*>/g, ""); The plone code is actually slightly longer since it also does things like making all the links relative, but I've just pulled out the important parts. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Is it possibile to control the well-formed XML produced by kupu?: 00015, Alessandra Donnini |
|---|---|
| Next by Date: | post-XSLT whitespace: 00015, Izaak Branderhorst |
| Previous by Thread: | Is it possibile to control the well-formed XML produced by kupu?i: 00015, Alessandra Donnini |
| Next by Thread: | post-XSLT whitespace: 00015, Izaak Branderhorst |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |