Setting the 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:if> block. If you do not have content selected, the
<xsl:if> 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.
<xsl:if> element is similar to the
if 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:if> element allows you to test an expression for a single true or false value.
To insert a conditional region:
- In the Conditional Region dialog box, enter the condition.
In the following example, you want to test to see if the context nodes
@available attribute value is
- Click OK.
The following code is inserted in your XSLT page:
Content goes here
You need to surround string values such as true in quotes. Dreamweaver encodes the quotes for you (') so that they are entered as valid XHTML.
In addition to testing nodes for values, you can use any of the supported XSLT functions in any conditional statement. The condition is tested for the current node within your XML file. In the following example, you want to test for the last node in the resultset:
For more information and examples on writing conditional expressions, see the
<xsl:if> section in the Reference panel.