Devrim E. wrote:
Thanks Hussein. This helped me understand the concept better. I am using
XMLMind 6 and when I use the copy as reference method, we have the
problem that, if new sections are added, they will not be automatically
part of the referencing doc. So I wonder if it is possible to select all
the sections under a chapter in a generic fashion.

By looking at the XPath specs, I understand this shall be possible by
using a path like chapter/section, but I wasn't able to get this
working. Is this supported?

If you have any idea to achieve this in another way, I'd be glad to hear
about that too.


Modifying by hand xincludes in order to achieve what you want is not officially supported by us. Therefore, in principle, I'm not allowed to answer your question.

This being said, an xinclude such as any of the following ones should do the trick:

---
<xi:include
   href="chapter.xml"
   xpointer="xmlns(db=http://docbook.org/ns/docbook)
             xpointer(id('ModelsAndConfiguration')/db:section)"/>
---

---
<xi:include
   href="chapter.xml"
   xpointer="xmlns(db=http://docbook.org/ns/docbook)
             xpointer(/db:chapter/db:section)"/>
---

---
<xi:include
   href="chapter.xml"
   xpointer="xmlns(db=http://docbook.org/ns/docbook)
             xpointer(/*/db:section)"/>
---

See attached book.xml and chapter.xml for a working example.
<?xml version="1.0" encoding="UTF-8"?>
<book version="5.0" xmlns="http://docbook.org/ns/docbook";
      xmlns:xlink="http://www.w3.org/1999/xlink";
      xmlns:xi="http://www.w3.org/2001/XInclude";
      xmlns:svg="http://www.w3.org/2000/svg";
      xmlns:m="http://www.w3.org/1998/Math/MathML";
      xmlns:html="http://www.w3.org/1999/xhtml";
      xmlns:db="http://docbook.org/ns/docbook";>
  <info>
    <title>Book</title>

    <author>
      <personname><firstname/><surname/></personname>

      <affiliation>
        <orgname/>
      </affiliation>
    </author>

    <pubdate/>
  </info>

  <chapter>
    <title>My chapter</title>

    <para>My paragraph.</para>

    <xi:include href="chapter.xml"
                xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('ModelsAndConfiguration')/db:section)"/>
  </chapter>
</book>

<?xml version="1.0" encoding="UTF-8"?>
<chapter version="5.0" xml:id="ModelsAndConfiguration"
         xmlns="http://docbook.org/ns/docbook";
         xmlns:xlink="http://www.w3.org/1999/xlink";
         xmlns:xi="http://www.w3.org/2001/XInclude";
         xmlns:svg="http://www.w3.org/2000/svg";
         xmlns:m="http://www.w3.org/1998/Math/MathML";
         xmlns:html="http://www.w3.org/1999/xhtml";
         xmlns:db="http://docbook.org/ns/docbook";>
  <title>Chapter 1</title>

  <section>
    <title>Section 1</title>

    <para>Paragraph 1. Paragraph 1. Paragraph 1.</para>
  </section>

  <section>
    <title>Section 2</title>

    <para>Paragraph 2. Paragraph 2. Paragraph 2.</para>
  </section>

  <section>
    <title>Section 3</title>

    <para>Paragraph 3. Paragraph 3. Paragraph 3.</para>
  </section>

  <section>
    <title>Section 4</title>

    <para>Paragraph 4. Paragraph 4. Paragraph 4.</para>
  </section>

  <section>
    <title>Section 5</title>

    <para version="5.0">Paragraph 5. Paragraph 5. Paragraph 5.</para>
  </section>
</chapter>

--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to