W3C home > Mailing lists > Public > www-forms@w3.org > September 2005

Populating select1 from a schema

From: Patricio Olivares <patolivares@gmail.com>
Date: Mon, 26 Sep 2005 15:04:25 -0400
Message-ID: <1bbf1ffd0509261204762ed2e8@mail.gmail.com>
To: www-forms@w3.org

Hi everybody,
since as far as I know the xforms engine I'm using (x-smiles) can't
infer the listing of posible values from the validating schema of the
instance (in a select1 widget), I'm trying to recover the values
directly from the xsd.

The problem I'm having with this approach is how to reference to the
values (in itemset, via xpath). This is because the natural prefix to
use is "xsd:" but that approach doesn't scale very well because I've
no control over the file "enum.xsd" and If I need to refer two enums
(enum1.xsd and enum2.xsd) from two select1 widgets, maybe the two
schemas are using the same prefix, so I can't distinguish between
them.

Does anyone have any thoughts about this?. Is there a better approach possible?

The following are code extracts that I'm using to test the issue.
Thanks in advance.

-------------------

enum.xsd
========
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.target/namespaces/enum"
    version="1.0"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified">

    <xsd:simpleType name="globalEnumType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="VAL1" />
            <xsd:enumeration value="VAL2" />
            <xsd:enumeration value="VAL3" />
        </xsd:restriction>
    </xsd:simpleType>
</xsd:schema>


xforms :: head
===============
<xf:model id="idenum">
    <xf:instance
        src="enum.xsd"
        xmlns:xsd="http://www.target/namespaces/enum" />
</xf:model>


xforms :: body
==============
<xf:select1 model="default" ref="/path/to/target/element">
    <xf:label>Choose...</xf:label>
    <xf:itemset model="idenum"
nodeset="xsd:schema/xsd:simpleType/xsd:restriction/xsd:enumeration">
        <xf:label ref="@value" />
        <xf:value ref="@value" />
    </xf:itemset>
</xf:select1>



--
Patricio Olivares
Received on Tuesday, 27 September 2005 03:31:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:01 GMT