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

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


Subject: Re: [xsl] where does one stick the doctype?
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 20 Mar 2003 12:32:34 -0700 (MST)

Kovach, Dave wrote:
> so I am trying to place a DOCTYPE declaration in my XSLT

DOCTYPE is not part of the XPath/XSLT data model. Like the rest of the prolog,
entity and character references, what kind of quotes delimit attribute values,
insignificant whitespace for indenting, etc., it is an artifact of
serialization after the transformation is complete. You can cause a DOCTYPE to
be added to the serialized output by adding doctype-public="..." and/or
doctype-system="..." to the <xsl:output> element, with the "..." filled in
with the public ID or system ID that you want to go into the DOCTYPE. You
cannot produce a DOCTYPE that has an internal DTD subset.

> but can't get it to render correctly - get errors like:
> 
> ---
> XML error
> Cannot have a DOCTYPE declaration outside of a prolog. 
> ---
> 
> I have tried sticking it everywhere I can think...

XSLT has a spec at http://www.w3.org/TR/REC-xslt ... you may find that
searching for "doctype" in there is a better learning strategy than trial and
error.

> using MSXML as the parser for xml and xslt... I have xhtml
> templates that feed into a master xslt template document.
> 
> This brings me to this problem(?) - my outputted html
> actually has:
> 
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:apt="http://www.somedomain.com/applicationpagetemplate" xmlns:module="http://www.somedomain.com/modules" xmlns:modtag="http://www.somedomain.com/smart/tags" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><xsl:template
> match="pp">
> 
> as the opening tag before the <html> tag. Is this normal? or ok?

No, it's not normal. It sounds like you may be using an obsolete version of
MSXML, or invoking deprecated, pre-XSLT 1.0 APIs. The binding of the string
'http://www.w3.org/1999/XSL/Transform' to the prefix 'xsl' is supposed to
indicate that elements whose names are prefixed with 'xsl' are XSLT
instructions. The processor is apparently not recognizing them as such, and is
treating them as it would any other literal result element -- an indication
that perhaps it is not an XSLT 1.0 processor at all.

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