How to convert XML subscription file to OPML

Discussion in 'XML' started by Desi, Jan 28, 2004.

  1. Desi

    Desi Guest

    XML gurus,

    I need help in converting my feedreader subscription XML file to an
    OPML file. I have no idea how to do that.

    Thanks in advance.
     
    Desi, Jan 28, 2004
    #1
    1. Advertising

  2. Desi wrote:

    > XML gurus,
    >
    > I need help in converting my feedreader subscription XML file to an
    > OPML file. I have no idea how to do that.


    Something like this (feedreader2opml.xsl) should do:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:eek:utput method="xml" />
    <xsl:template match="/">
    <xsl:apply-templates />
    </xsl:template>

    <xsl:template match="feeds">
    <opml version="1.0">
    <head>
    <title>Converted from feedreader subscriptions using
    feedreader2opml.xsl</title>
    </head>
    <body>
    <xsl:apply-templates />
    </body>
    </opml>
    </xsl:template>

    <xsl:template match="item">
    <outline type="rss">
    <xsl:choose>
    <xsl:when test="title/text() != ''">
    <xsl:attribute name="text"><xsl:value-of
    select="normalize-space(title/text())" /></xsl:attribute>
    <xsl:attribute name="title"><xsl:value-of
    select="normalize-space(title/text())" /></xsl:attribute>
    </xsl:when>
    <xsl:eek:therwise />
    </xsl:choose>
    <xsl:choose>
    <xsl:when test="htmlurl/text() != ''">
    <xsl:attribute name="htmlurl"><xsl:value-of
    select="normalize-space(htmlurl/text())" /></xsl:attribute>
    </xsl:when>
    <xsl:eek:therwise />
    </xsl:choose>
    <xsl:choose>
    <xsl:when test="link/text() != ''">
    <xsl:attribute name="xmlurl"><xsl:value-of
    select="normalize-space(link/text())" /></xsl:attribute>
    </xsl:when>
    <xsl:eek:therwise />
    </xsl:choose>
    </outline>
    </xsl:template>

    <xsl:template match="*" />
    </xsl:stylesheet>


    --
    Klaus Johannes Rusch

    http://www.atmedia.net/KlausRusch/
     
    Klaus Johannes Rusch, Feb 2, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kate
    Replies:
    1
    Views:
    596
    Martin Honnen
    Feb 11, 2004
  2. Tom Denford
    Replies:
    0
    Views:
    681
    Tom Denford
    Apr 22, 2005
  3. OPML help required

    , Feb 22, 2007, in forum: XML
    Replies:
    0
    Views:
    440
  4. Muness Alrubaie

    RubyConf Coverage by OPML

    Muness Alrubaie, Oct 15, 2005, in forum: Ruby
    Replies:
    2
    Views:
    114
    James Britt
    Oct 15, 2005
  5. Chris

    parsing OPML

    Chris, Apr 6, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    179
    Richard Morse
    Apr 7, 2004
Loading...

Share This Page