I searched for a solution, but found nothing.
I need a country / city selection. I thought about one select1 to select the country, a second, filled depending on the first, to select the city. What would be a good way to implement this with xforms? I can format the source (city/country list) in any way nessecary. It's about 14 countries with maybe 10 cities each. Thanks, Mathias -- 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 |
Mathias,
I'm doing a similar thing with databases on my application I have the following xml <servers> <server> <name>blah</name> <database>blah</database> ... </server> ... </servers> I have two instances one holding the above and one with <instance> <serverUrl/> <databaseName/> </instance> And two select1s as follows <xforms:select1 ref="instance('instance')/serverUrl"> <xforms:itemset nodeset="instance('tamino')/server"> <xforms:label ref="url"/> <xforms:value ref="url"/> </xforms:itemset> <xforms:setvalue ev:event="xforms-value-changed" ref="instance('instance')/databaseName" value="instance('tamino')/server[url = instance('instance')/serverUrl]/databases/database[1]"/> </xforms:select1> <xforms:select1 ref="instance('instance')/databaseName"> <xforms:itemset nodeset="instance('tamino')/server[url = instance('instance')/serverUrl]/databases/database"> <xforms:label ref="."/> <xforms:value ref="."/> </xforms:itemset> </xforms:select1> Hope this helps Ryan Puddephatt Software Engineer TFX Group - IT UK 1 Michaelson Square Livingston West Lothian Scotand EH54 7DP * [hidden email] ( 01506 407 110 7 01506 407 108 >-----Original Message----- >From: Mathias Picker [mailto:[hidden email]] >Sent: 25 April 2006 17:38 >To: ops-users >Subject: [ops-users] master/slave select1 (e.g. country/city) > >I searched for a solution, but found nothing. > >I need a country / city selection. I thought about one select1 to select >the country, a second, filled depending on the first, to select the >city. > >What would be a good way to implement this with xforms? > >I can format the source (city/country list) in any way nessecary. It's >about 14 countries with maybe 10 cities each. > >Thanks, Mathias > -- 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 |
Great. Thanks, Ryan!
Am Dienstag, den 25.04.2006, 17:30 +0100 schrieb Ryan Puddephatt: > Mathias, > I'm doing a similar thing with databases on my application I have > the following xml > <servers> > <server> > <name>blah</name> > <database>blah</database> > ... > </server> > ... > </servers> > > I have two instances one holding the above and one with > > <instance> > <serverUrl/> > <databaseName/> > </instance> > > And two select1s as follows > > <xforms:select1 ref="instance('instance')/serverUrl"> > <xforms:itemset nodeset="instance('tamino')/server"> > <xforms:label ref="url"/> > <xforms:value ref="url"/> > </xforms:itemset> > <xforms:setvalue ev:event="xforms-value-changed" > ref="instance('instance')/databaseName" > value="instance('tamino')/server[url = > instance('instance')/serverUrl]/databases/database[1]"/> > </xforms:select1> > > <xforms:select1 ref="instance('instance')/databaseName"> > <xforms:itemset nodeset="instance('tamino')/server[url = > instance('instance')/serverUrl]/databases/database"> > <xforms:label ref="."/> > <xforms:value ref="."/> > </xforms:itemset> > </xforms:select1> > > Hope this helps > > Ryan Puddephatt > Software Engineer > TFX Group - IT UK > 1 Michaelson Square > Livingston > West Lothian > Scotand > EH54 7DP > > * [hidden email] > ( 01506 407 110 > 7 01506 407 108 > > > >-----Original Message----- > >From: Mathias Picker [mailto:[hidden email]] > >Sent: 25 April 2006 17:38 > >To: ops-users > >Subject: [ops-users] master/slave select1 (e.g. country/city) > > > >I searched for a solution, but found nothing. > > > >I need a country / city selection. I thought about one select1 to select > >the country, a second, filled depending on the first, to select the > >city. > > > >What would be a good way to implement this with xforms? > > > >I can format the source (city/country list) in any way nessecary. It's > >about 14 countries with maybe 10 cities each. > > > >Thanks, Mathias > > > > > > einfaches Textdokument-Anlage (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 > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- 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 |
In reply to this post by Ryan Puddephatt
I'm trying to apply Ryans solution inside a repeat. So, I need to get at
the position of the repeat in the xpath expression of the second select1. But I'm just not fluent enough in xpath to guess at how to do this. If I have an instance <xforms:instance id="r"> <instance> <did> <country /> <city /> </did> <did> <country /> <city /> </did> </instance> </xforms:instance> and for the did-locations the following xml: <xforms:instance id="did-locations"> <dids> <country> <name>Germany</name> <code>de</code> <city><name>München</name><code>muc</code></city> <city><name>Köln</name><code>kln</code></city> </country> <country> <name>Switzerland</name> <code>ch</code> <city><name>Bern</name><code>brn</code> </city> <city><name>Zürich</name><code>zur</code> </city> </country> </dids> </xforms:instance> I would like to use something like: (inside a xforms:group ref=instance('r')) <xforms:repeat id="did-repeat" nodeset="did[position() > 1]"> <xforms:select1 ref="country" class="country-selector" appearance="minimal"> <xforms:itemset nodeset="instance('did-locations')/country"> <xforms:label ref="name"/> <xforms:value ref="code"/> </xforms:itemset> </xforms:select1> <!-- This works fine, showing the index of the repeat 'did-repeat' --> <xforms:output value="position()" /> <xforms:select1 ref="city" class="country-selector indent" appearance="minimal"> <xforms:itemset nodeset="instance('did-locations')/country[code= instance('r')/did[REPEAT POSITION??]/country]/city"> <xforms:label ref="name"/> <xforms:value ref="code"/> </xforms:itemset> </xforms:select1> </xforms:repeat> but how do I get the position of did-repeat in this expression: "instance('r')/did[REPEAT POSITION??]/country]/city" Thanks for any ideas, Mathias Am Dienstag, den 25.04.2006, 17:30 +0100 schrieb Ryan Puddephatt: > Mathias, > I'm doing a similar thing with databases on my application I have > the following xml > <servers> > <server> > <name>blah</name> > <database>blah</database> > ... > </server> > ... > </servers> > > I have two instances one holding the above and one with > > <instance> > <serverUrl/> > <databaseName/> > </instance> > > And two select1s as follows > > <xforms:select1 ref="instance('instance')/serverUrl"> > <xforms:itemset nodeset="instance('tamino')/server"> > <xforms:label ref="url"/> > <xforms:value ref="url"/> > </xforms:itemset> > <xforms:setvalue ev:event="xforms-value-changed" > ref="instance('instance')/databaseName" > value="instance('tamino')/server[url = > instance('instance')/serverUrl]/databases/database[1]"/> > </xforms:select1> > > <xforms:select1 ref="instance('instance')/databaseName"> > <xforms:itemset nodeset="instance('tamino')/server[url = > instance('instance')/serverUrl]/databases/database"> > <xforms:label ref="."/> > <xforms:value ref="."/> > </xforms:itemset> > </xforms:select1> > > Hope this helps > > Ryan Puddephatt > Software Engineer > TFX Group - IT UK > 1 Michaelson Square > Livingston > West Lothian > Scotand > EH54 7DP > > * [hidden email] > ( 01506 407 110 > 7 01506 407 108 > > > >-----Original Message----- > >From: Mathias Picker [mailto:[hidden email]] > >Sent: 25 April 2006 17:38 > >To: ops-users > >Subject: [ops-users] master/slave select1 (e.g. country/city) > > > >I searched for a solution, but found nothing. > > > >I need a country / city selection. I thought about one select1 to select > >the country, a second, filled depending on the first, to select the > >city. > > > >What would be a good way to implement this with xforms? > > > >I can format the source (city/country list) in any way nessecary. It's > >about 14 countries with maybe 10 cities each. > > > >Thanks, Mathias > > > > > > einfaches Textdokument-Anlage (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 > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- 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 |
Mathias,
I am stumped also. I don't know which instance position() will refer to, and while XForms works with multiple instances, I don't know that XPath does. So perhaps it is better to build a new instance ? You can use XSLT to build an instance and it might be easier to construct this in an <xsl:for-each> construct with variables. You can select the instance that comes from the page-flow "model" attribute, select="doc('input:data')/*" I am not sure how xslt can access xforms instances, only build them, so your model would need to have the instances aggregated. Best, Hank ----- Original Message ----- From: "Mathias Picker" <[hidden email]> To: <[hidden email]> Sent: Wednesday, April 26, 2006 6:49 AM Subject: RE: [ops-users] master/slave select1 (e.g. country/city) > I'm trying to apply Ryans solution inside a repeat. So, I need to get at > the position of the repeat in the xpath expression of the second > select1. But I'm just not fluent enough in xpath to guess at how to do > this. > > If I have an instance > > <xforms:instance id="r"> > <instance> > <did> > <country /> > <city /> > </did> > <did> > <country /> > <city /> > </did> > </instance> > </xforms:instance> > > > and for the did-locations the following xml: > > > <xforms:instance id="did-locations"> > <dids> > <country> > <name>Germany</name> > <code>de</code> > > <city><name>München</name><code>muc</code></city> > <city><name>Köln</name><code>kln</code></city> > </country> > <country> > <name>Switzerland</name> > <code>ch</code> > <city><name>Bern</name><code>brn</code> </city> > <city><name>Zürich</name><code>zur</code> </city> > </country> > </dids> > </xforms:instance> > > > I would like to use something like: > (inside a xforms:group ref=instance('r')) > > > <xforms:repeat id="did-repeat" > nodeset="did[position() > 1]"> > > <xforms:select1 ref="country" class="country-selector" > appearance="minimal"> > <xforms:itemset nodeset="instance('did-locations')/country"> > <xforms:label ref="name"/> > <xforms:value ref="code"/> > </xforms:itemset> > </xforms:select1> > > <!-- This works fine, showing the index of the repeat 'did-repeat' --> > <xforms:output value="position()" /> > > <xforms:select1 ref="city" class="country-selector indent" > appearance="minimal"> > <xforms:itemset > nodeset="instance('did-locations')/country[code= > instance('r')/did[REPEAT POSITION??]/country]/city"> > <xforms:label ref="name"/> > <xforms:value ref="code"/> > </xforms:itemset> > </xforms:select1> > > </xforms:repeat> > > > but how do I get the position of did-repeat in this expression: > "instance('r')/did[REPEAT POSITION??]/country]/city" > > > Thanks for any ideas, > > Mathias > > > Am Dienstag, den 25.04.2006, 17:30 +0100 schrieb Ryan Puddephatt: >> Mathias, >> I'm doing a similar thing with databases on my application I have >> the following xml >> <servers> >> <server> >> <name>blah</name> >> <database>blah</database> >> ... >> </server> >> ... >> </servers> >> >> I have two instances one holding the above and one with >> >> <instance> >> <serverUrl/> >> <databaseName/> >> </instance> >> >> And two select1s as follows >> >> <xforms:select1 ref="instance('instance')/serverUrl"> >> <xforms:itemset nodeset="instance('tamino')/server"> >> <xforms:label ref="url"/> >> <xforms:value ref="url"/> >> </xforms:itemset> >> <xforms:setvalue ev:event="xforms-value-changed" >> ref="instance('instance')/databaseName" >> value="instance('tamino')/server[url = >> instance('instance')/serverUrl]/databases/database[1]"/> >> </xforms:select1> >> >> <xforms:select1 ref="instance('instance')/databaseName"> >> <xforms:itemset nodeset="instance('tamino')/server[url = >> instance('instance')/serverUrl]/databases/database"> >> <xforms:label ref="."/> >> <xforms:value ref="."/> >> </xforms:itemset> >> </xforms:select1> >> >> Hope this helps >> >> Ryan Puddephatt >> Software Engineer >> TFX Group - IT UK >> 1 Michaelson Square >> Livingston >> West Lothian >> Scotand >> EH54 7DP >> >> * [hidden email] >> ( 01506 407 110 >> 7 01506 407 108 >> >> >> >-----Original Message----- >> >From: Mathias Picker [mailto:[hidden email]] >> >Sent: 25 April 2006 17:38 >> >To: ops-users >> >Subject: [ops-users] master/slave select1 (e.g. country/city) >> > >> >I searched for a solution, but found nothing. >> > >> >I need a country / city selection. I thought about one select1 to select >> >the country, a second, filled depending on the first, to select the >> >city. >> > >> >What would be a good way to implement this with xforms? >> > >> >I can format the source (city/country list) in any way nessecary. It's >> >about 14 countries with maybe 10 cities each. >> > >> >Thanks, Mathias >> > >> >> >> >> einfaches Textdokument-Anlage (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 >> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -------------------------------------------------------------------------------- > > -- > 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 > -- 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 |
Hank,
I just found an xpath 2.0 solution: "for $repindex in (count(../preceding-sibling::did) + 1 ) return instance('did-locations')/country[ code=instance('r')/did[$repindex]/country ]/city" I'm not sure if this is a good solution, but it certainly works. It counts the preceding siblings of type did in our ancestor, adds that ancestor (+1) and (mis?)uses a for construct to put it in a var. I'm not sure if it is considered good style to use a for in this way, but I have my solution for now. Thanks for thinking it over, Mathias Am Mittwoch, den 26.04.2006, 08:49 -0700 schrieb Hank Ratzesberger: > Mathias, > > I am stumped also. I don't know which instance position() > will refer to, and while XForms works with multiple > instances, I don't know that XPath does. > > So perhaps it is better to build a new instance ? > You can use XSLT to build an instance and it might > be easier to construct this in an <xsl:for-each> > construct with variables. You can select the > instance that comes from the page-flow "model" > attribute, select="doc('input:data')/*" > > I am not sure how xslt can access xforms > instances, only build them, so your model would > need to have the instances aggregated. > > Best, > Hank > > ----- Original Message ----- > From: "Mathias Picker" <[hidden email]> > To: <[hidden email]> > Sent: Wednesday, April 26, 2006 6:49 AM > Subject: RE: [ops-users] master/slave select1 (e.g. country/city) > > > > I'm trying to apply Ryans solution inside a repeat. So, I need to get at > > the position of the repeat in the xpath expression of the second > > select1. But I'm just not fluent enough in xpath to guess at how to do > > this. > > > > If I have an instance > > > > <xforms:instance id="r"> > > <instance> > > <did> > > <country /> > > <city /> > > </did> > > <did> > > <country /> > > <city /> > > </did> > > </instance> > > </xforms:instance> > > > > > > and for the did-locations the following xml: > > > > > > <xforms:instance id="did-locations"> > > <dids> > > <country> > > <name>Germany</name> > > <code>de</code> > > > > <city><name>München</name><code>muc</code></city> > > <city><name>Köln</name><code>kln</code></city> > > </country> > > <country> > > <name>Switzerland</name> > > <code>ch</code> > > <city><name>Bern</name><code>brn</code> </city> > > <city><name>Zürich</name><code>zur</code> </city> > > </country> > > </dids> > > </xforms:instance> > > > > > > I would like to use something like: > > (inside a xforms:group ref=instance('r')) > > > > > > <xforms:repeat id="did-repeat" > > nodeset="did[position() > 1]"> > > > > <xforms:select1 ref="country" class="country-selector" > > appearance="minimal"> > > <xforms:itemset nodeset="instance('did-locations')/country"> > > <xforms:label ref="name"/> > > <xforms:value ref="code"/> > > </xforms:itemset> > > </xforms:select1> > > > > <!-- This works fine, showing the index of the repeat 'did-repeat' --> > > <xforms:output value="position()" /> > > > > <xforms:select1 ref="city" class="country-selector indent" > > appearance="minimal"> > > <xforms:itemset > > nodeset="instance('did-locations')/country[code= > > instance('r')/did[REPEAT POSITION??]/country]/city"> > > <xforms:label ref="name"/> > > <xforms:value ref="code"/> > > </xforms:itemset> > > </xforms:select1> > > > > </xforms:repeat> > > > > > > but how do I get the position of did-repeat in this expression: > > "instance('r')/did[REPEAT POSITION??]/country]/city" > > > > > > Thanks for any ideas, > > > > Mathias > > > > > > Am Dienstag, den 25.04.2006, 17:30 +0100 schrieb Ryan Puddephatt: > >> Mathias, > >> I'm doing a similar thing with databases on my application I have > >> the following xml > >> <servers> > >> <server> > >> <name>blah</name> > >> <database>blah</database> > >> ... > >> </server> > >> ... > >> </servers> > >> > >> I have two instances one holding the above and one with > >> > >> <instance> > >> <serverUrl/> > >> <databaseName/> > >> </instance> > >> > >> And two select1s as follows > >> > >> <xforms:select1 ref="instance('instance')/serverUrl"> > >> <xforms:itemset nodeset="instance('tamino')/server"> > >> <xforms:label ref="url"/> > >> <xforms:value ref="url"/> > >> </xforms:itemset> > >> <xforms:setvalue ev:event="xforms-value-changed" > >> ref="instance('instance')/databaseName" > >> value="instance('tamino')/server[url = > >> instance('instance')/serverUrl]/databases/database[1]"/> > >> </xforms:select1> > >> > >> <xforms:select1 ref="instance('instance')/databaseName"> > >> <xforms:itemset nodeset="instance('tamino')/server[url = > >> instance('instance')/serverUrl]/databases/database"> > >> <xforms:label ref="."/> > >> <xforms:value ref="."/> > >> </xforms:itemset> > >> </xforms:select1> > >> > >> Hope this helps > >> > >> Ryan Puddephatt > >> Software Engineer > >> TFX Group - IT UK > >> 1 Michaelson Square > >> Livingston > >> West Lothian > >> Scotand > >> EH54 7DP > >> > >> * [hidden email] > >> ( 01506 407 110 > >> 7 01506 407 108 > >> > >> > >> >-----Original Message----- > >> >From: Mathias Picker [mailto:[hidden email]] > >> >Sent: 25 April 2006 17:38 > >> >To: ops-users > >> >Subject: [ops-users] master/slave select1 (e.g. country/city) > >> > > >> >I searched for a solution, but found nothing. > >> > > >> >I need a country / city selection. I thought about one select1 to select > >> >the country, a second, filled depending on the first, to select the > >> >city. > >> > > >> >What would be a good way to implement this with xforms? > >> > > >> >I can format the source (city/country list) in any way nessecary. It's > >> >about 14 countries with maybe 10 cities each. > >> > > >> >Thanks, Mathias > >> > > >> > >> > >> > >> einfaches Textdokument-Anlage (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 > >> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > > > > > > -------------------------------------------------------------------------------- > > > > > > -- > > 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 > > > > > einfaches Textdokument-Anlage (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 > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- 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 |
Free forum by Nabble | Edit this page |