Help! Pulling select list from external documents

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Help! Pulling select list from external documents

danc-3
Help!

I am trying pull a list of countries from an external XML file and populate my SELECT1 control.  The XML file is located in the same folder as my other files.  I went through the tutorial and documentation and couldn't find a clear example of how to pull a list from the file.

Can anyone help?





--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Help! Pulling select list from external documents

Erik Bruchez
Administrator
[hidden email] wrote:
 > Help!
 >
 > I am trying pull a list of countries from an external XML file and
 > populate my SELECT1 control.  The XML file is located in the same
 > folder as my other files.  I went through the tutorial and
 > documentation and couldn't find a clear example of how to pull a
 > list from the file.
 >
 > Can anyone help?

That's with 3.0 beta 3 or a nightly, right?

I would just either include the list of countries (as an XML file,
right?) as an external instance:

<xforms:instance src="oxf:/path/to/list.xml" id="countries-instance"/>

(Right now, relative URLs do not work with the src attribute on
xforms:instance.)

Alternatively, you can include the instance with XInclude (if you are
using a nightly build):

<xforms:instance id="countries-instance">
   <xi:include href="list.xml"/>
</xforms:instance>

Then you use an itemset:

<xforms:select1>
   <xforms:itemset nodeset="instance('countries-instance')/country">
     <xforms:label ref="my-name"/>
     <xforms:value ref="my-value"/>
   </xforms:itemset>
</xforms:select1>

This assuming list.xml is of the form:

<root>
   <country>
     <my-name>Sweden</my-name>
     <my-name>113</my-name>
   </country>
   <country>
     <my-name>Belgium</my-name>
     <my-name>14</my-name>
   </country>
   ...
</root>

-Erik




--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Help! Pulling select list from external documents

Erik Bruchez
Administrator
Erik Bruchez wrote:

> This assuming list.xml is of the form:
>
> <root>
>   <country>
>     <my-name>Sweden</my-name>
>     <my-name>113</my-name>
>   </country>
>   <country>
>     <my-name>Belgium</my-name>
>     <my-name>14</my-name>
>   </country>
>   ...
> </root>
Of course the above should read:

<root>
   <country>
     <my-name>Sweden</my-name>
     <my-value113</my-value>
   </country>
   <country>
     <my-name>Belgium</my-name>
     <my-value14</my-value>
   </country>
   ...
</root>

-Erik



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Help! Pulling select list from external documents

danc-3
Erik. 

Wow! Thank you so much!

You completely solved my problem.

Your help is MUCH appreciated.

Best,

Dan


---------- Original Message -----------
From: Erik Bruchez <[hidden email]>
To: [hidden email]
Sent: Mon, 07 Nov 2005 23:03:00 +0100
Subject: Re: [ops-users] Help! Pulling select list from external documents

> Erik Bruchez wrote:
>
> > This assuming list.xml is of the form:
> >
> > <root>
> >   <country>
> >     <my-name>Sweden</my-name>
> >     <my-name>113</my-name>
> >   </country>
> >   <country>
> >     <my-name>Belgium</my-name>
> >     <my-name>14</my-name>
> >   </country>
> >   ...
> > </root>
>
> Of course the above should read:
>
> <root>
>   <country>
>     <my-name>Sweden</my-name>
>     <my-value113</my-value>
>   </country>
>   <country>
>     <my-name>Belgium</my-name>
>     <my-value14</my-value>
>   </country>
>   ...
> </root>
>
> -Erik
------- End of Original Message -------


--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws