Transformation with XSLT and Perl

The XML Stylesheet Language Transformations (XSLT) specification describes an XML-based scripting language that can be used to create rules for transforming one XML format into another. In some cases you may wish to use XSLT instead of a Perl-based solution. You can still use Perl to interpret the XSLT rules, however. The XSLT specification is available online at http://www.w3.org/TR/xslt.

Example 7-3 reimplements part of the slide-show generator script introduced in Chapter 6, this time using XSLT. The example uses a slightly different version of the slide XML description language discussed there.

Example 7-3. A slightly different XML slide presentation format
<slide title="Perl for Graphics"> <image>http://shawn.apocabilly.org/PFG/examples/shawn.png </image> <textline>Section I: Raster Graphics</textline> <bulletlist> <bullet>1. PNG, GIF, and JPEG</bullet> <bullet>2. Using GD</bullet> <bullet>3. Using Image::Magick</bullet> <bullet>4. Using GD::Chart</bullet> <bullet>5. Scripting Gimp plug-ins</bullet> </bulletlist> <textline>Section II: Vector graphics</textline> <bulletlist> <bullet>6. The SVG format</bullet> <bullet>7. SVG Recipes</bullet> <bullet>8. The SWF format</bullet> <bullet>9. Generating SWF files with Ming </bullet> </bulletlist> <textline>Section III: Printing formats</textline> <bulletlist> <bullet>10. PostScript and PDF</bullet> <bullet>11. Using the Postscript modules </bullet> <bullet>12. Using the Text::PDF module </bullet> </bulletlist> ...

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.