docbook-apps

  • 1.  Reusing

    Posted 04-09-2007 21:23
    I often need to reuse <chapter> and
    from one document in other
    documents. Frequently, I find that the content that I am reusing is a
    in one book and must be at the top level of another book.
    Because
    is not allowed at the top level of <book> and
    <chapter> cannot occur anywhere except in <book>, I have trouble reusing
    the content of sections and chapters in other documents. Specifically,
    I need to include the content of a <chapter> element as a child of a
    element. Also I need to include the content of a

    element as a child of <book>.

    Reading Chapter 22. Modular DocBook files in DocBook XSL led me to
    believe that the following xi:include could solve the problem for me. I
    expect it to include every child element of a
    element in the
    <chapter> element.

    <chapter>
    <xi:include href="docbook-file-containing-the-modular-content.xml"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xpointer="element(IdOfTheSectionElement/*)" />
    </chapter>

    But the xi:include fails. I use xmllint to resolve xi:includes. It
    gives the following errors:

    docbook-file-that-is-including.xml:11: element include: XInclude error :
    XPointer evaluation failed: #element(IdOfTheSectionElement/*)
    docbook-file-that-is-including.xml:11: element include: XInclude error :
    could not load docbook-file-containing-the-modular-content.xml, and no
    fallback was found

    Is my xpointer syntax incorrect? Other xi:includes from the same source
    file resolved without any trouble (they include entire elements).

    Is there a better way to reuse
    and <chapter> elements in each
    other's hierarchical places?

    In case it matters, here's my xmllint version:

    $ xmllint --version
    xmllint: using libxml version 20626
    compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1
    FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv
    ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug


    Thanks for your help!

    Peter Desjardins



  • 2.  RE: [docbook-apps] Reusing

    Posted 04-10-2007 13:39
    Try this:

    <chapter>
    <xi:include href="docbook-file-containing-the-modular-content.xml"
    xmlns:xi="http://www.w3.org/2001/XInclude"

    xpointer="xpointer(//section[@id='IdOfTheSectionElement']/*)"/>
    </chapter>

    David

    > Reading Chapter 22. Modular DocBook files in DocBook XSL led
    > me to believe that the following xi:include could solve the
    > problem for me. I expect it to include every child element
    > of a
    element in the <chapter> element.
    >
    > <chapter>
    > <xi:include href="docbook-file-containing-the-modular-content.xml"
    > xmlns:xi="http://www.w3.org/2001/XInclude"
    > xpointer="element(IdOfTheSectionElement/*)"
    > /> </chapter>
    >
    > But the xi:include fails. I use xmllint to resolve
    > xi:includes. It gives the following errors:
    >
    > docbook-file-that-is-including.xml:11: element include:
    > XInclude error :
    > XPointer evaluation failed: #element(IdOfTheSectionElement/*)
    > docbook-file-that-is-including.xml:11: element include:
    > XInclude error :
    > could not load
    > docbook-file-containing-the-modular-content.xml, and no
    > fallback was found
    >
    > Is my xpointer syntax incorrect? Other xi:includes from the
    > same source file resolved without any trouble (they include
    > entire elements).
    >
    > Is there a better way to reuse
    and <chapter>
    > elements in each other's hierarchical places?
    >
    > In case it matters, here's my xmllint version:
    >
    > $ xmllint --version
    > xmllint: using libxml version 20626
    > compiled with: Threads Tree Output Push Reader Patterns
    > Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath
    > XPointer XInclude Iconv ISO8859X Unicode Regexps Automata
    > Expr Schemas Schematron Modules Debug
    >
    >
    > Thanks for your help!
    >
    > Peter Desjardins
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail:
    > docbook-apps-help@lists.oasis-open.org
    >
    >



  • 3.  RE: [docbook-apps] Reusing

    Posted 04-10-2007 15:52
    That xpointer did work perfectly. Thank you!

    This may be a question for the docbook list but is this a common problem
    encountered when reusing content? I've run into it many times when
    making short excerpts of material in larger technical references.

    Now I have a working solution so I'm happy. XMLMind won't accept the
    syntax of the xpointer but since I'm actually writing the content in
    other documents it doesn't matter.

    Peter Desjardins

    >


  • 4.  RE: [docbook-apps] Reusing

    Posted 04-10-2007 16:35
    I too have run into the same problem and resorted to using xincludes to
    import all of the required paragraphs... It works but it is a pain.

    >