RSS and XSL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Corey

    RSS and XSL

    Dear All,

    I'm trying to use asp.net to parse in an RSS version 1.0 feed and output XML
    but I'm having trouble with the XSL file I'm trying to use. For some reason
    in the ouput of the transformation the XML namespaces are brought across
    from the XML file into the HTML. They appear as part of the <p> tag. For
    each item the <p> tag ends up being:

    <p xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
    xmlns:rdf="http ://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:foo="http ://purl.org/rss/1.0/">

    The XSL file I'm using is as follows.

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:styleshe et version="1.0"
    xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
    xmlns:rdf="http ://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:foo="http ://purl.org/rss/1.0/">
    <xsl:output method="html" omit-xml-declaration="ye s"/>
    <xsl:template match="/">
    <xsl:for-each select="rdf:RDF/foo:item">
    <p>
    <b><xsl:value-of select="foo:tit le"/></b><br/>
    Author: <xsl:value-of select="foo:des cription"/><br/>
    <a> <xsl:attribut e name="href"><xs l:value-of select="foo:lin k"/>
    </xsl:attribute>V isit the Article</a>
    </p>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    Any thoughts appreciated.

    With thanks.

    -Corey


  • Oleg Tkachenko

    #2
    Re: RSS and XSL

    Corey wrote:
    [color=blue]
    > I'm trying to use asp.net to parse in an RSS version 1.0 feed and output XML
    > but I'm having trouble with the XSL file I'm trying to use. For some reason
    > in the ouput of the transformation the XML namespaces are brought across
    > from the XML file into the HTML. They appear as part of the <p> tag. For
    > each item the <p> tag ends up being:
    >
    > <p xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
    > xmlns:rdf="http ://www.w3.org/1999/02/22-rdf-syntax-ns#"
    > xmlns:dc="http://purl.org/dc/elements/1.1/"
    > xmlns:foo="http ://purl.org/rss/1.0/">
    >
    > The XSL file I'm using is as follows.
    >
    > <?xml version="1.0" encoding="utf-8"?>
    > <xsl:styleshe et version="1.0"
    > xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
    > xmlns:rdf="http ://www.w3.org/1999/02/22-rdf-syntax-ns#"
    > xmlns:dc="http://purl.org/dc/elements/1.1/"
    > xmlns:foo="http ://purl.org/rss/1.0/">[/color]

    Add exclude-result-prefixes="rdf dc foo" attribute here.
    It's weird result has xsl namespace, are you sure?
    --
    Oleg Tkachenko
    XML Insider


    Comment

    • Corey

      #3
      Re: RSS and XSL


      "Oleg Tkachenko" <oleg@NO!SPAM!P LEASEtkachenko. com> wrote in message
      news:etq$tfWvDH A.2880@tk2msftn gp13.phx.gbl...[color=blue]
      > Corey wrote:
      >[color=green]
      > > I'm trying to use asp.net to parse in an RSS version 1.0 feed and output[/color][/color]
      XML[color=blue][color=green]
      > > but I'm having trouble with the XSL file I'm trying to use. For some[/color][/color]
      reason[color=blue][color=green]
      > > in the ouput of the transformation the XML namespaces are brought across
      > > from the XML file into the HTML. They appear as part of the <p> tag. For
      > > each item the <p> tag ends up being:
      > >
      > > <p xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
      > > xmlns:rdf="http ://www.w3.org/1999/02/22-rdf-syntax-ns#"
      > > xmlns:dc="http://purl.org/dc/elements/1.1/"
      > > xmlns:foo="http ://purl.org/rss/1.0/">
      > >
      > > The XSL file I'm using is as follows.
      > >
      > > <?xml version="1.0" encoding="utf-8"?>
      > > <xsl:styleshe et version="1.0"
      > > xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
      > > xmlns:rdf="http ://www.w3.org/1999/02/22-rdf-syntax-ns#"
      > > xmlns:dc="http://purl.org/dc/elements/1.1/"
      > > xmlns:foo="http ://purl.org/rss/1.0/">[/color]
      >
      > Add exclude-result-prefixes="rdf dc foo" attribute here.
      > It's weird result has xsl namespace, are you sure?
      > --
      > Oleg Tkachenko
      > XML Insider
      > http://www.tkachenko.com/blog
      >[/color]

      Many thanks Oleg, that was just what was needed.

      -Corey


      Comment

      Working...