SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: XSL Help

  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XSL Help

    Hi I am trying to make a xsl stylesheet for:
    http://rss.msnbc.msn.com/id/3032091/device/rss/rss.xml

    however the <rss version="2.0"> tag screws up my sheet. How can I correct this? My sheet is below:
    Code:
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="channel">
        <html>
          <head>
            <title>Msnbc news</title>
          </head>
          <body>
            <h2>Msnbc News</h2>
              <table border="1">
                <tr bgcolor="silver">
                  <th align="left">Title</th>
                  <th align="left">URL</th>
                </tr>
                <xsl:apply-templates/>
              </table>
            </body>
          </html>
        </xsl:template>
    
        <xsl:template match="channel/item">
          <tr>
            <td><xsl:value-of select="title"/></td>
            <td><xsl:value-of select="link"/></td>
          </tr>
        </xsl:template>
      </xsl:stylesheet>
    Have a good day.

  2. #2
    Free Geek computerages's Avatar
    Join Date
    Oct 2004
    Location
    /dev/null
    Posts
    1,071
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why can't you just remove "<rss version="2.0">"?

  3. #3
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well geez, maybe because its external?
    Have a good day.

  4. #4
    SitePoint Enthusiast bjvad's Avatar
    Join Date
    Dec 2004
    Location
    Canada
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What r u using to transform it? I used IE for convenience sake. Try the following code...it seemed to work...

    Code:
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="channel">
        <html>
          <head>
            <title>Msnbc news</title>
          </head>
          <body>
            <h2>Msnbc News</h2>
              <table border="1">
                <tr bgcolor="silver">
                  <th align="left">Title</th>
                  <th align="left">URL</th>
                </tr>
                <xsl:for-each select="item">
                	<tr>
    	            <td><xsl:value-of select="title"/></td>
    	            <td><xsl:value-of select="link"/></td>
          	        </tr>
               </xsl:for-each>
              </table>
            </body>
          </html>
        </xsl:template>
    
      </xsl:stylesheet>
    Hope that'll help!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •