Thursday, January 30, 2014

XML validation / XSL transformation in Eclipse

Here i share with you how to validate XML or XSLT output with the help of Eclipse.

First of all, check if you have XSL Developer tools. If not, just install new software (Help->Install New Software) and choose XSL Developer tools.

To check if the XML is valid you need to add the XSD schema to the code and check if it is in the XML Catalog (Windows->Perspective->XML->XML Catalog). After you add/find the schema in the catalog, just click the right button on the file and choose Validate.

The alternative is to select all files (XML, XSD) and choose Validate (from the right click menu again).

To check the output of the XML file applying XSLT you need to run the XSL transformation of the XSL/XSLT file and choose the file under which you want to run the transformation.

Notes:
if you need to validate xhtml website use the following attributes in the html tag
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml
http://www.w3.org/2002/08/xhtml/xhtml1-transactional.xsd"

The screenshots will be added.