Hi Stephen,

In response to:

> My current problem is in regard to XForm select1 elements, it is simple
to indicate that a schema simple element should become a select1 but not so
simple to indicate where the itemset for the select1 should come from (at
least in a way that seems logical to me).

This is a great question and one that has dogged everyone I know that has
worked in the area of automatic XForms generation.  The core problem is
that XML Schemas are designed for validation, not presentation.  So there
is no element attribute for "label".

In general the "best practice" that we use at the US Federal level is to
generate both the Code
<http://en.wikipedia.org/wiki/Code_%28metadata%29>-related
SimpleTypes with enumerations (restriction of xs:string) from something
called an ISO-11179 metadata registry.  Although this sounds complicated
there is only a single service you need out of the registry called a "code
table service" that returns code-table items for each "Code" Representation
Term <http://en.wikipedia.org/wiki/Representation_term> (any element that
has a suffix called "Code").

This service takes in a "Data Element Name" (like CountryCode) and returns
an item set that includes both the "value" and "label" for each item in a
code set.  This service is then used to create the enumerations for each
SimpleType when the sub-schema is generated and the label/value pairs for
the data elements.

The way I build most of my XForms is to put all the codes in a single
instance (usually called the "code-tables" or "all-codes" instance/service)
and then reference this in each select1 or select.  The decision to use
select1 or select comes from the cardinality of the element in the XML
Schema.

Here is the structure of this code-table instance:

http://en.wikibooks.org/wiki/XForms/Selecting_Codes_From_File#Structure_of_Code_Tables_Instance

The key I have found is that some large forms use the same code-table in
many areas.  This approach allows you to only have to load the code-table
once per form.

In my XRX frameworks "all-codes.xq" is just a service that gets all the
codes for any form.  You can deduce this if all your elements end with the
suffix "Code" or have the proper enumerations.

I will try to document some of these best practices and put them in a
wikibook article.

Keep up the great work!

- Dan

On Sat, Jan 7, 2012 at 11:35 PM, Stephen Cameron <[email protected]
> wrote:

> Hi List
>
> This is somewhat off the subject of XSLTForms but I'm hoping there are
> XML Schema/Schematron experts amongst the group who might like to
> comment.
>
> I am building a XML Schema/Schematron designer using XSLTForms and
> providing a means to generate XForms from the schemas produced.
>
> The designer side is looking pretty good now, and I'm starting to
> focus on the XForms generation side of things.
>
> The basic idea is that XML Schema elements are annotated with
> rendering elements indicating how they should be represented in an
> XForm.  Also Schematron asserts can be added that become constraints
> on binds in the generated forms.
>
> The main requirement is that the schema must be able to generate forms
> and also be useful for validating the XML generated by each form at
> the server.
>
> My current problem is in regard to XForm select1 elements, it is
> simple to indicate that a schema simple element should become a
> select1 but not so simple to indicate where the itemset for the
> select1 should come from (at least in a way that seems logical to me).
>
> I want to use an itemset that is bound to an 'code-list' instance
> nodeset and provide a separate CRUD Xform for maintaining the items in
> the code-list. Also. sometimes I want to be able to maintain a
> hierarchical code-list such that two or more selects (one after the
> other in the form) are linked to the same instance and selecting an
> item in one itemset affects what is visible in the select1 itemset
> below it (and so on). These are very common requirements and so I'd
> like to create an intuitive way to set this scenario up in the
> designer.
>
> This is something that is simple in a relational schema but not so
> straight-forward in XML Schema. I think what I am wanting is to define
> a element and say the possible set of values for that element are in
> another element altogether and I'm not sure if the relationship needs
> to be a derivation of the first element from the second element.
>
> If there is anyone with expertise in this arena that might like to comment.
>
> Thanks
>
> Steve Cameron
>
>
> ------------------------------------------------------------------------------
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual
> desktops for less than the cost of PCs and save 60% on VDI infrastructure
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> _______________________________________________
> Xsltforms-support mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xsltforms-support
>



-- 
Dan McCreary
Semantic Solutions Architect
office: (952) 931-9198
cell: (612) 986-1552
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to