Parse a xml-formatted text-variable in a xslt to use "value-of"
<p>I have an xml of the following structure:</p>

<p><code>MeasurementDataExport
    Comments
        ApiCall
            username
            lotId
            processToolId</code></p>

<p>This is a minimal example:</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;MeasurementDataExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://my.company.de/Measurement/MeasurementDataExport.xsd"&gt;
  &lt;Name&gt;MyTestName&lt;/Name&gt;
  &lt;Comments&gt;&amp;lt;ApiCall&amp;gt;&amp;lt;username&amp;gt;AName&amp;lt;/username&amp;gt;&amp;lt;lotId&amp;gt;12345&amp;lt;/lotId&amp;gt;&amp;lt;processToolId&amp;gt;67890&amp;lt;/processToolId&amp;gt;&amp;lt;/ApiCall&amp;gt;&lt;/Comments&gt;</code></pre>
</div>
</div>
</p>

<p>I am working on a xlst to get the value username. Here is how I get the value of comments:</p>

<pre><code>&lt;xsl:variable name="comments"&gt;
  &lt;xsl:copy-of select="mde:MeasurementDataExport/mde:Comments"/&gt;
&lt;/xsl:variable&gt;
</code></pre>

<p>This is how the output of that variable looks:</p>

<pre><code>&lt;ApiCall&gt;&lt;username&gt;Test&lt;/username&gt;&lt;lotId&gt;12345&lt;/lotId&gt;&lt;processToolId&gt;67890&lt;/processToolId&gt;&lt;/ApiCall&gt;
</code></pre>

<p>As you see the variable is in an xml-format and the &amp;lt and &amp;gt characters were already changed to > and &lt;. But while debugging he stores that value as type "text". So I can't dig deeper like</p>

<pre><code>&lt;xsl:value-of select="$comments/ApiCall/username" /&gt;
</code></pre>

<p>That is the main problem: My schema only works until the node comments, everything deeper needs to be parsed. So how can I parse the value of "Comments" to a node-structure, so that I can use deeper value-of-calls?</p>

<p>I tried to work with node-set, but had no success so far.</p>