docbook-apps

xi:include file and add link to file

  • 1.  xi:include file and add link to file

    Posted 03-13-2009 12:34
    I've been converting all my books on my website to DocBook XML but ran
    into a few problems. There are many chapters where I include sample HTML
    files like this:

    <programlisting><xi:include href="samle.html"
    parse="text"/></programlisting>

    When I generate HTML files I do not only want the HTML code of sample.html
    to be included (which works fine) but also want to provide a link to the
    file (so the reader can open sample.html in the browser). Obviously I
    can't process the <xi:include> tag and fetch the filename from the href
    attribute in the DocBook XSL stylesheets as sample.html is included first.
    Now I wonder what's the best solution?

    I've been thinking of using a processing instruction - something like this:

    <programlisting><xi:include href="samle.html"
    parse="text"/></programlisting>


    As I need to set two attributes to the same value I wonder if it's
    possible to use only the processing instruction and insert the
    <programlisting> tag and the file content in the customization layer
    somehow? But then again I want to include sample.html in PDF files, too -
    using only doesn't sound like a good idea then?

    Boris