Hub Nexus
업데이트됨

작가아직 작성자가 없습니다맡기

개선할 점이 보이나요? 변경을 제안하세요.

후원

매거진 XForms · 137개 중 47번째 페이지

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.

이 페이지가 속한 매거진XForms

언어English

이용 허락: CC BY-SA 4.0 · 출처 en.wikibooks.org

1

0

0

0

Spinner Logo

코멘트

Spinner Logo
버전: 2CC0 1.0 — public domain
The runaway star that left the Tarantula Nebula
버전: 2CC0 1.0 — public domain
The Blackwell School, where segregation had no law behind it
버전: 2CC0 1.0 — public domain
The Eagle Nebula, seen in the infrared
버전: 2CC0 1.0 — public domain
The house where the Equal Rights Amendment was written
버전: 2CC0 1.0 — public domain
The Aleutians, the forgotten front of the Second World War
버전: 2CC0 1.0 — public domain
The Cosmic Cliffs are not cliffs