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(sourceFi le)
dim styleFile
dim source, style
styleFile = Server.MapPath( "news.xsl")
Dim xmlhttp
Set xmlhttp = Server.CreateOb ject("Microsoft .XMLHTTP")
xmlhttp.Open "GET", sourceFile, false
xmlhttp.Send
set source = Server.CreateOb ject("Microsoft .XMLDOM")
source.async = false
source.loadxml( xmlhttp.Respons eText)
set style = Server.CreateOb ject("Microsoft .XMLDOM")
style.async = false
style.load(styl eFile)
getXML = source.transfor mNode(style)
set source = nothing
set style = nothing
End Function
%>
<html>
<%= getXML("http://syndication.bos ton.com/news?mode=rss_1 0?") %>
===========
news.xsl
<?xml version="1.0" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="ye s" indent="yes"/>
<xsl:template match="*">
<table border="1" width="100%" align="center">
<tr><td valign="top" align="center" class="title" bgcolor="silver " >
<a>
<xsl:attribut e name="href">
<xsl:value-of select="*[local-name()='channel ']/*[local-name()='link']"/>
</xsl:attribute>
<xsl:attribut e 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()='lastBui ldDate']"/>
</td></tr><tr><td valign="top" bgcolor="ghostw hite"
class="headline s"><font size="2">
<xsl:for-each select="//*[local-name()='item' and position() <
10]">
<a>
<xsl:attribut e name="href">
<xsl:value-of select="*[local-name()='link']"/>
</xsl:attribute>
<xsl:attribut e 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(sourceFi le)
dim styleFile
dim source, style
styleFile = Server.MapPath( "weather3.x sl")
Dim xmlhttp
Set xmlhttp = Server.CreateOb ject("Microsoft .XMLHTTP")
xmlhttp.Open "GET", sourceFile, false
xmlhttp.Send
set source = Server.CreateOb ject("Microsoft .XMLDOM")
source.async = false
source.loadxml( xmlhttp.Respons eText)
set style = Server.CreateOb ject("Microsoft .XMLDOM")
style.async = false
style.load(styl eFile)
getXML = source.transfor mNode(style)
set source = nothing
set style = nothing
End Function
%>
<html>
<%= getXML("http://www.rssweather. com/rss.php?config= &forecast=zandh &place=south+ea ston&state=ma&z ipcode=02375&co untry=us&county =25005&zone=MAZ 017&alt=rss20a" )
%>
=============
weather3.xsl
<?xml version="1.0" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="ye s" 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()='lastBui ldDate']"
/>
</td>
</tr>
<tr>
<td valign="top" bgcolor="ghostw hite" class="headline s">
<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()='descrip tion']"
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.