cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <>
Subject Re: change the !DOCUMENT type/mime type
Date Sat, 18 Mar 2000 23:36:56 GMT wrote:
> You shouldn't normally get the DOCTYPE decl unless you specify it via
> xsl:output doctype-public & doctype-system in normal xsl processing.
> However...
> ...I see in the Cocoon code, in, they are doing:
>     public void format(Document document, Writer writer, Dictionary p)
> throws Exception {
>         OutputFormat format = super.getFormat(p);
>         format.setMethod(Method.HTML);
>         format.setOmitXMLDeclaration(true);
>         format.setPreserveSpace(true);
>         format.setDoctype("-//W3C//DTD HTML 4.0//EN",
> "");
>         format.setVersion("4.0");
>         Serializer serializer = factory.makeSerializer(writer, format);
>         serializer.asDOMSerializer().serialize(document);
>     }
> In Cocoon 1.7.x the xsl:output information is not being passed to the
> formatter, so you can't really control this.  Perhaps someone on the Cocoon
> list could give you some suggestions?
> BTW, Cocoon people, you can get the proper OutputFormat object from Xalan's
> StylesheetRoot by calling it's getOutputFormat() method.  In
> you could supply:
>     /**
>      * Get the output properties for the given stylesheet.
>      */
>     OutputFormat getOutputFormat(Document sheet, String sheetBase)
>     {
>       XSLTInputSource s = new XSLTInputSource(sheet);
>       s.setSystemId(sheetBase);
>       StylesheetRoot stylesheet = processor.processStylesheet(s);
>       outputFormat = stylesheet.getOutputFormat();
>       return stylesheet.getOutputFormat();
>     }
> Which would be kind of slow since you don't have a stylesheet pool, but
> then you need to get the information from the transformer to the formatter.
> This is probably a moot point for Cocoon 1.7.x since I don't think Stefano
> wants to be adding features, but Pier should probably take note, if he
> doesn't do this already.

We may or may not add support for xsl:output... but if present, the XSLT
processor cannot be considered a filter anymore, but a serializer. So,
we'll have both the XSLTFilter and XSLTSerializer.

Why? think about it: you can't futher process your pipeline after you
output text out of xslt transformations, don't you think?

Anyway, I see no problems in the Cocoon2 architecture for adding it.

> > also can i explicitly
> > specify the mime type as well?
> Again, you can from XSLT, but the information won't get to the
> Formatter/Serializer.
> Someone from the Cocoon list should be better able to help you accomplish
> what you need to do.  I don't think this is an XSLT/Xalan issue.

No, it's not. We currently don't have a way to match xsl:output
capabilities because of architectural problems. For now, you can patch
the cocoon formatters to achieve what you want to do (the code is _very_

Look, we know this is a problem and we already have solutions... just
wait more time for them to stabilize.

Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<>                             Friedrich Nietzsche
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------

View raw message