Supplemental files and examples for this book can be found at http://examples.oreilly.com/0636920027966/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Preface
From Adobe InDesign CS2 to InDesign CS6, the ability to work with XML content has been built into every version of InDesign. Some of the useful applications are importing database content into InDesign to create catalog pages, exporting XML that will be useful for subsequent publishing processes, and building chunks of content that can be reused in multiple publications. XML is used widely with digital-first publishing workflows.
In this book, well play with the contents of a college course catalog and youll learn how you can use XML for course descriptions, tables, and other content. Underlying principles of XML structure, DTDs, and the InDesign namespace will help you develop your own XML processes. Ill touch briefly on using InDesign to skin XML content, exporting as XHTML, InCopy, and the IDML package. includes tips on using XSLT to manipulate XML in conjunction with InDesign.
In this book, I refer to InDesign CS6, and previous versions of the program back to CS3, generically as InDesign CS. When there are important differences in one versions XML features, I indicate for which version the screenshot or other information applies. Many features remain the same from one version to another. Generally, the screenshots are taken from InDesign CS6 for new content and CS5 for older content. I assume that you already know quite a bit about InDesign typographic styles and layout features because you want to use InDesign to do something with XML. In particular, I assume that you understand the role that paragraph and character styles play in consistent typography throughout an InDesign document or set of documents in the same InDesign template. (If you are new to these concepts, please refer to Adobes InDesign CS built-in HelpStyles or Peachpit Presss Real World Adobe InDesign CS6 .)
The power that XML brings to the InDesign world is summed up in the word interoperability , which means that the same content in XML format can be used in multiple applications or processesand not solely inside InDesign. XML is typically used for creating HTML for websites, but it can also be used to create rich text, PDF, or plain text files. XML does not inherently have presentation styles: the appearance of an XML file depends upon the way in which it is formatted and used by applications. The main purpose of XML is to provide a reliable structure of content so that it can be processed consistently once an application has rules for presenting the structure visually. (For more information on XML, see OReillys XML in a Nutshell , 3rd ed.)
For example, in a course catalog, there might be information that resides in a database in a set of tables (course descriptions, programs of study, faculty and staff directory, etc.). The information in the tables is the content; the way that it is organized in table columns, rows, and cells is its structure. If we save the data as XML, it becomes the structured content that we need, but now it is no longer bound to the database application. Its ready to use and reuse in other applications, including InDesign CS6.
Note
InDesign has features for importing and working with data in comma-separated-values (.csv) or tab-delimited (.txt) text format. But XML provides for a much more complex information structure to be imported into InDesign.
Well look at how and why you might want to tag content as XML in InDesign and export it to use in other applications. A theoretical workflow for XML with XSLT to create web page output will give you ideas for what you might want to do with your own InDesign documents.
XML publishing has traditionally been a process of generating PDF or HTML files from XML sources. These generated files were limited in their visual presentation and it was hard to make adjustments after they were generated. A key benefit of publishing XML with InDesign is that the full range of typographic and layout design is available. After XML is created in InDesign, tracking, hyphenation, and other controls can be applied to make the XML structure into a properly typeset document. We will look at the methods you can use to get InDesign to automatically provide the right paragraph styles when importing XML. Besides InDesigns Map Styles to Tags and Map Tags to Styles dialogs, you can go further with the use of XSLT and the namespaced XML that is part of InDesign under the hood.
About This Book and InDesign CS
The release of CS3 in May 2007 occurred almost simultaneously with the first publication of this book, which was originally published as an OReilly Short Cut. I wrote the first version of the book based on CS2 and CS3. In 2010, I updated the content for CS5. In this new version, I have updated the information and screenshots for InDesign CS6.
Chief among the features introduced in CS3 and retained through CS6 is the ability to apply XSL transformations (XSLT) to XML when importing into or exporting from InDesign. I have included some XSLT examples in , but there is much more to explore, such as the ability to automate XML processes using scripts. Scripting requires advanced understanding of both XML structures and programming, so what I cover here will just provide a taste of the possibilities.
I assume that InDesign will perform virtually the same on Mac OS X as on Windows, as Adobe makes InDesign cross-platform compatible. However, only Windows was used for the development of the test materials for this publication. If you use InDesign on a Mac or in a mixed-OS environment, there is the possibility that something might not work as described in this book.
Adobe provides for forward migrationthe ability to open a CS file in later versions than the one in which it was createdwhich appears to have no negative impact regarding XML processing. Adobe also provides backward compatibility, to some extent. You can save a CS6 file in IDML format, and most CS6 features will be available when you open the file in CS5.5. Refer to the Adobe InDesign documentation for assistance with InDesign backward-compatibility features and processes, especially the new documentation for CS6.
My intent is to help InDesign users understand how to work with XML more than to help XML users understand how to work with InDesign. Thus, I include explanations of XML that may be unnecessary for those experienced with it. I hope that XML novices will be able to follow the examples and XML experts will get ideas for venturing beyond the examples on their own.