2

Are nested 'if' statements permitted? ex:

<if cond="1 == 1">
  <if cond="2 == 2">
      One is in fact equal to one and Two is in fact equal to two
  <else/>
      One is in fact equal to one but Two is never not equal to two
  </if>
<else/>
  One is never not equal to one
</if>

I realize I could rewrite this condition with an '&&' statement but the logic that I am trying to do would be messy to keep repeating in the chain of if elseifs that it would have to be.

Jeremy Cron
  • 2,404
  • 3
  • 25
  • 30

2 Answers2

3

Yes, according to the schema definition found here. An if is an executable.content element, which is allowed to contain a sequence of zero or more executable.content elements.

John Feminella
  • 303,634
  • 46
  • 339
  • 357
0

Adding to the @John's answer (since comments have a word limit):

This remains true for VXML 2.1 as well: https://www.w3.org/TR/voicexml21/vxml.xsd

<xsd:element name="if">
<xsd:sequence>
<xsd:group ref="executable.content" minOccurs="0" maxOccurs="unbounded"/>
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="elseif"/>
<xsd:group ref="executable.content" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:sequence minOccurs="0" maxOccurs="1">
<xsd:element ref="else"/>
<xsd:group ref="executable.content" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:sequence>
<xsd:attributeGroup ref="If.attribs"/>
</xsd:complexType>
</xsd:element>
Anupam
  • 14,950
  • 19
  • 67
  • 94