title: Detecting if a node exists?
body: <p>I have a set of data called <code>&lt;testData&gt;</code> with many nodes inside.</p>
  
  <p>How do I detect if the node exists or not? </p>
  
  <p>I've tried</p>
  
  <pre><code>&lt;xsl:if test="/testData"&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;xsl:if test="../testData"&gt;
  </code></pre>
  
  <p>Neither one works. I'm sure this is possible but I'm not sure how. :P</p>
  
  <p>For context the XML file is laid out like this</p>
  
  <pre><code>&lt;overall&gt;
   &lt;body/&gt;
   &lt;state/&gt;
   &lt;data/&gt;(the one I want access to
   &lt;/overall&gt;
  </code></pre>
  
  <p>I'm currently in the <code>&lt;body&gt;</code> tag, though I'd like to access it globally. Shouldn't <code>/overall/data</code> work?</p>
  
  <p><em>Edit 2:</em>
  Right now I have an index into data that I need to use at anytime when apply templates to the tags inside of body. How do I tell, while in body, that data exists? Sometimes it does, sometimes it doesn't. Can't really control that. :)</p>