B
Burt Lewis
Hi,
I have 2 xsl style sheets calling separate rss feeds and I use ASP to
display.
Problem is that the 1st xsl takes on the style of the 2nd xsl even
though they are different formats. I think I need to clear from memory
but not sure how. This is the code and sample outputs. They work great
on their own but when I call them both they display the same formats.
Thanks for any help.
news4.asp
<%
Function getXML(sourceFile)
dim styleFile
dim source, style
styleFile = Server.MapPath("news.xsl")
Dim xmlhttp
Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "GET", sourceFile, false
xmlhttp.Send
set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = false
source.loadxml(xmlhttp.ResponseText)
set style = Server.CreateObject("Microsoft.XMLDOM")
style.async = false
style.load(styleFile)
getXML = source.transformNode(style)
set source = nothing
set style = nothing
End Function
%>
<html>
<%= getXML("http://syndication.boston.com/news?mode=rss_10?") %>
===========
news.xsl
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="*">
<table border="1" width="100%" align="center">
<tr><td valign="top" align="center" class="title" bgcolor="silver" >
<a>
<xsl:attribute name="href">
<xsl:value-of select="*[local-name()='channel']/*[local-name()='link']"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:text>top</xsl:text>
</xsl:attribute>
<xsl:value-of select="*[local-name()='channel']/*[local-name()='title']"/>
</a>
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
<xsl:value-of select="*[local-name()='channel']/*[local-name()='lastBuildDate']"/>
</td></tr><tr><td valign="top" bgcolor="ghostwhite"
class="headlines"><font size="2">
<xsl:for-each select="//*[local-name()='item' and position() <
10]">
<a>
<xsl:attribute name="href">
<xsl:value-of select="*[local-name()='link']"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:text>top</xsl:text>
</xsl:attribute>
<xsl:value-of select="*[local-name()='title']"/>
</a>
|
</xsl:for-each>
</font></td></tr>
</table>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
Output by itself:
http://www.eastonmass.com/forum/news4.asp
==========================================
Next feed: weather3.asp
<%
Function getXML(sourceFile)
dim styleFile
dim source, style
styleFile = Server.MapPath("weather3.xsl")
Dim xmlhttp
Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "GET", sourceFile, false
xmlhttp.Send
set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = false
source.loadxml(xmlhttp.ResponseText)
set style = Server.CreateObject("Microsoft.XMLDOM")
style.async = false
style.load(styleFile)
getXML = source.transformNode(style)
set source = nothing
set style = nothing
End Function
%>
<html>
<%= getXML("http://www.rssweather.com/rss.php?c...ountry=us&county=25005&zone=MAZ017&alt=rss20a")
%>
=============
weather3.xsl
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" omit-xml-declaration="yes" indent="yes" />
<xsl:template match="*">
<table border="1" width="100%" align="center">
<tr>
<td valign="top" align="center" class="title" bgcolor="silver">
<xsl:value-of select="*[local-name()='channel']/*[local-name()='title']"
/>
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
<xsl:value-of select="*[local-name()='channel']/*[local-name()='lastBuildDate']"
/>
</td>
</tr>
<tr>
<td valign="top" bgcolor="ghostwhite" class="headlines">
<ul>
<xsl:for-each select="//*[local-name()='item' and position() <
13]">
<!--
<xsl:value-of select="*[local-name()='channel']/*[local-name()='title']"
/>
-->
<b>
<xsl:value-of select="*[local-name()='title']" />
:
</b>
<xsl:value-of select="*[local-name()='description']"
disable-output-escaping="yes" />
--
</xsl:for-each>
</ul>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
===========================
output for weather3.asp
http://www.eastonmass.com/forum/weather3.asp
===========================
Calling them both:
testboth.asp
<!--#INCLUDE FILE="news4.asp" -->
<!--#INCLUDE FILE="weather3.asp" -->
==================
output for testboth.asp
http://www.eastonmass.com/forum/testboth.asp (here's the problem)
====================================
As you can see, the news feed takes on the attributes of the weather
feed which I don't want. Appreciate any help.
I have 2 xsl style sheets calling separate rss feeds and I use ASP to
display.
Problem is that the 1st xsl takes on the style of the 2nd xsl even
though they are different formats. I think I need to clear from memory
but not sure how. This is the code and sample outputs. They work great
on their own but when I call them both they display the same formats.
Thanks for any help.
news4.asp
<%
Function getXML(sourceFile)
dim styleFile
dim source, style
styleFile = Server.MapPath("news.xsl")
Dim xmlhttp
Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "GET", sourceFile, false
xmlhttp.Send
set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = false
source.loadxml(xmlhttp.ResponseText)
set style = Server.CreateObject("Microsoft.XMLDOM")
style.async = false
style.load(styleFile)
getXML = source.transformNode(style)
set source = nothing
set style = nothing
End Function
%>
<html>
<%= getXML("http://syndication.boston.com/news?mode=rss_10?") %>
===========
news.xsl
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="*">
<table border="1" width="100%" align="center">
<tr><td valign="top" align="center" class="title" bgcolor="silver" >
<a>
<xsl:attribute name="href">
<xsl:value-of select="*[local-name()='channel']/*[local-name()='link']"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:text>top</xsl:text>
</xsl:attribute>
<xsl:value-of select="*[local-name()='channel']/*[local-name()='title']"/>
</a>
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
<xsl:value-of select="*[local-name()='channel']/*[local-name()='lastBuildDate']"/>
</td></tr><tr><td valign="top" bgcolor="ghostwhite"
class="headlines"><font size="2">
<xsl:for-each select="//*[local-name()='item' and position() <
10]">
<a>
<xsl:attribute name="href">
<xsl:value-of select="*[local-name()='link']"/>
</xsl:attribute>
<xsl:attribute name="target">
<xsl:text>top</xsl:text>
</xsl:attribute>
<xsl:value-of select="*[local-name()='title']"/>
</a>
|
</xsl:for-each>
</font></td></tr>
</table>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
Output by itself:
http://www.eastonmass.com/forum/news4.asp
==========================================
Next feed: weather3.asp
<%
Function getXML(sourceFile)
dim styleFile
dim source, style
styleFile = Server.MapPath("weather3.xsl")
Dim xmlhttp
Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "GET", sourceFile, false
xmlhttp.Send
set source = Server.CreateObject("Microsoft.XMLDOM")
source.async = false
source.loadxml(xmlhttp.ResponseText)
set style = Server.CreateObject("Microsoft.XMLDOM")
style.async = false
style.load(styleFile)
getXML = source.transformNode(style)
set source = nothing
set style = nothing
End Function
%>
<html>
<%= getXML("http://www.rssweather.com/rss.php?c...ountry=us&county=25005&zone=MAZ017&alt=rss20a")
%>
=============
weather3.xsl
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" omit-xml-declaration="yes" indent="yes" />
<xsl:template match="*">
<table border="1" width="100%" align="center">
<tr>
<td valign="top" align="center" class="title" bgcolor="silver">
<xsl:value-of select="*[local-name()='channel']/*[local-name()='title']"
/>
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
<xsl:value-of select="*[local-name()='channel']/*[local-name()='lastBuildDate']"
/>
</td>
</tr>
<tr>
<td valign="top" bgcolor="ghostwhite" class="headlines">
<ul>
<xsl:for-each select="//*[local-name()='item' and position() <
13]">
<!--
<xsl:value-of select="*[local-name()='channel']/*[local-name()='title']"
/>
-->
<b>
<xsl:value-of select="*[local-name()='title']" />
:
</b>
<xsl:value-of select="*[local-name()='description']"
disable-output-escaping="yes" />
--
</xsl:for-each>
</ul>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
===========================
output for weather3.asp
http://www.eastonmass.com/forum/weather3.asp
===========================
Calling them both:
testboth.asp
<!--#INCLUDE FILE="news4.asp" -->
<!--#INCLUDE FILE="weather3.asp" -->
==================
output for testboth.asp
http://www.eastonmass.com/forum/testboth.asp (here's the problem)
====================================
As you can see, the news feed takes on the attributes of the weather
feed which I don't want. Appreciate any help.