Got more questions? Find advice on: ASP | SQL | Regular Expressions | Windows
in Search
Welcome to XmlAdvice Sign in | Join | Help

Blog Aggregator: XML and XSL

Last post 07-25-2009, 16:23 by Alpdog14. 0 replies.
Sort Posts: Previous Next
  •  07-25-2009, 16:23 55402

    Blog Aggregator: XML and XSL

    I am very new to XML & XSL but I know there is a way to build blog aggregators. I have a XML document that pulls the blogs in with the URI:

    <?xml version="1.0"?>

    <!DOCTYPE feeds SYSTEM "feeds.dtd">
    <feeds>
        
         <feed name="Mary Rose's Blog"
            provider="Blogabond"
            spec="rss"
            version="2.0"
            uri="http://www.blogabond.com/rss/rss.aspx?UserID=7835">
             <keyword name="meow"/>
          
        </feed>
    </feeds>

    I also have a .xsl document that prints all the blog entries out properly:

    <?xml version="1.0"?>

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:atom="http://www.w3.org/2005/Atom"
      xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
      xmlns:georss="http://www.georss.org/georss"
      xmlns:aml="http://markup-languages.googlecode.com/ns/aml"
      version="1.0">
      

      <xsl:output method="xml" indent="yes" />
      
      <xsl:template match="/feeds" >
        <aml:aggregated>
          <xsl:for-each select="feed">
            <xsl:element name="aml:blog">
              <xsl:copy-of select="@uri"/>  
              <xsl:apply-templates select="document(@uri)" mode="document"/>
              <xsl:apply-templates select="keyword" mode="document" />
            </xsl:element>
          </xsl:for-each>
        </aml:aggregated>
      </xsl:template>
      
      <xsl:template match="rss/channel" mode="document">
        <xsl:for-each select="item">
          <xsl:sort order="descending" select="atom:updated/text()"/>
          <xsl:copy-of select="."/>
     
        </xsl:for-each>
      </xsl:template>
      
    </xsl:stylesheet>

    Now the problem I am having is sorting by the keyword I indicated in the XML document. As you can see I tried using the apply-templates but it still pulls in all the blog entries.

    Another thing I want to do is more feeds to my XML file but different feeds do not use <pubDate> so how do I convert it to actualy print the <pubDate>. Any help would be most appreciated.
View as RSS news feed in XML