title: XSLT How to check if XML Node exists?
body: <p>I have XML file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="test.xsl"?&gt;
  &lt;Data&gt;
    &lt;Records&gt;
      &lt;Record&gt;
       &lt;AddInfo&gt;
        &lt;Info&gt;
        &lt;/Info&gt;
       &lt;/AddInfo&gt;
      &lt;/Record&gt;
    &lt;/Records&gt;
  &lt;/Data&gt;
  </code></pre>
  
  <p>and XSL file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:template match="Dane"&gt;
      &lt;html&gt;
        &lt;link rel="stylesheet" type="text/css" href="report.css"&gt;&lt;/link&gt;
        &lt;body&gt;
          &lt;h2&gt;Table1&lt;/h2&gt;
          &lt;table border="1" cellspacing="0"&gt;
            &lt;tr&gt;
              &lt;th&gt;XXX&lt;/th&gt;
            &lt;/tr&gt;
            &lt;xsl:for-each select="Records/Record"&gt;
              &lt;tr&gt;
                &lt;td&gt;
                  &lt;xsl:value-of select="XXX"/&gt;
                &lt;/td&gt;
              &lt;/tr&gt;
            &lt;/xsl:for-each&gt;
          &lt;/table&gt;
          &lt;h2&gt;SecondTable&lt;/h2&gt;
          &lt;table border="1" cellspacing="0"&gt;
            &lt;tr&gt;
              &lt;th&gt;YYY&lt;/th&gt;
              &lt;th&gt;ZZZ&lt;/th&gt;
            &lt;/tr&gt;
            &lt;xsl:for-each select="Records/Record/AddInfo/Info"&gt;
              &lt;tr&gt;
                &lt;td&gt;
                  &lt;xsl:value-of select="YYY"/&gt;
                &lt;/td&gt;
                &lt;td&gt;
                  &lt;xsl:value-of select="ZZZ"/&gt;
                &lt;/td&gt;
              &lt;/tr&gt;
            &lt;/xsl:for-each&gt;
          &lt;/table&gt;
        &lt;/body&gt;
      &lt;/html&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>And I want to make it like this: if node  exists, display table with "Info" nodes, and if not, display SOME TEXT.</p>
  
  <p>I've been trying </p>
  
  <pre><code>&lt;xsl:if test="following-sibling::AddInfo"&gt;
  &lt;/xsl:if&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;xsl:if test="AddInfo"&gt;
  &lt;/xsl:if&gt;
  </code></pre>
  
  <p>But it is not working. </p>
  
  <p>I want it like this:</p>
  
  <pre><code>Table1
  ---------------------
  |     |      |      |
  </code></pre>
  
  <p>(condition: if inside XML will be  node, I want to display second table, under Table1)</p>
  
  <pre><code>SecondTable
  -------------
  |     |     |
  </code></pre>
  
  <p>How I can do this?</p>