Re: Script to extract data -

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 13, 2011 at 11:54 PM, Bruno Wolff III <bruno@xxxxxxxx> wrote:
On Wed, Apr 13, 2011 at 16:24:36 -0400,
 Jake Peavy <djstunks@xxxxxxxxx> 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@xxxxxxxxxx> 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
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux