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:
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 

XSV - The XML Schema Validator

XSV is the official reference implementation for the XML Schema language and Stylus Studio is the only XML IDE to provide seamless integration with XSV - the W3C XML Schema Validator. Download Stylus Studio and XSV today.

XML Development Blogs

Blogging is the hottest fad on the Internet and Stylus Studio has jumped on the bandwagon. Bookmark these XML Blogs to keep up with all the latest XML buzz in the internet blogosphere. Includes RSS and Atom Feeds!

An Introduction to XQuery Development

An Introduction to XQuery demonstrates how easy it is to use Stylus Studio's many tools for editing, testing and deploying XQuery applications. Learn how to write your first XQuery application in just minutes by watching this online tutorial.

Building DataDirect XML Converter Applications with Stylus Studio

DataDirect XML Converters are Java and .NET components that enable access to any data (flat files, EDI) from your application code. Learn how to deploy XML applications today.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member