[Omaha.pm] [OT] Parsing XML with command line XSLT xsltproc...

Dave Burchell evaddnomaid at gmail.com
Tue Feb 2 06:14:19 PST 2010


Maybe try changing

<template match="/" >

to

<template match="//item" >

and change

TITLE="<value-of select="/rss/channel/item/title"/>"
FILE="<value-of select="/rss/channel/item/enclosure/@url"/>"

to

TITLE="<value-of select="title"/>"
FILE="<value-of select="enclosure/@url"/>"

(not tested)

- Dave


On Mon, Feb 1, 2010 at 10:30 PM, Dan Linder <dan at linder.org> wrote:

> 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)
> ** *** ***** ******* *********** ************* *****************
> _______________________________________________
> Omaha-pm mailing list
> Omaha-pm at pm.org
> http://mail.pm.org/mailman/listinfo/omaha-pm
>



-- 
Dave Burchell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/omaha-pm/attachments/20100202/e33c5c67/attachment.html>


More information about the Omaha-pm mailing list