Create HTML Form from Schema using xql or xslt?

Discussion in 'XML' started by Adam Retter, Feb 9, 2005.

  1. Adam Retter

    Adam Retter Guest

    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



    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>
    :)
    Adam Retter, Feb 9, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    654
    Stylus Studio
    Aug 3, 2004
  2. Markus
    Replies:
    1
    Views:
    1,528
    Markus
    Nov 23, 2005
  3. kvs

    how to test xql

    kvs, Sep 11, 2003, in forum: XML
    Replies:
    0
    Views:
    406
  4. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,248
    Stanimir Stamenkov
    Apr 25, 2005
  5. Lars Kellogg-Stedman

    XQL 'id' function in XML::XQL

    Lars Kellogg-Stedman, Nov 16, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    96
    Lars Kellogg-Stedman
    Nov 16, 2005
Loading...

Share This Page