- From: Kirmse, Daniel <daniel.kirmse@sap.com>
- Date: Wed, 21 Jan 2004 10:01:59 +0100
- To: www-xpath-comments@w3.org
- Message-ID: <22772E6015DA354B84C6F8DB8BF60504D0ECD1@dewdfx13.wdf.sap.corp>
Hi,
is there a way to retrieve a part of a document as XML?
Suppose this document:
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//X-HIVE/Generated Public ID 101//EN" "dtd/books.dtd">
<chapter>
  <title>Data Model</title>
  <section>
    <title>Syntax For Data Model</title>
  </section>
  <section>
    <title>XML</title>
    <section>
      <title>Basic Syntax</title>
    </section>
    <section>
      <title>XML and Semistructured Data</title>
    </section>
  </section>
</chapter>
The result I have in mind is:
  <section>
    <title>XML</title>
    <section>
      <title>Basic Syntax</title>
    </section>
    <section>
      <title>XML and Semistructured Data</title>
    </section>
  </section>
By using a XPath expression like /chapter/section[child::title/text() = "XML"] I would merely navigate to the context of node "section" (Well maybe the phrasing is not right. I hope I made you understand my intention).
Do I have to use XQuery to accomplish that? Well I think I could write a XQuery expression for that example that generates the output. But what if I do not know the structure of the subtree/part of document to retrieve but only the structure of the root node of this subtree/part of document?
Thanks,
Daniel
Received on Wednesday, 21 January 2004 04:03:31 UTC