spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / perl / graphics / chap7 / 3 To page 1To page 2current pageTo page 4To page 5
[previous] [next]

Perl Graphics Programming, Chapter 7: Creating SVG with Perl

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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>
  </slide>

That is our input XML; the output is an SVG image for the slide.

XSLT is an evolutionary child of Cascading Style Sheets (CSS) and the Extensible Stylesheet Language (XSL). XSLT defines a collection of XML elements (in the xsl namespace) that forms almost a kind of internal XML scripting language. An XSLT document is applied to a source XML document, and provides a series of rules or "templates" that match elements in the source document. Each template can add new XML elements or rearrange the source XML tree. Templates are applied to the entire source document; if a template matches an element, the rule is applied. If it doesn't match any text in the source document, the source text is passed on unmodified to the output tree.


home / programming / perl / graphics / chap7 / 3 To page 1To page 2current pageTo page 4To page 5
[previous] [next]

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint

Created: February 26, 2003
Revised: February 26, 2003

URL: http://webreference.com/programming/perl/chap7/3/3.html