Populating select1 from a schema

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 UTC