December 6th, 2009 03:05 PM
#1
Creating RSS via XSL?
I document chnages to my website in news.xml with the following format:
Code:
<!DOCTYPE news [
<!ELEMENT news (item*)>
<!ELEMENT item (title,date,detail)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT date (dow,year,month,day)>
<!ELEMENT dow (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT month (#PCDATA)>
<!ELEMENT day (#PCDATA)>
<!ELEMENT detail (#PCDATA)>
]>
if need I can retrofit it with an link element (i current generate a link field via PHP form the existing data)
I would like to Add a RSS feed to the site But I don't want to have to update a second file ever time I make a site update
Is it possible to make a valid RSS feed the uses say xsl transform of the first 10 entries in news.xml?
Last edited by Roguebfl; January 12th, 2010 at 04:45 PM .
Reason: correcting the DTD
February 24th, 2010 02:44 PM
#2
Re: Creating RSS via XSL?
Sure, just have something like
<xsl:apply-templates select="item[position() <= 10]"/>
I'm assuming somewhere in the header of the RSS you have a preprocessing directive like:
<?xml-stylesheet type="text/xsl" href="firstTenItems.xsl"?>
Last edited by jkmyoung; February 24th, 2010 at 02:48 PM .
February 24th, 2010 07:47 PM
#3
Re: Creating RSS via XSL?
Originally Posted by
jkmyoung
Sure, just have something like
<xsl:apply-templates select="item[position() <= 10]"/>
I'm assuming somewhere in the header of the RSS you have a preprocessing directive like:
<?xml-stylesheet type="text/xsl" href="firstTenItems.xsl"?>
my big question is if I had such a line, would browsers and reads reconginze it as an RSS feed?
February 26th, 2010 10:47 AM
#4
Re: Creating RSS via XSL?
Upon trying with a simple mechanism, perhaps not; XSLT transformations are implicitly cast to html. Have also tried to create a page which runs the transformation, but the output is still only recognized as HTML.
Sorry, I don't know if there is such a mechanism without having your server create the second file.
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks