Benson,

I expect the response that you would get from the Xalan folks is that the
DOCTYPE isn't part of the data model [1][2] so doesn't appear in the result
of the transform. I understand that the identity transformer is supposed to
behave like following stylesheet snippet:

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

and that only includes nodes in the XPath data model. I think some folks
believe the JAXP equivalent should copy everything, not just what's
representable in the data model, but apparently Xalan and perhaps other
XSLT processors do not do that.

You could try another API like the LSSerializer [3] which will serialize
the full content of the DOM.

Thanks.

[1] http://www.w3.org/TR/1999/REC-xslt-19991116#data-model
[2] http://www.w3.org/TR/xpath#data-model
[3]
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSSerializer.html

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

Benson Margulies <bimargul...@gmail.com> wrote on 10/30/2009 10:59:27 AM:

> I'm not sure if I should be consulting Xerces, Xalan, or a beer.
>
> I've got a DOM tree with a doctype on it.
>
> I want to serialize it.
>
> I use the usual TraX call. No doctype lands in the output. I'm very
> carefully using Xerces for the DOM and Xalan for TraX.
>
> Am I just in the land of RTfM?

Reply via email to