title: XSLT substring - take all values before specific string
body: <p>I have elements:</p>
  
  <pre><code>&lt;A&gt;11511/direction=sink&lt;/A&gt;
  &lt;B&gt;110/direction=src&lt;/B&gt;
  </code></pre>
  
  <p>Of course there are some elements without <code>/direction</code> suffix that is importnat to mention.</p>
  
  <p>If elements A and B contain string <code>/direction</code>... I want to have the value before string <code>/direction</code>.
  If elements do not contain <code>/direction</code> then take regular value as usual.
  What should I add in <code>value-of</code> clause ?</p>
  
  <pre><code>&lt;newElementA&gt;&lt;xsl:value-of select="A"/&gt;&lt;/newElementA&gt;
  &lt;newElementB&gt;&lt;xsl:value-of select="B"/&gt;&lt;/newElementB&gt;
  </code></pre>
  
  <p>I tried with <code>&lt;xsl:value-of select="substring-before(A,'/')"/&gt;</code> but then values which do not have value <code>/direction</code> are set with value null which is not correct</p>
  
  <p>I also tried this but then getting error:</p>
  
  <pre><code>     &lt;newelementA&gt;&lt;xsl:value-of select="if (contains(A,'/')) 
  then substring-before(A,'/') else A"/&gt;&lt;/newelementA&gt;
  </code></pre>
  
  <p>I want to have values <code>11511</code>and<code>110</code> in result.</p>
  
  <p>Thanks</p>