Script to extract data -
Jake Peavy
djstunks at gmail.com
Thu Apr 14 21:27:43 UTC 2011
On Wed, Apr 13, 2011 at 11:54 PM, Bruno Wolff III <bruno at wolff.to> wrote:
> On Wed, Apr 13, 2011 at 16:24:36 -0400,
> Jake Peavy <djstunks at gmail.com> wrote:
> >
> > Great timing! I have been struggling to get the xpath command line tool
> to
> > do something similar with some xml I have. Can anyone solve Bob's
> question
> > with xpath? I cannot for the life of me get the xpath syntax right.
>
> I parse some xml for extracting xml data from svn when preparing upstream
> updates.
>
> I run:
> xsltproc colossus-rev.xsl -
> and colossus-rev.xsl contains:
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns="http://www.w3.org/TR/xhtml1/strict"
> xmlns:date="http://exslt.org/dates-and-times"
> extension-element-prefixes="date">
>
> <xsl:output method="text"/>
> <xsl:template match="/">
> <xsl:for-each select="entry/commit">
> <xsl:value-of select="format-number(date:year(date),'0000')"/>
> <xsl:value-of select="format-number(date:month-in-year(date),'00')"/>
> <xsl:value-of select="format-number(date:day-in-month(date),'00')"/>
> <xsl:text> </xsl:text>
> <xsl:value-of select="@revision"/>
> </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
>
> I am not really good at this stuff, I just found some examples and cobbled
> something together that worked for my case.
>
On Thu, Apr 14, 2011 at 12:20 AM, Norman Gaywood <ngaywood at une.edu.au>wrote:
> xpath bob.xml '/graph/set[@name="Actual Usage Upload"]/@value'
>
> xpath bob.xml '/graph/set[@name="Actual Usage Download"]/@value'
>
Thank you so much to both, looks great.
I could really use an XML Ninja course/book/blog for XML scraping/munging
techniques & tools. If anyone's got ideas, that would be excellent.
--
-jp
What is it that makes a complete stranger dive into an icy river to save a
solid gold baby? Maybe we'll never know.
deepthoughtsbyjackhandey.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/users/attachments/20110414/a821a48b/attachment.html
More information about the users
mailing list