title: Dataweave: how to apply conditional filter on input XML?
body: <p>I would like to apply a filter on the input payload. The input is XML like:</p>
  
  <pre><code>&lt;result&gt;
      &lt;person&gt;
          &lt;id&gt;1&lt;/id&gt;
          &lt;zipcode&gt;1111AB &lt;/zipcode&gt;
          &lt;housenr&gt;1 &lt;/housenr&gt;
      &lt;/person&gt;
      &lt;person&gt;
          &lt;id&gt;1&lt;/id&gt;
          &lt;zipcode&gt;1111AC &lt;/zipcode&gt;
          &lt;housenr&gt;2&lt;/housenr&gt;
      &lt;/person&gt;
      &lt;person&gt;
          &lt;id&gt;1&lt;/id&gt;
          &lt;zipcode&gt;1111AD &lt;/zipcode&gt;
          &lt;housenr&gt;3&lt;/housenr&gt;
      &lt;/person&gt;
      &lt;person&gt;
          &lt;id&gt;1&lt;/id&gt;
          &lt;zipcode&gt;1111AB &lt;/zipcode&gt;
          &lt;housenr&gt;4&lt;/housenr&gt;
      &lt;/person&gt;
  &lt;/result&gt;
  </code></pre>
  
  <p>The end user is able to search on zipcode and optionally a housenr. The output json is like:</p>
  
  <pre><code>{
      persons: [{
          id: "1"
          address: "1111AB 1"
      },
      { 
          id: "2",
          address: "1111AC 1"
      }
      ]
  }
  </code></pre>
  
  <p>So I had the idea to filter a map like so:</p>
  
  <pre><code>{
  persons: payload.result.*person filter ($.zipcode == flowVars.zipcode) map{
  id: $.id,
  address: $.zipcode ++ $.housenr
  }
  </code></pre>
  
  <p>I would like to know if it would be possible make that filter conditional. For example if flowVars Zipcode and Housnr are null then the filter should not be applied. Or if Zipcode is filled but housnr not, then only zipcode filter should be applied.</p>
  
  <p>Help welcome!</p>
  
  <p>thanks</p>