[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Outputting the DOCTYPE tag to XHTML


Subject: Re: [xsl] Outputting the DOCTYPE tag to XHTML
From: Mike Brown <mike@xxxxxxxx>
Date: Sun, 30 Mar 2003 14:03:05 -0700 (MST)

Gan Uesli Starling wrote:
> Daniel Bibbens wrote:
> > Use <xsl:output .../> i.e. 
> > 
> > <?xml version="1.0" encoding="utf-8"?>
> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> >   
> >   <xsl:output method="xml" 
> >     media-type="text/html" 
> >     doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
> >     doctype-system="DTD/xhtml1-strict.dtd"
> >     cdata-section-elements="script style"
> >     indent="yes"
> >     encoding="ISO-8859-1"/>
> > 
> Um... I am outputting the XHTML as a file for uploading. So the
> DOCTYPE declaration needs to go into that file. I needs to be
> writtin ahead of the head, and actually be there in the output
> XHTML file.
> 
> Is that a problem?

You didn't even try his suggestion, did you?

If you've specified a doctype-public or doctype-system (or both) in the
xsl:output instruction, then the XSLT processor will add the DOCTYPE if & when
it serializes the result tree.

Note that if you use "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd", then
you will be introducing a possible dependence on the w3.org site (external
DTDs may be read by the XML parser, even when not validating). Rather than
slow down parsing of your XHTML, either reference your own copy of the DTD, or
omit the doctype-system altogether.

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords