RE: [xsl] XML 2 XML using XSL,DTD XALAN - JAVA

Subject: RE: [xsl] XML 2 XML using XSL,DTD XALAN - JAVA
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 24 Nov 2004 23:40:33 -0000
> The only way to validade the result DOM tree is to parse it again?
> The XSL that I'm using has the output property below:
> <xsl:output method="xml" indent="no" encoding="ISO-8859-1" 
> doctype-system="../DTD/MyDTD.dtd"/>
> 
> Even with this, the result DOM tree doesn't have a DocType 
> with it. Does anyone knows why?

Because xsl:output only affects the serializer, and when you send your
output to a DOM, you are not serializing it.

JAXP 1.3 provides a SAX-based validation API. This provides a validator in
the form of a ContentHandler, and since JAXP allows you to send the results
of a transformation to a ContentHandler, you should be able to pipe
transformation results straight into a validator.

For a more closely integrated solution (but only with XML Schema) XSLT 2.0
allows you to request validation of a result document directly. I personally
find this the most useful aspect of XSLT/Schema integration in XSLT 2.0 -
until you get used to it, it comes as quite a surprise to see error messages
pointing straight to the line in your stylesheet that generates the
incorrect output.

Michael Kay
http://www.saxonica.com/

Current Thread