A quick primer: ONIX is a list of tags that we in the book trade have agreed to use to describe our books to each other. Arbitrary though they may be, the consistency prevents confusion.
Take an author’s name, for example. The people who decided on ONIX tag names could have chosen “Author Name” or “Author First Name” or “Author Last Name.” But they settled on tags like “Contributor” and “KeyNames.” So now everyone who sends or receives an ONIX message knows exactly what the data mean.
Having a lingua franca such as this is hugely helpful. Over a decade after ONIX was first introduced, it’s no wonder that, nowadays, being able to describe your books using ONIX is now an absolute necessity for any publisher, large or small.
Once you’re ONIX-compliant, your data get sent to the data aggregators, and that’s great. But if you find yourself still having to manually type data anywhere—for your catalog, for your tipsheets, in emails, into spreadsheets for customers who are not yet receiving ONIX—then ONIX can help you, too.
Not all ONIX is created equal (ironically enough, for an XML standard). For example, Amazon’s PublishToKindle requires the
Let’s have a look at how three other programs you already have on your computer can deal with ONIX.
Spreadsheets Open up Excel or another open-source spreadsheet program like LibreOffice or OpenOffice. In LibreOffice, for example, go to Data > XML source and find your ONIX file on your computer or network. You’ll see the structure of ONIX appear. With a bit of clicking, you can map the ONIX fields to spreadsheet columns. Pick out “TitleText,” “Contributor,” “RecordReference” and “PublicationDate” to get your bearings. Click OK and see your data appear in a flash.
Word Documents The same goes for Microsoft Word. In Word 2007, for instance, create a new macro from the developer tab. (To show the developer tab, go to the Office button and click “Word Options” at the bottom of the dialog box. Click “Show Developer Tab” in Ribbon.) Paste the following into it:
and load your ONIX file.
Next, create tags in the Word document where you want the XML data to go. On the Developer/Controls tab, insert four of what Word calls “plain text content controls,” which is a placeholder tag for your data, just to get started. Now, map the tags to the XML data. Create a new macro, and paste in the data here.
Run the macros in the Word doc (you’ll probably have to save it first). And voila! the fields update with the ONIX data.
Adobe InDesign Finally, let’s look at Adobe InDesign, the application many publishers use to their seasonal catalogs (among other things). InDesign handles XML pretty well.
Start by downloading this zip file, which contains an InDesign document, a sample ONIX message, some XLST to transform your ONIX into something more useable by InDesign and some images. Follow the instructions within to make a perfectly laid-out InDesign catalog magically appear. Switch out the images and ONIX with your own images and ONIX, and you’re on your way to saving a huge amount of time and effort, every season.
There are more things you can do with ONIX, to be sure. At a very low level, try opening an ONIX file in a proper text editor such as TextWrangler or TextMate. The syntax highlighting helps you see which bits are data and which bits are tags, and a decent text editor will indent XML nicely so you have half a hope of being able to read it.
In the InDesign example above, we used XSLT to transform our ONIX into another sort of XML, using InDesign as a processor. You don’t need to use InDesign, though; you can convert ONIX into another sort of XML—including XHTML (yes, web pages!)—using XLST and SAXON on the command line or even a web-based processor such as this one.
Because XML is, by its nature, structured, you can manipulate it with very simple programming to remove, modify and copy elements. For instance, you can use the Ruby Nokogiri gem to manipulate ONIX to your heart’s content—to add agency pricing, for instance, or to set the UK GBP price from the USD price by applying business rules.
At the moment, we here at Consonance are writing a Shopify app to allow the import of ONIX into the e-commerce platform.
All this manipulation can be a bind, of course, and if your bibliographic data management system is any good, you’ll be able to export data directly from it into whatever format you need, whether that’s a 1,000-page PDF catalog, a cut-down XML feed for InDesign to handle with less fuss, the Samsung ebook spreadsheet or CoreSource-flavored ONIX. But it’s still very useful to be familiar with ONIX terms, and playing around with importing it into a variety of programs can be both enlightening and productive.
But be warned: it’s very moreish. Once you get a glimpse into the sort of world where you can create a thousand catalog entries or a back-list order form with a single click, there’s no going back…