A Slide-Show Presentation

Many programs let you build presentations, the biggest and best-known of which is Microsoft’s Powerpoint. In this section we develop a program that transforms an XML file describing a slide-show presentation (slides, bullet items, etc.) into an SVG file that is the presentation.

The input file consists of a collection of any of the following six tags:

<slideshow>

The top-level tag

<slide>

A new slide in the sequence

<block>

A block can be either a line of text or a bullet list

<bulletlist>

A group of <bullet> elements

<bullet>

An indented line of text with a bullet prepended

<image>

An image to place in the upper left corner of the slide

A complete slide show file written in this format looks like Example 6-1.

Example 7-1. Sample slideshow file
<slideshow subdir="./slideshow1/"> <slide title="Perl for Graphics"> <image>http://shawn.apocabilly.org/PFG/examples/shawn.png </image> <block type="textline">Section I: File Formats</block> <block type="bulletlist"> <bullet>1. Raster Graphics Formats</bullet> <bullet>2. Efficient Multimedia with SWF</bullet> <bullet>3. The SVG format</bullet> <bullet>4. Printing with PostScript and PDF</bullet> </block> <block type="textline">Section II: Tools</block> ... </slide> <slide title="Chapter 1"> <image>http://shawn.apocabilly.org/PFG/examples/shawn.png </image> <block type="textline">Web Graphics Basics</block> <block type="bulletlist"> <bullet>Fields and Streams</bullet> <bullet>Color tables</bullet> <bullet>Transparency and alpha</bullet> ...

Get Perl Graphics Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.