title: Display XML DATA as HTML with PHP
body: <p>I hope someone can help me I am stuck at this for a while..</p>
  
  <p>i am an affiliate and i get xml data from the provided. I am trying to convert this data and display as html on my site.</p>
  
  <p>I have tested my xsl and can confirm that the xsl is displaying the data as i wanted.</p>
  
  <p>My issue is that the php code to extract the data from urla and trasform the data using xsl to display html is not working.</p>
  
  <pre><code>&lt;?php
  
  
      $context = stream_context_create(array('http' =&gt; array('header' =&gt; 'Accept: application/xml')));
  
      $url = 'http://merchandising.expediaaffiliate.com/campaign/?campaignId=85413&amp;cid=409870 ';
  
      $xml = file_get_contents($url, false, $context);
  
      $xml = simplexml_load_string($xml);
  
      $doc = new DOMDocument();
  
      $doc-&gt;load('http://sitename/hotels.xslt');
  
      $xsl = new XSLTProcessor();
  
      $xsl-&gt;importStyleSheet($doc);
  
      $doc-&gt;load($xml);
  
      echo $xsl-&gt;transformToXML($doc);
  
  
      ?&gt;
  </code></pre>
  
  <p>My XSl is below:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  
  &lt;html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE"&gt;
  
       &lt;xsl:for-each select="HotelAvailabilityListResults"&gt;
      &lt;xsl:for-each select="Hotel"&gt;
  
  
        &lt;div style="background-color:teal;color:white;padding:4px"&gt;
          &lt;span style="font-weight:bold"&gt;&lt;xsl:value-of 
      select="name" 
      disable-output-escaping="yes"/&gt;&lt;/span&gt;
          - &lt;xsl:value-of select="city"/&gt;
        &lt;/div&gt;
        &lt;div style="margin-left:20px;margin-bottom:1em;font-size:10pt"&gt;
          &lt;p&gt;&lt;xsl:value-of select="shortDescription" 
      disable-output-escaping="yes"/&gt;.
          &lt;span style="font-style:italic"&gt;
            &lt;xsl:value-of select="address1" 
      disable-output-escaping="yes"/&gt;
          &lt;/span&gt;.&lt;/p&gt;
   &lt;p&gt;
          &lt;span style="font-style:italic"&gt;
         &lt;xsl:element name="img"&gt;
      &lt;xsl:attribute name="src"&gt;
  
      &lt;xsl:value-of select="thumbNailUrl"/&gt;
      &lt;/xsl:attribute&gt;
      &lt;/xsl:element&gt;
          &lt;/span&gt;.&lt;/p&gt;
        &lt;/div&gt;
  &lt;span style="font-style:italic"&gt;
            &lt;xsl:value-of select="HotelProperty/promoDescription"  /&gt;
          &lt;/span&gt;
  &lt;span style="font-style:italic"&gt;
            &lt;xsl:value-of select="ValueAdds/ValueAdd"  /&gt;
          &lt;/span&gt;
  &lt;div&gt;
   &lt;span style="font-style:italic"&gt;
         &lt;xsl:element name="a"&gt;
      &lt;xsl:attribute name="href"&gt;
  
      &lt;xsl:value-of select="hotelUrl"/&gt;
      &lt;/xsl:attribute&gt;
      &lt;/xsl:element&gt;
          &lt;/span&gt;
  &lt;/div&gt;
      &lt;/xsl:for-each&gt;
      &lt;/xsl:for-each&gt;
  
  
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>