- From: Oliver Rath <rath@mglug.de>
- Date: Thu, 03 Aug 2006 07:45:46 +0200
- To: Aaron Reed <aaronr@us.ibm.com>
- CC: www-forms@w3.org, "Kugelman, John" <jkugelman@progeny.net>
That is perfektly working with the xforms-plugin and exactly what I
asked for. :-)
Thank you!
Oliver
Aaron Reed schrieb:
>
> Hi Oliver,
>
> Here is another example that does what I think you want.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:ev="http://www.w3.org/2001/xml-events"
> xmlns:xf="http://www.w3.org/2002/xforms">
> <head>
> <title>Dependent Select1 testcase</title>
>
> <xf:model>
> <xf:instance id="data" xmlns="">
> <data>
> <country/>
> <city/>
> <hotel/>
> </data>
> </xf:instance>
>
> <!-- Country list -->
> <xf:instance id="countries">
> <countries xmlns="">
> <country>Denmark</country>
> <country>France</country>
> <country>Germany</country>
> <country>Holland</country>
> </countries>
> </xf:instance>
>
> <!-- Hotel list -->
> <xf:instance id="hotels">
> <hotels xmlns="">
> <country>
> <name>Denmark</name>
> <city>
> <name>Copenhagen</name>
> <hotel>Little Mermaid Inn</hotel>
> <hotel>Nyhavn Hotel</hotel>
> </city>
> <city>
> <name>Ã…lborg</name>
> <hotel>Skipper Hotel</hotel>
> <hotel>Smugkroen</hotel>
> </city>
> </country>
> <country>
> <name>France</name>
> <city>
> <name>Paris</name>
> <hotel>L'Hotel de la Tour Eiffel</hotel>
> <hotel>Le Ptit Coin</hotel>
> </city>
> </country>
> <country>
> <name>Germany</name>
> <city>
> <name>Düsseldorf</name>
> <hotel>Schnurbart Imbiss</hotel>
> <hotel>Bremer Hotel</hotel>
> </city>
> </country>
> <country>
> <name>Holland</name>
> <city>
> <name>Amsterdam</name>
> <hotel>The Red Tulip</hotel>
> <hotel>Dam Superior</hotel>
> </city>
> <city>
> <name>Den Haag</name>
> <hotel>DH Superior</hotel>
> <hotel>Canal Suites</hotel>
> </city>
> </country>
> </hotels>
> </xf:instance>
>
> <xf:bind nodeset="city"
> relevant="string-length(string(../country)) > 0"/>
> <xf:bind nodeset="hotel" relevant="string-length(string(../city))
> > 0"/>
> </xf:model>
> </head>
>
> <body>
> <h2>Select1 for city should only appear if country has been set.
> Select1
> for hotel should only appear if city has been set.
> </h2>
>
> <xf:group>
> <xf:select1 ref="country">
> <xf:label>Country: </xf:label>
> <xf:itemset nodeset="instance('hotels')/country">
> <xf:label ref="name"/>
> <xf:value ref="name"/>
> </xf:itemset>
> <xf:setvalue ref="../city" value="" ev:event="xforms-select"/>
> <xf:setvalue ref="../hotel" value="" ev:event="xforms-select"/>
> </xf:select1>
>
> <xf:select1 ref="city">
> <xf:label>City: </xf:label>
> <xf:itemset nodeset="instance('hotels')/country[name =
> instance('data')/country]/city">
> <xf:label ref="name"/>
> <xf:value ref="name"/>
> </xf:itemset>
> <xf:setvalue ref="../hotel" value="" ev:event="xforms-select"/>
> </xf:select1>
>
> <xf:select1 ref="hotel">
> <xf:label>Hotel: </xf:label>
> <xf:itemset nodeset="instance('hotels')/country[name =
> instance('data')/country]/city[name = instance('data')/city]/hotel">
> <xf:label ref="." />
> <xf:value ref="."/>
> </xf:itemset>
> </xf:select1>
> </xf:group>
>
> </body>
> </html>
>
> Let me know if you have any questions/problems with it.
Received on Thursday, 3 August 2006 05:45:58 UTC