Recently I encountered an annoyance with the VXML standard. I was unable to use <if> within a <prompt>. The reason why I wanted to do this was to adjust the prompt based on a variable. The prompt was fairly long with just some variance based on the value of this variable. It was possible to do <if><prompt>...</prompt><else if/><prompt>...</prompt><else if/> etc etc. But this just made the document bigger and bigger and it just seemed to me that this abitrary limitation was ridiculous.
So imagine my surprise when I was able to circumvent this limitation while remaining within the standard. How was this possible? Simple, I used the <foreach> tag which is allowed to be a child of <prompt>. I created a dummy array of one element enabling me to do the following:

<prompt>
   this is the start of this prompt
   <foreach array="dummyArrayOfOneElement" item="foo">
      <if cond="cond1">
         middle prompt 1
      <elseif cond="cond2"/>
         middle prompt 2
      <else/>
         middle prompt default
      </if>
   </foreach>
   this is the end of this prompt
</prompt>

Can someone tell me why the limitation exists on <if> and why the limitation is pointless if it can be circumvented and still remain within the standard?

Originally from VXML, CCXML and a touch of SALT