473,722 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simple rdf to html doesn't work

I have the following feed which I want to convert to html:
http://www.heise.de/newsticker/heise.rdf but it does not work, I only see
the html elements empty as if it found no elements in the xml file, whereas
the feed http://www.golem.de/rss.php?feed=RSS1.0 works perfectly although I
annot see any difference in the file structure.
This is my xsl file:

<?xml version="1.0" encoding="utf-8" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http ://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rss="http ://purl.org/rss/1.0/"
xmlns="http://www.w3.org/1999/xhtml"

<xsl:output method="html" />
<xsl:template match="/rdf:RDF">
<html>
<head>
<title>
<xsl:value-of select="/rdf:RDF/rss:channel/rss:title" />
</title>
</head>
<body>
<h2>
<xsl:value-of select="/rdf:RDF/rss:channel/rss:title" />
</h2>
<a href="{rss:chan nel/rss:link}">
<xsl:value-of select="rss:cha nnel/rss:link" />
</a>
<br />
<xsl:apply-templates select="rss:cha nnel/rss:image" />
<br />
<xsl:value-of select="rss:cha nnel/rss:date" />
<br />
<xsl:value-of select="rss:cha nnel/rss:description " />
<br />
<xsl:apply-templates select="rss:ite m" />
</body>
</html>
</xsl:template>
<xsl:template match="rss:imag e">
<img src="{@rdf:reso urce}" />
</xsl:template>
<xsl:template match="rss:item ">
<h3>
<a href="{rss:link }">
<xsl:value-of select="rss:tit le" />
</a>
</h3>
<xsl:value-of select="rss:des cription" disable-output-escaping="yes" />
<font size="-1" color="808080">
<br />
<xsl:value-of select="rss:lin k" />
<br />
<xsl:value-of select="rss:dat e" />
</font>
</xsl:template>
</xsl:stylesheet>
Nov 12 '05 #1
4 1474
* cody wrote in microsoft.publi c.dotnet.xml:
I have the following feed which I want to convert to html:
http://www.heise.de/newsticker/heise.rdf but it does not work, I only see
the html elements empty as if it found no elements in the xml file, whereas
the feed http://www.golem.de/rss.php?feed=RSS1.0 works perfectly although I
annot see any difference in the file structure.
The namespaces are different. With
xmlns:rss="htt p://purl.org/rss/1.0/"
this declaration you bind the namespace "http://purl.org/rss/1.0/" to
the prefix "rss", so the
<xsl:value-of select="/rdf:RDF/rss:channel/rss:title" />


rss:channel node test would select "channel" elements in the
"http://purl.org/rss/1.0/" namespace. In the Heise RSS feed the
"channel" element is in the http://my.netscape.com/rdf/simple/0.9/
namespace, and

{"http://purl.org/rss/1.0/", "channel"}
{"http://my.netscape.com/rdf/simple/0.9/", "channel"}

are different elements. See

http://msdn.microsoft.com/library/en...ml05202002.asp
http://www.rpbourret.com/xml/NamespacesFAQ.htm
http://msdn.microsoft.com/msdnmag/issues/01/07/xml/
http://www.google.com/search?q=xml+namespaces

for details.
--
Björn Höhrmann · mailto:bj****@h oehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Nov 12 '05 #2
OK I understand. As I read in your links, the same prefix cannot be in more
than one namespace at the same time.But how can I solve this issue? I do not
want to create 2 xsl files differing only in the namespace declaration.
"Bjoern Hoehrmann" <bj****@hoehrma nn.de> schrieb im Newsbeitrag
news:43******** ********@news.b joern.hoehrmann .de...
* cody wrote in microsoft.publi c.dotnet.xml:
I have the following feed which I want to convert to html:
http://www.heise.de/newsticker/heise.rdf but it does not work, I only see
the html elements empty as if it found no elements in the xml file,
whereas
the feed http://www.golem.de/rss.php?feed=RSS1.0 works perfectly although
I
annot see any difference in the file structure.


The namespaces are different. With
xmlns:rss="ht tp://purl.org/rss/1.0/"


this declaration you bind the namespace "http://purl.org/rss/1.0/" to
the prefix "rss", so the
<xsl:value-of select="/rdf:RDF/rss:channel/rss:title" />


rss:channel node test would select "channel" elements in the
"http://purl.org/rss/1.0/" namespace. In the Heise RSS feed the
"channel" element is in the http://my.netscape.com/rdf/simple/0.9/
namespace, and

{"http://purl.org/rss/1.0/", "channel"}
{"http://my.netscape.com/rdf/simple/0.9/", "channel"}

are different elements. See

http://msdn.microsoft.com/library/en...ml05202002.asp
http://www.rpbourret.com/xml/NamespacesFAQ.htm
http://msdn.microsoft.com/msdnmag/issues/01/07/xml/
http://www.google.com/search?q=xml+namespaces

for details.
--
Björn Höhrmann · mailto:bj****@h oehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

Nov 12 '05 #3
* cody wrote in microsoft.publi c.dotnet.xml:
OK I understand. As I read in your links, the same prefix cannot be in more
than one namespace at the same time.But how can I solve this issue? I do not
want to create 2 xsl files differing only in the namespace declaration.


You could change the XPath expressions to consider multiple namespaces,
instead of rss:channel you could use *[local-name() = 'channel' and
(namespace-uri() = '...' or namespace-uri() = '...')] but that's not
really a good approach here. You could also use http://feedparser.org/
to parse RSS and probably even convert between formats. Otherwise I
guess using multiple XSLT documents is the best option here.
--
Björn Höhrmann · mailto:bj****@h oehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Nov 12 '05 #4
"Bjoern Hoehrmann" <bj****@hoehrma nn.de> schrieb im Newsbeitrag
news:42******** *******@news.bj oern.hoehrmann. de...
* cody wrote in microsoft.publi c.dotnet.xml:
OK I understand. As I read in your links, the same prefix cannot be in
more
than one namespace at the same time.But how can I solve this issue? I do
not
want to create 2 xsl files differing only in the namespace declaration.


You could change the XPath expressions to consider multiple namespaces,
instead of rss:channel you could use *[local-name() = 'channel' and
(namespace-uri() = '...' or namespace-uri() = '...')] but that's not
really a good approach here.


That is cool thank you :)
Nov 12 '05 #5

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

Similar topics

16
2901
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed loaded into cache, the slideshow doesn't look very nice. I am not sure how/when to call the slideshow() function to make sure it starts after the preload has been completed.
7
1769
by: J. Hall | last post by:
Hi dudes, Got a simple webpage, with three numeric text input boxes, the idea being that the user is asked to insert percentages of their business around the world... UK, Europe, Other Obviously this mustn't exceed 100% and so I OnChange I simply want to check that all three boxes have a value, and if so sum them up and alert the user
13
2363
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if (document.getElementById"].value=='1') { confirm('Are you sure you want to delete this file?'); } } ......
5
4180
by: Le, Thanh-Nhan | last post by:
Hi, I want to send a simple mail with C#. I have tried the following, but they don't work: - some solutions on CodeProject websites. - shellExecute(mailto:xxx@yyy.com?subject=aaa&body=bbb). Thanks for help TNL
0
1731
by: pepsi | last post by:
Hello, I would suggest a simple div tag... you could assign it a id and runat server. It should work. pepsi >-----Original Message----- >Hi gang. I tried posting this under a different topic
0
1892
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
10
2373
by: serge calderara | last post by:
Dear all, I need to build a web application which will contains articles (long or short) I was wondering on what is the correct way to retrive those article on web page. In orther words, when there is such information to be displayed are they coming from imported files, database ? Where and how this type of information is stored ? What is the way to retrieve such information in order to display it in page ?
73
4614
by: Claudio Grondi | last post by:
In the process of learning about some deeper details of Python I am curious if it is possible to write a 'prefix' code assigning to a and b something special, so, that Python gets trapped in an endless loop in a line with: if a==b: print 'OK' I mean, it would be of much help to me on my way to understanding Python to know how such prefix code leading to an endless loop can look like and if it is eventually not possible to write such...
3
3799
by: Joe | last post by:
Hi, I have a simple thing I need to do but just doesn't work in VB.NET. I have a string with HTML code and I want to load it into a HTMLDocument object or something similiar to it so I can access the the tags and tags value (<td> <table>, etc) by code. But it just doesn't work in VB.NET but works in VB6. Please someone just show me the right way to do this simple thing.
7
1779
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the problem is with this code, it just simply won't work properly. Some of the functions aren't done, but the main one gives me a Not a Number message in the text box where the calculations are supposed to come up. I tried to use a parseInt on my stuff,...
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
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...
0
9088
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
8052
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
6681
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
5995
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();...
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.