A
Adam Retter
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.
Thanks
Adam Retter
(e-mail address 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>
else
<input type="text">{$cg/@name}</input>
else(
if($pi eq "xs:integer") then
OUTPUT integer field
<p>{$cg/@name}</p>
else(
)
)
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
<p>{$inte/@name}</p>
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.
Thanks
Adam Retter
(e-mail address 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>
else
<input type="text">{$cg/@name}</input>
else(
if($pi eq "xs:integer") then
OUTPUT integer field
<p>{$cg/@name}</p>
else(
)
)
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
<p>{$inte/@name}</p>