Skip to content
Hub Nexus

No author yetClaim it

Version 1Updated 2 min read

Support

Here is a simple example of how to get a list of repeating data elements out to your screen. This is done using the repeat tag and the nodeset attribute. You use the nodeset to specify where you want to begin your listing in the model. In this case we are just using a model embedded into the page.

Output

Here is the output for this program under the FireFox browser:

Note that all of the names are displayed, not just the first name. Note how we are mixing both HTML tags and XForms tags together in the body.

Program

xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms">

Phone List

xmlns="" id="phonebook">

Peggy
123

Dan
456

John
789

Sue
234

Company Phone List
Name, Phone
nodeset="Person">
ref="Name"/>,
ref="Phone"/>

Discussion

The key line here is the repeat statement:

nodeset="Person">

The repeat element has an attribute named nodeset. This tells you where in your model to get the data. In this case we will be iterating over all Person records and outputting the Name and Phone for each Person.

You can also use an absolute path reference:

nodeset="/PhoneList/Person">

As an alternative you can also use an instance reference:

nodeset="instance('phonebook')/Person">

Note that each repeat starts a new line for each person record. This can be turned into a clean tabular layout using a simple style sheet. You can do this by having the second output be associated with a class called "column2" and then adding a column2 formatting rule to the style sheet.

Where this page came from

This page was imported from Wikibooks. From “XForms” on Wikibooks, by its contributors, under CC BY-SA 4.0. Changed here: set as a page; navigation and edit links left out; each image under its own licence, credited in its caption.

Nobody has written it yet — it is the source material at a new address, which is why search engines are asked to skip it and why no one earns from it. It is up for grabs: take it on, and it is yours to rewrite and to earn from.

Get each new page of

XForms

Following means one email when a page is added, nothing when a page changes.

Following means one email when a page is added, nothing when a page changes.

Comments

Spinner Logo

Next in XForms

CC BY-SA 4.0
nodeset="//my-node"> ref=".[element1='true']"> ref="element2"/> The syntax **.[a='b']** says that from the current node if the element **a** equals the value **b** then output the elements within the group. ### Conditional Formatting of Items This same strategy can be used to enclose output in diffe
CC BY-SA 4.0
XForms, Formatting Numbers
CC BY-SA 4.0
Your input instance is like the following: id="link-items" xmlns=""> 1 One 2 Two 3 Three ## Discussion With XForms it is not possible to create dynamic links inside a repeat using a combination of **output**, **value** and **concat**. This would also impact the ability to notify the user that is nav
CC BY-SA 4.0
XForms, Switch and Case
CC BY-SA 4.0
ref="/var/first" > Should I show the second question? /> select="yes"> Yes Please! 1 No Thank You 0 /> ref="/var/second"> Second value: ## Using Multiple Predicates in Binds Sometimes you have a sequence of many items and the display of one item depends on the values of other items. Predicates are a
CC BY-SA 4.0
Then we add a predicate to turn on or off that entire group. In this case if the code is "yes" the input field will be displayed. If it is not the field will be hidden. ref=".[code='yes']"> ref="field"> Conditional Display: ## Complete Example xmlns=" xmlns:xf=" Binds in Repeats type="text/css"> @na