HTML output from XLS file and XML feed

jesperhp
jesperhp used Ask the Experts™
on
I have a XML feed from a mediaservice, which I would like to show nicely on our web-page. I also have a standard XLS file from the mediaservice, but I'm not that into XLS etc to know exactly how to load the feed along with the stylesheet, and get it shown nicely.

I have full access to change everything in the XLS or greate HTML files, but I dont have access to change the XML feed.

The XML feed is retreived from this location:  http://meltwaternews.com/magenta/xml/html/20/49/rss/152509_hitsentence.rss2.XML

The style is shown below:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="iso-8859-1"/>

<xsl:template match="/feeds">
<html>
 <head>
   <style>
     body     { color: #000000; background-color: #ffffff; }
     H2 {font-size: 13pt; font-family: Arial;}
     a:link   {color: #006c43}
     a:visited{color: #006c43;}
     a:hover  {color: gray;}
     .date  {font-size: 9pt; font-family: Arial;}
     .source  {font-size: 9pt; font-family: Arial;}
     .title  {font-size: 10pt; font-family: Arial; color: #006c43; text-decoration: underline;}
     .ingress {font-size: 10pt; font-style: italic; font-family: Times;}
     .match {font-size: 10pt; font-style: italic; font-family: Verdana, arial, sans-serif;}
     .title a:link {font-size: 10pt; font-family: Arial; color: #006c43; text-decoration: underline;}
     .title a:visited{color: #006c43;}
     .title a:hover  {color: gray;}
   </style>
 </head>
 <body>
   <xsl:apply-templates/>
 </body>
</html>
</xsl:template>

<xsl:template match="feed">
 <h2><xsl:value-of select="name"/></h2>
 <table border="0">
   <xsl:for-each select="documents/document">
     <xsl:if test="(alike&lt;2 or docId=alike)">
       <tr>
         <td nowrap="" valign="top">
           <span class="date"><xsl:value-of select="createDate2"/>,</span> <span class="source"><xsl:value-of select="sourcename"/></span>
           <br/>
           <div class="title">
             <a>
               <xsl:attribute name="href"><xsl:value-of select="url"/></xsl:attribute>
               <xsl:attribute name="target">_blank</xsl:attribute>
               <xsl:value-of select="title2"/>
             </a>
           </div>
         </td>
       </tr>
       <tr>
         <td>
           <span class="ingress"><xsl:value-of select="ingress"/></span>
         </td>
       </tr>
       <tr><td></td></tr>
       <tr><td></td></tr>
     </xsl:if>
   </xsl:for-each>
 </table>
</xsl:template>

</xsl:stylesheet>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
All you need to do is add this in the top part of your XML:

<?xml-stylesheet type-"text/xs1" href-" URL TO XSL GOES HERE  "?>

Author

Commented:
Thanks - but the problem is, that I can not edit the XML, only the XSL. The XML document is a standard feed from a media service.

I hope it makes sense :-)
In that case I don't think it's possible to apply a stylesheet to the xml feed.

XML isn't used to display content anyway, it's used to create a feed.
What I would suggest is creating a simple php page that reads your feed and outputs html/CSS.
After all, that's how you're supposed to work. :)

You can use simpleXML to do this, preety straightforward:
just read in the xml file, and display the info ( childnodes ) you want.

http://www.w3schools.com/PHP/php_xml_simplexml.asp

Commented:
Thanks for the suggestions. I ended up using RSS-to-JavaScript.com to solve the problem.

Author

Commented:
solved

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial