title: 'HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. | When I copy-of result of set:distinct
body: <p>I trying transform (in eclipse) a document below:</p>
  
  <pre><code>&lt;doc&gt;
     &lt;city name="Paris"
           country="France" /&gt;
     &lt;city name="Madrid"
           country="Spain" /&gt;
     &lt;city name="Vienna"
           country="Austria" /&gt;
     &lt;city name="Barcelona"
           country="Spain" /&gt;
     &lt;city name="Salzburg"
           country="Austria" /&gt;
     &lt;city name="Bonn"
           country="Germany" /&gt;
     &lt;city name="Lyon"
           country="France" /&gt;
     &lt;city name="Hannover"
           country="Germany" /&gt;
     &lt;city name="Calais"
           country="France" /&gt;
     &lt;city name="Berlin"
           country="Germany" /&gt;
  &lt;/doc&gt;
  </code></pre>
  
  <p>with xslt:</p>
  
  <pre><code>&lt;xsl:template match="/"&gt;
     &lt;out&gt;
        &lt;all-countries&gt;
              &lt;xsl:copy-of select="//city" /&gt;
        &lt;/all-countries&gt;
        &lt;distinct-countries&gt;
              &lt;xsl:copy-of select="set:distinct(//@country/..)" /&gt;
        &lt;/distinct-countries&gt;
     &lt;/out&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>I'm use <strong>Xalan 2.7.1</strong> it's work fine, but when I'm use <strong>'JRE Instance Default'</strong> processor I get error:</p>
  
  <pre><code>16:07:20,642 ERROR [main] Main  - java.lang.RuntimeException: Run-time internal error in 'HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. '
  </code></pre>