Johnn
Johnn

Reputation: 35

Preferred way for transformation/validation - XSLT / XSD

I need to transform one XML to another XML format and at the same time i need to validate the XML also. can we use XSLT for both transformation and validation as well. If so then why XSD . Is it better to use XSLT for transformation and XSD for validation. What are the pros and cons in both of the approaches. Or should we create XSD for source XML, so that XSLT will parse only those XML files which comply with the XSD and then transform to another XML.

Please suggest.

Upvotes: 0

Views: 242

Answers (1)

Erik A. Brandstadmoen
Erik A. Brandstadmoen

Reputation: 10588

XSLT is for transforming XML into another output. This could be another XML file, HTML, text, whatever. XSD and DTD is a schema describing valid structure of the XML document.

So, to validate, you need to have a DTD or XSD to validate against. To transform, you can use an XSLT.

Upvotes: 2

Related Questions