This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: Need help including c source
Norman Walsh wrote:
> / Eric Richardson <eric.richardson@milagrosoft.com> was heard to say:
| **Added docbook-xsl/extensions/xalan2.jar to my classpath. I'm using
> | xalan-j_2_2_D6 for now.
>
Thanks for the quick response. I found that it is very close. The first
markup works except for some extra leading whitespace on the first line
so perhaps I need to left justify the imagedata tag. The second way has
no pre and perhaps that is okay?
**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>
**Result
<div class="figure"><p><b>Figure 1.1. C Source</b></p><pre
class="programlisting"><tt>myfunc.c</tt>
#include <stdio.h> *** indented here ***
int myfunc(int value) {
if (value == 4) {
return 0;
}
return 1;
}
int main() {
int error = myfunc(4);
if (error != 0) {
/* handle problem */
printf("myfunc problem\n");
}
/* continue */
printf("myfunc okay\n");
error = myfunc(3);
if (error != 0) {
printf("myfunc problem\n");
}
return 0;
}
</pre></div><p>FOO</p><div class="mediaobject">#include
<stdio.h>
int myfunc(int value) {
if (value == 4) {
return 0;
}
return 1;
}
int main() {
int error = myfunc(4);
if (error != 0) {
/* handle problem */
printf("myfunc problem\n");
}
/* continue */
printf("myfunc okay\n");
error = myfunc(3);
if (error != 0) {
printf("myfunc problem\n");
}
return 0;
}
</div>
Eric
----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>