RE: [xsl] where does one stick the doctype?

Subject: RE: [xsl] where does one stick the doctype?
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Fri, 21 Mar 2003 10:19:09 -0500
[ Chris Loschen]
>
> >I understand that a DOCTYPE declaration can contain any 
> valid element in
> >the DTD.  But I'm wondering if there's a way that XSL can insert this
> >element name when it creates the declaration via xsl:output or
> >xsl:document.
> 
> My sense was that XSLT automatically puts the root element of 
> your output
> document in your DOCTYPE line as you specified it in your 
> stylesheet, so y
> ou don't have to do it yourself. That seems to have happened 
> with all of my
> XSLT scripts to date. However, I'm not positive that's exactly what's 
> happening --
> does anyone know the real technical details?
> 
> 

You do not need a "sense".  The xslt 1.0 Rec tells you (section 16.1,
for the xml output method)  -

"If the doctype-system attribute is specified, the xml output method
should output a document type declaration immediately before the first
element. The name following <!DOCTYPE should be the name of the first
element."

So the serializer will create a DOCTYPE declaration that names the
document element, exactly as desired.  There are no facilities to create
anything different from this, but this is generally what you want.

Because this is a requirement levied on the serialized output, you will
not get it if you use non-serialized results, like a DOM that you hand
off for further processing.

Cheers,

Tom P

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


Current Thread