html页面上的不同XML数据

时间:2012-02-06 08:20:12

标签: html xml xslt feed spry

我的内联网中有不同的XML文件,每5分钟刷新一次&每次刷新间隔都会更改数据..我想创建一个HTML页面,我可以在其中显示所有XML提要。 什么是最好的创造方式?在单个页面上加载不同的XML Feed 我在Dreamweaver中使用Spry ..这段代码在IE中工作但在firefox中没有

    <html xmlns:spry="http://ns.adobe.com/spry"><body background="SpryAssets/mantra.jpg">
<p>
  <script  src="SpryAssets/xpath.js" type="text/javascript">
</script>
  <script  src="SpryAssets/SpryData.js" type="text/javascript">
</script>
  </div>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="852" align="center" border="0">
<tr>
      <th width="740" scope="col"><strong class="Fn">Now playing </strong></th>
      <th width="102" scope="col"><a href="index.html" title="Reload" target="_parent" class="rm1"><span class="Fn">Reload</span></a></th>
  </tr>
</table>
</p>
<table width="850" border="0">

</table>
<script  type="text/javascript">
var Agra = new Spry.Data.XMLDataSet("http://59.90.73.143/Agraexport.xml", "nexgen_audio_export/audio");
var Bareilly = new Spry.Data.XMLDataSet("http://59.90.73.143/bareillyexport.xml", "nexgen_audio_export/audio");
var Gorakhpur = new Spry.Data.XMLDataSet("http://59.90.73.143/Gorakhpurexport.xml", "nexgen_audio_export/audio");
var Hisar = new Spry.Data.XMLDataSet("http://59.90.73.143/Hisarexport.xml", "nexgen_audio_export/audio");
var Jalandhar = new Spry.Data.XMLDataSet("http://59.90.73.143/Jalandharexport.xml", "nexgen_audio_export/audio");
var Karnal = new Spry.Data.XMLDataSet("http://59.90.73.143/Karnalexport.xml", "nexgen_audio_export/audio");
var Ranchi = new Spry.Data.XMLDataSet("http://59.90.73.143/Ranchiexport.xml", "nexgen_audio_export/audio");
var Varanasi = new Spry.Data.XMLDataSet("http://59.90.73.143/VARANASIEXPORT.xml", "nexgen_audio_export/audio");
</script>
<div spry:region="Agra">
  <table width="852" align="center" bgcolor="#252525" border="1" cellpadding="1" cellspacing="2">
    <tr>
      <th width="99" class="Fn" spry:sort="type">City</th>
      <th width="427" class="rm1" spry:sort="title"><span class="Fn">Title</span></th>
      <th class="Fn" spry:sort="artist">Artist</th>
    </tr>
    <tr spry:repeat="Agra">
      <td><div align="center" class="rm1">
        <div align="left">Agra</div>
      </div></td>
      <td class="rm1">{title}</td>
      <td class="rm1">{artist}      </td>
    </tr>
  </table>
</div>
<div spry:region="Bareilly">
  <table width="852" align="center" bgcolor="#252525" border="1" cellpadding="1" cellspacing="2">
      <tr spry:repeat="Bareilly">
        <td width="99"><div align="center" class="rm1">
          <div align="left">Bareilly 
          </div>
        </div></td>
        <td width="429" class="rm1">{title}</td>
        <td class="rm1">{artist}</td>
      </tr>
  </table>
</div>
</div>
<div spry:region="Gorakhpur">
  <table width="852" align="center" bgcolor="#252525" border="1" cellpadding="1" cellspacing="2">
      <tr spry:repeat="Gorakhpur">
      <td width="99"><div align="center" class="rm1">
        <div align="left">Gorakhpur</div>
      </div></td>
        <td width="429" class="rm1">{title}</td>
        <td class="rm1">{artist}</td>
    </tr>
  </table>
</div>
<div spry:region="Hisar">
  <table width="852" align="center" bgcolor="#252525" border="1" cellpadding="1" cellspacing="2">
      <tr spry:repeat="Hisar">
      <td width="99"><div align="center" class="rm1">
        <div align="left">Hisar</div>
      </div></td>
        <td width="429" class="rm1">{title}</td>
        <td class="rm1">{artist}</td>
    </tr>
  </table>
</div>
<div spry:region="Jalandhar">
  <table width="852" align="center" bgcolor="#252525" border="1" cellpadding="1" cellspacing="2">
      <tr spry:repeat="Jalandhar">
      <td width="99"><div align="center" class="rm1">
        <div align="left">Jalandhar</div>
      </div></td>
        <td width="429" class="rm1">{title}</td>
        <td class="rm1">{artist}</td>
    </tr>
  </table>
</div>
<div spry:region="Karnal">
  <table width="852" align="center" bgcolor="#252525" border="1" cellpadding="1" cellspacing="2">
      <tr spry:repeat="Karnal">
      <td width="99"><div align="center" class="rm1">
        <div align="left">Karnal</div>
      </div></td>
        <td width="429" class="rm1">{title}</td>
        <td class="rm1">{artist}</td>
    </tr>
  </table>
</div>
<div spry:region="Ranchi">
<table width="852" align="center" bgcolor="#252525" border="1" cellpadding="1" cellspacing="2">
      <tr spry:repeat="Ranchi">
      <td width="99"><div align="center" class="rm1">
        <div align="left">Ranchi</div>
      </div></td>
        <td width="429" class="rm1">{title}</td>
        <td class="rm1">{artist}</td>
    </tr>
  </table>
</div>
<div spry:region="Varanasi">
<table width="852" align="center" bgcolor="#252525" border="1" cellpadding="1" cellspacing="2">
      <tr spry:repeat="Varanasi">
      <td width="99"><div align="center" class="rm1">
        <div align="left">Varanasi</div>
      </div></td>
        <td width="429" class="rm1">{title}</td>
        <td class="rm1">{artist}</td>
    </tr>
  </table>
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

最好的方法是使用XSLT将数据转换为html,这样就可以将每个文件指向样式表并输出所需的html