title: XML: Check if anything exists between two nodes
body: <p>I need to find out if anything exists between two nodes. My XML looks like this:</p>
  
  <pre><code>&lt;event value1="1" value2="2" value3="3" info="some info here"&gt;
            Line 1.&lt;lb/&gt;
            Line 2.&lt;lb/&gt;&lt;lb/&gt;
            Line 3.&lt;lb/&gt;
            Line 4.&lt;lb/&gt;
  &lt;/event&gt;
  </code></pre>
  
  <p>My goal is to convert the <code>&lt;lb/&gt;</code> nodes to <code>&lt;br/&gt;</code> HTML tags using XSLT. There is one additional requirement to fulfill though. In case there is one <code>&lt;lb/&gt;</code> <strong>directly</strong> following another <code>&lt;lb/&gt;</code> I want to output only <strong>one</strong> <code>&lt;br/&gt;</code>.</p>
  
  <p>My XSLT looks like this:</p>
  
  <pre><code> &lt;xsl:template match="lb"&gt;
      &lt;xsl:if test="not(preceding-sibling::lb[1])"&gt;
         &lt;br/&gt;
      &lt;/xsl:if&gt;
   &lt;/xsl:template&gt;
  </code></pre>
  
  <p>The problem with the XSLT above is that it works correctly for line 1 only as the text between both nodes is ignored. </p>
  
  <p>Maybe someone here can help.</p>