AW: Retrieving parts of a document

Forget about it! I finally found out how to achieve this.

 

-----Ursprüngliche Nachricht-----
Von: www-xpath-comments-request@w3.org [mailto:www-xpath-comments-request@w3.org] Im Auftrag von Kirmse, Daniel
Gesendet: Mittwoch, 21. Januar 2004 10:04
An: www-xpath-comments@w3.org
Betreff: Retrieving parts of a document

 

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 06:52:16 UTC