A DOCTYPE can be specified programmatically [1][2][3], so you don't need to
write a stylesheet. Note that either approach only works if the
DocumentType node has no internal subset. If it has one it will still be
lost if you do this.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/Transformer.html#setParameter
(java.lang.String,%20java.lang.Object)
[2]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/OutputKeys.html#DOCTYPE_PUBLIC
[3]
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/OutputKeys.html#DOCTYPE_SYSTEM

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

Michael Ludwig <mil...@gmx.de> wrote on 11/24/2009 08:22:31 AM:

> Michael Glavassevich schrieb am 30.10.2009 um 12:45:44 (-0400):
>
> > 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.
>
> You can set a DOCTYPE from XSLT using xsl:output/@doctype-system and
> xsl:output/@doctype-public:
>
> <xsl:stylesheet version="1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>
>   <xsl:output doctype-public="eins zwei drei"
>     doctype-system="http://eins.de/zwei/drei"/>
>
>   <xsl:template match="@*|node()">
>     <xsl:copy>
>       <xsl:apply-templates select="@*|node()"/>
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>
>
> --
> Michael Ludwig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to