docbook-apps

  • 1.  xmllint, xinclude, xpointer, and DocBook 5.0

    Posted 02-19-2008 22:44
    I'm running into a problem using xmllint to resolve xincludes
    in DocBook 5.0. I'm running xmllint 2.6.31, which I believe
    is the latest stable version, on Linux. The only argument I'm
    using on xmllint is --xinclude.

    I have no problem with a vanilla xinclude that just pulls in
    the entire file like this:

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="chap1.xml"/>

    or one that uses xpointer with the element expression like this:

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="chap1.xml"
    xpointer="element(idvalue)"/>

    But, xmllint fails if I use an xpointer expression like this:

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="chap1.xml"
    xpointer="xpointer(//chapter/title/node())"/>

    After playing around for a while, I found that xmllint will work
    with DocBook 5.0 if I remove xmlns="http://docbook.org/ns/docbook"
    from the parent element in the included file. The xmlns attribute
    is a no-op on the including file; xmllint fails whether the namespace
    is there or not.

    Since removing xmlns makes the included file invalid, doing that is
    not a practical long term solution.

    Does anyone know a way to get xmllint (or some alternate processor)
    to handle xincludes with xpointer in DocBook 5.0?

    Thanks,
    Dick Hamilton
    rlhamilton@frii.com





  • 2.  Re: [docbook-apps] xmllint, xinclude, xpointer, and DocBook 5.0

    Posted 02-20-2008 00:01
    Dick Hamilton wrote:

    > But, xmllint fails if I use an xpointer expression like this:
    >
    > <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    > href="chap1.xml"
    > xpointer="xpointer(//chapter/title/node())"/>

    Your expression //chapter/title is asking for elements which are in no
    namespace. You have to declare prefix for DocBook namespace for XPointer
    query. In theory you can use something like:

    xpointer="xmlns(db=http://docbook.org/ns/docbook)xpointer(//db:chapter/db:title/node())"

    Can you confirm whether xmllint supports this syntax?

    Jirka

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
    ------------------------------------------------------------------
    Professional XML consulting and training services
    DocBook customization, custom XSLT/XSL-FO document processing
    ------------------------------------------------------------------
    OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
    ------------------------------------------------------------------




  • 3.  RE: [docbook-apps] xmllint, xinclude, xpointer, and DocBook 5.0

    Posted 02-20-2008 00:05
    Jirka,

    That fixed it; thanks very much for your help.

    Dick

    > -----Original Message-----
    > From: Jirka Kosek [mailto:jirka@kosek.cz]
    > Sent: Tuesday, February 19, 2008 5:01 PM
    > To: Dick Hamilton
    > Cc: docbook-apps@lists.oasis-open.org
    > Subject: Re: [docbook-apps] xmllint, xinclude, xpointer, and
    > DocBook 5.0
    >
    >
    > Dick Hamilton wrote:
    >
    > > But, xmllint fails if I use an xpointer expression like this:
    > >
    > > <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    > > href="chap1.xml"
    > > xpointer="xpointer(//chapter/title/node())"/>
    >
    > Your expression //chapter/title is asking for elements which
    > are in no
    > namespace. You have to declare prefix for DocBook namespace
    > for XPointer
    > query. In theory you can use something like:
    >
    > xpointer="xmlns(db=http://docbook.org/ns/docbook)xpointer(//db
    :chapter/db:title/node())"
    >
    > Can you confirm whether xmllint supports this syntax?
    >
    > Jirka
    >
    > --
    > ------------------------------------------------------------------
    > Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
    > ------------------------------------------------------------------
    > Professional XML consulting and training services
    > DocBook customization, custom XSLT/XSL-FO document processing
    > ------------------------------------------------------------------
    > OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
    > ------------------------------------------------------------------
    >
    >