2.3 DOCTYPE

<..tex4ht doctype..>
 \ifx \a:DOCTYPE\relax
    \:CheckOption{frames}  \if:Option
       <.frames dtd.>
    \else
       <.no frames xhtml DOCTYPE.>
       <.no frames DOCTYPE.>
    \fi
 \fi
-_-_-

<..no frames xhtml DOCTYPE..>
 \:CheckOption{xhtml}  \if:Option
    \NewConfigure{@DOCTYPE}[1]{\def\:temp{#1}%
       \ifx \:temp\empty  \let\a:@DOCTYPE=\empty
       \else \ifx \a:@DOCTYPE\relax  \let\a:@DOCTYPE=\empty\fi
         \pend:def\a:@DOCTYPE{#1}\fi}
    \let\a:@DOCTYPE=\relax
 \fi
-_-_-

<..configure html4 Preamble..>
 <.pre definitions.>
 \Configure{PROLOG}{VERSION,DOCTYPE,*XML-STYLESHEET}
 \:CheckOption{mouseover} \if:Option
    <.DOCTYPE in PROLOG under mouseover.>
 \fi
 \:CheckOption{no-DOCTYPE} \if:Option
   \:CheckOption{no-VERSION} \if:Option
      \Configure{PROLOG}{*XML-STYLESHEET}
   \else
      \Configure{PROLOG}{VERSION,*XML-STYLESHEET}
      <.no-version note.>
   \fi
 \else
   \:CheckOption{no-VERSION} \if:Option
      \Configure{PROLOG}{DOCTYPE,*XML-STYLESHEET}
   \else
      <.no-version note.>
   \fi
   \Log:Note{to remove the DOCTYPE declaration
           use the command line option ‘no-DOCTYPE’}
 \fi
-_-_-

<..no-version note..>
 \Log:Note{to remove the <?xml version=...?>  processing instruction
           use the command line option ‘no-VERSION’}
-_-_-

<..no frames DOCTYPE..>
 \:CheckOption{xhtml}  \if:Option
    <.xhtml dtd.>%
    \def\:DTD{xhtml}
 \else
    <.html dtd.>%
 \fi
-_-_-

<..frames no frames DOCTYPE..>
 \csname a:frames-altDOCTYPE\endcsname
-_-_-

<..configure html4 tex4ht..>
 \NewConfigure{frames-altDOCTYPE}{1}
 \Configure{frames-altDOCTYPE}
    {<.no frames DOCTYPE.>}
-_-_-

Don’t place the full address ´
’ http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd’ within DOCTYPE. It can stop tools like xt when the server doesn’t respond

<..xhtml dtd..>
 <.xhtml dtd xml-version.>%
 \Configure{DOCTYPE}
   {\HCode{<!DOCTYPE html \xhtml:DOCTYPE>            \Hnewline
     <!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
     \Hnewline}}
 \def\xhtml:DOCTYPE{PUBLIC
     "-//W3C//DTD XHTML 1.0 Transitional//<.dtd lang.>"\Hnewline
     \space\space
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"}
-_-_-

<..dtd lang..>
 \expandafter
 \ifx \csname a:dtd-lang\endcsname\relax EN\else
   \csname a:dtd-lang\endcsname
 \fi
-_-_-

<..xhtml dtd..>+
 \Configure{@DOCTYPE}
   {<!ENTITY \% xhtml.dtd \xhtml:DOCTYPE>\Hnewline\%xhtml.dtd; \Hnewline}
-_-_-

<..html dtd..>
 \Configure{DOCTYPE}{\IgnorePar\HCode
    {<!DOCTYPE html PUBLIC
               "-//W3C//DTD HTML 4.01 Transitional//<.dtd lang.>"
     \Hnewline\space\space "http://www.w3.org/TR/html4/loose.dtd">
     \Hnewline}}
-_-_-

<..frames dtd..>
 \:CheckOption{xhtml} \if:Option
    <.xhtml dtd xml-version.>%
    \Configure{DOCTYPE}
    {\HCode{<!DOCTYPE html PUBLIC
           "-//W3C//DTD XHTML 1.0 Frameset//<.dtd lang.>"
     \Hnewline
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">\Hnewline}}
 \else
    \Configure{DOCTYPE}
    {\HCode{<!DOCTYPE html PUBLIC
                "-//W3C//DTD HTML 4.01 Frameset//<.dtd lang.>"
     \Hnewline "http://www.w3.org/TR/html4/frameset.dtd">\Hnewline}}
 \fi
-_-_-

Xerces reqires the following encoding.

<..tex4ht doctype..>+
 \def\:encoding#1={}
-_-_-

<..xml encoding..>
 encoding="\expandafter\ifx \csname a:charset\endcsname\relax
          \expandafter\:encoding\A:charset
    \else \expandafter\:encoding\a:charset\fi"
-_-_-