Skip to Content

Adding Datasets for Form Assets

Newer implementations use global XSL and a global dataset file; if this applies to your implementation, the following tutorial does not apply. Contact our helpdesk for assistance.

Some form asset elements - those with multiple answer options such as radio buttons and checkboxes - can make use of datasets to auto-create the list of answer items. Enter the dataset in the "Advanced" tab of the element, and the form pulls the information in the dataset. Some datasets come predefined, but you can also make your own.

A conditional defined in the XSL creates the dataset based on the use of the Advanced field in the form element and the dataset named within. In the XSL, the name of the dataset to use gets passed to the XSL with $adv. The XSL does a choose test to return the correct dataset.

Another dataset can be added to the existing XSL as another "when" condition. The "when" condition is set off with double quotes, so the dataset name is included within single quotes.

StepsLink to this section

  1. Navigate to Content > Pages.
  2. Find the datasets.xsl file (typically located in _resources/xsl/_shared).
  3. Add your new dataset to the list. As an example, use the following dataset called "shakespeare":
    <xsl:when test="ou:get-adv($adv,'dataset') = 'shakespeare'">
    Titus Andronicus,Taming of the Shrew,Henry IV Part 1,Henry IV Part 2,Henry V,Much Ado About Nothing,Twelfth Night,Othello,Hamlet
    </xsl:when>
    
    The name of the dataset (shakespeare) and the values entered can be changed to whatever you want. Each item should be separated by a comma. Spaces can be used within an item, but character entities should not. For example, instead of an ampersand (&) the HTML entity should be used (&amp;) and instead of a quote mark ('), the &quot; entity should be used.
  4. Save the XSL file. It doesn't need to be published.
  5. Navigate to Content > Assets.
  6. Either edit an existing form asset or create a new one.
  7. Add one of the following form elements that supportsdatasets:
    • Radio Buttons
    • Checkboxes
    • Dropdown
    • Multi-select
  8. In the "Advanced" field, enter dataset=shakespeare;.
  9. Save and republish the asset.

 

⇐ Return to Tutorials