473,602 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't separate XSL styles with multiple RSS feeds

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"> &amp;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() &lt;
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"> &amp;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() &lt;
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.
Jul 20 '05 #1
2 1960
bu***@yahoo.com (Burt Lewis) wrote in message news:<e7******* *************** ****@posting.go ogle.com>...
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.


This is an ASP (and general coding style) problem, not an XSL problem.

Your ASP "testboth" is using the include mechanism to link in both ASP
fragments. This is a good idea, but the implementation isn'right.
Each include file declares a function called getXML() and then invokes
it, and the two functions are slightly different to render the two
different feeds. This won't work in ASP (or almost any programming
environment) - because the two functions have the same name, only one
of them can be "in scope" at the same time.

I suggest that you make the stylesheet a parameter to the function in
just the same way you've already done it for the feed source. Then
it'll work.

Alternatively, keep two functions but rename them as
getRSSAsHTML_Ta bleStyle() and getRSSAsHTML_Bl ockStyle() or
something like that.

Neater code might be to use three include files instead of two. Put
the function declaration in one, and put the two calls to it in the
others. That way you can use the function whenever you want - you
might even just use the include file once and place the two calls (and
their feed / stylesheet URLs) directly into the page that calls them.
Jul 20 '05 #2
Bingo!

Thank you very much for your help that was exactly what I needed.
Everything works great now.
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1280
by: Motta | last post by:
Hi I'd like a function that searches through several RSS feeds, and generates a new feed with the results. Example:
0
1470
by: milesd | last post by:
Hi, Rather new to MSXML4. I am parsing an XML data-stream over HTTP, and would like to know why I cannot parse XML nodes with multiple parameters. The XML and Code are below, BUT I would like to know how to parse individual XML nodes when tags are specified as "<FIELD NAME="collection">myVal........". The code below gives me "FIELD" as the value of the XML, not myVal.
7
6837
by: codeslayer | last post by:
Greetings to everyone in ‘forum-land': I have a problem that has plaguing me to no end. It is a CSS-related question, and I have not seen this question posted anywhere in forums or through Google search. So here is my problem: I want to use CSS to apply images as bullet styles. However, I want to be able to apply VARIOUS, MULTIPLE styles in the same document. For example, let's assume I have a set of categorized hyperlinks on a...
8
9550
by: Ryan Stewart | last post by:
Is there a way to reset the style property of an HTML element to some default or to all empty values? I have a group of elements whose style settings may be changed arbitrarily at certain points in a script (maybe set the background color and font weight of one element and the text align of another), but at another point I want to undo all of these changes and go back to the original state (which is actually all empty styles). Is there a...
6
4262
by: nboutelier | last post by:
Is it possible to apply multiple css styles to a textfield. Eg, if the value of the textfield is "foo bar" id like for 'foo' to be arial and 'bar' to be verdana. Or... id like for 'foo' to be underlined and 'bar' to be highlighted. Is this possible? -Nick
102
5640
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler can't tell where a bracket is missing.... a few weeks have past, I requested a feature for the delphi ide/editor "automatic identation of code in begin/end statements etc" and today when I woke up I suddenly released a very simple solution for this...
5
2343
by: Peter Rilling | last post by:
Okay, the other day I was talking with someone about assemblies. He said something that I am not really sure about. He said that a DLL or EXE can contain more then one assembly (although the IDE only works with one). Now, I know that assemblies can be made up of more than one file, but I have never heard about it where a single file has more then one assembly. I know that files can have more than one module, but what about assemblies? ...
3
2023
by: spolsky | last post by:
hi, it is possible to apply multiple styles as shown in the following example. <STYLE TYPE="text/css"><!-- BODY { background-color:salmon; } P { margin-left:20px; } .clsCode { font-family:"Comic Sans MS"; font-size:10pt; color:navy;}
1
2320
by: Keoki12 | last post by:
I am a real newbie when it comes to HTML and CSS programming, so please be patient with me. I have a table. In one cell, I want 3 different styles for the text: First Line: Bold, Red Second line: Bold, Black Third line Black I used <span></span> and a class to allo 2 different styles of text in one cell, but I cannot figure out how to do 3 different styles.
0
8404
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8268
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.