Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC
ADC Home >
Developer Opportunities Using Keynote and APXL

Keynote, Apple's cutting-edge presentation application, is very popular with people who value its ease of use, its streamlined interface, and its superior templates and transitions. What you may not know is that Apple engineers were also thinking of you, the developer, when they designed Keynote. They decided to store Keynote presentations in an open XML format called APXL, a choice that gives you opportunities to create products that interact with Keynote. If you write applications for business professionals, educators, or others who rely on presentation software, you should know how to use APXL to leverage Keynote's display capabilities. This article tells you how.

Creating APXL Files

At the heart of the Keynote presentation file is the presentation.apxl file, which specifies every detail of the presentation's appearance and behavior—from the appearance of the master slide and each individual slide to the transitions used between slides and the state of the presentation when the customer first opens it.

Granted, when you look at a Keynote file, you don't see anything named presentation.apxl —but it's there. Keynote files are actually bundles, which are special folders that Finder displays as a single file icon. To view the contents of a Keynote file (or any other bundle), control-click it, select Show Package Contents from the contextual menu that appears, then open the Contents folder. You will then see the presentation.apxl file, along with other files that comprise the Keynote presentation you are examining.

As with any XML file, an APXL file consists of a series of elements, each of which may or may not include text inside it. For example, in the XML snippet below, the line marked "<!-- 2 -->" is an image element. This element has two attributes, image-data and transformation, but no text contents.

        <slide master-slide-id="master-slide-1">  <!-- 1 -->
                <title location="10 500" size="780 90" vertical-alignment
                ="tracks-master" visibility="visible"/>
                <body vertical-alignment="tracks-master" visibility="hidden"/>
                <image image-data="test.jpg" transformation="1.0 0 0 1.0 245 77"/
              >  <!-- 2 -->
            <transition-style type="inherited"/>
            <bullets>  <!-- 3 -->
                <bullet level="0" marker-type="inherited">  <!-- 4 -->
                    <content font-color="g1" font-name="Helvetica" font-size
                    ="48" paragraph-alignment="center"><![CDATA[test.jpg]]
                    ></content>  <!-- 5 -->

The structure of an APXL file is too complicated to examine here, but Apple Technical Note TN2067 lists the XML Schema file that defines the syntax of an APXL file. In addition, Apple Technical Note TN2073 describes how to create the slide-list element (as shown in the listing above), which is the main task in creating an APXL file.

Once you understand how the elements in an APXL file combine to create a Keynote presentation with the desired appearance and behavior, the process of creating a presentation.apxl file is simply that of printing a series of text strings to a file--something that you can do in virtually any programming language, although the process is much easier when you use an appropriate XML library.

The XML snippet shown above is a very small section of the presentation.apxl file created by a Java sample program named PictureShow. This program uses the Xerxes library from the Apache Project to simplify the process of creating, element-by-element, the desired XML file (in this case, the file named presentation.apxl ).

The Java snippet below, taken from but simplified somewhat for clarity and brevity, shows one way that a computer program can generate an APXL file. Note the tags, labeled 1 through 5, in both the XML and Java snippets, that help you keep track of which lines of Java code produces which lines of XML content.

    private void createImageSlide(ImageInfo sourceImage) {
        Element slide = createBlankSlide();  //1
        // createBlankSlide creates the drawables group for us.
        Element drawables = getFirstChildElementNamed(slide, "drawables");
        Element image = document.createElement("image");
        String name = sourceImage.getFile().getName();
        image.setAttribute("image-data", name);
        drawables.appendChild(image);  //2
        // Code for positioning the slide's title goes here;
        // omitted to preserve clarity.

        // Add a bullet point of level zero (the title) with the name of the
        // image file in it.
        Element bulletGroup = document.createElement("bullets");
        slide.appendChild(bulletGroup);  //3
        Element titleBullet = document.createElement("bullet");
        titleBullet.setAttribute("level", "0");
        titleBullet.setAttribute("marker-type", "inherited");
        bulletGroup.appendChild(titleBullet);  //4

        Element titleContent = document.createElement("content");
        // Code for setting the title's text attributes goes here;
        // omitted to preserve clarity.
        titleBullet.appendChild(titleContent);  //5

This code creates a blank slide (1), inserts an image element representing the file test.jpg into the drawables subelement of the slide (2), creates an empty bullets element that will contain all of the bulleted content in the slide (3), creates a bullet element and adds it to the bullets element (4), and finally adds as content to the bullet element the name of the file being displayed in the current slide (test.jpg). This snippet of XML code, when displayed as a Keynote presentation slide, instructs the Keynote application to display the slide showing the test.jpg image and, below it, the string "test.jpg".

Keynote Advantages

Keynote is a powerful application with many features that its customers enjoy. In the context of this article, however, the following capabilities are of particular interest:

  • importing and exporting PowerPoint presentations
  • importing content from QuickTime, PDF, Flash, and Adobe Photoshop and Illustrator, as well as content from any file format handled by QuickTime
  • exporting presentations as PDF documents or QuickTime movies, both of which are viewable on virtually any computer and over the Internet

Why are these capabilities of interest to you as a developer? The answer is this: Because Keynote uses an open, easily accessible file format, you can tap into the world of Keynote from within your own programs. By making Keynote part of software solutions that you create, you can offer your customers new, powerful solutions that would otherwise be impossible. This is especially true if you provide custom software solutions for vertical markets. If you develop commercial software, you may be able to find ways to use Keynote to enhance existing products or create new ones. For example, the Omni Group has enhanced its OmniOutliner outlining application by enabling it to import and export Keynote presentations, a move that makes its product more attractive to Macintosh users who also own Keynote.

Making Keynote Work for You

Before you decide what developer opportunities exist for you, it is instructive to consider the most effective uses of a Keynote presentation. Once you know that, you can better gauge the usefulness of any proposed Keynote-related software you might create.

Consider what a presentation is and why it exists. It presents a series of slides, each containing such items as text (usually as a list of bulleted items), tables of information, and graphics. Because each slide can contain only a limited amount of information, you must choose the contents of each slide carefully. Some slides contain the entirety of a body of information that would be difficult to convey verbally, while others summarize the main points of a more detailed verbal presentation. A presentation exists to convey key information, usually simultaneously, to multiple people—that is, you usually don't create a presentation unless you have information that you need to show to others. Finally, more often than not, the purpose of a presentation is to persuade more than it is to inform.

Given these observations (plus any others you may care to add), you should ask yourself, "What kinds of data do my products handle, and can any of them benefit from being delivered as a presentation?" In most cases, your products will not exclusively deliver its data as presentations, but for some data and for some situations, your product's end user will greatly value your its ability to automatically deliver data as a presentation.

Here are some questions that may help you see how you can use Keynote to make your product more effective:

  • What are the high-level data that the customer is working with? Could the customer benefit from having a presentation that uses such data?
  • Would the customer find it useful to view a subset of all the data based on given criteria?
  • Is the customer's key data in multiple locations, and would it be useful to have such data automatically collected into a presentation?
  • Is the customer's data used to persuade or to prove a point?
  • Does the customer have information that changes periodically and that must be communicated to others?
  • Would customers find it useful to deliver data to others through e-mail or CDs?
Developer Opportunities

Now that you have Keynote's strengths in mind, you can begin to look for opportunities that makes sense for you and your company. Depending on your situation, one or more of the sections immediately below may apply.

Vertical Solutions

If your company creates custom software solutions to solve a particular customer's problem, you may find several ways to use Keynote. You may use scripting language—the main contenders, Perl and Python, are conveniently shipped as part of Mac OS X—to gather data from several sources, or you may do all of your work within a "traditional" compiled programming language. In either case, your solution can package the appropriate data as a Keynote presentation. Because of Keynote's extensive exporting options, you can deliver the required data to interested parties in one of several platform-independent formats.

Database Integration

If your product stores key data in a database, you may find that you can use Keynote to display high-level, overview, or otherwise key data to its intended audience. When done properly, the data in a Keynote presentation is persuasive, professional, and easily accessible. The main factor in using Keynote to its best advantage is to use it only where it will display the right data to the right customer in the right format under the right circumstances.

4D, Inc. shows the potential of Keynote in its 4D Keynote Builder sample program. This program is a custom solution, built entirely in the 4D database language, that helps a hypothetical real estate agent to sell houses. The agent fills out a form that asks for certain characteristics of the desired house (maximum price, number of bedrooms, etc.). This program then simulates querying a "live" database of available houses and builds a Keynote presentation based on the desired criteria. The presentation, personalized with the client's name, displays a series of slides, each one showing a photograph of and information about a house that meets the client's criteria. When you realize that the real estate agent can create such custom presentations within a minute or two of typing in a few key numbers, you begin to see how Keynote, when properly used, can deliver impressive results.

If your application uses a database, it almost certainly produces reports of some kind. You may find that Keynote presentations provide a rich medium for presenting certain reports in a useful and innovative way.

Enhancing Existing Applications

The 4D Keynote Builder program gives a good example of how Keynote can enhance a vertical-solution product. Keep in mind, though, that some off-the-shelf applications can also benefit from displaying key data using Keynote. For example, a project management program could export current status data to a Keynote presentation; to make the customer's life a bit easier, it could even generate the report automatically, in time for the project's daily status meeting.

If you look over the questions in the "Making Keynote Work for You" section, you may well find some way to use Keynote that will significantly enhance your application's value to its customers.

Other Opportunities

Macintosh developers are a creative group of people who always find ways to create useful, innovative products that leverage Apple's own products. This situation will certainly repeat itself with Keynote. Keynote themes (presentation templates) are already a hot market for a few third-party developers, and others among you will find profitable niches within the Keynote ecosystem. Here are some ideas to get you started:

  • Keynote is elegantly simple, which makes it to a joy to use for most customers. However, there is always a market for product enhancements, and you may be able to devise some Keynote enhancement that customers will want.
  • Remember that the main content of a Keynote presentation is an XML file. You can analyze its content and, based on that analysis, modify it in a way that somehow enhances the presentation or does something useful.
  • You can also create a Keynote presentation programmatically; the PictureShow sample code shows how to create a slide-show presentation of images, beginning with the name of a folder that contains the images to be displayed as input.
  • In addition to the presentation.apxl file, a Keynote presentation also contains all the images used in the presentation. There are opportunities for you to develop utilities that access these images and manipulate them in some useful way.
Getting Started

If you're interested in creating a Keynote-related product or adding Keynote support to an existing one, the path for doing so is straightforward:

First (if you haven't already), learn the basics of XML. XML is finding its way into more and more projects, so achieving some level of XML literacy is probably a good idea anyway. Books and websites about XML abound, so you should have no trouble finding the materials you need. The first part of the "For Further Information" table at the end of this article also gives you some suggestions on where to start. You may also want to investigate XSLT, an XML "language" for manipulating XML data.

Second, learn the APXL format. The key documents here are Apple Technical Notes 2067 and 2073; see the table below for details. One Apple engineer reports that a good way to start learning APXL begins with you creating a simple, one-slide Keynote document. Examine its APXL code, then start adding to the code to learn how various APXL features work.

Third, decide what XML tool set you will use. Several such tools exist, but you should start by looking at the XML parsers and XSLT processors provided by the Apache and Gnome projects. See the second part of the table at the end of this article for details.

Fourth, get creative and start programming!

For Further Information

The following table lists various resources of interest, including those mentioned earlier in this article.

Resources for Learning XML
  • Beginning XML, Second Edition (various authors; published by Wrox Press)
  • XML in a Nutshell, Second Edition (by Elliotte Rusty Harold and W. Scott Means; published by O'Reilly)
  • the site offers concise tutorials on XML and related technologies
  • this O'Reilly-sponsored site is an XML portal with lots of cross-platform developer content
  • The World Wide Web Consortium: The W3 Consortium is the home of the official definitions of XML and related technologies; the definitive reference site
XML Tools
  • The Apache XML Project: Apache is the home of Xerxes (XML parser for C++ and Java) and Xalan (XSLT processor for C++ and Java), both of which can be included in commercial software
  • this site is the home of libxml (XML parser for C) and xsltlib (XSLT processor for C), both of which can be included in commercial software
Apple technical documentation for Keynote
  • Technical Note TN2067: About the Keynote XML File Format (APXL Schema); contains a link to APXL.xsd, the formal definition of the APXL file format
  • Technical Note TN2073: Deconstructing A Keynote Document: Part One - Slides; tutorial document explaining the overall structure of a Keynote document
  • PictureShow, a Java program that demonstrates how to generate a Keynote document under program control
Keynote and third-party products
  • 4D Keynote Builder; this is a standalone program that builds a custom Keynote presentation of houses for sale based on purchase criteria
  • FileMaker to Keynote Tool 1.1; FileMaker provides sample code that demonstrates one way to convert FileMaker database output to a Keynote presentation
Get information on Apple products.
Visit the Apple Store online or at retail locations.

Copyright © 2003 Apple Computer, Inc.
All rights reserved. | Terms of use | Privacy Notice