title: Testing text node in XSLT
body: <p>I have the following mix-content element:</p>
  
  <pre><code>&lt;firstElement type="random"&gt;text1&lt;secondElement&gt;random_value&lt;/secondElement&gt;text2&lt;/firstElement&gt;
  </code></pre>
  
  <p>I want to make a <code>for-each</code> loop on <code>&lt;firstElement&gt;</code> child nodes with a nested <code>if</code> condition, for example:</p>
  
  <pre><code>&lt;xsl:for-each select="child::*"&gt;
  &lt;xsl:if test="some test"&gt;
  &lt;xsl:copy&gt;
  &lt;/xsl:if&gt;
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>How can I write a <code>test</code> that selects only the text nodes of <code>&lt;firstElement&gt;</code>? </p>
  
  <p>I have tried with <code>text()</code>, but it only works for the child text node of the contextual node and <code>self::text()</code> doesn't seem to be a proper Xpath. I also tried to use XSLT 2.0 <code>instance of</code> to test against <code>xs:string</code> but it didn't work either.</p>