Re: [xsl] Re: Merging multiple RSS feeds into one RSS feed

Subject: Re: [xsl] Re: Merging multiple RSS feeds into one RSS feed
From: "Jon Gorman" <jonathan.gorman@xxxxxxxxx>
Date: Fri, 21 Apr 2006 14:05:36 -0500
> But when I look at the main.xml file in any viewer this is what I get:

If you mean browser, all I can do is repeat what I mentioned before.
How the XML result of the transformation is displayed depends on the
browser.  In IE it removes all spacing between tags, then dumps the
text (not tags or attributes) from the XML onto the browser window.
It doesn't do the same thing as if you just opened an xml file.  That
"knows" it's an xml file, I believe the XSLT process assumes the
result of transformation will be to generate html and tries to parse
it that way.  Probably a short-coming.  Also a quick test with Firefox
shows that it doesn't seem to run the document(link) although I'm not
entirely sure why.  Maybe there's some setting you can tweak on your
"viewers" to fix this poblem.

But if you run this with  with a processor like xsltproc or Saxon,
you'll notice it works.  I mentioned this last time.

> Test FeedTest Feedhttp://www.test.feedOneThis is item number
> 1http://www.test.feed

So it's doing the transformation, then processing the resulting xml by
removing spaces and newlines between tags, then getting the text
values of each element.  If you had a "view generated source" you'd
see the xml.

>
> How do I get the output from main.mxl to look like the rss feeds I am
> linking to?

Use a different browser or process.  If you're getting confused about
importing the rss feeds, don't.  Try this ultralight transform:

?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="trans.xsl"?>
<doc>
   <p>Hello</p>
</doc>

With trans.xsl being something like:
  <?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="xml" version="1.0" encoding="UTF-8" />
<xsl:template match="/">
<newdoc><xsl:apply-templates /></newdoc>
</xsl:template>

 <xsl:template match="p">
 <f>
  <xsl:apply-templates />
  </f>
  </xsl:template>
  </xsl:stylesheet>

Then if you look at the generated source (look for a plugin to do
this) you'll see the xml you expect. (Should be something like:
<newdoc><f>Hello</f></newdoc>.

I'd highly recommend against using the browser to perform transforms
if you are planning on producing XML.  In fact, I'm not quite sure
what you're expecting to do with it.  Without the appropriate plugins
it's not like you can save it.  I'd imagine you'd rather produce the
xml file so a RSS reader can actually handle it.  These would seem to
indicate a different tool than just using a browser.



Jon Gorman

Current Thread