[olug] [OT] Parsing XML with command line XSLT xsltproc...

Dan Linder dan at linder.org
Tue Feb 2 04:30:21 UTC 2010


I listen to quit a few podcasts, but some of their internal MP3
title/album/etc fields messed up.  My podcatcher (bashpodder -
http://lincgeek.org/bashpodder/) uses the xsltproc command line tool
to parse the RSS feed for the URLs for the MP3s.

When I try to parse an RSS feed with my XSL file (see below), I get
only the first RSS entry field:
    xsltproc parse.xsl http://leoville.tv/podcasts/sn.xml

Any idea how to modify the XSL file to work on all RSS entries?

Once I get that, it's fairly easy to use mp3info2 to fix the internal
MP3 fields so my player shows usable information.

On a side note, this site was a good primer on XSL:
    * http://accu.org/index.php/journals/311
Any others that people have found helpful?

Thanks,

Dan

=== begin parse.xsl ===
<?xml version="1.0"?>
<!--  -->
<stylesheet version="1.0"
        xmlns="http://www.w3.org/1999/XSL/Transform">
  <output method="text"/>
  <template match="/" >
###########################
ALBUM="<value-of select="/rss/channel/title"/>"
TITLE="<value-of select="/rss/channel/item/title"/>"
FILE="<value-of select="/rss/channel/item/enclosure/@url"/>"
###########################
  </template>
</stylesheet>
=== end parse.xsl ===

-- 
***************** ************* *********** ******* ***** *** **
"Quis custodiet ipsos custodes?"
    (Who can watch the watchmen?)
    -- from the Satires of Juvenal
"I do not fear computers, I fear the lack of them."
    -- Isaac Asimov (Author)
** *** ***** ******* *********** ************* *****************



More information about the OLUG mailing list