This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: Need help including c source
- To: Bob Stayton <bobs at caldera dot com>
- Subject: Re: DOCBOOK-APPS: Need help including c source
- From: Eric Richardson <eric dot richardson at milagrosoft dot com>
- Date: Thu, 18 Oct 2001 17:26:35 -0700
- Cc: ydirson at alcove dot fr, docbook-apps at lists dot oasis-open dot org
- List-Id: <docbook-apps.lists.oasis-open.org>
- Organization: MilagroSoft Inc.
- References: <10110181043.aa18508@mammoth.ca.caldera.com>
Bob Stayton wrote:
>>From: Yann Dirson <ydirson@alcove.fr>
>>
>>On Thu, Oct 18, 2001 at 09:12:49AM -0700, Eric Richardson wrote:
>>
>>>I'm trying to include C source into docbook but I'm having problems with
>>>the #include <stdio.h>. I really would like to have the source compile
>>>as is and include as is into the document.
>>>
>>Instead of using an entity, you can use:
>>
>><imagedata fileref="foo.c" format="linespecific">
>>
>>That roughly means, consider foo.c as an image encoded in the
>>"linespecific" format - not a common way of looking at things, but
>>semantically correct I think.
>>
>>docbook-dsssl 1.73 should work out-of-the box with this construct, I
>>don't know for sure about docbook-xsl, which I don't use.
>>
>
> Docbook-xsl should handle it if you are using Saxon or
> Xalan processors, but not libxslt yet. It requires
> setting the params 'use.extensions' and
> 'textinsert.extension' to 1 so the text
> insertion extensions in Saxon or Xalan will be utilized.
>
> Without the extensions, the XSL output looks like this:
>
> <div class="mediaobject"><a type="simple" show="embed"
> actuate="onLoad" href="foo.c"></a></div>
>
> This is a bit of a hybrid between HTML and XLink,
> since HTML doesn't have 'show' or 'actuate' attributes
> for the <A> element. Since a browser won't 'show'
> the link, and since the <A> element contains no
> text, this is an invisible link.
I decided to give this approach a try.
**I put the following in my source.
<figure>
<title>C Source</title>
<programlisting><filename>myfunc.c</filename>
<inlinemediaobject>
<imageobject>
<imagedata fileref="myfunc.c" format="linespecific"/>
</imageobject>
</inlinemediaobject>
</programlisting>
</figure>
<para>FOO</para>
<mediaobject>
<imageobject>
<imagedata fileref="myfunc.c" format="linespecific"/>
</imageobject>
</mediaobject>
**Put the in my drivers/customization layer
<xsl:param name="use.extensions" select="'1'" />
<xsl:param name="textinsert.extension" select="'1'"/>
**Added docbook-xsl/extensions/xalan2.jar to my classpath. I'm using
xalan-j_2_2_D6 for now.
**Now I get the following visual output.
Figure 1. C Source
myfunc.c
org.apache.xpath.NodeSet@302efa
FOO
org.apache.xpath.NodeSet@5c57db
**Or source
<div class="figure"><p><b>Figure 1. C Source</b></p>
<pre class="programlisting"><tt>myfunc.c</tt>
org.apache.xpath.NodeSet@302efa
</pre></div><p>FOO</p><div
class="mediaobject">org.apache.xpath.NodeSet@5c57db</div>
Seems to be getting close. Any ideas?
Thanks,
Eric
----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>