KB Version:

Learning Levels

Announcements RSS Feed of Announcements

Structured Data Definitions

You will now create a structured data definition. A data definition is a way to capture forms-based input into the system and have it outputted as transformable XML. You are going to create a simple data definition with fields for company contact information and write the corresponding XSL to transform it into HTML. There are five steps in creating and implementing a data definition:

  1. Write a data definition by hand in XML.
  2. Assign the data definition to the page via the page's content type.
  3. Edit the page, and fill in the form capture fields from the data definition.
  4. View the XML outputted from the data definition, and write a corresponding XSLT format to transform it to the desired output.
  5. Apply the format to the page’s DEFAULT region to transform the content (do not supply a block for the DEFAULT region because the data definition XML is automatically placed there).

structured data definititons


A. Create a Data Definition

To create a data definition:

  1. Go to the Administration area, and select Data Definitions in the left navigation bar.
  2. Click the New Data Definition button.
  3. For the Name field, type in contact.
  4. For the XML field, type in the following XML:

  5. Each text element represents an input field. The identifier attribute is the name of the resulting XML element produced with the captured data. The label attribute is the value that appears on the screen for the form field. The required attribute requires the user to fill in that field before submitting content.
  6. Now click Submit to save the new data definition.

When you have the chance, please browse through the existing data definitions provided with the software to see some of the advanced functionality available.

B. Attach a Data Definition

With the new contact data definition ready, you can create a new content type and attach it, replacing the word processor.

To copy an existing content type and attach a data definition:

  1. While still in the Administration area, select Content Types in the left navigation bar.
  2. Select our Web Standard content type which we created earlier.
  3. Click the Copy tab.
  4. In the System Name field, type Contact.
  5. Click Submit to copy the content type.
  6. Go to the Edit tab and click the browse icon located to the right of Data Definition.
  7. Select the contact data definition and click Submit.

    attach data definition

  8. Go back to the Home area.
  9. Select New -> Default -> Page to create a new page.
  10. Click the System pane in order to type in "contact-us" for the System Name field.
  11. For Content Type, click the browse icon to choose the new type Contact and click Submit.
  12. The page will reload and the main default region will be empty. Click the Edit tab.
  13. Instead of the word processor, you now have the data definition form (labeled Contact). Type My first paragraph in the Paragraph field.
  14. For the Company field, type My company.
  15. For the Phone field, type 123-123-1234.
  16. For the Fax field, type 123-123-1235.
  17. For the Email field, type me@mycompany.com.

    data definition form

  18. Click the Submit button to save the changes. The page will reload and the information that you entered in the data definition form will appear in the main default region.
  19. To add a new paragraph, click on the Edit tab to return to the data definition form. Click the single plus "+" sign above the Paragraph field to add a new paragraph.
  20. For the lower empty Paragraph field, type My second paragraph.
  21. Click the Submit button to save the changes.

The page will reload and all of the values just entered will run together. You need to attach presentation logic to the XML representing the data collected in the data definition. First, you should look at the resulting XML document created from the output of the data definition. View the HTML source of the resulting page (by right-clicking on the page, selecting This Frame and then View Frame Source), and look for the tag:

The XML snippet ends with:

The elements, in between the open and close system-data-structure tags, correspond to the identifier put in the data definition and the value that is filled in the form when editing the page. You can copy this XML snippet into your favorite XML/XSL IDE and write a corresponding XSLT to make it into HTML with the desired formatting and CSS classes.


C. Create a Format

Now we will write a simple XSLT to transform this XML into HTML.

To create an XSLT Format:

  1. Browse to your existing formats folder, or create a new folder. We don’t have a folder, so we will create formats.
  2. Once in the desired folder, click on New -> Default -> Format in the top navigation menu to create the new XSLT format.
  3. For the XML field, put in the following:

    The XSLT matches the root XML element,
    and then loops over all of the paragraph elements, outputting their values. The company element is then output in bold, followed by the phone and fax elements. Finally, the email element is turned into a mailto link and output. If you like, copy this XSLT into your favorite XML editor and make sure it is well formed and proper. You can even run the transformation against the XML from the view source above in a typical XML/XSL IDE.
  4. Click on the System pane, and type contact-us for the Name field. It is generally a good practice to use the same name for the format and the data definition to which it is transforming the resultant XML content.
  5. Click Submit to save the new format.

We now have our XSLT ready to be applied to the XML that is produced from the data definition content.

D. Apply a Format to a Configuration Set & Content Type

To apply a stylesheet to a page data definition:

  1. Browse to the desired page that uses the contact data definition. We will use the page that was just created: contact-us.
  2. Click the Configurations pane to display the currently assigned Configuration Set.
  3. Select the Web Standard configuration set.
  4. Using the Copy tab, create a new configuration set named Contact.
  5. Click the Edit tab, and select the Configurations pane to display the available configurations.
  6. The default configuration, HTML, will be shown. Click the browse icon located next to Format in the DEFAULT region row.
  7. Select the format you just created, and click Confirm in the browse icon window. We will select formats/contact-us.

    apply stylesheet

  8. Click the Submit button to record the change.
  9. Select Content Types in the left navigation bar and click on the Contact content type.
  10. Click the Edit tab, and browse for the Contact configuration set.
  11. Click the Submit button to record the change.

Locate the new data definition page by clicking on the Subscribers tab and selecting the contact-us page. You will now see the same page as before, except the XML data from the data definition has been transformed into standard HTML and output in the default region. You will see the formatting, which includes spacing, bold, and the hyperlinked email address. Try changing the format just created to see different outputs on the page. A good tip when you are working on a format in the system and you want to see the changes on the page is to move your mouse over to the icon denoting the page region, and click on the icon. Then click the Edit tab under the format listing, or click on the pencil icon located to the left of the format listing, which is labeled formats/contact-us. After saving the changes in the format, in the top navigation menu, click on History and then click on the corresponding page to quickly jump back to it. 

resulting contact page
 

Thanks for going through Part 2 of the Technical Introduction. Part 3 is available online: Learn how to set up PDF, Printer Friendly, and XML configurations, create and associate workflows, and display recent press releases.

Videos