Creating RSS via XSL?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Creating RSS via XSL?

  1. #1
    Join Date
    Nov 2009
    Posts
    31

    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

  2. #2
    Join Date
    Oct 2004
    Posts
    107

    Re: Creating RSS via XSL?

    Sure, just have something like
    <xsl:apply-templates select="item[position() &lt;= 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.

  3. #3
    Join Date
    Nov 2009
    Posts
    31

    Re: Creating RSS via XSL?

    Quote Originally Posted by jkmyoung View Post
    Sure, just have something like
    <xsl:apply-templates select="item[position() &lt;= 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?

  4. #4
    Join Date
    Oct 2004
    Posts
    107

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center