is this standard way of including xml into xml?

H

hilz

Hi,
I am trying to style an rss feed. i created a stylesheet, and an xml
file. i include the stylesheet and the rss feed file into my xml file.

when i open my xml file in IE, everything works fine.
when i open it in firefox, it doesn't work.

does anybody know if there is antyhing i can do to make this work in
firefox?

here are my files:

*********************
del.icio.us.xml
*********************
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE root [
<!ENTITY foo1 SYSTEM "http://del.icio.us/rss/">
]>
<?xml-stylesheet type="text/xsl" href="del.icio.us.xslt"?>
<root>
&foo1;
</root>


********************
del.icio.us.xslt
********************
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet 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:dc="http://purl.org/dc/elements/1.1/"
xmlns:foo="http://purl.org/rss/1.0/">
<xsl:template match="/">
<html>
<head/>
<body>
<table border="1">
<tr>
<th>Title</th>
<th>Link</th>
</tr>
<xsl:for-each select="//rdf:RDF/foo:item">
<tr>
<td>
<xsl:value-of select="foo:title"/>
</td>
<td>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="foo:link"/>
</xsl:attribute>
<xsl:text> </xsl:text>
<xsl:value-of select="foo:link"/>
</xsl:element>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
 
M

Martin Honnen

hilz wrote:

when i open it in firefox, it doesn't work.

does anybody know if there is antyhing i can do to make this work in
firefox?
<!DOCTYPE root [
<!ENTITY foo1 SYSTEM "http://del.icio.us/rss/">
]>

That is a problem with XML, the mechanism of such external entities is
defined but it is not mandatory to be implemented, non validating
parsers like the one Mozilla uses do not have to load such external
entities and usually don't do that.

Unless you know what kind of parsers processes the above construct
respectively you can configure the parsers used to load such external
entities you can't use it reliably.
 
P

Peter Flynn

hilz said:
Hi,
I am trying to style an rss feed. i created a stylesheet, and an xml
file. i include the stylesheet and the rss feed file into my xml file.

To answer the question in your subject line, yes.
See http://xml.silmaril.ie/authors/includes/
when i open my xml file in IE, everything works fine.
when i open it in firefox, it doesn't work.

Martin already answered this. Browser support for XML is still poor.
does anybody know if there is antyhing i can do to make this work in
firefox?

Do it server-side instead. Browser-side XML processing is not reliable
enough yet.

///Peter
 
H

hilz

Do it server-side instead. Browser-side XML processing is not reliable
enough yet.

///Peter

But i am not the owner of the server, and thus do not have access to the
server to do it server-side. I only have the url of the rss feel.

In this link you provided, it is saying that i can add the <!ENTITY ...>
defnition in the xml file without the <!DOCTYPE ...>
so if i do it this way:

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="del.icio.us.XSLT"?>
<!ENTITY foo1 SYSTEM "http://del.icio.us/rss">
<root>
&foo1;
</root>

if i do this, it doesn't work in either firefox or IE.
i get the following error in firefox:

XML Parsing Error: syntax error
Location:
file:///c:/...../del.icio.us.xml
Line Number 3, Column 1:<!ENTITY foo1 SYSTEM
"http://del.icio.us/rss/hsalameh">
^

and the following error in IE:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the
error and then click the Refresh button, or try again later.
---------------------------------------------------
Cannot have a DTD declaration outside of a DTD. Error processing
resource 'file:///C:/Documents and Settings/halim.salameh/...
<!ENTITY foo1 SYSTEM "http://del.icio.us/rss/hsalameh">
---------^


So how do i define the entity without a doctype ?

thanks
 
H

hilz

ok never mind...after reading your post and Martin's post again, i
realized that it will not work with mozilla!

thanks for your help
 
P

Peter Flynn

hilz said:
But i am not the owner of the server, and thus do not have access to
the server to do it server-side. I only have the url of the rss feel.

In this link you provided, it is saying that i can add the <!ENTITY
...> defnition in the xml file without the <!DOCTYPE ...>
so if i do it this way:

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="del.icio.us.XSLT"?>
<!ENTITY foo1 SYSTEM "http://del.icio.us/rss">

I'm sorry, I can see that my example is misleading. I'll fix it.

No, an ENTITY declaration must go in a DOCTYPE declaration.
So how do i define the entity without a doctype ?

You can't. But you don't have to have a DTD to do this. Just do

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="del.icio.us.XSLT"?>
<!DOCTYPE root [
<!ENTITY foo1 SYSTEM "http://del.icio.us/rss">
]>
<root>
&foo1;
</root>

But don't expect it to work in browsers. I can only repeat what I and
others said in case you didn't understand it: browser-side XML
processing is not reliable enough yet.

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top