Getting Spry regions to work with dynamic xml feeds
Phil_W Aug 23, 2008 6:06 AMHi,
I am redesinging our 11 year old mountaineering website, and amongst other things such as converting it to use css, I am trying to use dynamic xml feeds rather than the current static (manually updated) data.
I am trying to get a spry to work with a dynamic xml source.
The code is as follows
var Weather = new Spry.Data.XMLDataSet("test.php", "rss/channel");
var WeatherDetail = new Spry.Data.XMLDataSet("test.php", "rss/channel/item");
test.php contains the following code
<?php
//XMLXSL Transformation class
require_once('includes/MM_XSLTransform/MM_XSLTransform.class.php');
?>
<?php
$mm_xsl = new MM_XSLTransform();
$mm_xsl->setXML(" http://feeds.bbc.co.uk/weather/feeds/rss/outlook/uk.xml");
$mm_xsl->setXSL("weather.xsl");
echo $mm_xsl->Transform();
?>
The weather.xsl transform is as follows
<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource=" http://feeds.bbc.co.uk/weather/feeds/rss/outlook/uk.xml" --><!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:copy-of select="rss"/>
</xsl:template>
</xsl:stylesheet>
The code in the body of webpage is
<hr size="1" />
<div spry:region="Weather">
<ol>
<li>
<h2>{title}</h2>
</li>
<li> <em>(Last Updated {pubDate})</em></li>
</ol>
</div>
<h1> </h1>
<div class="SpryHiddenRegion" spry:region="WeatherDetail">
<div spry:repeat="WeatherDetail">
<ol>
<li>
<h3>{title}</h3>
</li>
<li>{description}</li>
</ol>
</div>
</div>
It is in effect returning the BBC rss weather feed (unaltered) for the UK Outlook and displaying the results on my webpage, but it appears from the same server So gets round the cross site datasecurity model built into most browsers
Well it returns the dynamic feed in Mozilla and Safari. Buggered if I can get it to work in IE7. So what is the problem?
See
Webpage Link
So how do I get it work in Internet Explorer etc.
Cheers
Phil
I am redesinging our 11 year old mountaineering website, and amongst other things such as converting it to use css, I am trying to use dynamic xml feeds rather than the current static (manually updated) data.
I am trying to get a spry to work with a dynamic xml source.
The code is as follows
var Weather = new Spry.Data.XMLDataSet("test.php", "rss/channel");
var WeatherDetail = new Spry.Data.XMLDataSet("test.php", "rss/channel/item");
test.php contains the following code
<?php
//XMLXSL Transformation class
require_once('includes/MM_XSLTransform/MM_XSLTransform.class.php');
?>
<?php
$mm_xsl = new MM_XSLTransform();
$mm_xsl->setXML(" http://feeds.bbc.co.uk/weather/feeds/rss/outlook/uk.xml");
$mm_xsl->setXSL("weather.xsl");
echo $mm_xsl->Transform();
?>
The weather.xsl transform is as follows
<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource=" http://feeds.bbc.co.uk/weather/feeds/rss/outlook/uk.xml" --><!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:copy-of select="rss"/>
</xsl:template>
</xsl:stylesheet>
The code in the body of webpage is
<hr size="1" />
<div spry:region="Weather">
<ol>
<li>
<h2>{title}</h2>
</li>
<li> <em>(Last Updated {pubDate})</em></li>
</ol>
</div>
<h1> </h1>
<div class="SpryHiddenRegion" spry:region="WeatherDetail">
<div spry:repeat="WeatherDetail">
<ol>
<li>
<h3>{title}</h3>
</li>
<li>{description}</li>
</ol>
</div>
</div>
It is in effect returning the BBC rss weather feed (unaltered) for the UK Outlook and displaying the results on my webpage, but it appears from the same server So gets round the cross site datasecurity model built into most browsers
Well it returns the dynamic feed in Mozilla and Safari. Buggered if I can get it to work in IE7. So what is the problem?
See
Webpage Link
So how do I get it work in Internet Explorer etc.
Cheers
Phil

