Unit Test: saxon.ext.001.xml

Daniel Leidert

$Id$

For this test file an article from the docbook-xsl testdocs repository was used and extended with several examples. The file is provided under same license as the docbook-xsl package.

Abstract

This is the abstract.

It has several paras. This one.

And here is another one.


This is an test for the extensions provided by the docbook-xsl-saxon extensions.

Example 1. callouts.extension

sub do_nothing_useful {
    my($a, $b, $c);
    $a = new A;                                            (1)
    $a->does_nothing_either();
    $b = new B;                                            (1)
    $c = "frog";
    return ($a, $c);                                       (2)(3)
}
  

1

These are calls to the constructor new in the object classes.

2

This function returns a two-element list.

3

The destructor (DESTROY) for the object $b will be called automatically for this object since there can be no other references to it outside this function.


Example 2. callouts.extension

#ifndef _My_Parser_h_  1 
#define _My_Parser_h_
#include "MyFetch.h"   2
class My_Parser  3
{
public:
        //
        // Construction/Destruction
        //
        My_Parser();  3
        virtual      ~My_Parser() = 0;
        virtual int  parse(MyFetch &fetcher) = 0;
};
#endif

1

Make this conditional.

2

Load necessary constants.

3

Define new class


Example 3. linenumbering.extension

The following XML code

<programlisting linenumbering="numbered">sub do_nothing_useful {
    my($a, $b, $c);
    $a = new A;
    $a->does_nothing_either();
    $b = new B;
    $c = "frog";
    return ($a, $c);
}
</programlisting>

leads to the following result:

  1 sub do_nothing_useful {
        my($a, $b, $c);
        $a = new A;
        $a->does_nothing_either();
  5     $b = new B;
        $c = "frog";
        return ($a, $c);
    }
    


Example 4. textinsert.extension

The following simply imports

#ifndef _My_Parser_h_
#define _My_Parser_h_
#include "MyFetch.h"
class My_Parser
{
public:
        //
        // Construction/Destruction
        //
        My_Parser();
        virtual      ~My_Parser() = 0;
        virtual int  parse(MyFetch &amp;fetcher) = 0;
};
#endif

Example 5. linenumbering.extension and textinsert.extension

 1 &gt;#ifndef _My_Parser_h_
 2 &gt;#define _My_Parser_h_
   &gt;#include "MyFetch.h"
 4 &gt;class My_Parser
   &gt;{
 6 &gt;public:
   &gt;        //
 8 &gt;        // Construction/Destruction
   &gt;        //
10 &gt;        My_Parser();
   &gt;        virtual      ~My_Parser() = 0;
12 &gt;        virtual int  parse(MyFetch &amp;fetcher) = 0;
   &gt;};
14 &gt;#endif
   &gt;

Example 6. callouts.extension, linenumbering.extension and textinsert.extension

  1 #ifndef _My_Parser_h_ (1)
  2 #define _My_Parser_h_
  3 #include "MyFetch.h"  (2)
  4 class My_Parser  (3)
  5 {
  6 public:
  7         //
  8         // Construction/Destruction
  9         //
 10         My_Parser();
 11         virtual      ~My_Parser() = 0;
 12         virtual int  parse(MyFetch &amp;fetcher) = 0;
 13 };
 14 #endif
 15 

1

Make this conditional.

2

Load necessary constants.

3

Define new class


I'd like to thank all the tests that came before me.