Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Create HTML Form from Schema using xql or xslt?

Thread Tools

Create HTML Form from Schema using xql or xslt?

Adam Retter
Posts: n/a
Hi Guys,

I have a need to create a html form based on my schema. I initially
decided to do this using xql, have got some way but am finding this
difficult (it may be as I am very new to xql).
The html form needs to be dynamically generated from the schema as the
schema may change in future. We need the forms to provide a UI for users
to edit the underlying xml documents represented by the schema.

Im wandering if there is an easy way or if its even possible to do it
using xslt instead?

I have attached my Schemas and xql for you guys to see what ive done so
far. Basically ive managed to generate some text fields for my text
elements in my schema but they are out of order and im not sure how to
deal with elements that have simple and complex types. Ideally for a
enumeration I would like to display a combo-box with all the possible
values of the enumeration.

Any hints and tips with xql, or an xslt method or anything else will be
greatly appreciated.


Adam Retter Removed)

xquery version "1.0";

(:for $cg in doc("/db/CommunityDatabase/CommunityGroup.xsd")/xs:schema/xs:element/xs:complexType/xs:sequence//xs:element return
for $cg in doc("/db/CommunityDatabase/CommunityGroup.xsd")/xs:schema//xs:element return
let $pi := $cg/@type return
if($pi eq "xs:string") then
(: OUTPUT text field
if($cg/../../@name) then
<input type="text" group="{$cg/../../@name}">{$cg/@name}</input>
<input type="text">{$cg/@name}</input>
if($pi eq "xs:integer") then
(: OUTPUT integer field


for $txt in doc("/db/CommunityDatabase/CommunityGroup.xsd")/xs:schema/xs:element/xs:complexType/xs:sequence//xs:element[@type="xs:string"] return
<input type="text">{$txt/@name}</input>

for $inte in doc("/db/CommunityDatabase/CommunityGroup.xsd")/xs:schema/xs:element/xs:complexType/xs:sequence//xs:element[@type="xs:integer"] return

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation with XSD using XML::LibXML::Schema, and XML::Validator::Schema Perl Misc 5 11-29-2006 12:37 PM
XQL 'id' function in XML::XQL Lars Kellogg-Stedman Perl Misc 0 11-16-2005 02:14 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
Howto create form with entry fields from XML/XSD schema ?? Michael Hertz Java 0 07-19-2004 11:15 AM
how to test xql kvs XML 0 09-11-2003 09:14 AM