Specifying That An Element Can Contain One of a Group of Elements in DTDs

You might want to define an element that contains one element out of a group of elements. For example, you might want an InventoryNumber element to contain a book, magazine, or newsletter element.

In the Tree tab, to define an element that contains one of a group of elements:
1. Define the elements that your new element can contain. See Defining Elements in DTDs.
2. Define the element that you want to contain another element. This is the container element.
3. Click the container element name.
4. In the left tool bar, click New Modifier . Stylus Studio displays a drop-down menu.
5. Double-click Choice.
6. For each element in the group of elements from which one element can appear:
a. Click New Reference to Element in the left tool bar.
b. Type the name of the element and press Enter.

After you add a reference to an element, you might want to check the definition of the referenced element. To do this, right-click the reference. In the shortcut menu, click Go To Definition. Stylus Studio moves the focus to the definition of the referenced element.

When the XSLT processor validates an instance document against this DTD, it ensures that each instance of the new element you just defined contains exactly one of the referenced elements.

The tree representation for an InventoryNumber element that can contain a book, magazine, or newsletter element would look like the following:

InventoryNumber
               

              
Choice
                   
book
                   
magazine
                   
newsletter
                   

                

Berkeley DB XML and Stylus Studio

Develop XML applications for Berkeley DBXML with Stylus Studio integrated tools support for SleepyCat Software's DBXML. Open, Query and Save XML to and from Berkeley DB XML directly from within the Stylus Studio XML IDE.

Building Workflow Applications with XML

Learn how to design custom XML workflow applications - from modeling your data and information processes, to capturing input from users in XML, and finally, generating useful queries and reports from the XML data -- using XSLT & XQuery technologies.

Investments and Financial Companies That Use Stylus Studio

Stylus Studio provides XML tools & components to leading investment and financial companies! See which top investment and financial companies are banking on Stylus Studio 2006 to simplify their dollars and cents.

Developer Resource Center: Learn XML and Stylus Studio

Learning XML is easy with Stylus Studio. Check out our free XML tutorials, XML whitepapers, online video demonstrations, XML examples and XML references and more.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member