[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSD Validation with XSLT

Subject: XSD Validation with XSLT
From: "Robert Soesemann" <rsoesemann@xxxxxxxxxxx>
Date: Fri, 10 Dec 2004 09:42:08 +0100
xsd required field
Hello,

I guess my question might seem somewhat strange. The context is, that I
need to bring in content into a CMS that will validate it againts XML
Schema files. Some of the XML files that I want to import might not
provide data where the datamodel of the CMS might require this.

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)

To give you an example of my structure:
XML:
----
<employee>
	<name>Tom</name>
	<id></id>				<-- is required
	<managedBy>Hans<managedBy>		<-- is required
	<manages>Frank</manages>
</employee>

XSD:
----
<xs:element name="employee">
		<xs:complexType>
			<xs:choice minOccurs="0" maxOccurs="1">
				<xs:element name="name"
type="xs:string"/>
				<xs:element name="id" type="xs:string"
minOccurs="1"/>
...


OUTPUT:
-------
<employee>
	<name>Tom</name>
	<id>n/a</id>				<-- is required
	<managedBy>Hans<managedBy>		<-- is required
	<manages>Frank</manages>
</employee>

Any help is very welcome.

Robert

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.