title: Make XSLT and XML Output to a XML File
body: <p>I have a few problems with XSLT.</p>
  
  <p>I have this XML File:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="XSLTest.xsl"?&gt;
  &lt;pages&gt;
    &lt;page&gt;
        &lt;title&gt;New Title&lt;/title&gt;
        &lt;id&gt;4782&lt;/id&gt;
        &lt;timestamp&gt;2012-09-13 13:15:33&lt;/timestamp&gt;
        &lt;contributor&gt;
          &lt;username&gt;kf&lt;/username&gt;
          &lt;id&gt;2&lt;/id&gt;
        &lt;/contributor&gt;
        &lt;text xml:space="preserve"&gt; 
        some text
      &lt;/text&gt;
   &lt;/page&gt;
   &lt;/pages&gt;
  </code></pre>
  
  <p>and this XSL File: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:template match="/"&gt;
  &lt;xsl:for-each select="pages/page"&gt;
      &lt;content&gt;
         &lt;id&gt;&lt;xsl:value-of select="id"/&gt;&lt;/id&gt;
         &lt;title&gt;&lt;xsl:value-of select="title"/&gt;&lt;/title&gt;
         &lt;created&gt;&lt;xsl:value-of select="timestamp"/&gt;&lt;/created&gt;
         &lt;created_by&gt;&lt;xsl:value-of select="contributor/username"/&gt;&lt;/created_by&gt;
     &lt;/content&gt;
     &lt;/xsl:for-each&gt;
     &lt;/xsl:template&gt;
  </code></pre>
  
  <p></p>
  
  <p>So now to my problems:</p>
  
  <ol>
  <li><p>The XML File Transformation does only partially work. I get all the values I want except for the title.</p></li>
  <li><p>I would like to save the transformed code to a new XML File.</p></li>
  </ol>
  
  <p>The iteration is necessary because the original file that I want to change is much bigger with much more <code>&lt;pages&gt;</code>.</p>