Setting the Multiple Conditional Region dialog box options

Setting the Multiple Conditional Region dialog box options

The purpose of this dialog box is to write a simple conditional expression to insert into your XSLT page. If content is selected when you open this dialog box, the content will be wrapped in an <xsl:choose> block. If you do not have content selected, the <xsl:choose> block will be entered at the insertion point.

This dialog box provides a way to create a simple conditional expression. It is recommended that you use the dialog box to get started and then customize the expression in Code view.

The <xsl:choose> element is similar to the case statement in other languages. The element provides a way for you to test a condition and take a course of action based on the result. The <xsl:choose> element allows you to test for multiple conditions.

To insert a multiple conditional region:

  1. In the Multiple Conditional Region dialog box, enter the first condition.

    In the following example, you want to test to see if the context node’s price subelement is less than 5.

    This is a picture of the feature being described.

  2. Click OK.

    In the example, the following code is inserted in your XSLT page:

    <xsl:choose>
       <xsl:when test="price&lt;5">
          Content goes here
       </xsl:when>
       <xsl:otherwise>
          Content goes here
       </xsl:otherwise>
    </xsl:choose>
    
  3. To insert another condition, place the insertion point in Code view between <xsl:when> tag pairs or just before the <xsl:otherwise> tag, and then insert a conditional region (Insert > XSLT Objects > Conditional Region).

    After you specify the condition and click OK, Dreamweaver inserts another <xsl:when> tag in the <xsl:choose> block.

For more information and examples on writing conditional expressions, see the <xsl:choose> sections in the Reference panel.



Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly