cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott_B...@lotus.com
Subject Re: change the !DOCUMENT type/mime type
Date Fri, 17 Mar 2000 23:28:42 GMT

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 HTMLFormatter.java, 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",
"http://www.w3.org/TR/REC-html40/strict.dtd");
        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
XalanTransformer.java 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.

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

-scott




                                                                                         
                         
                    "K. Rumman                                                           
                         
                    Akhter"              To:     "Xalan" <xalan-dev@xml.apache.org>
                               
                    <kakhter@sput        cc:     (bcc: Scott Boag/CAM/Lotus)          
                            
                    nik7.com>            Subject:     change the !DOCUMENT type/mime type
                         
                                                                                         
                         
                    03/17/00                                                             
                         
                    05:53 PM                                                             
                         
                    Please                                                               
                         
                    respond to                                                           
                         
                    xalan-dev                                                            
                         
                                                                                         
                         
                                                                                         
                         




an xslt transformation always yields the line:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
                      "http://www.w3.org/TR/REC-html40/strict.dtd">
in the resulting xml doc. however i am trying to user cocoon to dynamically
generate *.smi files (which are welformed xml) and i do not want that line
in the xalan output. is there anyway to change that. also can i explicitly
specify the mime type as well?
as usual, any suggestion will be helpful.

thanx
***
K h o n d k e r RUmman A k h t e r
Programmer
sputnik7.com

kakhter@sputnik7.com






Mime
View raw message