xsltdoctypecxml

How to add cxml doctype using XSLT


I am generating correct cxml but doctype is missing in the beginning.

How can I add the below doc type after <?xml version="1.0" encoding="utf-8"?> and copy the remaining xml using XSLT mapping.

<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.032/cXML.dtd">

Desired output should be like

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.032/cXML.dtd">
<xml>
<field>.... (followed by remaining xml structure)

Thanks, Varun


Solution

  • Try

    <xsl:output method="xml"
      doctype-system="http://xml.cxml.org/schemas/cXML/1.2.032/cXML.dtd"
    />