title: Two phase XSLT transformation converting string to XML first
body: <p>I have the following XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;string&gt;
  &amp;lt;Table&amp;gt;
  &amp;lt;Rows&amp;gt;
  &amp;lt;Row Id="0"&amp;gt;
  &amp;lt;Column Name="INS_NAME" XPath="Ins.Name"&amp;gt;Jane&amp;lt;/Column&amp;gt;
  &amp;lt;Column Name="INS_LASTNAME" XPath="Ins.LastName"&amp;gt;Smith&amp;lt;/Column&amp;gt;
  &amp;lt;/Row&amp;gt;
  &amp;lt;Row Id="1"&amp;gt;
  &amp;lt;Column Name="INS_NAME" XPath="Ins.Name"&amp;gt;Joe&amp;lt;/Column&amp;gt;
  &amp;lt;Column Name="INS_LASTNAME" XPath="Ins.LastName"&amp;gt;Miller&amp;lt;/Column&amp;gt;
  &amp;lt;/Row&amp;gt;
  &amp;lt;Row Id="2"&amp;gt;
  &amp;lt;Column Name="INS_NAME" XPath="Ins.Name"&amp;gt;George&amp;lt;/Column&amp;gt;
  &amp;lt;Column Name="INS_LASTNAME" XPath="Ins.LastName"&amp;gt;Ramsey&amp;lt;/Column&amp;gt;
  &amp;lt;/Row&amp;gt;
  &amp;lt;/Rows&amp;gt;
  &amp;lt;/Table&amp;gt;
  &lt;/string&gt;
  </code></pre>
  
  <p>and I would like to transform it to this XML using a <strong>single</strong> XSLT:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Customers&gt;
    &lt;Customer&gt;&lt;Name&gt;Jane&lt;/Name&gt;&lt;LastName&gt;Smith&lt;/LastName&gt;&lt;/Customer&gt;
    &lt;Customer&gt;&lt;Name&gt;Joe&lt;/Name&gt;&lt;LastName&gt;Miller&lt;/LastName&gt;&lt;/Customer&gt;
    &lt;Customer&gt;&lt;Name&gt;George&lt;/Name&gt;&lt;LastName&gt;Ramsey&lt;/LastName&gt;&lt;/Customer&gt;
  &lt;/Customers&gt;
  </code></pre>
  
  <p>I can do it with two different XSLT's:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:template match="/"&gt;
      &lt;xsl:value-of select="/" disable-output-escaping="yes" /&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>and then:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:template match="/"&gt;
      &lt;Customers&gt;
        &lt;xsl:for-each select="Table/Rows/Row"&gt;
        &lt;Customer&gt;
          &lt;Name&gt;&lt;xsl:value-of select="Column[@Name='INS_NAME']" /&gt;&lt;/Name&gt;
          &lt;LastName&gt;&lt;xsl:value-of select="Column[@Name='INS_LASTNAME']" /&gt;&lt;/LastName&gt;
        &lt;/Customer&gt;
        &lt;/xsl:for-each&gt;
      &lt;/Customers&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I have been reading about multi phase transformations but I can't seem to get it. I have tried saving the first XSLT in a variable but it seems <code>disable-output-escaping="yes"</code> does not work when saving to a variable.</p>
  
  <p>Can anybody help?</p>
  
  <p>Thank you.</p>
  
  <p><strong>New information (Edit)</strong></p>
  
  <p>I am now translating the string this way:</p>
  
  <pre><code>&lt;xsl:output method="text"/&gt;
    &lt;xsl:template match="/"&gt;
      &lt;xsl:variable name="stringXml"&gt;
        &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
        &lt;xsl:value-of select="translate(translate(/,'&amp;gt;','&amp;gt;'),'&amp;lt;','&amp;lt;')" /&gt;
      &lt;/xsl:variable&gt;
  ...
  </code></pre>
  
  <p>How can I do a transformation on the resulting XML stored in stringXML?</p>
  
  <p><strong>Final Solution (Edit)</strong></p>
  
  <pre><code>&lt;msxml:script implements-prefix="myLib" language="C#"&gt;
  &lt;msxml:assembly name="System.Web"/&gt;
  &lt;msxml:using namespace="System.Web"/&gt;
  &lt;![CDATA[
  public System.Xml.XPath.XPathNodeIterator convertText(string text)
  {
  XmlDocument doc = new XmlDocument();
        doc.PreserveWhitespace = true;
        doc.LoadXml(text);
        return doc.CreateNavigator().Select("/");
  }
  ]]&gt;
  &lt;/msxml:script&gt;
  </code></pre>