OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] How to handle XML code in programlistings?


Darya Said-Akbari wrote:
> Hi, 
> 
> I would like to use <programlistingco> for some XML
> code.
> 
> Is it possible at all? 

yes, with two caveats.

The easy way.

<programlisting>
<![CDATA[
<pox/>
]]>
</programlisting>

Easy, but no markup within the programlisting element.
If you need that, you'll have to escape all your xml

s/&/&amp;/
s/</&lt;/

is not too bad.

Then you can do things like

  <example id="xslfo-CHP-2-EX-1" label="2-1">
          <title>A basic page specification</title>
          <programlisting>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt; 
            <co id="xslfo-CHP-2-EX-1.1"/>
&lt;fo:layout-master-set&gt; 
            <co id="xslfo-CHP-2-EX-1.2"/>
       &lt;fo:simple-page-master
       page-height="11in"
       page-width="8.5in"
    master-name="only"&gt; 
             <co id="xslfo-CHP-2-EX-1.3"/>
          &lt;fo:region-body
    region-name="xsl-region-body" 
             <co id="xslfo-CHP-2-EX-1.4"/>
             margin="0.7in" /&gt;
    &lt;fo:region-before 
             <co id="xslfo-CHP-2-EX-1.5"/>
             region-name="xsl-region-before"
             extent="0.7in" /&gt;
          &lt;fo:region-after
    region-name="xsl-region-after" 
             <co id="xslfo-CHP-2-EX-1.6"/>
            extent="0.7in" /&gt;
       &lt;/fo:simple-page-master&gt;
    &lt;/fo:layout-master-set&gt;
&lt;fo:page-sequence master-reference="only" format="A"&gt; 
            <co id="xslfo-CHP-2-EX-1.7"/>
       &lt;fo:flow flow-name="xsl-region-body"&gt;
       &lt;fo:block &gt;Some base content, containing an inline warning, 
            <co id="xslfo-CHP-2-EX-1.8"/>
            &lt;fo:inline &gt;Warning: &lt;/fo:inline&gt;Do not touch 
blue paper,
            a fairly straightforward piece requiring emphasis
           &lt;fo:inline font-weight="bold"&gt;TEXT&lt;/fo:inline&gt;, and
            some instructions which  require presenting in a different
            way, such as &lt;fo:inline font-style="italic"&gt;Now light
            the blue paper&lt;/fo:inline&gt;.
          &lt;/fo:block&gt;
       &lt;/fo:flow&gt;
    &lt;/fo:page-sequence&gt;
&lt;/fo:root&gt;
</programlisting>
          <calloutlist>
             <callout arearefs="xslfo-CHP-2-EX-1.1">
                <para>The <indexterm id="IXT-2-236323">
                      <primary>document
elements</primary>
                   </indexterm>document element in the
<literal>fo</literal> namespace</para>
             </callout>
             <callout arearefs="xslfo-CHP-2-EX-1.2">
                <para>The <indexterm id="IXT-2-236324">
                      <primary>layout
master</primary>
                   </indexterm>layout master, which wraps the page
specification</para>
             </callout>
             <callout arearefs="xslfo-CHP-2-EX-1.3">
                <para>The <indexterm id="IXT-2-236325">
                      <primary>pagination</primary>
                   </indexterm>page specification
with name <literal>only</literal>
                </para>
             </callout>
             <callout arearefs="xslfo-CHP-2-EX-1.4">
                <para>The main <indexterm id="IXT-2-236326">
                      <primary>body of
page</primary>
                   </indexterm>body area of the page</para>
             </callout>
             <callout arearefs="xslfo-CHP-2-EX-1.5">
                <para>The <indexterm id="IXT-2-236327">
                      <primary>header
area</primary>
                   </indexterm>header area</para>
             </callout>
             <callout arearefs="xslfo-CHP-2-EX-1.6">
                <para>The <indexterm id="IXT-2-236328">
                      <primary>footer
area</primary>
                   </indexterm>footer area</para>
             </callout>
             <callout arearefs="xslfo-CHP-2-EX-1.7">
                <para>The <literal>page-sequence</literal>, which refers to
the page specification</para>
             </callout>
             <callout arearefs="xslfo-CHP-2-EX-1.8">
                <para>Some content, wrapped in blocks and inlines, which
will appear in the output</para>
             </callout>
          </calloutlist>
       </example>



I.e. insert callouts to reference your code?
I like that. Helps explain yards of code.

HTH


regards

-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]