Newbie : XPath query question

Discussion in 'XML' started by Kora.Jaki@gmail.com, Jun 21, 2007.

  1. Guest

    I have the following xml document -

    <bookstore>
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <bookstore>

    <book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>

    <book category="CHILDREN">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
    </book>

    <book category="WEB">
    <title lang="en">XQuery Kick Start</title>
    <author>James McGovern</author>
    <year>2003</year>
    <price>49.99</price>
    </book>

    <book category="WEB">
    <title lang="en">Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
    </book>

    </bookstore>

    Using XPath could I get a list of values with title and author for
    each book ? What I would like returned is several lines of "title,
    author" values.

    Thanks.

    --
    Kora
    , Jun 21, 2007
    #1
    1. Advertising

  2. wrote:
    > Using XPath could I get a list of values with title and author for
    > each book ? What I would like returned is several lines of "title,
    > author" values.


    XPath: Not by itself; it can retrieve the data but assembling it into
    lines is outside XPath's scope.

    XSLT or XQuery can do this easily. Or XPath plus a bit of user code.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
    Joe Kesselman, Jun 22, 2007
    #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. Marvin_123456

    "Memory leak" in javax.xml.xpath.XPath

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    1,964
    jan V
    Jul 29, 2005
  2. Alastair Cameron
    Replies:
    1
    Views:
    7,391
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  3. Anna
    Replies:
    0
    Views:
    519
  4. Victor
    Replies:
    1
    Views:
    349
    Philippe Poulard
    Feb 18, 2004
  5. David Gordon

    xpath query query

    David Gordon, May 18, 2005, in forum: XML
    Replies:
    2
    Views:
    786
    David Gordon
    May 18, 2005
Loading...

Share This Page