 <p>3 XQuery functions, <code>substring-before</code>, <code>substring-after</code> and <code>tokenize</code> are used to get the required output. </p> <p><code>substring-before</code> is used to get the Name. </p> <p>Similarly, the <code>substring-after</code> is used to get the Job portion. </p> <p>Then the <code>tokenize</code> function, is used to split the Jobs.</p> <pre><code>let $data := &lt;E&gt; &lt;Employee&gt;AAA@A#B#C#D&lt;/Employee&gt; &lt;Employee&gt;BBB@A#B#C#D&lt;/Employee&gt; &lt;Employee&gt;CCC@A#B#C#D&lt;/Employee&gt; &lt;Employee&gt;DDD@A#B#C#D&lt;/Employee&gt; &lt;/E&gt; for $x in $data/Employee return &lt;Employee&gt; {&lt;Name&gt;{substring-before($x,"@")}&lt;/Name&gt;} {&lt;Jobs&gt;{ for $tag in tokenize(substring-after($x,"@"),'#') return &lt;Job&gt;{$tag}&lt;/Job&gt; }&lt;/Jobs&gt; }&lt;/Employee&gt; </code></pre> <p>HTH...</p>