题
嵌套“如果”语句允许? 例如:
<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>
我知道我可以重写这个条件与“&&
”语句,但我试图做的是凌乱的,以保持在链中重复的,如果elseifs,它必须是逻辑。
解决方案
是,根据模式定义发现此处。一个if
是executable.content
元件,其允许包含零个或多个executable.content
元素的序列。
其他提示
添加到@约翰的答案(因为评论有字数限制):
这仍然是VXML 2.1以及真: HTTPS://www.w3。组织/ 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>
不隶属于 StackOverflow