Hi
I have a schema as follows: - <xsd:simpleType name="ISO3166CountyCode"> <xsd:annotation> <xsd:documentation> Two-letter (alpha-2) ISO 3166-1 code for one of the 243 countries. </xsd:documentation> </xsd:annotation> <xsd:restriction base="xsd:string"> <xsd:enumeration value="AF"/> <xsd:enumeration value="AX"/> <xsd:enumeration value="AL"/> <xsd:enumeration value="DZ"/> <xsd:enumeration value="AS"/> <xsd:enumeration value="AD"/> <xsd:enumeration value="AO"/> <xsd:enumeration value="AI"/> ---------- ------- Now I have an XForm in which I have a select1 control for country as follows: <xhtml:td class="form-td"> <xforms:select1 ref="instance('taskinput')/fe:country" selection="closed"> <xforms:label class="all-label">Country:</xforms:label> <xforms:item> <xforms:label> USA </xforms:label> <xforms:value> UK </xforms:value> </xforms:item> <xforms:item> <xforms:label> UAE </xforms:label> <xforms:value> Uganda </xforms:value> </xforms:item> </xforms:select1> </xhtml:td> --------- I coded hard-coded values in the select1 statement in the beginning when I did not have the schema for the country code, but when I have it, I do not know how to load these values into the select1 dropdown dynamically. That is, the dropdown should be prepopulated with values from the schema (through the instance or from the schema to the select1 directly) This may be a naive question, but I do not have an answer as to how I can do this. Any suggestions are appreciated. |
Hi,
Le mercredi 16 janvier 2008 à 10:49 -0800, XGuy a écrit : > That is, the dropdown should be prepopulated with values from the schema > (through the instance or from the schema to the select1 directly) What about using an XPath expression to access this information in the schema itself? In that case, rather than using a comment for the country name, you'd better use either a xs:annotation or a foreign attribute, for instance : <xsd:enumeration value="AF" dc:title="AFGHANISTAN"/> You can then access to the set of xsd:enumeration like you'd to to any lookup table... Something along these lines should work: <xforms:select1 ref="instance('taskinput')/fe:country" selection="closed"> <xforms:label class="all-label">Country:</xforms:label> <itemset nodeset="instance('schema')/xsd:simpleType[@name='ISO3166CountyCode']/xsd:restriction/xsd:enumeration"> <label ref="@dc:title"/> <value ref="@value"/> </itemset> ... Assuming that your instance named "schema" is your schema. Hope this helps. Eric > This may be a naive question, but I do not have an answer as to how I can do > this. > > Any suggestions are appreciated. > pièce jointe document plein texte (message-footer.txt) > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws Le premier annuaire des apiculteurs 100% XML! http://apiculteurs.info/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws signature.asc (196 bytes) Download Attachment |
I will try these suggestions today. I appreciate your looking at it.
|
In reply to this post by Eric van der Vlist
Hi Eric
I do not quite understand the use of "instance('schema')". In my XForm I have <xforms:model schema="CC.xsd" I think you are trying to tell me to directly reference the schema itself like: instance('CC').. Have I understood you correctly? thanks ilango <quote author="Eric van der Vlist"> Hi, Le mercredi 16 janvier 2008 à 10:49 -0800, XGuy a écrit : > That is, the dropdown should be prepopulated with values from the schema > (through the instance or from the schema to the select1 directly) What about using an XPath expression to access this information in the schema itself? In that case, rather than using a comment for the country name, you'd better use either a xs:annotation or a foreign attribute, for instance : <xsd:enumeration value="AF" dc:title="AFGHANISTAN"/> You can then access to the set of xsd:enumeration like you'd to to any lookup table... Something along these lines should work: <xforms:select1 ref="instance('taskinput')/fe:country" selection="closed"> <xforms:label class="all-label">Country:</xforms:label> <itemset nodeset="instance('schema')/xsd:simpleType[@name='ISO3166CountyCode']/xsd:restriction/xsd:enumeration"> <label ref="@dc:title"/> <value ref="@value"/> </itemset> ... Assuming that your instance named "schema" is your schema. Hope this helps. Eric > This may be a naive question, but I do not have an answer as to how I can do > this. > > Any suggestions are appreciated. > pièce jointe document plein texte (message-footer.txt) > -- > You receive this message as a subscriber of the ops-users@ow2.org mailing list. > To unsubscribe: mailto:ops-users-unsubscribe@ow2.org > For general help: mailto:sympa@ow2.org?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws -- GPG-PGP: 2A528005 Le premier annuaire des apiculteurs 100% XML! http://apiculteurs.info/ ------------------------------------------------------------------------ Eric van der Vlist http://xmlfr.org http://dyomedea.com (ISO) RELAX NG ISBN:0-596-00421-4 http://oreilly.com/catalog/relax (W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema ------------------------------------------------------------------------ -- You receive this message as a subscriber of the ops-users@ow2.org mailing list. To unsubscribe: mailto:ops-users-unsubscribe@ow2.org For general help: mailto:sympa@ow2.org?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
ilan,
> I think you are trying to tell me to directly reference the schema itself > like: instance('CC').. i suppose you wil have to load the schema into an instance, firstly, before accesing it that way. For example: <xforms:instance id="CC" src="oxf:CC.xsd" /> HTH florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |