xsl-list
[Top] [All Lists]

Re: XSD Validation with XSLT

2004-12-10 05:46:25
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:

 http://www.amazon.com/exec/obidos/tg/detail/-/1861005474

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.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>