Re: [xsl] XSD Validation with XSLT

Subject: Re: [xsl] XSD Validation with XSLT
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 10 Dec 2004 12:46:25 +0000
Hi Robert,

> My idea was to validate the input against a xsd *by means of XSLT*.
> This would *not need to validate the whole structure but only test
> whether elements with unique names have a value or not. I a required
> field is found to be empty a predefined value should be inserted.
> (e.g. a -1 for xs:integer or n/a for xs:string)

This is certainly *possible*. How easy this is depends very much on
how complicated your schema is -- using named model groups, included
schemas and (worse!) redefined schemas makes life really difficult.

What you have to do is navigate through the schema and the instance
document side-by-side. I wrote up how to do this in detail in my
chapter for Professional XML Schemas from Wrox:

There it was for the purposes of filling in an HTML form, generated
from the schema, within information from an instance document, but the
same principles apply. Unfortunately, it's rather involved, so all I
can suggest is that you buy, borrow or steal the book, or contact me
offline and I'll send you the source code if you'd like.



Jeni Tennison

Current Thread