title: How to insert an image using XSLT?
body: <p>Hello I am trying to generate MS-Word reports from a PHP application. In order to do so I am <a href="http://msdn.microsoft.com/en-us/library/ee840137%28v=office.12%29.aspx" rel="nofollow">converting XML data into Microsoft Office Open XML by using XSLT Transformations</a>.</p>
  
  <p>I have a simple XML file to pull the data:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Movies&gt;
      &lt;Genre name="Action"&gt;
          &lt;Movie&gt;
              &lt;Name&gt;Crash&lt;/Name&gt;
              &lt;Released&gt;2005&lt;/Released&gt;
          &lt;/Movie&gt;
      &lt;/Genre&gt;
      &lt;Genre name="Drama"&gt;
          &lt;Movie&gt;
              &lt;Name&gt;The Departed&lt;/Name&gt;
              &lt;Released&gt;2006&lt;/Released&gt;
          &lt;/Movie&gt;
          &lt;Movie&gt;
              &lt;Name&gt;The Pursuit of Happyness&lt;/Name&gt;
              &lt;Released&gt;2006&lt;/Released&gt;
          &lt;/Movie&gt;
      &lt;/Genre&gt;
      &lt;Genre name="Comedy"&gt;
          &lt;Movie&gt;
              &lt;Name&gt;The Bucket List&lt;/Name&gt;
              &lt;Released&gt;2007&lt;/Released&gt;
          &lt;/Movie&gt;
      &lt;/Genre&gt;
  &lt;/Movies&gt;
  </code></pre>
  
  <p>I also have a XSLT file that transforms the XML into MS Office XML:</p>
  
  <pre><code>&lt;xsl:for-each select="Movies/Genre"&gt;
      &lt;w:p w:rsidR="00EC137C" w:rsidRPr="00BF ...
          &lt;w:pPr&gt;
              &lt;w:pStyle w:val="Heading2"/&gt;
          &lt;/w:pPr&gt;
          &lt;w:r w:rsidRPr="00BF350E"&gt;
              &lt;w:t&gt;
                  &lt;xsl:value-of select="@name"/&gt;
              &lt;/w:t&gt;
          &lt;/&lt;xsl:value-of select w:r&gt;
      &lt;/w:p&gt;
      &lt;xsl:for-each select="Movie"&gt;
          &lt;w:p w:rsidR="00EC137C" w:rsidRPr="00EC1 ...
              &lt;w:pPr&gt;
                  &lt;w:pStyle w:val="ListParagraph"/&gt;
                  &lt;w:numPr&gt;
                      &lt;w:ilvl w:val="0"/&gt;
                      &lt;w:numId w:val="1"/&gt;
                  &lt;/w:numPr&gt;
              &lt;/w:pPr&gt;
              &lt;w:r w:rsidRPr="00BF350E"&gt;
                  &lt;w:rPr&gt;
                      &lt;w:b/&gt;
                  &lt;/w:rPr&gt;
                  &lt;w:t&gt;
                      &lt;xsl:value-of select="Name"/&gt;
                  &lt;/w:t&gt;
              &lt;/w:r&gt;
              &lt;w:r w:rsidR="00C46B60"&gt;
                  &lt;w:t xml:space="preserve"&gt; (&lt;xsl:value-of select="Released"/&gt;)
                  &lt;/w:t&gt;
              &lt;/w:r&gt;
          &lt;/w:p&gt;
      &lt;/xsl:for-each&gt;
  &lt;/xsl:for-each&gt;
  ...
  </code></pre>
  
  <p>And also the PHP script:</p>
  
  <pre><code>&lt;?php
  //Declare variables for file names.
  $xmlDataFile = "MyMovies.xml";
  $xsltFile = "MyMovies.xslt";
  $sourceTemplate = "MyMoviesTemplate.docx";
  $outputDocument = "MyMovies.docx";
  
  //Load the xml data and xslt and perform the transformation.
  $xmlDocument = new DOMDocument();
  $xmlDocument-&gt;load($xmlDataFile);
  
  $xsltDocument = new DOMDocument();
  $xsltDocument-&gt;load($xsltFile);
  
  $xsltProcessor = new XSLTProcessor();
  $xsltProcessor-&gt;importStylesheet($xsltDocument);
  
  //After the transformation, $newContentNew contains 
  //the XML data in the Open XML Wordprocessing format.
  $newContent =  $xsltProcessor-&gt;transformToXML($xmlDocument);
  
  //Copy the Word 2007 template document to the output file.
  if (copy($sourceTemplate, $outputDocument)) {
  
      //Open XML files are packaged following the Open Packaging 
      //Conventions and can be treated as zip files when 
      //accessing their content.
      $zipArchive = new ZipArchive();
      $zipArchive-&gt;open($outputDocument);
  
      //Replace the content with the new content created above.
      //In the Open XML Wordprocessing format content is stored
      //in the document.xml file located in the word directory.
      $zipArchive-&gt;addFromString("word/document.xml", $newContent);
      $zipArchive-&gt;close();
  
      echo "Processing Complete";
  }
  ?&gt;
  </code></pre>
  
  <p>Now I need to insert images in the reports. What should I have in the XML file and what should I have in the XSLT file? I am a beginner with XML and XSLT I just took the sample from msdn but now that I need to insert the images in the report I don't know how to do it? </p>
  
  <p>Regards</p>