title: Xalan redirect:write , use either of two element values to create name of new .xml file depending on null values
body: <p>So I have the following code:</p>
  
  <pre><code>&lt;redirect:write select="concat('..\\folder\\,string(filename),'.xml')"&gt;
  </code></pre>
  
  <p>Where "<strong>filename</strong>" is a tag in the xml source. My problem occurs when filename is null or blank. And this is the case for several of the xml filename tags. So what I am trying to implement is a checking method. This is what I have done:</p>
  
  <pre><code>&lt;xsl-if test = "filename != ''"&gt;
          &lt;xsl:variable name = "tempName"  select = "filename" /&gt;
          &lt;/xsl-if&gt;
          &lt;xsl-if test ="filename = ''"&gt;
          &lt;xsl:variable name = "tempName" select = "filenameB"/&gt;
          &lt;/xsl-if&gt;
  
  &lt;redirect:write select="concat('..\\folder\\,string($tempName),'.xml')"&gt;
  </code></pre>
  
  <p>I seem to be getting <strong>NPEs</strong> when I compile my Java code, saying the <strong>Variable not resolvable: tempName</strong></p>