cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conal Tuohy" <con...@paradise.net.nz>
Subject RE: FAQ and snippet, document() function
Date Wed, 10 Jul 2002 14:39:47 GMT
> -----Original Message-----
> From: Nicola Ken Barozzi [mailto:nicolaken@apache.org]
> Sent: Thursday, 11 July 2002 01:36
> To: cocoon-docs@xml.apache.org
> Subject: Re: FAQ and snippet, document() function
>
>
>
> Diana Shannon wrote:
> >
> > On Tuesday, July 9, 2002, at 06:04  PM, Conal Tuohy wrote:
> >
> >> Don't be too quick to deprecate document()!
> >
> >
> > Did my draft suggest that? Are you saying that pointing out
> the problems
> > associated with using the document() function in a Cocoon
> environment
> > (e.g. caching)
> > which may discourage use of the document() function "in effect"
> > suggests "deprecation"?
>
> It's not deprecated, but simply:
> 1. not supported
> 2. not recommended
> 3. inappropriate, because it mixes concerns.
>
> XML is content. XSL style.

I disagree with the bit in Diana's snippet where she said that "Using the
document() function for aggregation in Cocoon breaks Separation of Concerns
(SoC)", which you echoed: "inappropriate, because it mixes concerns". I
think it MAY break SoC but not necessarily.

XSLT is a complete programming language. You can do styling with it. And you
can do aggregation with it. You can do pretty much anything with it. In
particular you can do some complicated inclusions more easily than with
xinclude. That's all I'm saying: for some inclusion operations, a small XSLT
transform is preferable to other inclusion techniques. In particular I'm
thinking of recursive inclusions, which I'm sure are more efficient coded as
a single XSLT with a recursive template call, than as a recursive
multi-stage pipeline with xinclude, easier to maintain, easier to understand
... in fact better in every way. I used the document() function once for
this purpose and was amazed how simple it was to do. NB at no point did I
mix up styling and inclusion in the same stylesheet!

If you put multiple XSLT transforms in a pipeline, the first one can do
inclusion, and the second one can do transformation. There is no need to mix
them, just because you have written both operations in the same language.
That's the point I'm trying to make.

Let's not deprecate the document() function (I didn't mean to imply I
thought it was being formally deprecated, just that it was being "dissed"
unfairly), just because people COULD misuse it.

> Style should never *work* on content, just transform it.
> Aggregation is basically not something to do at the style
> phase, because
> it injects vital information in the data flow.

I agree.

> For example, if I used the document() function to aggregate your
> homepage with some nasty page, would you say it's just style?

No I wouldn't. But I hope you see why I don't care anyway ;-)

Cheers!

Con


Mime
View raw message