cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lenz, Evan" <le...@seattleu.edu>
Subject RE: Serializer for d-o-e?
Date Fri, 08 Nov 2002 19:47:52 GMT
J.Pietschmann wrote:
> The answer is quite simple: you can't. D-o-e only works if the
> XSLT processor serializes the result itself,

Please re-read my message a little more carefully. It's easy to dismiss it
as a top-10 XSLT FAQ, but it isn't.

> the information
> which text nodes are supposed to be d-o-e'd on output is not
> transported through the SAX pipelines Cocoon uses for plumbing
> it's components.

Actually it can be if I just pass that information on as a special attribute
(or element or processing instruction). Note that I'm not interested in
using xsl:disable-output-escaping. I already understand that I can't and
that there are very good reasons why I can't.

An example is in order. Here is what I would like to do:

<xsl:template match="html-blob">
  <html-blob my:disable-output-escaping="yes">
    <xsl:value-of select="."/>
  </html-blob>
</xsl:template>

Then I would like a custom serializer to simply check every element (or
perhaps only certain elements) for the presence of the attribute in my
namespace called my:disable-output-escaping. When its value is yes, then
output the content of that element without escaping markup characters.

This is a general problem that comes up often enough in the real world that
I thought someone might have already implemented such a feature. I recall
that the Xalan serializer had some kind of PI-based hack for attaining the
same.

As it happens, I've already solved my problem at hand by using the Google
Appliance's internal XSLT processor (which supports
xsl:disable-output-escaping) to generate custom HTML, and then using the
HTMLGenerator to load the Google results into Cocoon. Not exactly Web
services, but it's at least nice to isolate the hack on the Google side. It
may break in rare cases, but at least my site will still only be serving
well-formed XHTML :-)

Evan

> -----Original Message-----
> From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
> Sent: Friday, November 08, 2002 10:58 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: Serializer for d-o-e?
> 
> Lenz, Evan wrote:
> > I understand why Cocoon disables the use of disable-output-escaping in
> XSLT.
> > However, in my current project, which involves parsing XML results from
> > Google containing escaped (and non-well-formed) HTML, I need to find a
> way
> > to disable output escaping for certain sections of text, perhaps based
> on
> > the presence of a special attribute or PI that I can generate when
> > necessary. Does Cocoon provide a way of parameterizing an existing
> > serializer to do this? Has anyone implemented such a serializer? I would
> > think that such a customization of an existing XML serializer should be
> > pretty simple, but the Cocoon serialization framework is so abstract
> that
> > I'm having trouble finding the right code to extend or modify.
> 
> The answer is quite simple: you can't. D-o-e only works if the
> XSLT processor serializes the result itself, the information
> which text nodes are supposed to be d-o-e'd on output is not
> transported through the SAX pipelines Cocoon uses for plumbing
> it's components.
> One work around would be to do the opposite: emulate serializing
> in XSLT and use a text serializer, with some magic so that the
> client gets a content-type=text/html.
> 
> J.Pietschmann
> 
> 
> ---------------------------------------------------------------------
> 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:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>

---------------------------------------------------------------------
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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message