Re: [xsl] Problem with doctype-system in transformation xml to xml

Subject: Re: [xsl] Problem with doctype-system in transformation xml to xml
From: andrew welch <andrew.j.welch@xxxxxxxxx>
Date: Wed, 7 Dec 2005 12:04:36 +0000
On 12/7/05, Axel Kesten <kesten@xxxxxxxxxxxxxxx> wrote:
> Hi all,
>
> my problem is:
>
> I have written a stylesheet to transform a list of xml-files, given in =
> an xml-config-file, to another xml-file with another structure and dtd.
> Anything works fine, except of the dtd-declaration in the destination =
> xml-file.
> I use  <xsl:output  method="xml" version="1.0" encoding="UTF-8"
indent="yes"
> omit-xml-declaration="no" doctype-system="C:\A.dtd" media-type="text/xml"
/>
>
>  to create the dtd-declaration.
> In the A.dtd the first element is A, but the result in the destination =
> xml-file is as follows:
> <!DOCTYPE B SYSTEM "C:\A.dtd">
>
> and B is exactly the second element in the destination xml-file and it =
> is the only element, defined in the A.dtd as content for A.
>
> Of course this xml-file is not valid. If i change manually to <!DOCTYPE =
> A SYSTEM "C:\A.dtd"> it's valid. That means, all the other code should =
> be OK.
>
> What is the problem? Can anybody give me a hint what I'm doing wrong?
>
> I'm using XML-Version 1.0, XSL 2.0 and altovaxml-processor 2006 (with =
> Altova XSLT 2.0 Engine) to create the output file.

For this to happen <B> must be the root element of your output, eg:

<xsl:template match="/">
  <B>
    ...

You need to post a small complete example stylesheet that causes this
problem so it can be recreated, eg

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output omit-xml-declaration="no" doctype-system="C:\A.dtd"/>

<xsl:template match="/">
  <B></B>
</xsl:template>

</xsl:stylesheet>

cheers
andrew

Current Thread