title: Dealing with saxon:evaluate exception
body: <p>I have an XBL file where I can pass some arguments from my form, let's say : </p>
  
  <pre><code>&lt;my-xbl arg1='' arg2=''&gt;
  &lt;/my-xbl&gt;
  
  &lt;xf:input ref='@arg1'/&gt;
  &lt;xf:input ref='@arg2'/&gt;
  </code></pre>
  
  <p>Then I have something like this : </p>
  
  <pre><code>&lt;xf:model&gt;
      &lt;xf:action id="populate-data-binding"&gt;                         
          &lt;xf:action context="instance('sub')"
                     ev:event="xforms-submit-done"
                     ev:observer="my-submission"&gt;                     
              &lt;xf:action&gt;        
                  &lt;xf:var as="xs:string" name="control-value" value="saxon:evaluate(instance('arg1'))"/&gt;  
                  &lt;xf:var as="xs:string" name="control-name"  value="saxon:evaluate(instance('arg2'))"/&gt;
                  &lt;xf:setvalue ref="xxf:instance('fr-form-instance')//*[name() = $control-name]"
                               value="$control-value"/&gt;
             &lt;/xf:action&gt;
      &lt;/xf:action&gt;
  &lt;/xf:model&gt;
  </code></pre>
  
  <p>The problem is when <code>arg1</code> is empty string (it means that in my form when I press Control settings and skipp <code>arg1</code> field, just leaving it empty) then my form crashes. When I insert <code>''</code> or anything but empty string (asd, q, anything) as <code>arg1</code> everything is ok. So now I would like to do something like</p>
  
  <pre><code>&lt;xf:var as="xs:string" name=".." value="if(@arg1 ='null') then 'asd'
   else 'saxon:evaluate(instance('arg1'))'/&gt;
  </code></pre>
  
  <p>It doesn't work, obviously because quotes issue (condition must be between <code>''</code> and I cannot put any quotes inside) and probably something else. Could someone help me fix this ? Thanks in advance.</p>
  
  <p><strong>UPDATE :</strong> </p>
  
  <p>I guess I was a little bit unprecise. To make things clear, <code>arg1</code> is an ID of <code>xf:input</code> in my form. When form gets loaded I call a REST service (you've helped me with this once, <a href="https://stackoverflow.com/questions/27621087/event-xforms-model-construct-done-behaviour/27626839#27626839">Event xforms-model-construct-done behaviour</a>) and it sends me back some data. Now I would like to populate data to my xf:inputs and the code above does it very well. The problem is that in my XBL I have plenty of parameters, not just <code>arg1</code>, <code>arg2</code>, it looks more like</p>
  
  <pre><code>&lt;my-xbl arg1 = '' arg2 = '' ... arg19 = '' arg20 = ''/&gt;
  </code></pre>
  
  <p>Now, when in my form I go to control's basic settings I have to fill all the paraemters <code>arg1...20</code>. I would like to fill only those I need, which is usually 3 or 4 and leave the others blank. The problem is that I cannot do that, because that way my form crashes and it's because saxon:evalute throws an exception if its argument is null.</p>
  
  <p>(Also to mention everything, but I don't think it's relevant here but it may help you to understand my code above : in real, <code>arg2</code> is an ID of <code>xf:input</code> but <code>arg1</code> is something like a path to resource in webservice, f.e. I have <code>arg2 = "'firstname'"</code> which refers to my xf:input and <code>arg1 =" //CUSTOMER/FIRSTNAME"</code> (no quotes) and my REST service URL is <code>http://www.thomas-bayer.com/sqlrest/CUSTOMER/2/</code>. This way I can choose that under <strong>xf:input</strong> of id <code>'firstname'</code> I want to insert only firstname of the whole data I got from webservice. Then again, arg4 would be like <code>'lastname'</code> and arg3 would be <code>//CUSTOMER/LASTNAME</code> and so on. As I said, don't think it's relevant here)</p>
  
  <p>That's why I wanted to check empty value and I guess your code should have helped me - unfortunately it's not working. My form doesn't crash anymore, but also data is not populating into <code>xf:inputs</code>. Maybe because this misunderstanding ? Thanks.</p>