Menu

How to use <textdata> in DAPS?

2016-02-12
2016-02-12
  • Martin Köditz

    Martin Köditz - 2016-02-12

    Hi,

    I'm wondering if I can use the following DocBook-Code to embed source code in my documentation:

    <programlisting>
        <textobject>
            <textdata fileref="guide-structure-example.php" />
        </textobject>
    </programlisting>
    

    If I use this XML structure I'm getting this errors:

    /srv/www/htdocs/docs03.syndesk.de> daps -vv -d DC-SynDesk html
    Using MAIN file /srv/www/htdocs/docs03.syndesk.de/xml/SynDesk.xml
    ---------------
               DOC_DIR: /srv/www/htdocs/docs03.syndesk.de
             BUILD_DIR: /srv/www/htdocs/docs03.syndesk.de/build
              DAPSROOT: /usr/share/daps
               DOCCONF: /srv/www/htdocs/docs03.syndesk.de/DC-SynDesk
                  BOOK: SynDesk
    
       DOCBOOK_VERSION: 5
          DOCBOOK5_RNG: /usr/share/xml/docbook/schema/rng/5.0/docbookxi.rng
             STYLEROOT: /usr/share/xml/docbook/stylesheet/synergy2015-ns
    FALLBACK_STYLEROOT: /usr/share/xml/docbook/stylesheet/nwalsh5/1.78.1
              EPUB_CSS:
              HTML_CSS:
    
         PDF FORMATTER: fop
     FORMATTER WRAPPER: /usr/share/daps/libexec/daps-fop
      FORMATTER CONFIG:
               MAKECMD: /usr/bin/make -f /usr/share/daps/make/selector.mk -j2 -s html
         XSLTPROCESSOR: /usr/bin/xsltproc
     XML_CATALOG_FILES: /etc/xml/catalog
    
          DAPS VERSION: 2.1.5
    DB-STYLESHEET-VERS: 1.78.1
    ---------------
    Creating HTML pages
    Writing /srv/www/htdocs/docs03.syndesk.de/build/SynDesk/html/SynDesk/guide/guide-preface-de.html for preface(guide-preface-de)
    Writing /srv/www/htdocs/docs03.syndesk.de/build/SynDesk/html/SynDesk/guide/guide-constants-de.html for chapter(guide-constants-de)
    Writing /srv/www/htdocs/docs03.syndesk.de/build/SynDesk/html/SynDesk/guide/guide-doc-de.html for chapter(guide-doc-de)
    Writing /srv/www/htdocs/docs03.syndesk.de/build/SynDesk/html/SynDesk/guide/guide-git-de.html for chapter(guide-git-de)
    Cannot insert guide-structure-example.php. Check use.extensions and textinsert.extension parameters.
    make: *** [/srv/www/htdocs/docs03.syndesk.de/build/SynDesk/html/SynDesk/index.html] Fehler 10
    

    Would be great if you can help.

    Regards
    Martin

     
  • Thomas Schraitle

    Hi Martin,

    thanks for your question!

    I wouldn't recommend textdata; it is not a good idea as you need a Java extension which is only available through Saxon.

    However, there is a much better solution: use XIncludes:

    <programlisting><xi:include
        xmlns:xi="http://www.w3.org/2001/XInclude"
           href="guide-structure-example.php"
           parse="text"/></programlisting>
    

    This XInclude is resolved through the usual processing and all text inside the referenced text will be included.

    Hope that helps.

     
  • Martin Köditz

    Martin Köditz - 2016-02-12

    Thank you Thomas. This works great.

    For anyone having trouble with this: pay attention to special chars and your encoding. In my case the code was encoded in WIN1252 while the other documentation is in UTF8. So DAPS reported invalid characters. In my case the german symbols 'ö', 'ä' and 'ü'. So I corrected the encoding of my xincluded soruce code and everything is fine.

     
    • Thomas Schraitle

      Hi Martin,

      Although I would recommend to use UTF-8 throughout all files, XIncludes allows to define the encoding. Use the encoding attribute:

      <xi:include
          xmlns:xi="http://www.w3.org/2001/XInclude"
             href="guide-structure-example.php"
             encoding="win1252"
             parse="text"/>
      
       

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.